├── .gitignore ├── LICENSE ├── README.md ├── bzb20250417.sql ├── config.properties ├── docker-compose.yml ├── douyidou-common ├── pom.xml └── src │ └── main │ └── java │ └── cc │ └── douyidou │ └── common │ ├── annotation │ ├── Anonymous.java │ ├── DataScope.java │ ├── DataSource.java │ ├── Excel.java │ ├── Excels.java │ ├── Log.java │ ├── RateLimiter.java │ ├── RepeatSubmit.java │ └── Sensitive.java │ ├── config │ ├── RuoYiConfig.java │ └── serializer │ │ └── SensitiveJsonSerializer.java │ ├── constant │ ├── CacheConstants.java │ ├── Constants.java │ ├── GenConstants.java │ ├── HttpStatus.java │ ├── ScheduleConstants.java │ └── UserConstants.java │ ├── core │ ├── controller │ │ └── BaseController.java │ ├── domain │ │ ├── AjaxResult.java │ │ ├── BaseEntity.java │ │ ├── R.java │ │ ├── TreeEntity.java │ │ ├── TreeSelect.java │ │ ├── entity │ │ │ ├── SysDept.java │ │ │ ├── SysDictData.java │ │ │ ├── SysDictType.java │ │ │ ├── SysMenu.java │ │ │ ├── SysRole.java │ │ │ └── SysUser.java │ │ └── model │ │ │ ├── LoginBody.java │ │ │ ├── LoginUser.java │ │ │ └── RegisterBody.java │ ├── page │ │ ├── PageDomain.java │ │ ├── TableDataInfo.java │ │ └── TableSupport.java │ ├── redis │ │ └── RedisCache.java │ └── text │ │ ├── CharsetKit.java │ │ ├── Convert.java │ │ └── StrFormatter.java │ ├── enums │ ├── BusinessStatus.java │ ├── BusinessType.java │ ├── DataSourceType.java │ ├── DesensitizedType.java │ ├── HttpMethod.java │ ├── LimitType.java │ ├── OperatorType.java │ └── UserStatus.java │ ├── exception │ ├── DemoModeException.java │ ├── GlobalException.java │ ├── ServiceException.java │ ├── UtilException.java │ ├── base │ │ └── BaseException.java │ ├── file │ │ ├── FileException.java │ │ ├── FileNameLengthLimitExceededException.java │ │ ├── FileSizeLimitExceededException.java │ │ ├── FileUploadException.java │ │ └── InvalidExtensionException.java │ ├── job │ │ └── TaskException.java │ └── user │ │ ├── BlackListException.java │ │ ├── CaptchaException.java │ │ ├── CaptchaExpireException.java │ │ ├── UserException.java │ │ ├── UserNotExistsException.java │ │ ├── UserPasswordNotMatchException.java │ │ └── UserPasswordRetryLimitExceedException.java │ ├── filter │ ├── PropertyPreExcludeFilter.java │ ├── RepeatableFilter.java │ ├── RepeatedlyRequestWrapper.java │ ├── XssFilter.java │ └── XssHttpServletRequestWrapper.java │ ├── sensitive │ ├── Sensitive.java │ ├── SensitiveSerialize.java │ └── SensitiveTypeEnum.java │ ├── utils │ ├── Arith.java │ ├── DateUtils.java │ ├── DesensitizedUtil.java │ ├── DictUtils.java │ ├── ExceptionUtil.java │ ├── LogUtils.java │ ├── MessageUtils.java │ ├── PageUtils.java │ ├── SecurityUtils.java │ ├── SensitiveUtils.java │ ├── ServletUtils.java │ ├── StringUtils.java │ ├── Threads.java │ ├── bean │ │ ├── BeanUtils.java │ │ └── BeanValidators.java │ ├── file │ │ ├── FileTypeUtils.java │ │ ├── FileUploadUtils.java │ │ ├── FileUtils.java │ │ ├── ImageUtils.java │ │ └── MimeTypeUtils.java │ ├── html │ │ ├── EscapeUtil.java │ │ └── HTMLFilter.java │ ├── http │ │ ├── HttpHelper.java │ │ └── HttpUtils.java │ ├── ip │ │ ├── AddressUtils.java │ │ └── IpUtils.java │ ├── poi │ │ ├── ExcelHandlerAdapter.java │ │ └── ExcelUtil.java │ ├── reflect │ │ └── ReflectUtils.java │ ├── sign │ │ ├── Base64.java │ │ └── Md5Utils.java │ ├── spring │ │ └── SpringUtils.java │ ├── sql │ │ └── SqlUtil.java │ └── uuid │ │ ├── IdUtils.java │ │ ├── Seq.java │ │ └── UUID.java │ └── xss │ ├── Xss.java │ └── XssValidator.java ├── douyidou-framework ├── pom.xml └── src │ └── main │ └── java │ └── cc │ └── douyidou │ └── framework │ ├── aspectj │ ├── DataScopeAspect.java │ ├── DataSourceAspect.java │ ├── LogAspect.java │ └── RateLimiterAspect.java │ ├── config │ ├── ApplicationConfig.java │ ├── CaptchaConfig.java │ ├── DruidConfig.java │ ├── FastJson2JsonRedisSerializer.java │ ├── FilterConfig.java │ ├── I18nConfig.java │ ├── KaptchaTextCreator.java │ ├── MybatisPlusConfig.java │ ├── RedisConfig.java │ ├── ResourcesConfig.java │ ├── SecurityConfig.java │ ├── ServerConfig.java │ ├── ThreadPoolConfig.java │ ├── properties │ │ ├── DruidProperties.java │ │ └── PermitAllUrlProperties.java │ └── typehandler │ │ ├── ArrayLongTypeHandler.java │ │ ├── ArrayStringTypeHandler.java │ │ └── JsonTypeHandler.java │ ├── datasource │ ├── DynamicDataSource.java │ └── DynamicDataSourceContextHolder.java │ ├── interceptor │ ├── RepeatSubmitInterceptor.java │ └── impl │ │ └── SameUrlDataInterceptor.java │ ├── manager │ ├── AsyncManager.java │ ├── ShutdownManager.java │ └── factory │ │ └── AsyncFactory.java │ ├── security │ ├── context │ │ ├── AuthenticationContextHolder.java │ │ └── PermissionContextHolder.java │ ├── filter │ │ └── JwtAuthenticationTokenFilter.java │ └── handle │ │ ├── AuthenticationEntryPointImpl.java │ │ └── LogoutSuccessHandlerImpl.java │ └── web │ ├── domain │ ├── Server.java │ └── server │ │ ├── Cpu.java │ │ ├── Jvm.java │ │ ├── Mem.java │ │ ├── Sys.java │ │ └── SysFile.java │ ├── exception │ └── GlobalExceptionHandler.java │ └── service │ ├── PermissionService.java │ ├── SysLoginService.java │ ├── SysPasswordService.java │ ├── SysPermissionService.java │ ├── SysRegisterService.java │ ├── TokenService.java │ └── UserDetailsServiceImpl.java ├── douyidou-generator ├── pom.xml └── src │ └── main │ ├── java │ └── cc │ │ └── douyidou │ │ └── generator │ │ ├── config │ │ └── GenConfig.java │ │ ├── controller │ │ └── GenController.java │ │ ├── domain │ │ ├── GenTable.java │ │ └── GenTableColumn.java │ │ ├── mapper │ │ ├── GenTableColumnMapper.java │ │ └── GenTableMapper.java │ │ ├── service │ │ ├── GenTableColumnServiceImpl.java │ │ ├── GenTableServiceImpl.java │ │ ├── IGenTableColumnService.java │ │ └── IGenTableService.java │ │ └── util │ │ ├── GenUtils.java │ │ ├── VelocityInitializer.java │ │ └── VelocityUtils.java │ └── resources │ ├── generator.yml │ ├── mapper │ └── generator │ │ ├── GenTableColumnMapper.xml │ │ └── GenTableMapper.xml │ └── vm │ ├── java │ ├── controller.java.vm │ ├── domain.java.vm │ ├── mapper.java.vm │ ├── service.java.vm │ ├── serviceImpl.java.vm │ └── sub-domain.java.vm │ ├── js │ └── api.js.vm │ ├── sql │ └── sql.vm │ ├── vue │ ├── index-tree.vue.vm │ ├── index.vue.vm │ └── v3 │ │ ├── index-tree.vue.vm │ │ └── index.vue.vm │ └── xml │ └── mapper.xml.vm ├── douyidou-quartz ├── pom.xml └── src │ └── main │ ├── java │ └── cc │ │ └── douyidou │ │ └── quartz │ │ ├── config │ │ └── ScheduleConfig.java │ │ ├── controller │ │ ├── SysJobController.java │ │ └── SysJobLogController.java │ │ ├── domain │ │ ├── SysJob.java │ │ └── SysJobLog.java │ │ ├── mapper │ │ ├── SysJobLogMapper.java │ │ └── SysJobMapper.java │ │ ├── service │ │ ├── ISysJobLogService.java │ │ ├── ISysJobService.java │ │ └── impl │ │ │ ├── SysJobLogServiceImpl.java │ │ │ └── SysJobServiceImpl.java │ │ ├── task │ │ └── RyTask.java │ │ └── util │ │ ├── AbstractQuartzJob.java │ │ ├── CronUtils.java │ │ ├── JobInvokeUtil.java │ │ ├── QuartzDisallowConcurrentExecution.java │ │ ├── QuartzJobExecution.java │ │ └── ScheduleUtils.java │ └── resources │ └── mapper │ └── quartz │ ├── SysJobLogMapper.xml │ └── SysJobMapper.xml ├── douyidou-server ├── pom.xml └── src │ ├── main │ ├── java │ │ └── cc │ │ │ └── douyidou │ │ │ ├── DouYiDouApplication.java │ │ │ ├── DouYiDouServletInitializer.java │ │ │ └── web │ │ │ ├── controller │ │ │ ├── api │ │ │ │ ├── CommonApi.java │ │ │ │ ├── ConfigApi.java │ │ │ │ ├── FetchApi.java │ │ │ │ ├── ParseApi.java │ │ │ │ ├── RewardApi.java │ │ │ │ ├── UserApi.java │ │ │ │ └── UserLoginApi.java │ │ │ ├── common │ │ │ │ ├── CaptchaController.java │ │ │ │ └── CommonController.java │ │ │ ├── monitor │ │ │ │ ├── CacheController.java │ │ │ │ ├── ServerController.java │ │ │ │ ├── SysLogininforController.java │ │ │ │ ├── SysOperlogController.java │ │ │ │ └── SysUserOnlineController.java │ │ │ ├── system │ │ │ │ ├── DouHelpController.java │ │ │ │ ├── DouParseController.java │ │ │ │ ├── DouPlatformController.java │ │ │ │ ├── DouRewardController.java │ │ │ │ ├── DouTranslateController.java │ │ │ │ ├── DouUserController.java │ │ │ │ ├── SysConfigController.java │ │ │ │ ├── SysDeptController.java │ │ │ │ ├── SysDictDataController.java │ │ │ │ ├── SysDictTypeController.java │ │ │ │ ├── SysIndexController.java │ │ │ │ ├── SysLoginController.java │ │ │ │ ├── SysMenuController.java │ │ │ │ ├── SysNoticeController.java │ │ │ │ ├── SysPostController.java │ │ │ │ ├── SysProfileController.java │ │ │ │ ├── SysRegisterController.java │ │ │ │ ├── SysRoleController.java │ │ │ │ └── SysUserController.java │ │ │ └── tool │ │ │ │ └── TestController.java │ │ │ └── core │ │ │ └── config │ │ │ └── SwaggerConfig.java │ └── resources │ │ ├── META-INF │ │ └── spring-devtools.properties │ │ ├── application-dev.yml │ │ ├── application-prod.yml │ │ ├── application.yml │ │ ├── banner.txt │ │ ├── i18n │ │ └── messages.properties │ │ ├── logback-spring.xml │ │ └── mybatis │ │ └── mybatis-config.xml │ └── test │ └── java │ └── cc │ └── douyidou │ └── TestService.java ├── douyidou-service ├── pom.xml └── src │ └── main │ ├── java │ └── cc │ │ └── douyidou │ │ └── service │ │ ├── api │ │ └── ApiClient.java │ │ ├── common │ │ ├── PageResult.java │ │ ├── request │ │ │ └── PageParamRequest.java │ │ └── response │ │ │ ├── CommonResult.java │ │ │ ├── LoginResponse.java │ │ │ ├── parse │ │ │ ├── DouParseResponse.java │ │ │ ├── TranscodeResponse.java │ │ │ └── VideoParseResponse.java │ │ │ └── user │ │ │ └── DouUserResponse.java │ │ ├── config │ │ └── WebConfig.java │ │ ├── domain │ │ ├── DouBase.java │ │ ├── DouHelp.java │ │ ├── DouParse.java │ │ ├── DouPlatform.java │ │ ├── DouReward.java │ │ ├── DouTranslate.java │ │ └── DouUser.java │ │ ├── entity │ │ ├── LoginDouUser.java │ │ ├── LoginMaDTO.java │ │ └── WxUser.java │ │ ├── exception │ │ ├── DouException.java │ │ ├── ExceptionCodeEnum.java │ │ └── ExceptionHandler.java │ │ ├── interceptor │ │ └── DouUserAuthenticationInterceptor.java │ │ ├── mapper │ │ ├── DouHelpMapper.java │ │ ├── DouParseMapper.java │ │ ├── DouPlatformMapper.java │ │ ├── DouRewardMapper.java │ │ ├── DouTranslateMapper.java │ │ └── DouUserMapper.java │ │ ├── service │ │ ├── DouConfigService.java │ │ ├── DouUserTokenService.java │ │ ├── IDouHelpService.java │ │ ├── IDouParseService.java │ │ ├── IDouPlatformService.java │ │ ├── IDouRewardService.java │ │ ├── IDouTranslateService.java │ │ ├── IDouUserService.java │ │ ├── ParseService.java │ │ ├── ProxyService.java │ │ ├── WxUserService.java │ │ └── impl │ │ │ ├── DouHelpServiceImpl.java │ │ │ ├── DouParseServiceImpl.java │ │ │ ├── DouPlatformServiceImpl.java │ │ │ ├── DouRewardServiceImpl.java │ │ │ ├── DouTranslateServiceImpl.java │ │ │ ├── DouUserServiceImpl.java │ │ │ └── WxUserServiceImpl.java │ │ ├── task │ │ ├── DouUserTask.java │ │ └── TranscodeTask.java │ │ ├── utils │ │ ├── DouUtils.java │ │ └── SecurityUtils.java │ │ └── vo │ │ └── MyRecord.java │ └── resources │ └── mapper │ ├── DouHelpMapper.xml │ ├── DouParseMapper.xml │ ├── DouPlatformMapper.xml │ ├── DouRewardMapper.xml │ ├── DouTranslateMapper.xml │ └── DouUserMapper.xml ├── douyidou-system ├── pom.xml └── src │ └── main │ ├── java │ └── cc │ │ └── douyidou │ │ └── system │ │ ├── domain │ │ ├── SysCache.java │ │ ├── SysConfig.java │ │ ├── SysLogininfor.java │ │ ├── SysNotice.java │ │ ├── SysOperLog.java │ │ ├── SysPost.java │ │ ├── SysRoleDept.java │ │ ├── SysRoleMenu.java │ │ ├── SysUserOnline.java │ │ ├── SysUserPost.java │ │ ├── SysUserRole.java │ │ └── vo │ │ │ ├── MetaVo.java │ │ │ └── RouterVo.java │ │ ├── mapper │ │ ├── SysConfigMapper.java │ │ ├── SysDeptMapper.java │ │ ├── SysDictDataMapper.java │ │ ├── SysDictTypeMapper.java │ │ ├── SysLogininforMapper.java │ │ ├── SysMenuMapper.java │ │ ├── SysNoticeMapper.java │ │ ├── SysOperLogMapper.java │ │ ├── SysPostMapper.java │ │ ├── SysRoleDeptMapper.java │ │ ├── SysRoleMapper.java │ │ ├── SysRoleMenuMapper.java │ │ ├── SysUserMapper.java │ │ ├── SysUserPostMapper.java │ │ └── SysUserRoleMapper.java │ │ └── service │ │ ├── ISysConfigService.java │ │ ├── ISysDeptService.java │ │ ├── ISysDictDataService.java │ │ ├── ISysDictTypeService.java │ │ ├── ISysLogininforService.java │ │ ├── ISysMenuService.java │ │ ├── ISysNoticeService.java │ │ ├── ISysOperLogService.java │ │ ├── ISysPostService.java │ │ ├── ISysRoleService.java │ │ ├── ISysUserOnlineService.java │ │ ├── ISysUserService.java │ │ └── impl │ │ ├── SysConfigServiceImpl.java │ │ ├── SysDeptServiceImpl.java │ │ ├── SysDictDataServiceImpl.java │ │ ├── SysDictTypeServiceImpl.java │ │ ├── SysLogininforServiceImpl.java │ │ ├── SysMenuServiceImpl.java │ │ ├── SysNoticeServiceImpl.java │ │ ├── SysOperLogServiceImpl.java │ │ ├── SysPostServiceImpl.java │ │ ├── SysRoleServiceImpl.java │ │ ├── SysUserOnlineServiceImpl.java │ │ └── SysUserServiceImpl.java │ └── resources │ └── mapper │ └── system │ ├── SysConfigMapper.xml │ ├── SysDeptMapper.xml │ ├── SysDictDataMapper.xml │ ├── SysDictTypeMapper.xml │ ├── SysLogininforMapper.xml │ ├── SysMenuMapper.xml │ ├── SysNoticeMapper.xml │ ├── SysOperLogMapper.xml │ ├── SysPostMapper.xml │ ├── SysRoleDeptMapper.xml │ ├── SysRoleMapper.xml │ ├── SysRoleMenuMapper.xml │ ├── SysUserMapper.xml │ ├── SysUserPostMapper.xml │ └── SysUserRoleMapper.xml └── pom.xml /.gitignore: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # Build Tools 3 | 4 | .gradle 5 | /build/ 6 | !gradle/wrapper/gradle-wrapper.jar 7 | 8 | target/ 9 | !.mvn/wrapper/maven-wrapper.jar 10 | 11 | ###################################################################### 12 | # IDE 13 | 14 | ### STS ### 15 | .apt_generated 16 | .classpath 17 | .factorypath 18 | .project 19 | .settings 20 | .springBeans 21 | 22 | ### IntelliJ IDEA ### 23 | .idea 24 | *.iws 25 | *.iml 26 | *.ipr 27 | 28 | ### JRebel ### 29 | rebel.xml 30 | 31 | ### NetBeans ### 32 | nbproject/private/ 33 | build/* 34 | nbbuild/ 35 | dist/ 36 | nbdist/ 37 | .nb-gradle/ 38 | 39 | ###################################################################### 40 | # Others 41 | *.log 42 | *.xml.versionsBackup 43 | *.swp 44 | 45 | !*/build/*.java 46 | !*/build/*.html 47 | !*/build/*.xml 48 | 49 | RuoYi-Vue3/* 50 | sql/* 51 | doc/* 52 | logs/* 53 | bin/* 54 | ry.bat 55 | ry.sh 56 | uploadPath/* -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 douyidou.cc 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /config.properties: -------------------------------------------------------------------------------- 1 | # 服务器的HTTP端口,默认为8080 2 | server.port=7999 3 | # 上传地址 4 | dou.uploadPath=/www/wwwroot/d1dserver/uploadPath 5 | 6 | redis.host=localhost 7 | redis.port=6379 8 | redis.database=0 9 | redis.password= 10 | 11 | mysql.host=localhost 12 | mysql.port=3306 13 | mysql.database=d1dserver 14 | mysql.username=root 15 | mysql.password=root -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | name: 2 | d1dserver 3 | volumes: 4 | mysql8_data: 5 | services: 6 | mysql: 7 | image: mysql:8.0.38 8 | volumes: 9 | - mysql8_data:/var/lib/mysql 10 | ports: 11 | - "3307:3306" 12 | command: --default-authentication-plugin=mysql_native_password 13 | environment: 14 | MYSQL_ROOT_PASSWORD: root 15 | MYSQL_DATABASE: d1dserver 16 | MYSQL_CHARACTER_SET_SERVER: utf8mb4 17 | MYSQL_COLLATION_SERVER: utf8mb4_general_ci 18 | TZ: Asia/Shanghai 19 | 20 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/annotation/Anonymous.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.annotation; 2 | 3 | import java.lang.annotation.Documented; 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 | * @author ruoyi 13 | */ 14 | @Target({ ElementType.METHOD, ElementType.TYPE }) 15 | @Retention(RetentionPolicy.RUNTIME) 16 | @Documented 17 | public @interface Anonymous 18 | { 19 | } 20 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/annotation/DataScope.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.annotation; 2 | 3 | import java.lang.annotation.Documented; 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 | * @author ruoyi 13 | */ 14 | @Target(ElementType.METHOD) 15 | @Retention(RetentionPolicy.RUNTIME) 16 | @Documented 17 | public @interface DataScope 18 | { 19 | /** 20 | * 部门表的别名 21 | */ 22 | public String deptAlias() default ""; 23 | 24 | /** 25 | * 用户表的别名 26 | */ 27 | public String userAlias() default ""; 28 | 29 | /** 30 | * 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@ss获取,多个权限用逗号分隔开来 31 | */ 32 | public String permission() default ""; 33 | } 34 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/annotation/DataSource.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.annotation; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Inherited; 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.lang.annotation.Target; 9 | import cc.douyidou.common.enums.DataSourceType; 10 | 11 | /** 12 | * 自定义多数据源切换注解 13 | * 14 | * 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准 15 | * 16 | * @author ruoyi 17 | */ 18 | @Target({ ElementType.METHOD, ElementType.TYPE }) 19 | @Retention(RetentionPolicy.RUNTIME) 20 | @Documented 21 | @Inherited 22 | public @interface DataSource 23 | { 24 | /** 25 | * 切换数据源名称 26 | */ 27 | public DataSourceType value() default DataSourceType.MASTER; 28 | } 29 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/annotation/Excels.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.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 | /** 9 | * Excel注解集 10 | * 11 | * @author ruoyi 12 | */ 13 | @Target(ElementType.FIELD) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface Excels 16 | { 17 | public Excel[] value(); 18 | } 19 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/annotation/Log.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.annotation; 2 | 3 | import java.lang.annotation.Documented; 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 | import cc.douyidou.common.enums.BusinessType; 9 | import cc.douyidou.common.enums.OperatorType; 10 | 11 | /** 12 | * 自定义操作日志记录注解 13 | * 14 | * @author ruoyi 15 | * 16 | */ 17 | @Target({ ElementType.PARAMETER, ElementType.METHOD }) 18 | @Retention(RetentionPolicy.RUNTIME) 19 | @Documented 20 | public @interface Log 21 | { 22 | /** 23 | * 模块 24 | */ 25 | public String title() default ""; 26 | 27 | /** 28 | * 功能 29 | */ 30 | public BusinessType businessType() default BusinessType.OTHER; 31 | 32 | /** 33 | * 操作人类别 34 | */ 35 | public OperatorType operatorType() default OperatorType.MANAGE; 36 | 37 | /** 38 | * 是否保存请求的参数 39 | */ 40 | public boolean isSaveRequestData() default true; 41 | 42 | /** 43 | * 是否保存响应的参数 44 | */ 45 | public boolean isSaveResponseData() default true; 46 | 47 | /** 48 | * 排除指定的请求参数 49 | */ 50 | public String[] excludeParamNames() default {}; 51 | } 52 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/annotation/RateLimiter.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.annotation; 2 | 3 | import java.lang.annotation.Documented; 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 | import cc.douyidou.common.constant.CacheConstants; 9 | import cc.douyidou.common.enums.LimitType; 10 | 11 | /** 12 | * 限流注解 13 | * 14 | * @author ruoyi 15 | */ 16 | @Target(ElementType.METHOD) 17 | @Retention(RetentionPolicy.RUNTIME) 18 | @Documented 19 | public @interface RateLimiter 20 | { 21 | /** 22 | * 限流key 23 | */ 24 | public String key() default CacheConstants.RATE_LIMIT_KEY; 25 | 26 | /** 27 | * 限流时间,单位秒 28 | */ 29 | public int time() default 60; 30 | 31 | /** 32 | * 限流次数 33 | */ 34 | public int count() default 100; 35 | 36 | /** 37 | * 限流类型 38 | */ 39 | public LimitType limitType() default LimitType.DEFAULT; 40 | } 41 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/annotation/RepeatSubmit.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.annotation; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Inherited; 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.lang.annotation.Target; 9 | 10 | /** 11 | * 自定义注解防止表单重复提交 12 | * 13 | * @author ruoyi 14 | * 15 | */ 16 | @Inherited 17 | @Target(ElementType.METHOD) 18 | @Retention(RetentionPolicy.RUNTIME) 19 | @Documented 20 | public @interface RepeatSubmit 21 | { 22 | /** 23 | * 间隔时间(ms),小于此时间视为重复提交 24 | */ 25 | public int interval() default 5000; 26 | 27 | /** 28 | * 提示消息 29 | */ 30 | public String message() default "不允许重复提交,请稍候再试"; 31 | } 32 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/annotation/Sensitive.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.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 | import com.fasterxml.jackson.annotation.JacksonAnnotationsInside; 8 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 9 | import cc.douyidou.common.config.serializer.SensitiveJsonSerializer; 10 | import cc.douyidou.common.enums.DesensitizedType; 11 | 12 | /** 13 | * 数据脱敏注解 14 | * 15 | * @author ruoyi 16 | */ 17 | @Retention(RetentionPolicy.RUNTIME) 18 | @Target(ElementType.FIELD) 19 | @JacksonAnnotationsInside 20 | @JsonSerialize(using = SensitiveJsonSerializer.class) 21 | public @interface Sensitive 22 | { 23 | DesensitizedType desensitizedType(); 24 | } 25 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/constant/CacheConstants.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.constant; 2 | 3 | /** 4 | * 缓存的key 常量 5 | * 6 | * @author ruoyi 7 | */ 8 | public class CacheConstants 9 | { 10 | /** 11 | * 登录用户 redis key 12 | */ 13 | public static final String LOGIN_TOKEN_KEY = "login_tokens:"; 14 | 15 | /** 16 | * 验证码 redis key 17 | */ 18 | public static final String CAPTCHA_CODE_KEY = "captcha_codes:"; 19 | 20 | /** 21 | * 参数管理 cache key 22 | */ 23 | public static final String SYS_CONFIG_KEY = "sys_config:"; 24 | 25 | /** 26 | * 字典管理 cache key 27 | */ 28 | public static final String SYS_DICT_KEY = "sys_dict:"; 29 | 30 | /** 31 | * 防重提交 redis key 32 | */ 33 | public static final String REPEAT_SUBMIT_KEY = "repeat_submit:"; 34 | 35 | /** 36 | * 限流 redis key 37 | */ 38 | public static final String RATE_LIMIT_KEY = "rate_limit:"; 39 | 40 | /** 41 | * 登录账户密码错误次数 redis key 42 | */ 43 | public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:"; 44 | } 45 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/constant/HttpStatus.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.constant; 2 | 3 | /** 4 | * 返回状态码 5 | * 6 | * @author ruoyi 7 | */ 8 | public class HttpStatus 9 | { 10 | /** 11 | * 操作成功 12 | */ 13 | public static final int SUCCESS = 200; 14 | 15 | /** 16 | * 对象创建成功 17 | */ 18 | public static final int CREATED = 201; 19 | 20 | /** 21 | * 请求已经被接受 22 | */ 23 | public static final int ACCEPTED = 202; 24 | 25 | /** 26 | * 操作已经执行成功,但是没有返回数据 27 | */ 28 | public static final int NO_CONTENT = 204; 29 | 30 | /** 31 | * 资源已被移除 32 | */ 33 | public static final int MOVED_PERM = 301; 34 | 35 | /** 36 | * 重定向 37 | */ 38 | public static final int SEE_OTHER = 303; 39 | 40 | /** 41 | * 资源没有被修改 42 | */ 43 | public static final int NOT_MODIFIED = 304; 44 | 45 | /** 46 | * 参数列表错误(缺少,格式不匹配) 47 | */ 48 | public static final int BAD_REQUEST = 400; 49 | 50 | /** 51 | * 未授权 52 | */ 53 | public static final int UNAUTHORIZED = 401; 54 | 55 | /** 56 | * 访问受限,授权过期 57 | */ 58 | public static final int FORBIDDEN = 403; 59 | 60 | /** 61 | * 资源,服务未找到 62 | */ 63 | public static final int NOT_FOUND = 404; 64 | 65 | /** 66 | * 不允许的http方法 67 | */ 68 | public static final int BAD_METHOD = 405; 69 | 70 | /** 71 | * 资源冲突,或者资源被锁 72 | */ 73 | public static final int CONFLICT = 409; 74 | 75 | /** 76 | * 不支持的数据,媒体类型 77 | */ 78 | public static final int UNSUPPORTED_TYPE = 415; 79 | 80 | /** 81 | * 系统内部错误 82 | */ 83 | public static final int ERROR = 500; 84 | 85 | /** 86 | * 接口未实现 87 | */ 88 | public static final int NOT_IMPLEMENTED = 501; 89 | 90 | /** 91 | * 系统警告消息 92 | */ 93 | public static final int WARN = 601; 94 | } 95 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/constant/ScheduleConstants.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.constant; 2 | 3 | /** 4 | * 任务调度通用常量 5 | * 6 | * @author ruoyi 7 | */ 8 | public class ScheduleConstants 9 | { 10 | public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME"; 11 | 12 | /** 执行目标key */ 13 | public static final String TASK_PROPERTIES = "TASK_PROPERTIES"; 14 | 15 | /** 默认 */ 16 | public static final String MISFIRE_DEFAULT = "0"; 17 | 18 | /** 立即触发执行 */ 19 | public static final String MISFIRE_IGNORE_MISFIRES = "1"; 20 | 21 | /** 触发一次执行 */ 22 | public static final String MISFIRE_FIRE_AND_PROCEED = "2"; 23 | 24 | /** 不触发立即执行 */ 25 | public static final String MISFIRE_DO_NOTHING = "3"; 26 | 27 | public enum Status 28 | { 29 | /** 30 | * 正常 31 | */ 32 | NORMAL("0"), 33 | /** 34 | * 暂停 35 | */ 36 | PAUSE("1"); 37 | 38 | private String value; 39 | 40 | private Status(String value) 41 | { 42 | this.value = value; 43 | } 44 | 45 | public String getValue() 46 | { 47 | return value; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/core/domain/TreeEntity.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.core.domain; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * Tree基类 8 | * 9 | * @author ruoyi 10 | */ 11 | public class TreeEntity extends BaseEntity 12 | { 13 | private static final long serialVersionUID = 1L; 14 | 15 | /** 父菜单名称 */ 16 | private String parentName; 17 | 18 | /** 父菜单ID */ 19 | private Long parentId; 20 | 21 | /** 显示顺序 */ 22 | private Integer orderNum; 23 | 24 | /** 祖级列表 */ 25 | private String ancestors; 26 | 27 | /** 子部门 */ 28 | private List children = new ArrayList<>(); 29 | 30 | public String getParentName() 31 | { 32 | return parentName; 33 | } 34 | 35 | public void setParentName(String parentName) 36 | { 37 | this.parentName = parentName; 38 | } 39 | 40 | public Long getParentId() 41 | { 42 | return parentId; 43 | } 44 | 45 | public void setParentId(Long parentId) 46 | { 47 | this.parentId = parentId; 48 | } 49 | 50 | public Integer getOrderNum() 51 | { 52 | return orderNum; 53 | } 54 | 55 | public void setOrderNum(Integer orderNum) 56 | { 57 | this.orderNum = orderNum; 58 | } 59 | 60 | public String getAncestors() 61 | { 62 | return ancestors; 63 | } 64 | 65 | public void setAncestors(String ancestors) 66 | { 67 | this.ancestors = ancestors; 68 | } 69 | 70 | public List getChildren() 71 | { 72 | return children; 73 | } 74 | 75 | public void setChildren(List children) 76 | { 77 | this.children = children; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/core/domain/model/LoginBody.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.core.domain.model; 2 | 3 | /** 4 | * 用户登录对象 5 | * 6 | * @author ruoyi 7 | */ 8 | public class LoginBody 9 | { 10 | /** 11 | * 用户名 12 | */ 13 | private String username; 14 | 15 | /** 16 | * 用户密码 17 | */ 18 | private String password; 19 | 20 | /** 21 | * 验证码 22 | */ 23 | private String code; 24 | 25 | /** 26 | * 唯一标识 27 | */ 28 | private String uuid; 29 | 30 | public String getUsername() 31 | { 32 | return username; 33 | } 34 | 35 | public void setUsername(String username) 36 | { 37 | this.username = username; 38 | } 39 | 40 | public String getPassword() 41 | { 42 | return password; 43 | } 44 | 45 | public void setPassword(String password) 46 | { 47 | this.password = password; 48 | } 49 | 50 | public String getCode() 51 | { 52 | return code; 53 | } 54 | 55 | public void setCode(String code) 56 | { 57 | this.code = code; 58 | } 59 | 60 | public String getUuid() 61 | { 62 | return uuid; 63 | } 64 | 65 | public void setUuid(String uuid) 66 | { 67 | this.uuid = uuid; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/core/domain/model/RegisterBody.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.core.domain.model; 2 | 3 | /** 4 | * 用户注册对象 5 | * 6 | * @author ruoyi 7 | */ 8 | public class RegisterBody extends LoginBody 9 | { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/core/page/TableDataInfo.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.core.page; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | /** 7 | * 表格分页数据对象 8 | * 9 | * @author ruoyi 10 | */ 11 | public class TableDataInfo implements Serializable 12 | { 13 | private static final long serialVersionUID = 1L; 14 | 15 | /** 总记录数 */ 16 | private long total; 17 | 18 | /** 列表数据 */ 19 | private List rows; 20 | 21 | /** 消息状态码 */ 22 | private int code; 23 | 24 | /** 消息内容 */ 25 | private String msg; 26 | 27 | /** 28 | * 表格数据对象 29 | */ 30 | public TableDataInfo() 31 | { 32 | } 33 | 34 | /** 35 | * 分页 36 | * 37 | * @param list 列表数据 38 | * @param total 总记录数 39 | */ 40 | public TableDataInfo(List list, long total) 41 | { 42 | this.rows = list; 43 | this.total = total; 44 | } 45 | 46 | public long getTotal() 47 | { 48 | return total; 49 | } 50 | 51 | public void setTotal(long total) 52 | { 53 | this.total = total; 54 | } 55 | 56 | public List getRows() 57 | { 58 | return rows; 59 | } 60 | 61 | public void setRows(List rows) 62 | { 63 | this.rows = rows; 64 | } 65 | 66 | public int getCode() 67 | { 68 | return code; 69 | } 70 | 71 | public void setCode(int code) 72 | { 73 | this.code = code; 74 | } 75 | 76 | public String getMsg() 77 | { 78 | return msg; 79 | } 80 | 81 | public void setMsg(String msg) 82 | { 83 | this.msg = msg; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/core/page/TableSupport.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.core.page; 2 | 3 | import cc.douyidou.common.core.text.Convert; 4 | import cc.douyidou.common.utils.ServletUtils; 5 | 6 | /** 7 | * 表格数据处理 8 | * 9 | * @author ruoyi 10 | */ 11 | public class TableSupport 12 | { 13 | /** 14 | * 当前记录起始索引 15 | */ 16 | public static final String PAGE_NUM = "pageNum"; 17 | 18 | /** 19 | * 每页显示记录数 20 | */ 21 | public static final String PAGE_SIZE = "pageSize"; 22 | 23 | /** 24 | * 排序列 25 | */ 26 | public static final String ORDER_BY_COLUMN = "orderByColumn"; 27 | 28 | /** 29 | * 排序的方向 "desc" 或者 "asc". 30 | */ 31 | public static final String IS_ASC = "isAsc"; 32 | 33 | /** 34 | * 分页参数合理化 35 | */ 36 | public static final String REASONABLE = "reasonable"; 37 | 38 | /** 39 | * 封装分页对象 40 | */ 41 | public static PageDomain getPageDomain() 42 | { 43 | PageDomain pageDomain = new PageDomain(); 44 | pageDomain.setPageNum(Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1)); 45 | pageDomain.setPageSize(Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10)); 46 | pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN)); 47 | pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC)); 48 | pageDomain.setReasonable(ServletUtils.getParameterToBool(REASONABLE)); 49 | return pageDomain; 50 | } 51 | 52 | public static PageDomain buildPageRequest() 53 | { 54 | return getPageDomain(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/enums/BusinessStatus.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.enums; 2 | 3 | /** 4 | * 操作状态 5 | * 6 | * @author ruoyi 7 | * 8 | */ 9 | public enum BusinessStatus 10 | { 11 | /** 12 | * 成功 13 | */ 14 | SUCCESS, 15 | 16 | /** 17 | * 失败 18 | */ 19 | FAIL, 20 | } 21 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/enums/BusinessType.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.enums; 2 | 3 | /** 4 | * 业务操作类型 5 | * 6 | * @author ruoyi 7 | */ 8 | public enum BusinessType 9 | { 10 | /** 11 | * 其它 12 | */ 13 | OTHER, 14 | 15 | /** 16 | * 新增 17 | */ 18 | INSERT, 19 | 20 | /** 21 | * 修改 22 | */ 23 | UPDATE, 24 | 25 | /** 26 | * 删除 27 | */ 28 | DELETE, 29 | 30 | /** 31 | * 授权 32 | */ 33 | GRANT, 34 | 35 | /** 36 | * 导出 37 | */ 38 | EXPORT, 39 | 40 | /** 41 | * 导入 42 | */ 43 | IMPORT, 44 | 45 | /** 46 | * 强退 47 | */ 48 | FORCE, 49 | 50 | /** 51 | * 生成代码 52 | */ 53 | GENCODE, 54 | 55 | /** 56 | * 清空数据 57 | */ 58 | CLEAN, 59 | } 60 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/enums/DataSourceType.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.enums; 2 | 3 | /** 4 | * 数据源 5 | * 6 | * @author ruoyi 7 | */ 8 | public enum DataSourceType 9 | { 10 | /** 11 | * 主库 12 | */ 13 | MASTER, 14 | 15 | /** 16 | * 从库 17 | */ 18 | SLAVE 19 | } 20 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/enums/DesensitizedType.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.enums; 2 | 3 | import java.util.function.Function; 4 | import cc.douyidou.common.utils.DesensitizedUtil; 5 | 6 | /** 7 | * 脱敏类型 8 | * 9 | * @author ruoyi 10 | */ 11 | public enum DesensitizedType 12 | { 13 | /** 14 | * 姓名,第2位星号替换 15 | */ 16 | USERNAME(s -> s.replaceAll("(\\S)\\S(\\S*)", "$1*$2")), 17 | 18 | /** 19 | * 密码,全部字符都用*代替 20 | */ 21 | PASSWORD(DesensitizedUtil::password), 22 | 23 | /** 24 | * 身份证,中间10位星号替换 25 | */ 26 | ID_CARD(s -> s.replaceAll("(\\d{4})\\d{10}(\\d{3}[Xx]|\\d{4})", "$1** **** ****$2")), 27 | 28 | /** 29 | * 手机号,中间4位星号替换 30 | */ 31 | PHONE(s -> s.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2")), 32 | 33 | /** 34 | * 电子邮箱,仅显示第一个字母和@后面的地址显示,其他星号替换 35 | */ 36 | EMAIL(s -> s.replaceAll("(^.)[^@]*(@.*$)", "$1****$2")), 37 | 38 | /** 39 | * 银行卡号,保留最后4位,其他星号替换 40 | */ 41 | BANK_CARD(s -> s.replaceAll("\\d{15}(\\d{3})", "**** **** **** **** $1")), 42 | 43 | /** 44 | * 车牌号码,包含普通车辆、新能源车辆 45 | */ 46 | CAR_LICENSE(DesensitizedUtil::carLicense); 47 | 48 | private final Function desensitizer; 49 | 50 | DesensitizedType(Function desensitizer) 51 | { 52 | this.desensitizer = desensitizer; 53 | } 54 | 55 | public Function desensitizer() 56 | { 57 | return desensitizer; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/enums/HttpMethod.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.enums; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | import org.springframework.lang.Nullable; 6 | 7 | /** 8 | * 请求方式 9 | * 10 | * @author ruoyi 11 | */ 12 | public enum HttpMethod 13 | { 14 | GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE; 15 | 16 | private static final Map mappings = new HashMap<>(16); 17 | 18 | static 19 | { 20 | for (HttpMethod httpMethod : values()) 21 | { 22 | mappings.put(httpMethod.name(), httpMethod); 23 | } 24 | } 25 | 26 | @Nullable 27 | public static HttpMethod resolve(@Nullable String method) 28 | { 29 | return (method != null ? mappings.get(method) : null); 30 | } 31 | 32 | public boolean matches(String method) 33 | { 34 | return (this == resolve(method)); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/enums/LimitType.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.enums; 2 | 3 | /** 4 | * 限流类型 5 | * 6 | * @author ruoyi 7 | */ 8 | 9 | public enum LimitType 10 | { 11 | /** 12 | * 默认策略全局限流 13 | */ 14 | DEFAULT, 15 | 16 | /** 17 | * 根据请求者IP进行限流 18 | */ 19 | IP 20 | } 21 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/enums/OperatorType.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.enums; 2 | 3 | /** 4 | * 操作人类别 5 | * 6 | * @author ruoyi 7 | */ 8 | public enum OperatorType 9 | { 10 | /** 11 | * 其它 12 | */ 13 | OTHER, 14 | 15 | /** 16 | * 后台用户 17 | */ 18 | MANAGE, 19 | 20 | /** 21 | * 手机端用户 22 | */ 23 | MOBILE 24 | } 25 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/enums/UserStatus.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.enums; 2 | 3 | /** 4 | * 用户状态 5 | * 6 | * @author ruoyi 7 | */ 8 | public enum UserStatus 9 | { 10 | OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除"); 11 | 12 | private final String code; 13 | private final String info; 14 | 15 | UserStatus(String code, String info) 16 | { 17 | this.code = code; 18 | this.info = info; 19 | } 20 | 21 | public String getCode() 22 | { 23 | return code; 24 | } 25 | 26 | public String getInfo() 27 | { 28 | return info; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/exception/DemoModeException.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.exception; 2 | 3 | /** 4 | * 演示模式异常 5 | * 6 | * @author ruoyi 7 | */ 8 | public class DemoModeException extends RuntimeException 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public DemoModeException() 13 | { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/exception/GlobalException.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.exception; 2 | 3 | /** 4 | * 全局异常 5 | * 6 | * @author ruoyi 7 | */ 8 | public class GlobalException extends RuntimeException 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | /** 13 | * 错误提示 14 | */ 15 | private String message; 16 | 17 | /** 18 | * 错误明细,内部调试错误 19 | * 20 | * 和 {@link CommonResult#getDetailMessage()} 一致的设计 21 | */ 22 | private String detailMessage; 23 | 24 | /** 25 | * 空构造方法,避免反序列化问题 26 | */ 27 | public GlobalException() 28 | { 29 | } 30 | 31 | public GlobalException(String message) 32 | { 33 | this.message = message; 34 | } 35 | 36 | public String getDetailMessage() 37 | { 38 | return detailMessage; 39 | } 40 | 41 | public GlobalException setDetailMessage(String detailMessage) 42 | { 43 | this.detailMessage = detailMessage; 44 | return this; 45 | } 46 | 47 | @Override 48 | public String getMessage() 49 | { 50 | return message; 51 | } 52 | 53 | public GlobalException setMessage(String message) 54 | { 55 | this.message = message; 56 | return this; 57 | } 58 | } -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/exception/ServiceException.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.exception; 2 | 3 | /** 4 | * 业务异常 5 | * 6 | * @author ruoyi 7 | */ 8 | public final class ServiceException extends RuntimeException 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | /** 13 | * 错误码 14 | */ 15 | private Integer code; 16 | 17 | /** 18 | * 错误提示 19 | */ 20 | private String message; 21 | 22 | /** 23 | * 错误明细,内部调试错误 24 | * 25 | * 和 {@link CommonResult#getDetailMessage()} 一致的设计 26 | */ 27 | private String detailMessage; 28 | 29 | /** 30 | * 空构造方法,避免反序列化问题 31 | */ 32 | public ServiceException() 33 | { 34 | } 35 | 36 | public ServiceException(String message) 37 | { 38 | this.message = message; 39 | } 40 | 41 | public ServiceException(String message, Integer code) 42 | { 43 | this.message = message; 44 | this.code = code; 45 | } 46 | 47 | public String getDetailMessage() 48 | { 49 | return detailMessage; 50 | } 51 | 52 | @Override 53 | public String getMessage() 54 | { 55 | return message; 56 | } 57 | 58 | public Integer getCode() 59 | { 60 | return code; 61 | } 62 | 63 | public ServiceException setMessage(String message) 64 | { 65 | this.message = message; 66 | return this; 67 | } 68 | 69 | public ServiceException setDetailMessage(String detailMessage) 70 | { 71 | this.detailMessage = detailMessage; 72 | return this; 73 | } 74 | } -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/exception/UtilException.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.exception; 2 | 3 | /** 4 | * 工具类异常 5 | * 6 | * @author ruoyi 7 | */ 8 | public class UtilException extends RuntimeException 9 | { 10 | private static final long serialVersionUID = 8247610319171014183L; 11 | 12 | public UtilException(Throwable e) 13 | { 14 | super(e.getMessage(), e); 15 | } 16 | 17 | public UtilException(String message) 18 | { 19 | super(message); 20 | } 21 | 22 | public UtilException(String message, Throwable throwable) 23 | { 24 | super(message, throwable); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/exception/file/FileException.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.exception.file; 2 | 3 | import cc.douyidou.common.exception.base.BaseException; 4 | 5 | /** 6 | * 文件信息异常类 7 | * 8 | * @author ruoyi 9 | */ 10 | public class FileException extends BaseException 11 | { 12 | private static final long serialVersionUID = 1L; 13 | 14 | public FileException(String code, Object[] args) 15 | { 16 | super("file", code, args, null); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/exception/file/FileNameLengthLimitExceededException.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.exception.file; 2 | 3 | /** 4 | * 文件名称超长限制异常类 5 | * 6 | * @author ruoyi 7 | */ 8 | public class FileNameLengthLimitExceededException extends FileException 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public FileNameLengthLimitExceededException(int defaultFileNameLength) 13 | { 14 | super("upload.filename.exceed.length", new Object[] { defaultFileNameLength }); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/exception/file/FileSizeLimitExceededException.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.exception.file; 2 | 3 | /** 4 | * 文件名大小限制异常类 5 | * 6 | * @author ruoyi 7 | */ 8 | public class FileSizeLimitExceededException extends FileException 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public FileSizeLimitExceededException(long defaultMaxSize) 13 | { 14 | super("upload.exceed.maxSize", new Object[] { defaultMaxSize }); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/exception/file/FileUploadException.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.exception.file; 2 | 3 | import java.io.PrintStream; 4 | import java.io.PrintWriter; 5 | 6 | /** 7 | * 文件上传异常类 8 | * 9 | * @author ruoyi 10 | */ 11 | public class FileUploadException extends Exception 12 | { 13 | 14 | private static final long serialVersionUID = 1L; 15 | 16 | private final Throwable cause; 17 | 18 | public FileUploadException() 19 | { 20 | this(null, null); 21 | } 22 | 23 | public FileUploadException(final String msg) 24 | { 25 | this(msg, null); 26 | } 27 | 28 | public FileUploadException(String msg, Throwable cause) 29 | { 30 | super(msg); 31 | this.cause = cause; 32 | } 33 | 34 | @Override 35 | public void printStackTrace(PrintStream stream) 36 | { 37 | super.printStackTrace(stream); 38 | if (cause != null) 39 | { 40 | stream.println("Caused by:"); 41 | cause.printStackTrace(stream); 42 | } 43 | } 44 | 45 | @Override 46 | public void printStackTrace(PrintWriter writer) 47 | { 48 | super.printStackTrace(writer); 49 | if (cause != null) 50 | { 51 | writer.println("Caused by:"); 52 | cause.printStackTrace(writer); 53 | } 54 | } 55 | 56 | @Override 57 | public Throwable getCause() 58 | { 59 | return cause; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/exception/job/TaskException.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.exception.job; 2 | 3 | /** 4 | * 计划策略异常 5 | * 6 | * @author ruoyi 7 | */ 8 | public class TaskException extends Exception 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | private Code code; 13 | 14 | public TaskException(String msg, Code code) 15 | { 16 | this(msg, code, null); 17 | } 18 | 19 | public TaskException(String msg, Code code, Exception nestedEx) 20 | { 21 | super(msg, nestedEx); 22 | this.code = code; 23 | } 24 | 25 | public Code getCode() 26 | { 27 | return code; 28 | } 29 | 30 | public enum Code 31 | { 32 | TASK_EXISTS, NO_TASK_EXISTS, TASK_ALREADY_STARTED, UNKNOWN, CONFIG_ERROR, TASK_NODE_NOT_AVAILABLE 33 | } 34 | } -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/exception/user/BlackListException.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.exception.user; 2 | 3 | /** 4 | * 黑名单IP异常类 5 | * 6 | * @author ruoyi 7 | */ 8 | public class BlackListException extends UserException 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public BlackListException() 13 | { 14 | super("login.blocked", null); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/exception/user/CaptchaException.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.exception.user; 2 | 3 | /** 4 | * 验证码错误异常类 5 | * 6 | * @author ruoyi 7 | */ 8 | public class CaptchaException extends UserException 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public CaptchaException() 13 | { 14 | super("user.jcaptcha.error", null); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/exception/user/CaptchaExpireException.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.exception.user; 2 | 3 | /** 4 | * 验证码失效异常类 5 | * 6 | * @author ruoyi 7 | */ 8 | public class CaptchaExpireException extends UserException 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public CaptchaExpireException() 13 | { 14 | super("user.jcaptcha.expire", null); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/exception/user/UserException.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.exception.user; 2 | 3 | import cc.douyidou.common.exception.base.BaseException; 4 | 5 | /** 6 | * 用户信息异常类 7 | * 8 | * @author ruoyi 9 | */ 10 | public class UserException extends BaseException 11 | { 12 | private static final long serialVersionUID = 1L; 13 | 14 | public UserException(String code, Object[] args) 15 | { 16 | super("user", code, args, null); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/exception/user/UserNotExistsException.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.exception.user; 2 | 3 | /** 4 | * 用户不存在异常类 5 | * 6 | * @author ruoyi 7 | */ 8 | public class UserNotExistsException extends UserException 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public UserNotExistsException() 13 | { 14 | super("user.not.exists", null); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/exception/user/UserPasswordNotMatchException.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.exception.user; 2 | 3 | /** 4 | * 用户密码不正确或不符合规范异常类 5 | * 6 | * @author ruoyi 7 | */ 8 | public class UserPasswordNotMatchException extends UserException 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public UserPasswordNotMatchException() 13 | { 14 | super("user.password.not.match", null); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/exception/user/UserPasswordRetryLimitExceedException.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.exception.user; 2 | 3 | /** 4 | * 用户错误最大次数异常类 5 | * 6 | * @author ruoyi 7 | */ 8 | public class UserPasswordRetryLimitExceedException extends UserException 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public UserPasswordRetryLimitExceedException(int retryLimitCount, int lockTime) 13 | { 14 | super("user.password.retry.limit.exceed", new Object[] { retryLimitCount, lockTime }); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/filter/PropertyPreExcludeFilter.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.filter; 2 | 3 | import com.alibaba.fastjson2.filter.SimplePropertyPreFilter; 4 | 5 | /** 6 | * 排除JSON敏感属性 7 | * 8 | * @author ruoyi 9 | */ 10 | public class PropertyPreExcludeFilter extends SimplePropertyPreFilter 11 | { 12 | public PropertyPreExcludeFilter() 13 | { 14 | } 15 | 16 | public PropertyPreExcludeFilter addExcludes(String... filters) 17 | { 18 | for (int i = 0; i < filters.length; i++) 19 | { 20 | this.getExcludes().add(filters[i]); 21 | } 22 | return this; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/filter/RepeatableFilter.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.filter; 2 | 3 | import java.io.IOException; 4 | import jakarta.servlet.Filter; 5 | import jakarta.servlet.FilterChain; 6 | import jakarta.servlet.FilterConfig; 7 | import jakarta.servlet.ServletException; 8 | import jakarta.servlet.ServletRequest; 9 | import jakarta.servlet.ServletResponse; 10 | import jakarta.servlet.http.HttpServletRequest; 11 | import org.springframework.http.MediaType; 12 | import cc.douyidou.common.utils.StringUtils; 13 | 14 | /** 15 | * Repeatable 过滤器 16 | * 17 | * @author ruoyi 18 | */ 19 | public class RepeatableFilter implements Filter 20 | { 21 | @Override 22 | public void init(FilterConfig filterConfig) throws ServletException 23 | { 24 | 25 | } 26 | 27 | @Override 28 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) 29 | throws IOException, ServletException 30 | { 31 | ServletRequest requestWrapper = null; 32 | if (request instanceof HttpServletRequest 33 | && StringUtils.startsWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE)) 34 | { 35 | requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response); 36 | } 37 | if (null == requestWrapper) 38 | { 39 | chain.doFilter(request, response); 40 | } 41 | else 42 | { 43 | chain.doFilter(requestWrapper, response); 44 | } 45 | } 46 | 47 | @Override 48 | public void destroy() 49 | { 50 | 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/sensitive/Sensitive.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.sensitive; 2 | 3 | import com.fasterxml.jackson.annotation.JacksonAnnotationsInside; 4 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 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 | * 脱敏注解 13 | * 14 | **/ 15 | @Retention(RetentionPolicy.RUNTIME) 16 | @Target(ElementType.FIELD) 17 | @JacksonAnnotationsInside 18 | @JsonSerialize(using = SensitiveSerialize.class) 19 | public @interface Sensitive { 20 | 21 | /** 22 | * 脱敏数据类型 23 | */ 24 | SensitiveTypeEnum type(); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/sensitive/SensitiveTypeEnum.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.sensitive; 2 | 3 | /** 4 | * 敏感信息枚举类 5 | * 6 | * @author JooLun 7 | * @Author: https://www.cnblogs.com/xiluonanfeng/p/10183926.html 8 | **/ 9 | public enum SensitiveTypeEnum { 10 | 11 | /** 12 | * 用户名, 李*天, 张* 13 | */ 14 | CHINESE_NAME, 15 | /** 16 | * 手机号, 185****1653 17 | */ 18 | MOBILE_PHONE, 19 | /** 20 | * 电子邮件, r*****o@qq.com 21 | */ 22 | EMAIL, 23 | /** 24 | * 密码, ****** 25 | */ 26 | PASSWORD, 27 | /** 28 | * 密钥, 最后三位其他都是*** 29 | */ 30 | KEY 31 | 32 | } 33 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/utils/DesensitizedUtil.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.utils; 2 | 3 | /** 4 | * 脱敏工具类 5 | * 6 | * @author ruoyi 7 | */ 8 | public class DesensitizedUtil 9 | { 10 | /** 11 | * 密码的全部字符都用*代替,比如:****** 12 | * 13 | * @param password 密码 14 | * @return 脱敏后的密码 15 | */ 16 | public static String password(String password) 17 | { 18 | if (StringUtils.isBlank(password)) 19 | { 20 | return StringUtils.EMPTY; 21 | } 22 | return StringUtils.repeat('*', password.length()); 23 | } 24 | 25 | /** 26 | * 车牌中间用*代替,如果是错误的车牌,不处理 27 | * 28 | * @param carLicense 完整的车牌号 29 | * @return 脱敏后的车牌 30 | */ 31 | public static String carLicense(String carLicense) 32 | { 33 | if (StringUtils.isBlank(carLicense)) 34 | { 35 | return StringUtils.EMPTY; 36 | } 37 | // 普通车牌 38 | if (carLicense.length() == 7) 39 | { 40 | carLicense = StringUtils.hide(carLicense, 3, 6); 41 | } 42 | else if (carLicense.length() == 8) 43 | { 44 | // 新能源车牌 45 | carLicense = StringUtils.hide(carLicense, 3, 7); 46 | } 47 | return carLicense; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/utils/ExceptionUtil.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.utils; 2 | 3 | import java.io.PrintWriter; 4 | import java.io.StringWriter; 5 | import org.apache.commons.lang3.exception.ExceptionUtils; 6 | 7 | /** 8 | * 错误信息处理类。 9 | * 10 | * @author ruoyi 11 | */ 12 | public class ExceptionUtil 13 | { 14 | /** 15 | * 获取exception的详细错误信息。 16 | */ 17 | public static String getExceptionMessage(Throwable e) 18 | { 19 | StringWriter sw = new StringWriter(); 20 | e.printStackTrace(new PrintWriter(sw, true)); 21 | return sw.toString(); 22 | } 23 | 24 | public static String getRootErrorMessage(Exception e) 25 | { 26 | Throwable root = ExceptionUtils.getRootCause(e); 27 | root = (root == null ? e : root); 28 | if (root == null) 29 | { 30 | return ""; 31 | } 32 | String msg = root.getMessage(); 33 | if (msg == null) 34 | { 35 | return "null"; 36 | } 37 | return StringUtils.defaultString(msg); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/utils/LogUtils.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.utils; 2 | 3 | /** 4 | * 处理并记录日志文件 5 | * 6 | * @author ruoyi 7 | */ 8 | public class LogUtils 9 | { 10 | public static String getBlock(Object msg) 11 | { 12 | if (msg == null) 13 | { 14 | msg = ""; 15 | } 16 | return "[" + msg.toString() + "]"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/utils/MessageUtils.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.utils; 2 | 3 | import org.springframework.context.MessageSource; 4 | import org.springframework.context.i18n.LocaleContextHolder; 5 | import cc.douyidou.common.utils.spring.SpringUtils; 6 | 7 | /** 8 | * 获取i18n资源文件 9 | * 10 | * @author ruoyi 11 | */ 12 | public class MessageUtils 13 | { 14 | /** 15 | * 根据消息键和参数 获取消息 委托给spring messageSource 16 | * 17 | * @param code 消息键 18 | * @param args 参数 19 | * @return 获取国际化翻译值 20 | */ 21 | public static String message(String code, Object... args) 22 | { 23 | MessageSource messageSource = SpringUtils.getBean(MessageSource.class); 24 | return messageSource.getMessage(code, args, LocaleContextHolder.getLocale()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/utils/PageUtils.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.utils; 2 | 3 | import com.github.pagehelper.PageHelper; 4 | import cc.douyidou.common.core.page.PageDomain; 5 | import cc.douyidou.common.core.page.TableSupport; 6 | import cc.douyidou.common.utils.sql.SqlUtil; 7 | 8 | /** 9 | * 分页工具类 10 | * 11 | * @author ruoyi 12 | */ 13 | public class PageUtils extends PageHelper 14 | { 15 | /** 16 | * 设置请求分页数据 17 | */ 18 | public static void startPage() 19 | { 20 | PageDomain pageDomain = TableSupport.buildPageRequest(); 21 | Integer pageNum = pageDomain.getPageNum(); 22 | Integer pageSize = pageDomain.getPageSize(); 23 | String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); 24 | Boolean reasonable = pageDomain.getReasonable(); 25 | PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable); 26 | } 27 | 28 | /** 29 | * 清理分页的线程变量 30 | */ 31 | public static void clearPage() 32 | { 33 | PageHelper.clearPage(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/utils/bean/BeanValidators.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.utils.bean; 2 | 3 | import java.util.Set; 4 | import jakarta.validation.ConstraintViolation; 5 | import jakarta.validation.ConstraintViolationException; 6 | import jakarta.validation.Validator; 7 | 8 | /** 9 | * bean对象属性验证 10 | * 11 | * @author ruoyi 12 | */ 13 | public class BeanValidators 14 | { 15 | public static void validateWithException(Validator validator, Object object, Class... groups) 16 | throws ConstraintViolationException 17 | { 18 | Set> constraintViolations = validator.validate(object, groups); 19 | if (!constraintViolations.isEmpty()) 20 | { 21 | throw new ConstraintViolationException(constraintViolations); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/utils/file/MimeTypeUtils.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.utils.file; 2 | 3 | /** 4 | * 媒体类型工具类 5 | * 6 | * @author ruoyi 7 | */ 8 | public class MimeTypeUtils 9 | { 10 | public static final String IMAGE_PNG = "image/png"; 11 | 12 | public static final String IMAGE_JPG = "image/jpg"; 13 | 14 | public static final String IMAGE_JPEG = "image/jpeg"; 15 | 16 | public static final String IMAGE_BMP = "image/bmp"; 17 | 18 | public static final String IMAGE_GIF = "image/gif"; 19 | 20 | public static final String[] IMAGE_EXTENSION = { "bmp", "gif", "jpg", "jpeg", "png" }; 21 | 22 | public static final String[] FLASH_EXTENSION = { "swf", "flv" }; 23 | 24 | public static final String[] MEDIA_EXTENSION = { "swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg", 25 | "asf", "rm", "rmvb" }; 26 | 27 | public static final String[] VIDEO_EXTENSION = { "mp4", "avi", "rmvb" }; 28 | 29 | public static final String[] DEFAULT_ALLOWED_EXTENSION = { 30 | // 图片 31 | "bmp", "gif", "jpg", "jpeg", "png", 32 | // word excel powerpoint 33 | "doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt", 34 | // 压缩文件 35 | "rar", "zip", "gz", "bz2", 36 | // 视频格式 37 | "mp4", "avi", "rmvb", 38 | // pdf 39 | "pdf" }; 40 | 41 | public static String getExtension(String prefix) 42 | { 43 | switch (prefix) 44 | { 45 | case IMAGE_PNG: 46 | return "png"; 47 | case IMAGE_JPG: 48 | return "jpg"; 49 | case IMAGE_JPEG: 50 | return "jpeg"; 51 | case IMAGE_BMP: 52 | return "bmp"; 53 | case IMAGE_GIF: 54 | return "gif"; 55 | default: 56 | return ""; 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/utils/http/HttpHelper.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.utils.http; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStream; 6 | import java.io.InputStreamReader; 7 | import java.nio.charset.StandardCharsets; 8 | 9 | import jakarta.servlet.ServletRequest; 10 | import org.apache.commons.lang3.exception.ExceptionUtils; 11 | import org.slf4j.Logger; 12 | import org.slf4j.LoggerFactory; 13 | 14 | /** 15 | * 通用http工具封装 16 | * 17 | * @author ruoyi 18 | */ 19 | public class HttpHelper 20 | { 21 | private static final Logger LOGGER = LoggerFactory.getLogger(HttpHelper.class); 22 | 23 | public static String getBodyString(ServletRequest request) 24 | { 25 | StringBuilder sb = new StringBuilder(); 26 | BufferedReader reader = null; 27 | try (InputStream inputStream = request.getInputStream()) 28 | { 29 | reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); 30 | String line = ""; 31 | while ((line = reader.readLine()) != null) 32 | { 33 | sb.append(line); 34 | } 35 | } 36 | catch (IOException e) 37 | { 38 | LOGGER.warn("getBodyString出现问题!"); 39 | } 40 | finally 41 | { 42 | if (reader != null) 43 | { 44 | try 45 | { 46 | reader.close(); 47 | } 48 | catch (IOException e) 49 | { 50 | LOGGER.error(ExceptionUtils.getMessage(e)); 51 | } 52 | } 53 | } 54 | return sb.toString(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/utils/ip/AddressUtils.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.utils.ip; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import com.alibaba.fastjson2.JSON; 6 | import com.alibaba.fastjson2.JSONObject; 7 | import cc.douyidou.common.config.RuoYiConfig; 8 | import cc.douyidou.common.constant.Constants; 9 | import cc.douyidou.common.utils.StringUtils; 10 | import cc.douyidou.common.utils.http.HttpUtils; 11 | 12 | /** 13 | * 获取地址类 14 | * 15 | * @author ruoyi 16 | */ 17 | public class AddressUtils 18 | { 19 | private static final Logger log = LoggerFactory.getLogger(AddressUtils.class); 20 | 21 | // IP地址查询 22 | public static final String IP_URL = "http://whois.pconline.com.cn/ipJson.jsp"; 23 | 24 | // 未知地址 25 | public static final String UNKNOWN = "XX XX"; 26 | 27 | public static String getRealAddressByIP(String ip) 28 | { 29 | // 内网不查询 30 | if (IpUtils.internalIp(ip)) 31 | { 32 | return "内网IP"; 33 | } 34 | if (RuoYiConfig.isAddressEnabled()) 35 | { 36 | try 37 | { 38 | String rspStr = HttpUtils.sendGet(IP_URL, "ip=" + ip + "&json=true", Constants.GBK); 39 | if (StringUtils.isEmpty(rspStr)) 40 | { 41 | log.error("获取地理位置异常 {}", ip); 42 | return UNKNOWN; 43 | } 44 | JSONObject obj = JSON.parseObject(rspStr); 45 | String region = obj.getString("pro"); 46 | String city = obj.getString("city"); 47 | return String.format("%s %s", region, city); 48 | } 49 | catch (Exception e) 50 | { 51 | log.error("获取地理位置异常 {}", ip); 52 | } 53 | } 54 | return UNKNOWN; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/utils/poi/ExcelHandlerAdapter.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.utils.poi; 2 | 3 | import org.apache.poi.ss.usermodel.Cell; 4 | import org.apache.poi.ss.usermodel.Workbook; 5 | 6 | /** 7 | * Excel数据格式处理适配器 8 | * 9 | * @author ruoyi 10 | */ 11 | public interface ExcelHandlerAdapter 12 | { 13 | /** 14 | * 格式化 15 | * 16 | * @param value 单元格数据值 17 | * @param args excel注解args参数组 18 | * @param cell 单元格对象 19 | * @param wb 工作簿对象 20 | * 21 | * @return 处理后的值 22 | */ 23 | Object format(Object value, String[] args, Cell cell, Workbook wb); 24 | } 25 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/utils/sign/Md5Utils.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.utils.sign; 2 | 3 | import java.nio.charset.StandardCharsets; 4 | import java.security.MessageDigest; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | 8 | /** 9 | * Md5加密方法 10 | * 11 | * @author ruoyi 12 | */ 13 | public class Md5Utils 14 | { 15 | private static final Logger log = LoggerFactory.getLogger(Md5Utils.class); 16 | 17 | private static byte[] md5(String s) 18 | { 19 | MessageDigest algorithm; 20 | try 21 | { 22 | algorithm = MessageDigest.getInstance("MD5"); 23 | algorithm.reset(); 24 | algorithm.update(s.getBytes("UTF-8")); 25 | byte[] messageDigest = algorithm.digest(); 26 | return messageDigest; 27 | } 28 | catch (Exception e) 29 | { 30 | log.error("MD5 Error...", e); 31 | } 32 | return null; 33 | } 34 | 35 | private static final String toHex(byte hash[]) 36 | { 37 | if (hash == null) 38 | { 39 | return null; 40 | } 41 | StringBuffer buf = new StringBuffer(hash.length * 2); 42 | int i; 43 | 44 | for (i = 0; i < hash.length; i++) 45 | { 46 | if ((hash[i] & 0xff) < 0x10) 47 | { 48 | buf.append("0"); 49 | } 50 | buf.append(Long.toString(hash[i] & 0xff, 16)); 51 | } 52 | return buf.toString(); 53 | } 54 | 55 | public static String hash(String s) 56 | { 57 | try 58 | { 59 | return new String(toHex(md5(s)).getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8); 60 | } 61 | catch (Exception e) 62 | { 63 | log.error("not supported charset...{}", e); 64 | return s; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/utils/sql/SqlUtil.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.utils.sql; 2 | 3 | import cc.douyidou.common.exception.UtilException; 4 | import cc.douyidou.common.utils.StringUtils; 5 | 6 | /** 7 | * sql操作工具类 8 | * 9 | * @author ruoyi 10 | */ 11 | public class SqlUtil 12 | { 13 | /** 14 | * 定义常用的 sql关键字 15 | */ 16 | public static String SQL_REGEX = "\u000B|and |extractvalue|updatexml|sleep|exec |insert |select |delete |update |drop |count |chr |mid |master |truncate |char |declare |or |union |like |+|/*|user()"; 17 | 18 | /** 19 | * 仅支持字母、数字、下划线、空格、逗号、小数点(支持多个字段排序) 20 | */ 21 | public static String SQL_PATTERN = "[a-zA-Z0-9_\\ \\,\\.]+"; 22 | 23 | /** 24 | * 限制orderBy最大长度 25 | */ 26 | private static final int ORDER_BY_MAX_LENGTH = 500; 27 | 28 | /** 29 | * 检查字符,防止注入绕过 30 | */ 31 | public static String escapeOrderBySql(String value) 32 | { 33 | if (StringUtils.isNotEmpty(value) && !isValidOrderBySql(value)) 34 | { 35 | throw new UtilException("参数不符合规范,不能进行查询"); 36 | } 37 | if (StringUtils.length(value) > ORDER_BY_MAX_LENGTH) 38 | { 39 | throw new UtilException("参数已超过最大限制,不能进行查询"); 40 | } 41 | return value; 42 | } 43 | 44 | /** 45 | * 验证 order by 语法是否符合规范 46 | */ 47 | public static boolean isValidOrderBySql(String value) 48 | { 49 | return value.matches(SQL_PATTERN); 50 | } 51 | 52 | /** 53 | * SQL关键字检查 54 | */ 55 | public static void filterKeyword(String value) 56 | { 57 | if (StringUtils.isEmpty(value)) 58 | { 59 | return; 60 | } 61 | String[] sqlKeywords = StringUtils.split(SQL_REGEX, "\\|"); 62 | for (String sqlKeyword : sqlKeywords) 63 | { 64 | if (StringUtils.indexOfIgnoreCase(value, sqlKeyword) > -1) 65 | { 66 | throw new UtilException("参数存在SQL注入风险"); 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/utils/uuid/IdUtils.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.utils.uuid; 2 | 3 | /** 4 | * ID生成器工具类 5 | * 6 | * @author ruoyi 7 | */ 8 | public class IdUtils 9 | { 10 | /** 11 | * 获取随机UUID 12 | * 13 | * @return 随机UUID 14 | */ 15 | public static String randomUUID() 16 | { 17 | return UUID.randomUUID().toString(); 18 | } 19 | 20 | /** 21 | * 简化的UUID,去掉了横线 22 | * 23 | * @return 简化的UUID,去掉了横线 24 | */ 25 | public static String simpleUUID() 26 | { 27 | return UUID.randomUUID().toString(true); 28 | } 29 | 30 | /** 31 | * 获取随机UUID,使用性能更好的ThreadLocalRandom生成UUID 32 | * 33 | * @return 随机UUID 34 | */ 35 | public static String fastUUID() 36 | { 37 | return UUID.fastUUID().toString(); 38 | } 39 | 40 | /** 41 | * 简化的UUID,去掉了横线,使用性能更好的ThreadLocalRandom生成UUID 42 | * 43 | * @return 简化的UUID,去掉了横线 44 | */ 45 | public static String fastSimpleUUID() 46 | { 47 | return UUID.fastUUID().toString(true); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/xss/Xss.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.xss; 2 | 3 | import jakarta.validation.Constraint; 4 | import jakarta.validation.Payload; 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 | * 自定义xss校验注解 13 | * 14 | * @author ruoyi 15 | */ 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @Target(value = { ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.PARAMETER }) 18 | @Constraint(validatedBy = { XssValidator.class }) 19 | public @interface Xss 20 | { 21 | String message() 22 | 23 | default "不允许任何脚本运行"; 24 | 25 | Class[] groups() default {}; 26 | 27 | Class[] payload() default {}; 28 | } 29 | -------------------------------------------------------------------------------- /douyidou-common/src/main/java/cc/douyidou/common/xss/XssValidator.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.common.xss; 2 | 3 | import cc.douyidou.common.utils.StringUtils; 4 | import jakarta.validation.ConstraintValidator; 5 | import jakarta.validation.ConstraintValidatorContext; 6 | import java.util.regex.Matcher; 7 | import java.util.regex.Pattern; 8 | 9 | /** 10 | * 自定义xss校验注解实现 11 | * 12 | * @author ruoyi 13 | */ 14 | public class XssValidator implements ConstraintValidator 15 | { 16 | private static final String HTML_PATTERN = "<(\\S*?)[^>]*>.*?|<.*? />"; 17 | 18 | @Override 19 | public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) 20 | { 21 | if (StringUtils.isBlank(value)) 22 | { 23 | return true; 24 | } 25 | return !containsHtml(value); 26 | } 27 | 28 | public static boolean containsHtml(String value) 29 | { 30 | StringBuilder sHtml = new StringBuilder(); 31 | Pattern pattern = Pattern.compile(HTML_PATTERN); 32 | Matcher matcher = pattern.matcher(value); 33 | while (matcher.find()) 34 | { 35 | sHtml.append(matcher.group()); 36 | } 37 | return pattern.matcher(sHtml).matches(); 38 | } 39 | } -------------------------------------------------------------------------------- /douyidou-framework/src/main/java/cc/douyidou/framework/config/ApplicationConfig.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.framework.config; 2 | 3 | import java.util.TimeZone; 4 | import org.mybatis.spring.annotation.MapperScan; 5 | import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.context.annotation.EnableAspectJAutoProxy; 9 | 10 | /** 11 | * 程序注解配置 12 | * 13 | * @author ruoyi 14 | */ 15 | @Configuration 16 | // 表示通过aop框架暴露该代理对象,AopContext能够访问 17 | @EnableAspectJAutoProxy(exposeProxy = true) 18 | // 指定要扫描的Mapper类的包的路径 19 | @MapperScan("cc.douyidou.**.mapper") 20 | public class ApplicationConfig 21 | { 22 | /** 23 | * 时区配置 24 | */ 25 | @Bean 26 | public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization() 27 | { 28 | return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /douyidou-framework/src/main/java/cc/douyidou/framework/config/FastJson2JsonRedisSerializer.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.framework.config; 2 | 3 | import java.nio.charset.Charset; 4 | import org.springframework.data.redis.serializer.RedisSerializer; 5 | import org.springframework.data.redis.serializer.SerializationException; 6 | import com.alibaba.fastjson2.JSON; 7 | import com.alibaba.fastjson2.JSONReader; 8 | import com.alibaba.fastjson2.JSONWriter; 9 | import com.alibaba.fastjson2.filter.Filter; 10 | import cc.douyidou.common.constant.Constants; 11 | 12 | /** 13 | * Redis使用FastJson序列化 14 | * 15 | * @author ruoyi 16 | */ 17 | public class FastJson2JsonRedisSerializer implements RedisSerializer 18 | { 19 | public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8"); 20 | 21 | static final Filter AUTO_TYPE_FILTER = JSONReader.autoTypeFilter(Constants.JSON_WHITELIST_STR); 22 | 23 | private Class clazz; 24 | 25 | public FastJson2JsonRedisSerializer(Class clazz) 26 | { 27 | super(); 28 | this.clazz = clazz; 29 | } 30 | 31 | @Override 32 | public byte[] serialize(T t) throws SerializationException 33 | { 34 | if (t == null) 35 | { 36 | return new byte[0]; 37 | } 38 | return JSON.toJSONString(t, JSONWriter.Feature.WriteClassName).getBytes(DEFAULT_CHARSET); 39 | } 40 | 41 | @Override 42 | public T deserialize(byte[] bytes) throws SerializationException 43 | { 44 | if (bytes == null || bytes.length <= 0) 45 | { 46 | return null; 47 | } 48 | String str = new String(bytes, DEFAULT_CHARSET); 49 | 50 | return JSON.parseObject(str, clazz, AUTO_TYPE_FILTER); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /douyidou-framework/src/main/java/cc/douyidou/framework/config/I18nConfig.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.framework.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.servlet.LocaleResolver; 6 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 7 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 8 | import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; 9 | import org.springframework.web.servlet.i18n.SessionLocaleResolver; 10 | import cc.douyidou.common.constant.Constants; 11 | 12 | /** 13 | * 资源文件配置加载 14 | * 15 | * @author ruoyi 16 | */ 17 | @Configuration 18 | public class I18nConfig implements WebMvcConfigurer 19 | { 20 | @Bean 21 | public LocaleResolver localeResolver() 22 | { 23 | SessionLocaleResolver slr = new SessionLocaleResolver(); 24 | // 默认语言 25 | slr.setDefaultLocale(Constants.DEFAULT_LOCALE); 26 | return slr; 27 | } 28 | 29 | @Bean 30 | public LocaleChangeInterceptor localeChangeInterceptor() 31 | { 32 | LocaleChangeInterceptor lci = new LocaleChangeInterceptor(); 33 | // 参数名 34 | lci.setParamName("lang"); 35 | return lci; 36 | } 37 | 38 | @Override 39 | public void addInterceptors(InterceptorRegistry registry) 40 | { 41 | registry.addInterceptor(localeChangeInterceptor()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /douyidou-framework/src/main/java/cc/douyidou/framework/config/MybatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.framework.config; 2 | 3 | import com.baomidou.mybatisplus.annotation.DbType; 4 | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; 5 | import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor; 6 | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | 10 | 11 | @Configuration 12 | public class MybatisPlusConfig { 13 | 14 | @Bean 15 | public MybatisPlusInterceptor mybatisPlusInterceptor() { 16 | MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor(); 17 | 18 | // 乐观锁配置 19 | mybatisPlusInterceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor()); 20 | 21 | // 分页配置 22 | mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); 23 | return mybatisPlusInterceptor; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /douyidou-framework/src/main/java/cc/douyidou/framework/config/ServerConfig.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.framework.config; 2 | 3 | import cn.hutool.core.util.ObjectUtil; 4 | import jakarta.servlet.http.HttpServletRequest; 5 | import org.springframework.stereotype.Component; 6 | import cc.douyidou.common.utils.ServletUtils; 7 | 8 | /** 9 | * 服务相关配置 10 | * 11 | * @author ruoyi 12 | */ 13 | @Component 14 | public class ServerConfig 15 | { 16 | /** 17 | * 获取完整的请求路径,包括:域名,端口,上下文访问路径 18 | * 19 | * @return 服务地址 20 | */ 21 | public String getUrl() 22 | { 23 | HttpServletRequest request = ServletUtils.getRequest(); 24 | return getDomain(request); 25 | } 26 | 27 | public static String getDomain(HttpServletRequest request) 28 | { 29 | String domain = request.getHeader("X-Host"); 30 | if(ObjectUtil.isNull(domain)) domain = request.getHeader("Host"); 31 | if (domain.contains("127.0.0.1") || domain.contains("localhost") || domain.contains("192.168")) { 32 | StringBuffer url = request.getRequestURL(); 33 | String contextPath = request.getServletContext().getContextPath(); 34 | return url.delete(url.length() - request.getRequestURI().length(), url.length()).append(contextPath).toString(); 35 | } else { 36 | return "https://"+domain; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /douyidou-framework/src/main/java/cc/douyidou/framework/config/typehandler/ArrayLongTypeHandler.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.framework.config.typehandler; 2 | 3 | import cn.hutool.json.JSONUtil; 4 | import org.apache.ibatis.type.BaseTypeHandler; 5 | import org.apache.ibatis.type.JdbcType; 6 | import org.apache.ibatis.type.MappedJdbcTypes; 7 | import org.apache.ibatis.type.MappedTypes; 8 | 9 | import java.sql.CallableStatement; 10 | import java.sql.PreparedStatement; 11 | import java.sql.ResultSet; 12 | import java.sql.SQLException; 13 | 14 | /** 15 | * 存储到数据库, 将LONG数组转换成字符串; 16 | * 从数据库获取数据, 将字符串转为LONG数组. 17 | */ 18 | @MappedTypes({Long[].class}) 19 | @MappedJdbcTypes({JdbcType.VARCHAR}) 20 | public class ArrayLongTypeHandler extends BaseTypeHandler { 21 | 22 | private static Long[] l = new Long[]{}; 23 | 24 | @Override 25 | public void setNonNullParameter(PreparedStatement ps, int i, 26 | Long[] parameter, JdbcType jdbcType) throws SQLException { 27 | ps.setString(i, JSONUtil.toJsonStr(parameter)); 28 | } 29 | 30 | @Override 31 | public Long[] getNullableResult(ResultSet rs, String columnName) 32 | throws SQLException { 33 | return JSONUtil.parseArray(rs.getString(columnName)).toArray(l); 34 | } 35 | 36 | @Override 37 | public Long[] getNullableResult(ResultSet rs, int columnIndex) 38 | throws SQLException { 39 | return JSONUtil.parseArray(rs.getString(columnIndex)).toArray(l); 40 | } 41 | 42 | @Override 43 | public Long[] getNullableResult(CallableStatement cs, int columnIndex) 44 | throws SQLException { 45 | return JSONUtil.parseArray(cs.getString(columnIndex)).toArray(l); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /douyidou-framework/src/main/java/cc/douyidou/framework/config/typehandler/ArrayStringTypeHandler.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.framework.config.typehandler; 2 | 3 | import cn.hutool.json.JSONUtil; 4 | import org.apache.ibatis.type.BaseTypeHandler; 5 | import org.apache.ibatis.type.JdbcType; 6 | import org.apache.ibatis.type.MappedJdbcTypes; 7 | import org.apache.ibatis.type.MappedTypes; 8 | 9 | import java.sql.CallableStatement; 10 | import java.sql.PreparedStatement; 11 | import java.sql.ResultSet; 12 | import java.sql.SQLException; 13 | 14 | /** 15 | * 存储到数据库, 将String数组转换成字符串; 16 | * 从数据库获取数据, 将字符串转为LONG数组. 17 | */ 18 | @MappedTypes({String[].class}) 19 | @MappedJdbcTypes({JdbcType.VARCHAR}) 20 | public class ArrayStringTypeHandler extends BaseTypeHandler { 21 | 22 | private static String[] l = new String[]{}; 23 | 24 | @Override 25 | public void setNonNullParameter(PreparedStatement ps, int i, 26 | String[] parameter, JdbcType jdbcType) throws SQLException { 27 | ps.setString(i, JSONUtil.toJsonStr(parameter)); 28 | } 29 | 30 | @Override 31 | public String[] getNullableResult(ResultSet rs, String columnName) 32 | throws SQLException { 33 | return JSONUtil.parseArray(rs.getString(columnName)).toArray(l); 34 | } 35 | 36 | @Override 37 | public String[] getNullableResult(ResultSet rs, int columnIndex) 38 | throws SQLException { 39 | return JSONUtil.parseArray(rs.getString(columnIndex)).toArray(l); 40 | } 41 | 42 | @Override 43 | public String[] getNullableResult(CallableStatement cs, int columnIndex) 44 | throws SQLException { 45 | return JSONUtil.parseArray(cs.getString(columnIndex)).toArray(l); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /douyidou-framework/src/main/java/cc/douyidou/framework/config/typehandler/JsonTypeHandler.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.framework.config.typehandler; 2 | 3 | import cn.hutool.json.JSONObject; 4 | import cn.hutool.json.JSONUtil; 5 | import org.apache.ibatis.type.BaseTypeHandler; 6 | import org.apache.ibatis.type.JdbcType; 7 | import org.apache.ibatis.type.MappedJdbcTypes; 8 | import org.apache.ibatis.type.MappedTypes; 9 | 10 | import java.sql.CallableStatement; 11 | import java.sql.PreparedStatement; 12 | import java.sql.ResultSet; 13 | import java.sql.SQLException; 14 | 15 | /** 16 | * 存储到数据库, 将JSON对象转换成字符串; 17 | * 从数据库获取数据, 将字符串转为JSON对象. 18 | */ 19 | @MappedTypes({JSONObject.class}) 20 | @MappedJdbcTypes({JdbcType.VARCHAR}) 21 | public class JsonTypeHandler extends BaseTypeHandler { 22 | 23 | @Override 24 | public void setNonNullParameter(PreparedStatement ps, int i, JSONObject parameter, 25 | JdbcType jdbcType) throws SQLException { 26 | 27 | ps.setString(i, JSONUtil.toJsonStr(parameter)); 28 | } 29 | 30 | @Override 31 | public JSONObject getNullableResult(ResultSet rs, String columnName) 32 | throws SQLException { 33 | 34 | return JSONUtil.parseObj(rs.getString(columnName)).toBean(JSONObject.class); 35 | } 36 | 37 | @Override 38 | public JSONObject getNullableResult(ResultSet rs, int columnIndex) throws SQLException { 39 | 40 | return JSONUtil.parseObj(rs.getString(columnIndex)).toBean(JSONObject.class); 41 | } 42 | 43 | @Override 44 | public JSONObject getNullableResult(CallableStatement cs, int columnIndex) 45 | throws SQLException { 46 | 47 | return JSONUtil.parseObj(cs.getString(columnIndex)).toBean(JSONObject.class); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /douyidou-framework/src/main/java/cc/douyidou/framework/datasource/DynamicDataSource.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.framework.datasource; 2 | 3 | import java.util.Map; 4 | import javax.sql.DataSource; 5 | import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; 6 | 7 | /** 8 | * 动态数据源 9 | * 10 | * @author ruoyi 11 | */ 12 | public class DynamicDataSource extends AbstractRoutingDataSource 13 | { 14 | public DynamicDataSource(DataSource defaultTargetDataSource, Map targetDataSources) 15 | { 16 | super.setDefaultTargetDataSource(defaultTargetDataSource); 17 | super.setTargetDataSources(targetDataSources); 18 | super.afterPropertiesSet(); 19 | } 20 | 21 | @Override 22 | protected Object determineCurrentLookupKey() 23 | { 24 | return DynamicDataSourceContextHolder.getDataSourceType(); 25 | } 26 | } -------------------------------------------------------------------------------- /douyidou-framework/src/main/java/cc/douyidou/framework/datasource/DynamicDataSourceContextHolder.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.framework.datasource; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | /** 7 | * 数据源切换处理 8 | * 9 | * @author ruoyi 10 | */ 11 | public class DynamicDataSourceContextHolder 12 | { 13 | public static final Logger log = LoggerFactory.getLogger(DynamicDataSourceContextHolder.class); 14 | 15 | /** 16 | * 使用ThreadLocal维护变量,ThreadLocal为每个使用该变量的线程提供独立的变量副本, 17 | * 所以每一个线程都可以独立地改变自己的副本,而不会影响其它线程所对应的副本。 18 | */ 19 | private static final ThreadLocal CONTEXT_HOLDER = new ThreadLocal<>(); 20 | 21 | /** 22 | * 设置数据源的变量 23 | */ 24 | public static void setDataSourceType(String dsType) 25 | { 26 | log.info("切换到{}数据源", dsType); 27 | CONTEXT_HOLDER.set(dsType); 28 | } 29 | 30 | /** 31 | * 获得数据源的变量 32 | */ 33 | public static String getDataSourceType() 34 | { 35 | return CONTEXT_HOLDER.get(); 36 | } 37 | 38 | /** 39 | * 清空数据源变量 40 | */ 41 | public static void clearDataSourceType() 42 | { 43 | CONTEXT_HOLDER.remove(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /douyidou-framework/src/main/java/cc/douyidou/framework/interceptor/RepeatSubmitInterceptor.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.framework.interceptor; 2 | 3 | import java.lang.reflect.Method; 4 | import jakarta.servlet.http.HttpServletRequest; 5 | import jakarta.servlet.http.HttpServletResponse; 6 | import org.springframework.stereotype.Component; 7 | import org.springframework.web.method.HandlerMethod; 8 | import org.springframework.web.servlet.HandlerInterceptor; 9 | import com.alibaba.fastjson2.JSON; 10 | import cc.douyidou.common.annotation.RepeatSubmit; 11 | import cc.douyidou.common.core.domain.AjaxResult; 12 | import cc.douyidou.common.utils.ServletUtils; 13 | 14 | /** 15 | * 防止重复提交拦截器 16 | * 17 | * @author ruoyi 18 | */ 19 | @Component 20 | public abstract class RepeatSubmitInterceptor implements HandlerInterceptor 21 | { 22 | @Override 23 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception 24 | { 25 | if (handler instanceof HandlerMethod) 26 | { 27 | HandlerMethod handlerMethod = (HandlerMethod) handler; 28 | Method method = handlerMethod.getMethod(); 29 | RepeatSubmit annotation = method.getAnnotation(RepeatSubmit.class); 30 | if (annotation != null) 31 | { 32 | if (this.isRepeatSubmit(request, annotation)) 33 | { 34 | AjaxResult ajaxResult = AjaxResult.error(annotation.message()); 35 | ServletUtils.renderString(response, JSON.toJSONString(ajaxResult)); 36 | return false; 37 | } 38 | } 39 | return true; 40 | } 41 | else 42 | { 43 | return true; 44 | } 45 | } 46 | 47 | /** 48 | * 验证是否重复提交由子类实现具体的防重复提交的规则 49 | * 50 | * @param request 请求信息 51 | * @param annotation 防重复注解参数 52 | * @return 结果 53 | * @throws Exception 54 | */ 55 | public abstract boolean isRepeatSubmit(HttpServletRequest request, RepeatSubmit annotation); 56 | } 57 | -------------------------------------------------------------------------------- /douyidou-framework/src/main/java/cc/douyidou/framework/manager/AsyncManager.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.framework.manager; 2 | 3 | import java.util.TimerTask; 4 | import java.util.concurrent.ScheduledExecutorService; 5 | import java.util.concurrent.TimeUnit; 6 | import cc.douyidou.common.utils.Threads; 7 | import cc.douyidou.common.utils.spring.SpringUtils; 8 | 9 | /** 10 | * 异步任务管理器 11 | * 12 | * @author ruoyi 13 | */ 14 | public class AsyncManager 15 | { 16 | /** 17 | * 操作延迟10毫秒 18 | */ 19 | private final int OPERATE_DELAY_TIME = 10; 20 | 21 | /** 22 | * 异步操作任务调度线程池 23 | */ 24 | private ScheduledExecutorService executor = SpringUtils.getBean("scheduledExecutorService"); 25 | 26 | /** 27 | * 单例模式 28 | */ 29 | private AsyncManager(){} 30 | 31 | private static AsyncManager me = new AsyncManager(); 32 | 33 | public static AsyncManager me() 34 | { 35 | return me; 36 | } 37 | 38 | /** 39 | * 执行任务 40 | * 41 | * @param task 任务 42 | */ 43 | public void execute(TimerTask task) 44 | { 45 | executor.schedule(task, OPERATE_DELAY_TIME, TimeUnit.MILLISECONDS); 46 | } 47 | 48 | /** 49 | * 停止任务线程池 50 | */ 51 | public void shutdown() 52 | { 53 | Threads.shutdownAndAwaitTermination(executor); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /douyidou-framework/src/main/java/cc/douyidou/framework/manager/ShutdownManager.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.framework.manager; 2 | 3 | import jakarta.annotation.PreDestroy; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * 确保应用退出时能关闭后台线程 10 | * 11 | * @author ruoyi 12 | */ 13 | @Component 14 | public class ShutdownManager 15 | { 16 | private static final Logger logger = LoggerFactory.getLogger("sys-user"); 17 | 18 | @PreDestroy 19 | public void destroy() 20 | { 21 | shutdownAsyncManager(); 22 | } 23 | 24 | /** 25 | * 停止异步执行任务 26 | */ 27 | private void shutdownAsyncManager() 28 | { 29 | try 30 | { 31 | logger.info("====关闭后台任务任务线程池===="); 32 | AsyncManager.me().shutdown(); 33 | } 34 | catch (Exception e) 35 | { 36 | logger.error(e.getMessage(), e); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /douyidou-framework/src/main/java/cc/douyidou/framework/security/context/AuthenticationContextHolder.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.framework.security.context; 2 | 3 | import org.springframework.security.core.Authentication; 4 | 5 | /** 6 | * 身份验证信息 7 | * 8 | * @author ruoyi 9 | */ 10 | public class AuthenticationContextHolder 11 | { 12 | private static final ThreadLocal contextHolder = new ThreadLocal<>(); 13 | 14 | public static Authentication getContext() 15 | { 16 | return contextHolder.get(); 17 | } 18 | 19 | public static void setContext(Authentication context) 20 | { 21 | contextHolder.set(context); 22 | } 23 | 24 | public static void clearContext() 25 | { 26 | contextHolder.remove(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /douyidou-framework/src/main/java/cc/douyidou/framework/security/context/PermissionContextHolder.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.framework.security.context; 2 | 3 | import org.springframework.web.context.request.RequestAttributes; 4 | import org.springframework.web.context.request.RequestContextHolder; 5 | import cc.douyidou.common.core.text.Convert; 6 | 7 | /** 8 | * 权限信息 9 | * 10 | * @author ruoyi 11 | */ 12 | public class PermissionContextHolder 13 | { 14 | private static final String PERMISSION_CONTEXT_ATTRIBUTES = "PERMISSION_CONTEXT"; 15 | 16 | public static void setContext(String permission) 17 | { 18 | RequestContextHolder.currentRequestAttributes().setAttribute(PERMISSION_CONTEXT_ATTRIBUTES, permission, 19 | RequestAttributes.SCOPE_REQUEST); 20 | } 21 | 22 | public static String getContext() 23 | { 24 | return Convert.toStr(RequestContextHolder.currentRequestAttributes().getAttribute(PERMISSION_CONTEXT_ATTRIBUTES, 25 | RequestAttributes.SCOPE_REQUEST)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /douyidou-framework/src/main/java/cc/douyidou/framework/security/handle/AuthenticationEntryPointImpl.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.framework.security.handle; 2 | 3 | import java.io.IOException; 4 | import java.io.Serializable; 5 | import jakarta.servlet.http.HttpServletRequest; 6 | import jakarta.servlet.http.HttpServletResponse; 7 | import org.springframework.security.core.AuthenticationException; 8 | import org.springframework.security.web.AuthenticationEntryPoint; 9 | import org.springframework.stereotype.Component; 10 | import com.alibaba.fastjson2.JSON; 11 | import cc.douyidou.common.constant.HttpStatus; 12 | import cc.douyidou.common.core.domain.AjaxResult; 13 | import cc.douyidou.common.utils.ServletUtils; 14 | import cc.douyidou.common.utils.StringUtils; 15 | 16 | /** 17 | * 认证失败处理类 返回未授权 18 | * 19 | * @author ruoyi 20 | */ 21 | @Component 22 | public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint, Serializable 23 | { 24 | private static final long serialVersionUID = -8970718410437077606L; 25 | 26 | @Override 27 | public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) 28 | throws IOException 29 | { 30 | int code = HttpStatus.UNAUTHORIZED; 31 | String msg = StringUtils.format("请求访问:{},认证失败,无法访问系统资源", request.getRequestURI()); 32 | ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(code, msg))); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /douyidou-framework/src/main/java/cc/douyidou/framework/web/domain/server/Cpu.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.framework.web.domain.server; 2 | 3 | import cc.douyidou.common.utils.Arith; 4 | 5 | /** 6 | * CPU相关信息 7 | * 8 | * @author ruoyi 9 | */ 10 | public class Cpu 11 | { 12 | /** 13 | * 核心数 14 | */ 15 | private int cpuNum; 16 | 17 | /** 18 | * CPU总的使用率 19 | */ 20 | private double total; 21 | 22 | /** 23 | * CPU系统使用率 24 | */ 25 | private double sys; 26 | 27 | /** 28 | * CPU用户使用率 29 | */ 30 | private double used; 31 | 32 | /** 33 | * CPU当前等待率 34 | */ 35 | private double wait; 36 | 37 | /** 38 | * CPU当前空闲率 39 | */ 40 | private double free; 41 | 42 | public int getCpuNum() 43 | { 44 | return cpuNum; 45 | } 46 | 47 | public void setCpuNum(int cpuNum) 48 | { 49 | this.cpuNum = cpuNum; 50 | } 51 | 52 | public double getTotal() 53 | { 54 | return Arith.round(Arith.mul(total, 100), 2); 55 | } 56 | 57 | public void setTotal(double total) 58 | { 59 | this.total = total; 60 | } 61 | 62 | public double getSys() 63 | { 64 | return Arith.round(Arith.mul(sys / total, 100), 2); 65 | } 66 | 67 | public void setSys(double sys) 68 | { 69 | this.sys = sys; 70 | } 71 | 72 | public double getUsed() 73 | { 74 | return Arith.round(Arith.mul(used / total, 100), 2); 75 | } 76 | 77 | public void setUsed(double used) 78 | { 79 | this.used = used; 80 | } 81 | 82 | public double getWait() 83 | { 84 | return Arith.round(Arith.mul(wait / total, 100), 2); 85 | } 86 | 87 | public void setWait(double wait) 88 | { 89 | this.wait = wait; 90 | } 91 | 92 | public double getFree() 93 | { 94 | return Arith.round(Arith.mul(free / total, 100), 2); 95 | } 96 | 97 | public void setFree(double free) 98 | { 99 | this.free = free; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /douyidou-framework/src/main/java/cc/douyidou/framework/web/domain/server/Mem.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.framework.web.domain.server; 2 | 3 | import cc.douyidou.common.utils.Arith; 4 | 5 | /** 6 | * 內存相关信息 7 | * 8 | * @author ruoyi 9 | */ 10 | public class Mem 11 | { 12 | /** 13 | * 内存总量 14 | */ 15 | private double total; 16 | 17 | /** 18 | * 已用内存 19 | */ 20 | private double used; 21 | 22 | /** 23 | * 剩余内存 24 | */ 25 | private double free; 26 | 27 | public double getTotal() 28 | { 29 | return Arith.div(total, (1024 * 1024 * 1024), 2); 30 | } 31 | 32 | public void setTotal(long total) 33 | { 34 | this.total = total; 35 | } 36 | 37 | public double getUsed() 38 | { 39 | return Arith.div(used, (1024 * 1024 * 1024), 2); 40 | } 41 | 42 | public void setUsed(long used) 43 | { 44 | this.used = used; 45 | } 46 | 47 | public double getFree() 48 | { 49 | return Arith.div(free, (1024 * 1024 * 1024), 2); 50 | } 51 | 52 | public void setFree(long free) 53 | { 54 | this.free = free; 55 | } 56 | 57 | public double getUsage() 58 | { 59 | return Arith.mul(Arith.div(used, total, 4), 100); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /douyidou-framework/src/main/java/cc/douyidou/framework/web/domain/server/Sys.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.framework.web.domain.server; 2 | 3 | /** 4 | * 系统相关信息 5 | * 6 | * @author ruoyi 7 | */ 8 | public class Sys 9 | { 10 | /** 11 | * 服务器名称 12 | */ 13 | private String computerName; 14 | 15 | /** 16 | * 服务器Ip 17 | */ 18 | private String computerIp; 19 | 20 | /** 21 | * 项目路径 22 | */ 23 | private String userDir; 24 | 25 | /** 26 | * 操作系统 27 | */ 28 | private String osName; 29 | 30 | /** 31 | * 系统架构 32 | */ 33 | private String osArch; 34 | 35 | public String getComputerName() 36 | { 37 | return computerName; 38 | } 39 | 40 | public void setComputerName(String computerName) 41 | { 42 | this.computerName = computerName; 43 | } 44 | 45 | public String getComputerIp() 46 | { 47 | return computerIp; 48 | } 49 | 50 | public void setComputerIp(String computerIp) 51 | { 52 | this.computerIp = computerIp; 53 | } 54 | 55 | public String getUserDir() 56 | { 57 | return userDir; 58 | } 59 | 60 | public void setUserDir(String userDir) 61 | { 62 | this.userDir = userDir; 63 | } 64 | 65 | public String getOsName() 66 | { 67 | return osName; 68 | } 69 | 70 | public void setOsName(String osName) 71 | { 72 | this.osName = osName; 73 | } 74 | 75 | public String getOsArch() 76 | { 77 | return osArch; 78 | } 79 | 80 | public void setOsArch(String osArch) 81 | { 82 | this.osArch = osArch; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /douyidou-generator/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | douyidou 7 | cc.douyidou 8 | 3.8.9 9 | 10 | 4.0.0 11 | 12 | douyidou-generator 13 | 14 | 15 | generator代码生成 16 | 17 | 18 | 19 | 20 | 21 | 22 | org.apache.velocity 23 | velocity-engine-core 24 | 25 | 26 | 27 | 28 | cc.douyidou 29 | douyidou-common 30 | 31 | 32 | 33 | 34 | com.alibaba 35 | druid-spring-boot-3-starter 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /douyidou-generator/src/main/java/cc/douyidou/generator/mapper/GenTableColumnMapper.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.generator.mapper; 2 | 3 | import java.util.List; 4 | import cc.douyidou.generator.domain.GenTableColumn; 5 | 6 | /** 7 | * 业务字段 数据层 8 | * 9 | * @author ruoyi 10 | */ 11 | public interface GenTableColumnMapper 12 | { 13 | /** 14 | * 根据表名称查询列信息 15 | * 16 | * @param tableName 表名称 17 | * @return 列信息 18 | */ 19 | public List selectDbTableColumnsByName(String tableName); 20 | 21 | /** 22 | * 查询业务字段列表 23 | * 24 | * @param tableId 业务字段编号 25 | * @return 业务字段集合 26 | */ 27 | public List selectGenTableColumnListByTableId(Long tableId); 28 | 29 | /** 30 | * 新增业务字段 31 | * 32 | * @param genTableColumn 业务字段信息 33 | * @return 结果 34 | */ 35 | public int insertGenTableColumn(GenTableColumn genTableColumn); 36 | 37 | /** 38 | * 修改业务字段 39 | * 40 | * @param genTableColumn 业务字段信息 41 | * @return 结果 42 | */ 43 | public int updateGenTableColumn(GenTableColumn genTableColumn); 44 | 45 | /** 46 | * 删除业务字段 47 | * 48 | * @param genTableColumns 列数据 49 | * @return 结果 50 | */ 51 | public int deleteGenTableColumns(List genTableColumns); 52 | 53 | /** 54 | * 批量删除业务字段 55 | * 56 | * @param ids 需要删除的数据ID 57 | * @return 结果 58 | */ 59 | public int deleteGenTableColumnByIds(Long[] ids); 60 | } 61 | -------------------------------------------------------------------------------- /douyidou-generator/src/main/java/cc/douyidou/generator/mapper/GenTableMapper.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.generator.mapper; 2 | 3 | import java.util.List; 4 | import cc.douyidou.generator.domain.GenTable; 5 | 6 | /** 7 | * 业务 数据层 8 | * 9 | * @author ruoyi 10 | */ 11 | public interface GenTableMapper 12 | { 13 | /** 14 | * 查询业务列表 15 | * 16 | * @param genTable 业务信息 17 | * @return 业务集合 18 | */ 19 | public List selectGenTableList(GenTable genTable); 20 | 21 | /** 22 | * 查询据库列表 23 | * 24 | * @param genTable 业务信息 25 | * @return 数据库表集合 26 | */ 27 | public List selectDbTableList(GenTable genTable); 28 | 29 | /** 30 | * 查询据库列表 31 | * 32 | * @param tableNames 表名称组 33 | * @return 数据库表集合 34 | */ 35 | public List selectDbTableListByNames(String[] tableNames); 36 | 37 | /** 38 | * 查询所有表信息 39 | * 40 | * @return 表信息集合 41 | */ 42 | public List selectGenTableAll(); 43 | 44 | /** 45 | * 查询表ID业务信息 46 | * 47 | * @param id 业务ID 48 | * @return 业务信息 49 | */ 50 | public GenTable selectGenTableById(Long id); 51 | 52 | /** 53 | * 查询表名称业务信息 54 | * 55 | * @param tableName 表名称 56 | * @return 业务信息 57 | */ 58 | public GenTable selectGenTableByName(String tableName); 59 | 60 | /** 61 | * 新增业务 62 | * 63 | * @param genTable 业务信息 64 | * @return 结果 65 | */ 66 | public int insertGenTable(GenTable genTable); 67 | 68 | /** 69 | * 修改业务 70 | * 71 | * @param genTable 业务信息 72 | * @return 结果 73 | */ 74 | public int updateGenTable(GenTable genTable); 75 | 76 | /** 77 | * 批量删除业务 78 | * 79 | * @param ids 需要删除的数据ID 80 | * @return 结果 81 | */ 82 | public int deleteGenTableByIds(Long[] ids); 83 | 84 | /** 85 | * 创建表 86 | * 87 | * @param sql 表结构 88 | * @return 结果 89 | */ 90 | public int createTable(String sql); 91 | } 92 | -------------------------------------------------------------------------------- /douyidou-generator/src/main/java/cc/douyidou/generator/service/GenTableColumnServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.generator.service; 2 | 3 | import java.util.List; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.stereotype.Service; 6 | import cc.douyidou.common.core.text.Convert; 7 | import cc.douyidou.generator.domain.GenTableColumn; 8 | import cc.douyidou.generator.mapper.GenTableColumnMapper; 9 | 10 | /** 11 | * 业务字段 服务层实现 12 | * 13 | * @author ruoyi 14 | */ 15 | @Service 16 | public class GenTableColumnServiceImpl implements IGenTableColumnService 17 | { 18 | @Autowired 19 | private GenTableColumnMapper genTableColumnMapper; 20 | 21 | /** 22 | * 查询业务字段列表 23 | * 24 | * @param tableId 业务字段编号 25 | * @return 业务字段集合 26 | */ 27 | @Override 28 | public List selectGenTableColumnListByTableId(Long tableId) 29 | { 30 | return genTableColumnMapper.selectGenTableColumnListByTableId(tableId); 31 | } 32 | 33 | /** 34 | * 新增业务字段 35 | * 36 | * @param genTableColumn 业务字段信息 37 | * @return 结果 38 | */ 39 | @Override 40 | public int insertGenTableColumn(GenTableColumn genTableColumn) 41 | { 42 | return genTableColumnMapper.insertGenTableColumn(genTableColumn); 43 | } 44 | 45 | /** 46 | * 修改业务字段 47 | * 48 | * @param genTableColumn 业务字段信息 49 | * @return 结果 50 | */ 51 | @Override 52 | public int updateGenTableColumn(GenTableColumn genTableColumn) 53 | { 54 | return genTableColumnMapper.updateGenTableColumn(genTableColumn); 55 | } 56 | 57 | /** 58 | * 删除业务字段对象 59 | * 60 | * @param ids 需要删除的数据ID 61 | * @return 结果 62 | */ 63 | @Override 64 | public int deleteGenTableColumnByIds(String ids) 65 | { 66 | return genTableColumnMapper.deleteGenTableColumnByIds(Convert.toLongArray(ids)); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /douyidou-generator/src/main/java/cc/douyidou/generator/service/IGenTableColumnService.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.generator.service; 2 | 3 | import java.util.List; 4 | import cc.douyidou.generator.domain.GenTableColumn; 5 | 6 | /** 7 | * 业务字段 服务层 8 | * 9 | * @author ruoyi 10 | */ 11 | public interface IGenTableColumnService 12 | { 13 | /** 14 | * 查询业务字段列表 15 | * 16 | * @param tableId 业务字段编号 17 | * @return 业务字段集合 18 | */ 19 | public List selectGenTableColumnListByTableId(Long tableId); 20 | 21 | /** 22 | * 新增业务字段 23 | * 24 | * @param genTableColumn 业务字段信息 25 | * @return 结果 26 | */ 27 | public int insertGenTableColumn(GenTableColumn genTableColumn); 28 | 29 | /** 30 | * 修改业务字段 31 | * 32 | * @param genTableColumn 业务字段信息 33 | * @return 结果 34 | */ 35 | public int updateGenTableColumn(GenTableColumn genTableColumn); 36 | 37 | /** 38 | * 删除业务字段信息 39 | * 40 | * @param ids 需要删除的数据ID 41 | * @return 结果 42 | */ 43 | public int deleteGenTableColumnByIds(String ids); 44 | } 45 | -------------------------------------------------------------------------------- /douyidou-generator/src/main/java/cc/douyidou/generator/util/VelocityInitializer.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.generator.util; 2 | 3 | import java.util.Properties; 4 | import org.apache.velocity.app.Velocity; 5 | import cc.douyidou.common.constant.Constants; 6 | 7 | /** 8 | * VelocityEngine工厂 9 | * 10 | * @author ruoyi 11 | */ 12 | public class VelocityInitializer 13 | { 14 | /** 15 | * 初始化vm方法 16 | */ 17 | public static void initVelocity() 18 | { 19 | Properties p = new Properties(); 20 | try 21 | { 22 | // 加载classpath目录下的vm文件 23 | p.setProperty("resource.loader.file.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); 24 | // 定义字符集 25 | p.setProperty(Velocity.INPUT_ENCODING, Constants.UTF8); 26 | // 初始化Velocity引擎,指定配置Properties 27 | Velocity.init(p); 28 | } 29 | catch (Exception e) 30 | { 31 | throw new RuntimeException(e); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /douyidou-generator/src/main/resources/generator.yml: -------------------------------------------------------------------------------- 1 | # 代码生成 2 | gen: 3 | # 作者 4 | author: Tuteri 5 | # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool 6 | packageName: cc.douyidou.service 7 | # 自动去除表前缀,默认是false 8 | autoRemovePre: false 9 | # 表前缀(生成类名不会包含表前缀,多个用逗号分隔) 10 | tablePrefix: dou_ 11 | # 是否允许生成文件覆盖到本地(自定义路径),默认不允许 12 | allowOverwrite: false -------------------------------------------------------------------------------- /douyidou-generator/src/main/resources/vm/java/domain.java.vm: -------------------------------------------------------------------------------- 1 | package ${packageName}.domain; 2 | 3 | #foreach ($import in $importList) 4 | import ${import}; 5 | #end 6 | import cc.douyidou.common.annotation.Excel; 7 | #if($table.crud || $table.sub) 8 | import cc.douyidou.service.domain.DouBase; 9 | #elseif($table.tree) 10 | #end 11 | import lombok.Data; 12 | 13 | /** 14 | * ${functionName}对象 ${tableName} 15 | * 16 | * @author ${author} 17 | * @date ${datetime} 18 | */ 19 | #if($table.crud || $table.sub) 20 | #set($Entity="DouBase") 21 | #elseif($table.tree) 22 | #set($Entity="TreeEntity") 23 | #end 24 | @Data 25 | public class ${ClassName} extends ${Entity} 26 | { 27 | private static final long serialVersionUID = 1L; 28 | 29 | #foreach ($column in $columns) 30 | #if(!$table.isSuperColumn($column.javaField)) 31 | /** $column.columnComment */ 32 | #if($column.list) 33 | #set($parentheseIndex=$column.columnComment.indexOf("(")) 34 | #if($parentheseIndex != -1) 35 | #set($comment=$column.columnComment.substring(0, $parentheseIndex)) 36 | #else 37 | #set($comment=$column.columnComment) 38 | #end 39 | #if($parentheseIndex != -1) 40 | @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") 41 | #elseif($column.javaType == 'Date') 42 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 43 | @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") 44 | #else 45 | @Excel(name = "${comment}") 46 | #end 47 | #end 48 | private $column.javaType $column.javaField; 49 | 50 | #end 51 | #end 52 | #if($table.sub) 53 | /** $table.subTable.functionName信息 */ 54 | private List<${subClassName}> ${subclassName}List; 55 | 56 | #end 57 | #if($table.sub) 58 | public List<${subClassName}> get${subClassName}List() 59 | { 60 | return ${subclassName}List; 61 | } 62 | 63 | public void set${subClassName}List(List<${subClassName}> ${subclassName}List) 64 | { 65 | this.${subclassName}List = ${subclassName}List; 66 | } 67 | 68 | #end 69 | } 70 | -------------------------------------------------------------------------------- /douyidou-generator/src/main/resources/vm/java/service.java.vm: -------------------------------------------------------------------------------- 1 | package ${packageName}.service; 2 | 3 | import java.util.List; 4 | import ${packageName}.domain.${ClassName}; 5 | import com.baomidou.mybatisplus.extension.service.IService; 6 | 7 | /** 8 | * ${functionName}Service接口 9 | * 10 | * @author ${author} 11 | * @date ${datetime} 12 | */ 13 | public interface I${ClassName}Service extends IService<${ClassName}> 14 | { 15 | /** 16 | * 查询${functionName} 17 | * 18 | * @param ${pkColumn.javaField} ${functionName}主键 19 | * @return ${functionName} 20 | */ 21 | public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); 22 | 23 | /** 24 | * 查询${functionName}列表 25 | * 26 | * @param ${className} ${functionName} 27 | * @return ${functionName}集合 28 | */ 29 | public List<${ClassName}> select${ClassName}List(${ClassName} ${className}); 30 | 31 | /** 32 | * 新增${functionName} 33 | * 34 | * @param ${className} ${functionName} 35 | * @return 结果 36 | */ 37 | public int insert${ClassName}(${ClassName} ${className}); 38 | 39 | /** 40 | * 修改${functionName} 41 | * 42 | * @param ${className} ${functionName} 43 | * @return 结果 44 | */ 45 | public int update${ClassName}(${ClassName} ${className}); 46 | 47 | /** 48 | * 批量删除${functionName} 49 | * 50 | * @param ${pkColumn.javaField}s 需要删除的${functionName}主键集合 51 | * @return 结果 52 | */ 53 | public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s); 54 | 55 | /** 56 | * 删除${functionName}信息 57 | * 58 | * @param ${pkColumn.javaField} ${functionName}主键 59 | * @return 结果 60 | */ 61 | public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); 62 | } 63 | -------------------------------------------------------------------------------- /douyidou-generator/src/main/resources/vm/js/api.js.vm: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request' 2 | 3 | // 查询${functionName}列表 4 | export function list${BusinessName}(query) { 5 | return request({ 6 | url: '/${moduleName}/${businessName}/list', 7 | method: 'get', 8 | params: query 9 | }) 10 | } 11 | 12 | // 查询${functionName}详细 13 | export function get${BusinessName}(${pkColumn.javaField}) { 14 | return request({ 15 | url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField}, 16 | method: 'get' 17 | }) 18 | } 19 | 20 | // 新增${functionName} 21 | export function add${BusinessName}(data) { 22 | return request({ 23 | url: '/${moduleName}/${businessName}', 24 | method: 'post', 25 | data: data 26 | }) 27 | } 28 | 29 | // 修改${functionName} 30 | export function update${BusinessName}(data) { 31 | return request({ 32 | url: '/${moduleName}/${businessName}', 33 | method: 'put', 34 | data: data 35 | }) 36 | } 37 | 38 | // 删除${functionName} 39 | export function del${BusinessName}(${pkColumn.javaField}) { 40 | return request({ 41 | url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField}, 42 | method: 'delete' 43 | }) 44 | } 45 | -------------------------------------------------------------------------------- /douyidou-quartz/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | douyidou 7 | cc.douyidou 8 | 3.8.9 9 | 10 | 4.0.0 11 | 12 | douyidou-quartz 13 | 14 | 15 | quartz定时任务 16 | 17 | 18 | 19 | 20 | 21 | 22 | org.quartz-scheduler 23 | quartz 24 | 25 | 26 | com.mchange 27 | c3p0 28 | 29 | 30 | 31 | 32 | 33 | 34 | cc.douyidou 35 | douyidou-common 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /douyidou-quartz/src/main/java/cc/douyidou/quartz/mapper/SysJobLogMapper.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.quartz.mapper; 2 | 3 | import java.util.List; 4 | import cc.douyidou.quartz.domain.SysJobLog; 5 | 6 | /** 7 | * 调度任务日志信息 数据层 8 | * 9 | * @author ruoyi 10 | */ 11 | public interface SysJobLogMapper 12 | { 13 | /** 14 | * 获取quartz调度器日志的计划任务 15 | * 16 | * @param jobLog 调度日志信息 17 | * @return 调度任务日志集合 18 | */ 19 | public List selectJobLogList(SysJobLog jobLog); 20 | 21 | /** 22 | * 查询所有调度任务日志 23 | * 24 | * @return 调度任务日志列表 25 | */ 26 | public List selectJobLogAll(); 27 | 28 | /** 29 | * 通过调度任务日志ID查询调度信息 30 | * 31 | * @param jobLogId 调度任务日志ID 32 | * @return 调度任务日志对象信息 33 | */ 34 | public SysJobLog selectJobLogById(Long jobLogId); 35 | 36 | /** 37 | * 新增任务日志 38 | * 39 | * @param jobLog 调度日志信息 40 | * @return 结果 41 | */ 42 | public int insertJobLog(SysJobLog jobLog); 43 | 44 | /** 45 | * 批量删除调度日志信息 46 | * 47 | * @param logIds 需要删除的数据ID 48 | * @return 结果 49 | */ 50 | public int deleteJobLogByIds(Long[] logIds); 51 | 52 | /** 53 | * 删除任务日志 54 | * 55 | * @param jobId 调度日志ID 56 | * @return 结果 57 | */ 58 | public int deleteJobLogById(Long jobId); 59 | 60 | /** 61 | * 清空任务日志 62 | */ 63 | public void cleanJobLog(); 64 | } 65 | -------------------------------------------------------------------------------- /douyidou-quartz/src/main/java/cc/douyidou/quartz/mapper/SysJobMapper.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.quartz.mapper; 2 | 3 | import java.util.List; 4 | import cc.douyidou.quartz.domain.SysJob; 5 | 6 | /** 7 | * 调度任务信息 数据层 8 | * 9 | * @author ruoyi 10 | */ 11 | public interface SysJobMapper 12 | { 13 | /** 14 | * 查询调度任务日志集合 15 | * 16 | * @param job 调度信息 17 | * @return 操作日志集合 18 | */ 19 | public List selectJobList(SysJob job); 20 | 21 | /** 22 | * 查询所有调度任务 23 | * 24 | * @return 调度任务列表 25 | */ 26 | public List selectJobAll(); 27 | 28 | /** 29 | * 通过调度ID查询调度任务信息 30 | * 31 | * @param jobId 调度ID 32 | * @return 角色对象信息 33 | */ 34 | public SysJob selectJobById(Long jobId); 35 | 36 | /** 37 | * 通过调度ID删除调度任务信息 38 | * 39 | * @param jobId 调度ID 40 | * @return 结果 41 | */ 42 | public int deleteJobById(Long jobId); 43 | 44 | /** 45 | * 批量删除调度任务信息 46 | * 47 | * @param ids 需要删除的数据ID 48 | * @return 结果 49 | */ 50 | public int deleteJobByIds(Long[] ids); 51 | 52 | /** 53 | * 修改调度任务信息 54 | * 55 | * @param job 调度任务信息 56 | * @return 结果 57 | */ 58 | public int updateJob(SysJob job); 59 | 60 | /** 61 | * 新增调度任务信息 62 | * 63 | * @param job 调度任务信息 64 | * @return 结果 65 | */ 66 | public int insertJob(SysJob job); 67 | } 68 | -------------------------------------------------------------------------------- /douyidou-quartz/src/main/java/cc/douyidou/quartz/service/ISysJobLogService.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.quartz.service; 2 | 3 | import java.util.List; 4 | import cc.douyidou.quartz.domain.SysJobLog; 5 | 6 | /** 7 | * 定时任务调度日志信息信息 服务层 8 | * 9 | * @author ruoyi 10 | */ 11 | public interface ISysJobLogService 12 | { 13 | /** 14 | * 获取quartz调度器日志的计划任务 15 | * 16 | * @param jobLog 调度日志信息 17 | * @return 调度任务日志集合 18 | */ 19 | public List selectJobLogList(SysJobLog jobLog); 20 | 21 | /** 22 | * 通过调度任务日志ID查询调度信息 23 | * 24 | * @param jobLogId 调度任务日志ID 25 | * @return 调度任务日志对象信息 26 | */ 27 | public SysJobLog selectJobLogById(Long jobLogId); 28 | 29 | /** 30 | * 新增任务日志 31 | * 32 | * @param jobLog 调度日志信息 33 | */ 34 | public void addJobLog(SysJobLog jobLog); 35 | 36 | /** 37 | * 批量删除调度日志信息 38 | * 39 | * @param logIds 需要删除的日志ID 40 | * @return 结果 41 | */ 42 | public int deleteJobLogByIds(Long[] logIds); 43 | 44 | /** 45 | * 删除任务日志 46 | * 47 | * @param jobId 调度日志ID 48 | * @return 结果 49 | */ 50 | public int deleteJobLogById(Long jobId); 51 | 52 | /** 53 | * 清空任务日志 54 | */ 55 | public void cleanJobLog(); 56 | } 57 | -------------------------------------------------------------------------------- /douyidou-quartz/src/main/java/cc/douyidou/quartz/task/RyTask.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.quartz.task; 2 | 3 | import org.springframework.stereotype.Component; 4 | import cc.douyidou.common.utils.StringUtils; 5 | 6 | /** 7 | * 定时任务调度测试 8 | * 9 | * @author ruoyi 10 | */ 11 | @Component("ryTask") 12 | public class RyTask 13 | { 14 | public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) 15 | { 16 | System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i)); 17 | } 18 | 19 | public void ryParams(String params) 20 | { 21 | System.out.println("执行有参方法:" + params); 22 | } 23 | 24 | public void ryNoParams() 25 | { 26 | System.out.println("执行无参方法"); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /douyidou-quartz/src/main/java/cc/douyidou/quartz/util/CronUtils.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.quartz.util; 2 | 3 | import java.text.ParseException; 4 | import java.util.Date; 5 | import org.quartz.CronExpression; 6 | 7 | /** 8 | * cron表达式工具类 9 | * 10 | * @author ruoyi 11 | * 12 | */ 13 | public class CronUtils 14 | { 15 | /** 16 | * 返回一个布尔值代表一个给定的Cron表达式的有效性 17 | * 18 | * @param cronExpression Cron表达式 19 | * @return boolean 表达式是否有效 20 | */ 21 | public static boolean isValid(String cronExpression) 22 | { 23 | return CronExpression.isValidExpression(cronExpression); 24 | } 25 | 26 | /** 27 | * 返回一个字符串值,表示该消息无效Cron表达式给出有效性 28 | * 29 | * @param cronExpression Cron表达式 30 | * @return String 无效时返回表达式错误描述,如果有效返回null 31 | */ 32 | public static String getInvalidMessage(String cronExpression) 33 | { 34 | try 35 | { 36 | new CronExpression(cronExpression); 37 | return null; 38 | } 39 | catch (ParseException pe) 40 | { 41 | return pe.getMessage(); 42 | } 43 | } 44 | 45 | /** 46 | * 返回下一个执行时间根据给定的Cron表达式 47 | * 48 | * @param cronExpression Cron表达式 49 | * @return Date 下次Cron表达式执行时间 50 | */ 51 | public static Date getNextExecution(String cronExpression) 52 | { 53 | try 54 | { 55 | CronExpression cron = new CronExpression(cronExpression); 56 | return cron.getNextValidTimeAfter(new Date(System.currentTimeMillis())); 57 | } 58 | catch (ParseException e) 59 | { 60 | throw new IllegalArgumentException(e.getMessage()); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /douyidou-quartz/src/main/java/cc/douyidou/quartz/util/QuartzDisallowConcurrentExecution.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.quartz.util; 2 | 3 | import org.quartz.DisallowConcurrentExecution; 4 | import org.quartz.JobExecutionContext; 5 | import cc.douyidou.quartz.domain.SysJob; 6 | 7 | /** 8 | * 定时任务处理(禁止并发执行) 9 | * 10 | * @author ruoyi 11 | * 12 | */ 13 | @DisallowConcurrentExecution 14 | public class QuartzDisallowConcurrentExecution extends AbstractQuartzJob 15 | { 16 | @Override 17 | protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception 18 | { 19 | JobInvokeUtil.invokeMethod(sysJob); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /douyidou-quartz/src/main/java/cc/douyidou/quartz/util/QuartzJobExecution.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.quartz.util; 2 | 3 | import org.quartz.JobExecutionContext; 4 | import cc.douyidou.quartz.domain.SysJob; 5 | 6 | /** 7 | * 定时任务处理(允许并发执行) 8 | * 9 | * @author ruoyi 10 | * 11 | */ 12 | public class QuartzJobExecution extends AbstractQuartzJob 13 | { 14 | @Override 15 | protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception 16 | { 17 | JobInvokeUtil.invokeMethod(sysJob); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /douyidou-server/src/main/java/cc/douyidou/DouYiDouApplication.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 6 | 7 | /** 8 | * 启动程序 9 | * 10 | * @author ruoyi 11 | */ 12 | @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) 13 | public class DouYiDouApplication 14 | { 15 | public static void main(String[] args) 16 | { 17 | // System.setProperty("spring.devtools.restart.enabled", "false"); 18 | SpringApplication.run(DouYiDouApplication.class, args); 19 | System.out.println( 20 | " (♥◠‿◠)ノ゙ 抖一抖启动成功 ლ(´ڡ`ლ)゙ \n" + 21 | ".______ __ __ .__ __. .__ __. __ .__ __. _______ \n" + 22 | "| _ \\ | | | | | \\ | | | \\ | | | | | \\ | | / _____|\n" + 23 | "| |_) | | | | | | \\| | | \\| | | | | \\| | | | __ \n" + 24 | "| / | | | | | . ` | | . ` | | | | . ` | | | |_ | \n" + 25 | "| |\\ \\----.| `--' | | |\\ | | |\\ | | | | |\\ | | |__| | \n" + 26 | "| _| `._____| \\______/ |__| \\__| |__| \\__| |__| |__| \\__| \\______|"); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /douyidou-server/src/main/java/cc/douyidou/DouYiDouServletInitializer.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou; 2 | 3 | import org.springframework.boot.builder.SpringApplicationBuilder; 4 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 5 | 6 | /** 7 | * web容器中进行部署 8 | * 9 | * @author ruoyi 10 | */ 11 | public class DouYiDouServletInitializer extends SpringBootServletInitializer 12 | { 13 | @Override 14 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) 15 | { 16 | return application.sources(DouYiDouApplication.class); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /douyidou-server/src/main/java/cc/douyidou/web/controller/api/CommonApi.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.web.controller.api; 2 | 3 | import cc.douyidou.common.config.RuoYiConfig; 4 | import cc.douyidou.common.utils.file.FileUploadUtils; 5 | import cc.douyidou.common.utils.file.FileUtils; 6 | import cc.douyidou.framework.config.ServerConfig; 7 | import cc.douyidou.service.common.response.CommonResult; 8 | import org.slf4j.Logger; 9 | import org.slf4j.LoggerFactory; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.PostMapping; 12 | import org.springframework.web.bind.annotation.RequestMapping; 13 | import org.springframework.web.bind.annotation.RestController; 14 | import org.springframework.web.multipart.MultipartFile; 15 | 16 | import java.util.HashMap; 17 | 18 | /** 19 | * @probject douyidou 20 | * @author Tuteri 21 | * @date 2025/04/16 22 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 23 | * 本程序仅供学习与测试使用,禁止商用。 24 | */ 25 | @RestController 26 | @RequestMapping("/api/common") 27 | public class CommonApi { 28 | private static final Logger log = LoggerFactory.getLogger(CommonApi.class); 29 | 30 | @Autowired 31 | private ServerConfig serverConfig; 32 | 33 | /** 34 | * 通用上传请求(单个) 35 | */ 36 | @PostMapping("/upload") 37 | public CommonResult uploadFile(MultipartFile file){ 38 | try { 39 | // 上传文件路径 40 | String filePath = RuoYiConfig.getUploadPath(); 41 | // 上传并返回新文件名称 42 | String fileName = FileUploadUtils.upload(filePath, file); 43 | String url = serverConfig.getUrl() + fileName; 44 | var map = new HashMap<>(); 45 | map.put("url", url); 46 | map.put("fileName", fileName); 47 | map.put("newFileName", FileUtils.getName(fileName)); 48 | map.put("originalFilename", file.getOriginalFilename()); 49 | return CommonResult.success(map); 50 | } catch (Exception e) { 51 | return CommonResult.failed("文件上传失败"); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /douyidou-server/src/main/java/cc/douyidou/web/controller/api/ConfigApi.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.web.controller.api; 2 | 3 | import cc.douyidou.service.common.response.CommonResult; 4 | import cc.douyidou.service.domain.DouHelp; 5 | import cc.douyidou.service.service.DouConfigService; 6 | import cc.douyidou.service.service.IDouHelpService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | import java.util.List; 13 | import java.util.Map; 14 | 15 | /** 16 | * @probject douyidou 17 | * @author Tuteri 18 | * @date 2025/04/16 19 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 20 | * 本程序仅供学习与测试使用,禁止商用。 21 | */ 22 | @RestController 23 | @RequestMapping("/api/config") 24 | public class ConfigApi { 25 | 26 | @Autowired 27 | DouConfigService douConfigService; 28 | @Autowired 29 | IDouHelpService douHelpService; 30 | @GetMapping("/routine") 31 | public CommonResult> getRoutine(){ 32 | return douConfigService.getRoutine(); 33 | } 34 | @GetMapping("/help") 35 | public CommonResult> help(){ 36 | return CommonResult.success(douHelpService.getList()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /douyidou-server/src/main/java/cc/douyidou/web/controller/api/RewardApi.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.web.controller.api; 2 | 3 | import cn.hutool.core.util.ObjectUtil; 4 | import cc.douyidou.service.common.response.CommonResult; 5 | import cc.douyidou.service.domain.DouReward; 6 | import cc.douyidou.service.service.IDouRewardService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.*; 9 | 10 | /** 11 | * @probject douyidou 12 | * @author Tuteri 13 | * @date 2025/04/16 14 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 15 | * 本程序仅供学习与测试使用,禁止商用。 16 | */ 17 | @RestController 18 | @RequestMapping("/api/reward") 19 | public class RewardApi { 20 | 21 | @Autowired 22 | private IDouRewardService douRewardService; 23 | 24 | 25 | /** 26 | * 广告结束 领奖 27 | * @param douRewardRequest 请求 28 | * @return CommonResult 29 | */ 30 | @PostMapping("claim") 31 | public CommonResult claim(@RequestBody DouReward douRewardRequest) { 32 | DouReward douReward = douRewardService.sendReward(douRewardRequest); 33 | return CommonResult.success(ObjectUtil.isNotNull(douReward)); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /douyidou-server/src/main/java/cc/douyidou/web/controller/api/UserApi.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.web.controller.api; 2 | 3 | import cc.douyidou.service.common.response.CommonResult; 4 | import cc.douyidou.service.common.response.user.DouUserResponse; 5 | import cc.douyidou.service.domain.DouUser; 6 | import cc.douyidou.service.service.IDouUserService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.*; 9 | 10 | /** 11 | * @probject douyidou 12 | * @author Tuteri 13 | * @date 2025/04/16 14 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 15 | * 本程序仅供学习与测试使用,禁止商用。 16 | */ 17 | @RestController 18 | @RequestMapping("/api") 19 | public class UserApi { 20 | @Autowired 21 | IDouUserService douUserService; 22 | 23 | @GetMapping("getInfo") 24 | public CommonResult getInfo() { 25 | return CommonResult.success(douUserService.getInfo()); 26 | } 27 | 28 | @GetMapping("user/info") 29 | public CommonResult userInfo() { 30 | return CommonResult.success(douUserService.getInfo()); 31 | } 32 | 33 | //@GetMapping("user/limits") 34 | //public CommonResult userInfo() { 35 | // return CommonResult.success(douUserService.getInfo()); 36 | //} 37 | 38 | /** 39 | * 用户消费解析次数 40 | * @return 41 | */ 42 | @GetMapping("user/consumer") 43 | public CommonResult consumer() { 44 | douUserService.parseNumConsumer(); 45 | return CommonResult.success(); 46 | } 47 | /** 48 | * 用户兑换解析次数 49 | * @return 50 | */ 51 | @PostMapping("user/tokensToParseNum") 52 | public CommonResult tokensToParseNum(@RequestBody DouUser douUserRequest) { 53 | return douUserService.tokensToParseNum(douUserRequest); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /douyidou-server/src/main/java/cc/douyidou/web/controller/api/UserLoginApi.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2018-2019 3 | * All rights reserved, Designed By www.joolun.com 4 | */ 5 | package cc.douyidou.web.controller.api; 6 | 7 | import cc.douyidou.service.common.response.CommonResult; 8 | import cc.douyidou.service.common.response.LoginResponse; 9 | import cc.douyidou.service.entity.LoginMaDTO; 10 | import cc.douyidou.service.service.WxUserService; 11 | import jakarta.servlet.http.HttpServletRequest; 12 | import lombok.AllArgsConstructor; 13 | import lombok.extern.slf4j.Slf4j; 14 | import org.springframework.web.bind.annotation.*; 15 | 16 | 17 | /** 18 | * @probject douyidou 19 | * @author Tuteri 20 | * @date 2025/04/16 21 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 22 | * 本程序仅供学习与测试使用,禁止商用。 23 | */ 24 | @Slf4j 25 | @RestController 26 | @AllArgsConstructor 27 | @RequestMapping("/api") 28 | public class UserLoginApi { 29 | 30 | private final WxUserService wxUserService; 31 | /** 32 | * 小程序用户登录 33 | * @param request 34 | * @param loginMaDTO 35 | * @return 36 | */ 37 | @PostMapping("/miniLogin") 38 | public CommonResult login(HttpServletRequest request, @RequestBody LoginMaDTO loginMaDTO){ 39 | return wxUserService.miniLogin(loginMaDTO.getCode(),request); 40 | } 41 | @PostMapping("/refreshToken") 42 | public CommonResult refreshToken(HttpServletRequest request){ 43 | return wxUserService.refreshToken(request); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /douyidou-server/src/main/java/cc/douyidou/web/controller/monitor/ServerController.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.web.controller.monitor; 2 | 3 | import org.springframework.security.access.prepost.PreAuthorize; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RestController; 7 | import cc.douyidou.common.core.domain.AjaxResult; 8 | import cc.douyidou.framework.web.domain.Server; 9 | 10 | /** 11 | * 服务器监控 12 | * 13 | * @author ruoyi 14 | */ 15 | @RestController 16 | @RequestMapping("/monitor/server") 17 | public class ServerController 18 | { 19 | @PreAuthorize("@ss.hasPermi('monitor:server:list')") 20 | @GetMapping() 21 | public AjaxResult getInfo() throws Exception 22 | { 23 | Server server = new Server(); 24 | server.copyTo(); 25 | return AjaxResult.success(server); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /douyidou-server/src/main/java/cc/douyidou/web/controller/system/SysIndexController.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.web.controller.system; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | import cc.douyidou.common.config.RuoYiConfig; 7 | import cc.douyidou.common.utils.StringUtils; 8 | 9 | /** 10 | * 首页 11 | * 12 | * @author ruoyi 13 | */ 14 | @RestController 15 | public class SysIndexController 16 | { 17 | /** 系统基础配置 */ 18 | @Autowired 19 | private RuoYiConfig ruoyiConfig; 20 | 21 | /** 22 | * 访问首页,提示语 23 | */ 24 | @RequestMapping("/") 25 | public String index() 26 | { 27 | return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /douyidou-server/src/main/java/cc/douyidou/web/controller/system/SysRegisterController.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.web.controller.system; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.web.bind.annotation.PostMapping; 5 | import org.springframework.web.bind.annotation.RequestBody; 6 | import org.springframework.web.bind.annotation.RestController; 7 | import cc.douyidou.common.core.controller.BaseController; 8 | import cc.douyidou.common.core.domain.AjaxResult; 9 | import cc.douyidou.common.core.domain.model.RegisterBody; 10 | import cc.douyidou.common.utils.StringUtils; 11 | import cc.douyidou.framework.web.service.SysRegisterService; 12 | import cc.douyidou.system.service.ISysConfigService; 13 | 14 | /** 15 | * 注册验证 16 | * 17 | * @author ruoyi 18 | */ 19 | @RestController 20 | public class SysRegisterController extends BaseController 21 | { 22 | @Autowired 23 | private SysRegisterService registerService; 24 | 25 | @Autowired 26 | private ISysConfigService configService; 27 | 28 | @PostMapping("/register") 29 | public AjaxResult register(@RequestBody RegisterBody user) 30 | { 31 | if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) 32 | { 33 | return error("当前系统没有开启注册功能!"); 34 | } 35 | String msg = registerService.register(user); 36 | return StringUtils.isEmpty(msg) ? success() : error(msg); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /douyidou-server/src/main/java/cc/douyidou/web/core/config/SwaggerConfig.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.web.core.config; 2 | 3 | import cc.douyidou.common.config.RuoYiConfig; 4 | import io.swagger.v3.oas.models.Components; 5 | import io.swagger.v3.oas.models.OpenAPI; 6 | import io.swagger.v3.oas.models.info.Contact; 7 | import io.swagger.v3.oas.models.info.Info; 8 | import io.swagger.v3.oas.models.security.SecurityRequirement; 9 | import io.swagger.v3.oas.models.security.SecurityScheme; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.context.annotation.Bean; 12 | import org.springframework.context.annotation.Configuration; 13 | 14 | /** 15 | * Swagger2的接口配置 16 | * 17 | * @author ruoyi 18 | */ 19 | @Configuration 20 | public class SwaggerConfig 21 | { 22 | /** 系统基础配置 */ 23 | @Autowired 24 | private RuoYiConfig ruoyiConfig; 25 | 26 | /** 27 | * 自定义的 OpenAPI 对象 28 | */ 29 | @Bean 30 | public OpenAPI customOpenApi() 31 | { 32 | return new OpenAPI().components(new Components() 33 | // 设置认证的请求头 34 | .addSecuritySchemes("apikey", securityScheme())) 35 | .addSecurityItem(new SecurityRequirement().addList("apikey")) 36 | .info(getApiInfo()); 37 | } 38 | 39 | @Bean 40 | public SecurityScheme securityScheme() 41 | { 42 | return new SecurityScheme() 43 | .type(SecurityScheme.Type.APIKEY) 44 | .name("Authorization") 45 | .in(SecurityScheme.In.HEADER) 46 | .scheme("Bearer"); 47 | } 48 | 49 | /** 50 | * 添加摘要信息 51 | */ 52 | public Info getApiInfo() 53 | { 54 | return new Info() 55 | // 设置标题 56 | .title("标题:若依管理系统_接口文档") 57 | // 描述 58 | .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...") 59 | // 作者信息 60 | .contact(new Contact().name(ruoyiConfig.getName())) 61 | // 版本 62 | .version("版本号:" + ruoyiConfig.getVersion()); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /douyidou-server/src/main/resources/META-INF/spring-devtools.properties: -------------------------------------------------------------------------------- 1 | restart.include.json=/com.alibaba.fastjson2.*.jar -------------------------------------------------------------------------------- /douyidou-server/src/main/resources/application-dev.yml: -------------------------------------------------------------------------------- 1 | ruoyi: 2 | # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) 3 | profile: E:\Desktop\douyidou\RuoYi-backend 4 | 5 | # 开发环境配置 6 | server: 7 | # 服务器的HTTP端口,默认为8080 8 | port: 7999 9 | spring: 10 | data: 11 | # redis 配置 12 | redis: 13 | # 地址 14 | host: localhost 15 | # 端口,默认为6379 16 | port: 6379 17 | # 数据库索引 18 | database: 0 19 | # 密码 20 | password: 21 | datasource: 22 | type: com.alibaba.druid.pool.DruidDataSource 23 | driverClassName: com.mysql.cj.jdbc.Driver 24 | druid: 25 | # 主库数据源 26 | master: 27 | url: jdbc:mysql://localhost:3307/d1ddefault?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 28 | username: root 29 | password: root -------------------------------------------------------------------------------- /douyidou-server/src/main/resources/application-prod.yml: -------------------------------------------------------------------------------- 1 | ruoyi: 2 | # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) 3 | profile: ${dou.uploadPath} 4 | 5 | # 开发环境配置 6 | server: 7 | # 服务器的HTTP端口,默认为8080 8 | port: ${server.port} 9 | spring: 10 | config: 11 | import: file:config.properties 12 | data: 13 | # redis 配置 14 | redis: 15 | # 地址 16 | host: ${redis.host} 17 | # 端口,默认为6379 18 | port: ${redis.port} 19 | # 数据库索引 20 | database: ${redis.database} 21 | # 密码 22 | password: ${redis.password} 23 | datasource: 24 | driverClassName: com.mysql.cj.jdbc.Driver 25 | druid: 26 | # 主库数据源 27 | master: 28 | url: jdbc:mysql://${mysql.host}:${mysql.port}/${mysql.database}?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 29 | username: ${mysql.username} 30 | password: ${mysql.password} -------------------------------------------------------------------------------- /douyidou-server/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | Application Version: ${ruoyi.version} 2 | Spring Boot Version: ${spring-boot.version} 3 | _______ ______ __ __ ____ ____ __ _______ ______ __ __ ______ ______ 4 | | \ / __ \ | | | | \ \ / / | | | \ / __ \ | | | | / | / | 5 | | .--. || | | | | | | | \ \/ / | | | .--. || | | | | | | | | ,----'| ,----' 6 | | | | || | | | | | | | \_ _/ | | | | | || | | | | | | | | | | | 7 | | '--' || `--' | | `--' | | | | | | '--' || `--' | | `--' | __ | `----.| `----. 8 | |_______/ \______/ \______/ |__| |__| |_______/ \______/ \______/ (__) \______| \______| 9 | -------------------------------------------------------------------------------- /douyidou-server/src/main/resources/i18n/messages.properties: -------------------------------------------------------------------------------- 1 | #错误消息 2 | not.null=* 必须填写 3 | user.jcaptcha.error=验证码错误 4 | user.jcaptcha.expire=验证码已失效 5 | user.not.exists=用户不存在/密码错误 6 | user.password.not.match=用户不存在/密码错误 7 | user.password.retry.limit.count=密码输入错误{0}次 8 | user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟 9 | user.password.delete=对不起,您的账号已被删除 10 | user.blocked=用户已封禁,请联系管理员 11 | role.blocked=角色已封禁,请联系管理员 12 | login.blocked=很遗憾,访问IP已被列入系统黑名单 13 | user.logout.success=退出成功 14 | 15 | length.not.valid=长度必须在{min}到{max}个字符之间 16 | 17 | user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头 18 | user.password.not.valid=* 5-50个字符 19 | 20 | user.email.not.valid=邮箱格式错误 21 | user.mobile.phone.number.not.valid=手机号格式错误 22 | user.login.success=登录成功 23 | user.register.success=注册成功 24 | user.notfound=请重新登录 25 | user.forcelogout=管理员强制退出,请重新登录 26 | user.unknown.error=未知错误,请重新登录 27 | 28 | ##文件上传消息 29 | upload.exceed.maxSize=上传的文件大小超出限制的文件大小!允许的文件最大大小是:{0}MB! 30 | upload.filename.exceed.length=上传的文件名最长{0}个字符 31 | 32 | ##权限 33 | no.permission=您没有数据的权限,请联系管理员添加权限 [{0}] 34 | no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}] 35 | no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}] 36 | no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}] 37 | no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}] 38 | no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}] 39 | -------------------------------------------------------------------------------- /douyidou-server/src/main/resources/mybatis/mybatis-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /douyidou-server/src/test/java/cc/douyidou/TestService.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou; 2 | 3 | import cc.douyidou.service.service.IDouParseService; 4 | import jakarta.annotation.Resource; 5 | import org.junit.jupiter.api.Test; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | 8 | @SpringBootTest 9 | public class TestService { 10 | @Resource 11 | IDouParseService douParseService; 12 | 13 | @Test 14 | void filterDownloadUrl(){ 15 | douParseService.filterDownloadUrl(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/common/PageResult.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.common; 2 | 3 | import com.github.pagehelper.PageInfo; 4 | import lombok.Data; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | /** 10 | * @probject douyidou 11 | * @author Tuteri 12 | * @date 2025/04/16 13 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 14 | * 本程序仅供学习与测试使用,禁止商用。 15 | */ 16 | @Data 17 | public class PageResult { 18 | private Integer page = 1; 19 | private Integer nextPage = 2; 20 | private Integer limit = 20; 21 | private Integer totalPage = 0; 22 | private Long total = 0L ; 23 | private List list = new ArrayList<>(); 24 | 25 | 26 | /** 27 | * 将PageHelper分页后的 PageInfo 转为分页信息 28 | * @return 29 | */ 30 | public static PageResult restPage(PageInfo pageInfo, List list) { 31 | PageResult result = new PageResult<>(); 32 | result.setTotalPage(pageInfo.getPages()); 33 | result.setPage(pageInfo.getPageNum()); 34 | result.setNextPage(pageInfo.getNextPage()); 35 | result.setLimit(pageInfo.getPageSize()); 36 | result.setTotal(pageInfo.getTotal()); 37 | result.setList(list); 38 | return result; 39 | } 40 | 41 | /** 42 | * 对象A复制对象B的分页信息 // 多次数据查询导致分页数据异常解决办法 43 | */ 44 | public static PageInfo copyPageInfo(PageInfo originPageInfo, List list) { 45 | PageInfo pageInfo = new PageInfo<>(list); 46 | pageInfo.setPages(originPageInfo.getPages()); 47 | pageInfo.setNextPage(originPageInfo.getNextPage()); 48 | pageInfo.setPageNum(originPageInfo.getPageNum()); 49 | pageInfo.setPageSize(originPageInfo.getPageSize()); 50 | pageInfo.setTotal(originPageInfo.getTotal()); 51 | pageInfo.setList(list); 52 | return pageInfo; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/common/request/PageParamRequest.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.common.request; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | 6 | /** 7 | * @probject douyidou 8 | * @author Tuteri 9 | * @date 2025/04/16 10 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 11 | * 本程序仅供学习与测试使用,禁止商用。 12 | */ 13 | @Data 14 | public class PageParamRequest { 15 | 16 | @Schema(description = "页码", example = "1", minimum = "1", defaultValue = "1") 17 | private int page = 1; 18 | 19 | @Schema(description = "每页数量", example = "20", minimum = "1", maximum = "50", defaultValue = "20") 20 | private int limit = 20; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/common/response/LoginResponse.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.common.response; 2 | 3 | import lombok.Data; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.experimental.Accessors; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * @probject douyidou 11 | * @author Tuteri 12 | * @date 2025/04/16 13 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 14 | * 本程序仅供学习与测试使用,禁止商用。 15 | */ 16 | @Data 17 | @EqualsAndHashCode(callSuper = false) 18 | @Accessors(chain = true) 19 | public class LoginResponse implements Serializable { 20 | 21 | private static final long serialVersionUID=1L; 22 | 23 | private String accessToken; 24 | private String refreshToken; 25 | private int expire; 26 | } 27 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/common/response/parse/DouParseResponse.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.common.response.parse; 2 | 3 | import com.alibaba.fastjson2.JSONObject; 4 | import com.fasterxml.jackson.annotation.JsonFormat; 5 | import cc.douyidou.common.utils.bean.BeanUtils; 6 | import cc.douyidou.service.domain.DouParse; 7 | import lombok.Data; 8 | 9 | import java.io.Serializable; 10 | import java.util.ArrayList; 11 | import java.util.Date; 12 | import java.util.List; 13 | import java.util.Map; 14 | 15 | /** 16 | * @probject douyidou 17 | * @author Tuteri 18 | * @date 2025/04/16 19 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 20 | * 本程序仅供学习与测试使用,禁止商用。 21 | */ 22 | @Data 23 | public class DouParseResponse implements Serializable { 24 | private Long id; 25 | private String type; // 类型(video、audio等) 26 | private String url; // 原url 27 | private List video = new ArrayList<>(); // 视频链接 28 | private List images = new ArrayList<>();; // 图片地址 29 | private List audio = new ArrayList<>();; // 音频地址 30 | private String cover; // 封面图片 31 | private String text; // 文本内容 32 | private Integer platform; // 平台信息 33 | private Map proxy; 34 | private Map origin; 35 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 36 | private Date createTime; 37 | 38 | public DouParseResponse() { 39 | } 40 | 41 | public DouParseResponse(DouParse douParse) { 42 | BeanUtils.copyProperties(douParse,this); 43 | this.setVideo(JSONObject.parseObject(douParse.getVideo(),List.class)); 44 | this.setImages(JSONObject.parseObject(douParse.getImages(),List.class)); 45 | this.setAudio(JSONObject.parseObject(douParse.getAudio(),List.class)); 46 | this.setProxy(JSONObject.parseObject(douParse.getProxy())); 47 | this.setOrigin(JSONObject.parseObject(douParse.getOrigin())); 48 | } 49 | } -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/common/response/parse/TranscodeResponse.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.common.response.parse; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import lombok.Data; 5 | 6 | import java.io.Serializable; 7 | import java.math.BigInteger; 8 | import java.util.Date; 9 | 10 | /** 11 | * @probject douyidou 12 | * @author Tuteri 13 | * @date 2025/04/16 14 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 15 | * 本程序仅供学习与测试使用,禁止商用。 16 | */ 17 | @Data 18 | public class TranscodeResponse implements Serializable { 19 | // 任务名 20 | private Long id; 21 | // 任务名 22 | private String name; 23 | // 任务id 24 | private String task; 25 | // 任务状态 26 | private Integer stats; 27 | // 已转换文件大小 kb 28 | private BigInteger size; 29 | // 原url 30 | private String url; 31 | // 下载url 32 | private String downloadUrl; 33 | // 目标时长 34 | private Integer time; 35 | // 类型 36 | private String type; 37 | // 转码类型 38 | private String source; 39 | private String target; 40 | 41 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 42 | private Date createTime; 43 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 44 | private Date doneTime; 45 | } 46 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/common/response/parse/VideoParseResponse.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.common.response.parse; 2 | 3 | import com.alibaba.fastjson2.JSONObject; 4 | import cc.douyidou.common.utils.bean.BeanUtils; 5 | import cc.douyidou.service.domain.DouParse; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | /** 14 | * @probject douyidou 15 | * @author Tuteri 16 | * @date 2025/04/16 17 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 18 | * 本程序仅供学习与测试使用,禁止商用。 19 | */ 20 | @Data 21 | public class VideoParseResponse implements Serializable { 22 | private String type; // 类型(video、audio等) 23 | private List video = new ArrayList<>(); // 视频链接 24 | private List images = new ArrayList<>();; // 图片地址 25 | private List audio = new ArrayList<>();; // 音频地址 26 | private String music; // 音乐地址 27 | private String cover; // 封面图片 28 | private String text; // 文本内容 29 | private Integer platform; // 平台信息 30 | private Map proxy; 31 | private Map origin; 32 | 33 | public VideoParseResponse() { 34 | } 35 | 36 | public VideoParseResponse(DouParse douParse) { 37 | BeanUtils.copyProperties(douParse,this); 38 | this.setVideo(JSONObject.parseObject(douParse.getVideo(),List.class)); 39 | this.setImages(JSONObject.parseObject(douParse.getImages(),List.class)); 40 | this.setAudio(JSONObject.parseObject(douParse.getAudio(),List.class)); 41 | this.setProxy(JSONObject.parseObject(douParse.getProxy())); 42 | this.setOrigin(JSONObject.parseObject(douParse.getOrigin())); 43 | } 44 | } -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/common/response/user/DouUserResponse.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.common.response.user; 2 | 3 | import cc.douyidou.common.utils.bean.BeanUtils; 4 | import cc.douyidou.service.domain.DouUser; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | import java.io.Serializable; 9 | 10 | 11 | /** 12 | * @probject douyidou 13 | * @author Tuteri 14 | * @date 2025/04/16 15 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 16 | * 本程序仅供学习与测试使用,禁止商用。 17 | */ 18 | @Data 19 | @NoArgsConstructor 20 | public class DouUserResponse implements Serializable { 21 | private static final long serialVersionUID = 1L; 22 | 23 | 24 | /** 微信昵称 */ 25 | private String wxName; 26 | 27 | /** 微信openid */ 28 | private String wxOpenid; 29 | 30 | /** 用户名 */ 31 | private String username; 32 | 33 | /** 头像 */ 34 | private String avatar; 35 | /** 用户等级*/ 36 | private Integer level; 37 | /** 解析次数*/ 38 | private Integer parseNum; 39 | /** tokens*/ 40 | private Integer tokens; 41 | /** 解析次数临时*/ 42 | private Integer parseNumTemp; 43 | /** 解析广告是否跳过*/ 44 | private Boolean adSkipParse = false; 45 | /** 下载广告是否跳过*/ 46 | private Boolean adSkipSave = false; 47 | 48 | public DouUserResponse(DouUser douUser) { 49 | BeanUtils.copyProperties(douUser,this); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/config/WebConfig.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.config; 2 | 3 | import cc.douyidou.service.interceptor.DouUserAuthenticationInterceptor; 4 | import lombok.AllArgsConstructor; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.data.redis.core.RedisTemplate; 8 | import org.springframework.web.servlet.HandlerInterceptor; 9 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 10 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 11 | 12 | /** 13 | * @probject douyidou 14 | * @author Tuteri 15 | * @date 2025/04/16 16 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 17 | * 本程序仅供学习与测试使用,禁止商用。 18 | */ 19 | @Configuration 20 | @AllArgsConstructor 21 | public class WebConfig implements WebMvcConfigurer { 22 | private final RedisTemplate redisTemplate; 23 | @Bean 24 | public HandlerInterceptor getDouUserAuthenticationInterceptor(){ 25 | return new DouUserAuthenticationInterceptor(); 26 | } 27 | /** 28 | * 拦截器 29 | * @param registry 30 | */ 31 | @Override 32 | public void addInterceptors(InterceptorRegistry registry) { 33 | /** 34 | * 进入ThirdSession拦截器 35 | */ 36 | registry.addInterceptor(getDouUserAuthenticationInterceptor()) 37 | .addPathPatterns("/api/**")//拦截/api/**接口 38 | .excludePathPatterns("/api/miniLogin","/api/refreshToken","/api/f/**");//放行接口 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/domain/DouBase.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.domain; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableField; 4 | import cc.douyidou.common.core.domain.BaseEntity; 5 | 6 | import java.util.Map; 7 | 8 | /** 9 | * @probject douyidou 10 | * @author Tuteri 11 | * @date 2025/04/16 12 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 13 | * 本程序仅供学习与测试使用,禁止商用。 14 | */ 15 | public class DouBase extends BaseEntity { 16 | @TableField(exist = false) 17 | private String searchValue; 18 | @TableField(exist = false) 19 | private String createBy; 20 | @TableField(exist = false) 21 | private String updateBy; 22 | @TableField(exist = false) 23 | private String remark; 24 | @TableField(exist = false) 25 | private Map params; 26 | } 27 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/domain/DouHelp.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.domain; 2 | 3 | import cc.douyidou.common.annotation.Excel; 4 | import lombok.Data; 5 | 6 | /** 7 | * @probject douyidou 8 | * @author Tuteri 9 | * @date 2025/04/16 10 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 11 | * 本程序仅供学习与测试使用,禁止商用。 12 | */ 13 | @Data 14 | public class DouHelp extends DouBase 15 | { 16 | private static final long serialVersionUID = 1L; 17 | 18 | /** id */ 19 | @Excel(name = "id") 20 | private Long id; 21 | 22 | /** 标题 */ 23 | @Excel(name = "标题") 24 | private String title; 25 | 26 | /** 内容 */ 27 | @Excel(name = "内容") 28 | private String description; 29 | 30 | /** 展开 */ 31 | @Excel(name = "展开") 32 | private Long expand; 33 | 34 | /** 状态 */ 35 | @Excel(name = "状态") 36 | private Long status; 37 | /** 排序 */ 38 | @Excel(name = "排序") 39 | private Integer weight; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/domain/DouParse.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.domain; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import cc.douyidou.common.annotation.Excel; 5 | import lombok.Data; 6 | 7 | import java.util.Date; 8 | 9 | /** 10 | * @probject douyidou 11 | * @author Tuteri 12 | * @date 2025/04/16 13 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 14 | * 本程序仅供学习与测试使用,禁止商用。 15 | */ 16 | @Data 17 | public class DouParse extends DouBase 18 | { 19 | private static final long serialVersionUID = 1L; 20 | 21 | /** id */ 22 | private Long id; 23 | /** uid */ 24 | private Long uid; 25 | 26 | /** 视频url */ 27 | @Excel(name = "视频url") 28 | private String url; 29 | 30 | /** hash md5 */ 31 | @Excel(name = "hash md5") 32 | private String urlHash; 33 | 34 | /** 视频类型 video|note|slides */ 35 | @Excel(name = "视频类型 video|note|slides") 36 | private String type; 37 | 38 | /** 视频地址 */ 39 | @Excel(name = "视频地址") 40 | private String video; 41 | 42 | /** 音频地址 */ 43 | @Excel(name = "音频地址") 44 | private String audio; 45 | 46 | /** 图片地址 */ 47 | @Excel(name = "图片地址") 48 | private String images; 49 | 50 | /** 封面地址 */ 51 | @Excel(name = "封面地址") 52 | private String cover; 53 | 54 | /** 文案 */ 55 | @Excel(name = "文案") 56 | private String text; 57 | 58 | /** 平台 0未知 */ 59 | @Excel(name = "平台 0未知") 60 | private Integer platform; 61 | 62 | /** 代理 json */ 63 | private String proxy; 64 | 65 | /** 源 json */ 66 | private String origin; 67 | /** 创建时间 */ 68 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 69 | @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") 70 | private Date createTime; 71 | 72 | /** 更新时间 */ 73 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 74 | @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") 75 | private Date updateTime; 76 | 77 | } 78 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/domain/DouPlatform.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.domain; 2 | 3 | import lombok.Data; 4 | import cc.douyidou.common.annotation.Excel; 5 | 6 | /** 7 | * @probject douyidou 8 | * @author Tuteri 9 | * @date 2025/04/16 10 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 11 | * 本程序仅供学习与测试使用,禁止商用。 12 | */ 13 | @Data 14 | public class DouPlatform extends DouBase 15 | { 16 | private static final long serialVersionUID = 1L; 17 | 18 | /** $column.columnComment */ 19 | private Long id; 20 | 21 | /** 平台名 */ 22 | @Excel(name = "平台名") 23 | private String name; 24 | 25 | /** 图标 */ 26 | @Excel(name = "图标") 27 | private String icon; 28 | 29 | /** 描述 */ 30 | @Excel(name = "描述") 31 | private String description; 32 | 33 | /** 可用状态 */ 34 | @Excel(name = "可用状态") 35 | private Integer status; 36 | 37 | /** 权重 */ 38 | @Excel(name = "权重") 39 | private Integer weight; 40 | } 41 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/domain/DouReward.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.domain; 2 | 3 | import lombok.Data; 4 | import cc.douyidou.common.annotation.Excel; 5 | 6 | /** 7 | * @probject douyidou 8 | * @author Tuteri 9 | * @date 2025/04/16 10 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 11 | * 本程序仅供学习与测试使用,禁止商用。 12 | */ 13 | @Data 14 | public class DouReward extends DouBase 15 | { 16 | private static final long serialVersionUID = 1L; 17 | 18 | /** id */ 19 | @Excel(name = "id") 20 | private Long id; 21 | 22 | /** 用户id */ 23 | @Excel(name = "用户id") 24 | private Long uid; 25 | 26 | /** 广告id */ 27 | @Excel(name = "广告id") 28 | private String adId; 29 | 30 | /** 解析次数 */ 31 | @Excel(name = "解析次数") 32 | private Integer parseNum; 33 | 34 | /** tokens */ 35 | @Excel(name = "tokens") 36 | private Integer tokens; 37 | 38 | /** 奖励来源 */ 39 | @Excel(name = "奖励来源") 40 | private String source; 41 | 42 | /** 类型 0未知 1解析 2下载 3转码 4转码下载 */ 43 | @Excel(name = "类型 0未知 1解析 2下载 3转码 4转码下载") 44 | private Integer type; 45 | /** 是否为主动 */ 46 | @Excel(name = "是否为主动") 47 | private Integer proactive; 48 | 49 | } 50 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/domain/DouTranslate.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.domain; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import cc.douyidou.common.annotation.Excel; 5 | import lombok.Data; 6 | 7 | import java.math.BigInteger; 8 | import java.util.Date; 9 | 10 | /** 11 | * @probject douyidou 12 | * @author Tuteri 13 | * @date 2025/04/16 14 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 15 | * 本程序仅供学习与测试使用,禁止商用。 16 | */ 17 | @Data 18 | public class DouTranslate extends DouBase 19 | { 20 | private static final long serialVersionUID = 1L; 21 | 22 | /** ID */ 23 | private Long id; 24 | 25 | /** 自定义任务名 */ 26 | @Excel(name = "自定义任务名") 27 | private String name; 28 | 29 | /** 视频url */ 30 | @Excel(name = "视频url") 31 | private String url; 32 | 33 | /** 原格式 */ 34 | @Excel(name = "原格式") 35 | private String source; 36 | 37 | /** 现格式 */ 38 | @Excel(name = "现格式") 39 | private String target; 40 | 41 | /** 用户id */ 42 | @Excel(name = "用户id") 43 | private Long uid; 44 | 45 | /** 转码状态 */ 46 | @Excel(name = "转码状态") 47 | private Integer status; 48 | 49 | /** 任务名 */ 50 | @Excel(name = "任务名") 51 | private String task; 52 | 53 | /** 已转换文件大小 kb */ 54 | @Excel(name = "文件大小") 55 | private BigInteger size; 56 | 57 | /** 下载地址 */ 58 | @Excel(name = "下载地址") 59 | private String downloadUrl; 60 | 61 | /** 目标时长 */ 62 | @Excel(name = "目标时长") 63 | private Integer targetTime; 64 | /** 类型 */ 65 | @Excel(name = "类型") 66 | private Integer type; 67 | /** 创建时间 */ 68 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 69 | @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") 70 | private Date createTime; 71 | 72 | /** 更新时间 */ 73 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 74 | @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") 75 | private Date updateTime; 76 | /** 更新时间 */ 77 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 78 | @Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd") 79 | private Date doneTime; 80 | 81 | } 82 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/domain/DouUser.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.domain; 2 | 3 | import java.util.Date; 4 | 5 | import com.fasterxml.jackson.annotation.JsonFormat; 6 | import lombok.Data; 7 | import cc.douyidou.common.annotation.Excel; 8 | 9 | /** 10 | * @probject douyidou 11 | * @author Tuteri 12 | * @date 2025/04/16 13 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 14 | * 本程序仅供学习与测试使用,禁止商用。 15 | */ 16 | @Data 17 | public class DouUser extends DouBase 18 | { 19 | private static final long serialVersionUID = 1L; 20 | 21 | /** ID */ 22 | private Long id; 23 | 24 | /** 微信昵称 */ 25 | @Excel(name = "微信昵称") 26 | private String wxName; 27 | 28 | /** 微信openid */ 29 | @Excel(name = "微信openid") 30 | private String wxOpenid; 31 | 32 | /** 用户名 */ 33 | @Excel(name = "用户名") 34 | private String username; 35 | 36 | /** 密码 */ 37 | @Excel(name = "密码") 38 | private String password; 39 | 40 | /** 更新时间 */ 41 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 42 | @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") 43 | private Date updateTime; 44 | 45 | /** 创建时间 */ 46 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 47 | @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") 48 | private Date createTime; 49 | 50 | /** 头像 */ 51 | @Excel(name = "头像") 52 | private String avatar; 53 | /** 注册ip */ 54 | @Excel(name = "注册ip") 55 | private String registerIp; 56 | /** 登录ip */ 57 | private String loginIp; 58 | /** 上次登录ip */ 59 | private String lastLoginIp; 60 | /** 用户等级 */ 61 | @Excel(name = "用户等级") 62 | private Integer level; 63 | /** 解析/下载/转码次数 */ 64 | @Excel(name = "解析/下载/转码次数") 65 | private Integer parseNum; 66 | /** tokens */ 67 | @Excel(name = "tokens") 68 | private Integer tokens; 69 | /** 临时可用 解析/下载/转码次数 */ 70 | @Excel(name = "临时可用 解析/下载/转码次数") 71 | private Integer parseNumTemp; 72 | 73 | } 74 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/entity/LoginDouUser.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.entity; 2 | 3 | import cc.douyidou.service.domain.DouUser; 4 | import lombok.Data; 5 | 6 | /** 7 | * @probject douyidou 8 | * @author Tuteri 9 | * @date 2025/04/16 10 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 11 | * 本程序仅供学习与测试使用,禁止商用。 12 | */ 13 | @Data 14 | public class LoginDouUser { 15 | private String wxOpenid; 16 | private DouUser user; 17 | } 18 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/entity/LoginMaDTO.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.entity; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @probject douyidou 7 | * @author Tuteri 8 | * @date 2025/04/16 9 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 10 | * 本程序仅供学习与测试使用,禁止商用。 11 | */ 12 | @Data 13 | public class LoginMaDTO { 14 | private String code; 15 | } 16 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/exception/DouException.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.exception; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | 5 | /** 6 | * @probject douyidou 7 | * @author Tuteri 8 | * @date 2025/04/16 9 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 10 | * 本程序仅供学习与测试使用,禁止商用。 11 | */ 12 | @Slf4j 13 | public class DouException extends RuntimeException { 14 | 15 | private static final long serialVersionUID = 1L; 16 | 17 | public DouException() {} 18 | 19 | public DouException(String message) { 20 | super(message); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/exception/ExceptionCodeEnum.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.exception; 2 | 3 | /** 4 | * @probject douyidou 5 | * @author Tuteri 6 | * @date 2025/04/16 7 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 8 | * 本程序仅供学习与测试使用,禁止商用。 9 | */ 10 | public enum ExceptionCodeEnum implements ExceptionHandler{ 11 | // 数据操作错误定义 12 | SUCCESS(200, "操作成功"), 13 | FAILED(500, "操作失败"), 14 | PRAM_NOT_MATCH(400, "参数不正确"), 15 | VALIDATE_FAILED(400, "参数检验失败"), 16 | UNAUTHORIZED(401, "未登录或token过期,请登录!"), 17 | FORBIDDEN(403, "没有相关权限"), 18 | NOT_FOUND(404, "没有找到相关数据"), 19 | ERROR(500, "系统异常"), 20 | ; 21 | 22 | private long code; 23 | private String message; 24 | 25 | private ExceptionCodeEnum(long code, String message){ 26 | this.code = code; 27 | this.message = message; 28 | } 29 | 30 | @Override 31 | public long getCode() { 32 | return code; 33 | } 34 | 35 | @Override 36 | public String getMessage() { 37 | return message; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/exception/ExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.exception; 2 | 3 | /** 4 | * @probject douyidou 5 | * @author Tuteri 6 | * @date 2025/04/16 7 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 8 | * 本程序仅供学习与测试使用,禁止商用。 9 | */ 10 | public interface ExceptionHandler { 11 | 12 | long getCode(); 13 | 14 | String getMessage(); 15 | } 16 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/mapper/DouHelpMapper.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.mapper; 2 | 3 | import java.util.List; 4 | 5 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 6 | import cc.douyidou.service.domain.DouHelp; 7 | import org.apache.ibatis.annotations.Mapper; 8 | 9 | /** 10 | * 使用说明Mapper接口 11 | * @probject douyidou 12 | * @author Tuteri 13 | * @date 2025/04/16 14 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 15 | * 本程序仅供学习与测试使用,禁止商用。 16 | */ 17 | @Mapper 18 | public interface DouHelpMapper extends BaseMapper 19 | { 20 | /** 21 | * 查询使用说明 22 | * 23 | * @param id 使用说明主键 24 | * @return 使用说明 25 | */ 26 | public DouHelp selectDouHelpById(Long id); 27 | 28 | /** 29 | * 查询使用说明列表 30 | * 31 | * @param douHelp 使用说明 32 | * @return 使用说明集合 33 | */ 34 | public List selectDouHelpList(DouHelp douHelp); 35 | 36 | /** 37 | * 新增使用说明 38 | * 39 | * @param douHelp 使用说明 40 | * @return 结果 41 | */ 42 | public int insertDouHelp(DouHelp douHelp); 43 | 44 | /** 45 | * 修改使用说明 46 | * 47 | * @param douHelp 使用说明 48 | * @return 结果 49 | */ 50 | public int updateDouHelp(DouHelp douHelp); 51 | 52 | /** 53 | * 删除使用说明 54 | * 55 | * @param id 使用说明主键 56 | * @return 结果 57 | */ 58 | public int deleteDouHelpById(Long id); 59 | 60 | /** 61 | * 批量删除使用说明 62 | * 63 | * @param ids 需要删除的数据主键集合 64 | * @return 结果 65 | */ 66 | public int deleteDouHelpByIds(Long[] ids); 67 | } 68 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/mapper/DouParseMapper.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.mapper; 2 | 3 | import java.util.List; 4 | 5 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 6 | import cc.douyidou.service.domain.DouParse; 7 | import org.apache.ibatis.annotations.Mapper; 8 | 9 | /** 10 | * 视频解析记录Mapper接口 11 | * @probject douyidou 12 | * @author Tuteri 13 | * @date 2025/04/16 14 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 15 | * 本程序仅供学习与测试使用,禁止商用。 16 | */ 17 | @Mapper 18 | public interface DouParseMapper extends BaseMapper 19 | { 20 | /** 21 | * 查询视频解析记录 22 | * 23 | * @param id 视频解析记录主键 24 | * @return 视频解析记录 25 | */ 26 | public DouParse selectDouParseById(Long id); 27 | 28 | /** 29 | * 查询视频解析记录列表 30 | * 31 | * @param douParse 视频解析记录 32 | * @return 视频解析记录集合 33 | */ 34 | public List selectDouParseList(DouParse douParse); 35 | 36 | /** 37 | * 新增视频解析记录 38 | * 39 | * @param douParse 视频解析记录 40 | * @return 结果 41 | */ 42 | public int insertDouParse(DouParse douParse); 43 | 44 | /** 45 | * 修改视频解析记录 46 | * 47 | * @param douParse 视频解析记录 48 | * @return 结果 49 | */ 50 | public int updateDouParse(DouParse douParse); 51 | 52 | /** 53 | * 删除视频解析记录 54 | * 55 | * @param id 视频解析记录主键 56 | * @return 结果 57 | */ 58 | public int deleteDouParseById(Long id); 59 | 60 | /** 61 | * 批量删除视频解析记录 62 | * 63 | * @param ids 需要删除的数据主键集合 64 | * @return 结果 65 | */ 66 | public int deleteDouParseByIds(Long[] ids); 67 | } 68 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/mapper/DouPlatformMapper.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.mapper; 2 | 3 | import java.util.List; 4 | 5 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 6 | import cc.douyidou.service.domain.DouPlatform; 7 | import org.apache.ibatis.annotations.Mapper; 8 | 9 | /** 10 | * 支持的平台Mapper接口 11 | * @probject douyidou 12 | * @author Tuteri 13 | * @date 2025/04/16 14 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 15 | * 本程序仅供学习与测试使用,禁止商用。 16 | */ 17 | @Mapper 18 | public interface DouPlatformMapper extends BaseMapper 19 | { 20 | /** 21 | * 查询支持的平台 22 | * 23 | * @param id 支持的平台主键 24 | * @return 支持的平台 25 | */ 26 | public DouPlatform selectDouPlatformById(Long id); 27 | 28 | /** 29 | * 查询支持的平台列表 30 | * 31 | * @param douPlatform 支持的平台 32 | * @return 支持的平台集合 33 | */ 34 | public List selectDouPlatformList(DouPlatform douPlatform); 35 | 36 | /** 37 | * 新增支持的平台 38 | * 39 | * @param douPlatform 支持的平台 40 | * @return 结果 41 | */ 42 | public int insertDouPlatform(DouPlatform douPlatform); 43 | 44 | /** 45 | * 修改支持的平台 46 | * 47 | * @param douPlatform 支持的平台 48 | * @return 结果 49 | */ 50 | public int updateDouPlatform(DouPlatform douPlatform); 51 | 52 | /** 53 | * 删除支持的平台 54 | * 55 | * @param id 支持的平台主键 56 | * @return 结果 57 | */ 58 | public int deleteDouPlatformById(Long id); 59 | 60 | /** 61 | * 批量删除支持的平台 62 | * 63 | * @param ids 需要删除的数据主键集合 64 | * @return 结果 65 | */ 66 | public int deleteDouPlatformByIds(Long[] ids); 67 | } 68 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/mapper/DouRewardMapper.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.mapper; 2 | 3 | import java.util.List; 4 | 5 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 6 | import cc.douyidou.service.domain.DouReward; 7 | import org.apache.ibatis.annotations.Mapper; 8 | 9 | /** 10 | * 激励广告奖励Mapper接口 11 | * @probject douyidou 12 | * @author Tuteri 13 | * @date 2025/04/16 14 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 15 | * 本程序仅供学习与测试使用,禁止商用。 16 | */ 17 | @Mapper 18 | public interface DouRewardMapper extends BaseMapper 19 | { 20 | /** 21 | * 查询激励广告奖励 22 | * 23 | * @param id 激励广告奖励主键 24 | * @return 激励广告奖励 25 | */ 26 | public DouReward selectDouRewardById(Long id); 27 | 28 | /** 29 | * 查询激励广告奖励列表 30 | * 31 | * @param douReward 激励广告奖励 32 | * @return 激励广告奖励集合 33 | */ 34 | public List selectDouRewardList(DouReward douReward); 35 | 36 | /** 37 | * 新增激励广告奖励 38 | * 39 | * @param douReward 激励广告奖励 40 | * @return 结果 41 | */ 42 | public int insertDouReward(DouReward douReward); 43 | 44 | /** 45 | * 修改激励广告奖励 46 | * 47 | * @param douReward 激励广告奖励 48 | * @return 结果 49 | */ 50 | public int updateDouReward(DouReward douReward); 51 | 52 | /** 53 | * 删除激励广告奖励 54 | * 55 | * @param id 激励广告奖励主键 56 | * @return 结果 57 | */ 58 | public int deleteDouRewardById(Long id); 59 | 60 | /** 61 | * 批量删除激励广告奖励 62 | * 63 | * @param ids 需要删除的数据主键集合 64 | * @return 结果 65 | */ 66 | public int deleteDouRewardByIds(Long[] ids); 67 | } 68 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/mapper/DouTranslateMapper.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import cc.douyidou.service.domain.DouTranslate; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 视频转码Mapper接口 11 | * @probject douyidou 12 | * @author Tuteri 13 | * @date 2025/04/16 14 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 15 | * 本程序仅供学习与测试使用,禁止商用。 16 | */ 17 | @Mapper 18 | public interface DouTranslateMapper extends BaseMapper 19 | { 20 | /** 21 | * 查询视频转码 22 | * 23 | * @param id 视频转码主键 24 | * @return 视频转码 25 | */ 26 | public DouTranslate selectDouTranslateById(Long id); 27 | 28 | /** 29 | * 查询视频转码列表 30 | * 31 | * @param douTranslate 视频转码 32 | * @return 视频转码集合 33 | */ 34 | public List selectDouTranslateList(DouTranslate douTranslate); 35 | 36 | /** 37 | * 新增视频转码 38 | * 39 | * @param douTranslate 视频转码 40 | * @return 结果 41 | */ 42 | public int insertDouTranslate(DouTranslate douTranslate); 43 | 44 | /** 45 | * 修改视频转码 46 | * 47 | * @param douTranslate 视频转码 48 | * @return 结果 49 | */ 50 | public int updateDouTranslate(DouTranslate douTranslate); 51 | 52 | /** 53 | * 删除视频转码 54 | * 55 | * @param id 视频转码主键 56 | * @return 结果 57 | */ 58 | public int deleteDouTranslateById(Long id); 59 | 60 | /** 61 | * 批量删除视频转码 62 | * 63 | * @param ids 需要删除的数据主键集合 64 | * @return 结果 65 | */ 66 | public int deleteDouTranslateByIds(Long[] ids); 67 | } 68 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/mapper/DouUserMapper.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.mapper; 2 | 3 | import java.util.List; 4 | 5 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 6 | import cc.douyidou.service.domain.DouUser; 7 | import org.apache.ibatis.annotations.Mapper; 8 | 9 | /** 10 | * 应用用户Mapper接口 11 | * @probject douyidou 12 | * @author Tuteri 13 | * @date 2025/04/16 14 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 15 | * 本程序仅供学习与测试使用,禁止商用。 16 | */ 17 | @Mapper 18 | public interface DouUserMapper extends BaseMapper 19 | { 20 | /** 21 | * 查询应用用户 22 | * 23 | * @param id 应用用户主键 24 | * @return 应用用户 25 | */ 26 | public DouUser selectDouUserById(Long id); 27 | 28 | /** 29 | * 查询应用用户列表 30 | * 31 | * @param douUser 应用用户 32 | * @return 应用用户集合 33 | */ 34 | public List selectDouUserList(DouUser douUser); 35 | 36 | /** 37 | * 新增应用用户 38 | * 39 | * @param douUser 应用用户 40 | * @return 结果 41 | */ 42 | public int insertDouUser(DouUser douUser); 43 | 44 | /** 45 | * 修改应用用户 46 | * 47 | * @param douUser 应用用户 48 | * @return 结果 49 | */ 50 | public int updateDouUser(DouUser douUser); 51 | 52 | /** 53 | * 删除应用用户 54 | * 55 | * @param id 应用用户主键 56 | * @return 结果 57 | */ 58 | public int deleteDouUserById(Long id); 59 | 60 | /** 61 | * 批量删除应用用户 62 | * 63 | * @param ids 需要删除的数据主键集合 64 | * @return 结果 65 | */ 66 | public int deleteDouUserByIds(Long[] ids); 67 | } 68 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/service/DouConfigService.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.service; 2 | 3 | import cc.douyidou.service.common.response.CommonResult; 4 | import cc.douyidou.system.domain.SysConfig; 5 | import cc.douyidou.system.service.ISysConfigService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.HashMap; 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | /** 14 | * @probject douyidou 15 | * @author Tuteri 16 | * @date 2025/04/16 17 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 18 | * 本程序仅供学习与测试使用,禁止商用。 19 | */ 20 | @Service 21 | public class DouConfigService { 22 | @Autowired 23 | ISysConfigService configService; 24 | public CommonResult> getRoutine(){ 25 | List routine = configService.routine(); 26 | Map map = new HashMap<>(); 27 | routine.forEach(config -> { 28 | String name = config.getConfigKey().substring(8); 29 | if(!"app_id".equals(name) && !"app_secret".equals(name)){ 30 | map.put(name, config.getConfigValue()); 31 | } 32 | }); 33 | return CommonResult.success(map); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/service/IDouHelpService.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.service; 2 | 3 | import java.util.List; 4 | import cc.douyidou.service.domain.DouHelp; 5 | import com.baomidou.mybatisplus.extension.service.IService; 6 | 7 | /** 8 | * 使用说明Service接口 9 | * @probject douyidou 10 | * @author Tuteri 11 | * @date 2025/04/16 12 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 13 | * 本程序仅供学习与测试使用,禁止商用。 14 | */ 15 | public interface IDouHelpService extends IService 16 | { 17 | /** 18 | * 获取帮助列表 19 | */ 20 | public List getList(); 21 | /** 22 | * 查询使用说明 23 | * 24 | * @param id 使用说明主键 25 | * @return 使用说明 26 | */ 27 | public DouHelp selectDouHelpById(Long id); 28 | 29 | /** 30 | * 查询使用说明列表 31 | * 32 | * @param douHelp 使用说明 33 | * @return 使用说明集合 34 | */ 35 | public List selectDouHelpList(DouHelp douHelp); 36 | 37 | /** 38 | * 新增使用说明 39 | * 40 | * @param douHelp 使用说明 41 | * @return 结果 42 | */ 43 | public int insertDouHelp(DouHelp douHelp); 44 | 45 | /** 46 | * 修改使用说明 47 | * 48 | * @param douHelp 使用说明 49 | * @return 结果 50 | */ 51 | public int updateDouHelp(DouHelp douHelp); 52 | 53 | /** 54 | * 批量删除使用说明 55 | * 56 | * @param ids 需要删除的使用说明主键集合 57 | * @return 结果 58 | */ 59 | public int deleteDouHelpByIds(Long[] ids); 60 | 61 | /** 62 | * 删除使用说明信息 63 | * 64 | * @param id 使用说明主键 65 | * @return 结果 66 | */ 67 | public int deleteDouHelpById(Long id); 68 | } 69 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/service/IDouPlatformService.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.service; 2 | 3 | import java.util.List; 4 | 5 | import com.baomidou.mybatisplus.extension.service.IService; 6 | import cc.douyidou.service.domain.DouPlatform; 7 | 8 | /** 9 | * 支持的平台Service接口 10 | * @probject douyidou 11 | * @author Tuteri 12 | * @date 2025/04/16 13 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 14 | * 本程序仅供学习与测试使用,禁止商用。 15 | */ 16 | public interface IDouPlatformService extends IService 17 | { 18 | /** 19 | * 查询支持的平台 20 | * 21 | * @param id 支持的平台主键 22 | * @return 支持的平台 23 | */ 24 | public DouPlatform selectDouPlatformById(Long id); 25 | 26 | /** 27 | * 查询支持的平台列表 28 | * 29 | * @param douPlatform 支持的平台 30 | * @return 支持的平台集合 31 | */ 32 | public List selectDouPlatformList(DouPlatform douPlatform); 33 | 34 | /** 35 | * 新增支持的平台 36 | * 37 | * @param douPlatform 支持的平台 38 | * @return 结果 39 | */ 40 | public int insertDouPlatform(DouPlatform douPlatform); 41 | 42 | /** 43 | * 修改支持的平台 44 | * 45 | * @param douPlatform 支持的平台 46 | * @return 结果 47 | */ 48 | public int updateDouPlatform(DouPlatform douPlatform); 49 | 50 | /** 51 | * 批量删除支持的平台 52 | * 53 | * @param ids 需要删除的支持的平台主键集合 54 | * @return 结果 55 | */ 56 | public int deleteDouPlatformByIds(Long[] ids); 57 | 58 | /** 59 | * 删除支持的平台信息 60 | * 61 | * @param id 支持的平台主键 62 | * @return 结果 63 | */ 64 | public int deleteDouPlatformById(Long id); 65 | } 66 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/service/IDouRewardService.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.service; 2 | 3 | import java.util.List; 4 | 5 | import com.baomidou.mybatisplus.extension.service.IService; 6 | import cc.douyidou.service.domain.DouReward; 7 | 8 | /** 9 | * 激励广告奖励Service接口 10 | * @probject douyidou 11 | * @author Tuteri 12 | * @date 2025/04/16 13 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 14 | * 本程序仅供学习与测试使用,禁止商用。 15 | */ 16 | public interface IDouRewardService extends IService { 17 | 18 | 19 | /** 20 | * 统计今日分享次数 21 | * 22 | * @return Integer 23 | */ 24 | Long dayCountByUser(); 25 | 26 | DouReward sendReward(DouReward douRewardRequest); 27 | 28 | DouReward findLastByUser(); 29 | 30 | DouReward findLastByUserId(Long userId); 31 | /** 32 | * 查询激励广告奖励 33 | * 34 | * @param id 激励广告奖励主键 35 | * @return 激励广告奖励 36 | */ 37 | public DouReward selectDouRewardById(Long id); 38 | 39 | /** 40 | * 查询激励广告奖励列表 41 | * 42 | * @param douReward 激励广告奖励 43 | * @return 激励广告奖励集合 44 | */ 45 | public List selectDouRewardList(DouReward douReward); 46 | 47 | /** 48 | * 新增激励广告奖励 49 | * 50 | * @param douReward 激励广告奖励 51 | * @return 结果 52 | */ 53 | public int insertDouReward(DouReward douReward); 54 | 55 | /** 56 | * 修改激励广告奖励 57 | * 58 | * @param douReward 激励广告奖励 59 | * @return 结果 60 | */ 61 | public int updateDouReward(DouReward douReward); 62 | 63 | /** 64 | * 批量删除激励广告奖励 65 | * 66 | * @param ids 需要删除的激励广告奖励主键集合 67 | * @return 结果 68 | */ 69 | public int deleteDouRewardByIds(Long[] ids); 70 | 71 | /** 72 | * 删除激励广告奖励信息 73 | * 74 | * @param id 激励广告奖励主键 75 | * @return 结果 76 | */ 77 | public int deleteDouRewardById(Long id); 78 | } 79 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/service/WxUserService.java: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (c) 2020 www.joolun.com 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | package cc.douyidou.service.service; 25 | 26 | import cc.douyidou.service.common.response.CommonResult; 27 | import cc.douyidou.service.common.response.LoginResponse; 28 | import jakarta.servlet.http.HttpServletRequest; 29 | 30 | /** 31 | * @probject douyidou 32 | * @author Tuteri 33 | * @date 2025/04/16 34 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 35 | * 本程序仅供学习与测试使用,禁止商用。 36 | */ 37 | public interface WxUserService { 38 | 39 | 40 | /** 41 | * 根据openId获取用户 42 | * @param openId 43 | * @return 44 | */ 45 | //WxUser getByOpenId(String openId); 46 | 47 | /** 48 | * 小程序登录 49 | * @param code 50 | * @return 51 | */ 52 | CommonResult miniLogin(String code,HttpServletRequest request); 53 | 54 | CommonResult refreshToken(HttpServletRequest request); 55 | 56 | } 57 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/task/DouUserTask.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.task; 2 | 3 | import cc.douyidou.service.service.IDouRewardService; 4 | import cc.douyidou.service.service.IDouUserService; 5 | import cc.douyidou.service.service.ParseService; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Component; 10 | 11 | @Component 12 | public class DouUserTask { 13 | private static final Logger log = LoggerFactory.getLogger(DouUserTask.class); 14 | 15 | @Autowired 16 | IDouUserService douUserService; 17 | 18 | /** 19 | * 检查过期的临时次数 20 | */ 21 | public void clearPntTask(){ 22 | douUserService.clearPntTask(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/task/TranscodeTask.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.task; 2 | 3 | import cc.douyidou.service.service.ParseService; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Component; 8 | 9 | /** 10 | * @probject douyidou 11 | * @author Tuteri 12 | * @date 2025/04/16 13 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 14 | * 本程序仅供学习与测试使用,禁止商用。 15 | */ 16 | @Component 17 | public class TranscodeTask { 18 | private static final Logger log = LoggerFactory.getLogger(TranscodeTask.class); 19 | @Autowired 20 | ParseService parseService; 21 | public void stats(){ 22 | log.info("TranscodeTask::stats 定时任务"); 23 | parseService.transcodeStatsTask(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/utils/DouUtils.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.utils; 2 | 3 | import jakarta.servlet.http.HttpServletRequest; 4 | 5 | import java.net.URL; 6 | 7 | /** 8 | * @probject douyidou 9 | * @author Tuteri 10 | * @date 2025/04/16 11 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 12 | * 本程序仅供学习与测试使用,禁止商用。 13 | */ 14 | public class DouUtils { 15 | public static String getUrlExt(String urlString) { 16 | try { 17 | URL url = new URL(urlString); 18 | String path = url.getPath(); // 只获取 URL 的路径部分 19 | int lastDotIndex = path.lastIndexOf("."); 20 | if (lastDotIndex != -1 && lastDotIndex < path.length() - 1) { 21 | return path.substring(lastDotIndex).toLowerCase(); 22 | } 23 | } catch (Exception e) { 24 | e.printStackTrace(); 25 | } 26 | return ""; 27 | } 28 | public static String md5(String str) { 29 | try { 30 | java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5"); 31 | byte[] array = md.digest(str.getBytes()); 32 | StringBuilder sb = new StringBuilder(); 33 | for (byte b : array) { 34 | sb.append(String.format("%02x", b)); 35 | } 36 | return sb.toString(); 37 | } catch (Exception e) { 38 | throw new RuntimeException("MD5 计算失败", e); 39 | } 40 | } 41 | public static String getClientIp(HttpServletRequest request) { 42 | String ip = request.getHeader("X-Real-IP"); 43 | if (ip != null && ip.length() != 0 && !"unknown".equalsIgnoreCase(ip)) { 44 | return ip.split(",")[0].trim(); 45 | } 46 | 47 | return request.getRemoteAddr(); // 最后才取默认的 remoteAddr 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /douyidou-service/src/main/java/cc/douyidou/service/utils/SecurityUtils.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.service.utils; 2 | 3 | import cc.douyidou.service.entity.LoginDouUser; 4 | import org.springframework.security.core.Authentication; 5 | import org.springframework.security.core.context.SecurityContextHolder; 6 | 7 | 8 | /** 9 | * @probject douyidou 10 | * @author Tuteri 11 | * @date 2025/04/16 12 | * 版权所有 © 2025 douyidou.cc 保留所有权利。 13 | * 本程序仅供学习与测试使用,禁止商用。 14 | */ 15 | public class SecurityUtils { 16 | public static LoginDouUser getLoginDouUser() { 17 | Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); 18 | LoginDouUser loginDouUser = (LoginDouUser) authentication.getPrincipal(); 19 | return loginDouUser; 20 | } 21 | public static Long getLoginDouUserId() { 22 | 23 | return getLoginDouUser().getUser().getId(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /douyidou-system/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | douyidou 7 | cc.douyidou 8 | 3.8.9 9 | 10 | 4.0.0 11 | 12 | douyidou-system 13 | 14 | 15 | system系统模块 16 | 17 | 18 | 19 | 20 | 21 | com.baomidou 22 | mybatis-plus-spring-boot3-starter 23 | 24 | 25 | 26 | cc.douyidou 27 | douyidou-common 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /douyidou-system/src/main/java/cc/douyidou/system/domain/SysCache.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.system.domain; 2 | 3 | import cc.douyidou.common.utils.StringUtils; 4 | 5 | /** 6 | * 缓存信息 7 | * 8 | * @author ruoyi 9 | */ 10 | public class SysCache 11 | { 12 | /** 缓存名称 */ 13 | private String cacheName = ""; 14 | 15 | /** 缓存键名 */ 16 | private String cacheKey = ""; 17 | 18 | /** 缓存内容 */ 19 | private String cacheValue = ""; 20 | 21 | /** 备注 */ 22 | private String remark = ""; 23 | 24 | public SysCache() 25 | { 26 | 27 | } 28 | 29 | public SysCache(String cacheName, String remark) 30 | { 31 | this.cacheName = cacheName; 32 | this.remark = remark; 33 | } 34 | 35 | public SysCache(String cacheName, String cacheKey, String cacheValue) 36 | { 37 | this.cacheName = StringUtils.replace(cacheName, ":", ""); 38 | this.cacheKey = StringUtils.replace(cacheKey, cacheName, ""); 39 | this.cacheValue = cacheValue; 40 | } 41 | 42 | public String getCacheName() 43 | { 44 | return cacheName; 45 | } 46 | 47 | public void setCacheName(String cacheName) 48 | { 49 | this.cacheName = cacheName; 50 | } 51 | 52 | public String getCacheKey() 53 | { 54 | return cacheKey; 55 | } 56 | 57 | public void setCacheKey(String cacheKey) 58 | { 59 | this.cacheKey = cacheKey; 60 | } 61 | 62 | public String getCacheValue() 63 | { 64 | return cacheValue; 65 | } 66 | 67 | public void setCacheValue(String cacheValue) 68 | { 69 | this.cacheValue = cacheValue; 70 | } 71 | 72 | public String getRemark() 73 | { 74 | return remark; 75 | } 76 | 77 | public void setRemark(String remark) 78 | { 79 | this.remark = remark; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /douyidou-system/src/main/java/cc/douyidou/system/domain/SysRoleDept.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.system.domain; 2 | 3 | import org.apache.commons.lang3.builder.ToStringBuilder; 4 | import org.apache.commons.lang3.builder.ToStringStyle; 5 | 6 | /** 7 | * 角色和部门关联 sys_role_dept 8 | * 9 | * @author ruoyi 10 | */ 11 | public class SysRoleDept 12 | { 13 | /** 角色ID */ 14 | private Long roleId; 15 | 16 | /** 部门ID */ 17 | private Long deptId; 18 | 19 | public Long getRoleId() 20 | { 21 | return roleId; 22 | } 23 | 24 | public void setRoleId(Long roleId) 25 | { 26 | this.roleId = roleId; 27 | } 28 | 29 | public Long getDeptId() 30 | { 31 | return deptId; 32 | } 33 | 34 | public void setDeptId(Long deptId) 35 | { 36 | this.deptId = deptId; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) 42 | .append("roleId", getRoleId()) 43 | .append("deptId", getDeptId()) 44 | .toString(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /douyidou-system/src/main/java/cc/douyidou/system/domain/SysRoleMenu.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.system.domain; 2 | 3 | import org.apache.commons.lang3.builder.ToStringBuilder; 4 | import org.apache.commons.lang3.builder.ToStringStyle; 5 | 6 | /** 7 | * 角色和菜单关联 sys_role_menu 8 | * 9 | * @author ruoyi 10 | */ 11 | public class SysRoleMenu 12 | { 13 | /** 角色ID */ 14 | private Long roleId; 15 | 16 | /** 菜单ID */ 17 | private Long menuId; 18 | 19 | public Long getRoleId() 20 | { 21 | return roleId; 22 | } 23 | 24 | public void setRoleId(Long roleId) 25 | { 26 | this.roleId = roleId; 27 | } 28 | 29 | public Long getMenuId() 30 | { 31 | return menuId; 32 | } 33 | 34 | public void setMenuId(Long menuId) 35 | { 36 | this.menuId = menuId; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) 42 | .append("roleId", getRoleId()) 43 | .append("menuId", getMenuId()) 44 | .toString(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /douyidou-system/src/main/java/cc/douyidou/system/domain/SysUserPost.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.system.domain; 2 | 3 | import org.apache.commons.lang3.builder.ToStringBuilder; 4 | import org.apache.commons.lang3.builder.ToStringStyle; 5 | 6 | /** 7 | * 用户和岗位关联 sys_user_post 8 | * 9 | * @author ruoyi 10 | */ 11 | public class SysUserPost 12 | { 13 | /** 用户ID */ 14 | private Long userId; 15 | 16 | /** 岗位ID */ 17 | private Long postId; 18 | 19 | public Long getUserId() 20 | { 21 | return userId; 22 | } 23 | 24 | public void setUserId(Long userId) 25 | { 26 | this.userId = userId; 27 | } 28 | 29 | public Long getPostId() 30 | { 31 | return postId; 32 | } 33 | 34 | public void setPostId(Long postId) 35 | { 36 | this.postId = postId; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) 42 | .append("userId", getUserId()) 43 | .append("postId", getPostId()) 44 | .toString(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /douyidou-system/src/main/java/cc/douyidou/system/domain/SysUserRole.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.system.domain; 2 | 3 | import org.apache.commons.lang3.builder.ToStringBuilder; 4 | import org.apache.commons.lang3.builder.ToStringStyle; 5 | 6 | /** 7 | * 用户和角色关联 sys_user_role 8 | * 9 | * @author ruoyi 10 | */ 11 | public class SysUserRole 12 | { 13 | /** 用户ID */ 14 | private Long userId; 15 | 16 | /** 角色ID */ 17 | private Long roleId; 18 | 19 | public Long getUserId() 20 | { 21 | return userId; 22 | } 23 | 24 | public void setUserId(Long userId) 25 | { 26 | this.userId = userId; 27 | } 28 | 29 | public Long getRoleId() 30 | { 31 | return roleId; 32 | } 33 | 34 | public void setRoleId(Long roleId) 35 | { 36 | this.roleId = roleId; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) 42 | .append("userId", getUserId()) 43 | .append("roleId", getRoleId()) 44 | .toString(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /douyidou-system/src/main/java/cc/douyidou/system/mapper/SysConfigMapper.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.system.mapper; 2 | 3 | import java.util.List; 4 | 5 | import cc.douyidou.system.domain.SysConfig; 6 | import org.apache.ibatis.annotations.Mapper; 7 | import org.apache.ibatis.annotations.Select; 8 | 9 | /** 10 | * 参数配置 数据层 11 | * 12 | * @author ruoyi 13 | */ 14 | @Mapper 15 | public interface SysConfigMapper 16 | { 17 | @Select("SELECT * FROM sys_config WHERE config_key LIKE 'routine.%'") 18 | List selectRoutineData(); 19 | /** 20 | * 查询参数配置信息 21 | * 22 | * @param config 参数配置信息 23 | * @return 参数配置信息 24 | */ 25 | public SysConfig selectConfig(SysConfig config); 26 | 27 | /** 28 | * 通过ID查询配置 29 | * 30 | * @param configId 参数ID 31 | * @return 参数配置信息 32 | */ 33 | public SysConfig selectConfigById(Long configId); 34 | 35 | /** 36 | * 查询参数配置列表 37 | * 38 | * @param config 参数配置信息 39 | * @return 参数配置集合 40 | */ 41 | public List selectConfigList(SysConfig config); 42 | 43 | /** 44 | * 根据键名查询参数配置信息 45 | * 46 | * @param configKey 参数键名 47 | * @return 参数配置信息 48 | */ 49 | public SysConfig checkConfigKeyUnique(String configKey); 50 | 51 | /** 52 | * 新增参数配置 53 | * 54 | * @param config 参数配置信息 55 | * @return 结果 56 | */ 57 | public int insertConfig(SysConfig config); 58 | 59 | /** 60 | * 修改参数配置 61 | * 62 | * @param config 参数配置信息 63 | * @return 结果 64 | */ 65 | public int updateConfig(SysConfig config); 66 | 67 | /** 68 | * 删除参数配置 69 | * 70 | * @param configId 参数ID 71 | * @return 结果 72 | */ 73 | public int deleteConfigById(Long configId); 74 | 75 | /** 76 | * 批量删除参数信息 77 | * 78 | * @param configIds 需要删除的参数ID 79 | * @return 结果 80 | */ 81 | public int deleteConfigByIds(Long[] configIds); 82 | } 83 | -------------------------------------------------------------------------------- /douyidou-system/src/main/java/cc/douyidou/system/mapper/SysDictTypeMapper.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.system.mapper; 2 | 3 | import java.util.List; 4 | import cc.douyidou.common.core.domain.entity.SysDictType; 5 | 6 | /** 7 | * 字典表 数据层 8 | * 9 | * @author ruoyi 10 | */ 11 | public interface SysDictTypeMapper 12 | { 13 | /** 14 | * 根据条件分页查询字典类型 15 | * 16 | * @param dictType 字典类型信息 17 | * @return 字典类型集合信息 18 | */ 19 | public List selectDictTypeList(SysDictType dictType); 20 | 21 | /** 22 | * 根据所有字典类型 23 | * 24 | * @return 字典类型集合信息 25 | */ 26 | public List selectDictTypeAll(); 27 | 28 | /** 29 | * 根据字典类型ID查询信息 30 | * 31 | * @param dictId 字典类型ID 32 | * @return 字典类型 33 | */ 34 | public SysDictType selectDictTypeById(Long dictId); 35 | 36 | /** 37 | * 根据字典类型查询信息 38 | * 39 | * @param dictType 字典类型 40 | * @return 字典类型 41 | */ 42 | public SysDictType selectDictTypeByType(String dictType); 43 | 44 | /** 45 | * 通过字典ID删除字典信息 46 | * 47 | * @param dictId 字典ID 48 | * @return 结果 49 | */ 50 | public int deleteDictTypeById(Long dictId); 51 | 52 | /** 53 | * 批量删除字典类型信息 54 | * 55 | * @param dictIds 需要删除的字典ID 56 | * @return 结果 57 | */ 58 | public int deleteDictTypeByIds(Long[] dictIds); 59 | 60 | /** 61 | * 新增字典类型信息 62 | * 63 | * @param dictType 字典类型信息 64 | * @return 结果 65 | */ 66 | public int insertDictType(SysDictType dictType); 67 | 68 | /** 69 | * 修改字典类型信息 70 | * 71 | * @param dictType 字典类型信息 72 | * @return 结果 73 | */ 74 | public int updateDictType(SysDictType dictType); 75 | 76 | /** 77 | * 校验字典类型称是否唯一 78 | * 79 | * @param dictType 字典类型 80 | * @return 结果 81 | */ 82 | public SysDictType checkDictTypeUnique(String dictType); 83 | } 84 | -------------------------------------------------------------------------------- /douyidou-system/src/main/java/cc/douyidou/system/mapper/SysLogininforMapper.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.system.mapper; 2 | 3 | import java.util.List; 4 | import cc.douyidou.system.domain.SysLogininfor; 5 | 6 | /** 7 | * 系统访问日志情况信息 数据层 8 | * 9 | * @author ruoyi 10 | */ 11 | public interface SysLogininforMapper 12 | { 13 | /** 14 | * 新增系统登录日志 15 | * 16 | * @param logininfor 访问日志对象 17 | */ 18 | public void insertLogininfor(SysLogininfor logininfor); 19 | 20 | /** 21 | * 查询系统登录日志集合 22 | * 23 | * @param logininfor 访问日志对象 24 | * @return 登录记录集合 25 | */ 26 | public List selectLogininforList(SysLogininfor logininfor); 27 | 28 | /** 29 | * 批量删除系统登录日志 30 | * 31 | * @param infoIds 需要删除的登录日志ID 32 | * @return 结果 33 | */ 34 | public int deleteLogininforByIds(Long[] infoIds); 35 | 36 | /** 37 | * 清空系统登录日志 38 | * 39 | * @return 结果 40 | */ 41 | public int cleanLogininfor(); 42 | } 43 | -------------------------------------------------------------------------------- /douyidou-system/src/main/java/cc/douyidou/system/mapper/SysNoticeMapper.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.system.mapper; 2 | 3 | import java.util.List; 4 | 5 | import cc.douyidou.system.domain.SysNotice; 6 | 7 | /** 8 | * 通知公告表 数据层 9 | * 10 | * @author ruoyi 11 | */ 12 | public interface SysNoticeMapper 13 | { 14 | /** 15 | * 查询公告信息 16 | * 17 | * @param noticeId 公告ID 18 | * @return 公告信息 19 | */ 20 | public SysNotice selectNoticeById(Long noticeId); 21 | 22 | /** 23 | * 查询公告列表 24 | * 25 | * @param notice 公告信息 26 | * @return 公告集合 27 | */ 28 | public List selectNoticeList(SysNotice notice); 29 | 30 | /** 31 | * 新增公告 32 | * 33 | * @param notice 公告信息 34 | * @return 结果 35 | */ 36 | public int insertNotice(SysNotice notice); 37 | 38 | /** 39 | * 修改公告 40 | * 41 | * @param notice 公告信息 42 | * @return 结果 43 | */ 44 | public int updateNotice(SysNotice notice); 45 | 46 | /** 47 | * 批量删除公告 48 | * 49 | * @param noticeId 公告ID 50 | * @return 结果 51 | */ 52 | public int deleteNoticeById(Long noticeId); 53 | 54 | /** 55 | * 批量删除公告信息 56 | * 57 | * @param noticeIds 需要删除的公告ID 58 | * @return 结果 59 | */ 60 | public int deleteNoticeByIds(Long[] noticeIds); 61 | } 62 | -------------------------------------------------------------------------------- /douyidou-system/src/main/java/cc/douyidou/system/mapper/SysOperLogMapper.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.system.mapper; 2 | 3 | import java.util.List; 4 | import cc.douyidou.system.domain.SysOperLog; 5 | 6 | /** 7 | * 操作日志 数据层 8 | * 9 | * @author ruoyi 10 | */ 11 | public interface SysOperLogMapper 12 | { 13 | /** 14 | * 新增操作日志 15 | * 16 | * @param operLog 操作日志对象 17 | */ 18 | public void insertOperlog(SysOperLog operLog); 19 | 20 | /** 21 | * 查询系统操作日志集合 22 | * 23 | * @param operLog 操作日志对象 24 | * @return 操作日志集合 25 | */ 26 | public List selectOperLogList(SysOperLog operLog); 27 | 28 | /** 29 | * 批量删除系统操作日志 30 | * 31 | * @param operIds 需要删除的操作日志ID 32 | * @return 结果 33 | */ 34 | public int deleteOperLogByIds(Long[] operIds); 35 | 36 | /** 37 | * 查询操作日志详细 38 | * 39 | * @param operId 操作ID 40 | * @return 操作日志对象 41 | */ 42 | public SysOperLog selectOperLogById(Long operId); 43 | 44 | /** 45 | * 清空操作日志 46 | */ 47 | public void cleanOperLog(); 48 | } 49 | -------------------------------------------------------------------------------- /douyidou-system/src/main/java/cc/douyidou/system/mapper/SysRoleDeptMapper.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.system.mapper; 2 | 3 | import java.util.List; 4 | 5 | import cc.douyidou.system.domain.SysRoleDept; 6 | 7 | /** 8 | * 角色与部门关联表 数据层 9 | * 10 | * @author ruoyi 11 | */ 12 | public interface SysRoleDeptMapper 13 | { 14 | /** 15 | * 通过角色ID删除角色和部门关联 16 | * 17 | * @param roleId 角色ID 18 | * @return 结果 19 | */ 20 | public int deleteRoleDeptByRoleId(Long roleId); 21 | 22 | /** 23 | * 批量删除角色部门关联信息 24 | * 25 | * @param ids 需要删除的数据ID 26 | * @return 结果 27 | */ 28 | public int deleteRoleDept(Long[] ids); 29 | 30 | /** 31 | * 查询部门使用数量 32 | * 33 | * @param deptId 部门ID 34 | * @return 结果 35 | */ 36 | public int selectCountRoleDeptByDeptId(Long deptId); 37 | 38 | /** 39 | * 批量新增角色部门信息 40 | * 41 | * @param roleDeptList 角色部门列表 42 | * @return 结果 43 | */ 44 | public int batchRoleDept(List roleDeptList); 45 | } 46 | -------------------------------------------------------------------------------- /douyidou-system/src/main/java/cc/douyidou/system/mapper/SysRoleMenuMapper.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.system.mapper; 2 | 3 | import java.util.List; 4 | import cc.douyidou.system.domain.SysRoleMenu; 5 | 6 | /** 7 | * 角色与菜单关联表 数据层 8 | * 9 | * @author ruoyi 10 | */ 11 | public interface SysRoleMenuMapper 12 | { 13 | /** 14 | * 查询菜单使用数量 15 | * 16 | * @param menuId 菜单ID 17 | * @return 结果 18 | */ 19 | public int checkMenuExistRole(Long menuId); 20 | 21 | /** 22 | * 通过角色ID删除角色和菜单关联 23 | * 24 | * @param roleId 角色ID 25 | * @return 结果 26 | */ 27 | public int deleteRoleMenuByRoleId(Long roleId); 28 | 29 | /** 30 | * 批量删除角色菜单关联信息 31 | * 32 | * @param ids 需要删除的数据ID 33 | * @return 结果 34 | */ 35 | public int deleteRoleMenu(Long[] ids); 36 | 37 | /** 38 | * 批量新增角色菜单信息 39 | * 40 | * @param roleMenuList 角色菜单列表 41 | * @return 结果 42 | */ 43 | public int batchRoleMenu(List roleMenuList); 44 | } 45 | -------------------------------------------------------------------------------- /douyidou-system/src/main/java/cc/douyidou/system/mapper/SysUserPostMapper.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.system.mapper; 2 | 3 | import java.util.List; 4 | import cc.douyidou.system.domain.SysUserPost; 5 | 6 | /** 7 | * 用户与岗位关联表 数据层 8 | * 9 | * @author ruoyi 10 | */ 11 | public interface SysUserPostMapper 12 | { 13 | /** 14 | * 通过用户ID删除用户和岗位关联 15 | * 16 | * @param userId 用户ID 17 | * @return 结果 18 | */ 19 | public int deleteUserPostByUserId(Long userId); 20 | 21 | /** 22 | * 通过岗位ID查询岗位使用数量 23 | * 24 | * @param postId 岗位ID 25 | * @return 结果 26 | */ 27 | public int countUserPostById(Long postId); 28 | 29 | /** 30 | * 批量删除用户和岗位关联 31 | * 32 | * @param ids 需要删除的数据ID 33 | * @return 结果 34 | */ 35 | public int deleteUserPost(Long[] ids); 36 | 37 | /** 38 | * 批量新增用户岗位信息 39 | * 40 | * @param userPostList 用户岗位列表 41 | * @return 结果 42 | */ 43 | public int batchUserPost(List userPostList); 44 | } 45 | -------------------------------------------------------------------------------- /douyidou-system/src/main/java/cc/douyidou/system/mapper/SysUserRoleMapper.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.system.mapper; 2 | 3 | import java.util.List; 4 | import org.apache.ibatis.annotations.Param; 5 | import cc.douyidou.system.domain.SysUserRole; 6 | 7 | /** 8 | * 用户与角色关联表 数据层 9 | * 10 | * @author ruoyi 11 | */ 12 | public interface SysUserRoleMapper 13 | { 14 | /** 15 | * 通过用户ID删除用户和角色关联 16 | * 17 | * @param userId 用户ID 18 | * @return 结果 19 | */ 20 | public int deleteUserRoleByUserId(Long userId); 21 | 22 | /** 23 | * 批量删除用户和角色关联 24 | * 25 | * @param ids 需要删除的数据ID 26 | * @return 结果 27 | */ 28 | public int deleteUserRole(Long[] ids); 29 | 30 | /** 31 | * 通过角色ID查询角色使用数量 32 | * 33 | * @param roleId 角色ID 34 | * @return 结果 35 | */ 36 | public int countUserRoleByRoleId(Long roleId); 37 | 38 | /** 39 | * 批量新增用户角色信息 40 | * 41 | * @param userRoleList 用户角色列表 42 | * @return 结果 43 | */ 44 | public int batchUserRole(List userRoleList); 45 | 46 | /** 47 | * 删除用户和角色关联信息 48 | * 49 | * @param userRole 用户和角色关联信息 50 | * @return 结果 51 | */ 52 | public int deleteUserRoleInfo(SysUserRole userRole); 53 | 54 | /** 55 | * 批量取消授权用户角色 56 | * 57 | * @param roleId 角色ID 58 | * @param userIds 需要删除的用户数据ID 59 | * @return 结果 60 | */ 61 | public int deleteUserRoleInfos(@Param("roleId") Long roleId, @Param("userIds") Long[] userIds); 62 | } 63 | -------------------------------------------------------------------------------- /douyidou-system/src/main/java/cc/douyidou/system/service/ISysDictDataService.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.system.service; 2 | 3 | import java.util.List; 4 | import cc.douyidou.common.core.domain.entity.SysDictData; 5 | 6 | /** 7 | * 字典 业务层 8 | * 9 | * @author ruoyi 10 | */ 11 | public interface ISysDictDataService 12 | { 13 | /** 14 | * 根据条件分页查询字典数据 15 | * 16 | * @param dictData 字典数据信息 17 | * @return 字典数据集合信息 18 | */ 19 | public List selectDictDataList(SysDictData dictData); 20 | 21 | /** 22 | * 根据字典类型和字典键值查询字典数据信息 23 | * 24 | * @param dictType 字典类型 25 | * @param dictValue 字典键值 26 | * @return 字典标签 27 | */ 28 | public String selectDictLabel(String dictType, String dictValue); 29 | 30 | /** 31 | * 根据字典数据ID查询信息 32 | * 33 | * @param dictCode 字典数据ID 34 | * @return 字典数据 35 | */ 36 | public SysDictData selectDictDataById(Long dictCode); 37 | 38 | /** 39 | * 批量删除字典数据信息 40 | * 41 | * @param dictCodes 需要删除的字典数据ID 42 | */ 43 | public void deleteDictDataByIds(Long[] dictCodes); 44 | 45 | /** 46 | * 新增保存字典数据信息 47 | * 48 | * @param dictData 字典数据信息 49 | * @return 结果 50 | */ 51 | public int insertDictData(SysDictData dictData); 52 | 53 | /** 54 | * 修改保存字典数据信息 55 | * 56 | * @param dictData 字典数据信息 57 | * @return 结果 58 | */ 59 | public int updateDictData(SysDictData dictData); 60 | } 61 | -------------------------------------------------------------------------------- /douyidou-system/src/main/java/cc/douyidou/system/service/ISysLogininforService.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.system.service; 2 | 3 | import java.util.List; 4 | import cc.douyidou.system.domain.SysLogininfor; 5 | 6 | /** 7 | * 系统访问日志情况信息 服务层 8 | * 9 | * @author ruoyi 10 | */ 11 | public interface ISysLogininforService 12 | { 13 | /** 14 | * 新增系统登录日志 15 | * 16 | * @param logininfor 访问日志对象 17 | */ 18 | public void insertLogininfor(SysLogininfor logininfor); 19 | 20 | /** 21 | * 查询系统登录日志集合 22 | * 23 | * @param logininfor 访问日志对象 24 | * @return 登录记录集合 25 | */ 26 | public List selectLogininforList(SysLogininfor logininfor); 27 | 28 | /** 29 | * 批量删除系统登录日志 30 | * 31 | * @param infoIds 需要删除的登录日志ID 32 | * @return 结果 33 | */ 34 | public int deleteLogininforByIds(Long[] infoIds); 35 | 36 | /** 37 | * 清空系统登录日志 38 | */ 39 | public void cleanLogininfor(); 40 | } 41 | -------------------------------------------------------------------------------- /douyidou-system/src/main/java/cc/douyidou/system/service/ISysNoticeService.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.system.service; 2 | 3 | import java.util.List; 4 | 5 | import cc.douyidou.system.domain.SysNotice; 6 | 7 | /** 8 | * 公告 服务层 9 | * 10 | * @author ruoyi 11 | */ 12 | public interface ISysNoticeService 13 | { 14 | /** 15 | * 查询公告信息 16 | * 17 | * @param noticeId 公告ID 18 | * @return 公告信息 19 | */ 20 | public SysNotice selectNoticeById(Long noticeId); 21 | 22 | /** 23 | * 查询公告列表 24 | * 25 | * @param notice 公告信息 26 | * @return 公告集合 27 | */ 28 | public List selectNoticeList(SysNotice notice); 29 | 30 | /** 31 | * 新增公告 32 | * 33 | * @param notice 公告信息 34 | * @return 结果 35 | */ 36 | public int insertNotice(SysNotice notice); 37 | 38 | /** 39 | * 修改公告 40 | * 41 | * @param notice 公告信息 42 | * @return 结果 43 | */ 44 | public int updateNotice(SysNotice notice); 45 | 46 | /** 47 | * 删除公告信息 48 | * 49 | * @param noticeId 公告ID 50 | * @return 结果 51 | */ 52 | public int deleteNoticeById(Long noticeId); 53 | 54 | /** 55 | * 批量删除公告信息 56 | * 57 | * @param noticeIds 需要删除的公告ID 58 | * @return 结果 59 | */ 60 | public int deleteNoticeByIds(Long[] noticeIds); 61 | } 62 | -------------------------------------------------------------------------------- /douyidou-system/src/main/java/cc/douyidou/system/service/ISysOperLogService.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.system.service; 2 | 3 | import java.util.List; 4 | import cc.douyidou.system.domain.SysOperLog; 5 | 6 | /** 7 | * 操作日志 服务层 8 | * 9 | * @author ruoyi 10 | */ 11 | public interface ISysOperLogService 12 | { 13 | /** 14 | * 新增操作日志 15 | * 16 | * @param operLog 操作日志对象 17 | */ 18 | public void insertOperlog(SysOperLog operLog); 19 | 20 | /** 21 | * 查询系统操作日志集合 22 | * 23 | * @param operLog 操作日志对象 24 | * @return 操作日志集合 25 | */ 26 | public List selectOperLogList(SysOperLog operLog); 27 | 28 | /** 29 | * 批量删除系统操作日志 30 | * 31 | * @param operIds 需要删除的操作日志ID 32 | * @return 结果 33 | */ 34 | public int deleteOperLogByIds(Long[] operIds); 35 | 36 | /** 37 | * 查询操作日志详细 38 | * 39 | * @param operId 操作ID 40 | * @return 操作日志对象 41 | */ 42 | public SysOperLog selectOperLogById(Long operId); 43 | 44 | /** 45 | * 清空操作日志 46 | */ 47 | public void cleanOperLog(); 48 | } 49 | -------------------------------------------------------------------------------- /douyidou-system/src/main/java/cc/douyidou/system/service/ISysUserOnlineService.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.system.service; 2 | 3 | import cc.douyidou.common.core.domain.model.LoginUser; 4 | import cc.douyidou.system.domain.SysUserOnline; 5 | 6 | /** 7 | * 在线用户 服务层 8 | * 9 | * @author ruoyi 10 | */ 11 | public interface ISysUserOnlineService 12 | { 13 | /** 14 | * 通过登录地址查询信息 15 | * 16 | * @param ipaddr 登录地址 17 | * @param user 用户信息 18 | * @return 在线用户信息 19 | */ 20 | public SysUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user); 21 | 22 | /** 23 | * 通过用户名称查询信息 24 | * 25 | * @param userName 用户名称 26 | * @param user 用户信息 27 | * @return 在线用户信息 28 | */ 29 | public SysUserOnline selectOnlineByUserName(String userName, LoginUser user); 30 | 31 | /** 32 | * 通过登录地址/用户名称查询信息 33 | * 34 | * @param ipaddr 登录地址 35 | * @param userName 用户名称 36 | * @param user 用户信息 37 | * @return 在线用户信息 38 | */ 39 | public SysUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user); 40 | 41 | /** 42 | * 设置在线用户信息 43 | * 44 | * @param user 用户信息 45 | * @return 在线用户 46 | */ 47 | public SysUserOnline loginUserToUserOnline(LoginUser user); 48 | } 49 | -------------------------------------------------------------------------------- /douyidou-system/src/main/java/cc/douyidou/system/service/impl/SysLogininforServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.system.service.impl; 2 | 3 | import java.util.List; 4 | 5 | import cc.douyidou.system.service.ISysLogininforService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | import cc.douyidou.system.domain.SysLogininfor; 9 | import cc.douyidou.system.mapper.SysLogininforMapper; 10 | 11 | /** 12 | * 系统访问日志情况信息 服务层处理 13 | * 14 | * @author ruoyi 15 | */ 16 | @Service 17 | public class SysLogininforServiceImpl implements ISysLogininforService 18 | { 19 | 20 | @Autowired 21 | private SysLogininforMapper logininforMapper; 22 | 23 | /** 24 | * 新增系统登录日志 25 | * 26 | * @param logininfor 访问日志对象 27 | */ 28 | @Override 29 | public void insertLogininfor(SysLogininfor logininfor) 30 | { 31 | logininforMapper.insertLogininfor(logininfor); 32 | } 33 | 34 | /** 35 | * 查询系统登录日志集合 36 | * 37 | * @param logininfor 访问日志对象 38 | * @return 登录记录集合 39 | */ 40 | @Override 41 | public List selectLogininforList(SysLogininfor logininfor) 42 | { 43 | return logininforMapper.selectLogininforList(logininfor); 44 | } 45 | 46 | /** 47 | * 批量删除系统登录日志 48 | * 49 | * @param infoIds 需要删除的登录日志ID 50 | * @return 结果 51 | */ 52 | @Override 53 | public int deleteLogininforByIds(Long[] infoIds) 54 | { 55 | return logininforMapper.deleteLogininforByIds(infoIds); 56 | } 57 | 58 | /** 59 | * 清空系统登录日志 60 | */ 61 | @Override 62 | public void cleanLogininfor() 63 | { 64 | logininforMapper.cleanLogininfor(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /douyidou-system/src/main/java/cc/douyidou/system/service/impl/SysOperLogServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cc.douyidou.system.service.impl; 2 | 3 | import java.util.List; 4 | 5 | import cc.douyidou.system.service.ISysOperLogService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | import cc.douyidou.system.domain.SysOperLog; 9 | import cc.douyidou.system.mapper.SysOperLogMapper; 10 | 11 | /** 12 | * 操作日志 服务层处理 13 | * 14 | * @author ruoyi 15 | */ 16 | @Service 17 | public class SysOperLogServiceImpl implements ISysOperLogService 18 | { 19 | @Autowired 20 | private SysOperLogMapper operLogMapper; 21 | 22 | /** 23 | * 新增操作日志 24 | * 25 | * @param operLog 操作日志对象 26 | */ 27 | @Override 28 | public void insertOperlog(SysOperLog operLog) 29 | { 30 | operLogMapper.insertOperlog(operLog); 31 | } 32 | 33 | /** 34 | * 查询系统操作日志集合 35 | * 36 | * @param operLog 操作日志对象 37 | * @return 操作日志集合 38 | */ 39 | @Override 40 | public List selectOperLogList(SysOperLog operLog) 41 | { 42 | return operLogMapper.selectOperLogList(operLog); 43 | } 44 | 45 | /** 46 | * 批量删除系统操作日志 47 | * 48 | * @param operIds 需要删除的操作日志ID 49 | * @return 结果 50 | */ 51 | @Override 52 | public int deleteOperLogByIds(Long[] operIds) 53 | { 54 | return operLogMapper.deleteOperLogByIds(operIds); 55 | } 56 | 57 | /** 58 | * 查询操作日志详细 59 | * 60 | * @param operId 操作ID 61 | * @return 操作日志对象 62 | */ 63 | @Override 64 | public SysOperLog selectOperLogById(Long operId) 65 | { 66 | return operLogMapper.selectOperLogById(operId); 67 | } 68 | 69 | /** 70 | * 清空操作日志 71 | */ 72 | @Override 73 | public void cleanOperLog() 74 | { 75 | operLogMapper.cleanOperLog(); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /douyidou-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | delete from sys_role_dept where role_id=#{roleId} 14 | 15 | 16 | 19 | 20 | 21 | delete from sys_role_dept where role_id in 22 | 23 | #{roleId} 24 | 25 | 26 | 27 | 28 | insert into sys_role_dept(role_id, dept_id) values 29 | 30 | (#{item.roleId},#{item.deptId}) 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /douyidou-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | 17 | delete from sys_role_menu where role_id=#{roleId} 18 | 19 | 20 | 21 | delete from sys_role_menu where role_id in 22 | 23 | #{roleId} 24 | 25 | 26 | 27 | 28 | insert into sys_role_menu(role_id, menu_id) values 29 | 30 | (#{item.roleId},#{item.menuId}) 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /douyidou-system/src/main/resources/mapper/system/SysUserPostMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | delete from sys_user_post where user_id=#{userId} 14 | 15 | 16 | 19 | 20 | 21 | delete from sys_user_post where user_id in 22 | 23 | #{userId} 24 | 25 | 26 | 27 | 28 | insert into sys_user_post(user_id, post_id) values 29 | 30 | (#{item.userId},#{item.postId}) 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /douyidou-system/src/main/resources/mapper/system/SysUserRoleMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | delete from sys_user_role where user_id=#{userId} 14 | 15 | 16 | 19 | 20 | 21 | delete from sys_user_role where user_id in 22 | 23 | #{userId} 24 | 25 | 26 | 27 | 28 | insert into sys_user_role(user_id, role_id) values 29 | 30 | (#{item.userId},#{item.roleId}) 31 | 32 | 33 | 34 | 35 | delete from sys_user_role where user_id=#{userId} and role_id=#{roleId} 36 | 37 | 38 | 39 | delete from sys_user_role where role_id=#{roleId} and user_id in 40 | 41 | #{userId} 42 | 43 | 44 | --------------------------------------------------------------------------------