├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── doc ├── data │ ├── READEM.md │ ├── bin │ │ ├── .env │ │ ├── check.sh │ │ ├── devops.sh │ │ ├── initsql.sh │ │ ├── loadimages.sh │ │ └── nginx.sh │ ├── config │ │ ├── application-prod.yml │ │ └── smart-job.sql │ ├── docker-compose │ │ ├── docker-compose │ │ └── docker-java.yml │ ├── docker │ │ ├── docker-19.03.9.tgz │ │ └── docker.service │ └── nginx │ │ └── conf.d │ │ └── job.xxx.com.conf ├── image │ ├── bitbug_favicon.ico │ ├── pay100.jpeg │ ├── pay20.jpeg │ ├── pay50.jpeg │ ├── smart-job-logo.png │ ├── smart-job部署架构图.png │ ├── 任务列表-注册节点.png │ ├── 任务执行器.png │ ├── 任务日志.png │ ├── 任务管理.png │ ├── 任务编辑.png │ ├── 告警记录.png │ ├── 告警配置.png │ ├── 用户管理.png │ ├── 登录页面.png │ ├── 角色管理.png │ ├── 调度管理.png │ └── 首页.png └── sql │ └── xxl-job.sql ├── docker-entrypoint.sh ├── pom.xml ├── smart-job-common ├── .DS_Store ├── pom.xml └── src │ └── main │ └── java │ └── cn │ └── smartcoding │ └── common │ ├── annotation │ ├── DataScope.java │ ├── DataSource.java │ ├── Excel.java │ ├── Excels.java │ ├── Log.java │ └── RepeatSubmit.java │ ├── config │ └── SmartJobConfig.java │ ├── constant │ ├── Constants.java │ ├── GenConstants.java │ ├── HttpStatus.java │ ├── ScheduleConstants.java │ └── UserConstants.java │ ├── core │ ├── captcha │ │ ├── CaptchaCode.java │ │ ├── CaptchaCodeEnum.java │ │ └── CaptchaFactory.java │ ├── controller │ │ └── BaseController.java │ ├── domain │ │ ├── AccountCreateEnum.java │ │ ├── AccountStatusEnum.java │ │ ├── BaseEntity.java │ │ ├── CommonErrorCode.java │ │ ├── IErrorCode.java │ │ ├── ResultModel.java │ │ ├── TreeEntity.java │ │ ├── TreeSelect.java │ │ ├── entity │ │ │ ├── SysDept.java │ │ │ ├── SysDictData.java │ │ │ ├── SysDictType.java │ │ │ ├── SysMenu.java │ │ │ ├── SysRole.java │ │ │ └── SysUser.java │ │ ├── model │ │ │ ├── LoginBody.java │ │ │ └── LoginUser.java │ │ └── util │ │ │ └── ResultModelUtils.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 │ ├── HttpMethod.java │ ├── OperatorType.java │ └── UserStatus.java │ ├── exception │ ├── BaseException.java │ ├── CommonException.java │ ├── CustomException.java │ ├── DemoModeException.java │ ├── UtilException.java │ ├── file │ │ ├── FileException.java │ │ ├── FileNameLengthLimitExceededException.java │ │ ├── FileSizeLimitExceededException.java │ │ └── InvalidExtensionException.java │ ├── job │ │ └── TaskException.java │ └── user │ │ ├── UserException.java │ │ └── UserPasswordNotMatchException.java │ ├── filter │ ├── RepeatableFilter.java │ ├── RepeatedlyRequestWrapper.java │ ├── XssFilter.java │ └── XssHttpServletRequestWrapper.java │ ├── robot │ ├── enums │ │ ├── NotifyMsgTypeEnum.java │ │ └── NotifyRobotEnum.java │ ├── exception │ │ ├── WebHookRobotIllegalArgumentException.java │ │ ├── WebHookRobotResponseException.java │ │ └── WebHookRobotValidateException.java │ ├── model │ │ ├── message │ │ │ ├── Message.java │ │ │ ├── dingding │ │ │ │ ├── DingActionCardMessage.java │ │ │ │ ├── DingFeedCardMessage.java │ │ │ │ ├── DingLinkMessage.java │ │ │ │ ├── DingMarkdownMessage.java │ │ │ │ ├── DingSingleActionCardMessage.java │ │ │ │ ├── DingTextMessage.java │ │ │ │ └── enums │ │ │ │ │ ├── BtnOrientationTypeEnum.java │ │ │ │ │ └── HideAvatarTypeEnums.java │ │ │ └── wx │ │ │ │ ├── WxImageMessage.java │ │ │ │ ├── WxMarkdownMessage.java │ │ │ │ ├── WxTextMessage.java │ │ │ │ └── news │ │ │ │ ├── WxNewsArticle.java │ │ │ │ └── WxNewsMessage.java │ │ ├── request │ │ │ ├── ActionCardRequest.java │ │ │ ├── BaseNotifyRequest.java │ │ │ ├── CardRequest.java │ │ │ ├── ImageRequest.java │ │ │ ├── LinkRequest.java │ │ │ ├── MarkdownRequest.java │ │ │ ├── NewsRequest.java │ │ │ ├── RobotNotifyRequest.java │ │ │ ├── SingleActionCardRequest.java │ │ │ └── TextRequest.java │ │ └── response │ │ │ ├── RobotNotifyRequestBuilder.java │ │ │ └── RobotNotifyResponse.java │ ├── notify │ │ ├── AbstractRobotNotify.java │ │ ├── BaseRobotNotify.java │ │ ├── RobotNotify.java │ │ ├── corpwechat │ │ │ ├── WechatMessageCovert.java │ │ │ └── WechatRobotNotify.java │ │ └── dingding │ │ │ ├── DingDingMessageCovert.java │ │ │ └── DingDingRobotNotify.java │ └── util │ │ ├── ErrorStringUtils.java │ │ ├── HttpUtils.java │ │ ├── MarkdownMessageUtils.java │ │ └── ThreadSupport.java │ └── utils │ ├── AESUtil.java │ ├── Arith.java │ ├── DateUtils.java │ ├── DictUtils.java │ ├── ExceptionUtil.java │ ├── LogUtils.java │ ├── MessageUtils.java │ ├── SecurityUtils.java │ ├── ServletUtils.java │ ├── StringUtils.java │ ├── Threads.java │ ├── VerifyCodeUtils.java │ ├── bean │ └── BeanUtils.java │ ├── file │ ├── FileUploadUtils.java │ ├── FileUtils.java │ └── MimeTypeUtils.java │ ├── html │ ├── EscapeUtil.java │ └── HTMLFilter.java │ ├── http │ ├── HttpHelper.java │ └── HttpUtils.java │ ├── ip │ ├── AddressUtils.java │ └── IpUtils.java │ ├── poi │ └── ExcelUtil.java │ ├── reflect │ └── ReflectUtils.java │ ├── sign │ ├── Base64.java │ └── Md5Utils.java │ ├── spring │ └── SpringUtils.java │ ├── sql │ └── SqlUtil.java │ └── uuid │ ├── IdUtils.java │ └── UUID.java ├── smart-job-core ├── .DS_Store ├── pom.xml └── src │ └── main │ └── java │ └── cn │ └── smartcoding │ └── job │ └── core │ ├── biz │ ├── AdminBiz.java │ ├── ExecutorBiz.java │ ├── JobBiz.java │ ├── JobConst.java │ ├── impl │ │ └── ExecutorBizImpl.java │ └── model │ │ ├── HandleCallbackParam.java │ │ ├── JobGroupParam.java │ │ ├── JobInfoParam.java │ │ ├── LogResult.java │ │ ├── RegistryParam.java │ │ ├── ReturnT.java │ │ └── TriggerParam.java │ ├── cron │ ├── CronExpression.java │ └── ValueSet.java │ ├── enums │ ├── ExecutorBlockStrategyEnum.java │ ├── ExecutorRouteStrategyEnum.java │ └── RegistryConfig.java │ ├── executor │ ├── XxlJobExecutor.java │ └── impl │ │ └── XxlJobSpringExecutor.java │ ├── glue │ ├── GlueFactory.java │ ├── GlueTypeEnum.java │ └── impl │ │ └── SpringGlueFactory.java │ ├── handler │ ├── IJobHandler.java │ ├── annotation │ │ ├── Job.java │ │ ├── JobHandler.java │ │ └── JobMethodHandler.java │ └── impl │ │ ├── GlueJobHandler.java │ │ ├── MethodJobHandler.java │ │ └── ScriptJobHandler.java │ ├── log │ ├── LogLevel.java │ ├── XxlJobFileAppender.java │ └── XxlJobLogger.java │ ├── thread │ ├── ExecutorRegistryThread.java │ ├── JobLogFileCleanThread.java │ ├── JobRegistryThread.java │ ├── JobThread.java │ └── TriggerCallbackThread.java │ └── util │ ├── DateUtil.java │ ├── FileUtil.java │ ├── ScriptUtil.java │ ├── ShardingUtil.java │ ├── UUIDUtils.java │ └── XxlJobRemotingUtil.java ├── smart-job-framework ├── .DS_Store ├── pom.xml └── src │ └── main │ └── java │ └── cn │ └── smartcoding │ └── framework │ ├── aspectj │ ├── DataScopeAspect.java │ └── DataSourceAspect.java │ ├── config │ ├── ApplicationConfig.java │ ├── CaptchaConfig.java │ ├── DruidConfig.java │ ├── FastJson2JsonRedisSerializer.java │ ├── FilterConfig.java │ ├── RedisConfig.java │ ├── ResourcesConfig.java │ ├── ServerConfig.java │ ├── ThreadPoolConfig.java │ └── properties │ │ ├── CaptchaProperties.java │ │ └── DruidProperties.java │ ├── datasource │ ├── DynamicDataSource.java │ └── DynamicDataSourceContextHolder.java │ ├── interceptor │ ├── RepeatSubmitInterceptor.java │ └── impl │ │ └── SameUrlDataInterceptor.java │ ├── manager │ ├── AsyncManager.java │ └── ShutdownManager.java │ └── web │ ├── domain │ ├── Server.java │ └── server │ │ ├── Cpu.java │ │ ├── Jvm.java │ │ ├── Mem.java │ │ ├── Sys.java │ │ └── SysFile.java │ ├── exception │ └── GlobalExceptionHandler.java │ └── service │ ├── PermissionService.java │ └── TokenService.java ├── smart-job-generator ├── .DS_Store ├── pom.xml └── src │ └── main │ ├── java │ └── cn │ │ └── smartcoding │ │ └── 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 │ │ └── test.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 │ ├── js │ └── api.js.vm │ ├── sql │ └── sql.vm │ ├── vue │ ├── index-tree.vue.vm │ └── index.vue.vm │ └── xml │ └── mapper.xml.vm ├── smart-job-schedule ├── .DS_Store ├── pom.xml └── src │ ├── .DS_Store │ ├── main │ ├── java │ │ └── cn │ │ │ └── smartcoding │ │ │ └── schedule │ │ │ ├── config │ │ │ └── XxlJobConfig.java │ │ │ ├── core │ │ │ ├── alarm │ │ │ │ ├── AbstractJobAlarm.java │ │ │ │ ├── AlarmManager.java │ │ │ │ ├── AlarmParam.java │ │ │ │ ├── AlarmProviderManager.java │ │ │ │ ├── AlarmResult.java │ │ │ │ ├── DefaultAlarmResult.java │ │ │ │ ├── DefaultFailAlarmResult.java │ │ │ │ ├── JobAlarm.java │ │ │ │ ├── JobAlarmEnum.java │ │ │ │ └── impl │ │ │ │ │ ├── DingdingJobAlarm.java │ │ │ │ │ ├── EmailJobAlarm.java │ │ │ │ │ ├── MobileJobAlarm.java │ │ │ │ │ ├── SmsJobAlarm.java │ │ │ │ │ └── WxWechatJobAlarm.java │ │ │ ├── conf │ │ │ │ ├── XxlJobAdminConfig.java │ │ │ │ └── XxlJobScheduler.java │ │ │ ├── cron │ │ │ │ └── CronExpression.java │ │ │ ├── enums │ │ │ │ ├── AddressOnlineEnum.java │ │ │ │ ├── AddressTypeEnum.java │ │ │ │ ├── ExecutorWayTypeEnum.java │ │ │ │ ├── JobAlarmStatusEnum.java │ │ │ │ ├── JobCreateWayEnum.java │ │ │ │ ├── JobGroupAlarmStatusEnum.java │ │ │ │ ├── JobGroupClusterEnum.java │ │ │ │ ├── JobStatusEnum.java │ │ │ │ ├── LoginWayEnum.java │ │ │ │ ├── ScheduleStatusEnum.java │ │ │ │ └── ThreadTypeEnum.java │ │ │ ├── exception │ │ │ │ ├── AlarmFailException.java │ │ │ │ └── XxlJobException.java │ │ │ ├── model │ │ │ │ ├── XxlAlarmInfo.java │ │ │ │ ├── XxlJobAlarmLog.java │ │ │ │ ├── XxlJobGroup.java │ │ │ │ ├── XxlJobInfo.java │ │ │ │ ├── XxlJobLock.java │ │ │ │ ├── XxlJobLog.java │ │ │ │ ├── XxlJobLogGlue.java │ │ │ │ ├── XxlJobLogReport.java │ │ │ │ ├── XxlJobRegistry.java │ │ │ │ ├── XxlJobScheduleConfig.java │ │ │ │ ├── XxlJobThread.java │ │ │ │ ├── bo │ │ │ │ │ ├── JobDashbordBO.java │ │ │ │ │ ├── XxlJobAddressBO.java │ │ │ │ │ ├── XxlJobGroupBO.java │ │ │ │ │ ├── XxlJobInfoBO.java │ │ │ │ │ ├── XxlJobLogReportBO.java │ │ │ │ │ ├── XxlJobStatisticBO.java │ │ │ │ │ ├── XxlJobUserBO.java │ │ │ │ │ ├── XxlShortAlarmInfoBO.java │ │ │ │ │ └── XxlShortJobInfoBO.java │ │ │ │ └── vo │ │ │ │ │ ├── JobAddressGroupVO.java │ │ │ │ │ ├── JobAddressVO.java │ │ │ │ │ ├── JobGroupVO.java │ │ │ │ │ ├── NoticeUser.java │ │ │ │ │ ├── TestAlarmParamVO.java │ │ │ │ │ ├── Variable.java │ │ │ │ │ └── XxlJobGroupVO.java │ │ │ ├── route │ │ │ │ ├── ExecutorRouteStrategyEnum.java │ │ │ │ ├── ExecutorRouter.java │ │ │ │ └── strategy │ │ │ │ │ ├── ExecutorRouteBusyover.java │ │ │ │ │ ├── ExecutorRouteConsistentHash.java │ │ │ │ │ ├── ExecutorRouteFailover.java │ │ │ │ │ ├── ExecutorRouteFirst.java │ │ │ │ │ ├── ExecutorRouteLFU.java │ │ │ │ │ ├── ExecutorRouteLRU.java │ │ │ │ │ ├── ExecutorRouteLast.java │ │ │ │ │ ├── ExecutorRouteRandom.java │ │ │ │ │ ├── ExecutorRouteRound.java │ │ │ │ │ └── IdleBeat.java │ │ │ ├── thread │ │ │ │ ├── JobFailMonitorHelper.java │ │ │ │ ├── JobRegistryMonitorHelper.java │ │ │ │ ├── JobScheduleHelper.java │ │ │ │ └── JobTriggerPoolHelper.java │ │ │ ├── trigger │ │ │ │ ├── TriggerConstant.java │ │ │ │ ├── TriggerMsg.java │ │ │ │ ├── TriggerReslut.java │ │ │ │ ├── TriggerStatusEnum.java │ │ │ │ ├── TriggerTypeEnum.java │ │ │ │ └── XxlJobTrigger.java │ │ │ └── util │ │ │ │ ├── CookieUtil.java │ │ │ │ ├── I18nUtil.java │ │ │ │ ├── IpUtils.java │ │ │ │ ├── JacksonUtil.java │ │ │ │ ├── LocalCacheUtil.java │ │ │ │ ├── StringBuilderUtil.java │ │ │ │ ├── UserPermissionUtil.java │ │ │ │ └── VO2DOUtils.java │ │ │ ├── dto │ │ │ ├── ClearLogDto.java │ │ │ └── TriggerJobDto.java │ │ │ ├── job │ │ │ ├── DeleteJobLogJobHandler.java │ │ │ ├── DemoJobHandler.java │ │ │ └── JobLogReportJobHandler.java │ │ │ ├── mapper │ │ │ ├── XxlJobAlarmInfoMapper.java │ │ │ ├── XxlJobAlarmLogMapper.java │ │ │ ├── XxlJobGroupMapper.java │ │ │ ├── XxlJobInfoMapper.java │ │ │ ├── XxlJobLockMapper.java │ │ │ ├── XxlJobLogGlueMapper.java │ │ │ ├── XxlJobLogMapper.java │ │ │ ├── XxlJobLogReportDao.java │ │ │ ├── XxlJobRegistryMapper.java │ │ │ ├── XxlJobScheduleConfigMapper.java │ │ │ └── XxlJobThreadMapper.java │ │ │ └── service │ │ │ ├── ApplicationContextUtil.java │ │ │ ├── IXxlJobAlarmInfoService.java │ │ │ ├── IXxlJobAlarmLogService.java │ │ │ ├── IXxlJobScheduleConfigService.java │ │ │ ├── IXxlJobTreadService.java │ │ │ ├── XxlJobGroupService.java │ │ │ ├── XxlJobInitService.java │ │ │ ├── XxlJobLogService.java │ │ │ ├── XxlJobService.java │ │ │ └── impl │ │ │ ├── AdminBizImpl.java │ │ │ ├── JobBizImpl.java │ │ │ ├── XxlJobAlarmInfoServiceImpl.java │ │ │ ├── XxlJobAlarmLogServiceImpl.java │ │ │ ├── XxlJobGroupServiceImpl.java │ │ │ ├── XxlJobInitServiceImpl.java │ │ │ ├── XxlJobLogServiceImpl.java │ │ │ ├── XxlJobScheduleConfigServiceImpl.java │ │ │ ├── XxlJobServiceImpl.java │ │ │ └── XxlJobTreadServiceImpl.java │ └── resources │ │ └── mapper │ │ ├── XxlJobAlarmInfoMapper.xml │ │ ├── XxlJobAlarmLogMapper.xml │ │ ├── XxlJobGroupMapper.xml │ │ ├── XxlJobInfoMapper.xml │ │ ├── XxlJobLockMapper.xml │ │ ├── XxlJobLogGlueMapper.xml │ │ ├── XxlJobLogMapper.xml │ │ ├── XxlJobLogReportMapper.xml │ │ ├── XxlJobRegistryMapper.xml │ │ ├── XxlJobScheduleConfigMapper.xml │ │ └── XxlJobThreadMapper.xml │ └── test │ └── java │ └── cn │ └── smartcoding │ └── schedule │ ├── controller │ └── AbstractSpringMvcTest.java │ ├── test │ ├── XxlJobGroupDaoTest.java │ ├── XxlJobInfoDaoTest.java │ ├── XxlJobLogDaoTest.java │ ├── XxlJobLogGlueDaoTest.java │ └── XxlJobRegistryDaoTest.java │ └── util │ ├── CronTest.java │ └── I18nUtilTest.java ├── smart-job-starter ├── pom.xml └── src │ └── main │ ├── java │ └── cn │ │ └── smartcoding │ │ └── xxl │ │ └── job │ │ └── starter │ │ ├── XxlJobAutoConfiguration.java │ │ └── XxxJobProperties.java │ └── resources │ └── META-INF │ └── spring.factories ├── smart-job-system ├── .DS_Store ├── pom.xml └── src │ └── main │ ├── java │ └── cn │ │ └── smartcoding │ │ └── system │ │ ├── aspectj │ │ └── LogAspect.java │ │ ├── config │ │ └── SecurityConfig.java │ │ ├── domain │ │ ├── SysConfig.java │ │ ├── SysLdapConfig.java │ │ ├── SysLogininfor.java │ │ ├── SysNotice.java │ │ ├── SysOperLog.java │ │ ├── SysPost.java │ │ ├── SysRoleDept.java │ │ ├── SysRoleMenu.java │ │ ├── SysUserOnline.java │ │ ├── SysUserPost.java │ │ ├── SysUserRole.java │ │ └── vo │ │ │ ├── MetaVo.java │ │ │ ├── RouterVo.java │ │ │ └── SysUserVO.java │ │ ├── dto │ │ ├── LdapUserDto.java │ │ ├── SysDeptDto.java │ │ └── SysUserDto.java │ │ ├── exception │ │ ├── LdapAuthenticationException.java │ │ └── LdapLockAuthenticationException.java │ │ ├── manager │ │ └── factory │ │ │ └── AsyncFactory.java │ │ ├── mapper │ │ ├── SysConfigMapper.java │ │ ├── SysDeptMapper.java │ │ ├── SysDictDataMapper.java │ │ ├── SysDictTypeMapper.java │ │ ├── SysLdapConfigMapper.java │ │ ├── SysLogininforMapper.java │ │ ├── SysMenuMapper.java │ │ ├── SysNoticeMapper.java │ │ ├── SysOperLogMapper.java │ │ ├── SysPostMapper.java │ │ ├── SysRoleDeptMapper.java │ │ ├── SysRoleMapper.java │ │ ├── SysRoleMenuMapper.java │ │ ├── SysUserMapper.java │ │ ├── SysUserPostMapper.java │ │ └── SysUserRoleMapper.java │ │ ├── security │ │ ├── CaptchaException.java │ │ ├── CaptchaExpireException.java │ │ ├── LoginTypeEnum.java │ │ ├── SecurityConstants.java │ │ ├── authentication │ │ │ ├── AbstractPreAuthenticationChecks.java │ │ │ ├── LdapAuthenticationProvider.java │ │ │ ├── LdapAuthenticationToken.java │ │ │ ├── MyAuthenticationFailureHandler.java │ │ │ ├── MyAuthenticationFilter.java │ │ │ ├── MyAuthenticationSuccessHandler.java │ │ │ ├── UsernamePasswordAuthenticationProvider.java │ │ │ └── UsernamePasswordAuthenticationToken.java │ │ ├── filter │ │ │ └── JwtAuthenticationTokenFilter.java │ │ └── handle │ │ │ ├── AuthenticationEntryPointImpl.java │ │ │ └── LogoutSuccessHandlerImpl.java │ │ ├── service │ │ ├── ISysConfigService.java │ │ ├── ISysDeptService.java │ │ ├── ISysDictDataService.java │ │ ├── ISysDictTypeService.java │ │ ├── ISysLdapConfigService.java │ │ ├── ISysLogininforService.java │ │ ├── ISysMenuService.java │ │ ├── ISysNoticeService.java │ │ ├── ISysOperLogService.java │ │ ├── ISysPostService.java │ │ ├── ISysRoleService.java │ │ ├── ISysUserOnlineService.java │ │ ├── ISysUserService.java │ │ ├── LdapUserDetailsService.java │ │ ├── SysLoginService.java │ │ ├── SysPermissionService.java │ │ ├── UserDetailsServiceImpl.java │ │ └── impl │ │ │ ├── SysConfigServiceImpl.java │ │ │ ├── SysDeptServiceImpl.java │ │ │ ├── SysDictDataServiceImpl.java │ │ │ ├── SysDictTypeServiceImpl.java │ │ │ ├── SysLdapConfigServiceImpl.java │ │ │ ├── SysLogininforServiceImpl.java │ │ │ ├── SysMenuServiceImpl.java │ │ │ ├── SysNoticeServiceImpl.java │ │ │ ├── SysOperLogServiceImpl.java │ │ │ ├── SysPostServiceImpl.java │ │ │ ├── SysRoleServiceImpl.java │ │ │ ├── SysUserOnlineServiceImpl.java │ │ │ └── SysUserServiceImpl.java │ │ └── vo │ │ └── LdapTestVO.java │ └── resources │ └── mapper │ └── system │ ├── SysConfigMapper.xml │ ├── SysDeptMapper.xml │ ├── SysDictDataMapper.xml │ ├── SysDictTypeMapper.xml │ ├── SysLdapConfigMapper.xml │ ├── SysLogininforMapper.xml │ ├── SysMenuMapper.xml │ ├── SysNoticeMapper.xml │ ├── SysOperLogMapper.xml │ ├── SysPostMapper.xml │ ├── SysRoleDeptMapper.xml │ ├── SysRoleMapper.xml │ ├── SysRoleMenuMapper.xml │ ├── SysUserMapper.xml │ ├── SysUserPostMapper.xml │ └── SysUserRoleMapper.xml └── smart-job-web ├── .DS_Store ├── pom.xml └── src └── main ├── java └── cn │ └── smartcoding │ ├── JobApplication.java │ └── web │ ├── common │ ├── CaptchaController.java │ └── CommonController.java │ ├── controller │ ├── StartCheckController.java │ ├── job │ │ ├── IndexController.java │ │ ├── JobAlarmInfoController.java │ │ ├── JobAlarmLogController.java │ │ ├── JobApiController.java │ │ ├── JobCodeController.java │ │ ├── JobGroupController.java │ │ ├── JobInfoController.java │ │ ├── JobLogController.java │ │ ├── JobScheduleConfigController.java │ │ └── JobThreadController.java │ ├── monitor │ │ ├── ServerController.java │ │ ├── SysLogininforController.java │ │ ├── SysOperlogController.java │ │ └── SysUserOnlineController.java │ ├── system │ │ ├── SysConfigController.java │ │ ├── SysDeptController.java │ │ ├── SysDictDataController.java │ │ ├── SysDictTypeController.java │ │ ├── SysLoginController.java │ │ ├── SysMenuController.java │ │ ├── SysNoticeController.java │ │ ├── SysPostController.java │ │ ├── SysProfileController.java │ │ ├── SysRoleController.java │ │ ├── SysSettingController.java │ │ └── SysUserController.java │ └── tool │ │ ├── SwaggerController.java │ │ └── TestController.java │ └── core │ └── config │ └── SwaggerConfig.java └── resources ├── META-INF └── spring-devtools.properties ├── application-dev.yml ├── application-prod.yml ├── application-test.yml ├── application.yml ├── banner.txt ├── i18n ├── message.properties ├── message_en.properties └── messages.properties └── logback-spring.xml /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | 25 | ###################################################################### 26 | # Build Tools 27 | 28 | .gradle 29 | /build/ 30 | !gradle/wrapper/gradle-wrapper.jar 31 | 32 | target/ 33 | !.mvn/wrapper/maven-wrapper.jar 34 | 35 | ###################################################################### 36 | # IDE 37 | 38 | ### STS ### 39 | .apt_generated 40 | .classpath 41 | .factorypath 42 | .project 43 | .settings 44 | .springBeans 45 | 46 | ### IntelliJ IDEA ### 47 | .idea 48 | *.iws 49 | *.iml 50 | *.ipr 51 | 52 | ### NetBeans ### 53 | nbproject/private/ 54 | build/* 55 | nbbuild/ 56 | logs/ 57 | dist/ 58 | nbdist/ 59 | .nb-gradle/ 60 | 61 | ###################################################################### 62 | # Others 63 | *.xml.versionsBackup 64 | *.swp 65 | 66 | !*/build/*.java 67 | !*/build/*.html 68 | !*/build/*.xml 69 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mskj/java8-base 2 | 3 | ENV AppName="smart-job" JARGcLogPath="/data/logs/${AppName}" Target="smart-job-web/target" JarName="smart-job-1.0.0.jar" 4 | 5 | #captcher 字体包 6 | RUN set -xe \ 7 | && apk add ttf-dejavu fontconfig 8 | 9 | WORKDIR /data 10 | 11 | COPY docker-entrypoint.sh . 12 | 13 | COPY ${Target}/${JarName} . 14 | 15 | CMD ["sh","+x","docker-entrypoint.sh"] 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 smart-coding-team 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. 22 | -------------------------------------------------------------------------------- /doc/data/bin/.env: -------------------------------------------------------------------------------- 1 | ########## 系统配置项 ############ 2 | network_mode=host 3 | restart_mode=always 4 | host_data_dir=../ 5 | ########## mysql配置项 ############ 6 | mysql_ip=127.0.0.1 7 | mysql_user=root 8 | mysql_password=xwyXNlwVflXHl2pyR1SY 9 | mysql_port=3306 10 | 11 | ########## redis配置项 ############ 12 | redis_ip=127.0.0.1 13 | redis_port=6379 14 | redis02_port=6380 15 | redis_password=E0haI233FNsFgekW 16 | #redis 集群模式开关,no:单机模式 yes:集群模式 17 | redis_cluster_status=no 18 | 19 | 20 | -------------------------------------------------------------------------------- /doc/data/bin/initsql.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## sql文件拷贝到容器中 4 | SHHOME=$(pwd) 5 | BASE_DIR=$(cd `dirname $0`/..; pwd) 6 | docker cp ${BASE_DIR}/config/smart-job.sql mysql:/tmp/ 7 | 8 | 9 | ## 登录mysql 10 | docker exec -it mysql bash -c 'mysql -uroot -pxwyXNlwVflXHl2pyR1SY' 11 | 12 | ## 执行执行初始化sql 13 | source /tmp/smart-job.sql 14 | 15 | 16 | -------------------------------------------------------------------------------- /doc/data/bin/nginx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #=============================================================================== 4 | # SYSTEM REQUIRED: Linux Centos7 5 | # DESCRIPTION: docker 容器部署 6 | # AUTHOR: wuque 7 | #=============================================================================== 8 | 9 | stty erase '^H' 10 | 11 | function echoPlus(){ 12 | # 增强显示 13 | # @param color (31|91 红 32|92绿 33|93黄 34|94蓝 35|95紫 36|96天蓝) 14 | # @param content 15 | local colorCode=$1 16 | local content=$2 17 | 18 | echo -e "\e[${colorCode}m${content}\e[0m" 19 | } 20 | 21 | function log_error() { 22 | echo -e "\033[31m [ERROR] $@ \033[0m" 23 | } 24 | 25 | function log_info() { 26 | echo -e "\033[32m [INFO] $@ \033[0m" 27 | } 28 | 29 | 30 | function check() { 31 | docker exec -it nginx /bin/bash -c 'cd sbin/ && ./nginx -t' 32 | } 33 | 34 | function load() { 35 | 36 | docker exec -it nginx /bin/bash -c 'cd sbin/ && ./nginx -s reload' 37 | } 38 | case "$1" in 39 | 40 | -t) 41 | (check ) 42 | ;; 43 | -s) 44 | (load ) 45 | ;; 46 | 47 | esac 48 | if [ $# -eq 0 ]; then 49 | cat << EOF 50 | +-------------------------------------------------+ 51 | nginx 52 | nginx 语法检查: -t 53 | nginx 配置重新加载: -s 54 | 55 | +-------------------------------------------------+ 56 | EOF 57 | echo -n "请输入:" 58 | 59 | 60 | fi 61 | 62 | 63 | -------------------------------------------------------------------------------- /doc/data/docker-compose/docker-compose: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/data/docker-compose/docker-compose -------------------------------------------------------------------------------- /doc/data/docker/docker-19.03.9.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/data/docker/docker-19.03.9.tgz -------------------------------------------------------------------------------- /doc/data/docker/docker.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Docker Application Container Engine 3 | Documentation=https://docs.docker.com 4 | After=network-online.target 5 | Wants=network-online.target 6 | 7 | [Service] 8 | Type=notify 9 | ExecStart=/usr/bin/dockerd 10 | ExecReload=/bin/kill -s HUP $MAINPID 11 | LimitNOFILE=infinity 12 | LimitNPROC=infinity 13 | TimeoutStartSec=0 14 | Delegate=yes 15 | KillMode=process 16 | Restart=on-failure 17 | StartLimitBurst=3 18 | StartLimitInterval=60s 19 | 20 | [Install] 21 | WantedBy=multi-user.target 22 | -------------------------------------------------------------------------------- /doc/data/nginx/conf.d/job.xxx.com.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name smart-job.com; 4 | # ssl_certificate /usr/local/nginx/conf.d/ssl_keys/xxx.cc.pem; 5 | # ssl_certificate_key /usr/local/nginx/conf.d/ssl_keys/xxx.cc.key; 6 | # ssl_session_timeout 5m; 7 | # ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; 8 | # ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 9 | # ssl_prefer_server_ciphers on; 10 | proxy_buffering off; 11 | ignore_invalid_headers off; 12 | access_log "pipe:rollback /usr/local/nginx/logs/access_apm.log interval=24h baknum=2 maxsize=2G" access; 13 | 14 | location / { 15 | root /usr/local/html/job-html; 16 | index index.html; 17 | try_files $uri /index.html; 18 | expires 0; 19 | add_header Cache-Control no-cache; 20 | add_header Cache-Control private; 21 | } 22 | 23 | location /api { 24 | proxy_pass http://127.0.0.1:7040; 25 | proxy_set_header Host $host; 26 | proxy_set_header X-Real-IP $remote_addr; 27 | proxy_set_header X-Forwarded-Proto $scheme; 28 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 29 | proxy_http_version 1.1; 30 | proxy_set_header Connection ""; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /doc/image/bitbug_favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/bitbug_favicon.ico -------------------------------------------------------------------------------- /doc/image/pay100.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/pay100.jpeg -------------------------------------------------------------------------------- /doc/image/pay20.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/pay20.jpeg -------------------------------------------------------------------------------- /doc/image/pay50.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/pay50.jpeg -------------------------------------------------------------------------------- /doc/image/smart-job-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/smart-job-logo.png -------------------------------------------------------------------------------- /doc/image/smart-job部署架构图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/smart-job部署架构图.png -------------------------------------------------------------------------------- /doc/image/任务列表-注册节点.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/任务列表-注册节点.png -------------------------------------------------------------------------------- /doc/image/任务执行器.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/任务执行器.png -------------------------------------------------------------------------------- /doc/image/任务日志.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/任务日志.png -------------------------------------------------------------------------------- /doc/image/任务管理.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/任务管理.png -------------------------------------------------------------------------------- /doc/image/任务编辑.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/任务编辑.png -------------------------------------------------------------------------------- /doc/image/告警记录.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/告警记录.png -------------------------------------------------------------------------------- /doc/image/告警配置.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/告警配置.png -------------------------------------------------------------------------------- /doc/image/用户管理.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/用户管理.png -------------------------------------------------------------------------------- /doc/image/登录页面.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/登录页面.png -------------------------------------------------------------------------------- /doc/image/角色管理.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/角色管理.png -------------------------------------------------------------------------------- /doc/image/调度管理.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/调度管理.png -------------------------------------------------------------------------------- /doc/image/首页.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/首页.png -------------------------------------------------------------------------------- /docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | PID=springboot.pid 3 | JAVA_OPTS=" -Duser.timezone=Asia/Shanghai -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8" 4 | JAVA_OPTS="${JAVA_OPTS} -verbose:gc -Xloggc:${GcLogPath}/gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:ErrorFile=${GcLogPath}/hs_err_pid_%p.log" 5 | JAVA_MEM_OPTS=" -XX:+UseG1GC -Xms${JAVA_XMX-512m} -Xmx${JAVA_XMX-512m} -Xmn${JAVA_XMN-256m} -XX:+AlwaysPreTouch -XX:-UseBiasedLocking -XX:G1HeapRegionSize=16m" 6 | JAVA_OPTS="$JAVA_OPTS $JAVA_MEM_OPTS" 7 | SPRING_OPTS=" --spring.profiles.active=${ACTIVE_PROFILE-prod}" 8 | 9 | function echoPlus(){ 10 | # 增强显示 11 | # @param color (31|91 红 32|92绿 33|93黄 34|94蓝 35|95紫 36|96天蓝) 12 | # @param content 13 | local colorCode=$1 14 | local content=$2 15 | 16 | echo -e "\e[${colorCode}m${content}\e[0m" 17 | } 18 | 19 | 20 | echoPlus 33 "[check] 即将启动Springboot......" 21 | 22 | 23 | java ${JAVA_OPTS} -jar ${JarName} ${SPRING_OPTS} 24 | -------------------------------------------------------------------------------- /smart-job-common/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/smart-job-common/.DS_Store -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/annotation/DataScope.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * 数据权限过滤注解 7 | * 8 | * @author wuque 9 | */ 10 | @Target(ElementType.METHOD) 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Documented 13 | public @interface DataScope { 14 | /** 15 | * 部门表的别名 16 | */ 17 | public String deptAlias() default ""; 18 | 19 | /** 20 | * 用户表的别名 21 | */ 22 | public String userAlias() default ""; 23 | } 24 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/annotation/DataSource.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.annotation; 2 | 3 | import cn.smartcoding.common.enums.DataSourceType; 4 | 5 | import java.lang.annotation.*; 6 | 7 | /** 8 | * 自定义多数据源切换注解 9 | *

10 | * 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准 11 | * 12 | * @author wuque 13 | */ 14 | @Target({ElementType.METHOD, ElementType.TYPE}) 15 | @Retention(RetentionPolicy.RUNTIME) 16 | @Documented 17 | @Inherited 18 | public @interface DataSource { 19 | /** 20 | * 切换数据源名称 21 | */ 22 | public DataSourceType value() default DataSourceType.MASTER; 23 | } 24 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/annotation/Excels.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.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 wuque 12 | */ 13 | @Target(ElementType.FIELD) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface Excels { 16 | Excel[] value(); 17 | } 18 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/annotation/Log.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.annotation; 2 | 3 | import cn.smartcoding.common.enums.BusinessType; 4 | import cn.smartcoding.common.enums.OperatorType; 5 | 6 | import java.lang.annotation.*; 7 | 8 | /** 9 | * 自定义操作日志记录注解 10 | * 11 | * @author wuque 12 | */ 13 | @Target({ElementType.PARAMETER, ElementType.METHOD}) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | @Documented 16 | public @interface Log { 17 | /** 18 | * 模块 19 | */ 20 | public String title() default ""; 21 | 22 | /** 23 | * 功能 24 | */ 25 | public BusinessType businessType() default BusinessType.OTHER; 26 | 27 | /** 28 | * 操作人类别 29 | */ 30 | public OperatorType operatorType() default OperatorType.MANAGE; 31 | 32 | /** 33 | * 是否保存请求的参数 34 | */ 35 | public boolean isSaveRequestData() default true; 36 | } 37 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/annotation/RepeatSubmit.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * 自定义注解防止表单重复提交 7 | * 8 | * @author wuque 9 | */ 10 | @Inherited 11 | @Target(ElementType.METHOD) 12 | @Retention(RetentionPolicy.RUNTIME) 13 | @Documented 14 | public @interface RepeatSubmit { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/constant/ScheduleConstants.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.constant; 2 | 3 | /** 4 | * 任务调度通用常量 5 | * 6 | * @author wuque 7 | */ 8 | public class ScheduleConstants { 9 | public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME"; 10 | 11 | /** 12 | * 执行目标key 13 | */ 14 | public static final String TASK_PROPERTIES = "TASK_PROPERTIES"; 15 | 16 | /** 17 | * 默认 18 | */ 19 | public static final String MISFIRE_DEFAULT = "0"; 20 | 21 | /** 22 | * 立即触发执行 23 | */ 24 | public static final String MISFIRE_IGNORE_MISFIRES = "1"; 25 | 26 | /** 27 | * 触发一次执行 28 | */ 29 | public static final String MISFIRE_FIRE_AND_PROCEED = "2"; 30 | 31 | /** 32 | * 不触发立即执行 33 | */ 34 | public static final String MISFIRE_DO_NOTHING = "3"; 35 | 36 | public enum Status { 37 | /** 38 | * 正常 39 | */ 40 | NORMAL("0"), 41 | /** 42 | * 暂停 43 | */ 44 | PAUSE("1"); 45 | 46 | private String value; 47 | 48 | private Status(String value) { 49 | this.value = value; 50 | } 51 | 52 | public String getValue() { 53 | return value; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/core/captcha/CaptchaCodeEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package cn.smartcoding.common.core.captcha; 17 | 18 | /** 19 | * 验证码配置枚举 20 | * 21 | * @author: liaojinlong 22 | * @date: 2020/6/10 17:40 23 | */ 24 | 25 | public enum CaptchaCodeEnum { 26 | /** 27 | * 算数 28 | */ 29 | arithmetic, 30 | /** 31 | * 中文 32 | */ 33 | chinese, 34 | /** 35 | * 中文闪图 36 | */ 37 | chinese_gif, 38 | /** 39 | * 闪图 40 | */ 41 | gif, 42 | /** 43 | * 数字+字母 44 | */ 45 | spec 46 | } 47 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/core/domain/AccountCreateEnum.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.core.domain; 2 | 3 | /** 4 | * 帐号创建类型 5 | */ 6 | public enum AccountCreateEnum { 7 | /** 8 | * 系统 9 | */ 10 | SYS(0, "系统"), 11 | /** 12 | * ldap 13 | */ 14 | LDAP(1, "ldap"); 15 | 16 | 17 | AccountCreateEnum(int code, String title) { 18 | this.code = code; 19 | this.title = title; 20 | } 21 | 22 | private int code; 23 | private String title; 24 | 25 | public String getTitle() { 26 | return title; 27 | } 28 | 29 | public int getCode() { 30 | return code; 31 | } 32 | 33 | public static AccountCreateEnum fromCode(Integer code, AccountCreateEnum defaultEnum) { 34 | if (code == null) { 35 | return defaultEnum; 36 | } 37 | AccountCreateEnum[] values = AccountCreateEnum.values(); 38 | for (AccountCreateEnum value : values) { 39 | if (value.getCode() == code) { 40 | return value; 41 | } 42 | } 43 | return defaultEnum; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/core/domain/AccountStatusEnum.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.core.domain; 2 | 3 | /** 4 | * 帐号状态 5 | */ 6 | public enum AccountStatusEnum { 7 | 8 | /** 9 | * 正常 10 | */ 11 | OK(0, "正常"), 12 | /** 13 | * 停用 14 | */ 15 | STOP(1, "停用"), 16 | /** 17 | * 锁定 18 | */ 19 | LOCK(2, "锁定"); 20 | 21 | 22 | AccountStatusEnum(int code, String title) { 23 | this.code = code; 24 | this.title = title; 25 | } 26 | 27 | private int code; 28 | private String title; 29 | 30 | public String getTitle() { 31 | return title; 32 | } 33 | 34 | public int getCode() { 35 | return code; 36 | } 37 | 38 | public static AccountStatusEnum fromCode(Integer code, AccountStatusEnum defaultEnum) { 39 | if (code == null) { 40 | return defaultEnum; 41 | } 42 | AccountStatusEnum[] values = AccountStatusEnum.values(); 43 | for (AccountStatusEnum value : values) { 44 | if (value.getCode() == code) { 45 | return value; 46 | } 47 | } 48 | return defaultEnum; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/core/domain/IErrorCode.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.core.domain; 2 | 3 | /** 4 | * 返回状态码 5 | */ 6 | public interface IErrorCode { 7 | 8 | int getCode(); 9 | 10 | String getMessage(); 11 | } 12 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/core/domain/util/ResultModelUtils.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.core.domain.util; 2 | 3 | import cn.smartcoding.common.core.domain.ResultModel; 4 | 5 | public class ResultModelUtils { 6 | 7 | /** 8 | * 响应返回结果 9 | * 10 | * @param rows 影响行数 11 | * @return 操作结果 12 | */ 13 | public static ResultModel toAjax(int rows) { 14 | return rows > 0 ? ResultModel.success() : ResultModel.fail(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/core/page/TableSupport.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.core.page; 2 | 3 | import cn.smartcoding.common.utils.ServletUtils; 4 | 5 | /** 6 | * 表格数据处理 7 | * 8 | * @author wuque 9 | */ 10 | public class TableSupport { 11 | /** 12 | * 当前记录起始索引 13 | */ 14 | public static final String PAGE_NUM = "pageNum"; 15 | 16 | /** 17 | * 每页显示记录数 18 | */ 19 | public static final String PAGE_SIZE = "pageSize"; 20 | 21 | /** 22 | * 排序列 23 | */ 24 | public static final String ORDER_BY_COLUMN = "orderByColumn"; 25 | 26 | /** 27 | * 排序的方向 "desc" 或者 "asc". 28 | */ 29 | public static final String IS_ASC = "isAsc"; 30 | 31 | /** 32 | * 封装分页对象 33 | */ 34 | public static PageDomain getPageDomain() { 35 | PageDomain pageDomain = new PageDomain(); 36 | pageDomain.setPageNum(ServletUtils.getParameterToInt(PAGE_NUM)); 37 | pageDomain.setPageSize(ServletUtils.getParameterToInt(PAGE_SIZE)); 38 | pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN)); 39 | pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC)); 40 | return pageDomain; 41 | } 42 | 43 | public static PageDomain buildPageRequest() { 44 | return getPageDomain(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/enums/BusinessStatus.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.enums; 2 | 3 | /** 4 | * 操作状态 5 | * 6 | * @author wuque 7 | */ 8 | public enum BusinessStatus { 9 | /** 10 | * 成功 11 | */ 12 | SUCCESS, 13 | 14 | /** 15 | * 失败 16 | */ 17 | FAIL, 18 | } 19 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/enums/BusinessType.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.enums; 2 | 3 | /** 4 | * 业务操作类型 5 | * 6 | * @author wuque 7 | */ 8 | public enum BusinessType { 9 | /** 10 | * 其它 11 | */ 12 | OTHER, 13 | 14 | /** 15 | * 新增 16 | */ 17 | INSERT, 18 | 19 | /** 20 | * 修改 21 | */ 22 | UPDATE, 23 | 24 | /** 25 | * 删除 26 | */ 27 | DELETE, 28 | 29 | /** 30 | * 授权 31 | */ 32 | GRANT, 33 | 34 | /** 35 | * 导出 36 | */ 37 | EXPORT, 38 | 39 | /** 40 | * 导入 41 | */ 42 | IMPORT, 43 | 44 | /** 45 | * 强退 46 | */ 47 | FORCE, 48 | 49 | /** 50 | * 生成代码 51 | */ 52 | GENCODE, 53 | 54 | /** 55 | * 清空数据 56 | */ 57 | CLEAN, 58 | /** 59 | * 运行 60 | */ 61 | RUN, 62 | /** 63 | * 查询 64 | */ 65 | QUERY, 66 | } 67 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/enums/DataSourceType.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.enums; 2 | 3 | /** 4 | * 数据源 5 | * 6 | * @author wuque 7 | */ 8 | public enum DataSourceType { 9 | /** 10 | * 主库 11 | */ 12 | MASTER, 13 | 14 | /** 15 | * 从库 16 | */ 17 | SLAVE 18 | } 19 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/enums/HttpMethod.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.enums; 2 | 3 | import org.springframework.lang.Nullable; 4 | 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | 8 | /** 9 | * 请求方式 10 | * 11 | * @author wuque 12 | */ 13 | public enum HttpMethod { 14 | GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE; 15 | 16 | private static final Map mappings = new HashMap<>(16); 17 | 18 | static { 19 | for (HttpMethod httpMethod : values()) { 20 | mappings.put(httpMethod.name(), httpMethod); 21 | } 22 | } 23 | 24 | @Nullable 25 | public static HttpMethod resolve(@Nullable String method) { 26 | return (method != null ? mappings.get(method) : null); 27 | } 28 | 29 | public boolean matches(String method) { 30 | return (this == resolve(method)); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/enums/OperatorType.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.enums; 2 | 3 | /** 4 | * 操作人类别 5 | * 6 | * @author wuque 7 | */ 8 | public enum OperatorType { 9 | /** 10 | * 其它 11 | */ 12 | OTHER, 13 | 14 | /** 15 | * 后台用户 16 | */ 17 | MANAGE, 18 | 19 | /** 20 | * 手机端用户 21 | */ 22 | MOBILE 23 | } 24 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/enums/UserStatus.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.enums; 2 | 3 | /** 4 | * 用户状态 5 | * 6 | * @author wuque 7 | */ 8 | public enum UserStatus { 9 | OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除"); 10 | 11 | private final String code; 12 | private final String info; 13 | 14 | UserStatus(String code, String info) { 15 | this.code = code; 16 | this.info = info; 17 | } 18 | 19 | public String getCode() { 20 | return code; 21 | } 22 | 23 | public String getInfo() { 24 | return info; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/exception/CustomException.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.exception; 2 | 3 | /** 4 | * 自定义异常 5 | * 6 | * @author wuque 7 | */ 8 | public class CustomException extends RuntimeException { 9 | private static final long serialVersionUID = 1L; 10 | 11 | private Integer code; 12 | 13 | private String message; 14 | 15 | public CustomException(String message) { 16 | this.message = message; 17 | } 18 | 19 | public CustomException(String message, Integer code) { 20 | this.message = message; 21 | this.code = code; 22 | } 23 | 24 | public CustomException(String message, Throwable e) { 25 | super(message, e); 26 | this.message = message; 27 | } 28 | 29 | @Override 30 | public String getMessage() { 31 | return message; 32 | } 33 | 34 | public Integer getCode() { 35 | return code; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/exception/DemoModeException.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.exception; 2 | 3 | /** 4 | * 演示模式异常 5 | * 6 | * @author wuque 7 | */ 8 | public class DemoModeException extends RuntimeException { 9 | private static final long serialVersionUID = 1L; 10 | 11 | public DemoModeException() { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/exception/UtilException.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.exception; 2 | 3 | /** 4 | * 工具类异常 5 | * 6 | * @author wuque 7 | */ 8 | public class UtilException extends RuntimeException { 9 | private static final long serialVersionUID = 8247610319171014183L; 10 | 11 | public UtilException(Throwable e) { 12 | super(e.getMessage(), e); 13 | } 14 | 15 | public UtilException(String message) { 16 | super(message); 17 | } 18 | 19 | public UtilException(String message, Throwable throwable) { 20 | super(message, throwable); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/exception/file/FileException.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.exception.file; 2 | 3 | import cn.smartcoding.common.exception.BaseException; 4 | 5 | /** 6 | * 文件信息异常类 7 | * 8 | * @author wuque 9 | */ 10 | public class FileException extends BaseException { 11 | private static final long serialVersionUID = 1L; 12 | 13 | public FileException(String code, Object[] args) { 14 | super("file", code, args, null); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/exception/file/FileNameLengthLimitExceededException.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.exception.file; 2 | 3 | /** 4 | * 文件名称超长限制异常类 5 | * 6 | * @author wuque 7 | */ 8 | public class FileNameLengthLimitExceededException extends FileException { 9 | private static final long serialVersionUID = 1L; 10 | 11 | public FileNameLengthLimitExceededException(int defaultFileNameLength) { 12 | super("upload.filename.exceed.length", new Object[]{defaultFileNameLength}); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/exception/file/FileSizeLimitExceededException.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.exception.file; 2 | 3 | /** 4 | * 文件名大小限制异常类 5 | * 6 | * @author wuque 7 | */ 8 | public class FileSizeLimitExceededException extends FileException { 9 | private static final long serialVersionUID = 1L; 10 | 11 | public FileSizeLimitExceededException(long defaultMaxSize) { 12 | super("upload.exceed.maxSize", new Object[]{defaultMaxSize}); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/exception/job/TaskException.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.exception.job; 2 | 3 | /** 4 | * 计划策略异常 5 | * 6 | * @author wuque 7 | */ 8 | public class TaskException extends Exception { 9 | private static final long serialVersionUID = 1L; 10 | 11 | private Code code; 12 | 13 | public TaskException(String msg, Code code) { 14 | this(msg, code, null); 15 | } 16 | 17 | public TaskException(String msg, Code code, Exception nestedEx) { 18 | super(msg, nestedEx); 19 | this.code = code; 20 | } 21 | 22 | public Code getCode() { 23 | return code; 24 | } 25 | 26 | public enum Code { 27 | TASK_EXISTS, NO_TASK_EXISTS, TASK_ALREADY_STARTED, UNKNOWN, CONFIG_ERROR, TASK_NODE_NOT_AVAILABLE 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/exception/user/UserException.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.exception.user; 2 | 3 | import cn.smartcoding.common.exception.BaseException; 4 | 5 | /** 6 | * 用户信息异常类 7 | * 8 | * @author wuque 9 | */ 10 | public class UserException extends BaseException { 11 | private static final long serialVersionUID = 1L; 12 | 13 | public UserException(String code, Object[] args) { 14 | super("user", code, args, null); 15 | } 16 | 17 | public UserException(String code, Object[] args, String message) { 18 | super("user", code, args, message); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/exception/user/UserPasswordNotMatchException.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.exception.user; 2 | 3 | /** 4 | * 用户密码不正确或不符合规范异常类 5 | * 6 | * @author wuque 7 | */ 8 | public class UserPasswordNotMatchException extends UserException { 9 | private static final long serialVersionUID = 1L; 10 | 11 | public UserPasswordNotMatchException() { 12 | super("user.password.not.match", null); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/filter/RepeatableFilter.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.filter; 2 | 3 | import cn.smartcoding.common.utils.StringUtils; 4 | import org.springframework.http.MediaType; 5 | 6 | import javax.servlet.*; 7 | import javax.servlet.http.HttpServletRequest; 8 | import java.io.IOException; 9 | 10 | /** 11 | * Repeatable 过滤器 12 | * 13 | * @author wuque 14 | */ 15 | public class RepeatableFilter implements Filter { 16 | @Override 17 | public void init(FilterConfig filterConfig) throws ServletException { 18 | 19 | } 20 | 21 | @Override 22 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) 23 | throws IOException, ServletException { 24 | ServletRequest requestWrapper = null; 25 | if (request instanceof HttpServletRequest && StringUtils.equalsAnyIgnoreCase(request.getContentType(), 26 | MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_JSON_UTF8_VALUE)) { 27 | requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response); 28 | } 29 | if (null == requestWrapper) { 30 | chain.doFilter(request, response); 31 | } else { 32 | chain.doFilter(requestWrapper, response); 33 | } 34 | } 35 | 36 | @Override 37 | public void destroy() { 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/robot/enums/NotifyMsgTypeEnum.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.robot.enums; 2 | 3 | /** 4 | * 响应的消息类型 5 | * 6 | * @author qingshi 7 | * @email 705029004@qq.com 8 | * @date 2020/02/06- 8:51 下午 9 | */ 10 | public enum NotifyMsgTypeEnum { 11 | /** 12 | * text消息 13 | */ 14 | TEXT, 15 | /** 16 | * markdown消息 17 | */ 18 | MARKDOWN, 19 | /** 20 | * link消息 21 | */ 22 | LINK, 23 | /** 24 | * IMAGE图片消息 25 | */ 26 | IMAGE, 27 | /** 28 | * news图文消息 29 | */ 30 | NEWS, 31 | /** 32 | * feedCard消息 33 | */ 34 | FEED_CARD, 35 | 36 | /** 37 | * actionCard 图文消息 38 | */ 39 | ACTION_CARD; 40 | } 41 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/robot/enums/NotifyRobotEnum.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.robot.enums; 2 | 3 | import lombok.Getter; 4 | 5 | import java.util.Arrays; 6 | import java.util.List; 7 | 8 | /** 9 | * 发送的服务类型 10 | * 11 | * @author qingshi 12 | * @email 705029004@qq.com 13 | * @date 2020/02/06- 8:49 下午 14 | */ 15 | @Getter 16 | public enum NotifyRobotEnum { 17 | /** 18 | * 企业微信机器人 19 | */ 20 | CORP_WECHAT(0, "企业微信机器人", Arrays.asList(NotifyMsgTypeEnum.TEXT, NotifyMsgTypeEnum.MARKDOWN, NotifyMsgTypeEnum.LINK, NotifyMsgTypeEnum.NEWS, NotifyMsgTypeEnum.IMAGE)), 21 | /** 22 | * 钉钉机器人 23 | */ 24 | DINGDING(1, "钉钉机器人", Arrays.asList(NotifyMsgTypeEnum.TEXT, NotifyMsgTypeEnum.MARKDOWN, NotifyMsgTypeEnum.LINK, NotifyMsgTypeEnum.FEED_CARD, NotifyMsgTypeEnum.ACTION_CARD)); 25 | 26 | private int code; 27 | private String desc; 28 | /** 29 | * 支持的通知 30 | */ 31 | private List supports; 32 | 33 | NotifyRobotEnum(int code, String desc, List supports) { 34 | this.code = code; 35 | this.desc = desc; 36 | this.supports = supports; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/robot/exception/WebHookRobotIllegalArgumentException.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.robot.exception; 2 | 3 | import lombok.Getter; 4 | 5 | /** 6 | * 通用异常 7 | * 8 | * @author qingshi 9 | * @email 705029004@qq.com 10 | * @date 2020/02/07- 3:15 下午 11 | */ 12 | @Getter 13 | public class WebHookRobotIllegalArgumentException extends RuntimeException { 14 | protected int code = 100403; 15 | protected String message; 16 | 17 | public WebHookRobotIllegalArgumentException(String message) { 18 | super(message); 19 | this.message = message; 20 | } 21 | 22 | public WebHookRobotIllegalArgumentException(int code, String message) { 23 | this.code = code; 24 | this.message = message; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/robot/exception/WebHookRobotResponseException.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.robot.exception; 2 | 3 | import lombok.Getter; 4 | 5 | /** 6 | * 通用异常 7 | * 8 | * @author qingshi 9 | * @email 705029004@qq.com 10 | * @date 2020/02/07- 3:15 下午 11 | */ 12 | @Getter 13 | public class WebHookRobotResponseException extends RuntimeException { 14 | protected int code = 100402; 15 | protected String message; 16 | 17 | public WebHookRobotResponseException(String message) { 18 | super(message); 19 | this.message = message; 20 | } 21 | 22 | public WebHookRobotResponseException(int code, String message) { 23 | this.code = code; 24 | this.message = message; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/robot/exception/WebHookRobotValidateException.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.robot.exception; 2 | 3 | import lombok.Getter; 4 | 5 | /** 6 | * 通用异常 7 | * 8 | * @author qingshi 9 | * @email 705029004@qq.com 10 | * @date 2020/02/07- 3:15 下午 11 | */ 12 | @Getter 13 | public class WebHookRobotValidateException extends RuntimeException { 14 | protected int code = 100401; 15 | protected String message; 16 | 17 | public WebHookRobotValidateException(String message) { 18 | super(message); 19 | this.message = message; 20 | } 21 | 22 | public WebHookRobotValidateException(int code, String message) { 23 | this.code = code; 24 | this.message = message; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/robot/model/message/Message.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.robot.model.message; 2 | 3 | /** 4 | * 消息接口 5 | * 6 | * @author qingshi 7 | * @email 705029004@qq.com 8 | * @date 2020/02/07- 9:40 下午 9 | */ 10 | public interface Message { 11 | 12 | /** 13 | * 返回消息的Json格式字符串 14 | * 15 | * @return 消息的Json格式字符串 16 | */ 17 | String toJsonString(); 18 | } 19 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/robot/model/message/dingding/enums/BtnOrientationTypeEnum.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.robot.model.message.dingding.enums; 2 | 3 | public enum BtnOrientationTypeEnum { 4 | /** 5 | * 0-按钮竖直排列 6 | */ 7 | VERTICAL("0"), 8 | /** 9 | * 1-按钮横向排列 10 | */ 11 | TRANSVERSE("1"); 12 | 13 | private String code; 14 | 15 | BtnOrientationTypeEnum(String code) { 16 | this.code = code; 17 | } 18 | 19 | public static String formCode(String code) { 20 | if (code == null) { 21 | return null; 22 | } 23 | for (BtnOrientationTypeEnum value : BtnOrientationTypeEnum.values()) { 24 | if (value.code.endsWith(code)) { 25 | return code; 26 | } 27 | } 28 | return null; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/robot/model/message/dingding/enums/HideAvatarTypeEnums.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.robot.model.message.dingding.enums; 2 | 3 | public enum HideAvatarTypeEnums { 4 | /** 5 | * 0-正常发消息者头像 6 | */ 7 | SHOW("0"), 8 | /** 9 | * 1-隐藏发消息者头像 10 | */ 11 | HIDE("1"); 12 | 13 | private String code; 14 | 15 | HideAvatarTypeEnums(String code) { 16 | this.code = code; 17 | } 18 | 19 | public static String formCode(String code) { 20 | if (code == null) { 21 | return null; 22 | } 23 | for (HideAvatarTypeEnums value : HideAvatarTypeEnums.values()) { 24 | if (value.code.endsWith(code)) { 25 | return code; 26 | } 27 | } 28 | return null; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/robot/model/message/wx/WxMarkdownMessage.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.robot.model.message.wx; 2 | 3 | import cn.smartcoding.common.robot.model.message.Message; 4 | import com.alibaba.fastjson.JSON; 5 | import lombok.Data; 6 | 7 | import java.util.ArrayList; 8 | import java.util.HashMap; 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | @Data 13 | public class WxMarkdownMessage implements Message { 14 | 15 | private List items = new ArrayList(); 16 | 17 | public void add(String text) { 18 | items.add(text); 19 | } 20 | 21 | 22 | @Override 23 | public String toJsonString() { 24 | Map result = new HashMap(); 25 | result.put("msgtype", "markdown"); 26 | 27 | Map markdown = new HashMap(); 28 | 29 | StringBuilder markdownText = new StringBuilder(); 30 | for (String item : items) { 31 | markdownText.append(item).append("\n"); 32 | } 33 | markdown.put("content", markdownText.toString()); 34 | result.put("markdown", markdown); 35 | 36 | return JSON.toJSONString(result); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/robot/model/message/wx/news/WxNewsArticle.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.robot.model.message.wx.news; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | @Data 9 | @NoArgsConstructor 10 | @AllArgsConstructor 11 | @Builder 12 | public class WxNewsArticle { 13 | private String title; 14 | private String description; 15 | private String picurl; 16 | private String url; 17 | } 18 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/robot/model/request/ActionCardRequest.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.robot.model.request; 2 | 3 | import cn.smartcoding.common.robot.enums.NotifyMsgTypeEnum; 4 | import cn.smartcoding.common.robot.enums.NotifyRobotEnum; 5 | import cn.smartcoding.common.robot.model.message.dingding.DingActionCardMessage; 6 | import lombok.Data; 7 | import lombok.experimental.Accessors; 8 | 9 | import java.util.List; 10 | 11 | @Data 12 | @Accessors(chain = true) 13 | public class ActionCardRequest extends BaseNotifyRequest implements RobotNotifyRequest { 14 | 15 | private String title; 16 | private String text; 17 | private String hideAvatar; 18 | private String btnOrientation; 19 | private List btns; 20 | 21 | public ActionCardRequest(String webHook, NotifyRobotEnum notifyRobotEnum) { 22 | super(webHook, notifyRobotEnum); 23 | } 24 | 25 | @Override 26 | public NotifyMsgTypeEnum getMsgType() { 27 | return NotifyMsgTypeEnum.ACTION_CARD; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/robot/model/request/BaseNotifyRequest.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.robot.model.request; 2 | 3 | import cn.smartcoding.common.robot.enums.NotifyRobotEnum; 4 | import lombok.Data; 5 | 6 | /** 7 | * 请求的详情请看: 8 | * 钉钉: https://ding-doc.dingtalk.com/doc#/serverapi2/qf2nxq 9 | * 微信: https://work.weixin.qq.com/help?person_id=1&doc_id=13376#markdown%E7%B1%BB%E5%9E%8B 10 | * 11 | * @author qingshi 12 | * @email 705029004@qq.com 13 | * @date 2020/02/06- 8:17 下午 14 | */ 15 | @Data 16 | public class BaseNotifyRequest { 17 | private String webHook; 18 | 19 | private NotifyRobotEnum notifyRobotEnum; 20 | 21 | 22 | protected BaseNotifyRequest(String webHook, NotifyRobotEnum notifyRobotEnum) { 23 | this.webHook = webHook; 24 | this.notifyRobotEnum = notifyRobotEnum; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/robot/model/request/CardRequest.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.robot.model.request; 2 | 3 | import cn.smartcoding.common.robot.enums.NotifyMsgTypeEnum; 4 | import cn.smartcoding.common.robot.enums.NotifyRobotEnum; 5 | import cn.smartcoding.common.robot.model.message.dingding.DingFeedCardMessage; 6 | import lombok.Data; 7 | import lombok.experimental.Accessors; 8 | 9 | import java.util.List; 10 | 11 | @Data 12 | @Accessors(chain = true) 13 | public class CardRequest extends BaseNotifyRequest implements RobotNotifyRequest { 14 | 15 | private List links; 16 | 17 | public CardRequest(String webHook, NotifyRobotEnum notifyRobotEnum) { 18 | super(webHook, notifyRobotEnum); 19 | } 20 | 21 | @Override 22 | public NotifyMsgTypeEnum getMsgType() { 23 | return NotifyMsgTypeEnum.FEED_CARD; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/robot/model/request/LinkRequest.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.robot.model.request; 2 | 3 | import cn.smartcoding.common.robot.enums.NotifyMsgTypeEnum; 4 | import cn.smartcoding.common.robot.enums.NotifyRobotEnum; 5 | import lombok.Data; 6 | import lombok.experimental.Accessors; 7 | 8 | /** 9 | * link请求 10 | * 11 | * @author qingshi 12 | * @email 705029004@qq.com 13 | * @date 2020/02/07- 9:39 下午 14 | */ 15 | @Data 16 | @Accessors(chain = true) 17 | public class LinkRequest extends BaseNotifyRequest implements RobotNotifyRequest { 18 | private String title; 19 | private String text; 20 | private String picUrl; 21 | private String messageUrl; 22 | 23 | public LinkRequest(String webHook, NotifyRobotEnum notifyRobotEnum) { 24 | super(webHook, notifyRobotEnum); 25 | } 26 | 27 | @Override 28 | public NotifyMsgTypeEnum getMsgType() { 29 | return NotifyMsgTypeEnum.LINK; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/robot/model/request/MarkdownRequest.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.robot.model.request; 2 | 3 | import cn.smartcoding.common.robot.enums.NotifyMsgTypeEnum; 4 | import cn.smartcoding.common.robot.enums.NotifyRobotEnum; 5 | import lombok.Data; 6 | import lombok.experimental.Accessors; 7 | 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | 11 | /** 12 | * MARKDOWN请求,微信和钉钉使用有差异 13 | * 14 | * @author qingshi 15 | * @email 705029004@qq.com 16 | * @date 2020/02/07- 9:40 下午 17 | */ 18 | @Data 19 | @Accessors(chain = true) 20 | public class MarkdownRequest extends BaseNotifyRequest implements RobotNotifyRequest { 21 | //wx只有这个字段 22 | //private List items = new ArrayList(); 23 | 24 | /** 25 | * DingDing具有的字段 26 | */ 27 | private String title; 28 | 29 | private List items = new ArrayList(); 30 | /** 31 | * 被@人的手机号(在text内容里要有@手机号) 32 | */ 33 | private List atMobileList = new ArrayList<>(); 34 | /** 35 | * (@所有人时:true,否则为:false) 36 | */ 37 | private boolean isAtAll = false; 38 | 39 | public MarkdownRequest addItem(String item) { 40 | this.items.add(item); 41 | return this; 42 | } 43 | 44 | public MarkdownRequest(String webHook, NotifyRobotEnum notifyRobotEnum) { 45 | super(webHook, notifyRobotEnum); 46 | } 47 | 48 | @Override 49 | public NotifyMsgTypeEnum getMsgType() { 50 | return NotifyMsgTypeEnum.MARKDOWN; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/robot/model/request/NewsRequest.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.robot.model.request; 2 | 3 | import cn.smartcoding.common.robot.enums.NotifyMsgTypeEnum; 4 | import cn.smartcoding.common.robot.enums.NotifyRobotEnum; 5 | import cn.smartcoding.common.robot.model.message.wx.news.WxNewsArticle; 6 | import lombok.Data; 7 | import lombok.experimental.Accessors; 8 | 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | /** 13 | * news图文请求 14 | * 15 | * @author qingshi 16 | * @email 705029004@qq.com 17 | * @date 2020/02/07- 9:41 下午 18 | */ 19 | @Data 20 | @Accessors(chain = true) 21 | public class NewsRequest extends BaseNotifyRequest implements RobotNotifyRequest { 22 | private List articles = new ArrayList(); 23 | 24 | public NewsRequest addArticle(WxNewsArticle wxNewsArticle) { 25 | this.articles.add(wxNewsArticle); 26 | return this; 27 | } 28 | 29 | public NewsRequest(String webHook, NotifyRobotEnum notifyRobotEnum) { 30 | super(webHook, notifyRobotEnum); 31 | } 32 | 33 | @Override 34 | public NotifyMsgTypeEnum getMsgType() { 35 | return NotifyMsgTypeEnum.NEWS; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/robot/model/request/RobotNotifyRequest.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.robot.model.request; 2 | 3 | import cn.smartcoding.common.robot.enums.NotifyMsgTypeEnum; 4 | import cn.smartcoding.common.robot.enums.NotifyRobotEnum; 5 | 6 | public interface RobotNotifyRequest { 7 | 8 | NotifyMsgTypeEnum getMsgType(); 9 | 10 | String getWebHook(); 11 | 12 | void setWebHook(String webHook); 13 | 14 | NotifyRobotEnum getNotifyRobotEnum(); 15 | 16 | void setNotifyRobotEnum(NotifyRobotEnum notifyRobotEnum); 17 | } 18 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/robot/model/request/SingleActionCardRequest.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.robot.model.request; 2 | 3 | import cn.smartcoding.common.robot.enums.NotifyMsgTypeEnum; 4 | import cn.smartcoding.common.robot.enums.NotifyRobotEnum; 5 | import lombok.Data; 6 | import lombok.experimental.Accessors; 7 | 8 | @Data 9 | @Accessors(chain = true) 10 | public class SingleActionCardRequest extends BaseNotifyRequest implements RobotNotifyRequest { 11 | 12 | private String title; 13 | private String text; 14 | private String singleTitle; 15 | private String singleURL; 16 | private String btnOrientation; 17 | private String hideAvatar; 18 | 19 | public SingleActionCardRequest(String webHook, NotifyRobotEnum notifyRobotEnum) { 20 | super(webHook, notifyRobotEnum); 21 | } 22 | 23 | @Override 24 | public NotifyMsgTypeEnum getMsgType() { 25 | return NotifyMsgTypeEnum.ACTION_CARD; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/robot/model/request/TextRequest.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.robot.model.request; 2 | 3 | import cn.smartcoding.common.robot.enums.NotifyMsgTypeEnum; 4 | import cn.smartcoding.common.robot.enums.NotifyRobotEnum; 5 | import lombok.Data; 6 | import lombok.experimental.Accessors; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * 文本请求 12 | * 13 | * @author qingshi 14 | * @email 705029004@qq.com 15 | * @date 2020/02/07- 9:37 下午 16 | */ 17 | @Data 18 | @Accessors(chain = true) 19 | public class TextRequest extends BaseNotifyRequest implements RobotNotifyRequest { 20 | /** 21 | * 消息的文本 22 | */ 23 | private String text; 24 | /** 25 | * 需要at @ 的人:手机号码 26 | */ 27 | private List atMobileList; 28 | /** 29 | * 需要at @ 的人:userid 30 | */ 31 | private List atUserIdList; 32 | /** 33 | * @all 所以人 34 | */ 35 | private boolean isAtAll; 36 | 37 | public TextRequest(String webHook, NotifyRobotEnum notifyRobotEnum) { 38 | super(webHook, notifyRobotEnum); 39 | } 40 | 41 | @Override 42 | public NotifyMsgTypeEnum getMsgType() { 43 | return NotifyMsgTypeEnum.TEXT; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/robot/model/response/RobotNotifyResponse.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.robot.model.response; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | 11 | /** 12 | * 请求返回信息 13 | * 14 | * @author qingshi 15 | * @email 705029004@qq.com 16 | * @date 2020/02/06- 8:18 下午 17 | */ 18 | @Data 19 | @NoArgsConstructor 20 | @AllArgsConstructor 21 | public class RobotNotifyResponse { 22 | private boolean isSuccess = false; 23 | private Integer errorCode; 24 | private String errorMsg; 25 | 26 | @Override 27 | public String toString() { 28 | Map items = new HashMap(); 29 | items.put("errorCode", errorCode); 30 | items.put("errorMsg", errorMsg); 31 | items.put("isSuccess", isSuccess); 32 | return JSON.toJSONString(items); 33 | } 34 | 35 | public static RobotNotifyResponse error(String errorMsg) { 36 | RobotNotifyResponse robotNotifyResponse = new RobotNotifyResponse(); 37 | robotNotifyResponse.setErrorMsg(errorMsg); 38 | return robotNotifyResponse; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/robot/util/ErrorStringUtils.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.robot.util; 2 | 3 | /** 4 | * --添加相关注释-- 5 | * 6 | * @author qingshi 7 | * @email 705029004@qq.com 8 | * @date 2020/02/07- 12:35 下午 9 | */ 10 | public class ErrorStringUtils { 11 | public static String wxError(String msg) { 12 | return "企业微信: " + msg; 13 | } 14 | 15 | public static String dingdingError(String msg) { 16 | return "钉钉: " + msg; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/utils/ExceptionUtil.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.utils; 2 | 3 | import org.apache.commons.lang3.exception.ExceptionUtils; 4 | 5 | import java.io.PrintWriter; 6 | import java.io.StringWriter; 7 | 8 | /** 9 | * 错误信息处理类。 10 | * 11 | * @author wuque 12 | */ 13 | public class ExceptionUtil { 14 | /** 15 | * 获取exception的详细错误信息。 16 | */ 17 | public static String getExceptionMessage(Throwable e) { 18 | StringWriter sw = new StringWriter(); 19 | e.printStackTrace(new PrintWriter(sw, true)); 20 | String str = sw.toString(); 21 | return str; 22 | } 23 | 24 | public static String getRootErrorMseeage(Exception e) { 25 | Throwable root = ExceptionUtils.getRootCause(e); 26 | root = (root == null ? e : root); 27 | if (root == null) { 28 | return ""; 29 | } 30 | String msg = root.getMessage(); 31 | if (msg == null) { 32 | return "null"; 33 | } 34 | return StringUtils.defaultString(msg); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/utils/LogUtils.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.utils; 2 | 3 | /** 4 | * 处理并记录日志文件 5 | * 6 | * @author wuque 7 | */ 8 | public class LogUtils { 9 | public static String getBlock(Object msg) { 10 | if (msg == null) { 11 | msg = ""; 12 | } 13 | return "[" + msg.toString() + "]"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/utils/MessageUtils.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.utils; 2 | 3 | import cn.smartcoding.common.utils.spring.SpringUtils; 4 | import org.springframework.context.MessageSource; 5 | import org.springframework.context.i18n.LocaleContextHolder; 6 | 7 | /** 8 | * 获取i18n资源文件 9 | * 10 | * @author wuque 11 | */ 12 | public class MessageUtils { 13 | /** 14 | * 根据消息键和参数 获取消息 委托给spring messageSource 15 | * 16 | * @param code 消息键 17 | * @param args 参数 18 | * @return 获取国际化翻译值 19 | */ 20 | public static String message(String code, Object... args) { 21 | MessageSource messageSource = SpringUtils.getBean(MessageSource.class); 22 | return messageSource.getMessage(code, args, LocaleContextHolder.getLocale()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/utils/http/HttpHelper.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.utils.http; 2 | 3 | import org.apache.commons.lang3.exception.ExceptionUtils; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | 7 | import javax.servlet.ServletRequest; 8 | import java.io.BufferedReader; 9 | import java.io.IOException; 10 | import java.io.InputStream; 11 | import java.io.InputStreamReader; 12 | import java.nio.charset.Charset; 13 | 14 | /** 15 | * 通用http工具封装 16 | * 17 | * @author wuque 18 | */ 19 | public class HttpHelper { 20 | private static final Logger LOGGER = LoggerFactory.getLogger(HttpHelper.class); 21 | 22 | public static String getBodyString(ServletRequest request) { 23 | StringBuilder sb = new StringBuilder(); 24 | BufferedReader reader = null; 25 | try (InputStream inputStream = request.getInputStream()) { 26 | reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName("UTF-8"))); 27 | String line = ""; 28 | while ((line = reader.readLine()) != null) { 29 | sb.append(line); 30 | } 31 | } catch (IOException e) { 32 | LOGGER.warn("getBodyString出现问题!"); 33 | } finally { 34 | if (reader != null) { 35 | try { 36 | reader.close(); 37 | } catch (IOException e) { 38 | LOGGER.error(ExceptionUtils.getMessage(e)); 39 | } 40 | } 41 | } 42 | return sb.toString(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/utils/sql/SqlUtil.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.utils.sql; 2 | 3 | import cn.smartcoding.common.exception.BaseException; 4 | import cn.smartcoding.common.utils.StringUtils; 5 | 6 | /** 7 | * sql操作工具类 8 | * 9 | * @author wuque 10 | */ 11 | public class SqlUtil { 12 | /** 13 | * 仅支持字母、数字、下划线、空格、逗号、小数点(支持多个字段排序) 14 | */ 15 | public static String SQL_PATTERN = "[a-zA-Z0-9_\\ \\,\\.]+"; 16 | 17 | /** 18 | * 检查字符,防止注入绕过 19 | */ 20 | public static String escapeOrderBySql(String value) { 21 | if (StringUtils.isNotEmpty(value) && !isValidOrderBySql(value)) { 22 | throw new BaseException("参数不符合规范,不能进行查询"); 23 | } 24 | return value; 25 | } 26 | 27 | /** 28 | * 验证 order by 语法是否符合规范 29 | */ 30 | public static boolean isValidOrderBySql(String value) { 31 | return value.matches(SQL_PATTERN); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /smart-job-common/src/main/java/cn/smartcoding/common/utils/uuid/IdUtils.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.common.utils.uuid; 2 | 3 | /** 4 | * ID生成器工具类 5 | * 6 | * @author wuque 7 | */ 8 | public class IdUtils { 9 | /** 10 | * 获取随机UUID 11 | * 12 | * @return 随机UUID 13 | */ 14 | public static String randomUUID() { 15 | return UUID.randomUUID().toString(); 16 | } 17 | 18 | /** 19 | * 简化的UUID,去掉了横线 20 | * 21 | * @return 简化的UUID,去掉了横线 22 | */ 23 | public static String simpleUUID() { 24 | return UUID.randomUUID().toString(true); 25 | } 26 | 27 | /** 28 | * 获取随机UUID,使用性能更好的ThreadLocalRandom生成UUID 29 | * 30 | * @return 随机UUID 31 | */ 32 | public static String fastUUID() { 33 | return UUID.fastUUID().toString(); 34 | } 35 | 36 | /** 37 | * 简化的UUID,去掉了横线,使用性能更好的ThreadLocalRandom生成UUID 38 | * 39 | * @return 简化的UUID,去掉了横线 40 | */ 41 | public static String fastSimpleUUID() { 42 | return UUID.fastUUID().toString(true); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /smart-job-core/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/smart-job-core/.DS_Store -------------------------------------------------------------------------------- /smart-job-core/src/main/java/cn/smartcoding/job/core/biz/AdminBiz.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.job.core.biz; 2 | 3 | import cn.smartcoding.job.core.biz.model.HandleCallbackParam; 4 | import cn.smartcoding.job.core.biz.model.RegistryParam; 5 | import cn.smartcoding.job.core.biz.model.ReturnT; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author xuxueli 2017-07-27 21:52:49 11 | */ 12 | public interface AdminBiz { 13 | 14 | String MAPPING = "/api"; 15 | 16 | 17 | // ---------------------- callback ---------------------- 18 | 19 | /** 20 | * callback 21 | * 22 | * @param callbackParamList 23 | * @return 24 | */ 25 | ReturnT callback(List callbackParamList); 26 | 27 | 28 | // ---------------------- registry ---------------------- 29 | 30 | /** 31 | * registry 32 | * 33 | * @param registryParam 34 | * @return 35 | */ 36 | ReturnT registry(RegistryParam registryParam); 37 | 38 | /** 39 | * registry remove 40 | * 41 | * @param registryParam 42 | * @return 43 | */ 44 | ReturnT registryRemove(RegistryParam registryParam); 45 | 46 | } 47 | -------------------------------------------------------------------------------- /smart-job-core/src/main/java/cn/smartcoding/job/core/biz/ExecutorBiz.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.job.core.biz; 2 | 3 | import cn.smartcoding.job.core.biz.model.LogResult; 4 | import cn.smartcoding.job.core.biz.model.ReturnT; 5 | import cn.smartcoding.job.core.biz.model.TriggerParam; 6 | 7 | /** 8 | * 任务执行器 9 | * Created by xuxueli on 17/3/1. 10 | */ 11 | public interface ExecutorBiz { 12 | 13 | /** 14 | * beat 15 | * 16 | * @return result 17 | */ 18 | ReturnT beat(); 19 | 20 | /** 21 | * idle beat 22 | * 23 | * @param jobId 24 | * @return result 25 | */ 26 | ReturnT idleBeat(Long jobId); 27 | 28 | /** 29 | * kill 30 | * 31 | * @param jobId 32 | * @return result 33 | */ 34 | ReturnT kill(Long jobId); 35 | 36 | /** 37 | * log 38 | * 39 | * @param logDateTime start time 40 | * @param logId jobLogId 41 | * @param fromLineNum from line num 42 | * @return result 43 | */ 44 | ReturnT log(long logDateTime, Long logId, int fromLineNum); 45 | 46 | /** 47 | * run 48 | * 49 | * @param triggerParam trigger 50 | * @return result 51 | */ 52 | ReturnT run(TriggerParam triggerParam); 53 | 54 | } 55 | -------------------------------------------------------------------------------- /smart-job-core/src/main/java/cn/smartcoding/job/core/biz/JobBiz.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.job.core.biz; 2 | 3 | import cn.smartcoding.job.core.biz.model.JobGroupParam; 4 | import cn.smartcoding.job.core.biz.model.JobInfoParam; 5 | import cn.smartcoding.job.core.biz.model.ReturnT; 6 | 7 | /** 8 | * @author xuxueli 2017-07-27 21:52:49 9 | */ 10 | public interface JobBiz { 11 | 12 | // ---------------------- registry ---------------------- 13 | 14 | /** 15 | * registry 16 | * 17 | * @param jobGroupParam 18 | * @return 19 | */ 20 | ReturnT registryJobGroup(JobGroupParam jobGroupParam); 21 | 22 | /** 23 | * registry remove 24 | * 25 | * @param jobInfoParam 26 | * @return 27 | */ 28 | ReturnT registryJobInfo(JobInfoParam jobInfoParam); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /smart-job-core/src/main/java/cn/smartcoding/job/core/biz/JobConst.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.job.core.biz; 2 | 3 | public interface JobConst { 4 | 5 | String CLIENT_VERSION = "2.3.1"; 6 | } 7 | -------------------------------------------------------------------------------- /smart-job-core/src/main/java/cn/smartcoding/job/core/biz/model/LogResult.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.job.core.biz.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Created by xuxueli on 17/3/23. 7 | */ 8 | public class LogResult implements Serializable { 9 | private static final long serialVersionUID = 42L; 10 | 11 | public LogResult(int fromLineNum, int toLineNum, String logContent, boolean isEnd) { 12 | this.fromLineNum = fromLineNum; 13 | this.toLineNum = toLineNum; 14 | this.logContent = logContent; 15 | this.isEnd = isEnd; 16 | } 17 | 18 | private int fromLineNum; 19 | private int toLineNum; 20 | private String logContent; 21 | private boolean isEnd; 22 | 23 | public int getFromLineNum() { 24 | return fromLineNum; 25 | } 26 | 27 | public void setFromLineNum(int fromLineNum) { 28 | this.fromLineNum = fromLineNum; 29 | } 30 | 31 | public int getToLineNum() { 32 | return toLineNum; 33 | } 34 | 35 | public void setToLineNum(int toLineNum) { 36 | this.toLineNum = toLineNum; 37 | } 38 | 39 | public String getLogContent() { 40 | return logContent; 41 | } 42 | 43 | public void setLogContent(String logContent) { 44 | this.logContent = logContent; 45 | } 46 | 47 | public boolean isEnd() { 48 | return isEnd; 49 | } 50 | 51 | public void setEnd(boolean end) { 52 | isEnd = end; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /smart-job-core/src/main/java/cn/smartcoding/job/core/cron/ValueSet.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.job.core.cron; 2 | 3 | class ValueSet { 4 | public int value; 5 | 6 | public int pos; 7 | } 8 | -------------------------------------------------------------------------------- /smart-job-core/src/main/java/cn/smartcoding/job/core/enums/ExecutorBlockStrategyEnum.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.job.core.enums; 2 | 3 | /** 4 | * Created by xuxueli on 17/5/9. 5 | */ 6 | public enum ExecutorBlockStrategyEnum { 7 | 8 | SERIAL_EXECUTION("Serial execution"), 9 | /*CONCURRENT_EXECUTION("并行"),*/ 10 | DISCARD_LATER("Discard Later"), 11 | COVER_EARLY("Cover Early"); 12 | 13 | private String title; 14 | 15 | private ExecutorBlockStrategyEnum(String title) { 16 | this.title = title; 17 | } 18 | 19 | public void setTitle(String title) { 20 | this.title = title; 21 | } 22 | 23 | public String getTitle() { 24 | return title; 25 | } 26 | 27 | public static ExecutorBlockStrategyEnum match(String name, ExecutorBlockStrategyEnum defaultItem) { 28 | if (name != null) { 29 | for (ExecutorBlockStrategyEnum item : ExecutorBlockStrategyEnum.values()) { 30 | if (item.name().equals(name)) { 31 | return item; 32 | } 33 | } 34 | } 35 | return defaultItem; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /smart-job-core/src/main/java/cn/smartcoding/job/core/enums/RegistryConfig.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.job.core.enums; 2 | 3 | /** 4 | * Created by xuxueli on 17/5/10. 5 | */ 6 | public class RegistryConfig { 7 | 8 | public static final int BEAT_TIMEOUT = 30; 9 | //超时 10 | public static final int DEAD_TIMEOUT = BEAT_TIMEOUT * 3; 11 | 12 | public enum RegistType {EXECUTOR, ADMIN} 13 | 14 | } 15 | -------------------------------------------------------------------------------- /smart-job-core/src/main/java/cn/smartcoding/job/core/glue/GlueTypeEnum.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.job.core.glue; 2 | 3 | /** 4 | * Created by xuxueli on 17/4/26. 5 | */ 6 | public enum GlueTypeEnum { 7 | 8 | BEAN("BEAN", false, null, null), 9 | GLUE_GROOVY("GLUE(Java)", false, null, null), 10 | GLUE_SHELL("GLUE(Shell)", true, "bash", ".sh"), 11 | GLUE_PYTHON("GLUE(Python)", true, "python", ".py"), 12 | GLUE_PHP("GLUE(PHP)", true, "php", ".php"), 13 | GLUE_NODEJS("GLUE(Nodejs)", true, "node", ".js"), 14 | GLUE_POWERSHELL("GLUE(PowerShell)", true, "powershell ", ".ps1"); 15 | 16 | private String desc; 17 | private boolean isScript; 18 | private String cmd; 19 | private String suffix; 20 | 21 | private GlueTypeEnum(String desc, boolean isScript, String cmd, String suffix) { 22 | this.desc = desc; 23 | this.isScript = isScript; 24 | this.cmd = cmd; 25 | this.suffix = suffix; 26 | } 27 | 28 | public String getDesc() { 29 | return desc; 30 | } 31 | 32 | public boolean isScript() { 33 | return isScript; 34 | } 35 | 36 | public String getCmd() { 37 | return cmd; 38 | } 39 | 40 | public String getSuffix() { 41 | return suffix; 42 | } 43 | 44 | public static GlueTypeEnum match(String name) { 45 | for (GlueTypeEnum item : GlueTypeEnum.values()) { 46 | if (item.name().equals(name)) { 47 | return item; 48 | } 49 | } 50 | return null; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /smart-job-core/src/main/java/cn/smartcoding/job/core/handler/IJobHandler.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.job.core.handler; 2 | 3 | import cn.smartcoding.job.core.biz.model.ReturnT; 4 | 5 | import java.lang.reflect.InvocationTargetException; 6 | 7 | /** 8 | * job handler 9 | * 10 | * @author xuxueli 2015-12-19 19:06:38 11 | */ 12 | public abstract class IJobHandler { 13 | 14 | 15 | /** 16 | * success 17 | */ 18 | public static final ReturnT SUCCESS = new ReturnT(200, "success"); 19 | /** 20 | * fail 21 | */ 22 | public static final ReturnT FAIL = new ReturnT(500, "fail"); 23 | /** 24 | * fail timeout 25 | */ 26 | public static final ReturnT FAIL_TIMEOUT = new ReturnT(502, "fail timeout"); 27 | 28 | 29 | /** 30 | * execute handler, invoked when executor receives a scheduling request 31 | * 32 | * @param param param 33 | * @return execute result 34 | * @throws Exception 35 | */ 36 | public abstract ReturnT execute(String param) throws Exception; 37 | 38 | /** 39 | * init handler, invoked when JobThread initJobThread 40 | */ 41 | public void init() throws InvocationTargetException, IllegalAccessException { 42 | // do something 43 | } 44 | 45 | 46 | /** 47 | * destroy handler, invoked when JobThread destroy 48 | */ 49 | public void destroy() throws InvocationTargetException, IllegalAccessException { 50 | // do something 51 | } 52 | 53 | 54 | } 55 | -------------------------------------------------------------------------------- /smart-job-core/src/main/java/cn/smartcoding/job/core/handler/annotation/JobHandler.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.job.core.handler.annotation; 2 | 3 | 4 | import java.lang.annotation.*; 5 | 6 | /** 7 | * annotation for job handler 8 | * 9 | * @author 2016-5-17 21:06:49 10 | */ 11 | @Target({ElementType.TYPE}) 12 | @Retention(RetentionPolicy.RUNTIME) 13 | @Inherited 14 | public @interface JobHandler { 15 | 16 | String value() default ""; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /smart-job-core/src/main/java/cn/smartcoding/job/core/handler/annotation/JobMethodHandler.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.job.core.handler.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * annotation for method jobhandler 7 | * 8 | * @author xuxueli 2019-12-11 20:50:13 9 | */ 10 | @Target({ElementType.METHOD}) 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Inherited 13 | public @interface JobMethodHandler { 14 | 15 | /** 16 | * jobhandler name 17 | */ 18 | String value() default ""; 19 | 20 | /** 21 | * init handler, invoked when JobThread init 22 | */ 23 | String init() default ""; 24 | 25 | /** 26 | * destroy handler, invoked when JobThread destroy 27 | */ 28 | String destroy() default ""; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /smart-job-core/src/main/java/cn/smartcoding/job/core/handler/impl/GlueJobHandler.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.job.core.handler.impl; 2 | 3 | import cn.smartcoding.job.core.biz.model.ReturnT; 4 | import cn.smartcoding.job.core.handler.IJobHandler; 5 | import cn.smartcoding.job.core.log.XxlJobLogger; 6 | 7 | /** 8 | * glue job handler 9 | * 10 | * @author xuxueli 2016-5-19 21:05:45 11 | */ 12 | public class GlueJobHandler extends IJobHandler { 13 | 14 | private Long glueUpdateTime; 15 | private IJobHandler jobHandler; 16 | 17 | public GlueJobHandler(IJobHandler jobHandler, Long glueUpdateTime) { 18 | this.jobHandler = jobHandler; 19 | this.glueUpdateTime = glueUpdateTime; 20 | } 21 | 22 | public Long getGlueUpdateTime() { 23 | return glueUpdateTime; 24 | } 25 | 26 | @Override 27 | public ReturnT execute(String param) throws Exception { 28 | XxlJobLogger.log("----------- glue.version:" + glueUpdateTime + " -----------"); 29 | return jobHandler.execute(param); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /smart-job-core/src/main/java/cn/smartcoding/job/core/log/LogLevel.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.job.core.log; 2 | 3 | /** 4 | * 日志的等级 5 | * 6 | * @author 无缺 7 | * @date 2019-08-04 8 | */ 9 | public enum LogLevel { 10 | INFO, 11 | DEBUG, 12 | WARN, 13 | ERROR 14 | } 15 | -------------------------------------------------------------------------------- /smart-job-core/src/main/java/cn/smartcoding/job/core/util/ShardingUtil.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.job.core.util; 2 | 3 | /** 4 | * sharding vo 5 | * 6 | * @author xuxueli 2017-07-25 21:26:38 7 | */ 8 | public class ShardingUtil { 9 | 10 | private static InheritableThreadLocal contextHolder = new InheritableThreadLocal(); 11 | 12 | public static class ShardingVO { 13 | 14 | private int index; // sharding index 15 | private int total; // sharding total 16 | 17 | public ShardingVO(int index, int total) { 18 | this.index = index; 19 | this.total = total; 20 | } 21 | 22 | public int getIndex() { 23 | return index; 24 | } 25 | 26 | public void setIndex(int index) { 27 | this.index = index; 28 | } 29 | 30 | public int getTotal() { 31 | return total; 32 | } 33 | 34 | public void setTotal(int total) { 35 | this.total = total; 36 | } 37 | } 38 | 39 | public static void setShardingVo(ShardingVO shardingVo) { 40 | contextHolder.set(shardingVo); 41 | } 42 | 43 | public static ShardingVO getShardingVo() { 44 | return contextHolder.get(); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /smart-job-core/src/main/java/cn/smartcoding/job/core/util/UUIDUtils.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.job.core.util; 2 | 3 | import java.util.UUID; 4 | 5 | /** 6 | * UUID工具类 7 | * 8 | * @author wuque 9 | * @date 04/05/2017 10 | */ 11 | public class UUIDUtils { 12 | 13 | public static String generateUUID() { 14 | return UUID.randomUUID().toString().replaceAll("-", ""); 15 | } 16 | 17 | /** 18 | * 生成纯数字UUID 19 | * 20 | * @return 8位数UUID 21 | */ 22 | public static String generateUUID(int num) { 23 | String uid = generateUUID(); 24 | return uid.substring(0, num); 25 | } 26 | 27 | /** 28 | * 生成8位纯数字UUID 29 | * 30 | * @return 8位数UUID 31 | */ 32 | public static String generateEightUUID() { 33 | long uid = UUID.randomUUID().getMostSignificantBits(); 34 | if (uid < 0) { 35 | uid = -uid; 36 | } 37 | String str = "" + uid; 38 | str = str.substring(0, 8); 39 | return str; 40 | } 41 | 42 | /** 43 | * 生成4位纯数字UUID 44 | * 45 | * @return 8位数UUID 46 | */ 47 | public static String generateFourUUID() { 48 | long uid = UUID.randomUUID().getMostSignificantBits(); 49 | if (uid < 0) { 50 | uid = -uid; 51 | } 52 | String str = "" + uid; 53 | str = str.substring(0, 4); 54 | return str; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /smart-job-framework/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/smart-job-framework/.DS_Store -------------------------------------------------------------------------------- /smart-job-framework/src/main/java/cn/smartcoding/framework/config/ApplicationConfig.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.framework.config; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.context.annotation.EnableAspectJAutoProxy; 8 | 9 | import java.util.TimeZone; 10 | 11 | /** 12 | * 程序注解配置 13 | * 14 | * @author wuque 15 | */ 16 | @Configuration 17 | // 表示通过aop框架暴露该代理对象,AopContext能够访问 18 | @EnableAspectJAutoProxy(exposeProxy = true) 19 | // 指定要扫描的Mapper类的包的路径 20 | @MapperScan("cn.smartcoding.**.mapper") 21 | public class ApplicationConfig { 22 | /** 23 | * 时区配置 24 | */ 25 | @Bean 26 | public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization() { 27 | return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /smart-job-framework/src/main/java/cn/smartcoding/framework/config/CaptchaConfig.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.framework.config; 2 | 3 | import cn.smartcoding.framework.config.properties.CaptchaProperties; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | /** 9 | * 验证码配置 10 | * 11 | * @author wuque 12 | */ 13 | @Configuration 14 | public class CaptchaConfig { 15 | 16 | @Bean 17 | @ConfigurationProperties(prefix = "login", ignoreUnknownFields = true) 18 | public CaptchaProperties captchaProperties() { 19 | return new CaptchaProperties(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /smart-job-framework/src/main/java/cn/smartcoding/framework/config/ServerConfig.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.framework.config; 2 | 3 | import cn.smartcoding.common.utils.ServletUtils; 4 | import org.springframework.stereotype.Component; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | 8 | /** 9 | * 服务相关配置 10 | * 11 | * @author wuque 12 | */ 13 | @Component 14 | public class ServerConfig { 15 | /** 16 | * 获取完整的请求路径,包括:域名,端口,上下文访问路径 17 | * 18 | * @return 服务地址 19 | */ 20 | public String getUrl() { 21 | HttpServletRequest request = ServletUtils.getRequest(); 22 | return getDomain(request); 23 | } 24 | 25 | public static String getDomain(HttpServletRequest request) { 26 | StringBuffer url = request.getRequestURL(); 27 | String contextPath = request.getServletContext().getContextPath(); 28 | return url.delete(url.length() - request.getRequestURI().length(), url.length()).append(contextPath).toString(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /smart-job-framework/src/main/java/cn/smartcoding/framework/datasource/DynamicDataSource.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.framework.datasource; 2 | 3 | import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; 4 | 5 | import javax.sql.DataSource; 6 | import java.util.Map; 7 | 8 | /** 9 | * 动态数据源 10 | * 11 | * @author wuque 12 | */ 13 | public class DynamicDataSource extends AbstractRoutingDataSource { 14 | public DynamicDataSource(DataSource defaultTargetDataSource, Map targetDataSources) { 15 | super.setDefaultTargetDataSource(defaultTargetDataSource); 16 | super.setTargetDataSources(targetDataSources); 17 | super.afterPropertiesSet(); 18 | } 19 | 20 | @Override 21 | protected Object determineCurrentLookupKey() { 22 | return DynamicDataSourceContextHolder.getDataSourceType(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /smart-job-framework/src/main/java/cn/smartcoding/framework/datasource/DynamicDataSourceContextHolder.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.framework.datasource; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | /** 7 | * 数据源切换处理 8 | * 9 | * @author wuque 10 | */ 11 | public class DynamicDataSourceContextHolder { 12 | public static final Logger log = LoggerFactory.getLogger(DynamicDataSourceContextHolder.class); 13 | 14 | /** 15 | * 使用ThreadLocal维护变量,ThreadLocal为每个使用该变量的线程提供独立的变量副本, 16 | * 所以每一个线程都可以独立地改变自己的副本,而不会影响其它线程所对应的副本。 17 | */ 18 | private static final ThreadLocal CONTEXT_HOLDER = new ThreadLocal<>(); 19 | 20 | /** 21 | * 设置数据源的变量 22 | */ 23 | public static void setDataSourceType(String dsType) { 24 | log.info("切换到{}数据源", dsType); 25 | CONTEXT_HOLDER.set(dsType); 26 | } 27 | 28 | /** 29 | * 获得数据源的变量 30 | */ 31 | public static String getDataSourceType() { 32 | return CONTEXT_HOLDER.get(); 33 | } 34 | 35 | /** 36 | * 清空数据源变量 37 | */ 38 | public static void clearDataSourceType() { 39 | CONTEXT_HOLDER.remove(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /smart-job-framework/src/main/java/cn/smartcoding/framework/manager/AsyncManager.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.framework.manager; 2 | 3 | import cn.smartcoding.common.utils.Threads; 4 | import cn.smartcoding.common.utils.spring.SpringUtils; 5 | 6 | import java.util.TimerTask; 7 | import java.util.concurrent.ScheduledExecutorService; 8 | import java.util.concurrent.TimeUnit; 9 | 10 | /** 11 | * 异步任务管理器 12 | * 13 | * @author wuque 14 | */ 15 | public class AsyncManager { 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 | 32 | private static AsyncManager me = new AsyncManager(); 33 | 34 | public static AsyncManager me() { 35 | return me; 36 | } 37 | 38 | /** 39 | * 执行任务 40 | * 41 | * @param task 任务 42 | */ 43 | public void execute(TimerTask task) { 44 | executor.schedule(task, OPERATE_DELAY_TIME, TimeUnit.MILLISECONDS); 45 | } 46 | 47 | /** 48 | * 停止任务线程池 49 | */ 50 | public void shutdown() { 51 | Threads.shutdownAndAwaitTermination(executor); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /smart-job-framework/src/main/java/cn/smartcoding/framework/manager/ShutdownManager.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.framework.manager; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.stereotype.Component; 6 | 7 | import javax.annotation.PreDestroy; 8 | 9 | /** 10 | * 确保应用退出时能关闭后台线程 11 | * 12 | * @author wuque 13 | */ 14 | @Component 15 | public class ShutdownManager { 16 | private static final Logger logger = LoggerFactory.getLogger("sys-user"); 17 | 18 | @PreDestroy 19 | public void destroy() { 20 | shutdownAsyncManager(); 21 | } 22 | 23 | /** 24 | * 停止异步执行任务 25 | */ 26 | private void shutdownAsyncManager() { 27 | try { 28 | logger.info("====关闭后台任务任务线程池===="); 29 | AsyncManager.me().shutdown(); 30 | } catch (Exception e) { 31 | logger.error(e.getMessage(), e); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /smart-job-framework/src/main/java/cn/smartcoding/framework/web/domain/server/Mem.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.framework.web.domain.server; 2 | 3 | import cn.smartcoding.common.utils.Arith; 4 | 5 | /** 6 | * 內存相关信息 7 | * 8 | * @author wuque 9 | */ 10 | public class Mem { 11 | /** 12 | * 内存总量 13 | */ 14 | private double total; 15 | 16 | /** 17 | * 已用内存 18 | */ 19 | private double used; 20 | 21 | /** 22 | * 剩余内存 23 | */ 24 | private double free; 25 | 26 | public double getTotal() { 27 | return Arith.div(total, (1024 * 1024 * 1024), 2); 28 | } 29 | 30 | public void setTotal(long total) { 31 | this.total = total; 32 | } 33 | 34 | public double getUsed() { 35 | return Arith.div(used, (1024 * 1024 * 1024), 2); 36 | } 37 | 38 | public void setUsed(long used) { 39 | this.used = used; 40 | } 41 | 42 | public double getFree() { 43 | return Arith.div(free, (1024 * 1024 * 1024), 2); 44 | } 45 | 46 | public void setFree(long free) { 47 | this.free = free; 48 | } 49 | 50 | public double getUsage() { 51 | return Arith.mul(Arith.div(used, total, 4), 100); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /smart-job-framework/src/main/java/cn/smartcoding/framework/web/domain/server/Sys.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.framework.web.domain.server; 2 | 3 | /** 4 | * 系统相关信息 5 | * 6 | * @author wuque 7 | */ 8 | public class Sys { 9 | /** 10 | * 服务器名称 11 | */ 12 | private String computerName; 13 | 14 | /** 15 | * 服务器Ip 16 | */ 17 | private String computerIp; 18 | 19 | /** 20 | * 项目路径 21 | */ 22 | private String userDir; 23 | 24 | /** 25 | * 操作系统 26 | */ 27 | private String osName; 28 | 29 | /** 30 | * 系统架构 31 | */ 32 | private String osArch; 33 | 34 | public String getComputerName() { 35 | return computerName; 36 | } 37 | 38 | public void setComputerName(String computerName) { 39 | this.computerName = computerName; 40 | } 41 | 42 | public String getComputerIp() { 43 | return computerIp; 44 | } 45 | 46 | public void setComputerIp(String computerIp) { 47 | this.computerIp = computerIp; 48 | } 49 | 50 | public String getUserDir() { 51 | return userDir; 52 | } 53 | 54 | public void setUserDir(String userDir) { 55 | this.userDir = userDir; 56 | } 57 | 58 | public String getOsName() { 59 | return osName; 60 | } 61 | 62 | public void setOsName(String osName) { 63 | this.osName = osName; 64 | } 65 | 66 | public String getOsArch() { 67 | return osArch; 68 | } 69 | 70 | public void setOsArch(String osArch) { 71 | this.osArch = osArch; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /smart-job-generator/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/smart-job-generator/.DS_Store -------------------------------------------------------------------------------- /smart-job-generator/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | smart-job 7 | cn.smartcoding 8 | 1.0.0 9 | 10 | 4.0.0 11 | 12 | smart-job-generator 13 | 14 | 15 | generator代码生成 16 | 17 | 18 | 19 | 20 | 21 | 22 | org.apache.velocity 23 | velocity 24 | 25 | 26 | 27 | 28 | cn.smartcoding 29 | smart-job-common 30 | 31 | 32 | cn.hutool 33 | hutool-all 34 | 5.4.2 35 | compile 36 | 37 | 38 | org.apache.commons 39 | commons-text 40 | 1.9 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /smart-job-generator/src/main/java/cn/smartcoding/generator/mapper/GenTableColumnMapper.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.generator.mapper; 2 | 3 | import cn.smartcoding.generator.domain.GenTableColumn; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 业务字段 数据层 9 | * 10 | * @author wuque 11 | */ 12 | public interface GenTableColumnMapper { 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 ids 需要删除的数据ID 49 | * @return 结果 50 | */ 51 | public int deleteGenTableColumnByIds(Long[] ids); 52 | } 53 | -------------------------------------------------------------------------------- /smart-job-generator/src/main/java/cn/smartcoding/generator/service/IGenTableColumnService.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.generator.service; 2 | 3 | import cn.smartcoding.generator.domain.GenTableColumn; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 业务字段 服务层 9 | * 10 | * @author wuque 11 | */ 12 | public interface IGenTableColumnService { 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 | -------------------------------------------------------------------------------- /smart-job-generator/src/main/java/cn/smartcoding/generator/util/VelocityInitializer.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.generator.util; 2 | 3 | import cn.smartcoding.common.constant.Constants; 4 | import org.apache.velocity.app.Velocity; 5 | 6 | import java.util.Properties; 7 | 8 | /** 9 | * VelocityEngine工厂 10 | * 11 | * @author RuoYi 12 | */ 13 | public class VelocityInitializer { 14 | /** 15 | * 初始化vm方法 16 | */ 17 | public static void initVelocity() { 18 | Properties p = new Properties(); 19 | try { 20 | // 加载classpath目录下的vm文件 21 | p.setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); 22 | // 定义字符集 23 | p.setProperty(Velocity.ENCODING_DEFAULT, Constants.UTF8); 24 | p.setProperty(Velocity.OUTPUT_ENCODING, Constants.UTF8); 25 | // 初始化Velocity引擎,指定配置Properties 26 | Velocity.init(p); 27 | } catch (Exception e) { 28 | throw new RuntimeException(e); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /smart-job-generator/src/main/java/cn/smartcoding/generator/util/test.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.generator.util; 2 | 3 | import org.apache.commons.text.StringSubstitutor; 4 | 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | 8 | public class test { 9 | 10 | public static void main(String[] args) { 11 | // TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("templates", TemplateConfig.ResourceMode.STRING)); 12 | // 13 | ////假设我们引入的是Beetl引擎,则: 14 | // Template template = engine.getTemplate("Hello ${name}"); 15 | ////Dict本质上为Map,此处可用Map 16 | // String result = template.render(Dict.create().set("name", "Hutool")); 17 | // System.out.println("result = " + result); 18 | 19 | Map valuesMap = new HashMap(); 20 | valuesMap.put("animal", "quick brown fox"); 21 | valuesMap.put("target", "lazy dog"); 22 | String templateString = "The ${animal:kkkkk} jumped over the ${target}."; 23 | StringSubstitutor sub = new StringSubstitutor(valuesMap); 24 | sub.setValueDelimiter(":"); 25 | String resolvedString = sub.replace(templateString); 26 | System.out.println("result = " + resolvedString); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /smart-job-generator/src/main/resources/generator.yml: -------------------------------------------------------------------------------- 1 | # 代码生成 2 | gen: 3 | # 作者 4 | author: wuque 5 | # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool 6 | packageName: com.smartcoding.system 7 | # 自动去除表前缀,默认是false 8 | autoRemovePre: false 9 | # 表前缀(生成类名不会包含表前缀,多个用逗号分隔) 10 | tablePrefix: sys_ 11 | -------------------------------------------------------------------------------- /smart-job-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 | 46 | // 导出${functionName} 47 | export function export${BusinessName}(query) { 48 | return request({ 49 | url: '/${moduleName}/${businessName}/export', 50 | method: 'get', 51 | params: query 52 | }) 53 | } -------------------------------------------------------------------------------- /smart-job-schedule/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/smart-job-schedule/.DS_Store -------------------------------------------------------------------------------- /smart-job-schedule/src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/smart-job-schedule/src/.DS_Store -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/alarm/AlarmManager.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.schedule.core.alarm; 2 | 3 | public interface AlarmManager { 4 | AlarmResult sendAlarm(AlarmParam alarmParam); 5 | 6 | AlarmResult testSendAlarm(AlarmParam alarmParam); 7 | } 8 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/alarm/AlarmParam.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.schedule.core.alarm; 2 | 3 | import cn.smartcoding.common.core.domain.entity.SysUser; 4 | import cn.smartcoding.schedule.core.model.XxlAlarmInfo; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.time.LocalDate; 9 | import java.time.LocalDateTime; 10 | import java.util.List; 11 | 12 | @Data 13 | public class AlarmParam implements Serializable { 14 | private Long jobId; 15 | private Long jobLogId; 16 | private String jobName; 17 | private String alarmContent; 18 | private String executorAddress; 19 | private String alarmTitle; 20 | private Integer handleCode; 21 | private Integer triggerType; 22 | private String appName; 23 | private LocalDateTime alarmTime; 24 | private LocalDate date; 25 | private JobAlarmEnum jobAlarmEnum; 26 | private XxlAlarmInfo alarmInfo; 27 | private List noticeUserList; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/alarm/AlarmResult.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.schedule.core.alarm; 2 | 3 | import java.util.Date; 4 | 5 | public interface AlarmResult { 6 | 7 | boolean getSendStatus(); 8 | 9 | String getErrorMsg(); 10 | 11 | Date getSendDate(); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/alarm/DefaultAlarmResult.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.schedule.core.alarm; 2 | 3 | import java.util.Date; 4 | 5 | public class DefaultAlarmResult implements AlarmResult { 6 | private Boolean sendStatus; 7 | private String errorMsg; 8 | private Date sendDate; 9 | 10 | public DefaultAlarmResult(Boolean sendStatus, String errorMsg) { 11 | this.sendStatus = sendStatus; 12 | this.errorMsg = errorMsg; 13 | this.sendDate = new Date(); 14 | } 15 | 16 | public DefaultAlarmResult(Boolean sendStatus, String errorMsg, Date sendDate) { 17 | this.sendStatus = sendStatus; 18 | this.errorMsg = errorMsg; 19 | this.sendDate = sendDate; 20 | } 21 | 22 | @Override 23 | public boolean getSendStatus() { 24 | return Boolean.TRUE.equals(sendStatus); 25 | } 26 | 27 | @Override 28 | public String getErrorMsg() { 29 | return errorMsg; 30 | } 31 | 32 | @Override 33 | public Date getSendDate() { 34 | return sendDate; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/alarm/DefaultFailAlarmResult.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.schedule.core.alarm; 2 | 3 | 4 | import java.util.Date; 5 | 6 | /** 7 | * @author wuque 8 | */ 9 | public class DefaultFailAlarmResult implements AlarmResult { 10 | 11 | private String errorMsg; 12 | 13 | public DefaultFailAlarmResult(String errorMsg) { 14 | this.errorMsg = errorMsg; 15 | } 16 | 17 | @Override 18 | public boolean getSendStatus() { 19 | return false; 20 | } 21 | 22 | @Override 23 | public String getErrorMsg() { 24 | return errorMsg; 25 | } 26 | 27 | @Override 28 | public Date getSendDate() { 29 | return new Date(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/alarm/JobAlarm.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.schedule.core.alarm; 2 | 3 | import cn.smartcoding.schedule.core.exception.AlarmFailException; 4 | 5 | public interface JobAlarm { 6 | 7 | /** 8 | * send alarm 9 | * 10 | * @param alarmParam 11 | * @return 12 | */ 13 | AlarmResult sendAlarm(AlarmParam alarmParam) throws AlarmFailException; 14 | 15 | /** 16 | * support type 17 | * 18 | * @param jobAlarmEnum 19 | * @return 20 | */ 21 | boolean support(JobAlarmEnum jobAlarmEnum); 22 | } 23 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/alarm/JobAlarmEnum.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.schedule.core.alarm; 2 | 3 | public enum JobAlarmEnum { 4 | 5 | /** 6 | * 邮箱 7 | */ 8 | EMAIL("email","邮箱"), 9 | /** 10 | * 钉钉 11 | */ 12 | DING_DING("dingDing","钉钉"), 13 | /** 14 | * 企业微信 15 | */ 16 | WX_WECHAT("wxWechat","企业微信"), 17 | /** 18 | * 飞书 19 | */ 20 | feishu("feishu","飞书"), 21 | /** 22 | * 短信 23 | */ 24 | SMS("sms","短信"), 25 | /** 26 | * 电话 27 | */ 28 | MOBILE("mobile","电话"),; 29 | 30 | JobAlarmEnum(String code,String title) { 31 | this.code = code; 32 | this.title = title; 33 | } 34 | 35 | private String code; 36 | 37 | private String title; 38 | 39 | public String getCode() { 40 | return code; 41 | } 42 | 43 | 44 | public String getTitle() { 45 | return title; 46 | } 47 | 48 | 49 | public static JobAlarmEnum match(String name, JobAlarmEnum defaultItem) { 50 | if (name != null) { 51 | for (JobAlarmEnum item : JobAlarmEnum.values()) { 52 | if (item.code.equals(name)) { 53 | return item; 54 | } 55 | } 56 | } 57 | return defaultItem; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/alarm/impl/MobileJobAlarm.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.schedule.core.alarm.impl; 2 | 3 | import cn.smartcoding.common.core.domain.entity.SysUser; 4 | import cn.smartcoding.schedule.core.alarm.AbstractJobAlarm; 5 | import cn.smartcoding.schedule.core.alarm.AlarmResult; 6 | import cn.smartcoding.schedule.core.alarm.JobAlarmEnum; 7 | import cn.smartcoding.schedule.core.exception.AlarmFailException; 8 | import cn.smartcoding.schedule.core.model.XxlAlarmInfo; 9 | import lombok.extern.slf4j.Slf4j; 10 | import org.springframework.core.annotation.Order; 11 | import org.springframework.stereotype.Component; 12 | 13 | import java.util.List; 14 | 15 | @Slf4j 16 | @Component 17 | @Order(4) 18 | public class MobileJobAlarm extends AbstractJobAlarm { 19 | 20 | 21 | @Override 22 | public AlarmResult sendAlarm(XxlAlarmInfo alarmInfo, List noticeUserList, String sendContent) throws AlarmFailException { 23 | throw new AlarmFailException("手机告警暂未实现"); 24 | } 25 | 26 | @Override 27 | public boolean support(JobAlarmEnum jobAlarmEnum) { 28 | return JobAlarmEnum.MOBILE.equals(jobAlarmEnum); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/alarm/impl/SmsJobAlarm.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.schedule.core.alarm.impl; 2 | 3 | import cn.smartcoding.common.core.domain.entity.SysUser; 4 | import cn.smartcoding.schedule.core.alarm.AbstractJobAlarm; 5 | import cn.smartcoding.schedule.core.alarm.AlarmResult; 6 | import cn.smartcoding.schedule.core.alarm.JobAlarmEnum; 7 | import cn.smartcoding.schedule.core.exception.AlarmFailException; 8 | import cn.smartcoding.schedule.core.model.XxlAlarmInfo; 9 | import lombok.extern.slf4j.Slf4j; 10 | import org.springframework.core.annotation.Order; 11 | import org.springframework.stereotype.Component; 12 | 13 | import java.util.List; 14 | 15 | @Slf4j 16 | @Component 17 | @Order(3) 18 | public class SmsJobAlarm extends AbstractJobAlarm { 19 | 20 | @Override 21 | public AlarmResult sendAlarm(XxlAlarmInfo alarmInfo, List noticeUserList, String sendContent) throws AlarmFailException { 22 | throw new AlarmFailException("短信告警暂未实现"); 23 | } 24 | 25 | @Override 26 | public boolean support(JobAlarmEnum jobAlarmEnum) { 27 | return JobAlarmEnum.SMS.equals(jobAlarmEnum); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/enums/AddressOnlineEnum.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.enums; 4 | 5 | /** 6 | * @author 无缺 7 | * @date 2019-07-10 8 | */ 9 | public enum AddressOnlineEnum { 10 | /** 11 | * 离线 12 | */ 13 | OFFLINE(0,"离线"), 14 | /** 15 | * 在线 16 | */ 17 | ONLINE(1,"在线"), 18 | ; 19 | 20 | AddressOnlineEnum(Integer code, String title) { 21 | this.code = code; 22 | this.title = title; 23 | } 24 | 25 | private Integer code; 26 | private String title; 27 | public String getTitle() { 28 | return title; 29 | } 30 | 31 | public Integer getCode() { 32 | return code; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/enums/AddressTypeEnum.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.enums; 4 | 5 | /** 6 | * 注册方式 7 | * @author 无缺 8 | * @date 2019-07-10 9 | */ 10 | public enum AddressTypeEnum { 11 | /** 12 | * 自动注册 13 | */ 14 | AUTO(0,"自动注册"), 15 | /** 16 | * 手动录入 17 | */ 18 | ADD(1,"手动录入"), 19 | ; 20 | 21 | AddressTypeEnum(Integer code, String title) { 22 | this.code = code; 23 | this.title = title; 24 | } 25 | 26 | private Integer code; 27 | private String title; 28 | public String getTitle() { 29 | return title; 30 | } 31 | 32 | public Integer getCode() { 33 | return code; 34 | } 35 | public static AddressTypeEnum fromCode(Integer code,AddressTypeEnum defaultEnum) { 36 | 37 | AddressTypeEnum[] values = AddressTypeEnum.values(); 38 | for (AddressTypeEnum value : values) { 39 | if (value.getCode().equals(code)) { 40 | return value; 41 | } 42 | } 43 | return defaultEnum; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/enums/ExecutorWayTypeEnum.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.enums; 4 | 5 | /** 6 | * 执行方式 7 | * @author 无缺 8 | * @date 2019-07-10 9 | */ 10 | public enum ExecutorWayTypeEnum { 11 | /** 12 | * 系统 13 | */ 14 | SYSTEM(0,"系统执行"), 15 | /** 16 | * 手动执行 17 | */ 18 | MANUAL(1,"手动执行"), 19 | ; 20 | 21 | ExecutorWayTypeEnum(Integer code, String title) { 22 | this.code = code; 23 | this.title = title; 24 | } 25 | 26 | private Integer code; 27 | private String title; 28 | public String getTitle() { 29 | return title; 30 | } 31 | 32 | public Integer getCode() { 33 | return code; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/enums/JobAlarmStatusEnum.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.enums; 4 | 5 | /** 6 | * @author 无缺 7 | * @date 2019-07-10 8 | */ 9 | public enum JobAlarmStatusEnum { 10 | // 告警状态:0-默认、-1=锁定状态、1-无需告警、2-告警成功、3-告警失败 11 | /** 12 | * 默认 13 | */ 14 | DEFAULT(0,"默认"), 15 | /** 16 | * 锁定状态 17 | */ 18 | LOCK(-1,"锁定状态"), 19 | /** 20 | * 无需告警 21 | */ 22 | NO_ALARM(1,"无需告警"), 23 | /** 24 | * 告警成功 25 | */ 26 | OK(2,"告警成功"), 27 | /** 28 | * 告警失败 29 | */ 30 | FAIL(3,"告警失败") 31 | ; 32 | 33 | JobAlarmStatusEnum(Integer code, String title) { 34 | this.code = code; 35 | this.title = title; 36 | } 37 | 38 | private Integer code; 39 | private String title; 40 | public String getTitle() { 41 | return title; 42 | } 43 | 44 | public Integer getCode() { 45 | return code; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/enums/JobCreateWayEnum.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.enums; 4 | 5 | /** 6 | * 任务创建方式 7 | */ 8 | public enum JobCreateWayEnum { 9 | /** 10 | * 界面创建 11 | */ 12 | MANUAL_CREATE(0, "界面创建"), 13 | /** 14 | * API创建 15 | */ 16 | AUTO_CREATE(1, "API创建"); 17 | 18 | JobCreateWayEnum(Integer code, String title) { 19 | this.code = code; 20 | this.title = title; 21 | } 22 | 23 | private Integer code; 24 | private String title; 25 | 26 | public String getTitle() { 27 | return title; 28 | } 29 | 30 | public Integer getCode() { 31 | return code; 32 | } 33 | 34 | 35 | public static JobCreateWayEnum fromCode(Integer code, JobCreateWayEnum defaultEnum) { 36 | JobCreateWayEnum[] values = JobCreateWayEnum.values(); 37 | for (JobCreateWayEnum value : values) { 38 | if (value.getCode().equals(code)) { 39 | return value; 40 | } 41 | } 42 | return defaultEnum; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/enums/JobGroupAlarmStatusEnum.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.enums; 4 | 5 | /** 6 | * @author 无缺 7 | * @date 2019-07-10 8 | */ 9 | public enum JobGroupAlarmStatusEnum { 10 | /** 11 | * 关闭 12 | */ 13 | CLOSE(0,"关闭"), 14 | /** 15 | * 开启 16 | */ 17 | OPEN(1,"开启"), 18 | ; 19 | 20 | JobGroupAlarmStatusEnum(Integer code, String title) { 21 | this.code = code; 22 | this.title = title; 23 | } 24 | 25 | private Integer code; 26 | private String title; 27 | public String getTitle() { 28 | return title; 29 | } 30 | 31 | public Integer getCode() { 32 | return code; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/enums/JobGroupClusterEnum.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.enums; 4 | 5 | public enum JobGroupClusterEnum { 6 | /** 7 | * 开发环境 8 | */ 9 | DEV("dev", "开发环境"), 10 | /** 11 | * 测试环境 12 | */ 13 | TEST("test", "测试环境"), 14 | /** 15 | * 预发环境 16 | */ 17 | PRE("pre", "预发环境"), 18 | /** 19 | * 正式环境 20 | */ 21 | PROD("prod", "正式环境"); 22 | 23 | JobGroupClusterEnum(String type, String des) { 24 | this.type = type; 25 | this.des = des; 26 | } 27 | 28 | private String type; 29 | private String des; 30 | 31 | public String getType() { 32 | return type; 33 | } 34 | 35 | public void setType(String type) { 36 | this.type = type; 37 | } 38 | 39 | public String getDes() { 40 | return des; 41 | } 42 | 43 | public void setDes(String des) { 44 | this.des = des; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/enums/LoginWayEnum.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.enums; 4 | 5 | public enum LoginWayEnum { 6 | /** 7 | * 密码登录 8 | */ 9 | password("password", "密码登录"), 10 | /** 11 | * sso登录 12 | */ 13 | sso("sso", "sso登录"); 14 | 15 | LoginWayEnum(String type, String des) { 16 | this.type = type; 17 | this.des = des; 18 | } 19 | 20 | private String type; 21 | private String des; 22 | 23 | public String getType() { 24 | return type; 25 | } 26 | 27 | public void setType(String type) { 28 | this.type = type; 29 | } 30 | 31 | public String getDes() { 32 | return des; 33 | } 34 | 35 | public void setDes(String des) { 36 | this.des = des; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/enums/ScheduleStatusEnum.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.enums; 4 | 5 | /** 6 | * 运行状态 7 | * trigger type enum 8 | * 9 | * @author xuxueli 2018-09-16 04:56:41 10 | */ 11 | public enum ScheduleStatusEnum { 12 | /** 13 | * 关闭 14 | */ 15 | CLOSE(0, "关闭"), 16 | /** 17 | * 开启 18 | */ 19 | OPEN(1, "开启"); 20 | 21 | 22 | ScheduleStatusEnum(Integer code, String title) { 23 | this.code = code; 24 | this.title = title; 25 | } 26 | 27 | private Integer code; 28 | private String title; 29 | 30 | public String getTitle() { 31 | return title; 32 | } 33 | 34 | public Integer getCode() { 35 | return code; 36 | } 37 | 38 | public static ScheduleStatusEnum fromCode(Integer code, ScheduleStatusEnum defaultEnum) { 39 | ScheduleStatusEnum[] values = ScheduleStatusEnum.values(); 40 | for (ScheduleStatusEnum value : values) { 41 | if (value.getCode().equals(code)) { 42 | return value; 43 | } 44 | } 45 | return defaultEnum; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/exception/AlarmFailException.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.exception; 4 | 5 | /** 6 | * @author xuxueli 2019-05-04 23:19:29 7 | */ 8 | public class AlarmFailException extends RuntimeException { 9 | 10 | public AlarmFailException() { 11 | } 12 | public AlarmFailException(String message) { 13 | super(message); 14 | } 15 | 16 | public AlarmFailException(String message, Throwable cause) { 17 | super(message, cause); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/exception/XxlJobException.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.exception; 4 | 5 | /** 6 | * @author xuxueli 2019-05-04 23:19:29 7 | */ 8 | public class XxlJobException extends RuntimeException { 9 | 10 | public XxlJobException() { 11 | } 12 | public XxlJobException(String message) { 13 | super(message); 14 | } 15 | 16 | public XxlJobException(String message, Throwable cause) { 17 | super(message, cause); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/model/XxlJobLogGlue.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.model; 4 | 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.util.Date; 9 | @Data 10 | public class XxlJobLogGlue implements Serializable { 11 | private static final long serialVersionUID = 1L; 12 | /** 13 | * BIGINT(19) 必填 14 | * 15 | */ 16 | private Long id; 17 | 18 | /** 19 | * BIGINT(19) 默认值[-1] 必填 20 | * 任务,主键ID 21 | */ 22 | private Long jobId; 23 | 24 | /** 25 | * VARCHAR(50) 26 | * GLUE类型 27 | */ 28 | private String glueType; 29 | 30 | /** 31 | * VARCHAR(128) 默认值[] 必填 32 | * GLUE备注 33 | */ 34 | private String glueRemark; 35 | 36 | /** 37 | * TIMESTAMP(19) 默认值[CURRENT_TIMESTAMP] 必填 38 | * 业务添加时间 39 | */ 40 | private Date addTime; 41 | 42 | /** 43 | * TIMESTAMP(19) 默认值[0000-00-00 00:00:00] 必填 44 | * 业务更新时间 45 | */ 46 | private Date updateTime; 47 | 48 | /** 49 | * TIMESTAMP(19) 默认值[CURRENT_TIMESTAMP] 必填 50 | * 创建时间 51 | */ 52 | private Date gmtCreate; 53 | 54 | /** 55 | * TIMESTAMP(19) 默认值[CURRENT_TIMESTAMP] 必填 56 | * 修改时间 57 | */ 58 | private Date gmtModified; 59 | 60 | /** 61 | * LONGVARCHAR(16777215) 62 | * GLUE源代码 63 | */ 64 | private String glueSource; 65 | 66 | 67 | 68 | } 69 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/model/XxlJobLogReport.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.model; 4 | 5 | import com.fasterxml.jackson.annotation.JsonFormat; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | import java.util.Date; 10 | 11 | @Data 12 | public class XxlJobLogReport implements Serializable { 13 | private static final long serialVersionUID = 1L; 14 | 15 | private Long id; 16 | 17 | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") 18 | private Date triggerDay; 19 | 20 | private Long runningCount; 21 | private Long sucCount; 22 | 23 | private Long failCount; 24 | 25 | /** 26 | * TIMESTAMP(19) 默认值[CURRENT_TIMESTAMP] 必填 27 | * 创建时间 28 | */ 29 | private Date gmtCreate; 30 | 31 | /** 32 | * TIMESTAMP(19) 默认值[CURRENT_TIMESTAMP] 必填 33 | * 修改时间 34 | */ 35 | private Date gmtModified; 36 | 37 | } 38 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/model/XxlJobRegistry.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.model; 4 | 5 | import com.fasterxml.jackson.annotation.JsonFormat; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | import java.util.Date; 10 | @Data 11 | public class XxlJobRegistry implements Serializable { 12 | private static final long serialVersionUID = 1L; 13 | /** 14 | * BIGINT(19) 必填 15 | * 16 | */ 17 | private Long id; 18 | 19 | /** 20 | * VARCHAR(30) 必填 21 | * 注册分组 22 | */ 23 | private String registryGroup; 24 | 25 | /** 26 | * VARCHAR(64) 必填 27 | * 注册的key:appName 28 | */ 29 | private String registryKey; 30 | 31 | /** 32 | * VARCHAR(64) 必填 33 | * 注册的值 34 | */ 35 | private String registryValue; 36 | 37 | /** 38 | * TIMESTAMP(19) 默认值[CURRENT_TIMESTAMP] 必填 39 | * 更新时间 40 | */ 41 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 42 | private Date updateTime; 43 | 44 | /** 45 | * TIMESTAMP(19) 默认值[CURRENT_TIMESTAMP] 必填 46 | * 创建时间 47 | */ 48 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 49 | private Date gmtCreate; 50 | 51 | /** 52 | * TIMESTAMP(19) 默认值[CURRENT_TIMESTAMP] 必填 53 | * 修改时间 54 | */ 55 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 56 | private Date gmtModified; 57 | 58 | 59 | } 60 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/model/XxlJobScheduleConfig.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.schedule.core.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import lombok.Data; 5 | 6 | import java.io.Serializable; 7 | import java.util.Date; 8 | 9 | /** 10 | * 任务管理配置对象 xxl_job_schedule_config 11 | * 12 | * @author wuque 13 | * @date 2020-08-29 14 | */ 15 | @Data 16 | public class XxlJobScheduleConfig implements Serializable { 17 | private static final long serialVersionUID = 1L; 18 | 19 | /** 20 | * id 21 | */ 22 | private Long id; 23 | 24 | /** 25 | * key 26 | */ 27 | private String configKey; 28 | 29 | /** 30 | * 值 31 | */ 32 | private String configValue; 33 | 34 | /** 35 | * 状态:1 启用 0 禁用 36 | */ 37 | private Integer configStatus; 38 | 39 | /** 40 | * 创建者 41 | */ 42 | private String createBy; 43 | 44 | /** 45 | * 创建时间 46 | */ 47 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 48 | private Date createTime; 49 | 50 | /** 51 | * 更新者 52 | */ 53 | private String updateBy; 54 | 55 | /** 56 | * 更新时间 57 | */ 58 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 59 | private Date updateTime; 60 | 61 | 62 | /** 63 | * 创建时间 64 | */ 65 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 66 | private Date gmtCreate; 67 | 68 | /** 69 | * 修改时间 70 | */ 71 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 72 | private Date gmtModified; 73 | 74 | } 75 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/model/bo/JobDashbordBO.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.model.bo; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * @author 无缺 9 | * @date 2019-07-12 10 | */ 11 | public class JobDashbordBO implements Serializable { 12 | 13 | /** 14 | * 任务数量 15 | */ 16 | private int jobInfoCount; 17 | /** 18 | * 调度总次数 19 | */ 20 | private Long jobLogCount; 21 | /** 22 | * 调度成功次数 23 | */ 24 | private Long jobLogSuccessCount; 25 | /** 26 | * 执行器数量 27 | */ 28 | private int executorCount; 29 | 30 | public int getJobInfoCount() { 31 | return jobInfoCount; 32 | } 33 | 34 | public void setJobInfoCount(int jobInfoCount) { 35 | this.jobInfoCount = jobInfoCount; 36 | } 37 | 38 | public Long getJobLogCount() { 39 | return jobLogCount; 40 | } 41 | 42 | public void setJobLogCount(Long jobLogCount) { 43 | this.jobLogCount = jobLogCount; 44 | } 45 | 46 | public Long getJobLogSuccessCount() { 47 | return jobLogSuccessCount; 48 | } 49 | 50 | public void setJobLogSuccessCount(Long jobLogSuccessCount) { 51 | this.jobLogSuccessCount = jobLogSuccessCount; 52 | } 53 | 54 | public int getExecutorCount() { 55 | return executorCount; 56 | } 57 | 58 | public void setExecutorCount(int executorCount) { 59 | this.executorCount = executorCount; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/model/bo/XxlJobGroupBO.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.model.bo; 4 | 5 | import cn.hutool.core.util.StrUtil; 6 | import cn.smartcoding.schedule.core.model.XxlJobGroup; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * @author 无缺 12 | * @date 2019-07-10 13 | */ 14 | public class XxlJobGroupBO extends XxlJobGroup { 15 | 16 | //执行器地址列表(系统注册) 17 | private List registryList; 18 | 19 | public List getRegistryList() { 20 | String addressList = super.getAddressList(); 21 | registryList = StrUtil.split(addressList, ',', true, true); 22 | return registryList; 23 | } 24 | 25 | private List registryInfoList; 26 | private int onLineNum; 27 | 28 | public void addOnLineNum() { 29 | this.onLineNum = this.onLineNum + 1; 30 | } 31 | 32 | public int getOnLineNum() { 33 | return onLineNum; 34 | } 35 | 36 | public void setOnLineNum(int onLineNum) { 37 | this.onLineNum = onLineNum; 38 | } 39 | 40 | public void setRegistryList(List registryList) { 41 | this.registryList = registryList; 42 | } 43 | 44 | public List getRegistryInfoList() { 45 | return registryInfoList; 46 | } 47 | 48 | public void setRegistryInfoList(List registryInfoList) { 49 | this.registryInfoList = registryInfoList; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/model/bo/XxlJobInfoBO.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.model.bo; 4 | 5 | import cn.smartcoding.schedule.core.model.XxlJobInfo; 6 | 7 | public class XxlJobInfoBO extends XxlJobInfo { 8 | 9 | private int onLineNum; 10 | 11 | 12 | 13 | private String title; 14 | 15 | 16 | 17 | public int getOnLineNum() { 18 | return onLineNum; 19 | } 20 | 21 | public void setOnLineNum(int onLineNum) { 22 | this.onLineNum = onLineNum; 23 | } 24 | 25 | public String getTitle() { 26 | return title; 27 | } 28 | 29 | public void setTitle(String title) { 30 | this.title = title; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/model/bo/XxlJobLogReportBO.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.model.bo; 4 | 5 | 6 | public class XxlJobLogReportBO { 7 | 8 | private Long triggerDayCount; 9 | private Long triggerDayCountRunning; 10 | private Long triggerDayCountSuc; 11 | 12 | public Long getTriggerDayCount() { 13 | return triggerDayCount; 14 | } 15 | 16 | public void setTriggerDayCount(Long triggerDayCount) { 17 | this.triggerDayCount = triggerDayCount; 18 | } 19 | 20 | public Long getTriggerDayCountRunning() { 21 | return triggerDayCountRunning; 22 | } 23 | 24 | public void setTriggerDayCountRunning(Long triggerDayCountRunning) { 25 | this.triggerDayCountRunning = triggerDayCountRunning; 26 | } 27 | 28 | public Long getTriggerDayCountSuc() { 29 | return triggerDayCountSuc; 30 | } 31 | 32 | public void setTriggerDayCountSuc(Long triggerDayCountSuc) { 33 | this.triggerDayCountSuc = triggerDayCountSuc; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/model/bo/XxlJobStatisticBO.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.model.bo; 4 | 5 | /** 6 | * 任务统计 7 | * @author 无缺 8 | * @date 2019-08-21 9 | */ 10 | public class XxlJobStatisticBO { 11 | 12 | /** 13 | * 总的任务数量 14 | */ 15 | private Integer totalJobNum; 16 | /** 17 | * 启用的任务数量 18 | */ 19 | private Integer enableJobNum; 20 | /** 21 | * 禁用的任务数量 22 | */ 23 | private Integer stopJobNum; 24 | /** 25 | * 当前运行中的任务数量 26 | */ 27 | private Integer runningJobNum; 28 | 29 | 30 | public Integer getTotalJobNum() { 31 | return totalJobNum; 32 | } 33 | 34 | public void setTotalJobNum(Integer totalJobNum) { 35 | this.totalJobNum = totalJobNum; 36 | } 37 | 38 | public Integer getEnableJobNum() { 39 | return enableJobNum; 40 | } 41 | 42 | public void setEnableJobNum(Integer enableJobNum) { 43 | this.enableJobNum = enableJobNum; 44 | } 45 | 46 | public Integer getStopJobNum() { 47 | this.stopJobNum=totalJobNum-enableJobNum; 48 | return stopJobNum; 49 | } 50 | 51 | public void setStopJobNum(Integer stopJobNum) { 52 | this.stopJobNum = stopJobNum; 53 | } 54 | 55 | public Integer getRunningJobNum() { 56 | return runningJobNum; 57 | } 58 | 59 | public void setRunningJobNum(Integer runningJobNum) { 60 | this.runningJobNum = runningJobNum; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/model/bo/XxlShortAlarmInfoBO.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.schedule.core.model.bo; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 任务告警方式配置对象 xxl_job_alarm_way 9 | * 10 | * @author wuque 11 | * @date 2020-08-29 12 | */ 13 | @Data 14 | public class XxlShortAlarmInfoBO implements Serializable { 15 | private static final long serialVersionUID = 1L; 16 | 17 | /** 18 | * id 19 | */ 20 | private Integer id; 21 | 22 | /** 23 | * 告警方式 24 | */ 25 | private String alarmType; 26 | 27 | /** 28 | * 告警方式名称 29 | */ 30 | private String alarmName; 31 | /** 32 | * 状态:1 启用 0 禁用 33 | */ 34 | private Integer alarmStatus; 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/model/bo/XxlShortJobInfoBO.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.model.bo; 4 | 5 | /** 6 | * @author 无缺 7 | * @date 2019-12-24 8 | */ 9 | public class XxlShortJobInfoBO { 10 | 11 | /** 12 | * BIGINT(19) 必填 13 | * 14 | */ 15 | private Long id; 16 | 17 | /** 18 | * VARCHAR(255) 必填 19 | * 任务名称 20 | */ 21 | private String jobName; 22 | /** 23 | * VARCHAR(255) 24 | * 执行器任务handler 25 | */ 26 | private String executorHandler; 27 | 28 | private Long triggerNextTime; 29 | 30 | public Long getId() { 31 | return id; 32 | } 33 | 34 | public void setId(Long id) { 35 | this.id = id; 36 | } 37 | 38 | public String getJobName() { 39 | return jobName; 40 | } 41 | 42 | public void setJobName(String jobName) { 43 | this.jobName = jobName; 44 | } 45 | 46 | public String getExecutorHandler() { 47 | return executorHandler; 48 | } 49 | 50 | public void setExecutorHandler(String executorHandler) { 51 | this.executorHandler = executorHandler; 52 | } 53 | 54 | public Long getTriggerNextTime() { 55 | return triggerNextTime; 56 | } 57 | 58 | public void setTriggerNextTime(Long triggerNextTime) { 59 | this.triggerNextTime = triggerNextTime; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/model/vo/JobAddressGroupVO.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.model.vo; 4 | 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.util.List; 9 | 10 | /** 11 | * @author 无缺 12 | * @date 2019-07-13 13 | */ 14 | @Data 15 | public class JobAddressGroupVO implements Serializable { 16 | private List registryInfoList; 17 | private int onLineNum; 18 | private String appName; 19 | 20 | /** 21 | * VARCHAR(60) 必填 22 | * 执行器名称 23 | */ 24 | private String title; 25 | 26 | public void addOnLineNum() { 27 | this.onLineNum = this.onLineNum + 1; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/model/vo/JobAddressVO.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.model.vo; 4 | 5 | import com.fasterxml.jackson.annotation.JsonFormat; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | import java.util.Date; 10 | 11 | @Data 12 | public class JobAddressVO implements Serializable { 13 | private static final long serialVersionUID = 1L; 14 | 15 | /** 16 | * VARCHAR(30) 必填 17 | * 地址 18 | */ 19 | private String address; 20 | /** 21 | * VARCHAR(64) 必填 22 | * 在线状态 23 | */ 24 | private Integer online; 25 | /** 26 | * TIMESTAMP(19) 默认值[CURRENT_TIMESTAMP] 必填 27 | * 更新时间 28 | */ 29 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 30 | private Date updateTime; 31 | 32 | public JobAddressVO(String address) { 33 | this.address = address; 34 | } 35 | 36 | public JobAddressVO() { 37 | } 38 | 39 | public JobAddressVO(String address, Integer online, Date updateTime) { 40 | this.address = address; 41 | this.online = online; 42 | this.updateTime = updateTime; 43 | } 44 | 45 | 46 | } 47 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/model/vo/JobGroupVO.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.schedule.core.model.vo; 2 | 3 | import cn.hutool.core.util.StrUtil; 4 | import cn.smartcoding.schedule.core.model.XxlJobGroup; 5 | 6 | import java.util.List; 7 | 8 | public class JobGroupVO extends XxlJobGroup { 9 | //执行器地址列表(系统注册) 10 | private List registryList; 11 | 12 | public List getRegistryList() { 13 | String addressList = super.getAddressList(); 14 | registryList = StrUtil.split(addressList, ',', true, true); 15 | return registryList; 16 | } 17 | 18 | private List registryInfoList; 19 | private int onLineNum; 20 | 21 | public void addOnLineNum() { 22 | this.onLineNum = this.onLineNum + 1; 23 | } 24 | 25 | public int getOnLineNum() { 26 | return onLineNum; 27 | } 28 | 29 | public void setOnLineNum(int onLineNum) { 30 | this.onLineNum = onLineNum; 31 | } 32 | 33 | public void setRegistryList(List registryList) { 34 | this.registryList = registryList; 35 | } 36 | 37 | public List getRegistryInfoList() { 38 | return registryInfoList; 39 | } 40 | 41 | public void setRegistryInfoList(List registryInfoList) { 42 | this.registryInfoList = registryInfoList; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/model/vo/NoticeUser.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.schedule.core.model.vo; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | @Data 8 | public class NoticeUser implements Serializable { 9 | private static final long serialVersionUID = 1L; 10 | private String mobile; 11 | private String email; 12 | } 13 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/model/vo/TestAlarmParamVO.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.schedule.core.model.vo; 2 | 3 | import cn.smartcoding.schedule.core.model.XxlAlarmInfo; 4 | import lombok.Data; 5 | 6 | import java.io.Serializable; 7 | import java.util.List; 8 | 9 | @Data 10 | public class TestAlarmParamVO implements Serializable { 11 | private static final long serialVersionUID = 1L; 12 | private XxlAlarmInfo alarmInfo; 13 | private List variableList; 14 | private NoticeUser noticeUser; 15 | 16 | 17 | 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/model/vo/Variable.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.schedule.core.model.vo; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | @Data 8 | public class Variable implements Serializable { 9 | private static final long serialVersionUID = 1L; 10 | private String title; 11 | private String variable; 12 | private String value; 13 | private String prop; 14 | } 15 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/route/ExecutorRouter.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.route; 4 | 5 | import cn.smartcoding.job.core.biz.model.ReturnT; 6 | import cn.smartcoding.job.core.biz.model.TriggerParam; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * Created by xuxueli on 17/3/10. 14 | */ 15 | public abstract class ExecutorRouter { 16 | protected static Logger logger = LoggerFactory.getLogger(ExecutorRouter.class); 17 | 18 | /** 19 | * route address 20 | * 21 | * @param addressList 22 | * @return ReturnT.content=address 23 | */ 24 | public abstract ReturnT route(TriggerParam triggerParam, List addressList); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/route/strategy/ExecutorRouteFirst.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.route.strategy; 4 | 5 | import cn.smartcoding.job.core.biz.model.ReturnT; 6 | import cn.smartcoding.job.core.biz.model.TriggerParam; 7 | import cn.smartcoding.schedule.core.route.ExecutorRouter; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Created by xuxueli on 17/3/10. 13 | */ 14 | public class ExecutorRouteFirst extends ExecutorRouter { 15 | 16 | @Override 17 | public ReturnT route(TriggerParam triggerParam, List addressList){ 18 | return new ReturnT(addressList.get(0)); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/route/strategy/ExecutorRouteLast.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.route.strategy; 4 | 5 | import cn.smartcoding.job.core.biz.model.ReturnT; 6 | import cn.smartcoding.job.core.biz.model.TriggerParam; 7 | import cn.smartcoding.schedule.core.route.ExecutorRouter; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Created by xuxueli on 17/3/10. 13 | */ 14 | public class ExecutorRouteLast extends ExecutorRouter { 15 | 16 | @Override 17 | public ReturnT route(TriggerParam triggerParam, List addressList) { 18 | return new ReturnT(addressList.get(addressList.size()-1)); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/route/strategy/ExecutorRouteRandom.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.route.strategy; 4 | 5 | import cn.smartcoding.job.core.biz.model.ReturnT; 6 | import cn.smartcoding.job.core.biz.model.TriggerParam; 7 | import cn.smartcoding.schedule.core.route.ExecutorRouter; 8 | 9 | import java.util.List; 10 | import java.util.Random; 11 | 12 | /** 13 | * Created by xuxueli on 17/3/10. 14 | */ 15 | public class ExecutorRouteRandom extends ExecutorRouter { 16 | 17 | private static Random localRandom = new Random(); 18 | 19 | @Override 20 | public ReturnT route(TriggerParam triggerParam, List addressList) { 21 | String address = addressList.get(localRandom.nextInt(addressList.size())); 22 | return new ReturnT(address); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/route/strategy/IdleBeat.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.schedule.core.route.strategy; 2 | 3 | import cn.hutool.json.JSONUtil; 4 | import com.alibaba.fastjson.JSON; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.util.LinkedHashMap; 9 | import java.util.Map; 10 | 11 | @Data 12 | public class IdleBeat implements Serializable { 13 | private String title; 14 | private String address; 15 | private Integer code; 16 | private String msg; 17 | 18 | public String toJson() { 19 | return JSON.toJSONString(this); 20 | } 21 | 22 | public String toJsonIgnoreTitle() { 23 | Map map = new LinkedHashMap<>(3); 24 | map.put("address", this.getAddress()); 25 | map.put("code", this.getCode()); 26 | map.put("msg", this.getMsg()); 27 | return JSONUtil.toJsonStr(map); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/trigger/TriggerConstant.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.schedule.core.trigger; 2 | 3 | public interface TriggerConstant { 4 | String TRIGGER_TYPE = "jobconf_trigger_type"; 5 | String TRIGGER_ADMIN_ADDRESS = "jobconf_trigger_admin_adress"; 6 | String TRIGGER_EXE_REG_TYPE = "jobconf_trigger_exe_regtype"; 7 | String TRIGGER_EXE_REG_ADDRESS = "jobconf_trigger_exe_regaddress"; 8 | String EXECUTOR_ROUTE_STRATEGY = "jobinfo_field_executorRouteStrategy"; 9 | String EXECUTOR_BLOCK_STRATEGY = "jobinfo_field_executorBlockStrategy"; 10 | String EXECUTOR_FAIL_RETRY_COUNT = "jobinfo_field_executorFailRetryCount"; 11 | String TIMEOUT = "jobinfo_field_timeout"; 12 | //触发调度 13 | String TRIGGER_RUN = "jobconf_trigger_run"; 14 | //心跳检测 15 | String TRIGGER_BEAT = "jobconf_beat"; 16 | String SHARDING_PARAM = "shardingParam"; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/trigger/TriggerMsg.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.schedule.core.trigger; 2 | 3 | import cn.smartcoding.schedule.core.util.I18nUtil; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | @Data 9 | @AllArgsConstructor 10 | @NoArgsConstructor 11 | public class TriggerMsg { 12 | 13 | private String key; 14 | private String name; 15 | private String value; 16 | private Integer sort; 17 | 18 | 19 | public static TriggerMsg build(String key, String value,int sort) { 20 | return new TriggerMsg(key, I18nUtil.getString(key), value,sort); 21 | } 22 | 23 | 24 | } 25 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/trigger/TriggerReslut.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.schedule.core.trigger; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.List; 6 | 7 | @Data 8 | public class TriggerReslut { 9 | 10 | 11 | private List list; 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/trigger/TriggerStatusEnum.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.trigger; 4 | 5 | /** 6 | * 任务触发状态 7 | * trigger type enum 8 | * 9 | * @author xuxueli 2018-09-16 04:56:41 10 | */ 11 | public enum TriggerStatusEnum { 12 | /** 13 | * 已停止 14 | */ 15 | STOPPING(0,"已停止"), 16 | /** 17 | * 已就绪 18 | */ 19 | READY(1,"已就绪"); 20 | 21 | TriggerStatusEnum(Integer code, String title) { 22 | this.code = code; 23 | this.title = title; 24 | } 25 | 26 | private Integer code; 27 | private String title; 28 | public String getTitle() { 29 | return title; 30 | } 31 | 32 | public Integer getCode() { 33 | return code; 34 | } 35 | 36 | public static TriggerStatusEnum fromCode(Integer code, TriggerStatusEnum defaultEnum) { 37 | TriggerStatusEnum[] values = TriggerStatusEnum.values(); 38 | for (TriggerStatusEnum value : values) { 39 | if (value.getCode().equals(code)) { 40 | return value; 41 | } 42 | } 43 | return defaultEnum; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/util/IpUtils.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.util; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | 7 | /** 8 | * Created by wuque on 18/04/2017. 9 | */ 10 | public class IpUtils { 11 | /** 12 | * 获取登录用户的IP地址 13 | * 14 | * @param request 请求 15 | * @return IP 16 | */ 17 | public static String getIpAddr(HttpServletRequest request) { 18 | String ip = request.getHeader("x-forwarded-for"); 19 | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { 20 | ip = request.getHeader("Proxy-Client-IP"); 21 | } 22 | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { 23 | ip = request.getHeader("WL-Proxy-Client-IP"); 24 | } 25 | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { 26 | ip = request.getRemoteAddr(); 27 | } 28 | 29 | if (ip.equals("0:0:0:0:0:0:0:1")) { 30 | ip = "127.0.0.1"; 31 | } 32 | if (ip.split(",").length > 1) { 33 | ip = ip.split(",")[0]; 34 | } 35 | return ip; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/util/StringBuilderUtil.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.util; 4 | 5 | import cn.hutool.core.collection.CollectionUtil; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author 无缺 11 | * @date 2019-07-13 12 | */ 13 | public class StringBuilderUtil { 14 | 15 | 16 | public static String listToString(List itemList) { 17 | StringBuilder stringBuilder = new StringBuilder(); 18 | if (CollectionUtil.isNotEmpty(itemList)) { 19 | for (String item : itemList) { 20 | stringBuilder.append(item).append(","); 21 | } 22 | if (stringBuilder.lastIndexOf(",") > 0) { 23 | stringBuilder.delete(stringBuilder.length()-1,stringBuilder.length()); 24 | } 25 | 26 | } 27 | return stringBuilder.toString(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/util/UserPermissionUtil.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.util; 4 | 5 | import org.springframework.util.StringUtils; 6 | 7 | /** 8 | * @author 无缺 9 | * @date 2019-07-09 10 | */ 11 | public class UserPermissionUtil { 12 | // plugin 13 | public static boolean validPermission(Integer role, String permission, Long jobGroup) { 14 | if (role == 1) { 15 | return true; 16 | } 17 | if (StringUtils.hasText(permission)) { 18 | for (String permissionItem : permission.split(",")) { 19 | if (String.valueOf(jobGroup).equals(permissionItem)) { 20 | return true; 21 | } 22 | } 23 | } 24 | return false; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/core/util/VO2DOUtils.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.core.util; 4 | 5 | import org.springframework.util.StringUtils; 6 | 7 | /** 8 | * @author 无缺 9 | * @date 2019-11-24 10 | */ 11 | public class VO2DOUtils { 12 | public static String hideMobile(String mobile) { 13 | if (StringUtils.isEmpty(mobile) || mobile.length() < 11) { 14 | return mobile; 15 | } 16 | return mobile.substring(0,3) + "****" + mobile.substring(7); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/dto/ClearLogDto.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.schedule.dto; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | @Data 8 | public class ClearLogDto implements Serializable { 9 | private Long jobGroup; 10 | private Long jobId; 11 | private Integer type; 12 | private Integer num; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/dto/TriggerJobDto.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.schedule.dto; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 用于启动任务接收的实体 9 | * 10 | * @author jingwk 11 | * @ClassName TriggerJobDto 12 | * @Version 1.0 13 | * @since 2019/12/01 16:12 14 | */ 15 | @Data 16 | public class TriggerJobDto implements Serializable { 17 | 18 | private String executorParam; 19 | 20 | private String address; 21 | 22 | private Long jobId; 23 | } 24 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/job/DemoJobHandler.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.job; 4 | 5 | import cn.smartcoding.job.core.biz.model.ReturnT; 6 | import cn.smartcoding.job.core.handler.annotation.Job; 7 | import cn.smartcoding.job.core.handler.annotation.JobHandler; 8 | import cn.smartcoding.job.core.log.XxlJobLogger; 9 | import org.slf4j.Logger; 10 | import org.slf4j.LoggerFactory; 11 | import org.springframework.stereotype.Component; 12 | 13 | import java.time.LocalDateTime; 14 | 15 | 16 | /** 17 | * 任务Handler示例(Bean模式) 18 | *

19 | * 开发步骤: 20 | * 1、继承"IJobHandler":“IJobHandler”; 21 | * 2、注册到Spring容器:添加“@Component”注解,被Spring容器扫描为Bean实例; 22 | * 3、注册到执行器工厂:添加“@JobHandler(value="自定义jobhandler名称")”注解,注解value值对应的是调度中心新建任务的JobHandler属性的值。 23 | * 4、执行日志:需要通过 "XxlJobLogger.log" 打印执行日志; 24 | * 25 | * @author xuxueli 2015-12-19 19:43:36 26 | */ 27 | @Component 28 | @JobHandler 29 | public class DemoJobHandler { 30 | 31 | private Logger log = LoggerFactory.getLogger(DemoJobHandler.class); 32 | 33 | 34 | @Job(executorHandler = "demoJobHandler", jobName = "smart-job演示测试任务", jobCron = "0 0 12 * * ?") 35 | public ReturnT execute(String param) throws Exception { 36 | log.info("XXL-JOB,demoJobHandler time:{},param:{}",LocalDateTime.now(),param); 37 | XxlJobLogger.log("XXL-JOB,demoJobHandler time:{}", LocalDateTime.now()); 38 | 39 | return ReturnT.SUCCESS; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/mapper/XxlJobAlarmLogMapper.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.schedule.mapper; 2 | 3 | import cn.smartcoding.schedule.core.model.XxlJobAlarmLog; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 任务告警记录Mapper接口 9 | * 10 | * @author wuque 11 | * @date 2020-08-29 12 | */ 13 | public interface XxlJobAlarmLogMapper { 14 | /** 15 | * 查询任务告警记录 16 | * 17 | * @param id 任务告警记录ID 18 | * @return 任务告警记录 19 | */ 20 | public XxlJobAlarmLog selectXxlJobAlarmLogById(Long id); 21 | 22 | /** 23 | * 查询任务告警记录列表 24 | * 25 | * @param xxlJobAlarmLog 任务告警记录 26 | * @return 任务告警记录集合 27 | */ 28 | public List selectXxlJobAlarmLogList(XxlJobAlarmLog xxlJobAlarmLog); 29 | 30 | /** 31 | * 新增任务告警记录 32 | * 33 | * @param xxlJobAlarmLog 任务告警记录 34 | * @return 结果 35 | */ 36 | public int insertXxlJobAlarmLog(XxlJobAlarmLog xxlJobAlarmLog); 37 | 38 | /** 39 | * 修改任务告警记录 40 | * 41 | * @param xxlJobAlarmLog 任务告警记录 42 | * @return 结果 43 | */ 44 | public int updateXxlJobAlarmLog(XxlJobAlarmLog xxlJobAlarmLog); 45 | 46 | /** 47 | * 删除任务告警记录 48 | * 49 | * @param id 任务告警记录ID 50 | * @return 结果 51 | */ 52 | public int deleteXxlJobAlarmLogById(Long id); 53 | 54 | /** 55 | * 批量删除任务告警记录 56 | * 57 | * @param ids 需要删除的数据ID 58 | * @return 结果 59 | */ 60 | public int deleteXxlJobAlarmLogByIds(Long[] ids); 61 | } 62 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/mapper/XxlJobLockMapper.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.mapper; 4 | 5 | import cn.smartcoding.schedule.core.model.XxlJobLock; 6 | import org.apache.ibatis.annotations.Mapper; 7 | import org.apache.ibatis.annotations.Param; 8 | 9 | @Mapper 10 | public interface XxlJobLockMapper { 11 | int deleteByPrimaryKey(String lockName); 12 | 13 | int insert(XxlJobLock record); 14 | 15 | int insertSelective(XxlJobLock record); 16 | 17 | XxlJobLock selectByPrimaryKey(String lockName); 18 | 19 | int updateByPrimaryKeySelective(XxlJobLock record); 20 | 21 | int updateByPrimaryKey(XxlJobLock record); 22 | 23 | int insertLockName(@Param("lockName") String lockName); 24 | } 25 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/mapper/XxlJobLogGlueMapper.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.mapper; 4 | 5 | import cn.smartcoding.schedule.core.model.XxlJobLogGlue; 6 | import org.apache.ibatis.annotations.Mapper; 7 | import org.apache.ibatis.annotations.Param; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * job log for glue 13 | * @author xuxueli 2016-5-19 18:04:56 14 | */ 15 | @Mapper 16 | public interface XxlJobLogGlueMapper { 17 | 18 | int save(XxlJobLogGlue xxlJobLogGlue); 19 | 20 | List findByJobId(@Param("jobId") Long jobId); 21 | 22 | int removeOld(@Param("jobId") Long jobId, @Param("limit") int limit); 23 | 24 | int deleteByJobId(@Param("jobId") Long jobId); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/mapper/XxlJobLogReportDao.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.mapper; 4 | 5 | import cn.smartcoding.schedule.core.model.XxlJobLogReport; 6 | import org.apache.ibatis.annotations.Mapper; 7 | import org.apache.ibatis.annotations.Param; 8 | 9 | import java.time.LocalDate; 10 | import java.util.Date; 11 | import java.util.List; 12 | 13 | /** 14 | * job log 15 | * @author xuxueli 2019-11-22 16 | */ 17 | @Mapper 18 | public interface XxlJobLogReportDao { 19 | 20 | int save(XxlJobLogReport xxlJobLogReport); 21 | 22 | int update(XxlJobLogReport xxlJobLogReport); 23 | 24 | List queryLogReport(@Param("triggerDayFrom") Date triggerDayFrom, @Param("triggerDayTo") Date triggerDayTo); 25 | 26 | XxlJobLogReport queryLogReportTotal(); 27 | 28 | XxlJobLogReport selectByTriggerDay(@Param("triggerDay") LocalDate triggerDay); 29 | 30 | void deleteById(Long id); 31 | } 32 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/service/ApplicationContextUtil.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.service; 4 | 5 | import org.springframework.beans.BeansException; 6 | import org.springframework.context.ApplicationContext; 7 | import org.springframework.context.ApplicationContextAware; 8 | import org.springframework.stereotype.Component; 9 | 10 | /** 11 | * @author wuque 12 | * @date 24/05/2017 13 | */ 14 | @Component 15 | public class ApplicationContextUtil implements ApplicationContextAware { 16 | 17 | private static ApplicationContext context; 18 | 19 | @Override 20 | public void setApplicationContext(ApplicationContext context) throws BeansException { 21 | ApplicationContextUtil.context = context; 22 | } 23 | 24 | public static ApplicationContext getContext() { 25 | return context; 26 | } 27 | 28 | public static Object getBean(String beanName) { 29 | return context.getBean(beanName); 30 | } 31 | 32 | public static T getBean(Class requiredType) { 33 | return context.getBean(requiredType); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/service/XxlJobGroupService.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.service; 4 | 5 | import cn.smartcoding.schedule.core.model.XxlJobGroup; 6 | import cn.smartcoding.schedule.core.model.vo.JobAddressGroupVO; 7 | import cn.smartcoding.schedule.core.model.vo.JobGroupVO; 8 | import com.github.pagehelper.PageInfo; 9 | 10 | import java.util.List; 11 | 12 | public interface XxlJobGroupService { 13 | 14 | JobAddressGroupVO getXxlJobAddressBOS(List registryList, String appName); 15 | 16 | int getOnLineNum(List registryList, String appName); 17 | 18 | PageInfo pageList(int pageNum, int pageSize, Long id, Integer addressType, Integer alarmStatus); 19 | 20 | int addJobGroup(XxlJobGroup jobGroup); 21 | 22 | int update(XxlJobGroup jobGroupVO); 23 | 24 | int remove(Long id); 25 | 26 | XxlJobGroup loadById(Long id); 27 | 28 | JobAddressGroupVO getOnLineAddressList(Long id); 29 | 30 | List findAll(); 31 | 32 | List querySearch(String title, int pageSize); 33 | } 34 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/service/XxlJobInitService.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.service; 4 | 5 | /** 6 | * 应用的初始化代码 7 | */ 8 | public interface XxlJobInitService { 9 | 10 | 11 | void initXxlJobLock(); 12 | } 13 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/service/XxlJobLogService.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.schedule.service; 2 | 3 | import cn.smartcoding.schedule.core.model.XxlJobLog; 4 | import com.github.pagehelper.PageInfo; 5 | 6 | import java.util.Date; 7 | 8 | public interface XxlJobLogService { 9 | 10 | 11 | PageInfo pageList(int pageNum, int pageSize,Long id, Integer jobStatus, Long jobId, Long jobGroup, Date triggerTimeStart, Date triggerTimeEnd); 12 | 13 | XxlJobLog selectByPrimaryKey(Long logId); 14 | 15 | void killRunningJob(Long id); 16 | 17 | void clearLog(Long jobGroup, Long jobId, Integer type, Integer num); 18 | } 19 | -------------------------------------------------------------------------------- /smart-job-schedule/src/main/java/cn/smartcoding/schedule/service/impl/XxlJobInitServiceImpl.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.schedule.service.impl; 4 | 5 | import cn.smartcoding.schedule.core.model.XxlJobLock; 6 | import cn.smartcoding.schedule.mapper.XxlJobLockMapper; 7 | import cn.smartcoding.schedule.service.XxlJobInitService; 8 | import lombok.extern.slf4j.Slf4j; 9 | import org.springframework.beans.factory.annotation.Value; 10 | import org.springframework.stereotype.Service; 11 | 12 | import javax.annotation.PostConstruct; 13 | import javax.annotation.Resource; 14 | 15 | @Service 16 | @Slf4j 17 | public class XxlJobInitServiceImpl implements XxlJobInitService { 18 | 19 | @Resource 20 | private XxlJobLockMapper xxlJobLockMapper; 21 | 22 | 23 | @Value("${xxl.job.admin.initUser:false}") 24 | private boolean initUser; 25 | 26 | @PostConstruct 27 | public void init() { 28 | if (initUser) { 29 | } 30 | initXxlJobLock(); 31 | } 32 | 33 | 34 | /** 35 | * 初始化的xxl-job调度锁 36 | */ 37 | @Override 38 | public void initXxlJobLock() { 39 | XxlJobLock scheduleLock = xxlJobLockMapper.selectByPrimaryKey("schedule_lock"); 40 | if (scheduleLock != null) { 41 | return; 42 | } 43 | log.info(">>> xxl-job init xxl_job_lock,scheduleLock:schedule_lock"); 44 | xxlJobLockMapper.insertLockName("schedule_lock"); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /smart-job-schedule/src/test/java/cn/smartcoding/schedule/controller/AbstractSpringMvcTest.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | //package com.smartcoding.schedule.controller; 4 | // 5 | //import org.junit.Before; 6 | //import org.junit.runner.RunWith; 7 | //import org.springframework.beans.factory.annotation.Autowired; 8 | //import org.springframework.test.context.ContextConfiguration; 9 | //import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 10 | //import org.springframework.test.context.web.WebAppConfiguration; 11 | //import org.springframework.test.web.servlet.MockMvc; 12 | //import org.springframework.test.web.servlet.setup.MockMvcBuilders; 13 | //import org.springframework.web.context.WebApplicationContext; 14 | // 15 | //@WebAppConfiguration 16 | //@RunWith(SpringJUnit4ClassRunner.class) 17 | //@ContextConfiguration(locations = {"classpath*:spring/*.xml"}) 18 | //public class AbstractSpringMvcTest { 19 | // 20 | // @Autowired 21 | // private WebApplicationContext applicationContext; 22 | // protected MockMvc mockMvc; 23 | // 24 | // @Before 25 | // public void setup() { 26 | // this.mockMvc = MockMvcBuilders.webAppContextSetup(this.applicationContext).build(); 27 | // } 28 | // 29 | //} 30 | -------------------------------------------------------------------------------- /smart-job-schedule/src/test/java/cn/smartcoding/schedule/test/XxlJobLogGlueDaoTest.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | //package com.smartcoding.schedule.test; 4 | // 5 | //import com.smartcoding.schedule.com.smartcoding.robot.core.model.XxlJobLogGlue; 6 | //import XxlJobLogGlueMapper; 7 | //import org.junit.Test; 8 | //import org.junit.runner.RunWith; 9 | //import org.springframework.test.context.ContextConfiguration; 10 | //import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 11 | // 12 | //import javax.annotation.Resource; 13 | //import java.util.List; 14 | // 15 | //@RunWith(SpringJUnit4ClassRunner.class) 16 | //@ContextConfiguration(locations = "classpath*:spring/applicationcontext-*.xml") 17 | //public class XxlJobLogGlueDaoTest { 18 | // 19 | // @Resource 20 | // private XxlJobLogGlueMapper xxlJobLogGlueDao; 21 | // 22 | // @Test 23 | // public void test(){ 24 | // XxlJobLogGlue logGlue = new XxlJobLogGlue(); 25 | // logGlue.setJobId(1L); 26 | // logGlue.setGlueType("1"); 27 | // logGlue.setGlueSource("1"); 28 | // logGlue.setGlueRemark("1"); 29 | // int ret = xxlJobLogGlueDao.save(logGlue); 30 | // 31 | // List list = xxlJobLogGlueDao.findByJobId(1L); 32 | // 33 | // int ret2 = xxlJobLogGlueDao.removeOld(1L, 1); 34 | // 35 | // int ret3 =xxlJobLogGlueDao.deleteByJobId(1L); 36 | // } 37 | // 38 | //} 39 | -------------------------------------------------------------------------------- /smart-job-schedule/src/test/java/cn/smartcoding/schedule/test/XxlJobRegistryDaoTest.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | //package com.smartcoding.schedule.test; 4 | // 5 | //import XxlJobRegistryMapper; 6 | //import com.smartcoding.schedule.com.smartcoding.robot.core.model.XxlJobRegistry; 7 | //import org.junit.Test; 8 | //import org.junit.runner.RunWith; 9 | //import org.springframework.boot.test.context.SpringBootTest; 10 | //import org.springframework.test.context.junit4.SpringRunner; 11 | // 12 | //import javax.annotation.Resource; 13 | //import java.util.Arrays; 14 | //import java.util.List; 15 | // 16 | //@RunWith(SpringRunner.class) 17 | //@SpringBootTest 18 | //public class XxlJobRegistryDaoTest { 19 | // 20 | // @Resource 21 | // private XxlJobRegistryMapper xxlJobRegistryDao; 22 | // 23 | // @Test 24 | // public void test(){ 25 | // int ret = xxlJobRegistryDao.registryUpdate("g1", "k1", "v1"); 26 | // if (ret < 1) { 27 | // ret = xxlJobRegistryDao.registrySave("g1", "k1", "v1"); 28 | // } 29 | // 30 | // List list = xxlJobRegistryDao.findAll(1); 31 | // 32 | // int ret2 = xxlJobRegistryDao.removeDead(Arrays.asList(1)); 33 | // 34 | // } 35 | // 36 | //} 37 | -------------------------------------------------------------------------------- /smart-job-schedule/src/test/java/cn/smartcoding/schedule/util/I18nUtilTest.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | //package com.smartcoding.schedule.util; 4 | // 5 | //import com.smartcoding.schedule.com.smartcoding.robot.core.util.I18nUtil; 6 | //import org.junit.Test; 7 | //import org.junit.runner.RunWith; 8 | //import org.springframework.test.context.ContextConfiguration; 9 | //import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 10 | // 11 | ///** 12 | // * email util test 13 | // * 14 | // * @author xuxueli 2017-12-22 17:16:23 15 | // */ 16 | //@RunWith(SpringJUnit4ClassRunner.class) 17 | //@ContextConfiguration(locations = "classpath*:spring/applicationcontext-*.xml") 18 | //public class I18nUtilTest { 19 | // 20 | // @Test 21 | // public void test(){ 22 | // System.out.println(I18nUtil.getString("admin_name")); 23 | // System.out.println(I18nUtil.getMultString("admin_name", "admin_name_full")); 24 | // System.out.println(I18nUtil.getMultString()); 25 | // } 26 | // 27 | //} 28 | -------------------------------------------------------------------------------- /smart-job-starter/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | cn.smartcoding.xxl.job.starter.XxlJobAutoConfiguration 3 | -------------------------------------------------------------------------------- /smart-job-system/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/smart-job-system/.DS_Store -------------------------------------------------------------------------------- /smart-job-system/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | smart-job 7 | cn.smartcoding 8 | 1.0.0 9 | 10 | 4.0.0 11 | 12 | smart-job-system 13 | 14 | 15 | system系统模块 16 | 17 | 18 | 19 | 20 | 21 | 22 | cn.smartcoding 23 | smart-job-common 24 | 25 | 26 | cn.smartcoding 27 | smart-job-framework 28 | 29 | 30 | org.projectlombok 31 | lombok 32 | compile 33 | 34 | 35 | cn.hutool 36 | hutool-all 37 | 38 | 39 | 40 | org.springframework.boot 41 | spring-boot-starter-data-ldap 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/domain/SysLdapConfig.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.domain; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | import java.util.Date; 7 | 8 | @Data 9 | public class SysLdapConfig implements Serializable { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | private Integer id; 14 | 15 | private Boolean enabled; 16 | 17 | private String urls; 18 | 19 | private Boolean enableSsl; 20 | 21 | private String base; 22 | 23 | private String managerDn; 24 | 25 | private String managerPassword; 26 | 27 | private String userDnPatterns; 28 | 29 | private String attributesMail; 30 | 31 | private String attributesTelephone; 32 | 33 | private String remark; 34 | 35 | private String updateBy; 36 | 37 | private Date gmtCreate; 38 | 39 | private Date gmtModified; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/domain/SysRoleDept.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.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 wuque 10 | */ 11 | public class SysRoleDept { 12 | /** 13 | * 角色ID 14 | */ 15 | private Long roleId; 16 | 17 | /** 18 | * 部门ID 19 | */ 20 | private Long deptId; 21 | 22 | public Long getRoleId() { 23 | return roleId; 24 | } 25 | 26 | public void setRoleId(Long roleId) { 27 | this.roleId = roleId; 28 | } 29 | 30 | public Long getDeptId() { 31 | return deptId; 32 | } 33 | 34 | public void setDeptId(Long deptId) { 35 | this.deptId = deptId; 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) 41 | .append("roleId", getRoleId()) 42 | .append("deptId", getDeptId()) 43 | .toString(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/domain/SysRoleMenu.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.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 wuque 10 | */ 11 | public class SysRoleMenu { 12 | /** 13 | * 角色ID 14 | */ 15 | private Long roleId; 16 | 17 | /** 18 | * 菜单ID 19 | */ 20 | private Long menuId; 21 | 22 | public Long getRoleId() { 23 | return roleId; 24 | } 25 | 26 | public void setRoleId(Long roleId) { 27 | this.roleId = roleId; 28 | } 29 | 30 | public Long getMenuId() { 31 | return menuId; 32 | } 33 | 34 | public void setMenuId(Long menuId) { 35 | this.menuId = menuId; 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) 41 | .append("roleId", getRoleId()) 42 | .append("menuId", getMenuId()) 43 | .toString(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/domain/SysUserPost.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.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 wuque 10 | */ 11 | public class SysUserPost { 12 | /** 13 | * 用户ID 14 | */ 15 | private Long userId; 16 | 17 | /** 18 | * 岗位ID 19 | */ 20 | private Long postId; 21 | 22 | public Long getUserId() { 23 | return userId; 24 | } 25 | 26 | public void setUserId(Long userId) { 27 | this.userId = userId; 28 | } 29 | 30 | public Long getPostId() { 31 | return postId; 32 | } 33 | 34 | public void setPostId(Long postId) { 35 | this.postId = postId; 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) 41 | .append("userId", getUserId()) 42 | .append("postId", getPostId()) 43 | .toString(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/domain/SysUserRole.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.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 wuque 10 | */ 11 | public class SysUserRole { 12 | /** 13 | * 用户ID 14 | */ 15 | private Long userId; 16 | 17 | /** 18 | * 角色ID 19 | */ 20 | private Long roleId; 21 | 22 | public Long getUserId() { 23 | return userId; 24 | } 25 | 26 | public void setUserId(Long userId) { 27 | this.userId = userId; 28 | } 29 | 30 | public Long getRoleId() { 31 | return roleId; 32 | } 33 | 34 | public void setRoleId(Long roleId) { 35 | this.roleId = roleId; 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) 41 | .append("userId", getUserId()) 42 | .append("roleId", getRoleId()) 43 | .toString(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/domain/vo/MetaVo.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.domain.vo; 2 | 3 | /** 4 | * 路由显示信息 5 | * 6 | * @author wuque 7 | */ 8 | public class MetaVo { 9 | /** 10 | * 设置该路由在侧边栏和面包屑中展示的名字 11 | */ 12 | private String title; 13 | 14 | /** 15 | * 设置该路由的图标,对应路径src/icons/svg 16 | */ 17 | private String icon; 18 | /** 19 | * 是否缓存路由,当设置 true 的时候该路由每次触发重新请求 20 | */ 21 | private Boolean noCache=true; 22 | 23 | public MetaVo() { 24 | } 25 | 26 | public MetaVo(String title, String icon) { 27 | this.title = title; 28 | this.icon = icon; 29 | } 30 | 31 | public String getTitle() { 32 | return title; 33 | } 34 | 35 | public void setTitle(String title) { 36 | this.title = title; 37 | } 38 | 39 | public String getIcon() { 40 | return icon; 41 | } 42 | 43 | public void setIcon(String icon) { 44 | this.icon = icon; 45 | } 46 | 47 | public Boolean getNoCache() { 48 | return noCache; 49 | } 50 | 51 | public void setNoCache(Boolean noCache) { 52 | this.noCache = noCache; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/domain/vo/SysUserVO.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.domain.vo; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class SysUserVO { 7 | 8 | /** 9 | * 用户ID 10 | */ 11 | private Long userId; 12 | 13 | 14 | /** 15 | * 用户账号 16 | */ 17 | private String userName; 18 | 19 | /** 20 | * 用户昵称 21 | */ 22 | private String nickName; 23 | /** 24 | * 帐号状态 25 | */ 26 | private String status; 27 | } 28 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/dto/LdapUserDto.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.dto; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * Ldap用户 9 | */ 10 | @Data 11 | public class LdapUserDto implements Serializable { 12 | private static final long serialVersionUID = 1L; 13 | 14 | /** 15 | * 用户账号 16 | */ 17 | private String dn; 18 | 19 | /** 20 | * 用户昵称 21 | */ 22 | private String sn; 23 | 24 | /** 25 | * 用户显示名 26 | */ 27 | private String displayName; 28 | 29 | /** 30 | * 用户邮箱 31 | */ 32 | private String email; 33 | 34 | /** 35 | * 手机号码 36 | */ 37 | private String telephone; 38 | 39 | private String password; 40 | } 41 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/dto/SysDeptDto.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.dto; 2 | 3 | import cn.smartcoding.common.core.domain.TreeSelect; 4 | import lombok.Data; 5 | 6 | import java.util.List; 7 | 8 | @Data 9 | public class SysDeptDto { 10 | private List checkedKeys; 11 | 12 | private List depts; 13 | } 14 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/dto/SysUserDto.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.dto; 2 | 3 | import cn.smartcoding.common.core.domain.entity.SysUser; 4 | import lombok.Data; 5 | 6 | import java.io.Serializable; 7 | import java.util.Set; 8 | 9 | @Data 10 | public class SysUserDto implements Serializable { 11 | private SysUser user; 12 | private Set roles; 13 | private Set permissions; 14 | } 15 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/exception/LdapAuthenticationException.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.exception; 2 | 3 | import org.springframework.security.core.AuthenticationException; 4 | 5 | public class LdapAuthenticationException extends AuthenticationException { 6 | 7 | public LdapAuthenticationException(String msg, Throwable t) { 8 | super(msg, t); 9 | } 10 | 11 | public LdapAuthenticationException(String msg) { 12 | super(msg); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/exception/LdapLockAuthenticationException.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.exception; 2 | 3 | import org.springframework.security.core.AuthenticationException; 4 | 5 | public class LdapLockAuthenticationException extends AuthenticationException { 6 | 7 | public LdapLockAuthenticationException(String msg, Throwable t) { 8 | super(msg, t); 9 | } 10 | 11 | public LdapLockAuthenticationException(String msg) { 12 | super(msg); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/mapper/SysConfigMapper.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.mapper; 2 | 3 | import cn.smartcoding.system.domain.SysConfig; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 参数配置 数据层 9 | * 10 | * @author wuque 11 | */ 12 | public interface SysConfigMapper { 13 | /** 14 | * 查询参数配置信息 15 | * 16 | * @param config 参数配置信息 17 | * @return 参数配置信息 18 | */ 19 | public SysConfig selectConfig(SysConfig config); 20 | 21 | /** 22 | * 查询参数配置列表 23 | * 24 | * @param config 参数配置信息 25 | * @return 参数配置集合 26 | */ 27 | public List selectConfigList(SysConfig config); 28 | 29 | /** 30 | * 根据键名查询参数配置信息 31 | * 32 | * @param configKey 参数键名 33 | * @return 参数配置信息 34 | */ 35 | public SysConfig checkConfigKeyUnique(String configKey); 36 | 37 | /** 38 | * 新增参数配置 39 | * 40 | * @param config 参数配置信息 41 | * @return 结果 42 | */ 43 | public int insertConfig(SysConfig config); 44 | 45 | /** 46 | * 修改参数配置 47 | * 48 | * @param config 参数配置信息 49 | * @return 结果 50 | */ 51 | public int updateConfig(SysConfig config); 52 | 53 | /** 54 | * 删除参数配置 55 | * 56 | * @param configId 参数ID 57 | * @return 结果 58 | */ 59 | public int deleteConfigById(Long configId); 60 | 61 | /** 62 | * 批量删除参数信息 63 | * 64 | * @param configIds 需要删除的参数ID 65 | * @return 结果 66 | */ 67 | public int deleteConfigByIds(Long[] configIds); 68 | } 69 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/mapper/SysLdapConfigMapper.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.mapper; 2 | 3 | import cn.smartcoding.system.domain.SysLdapConfig; 4 | 5 | /** 6 | * @author wuque 7 | */ 8 | public interface SysLdapConfigMapper { 9 | 10 | SysLdapConfig getSysDapConfig(); 11 | 12 | int update(SysLdapConfig sysLdapConfig); 13 | 14 | int insert(SysLdapConfig sysLdapConfig); 15 | } 16 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/mapper/SysLogininforMapper.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.mapper; 2 | 3 | import cn.smartcoding.system.domain.SysLogininfor; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 系统访问日志情况信息 数据层 9 | * 10 | * @author wuque 11 | */ 12 | public interface SysLogininforMapper { 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 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/mapper/SysNoticeMapper.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.mapper; 2 | 3 | import cn.smartcoding.system.domain.SysNotice; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 通知公告表 数据层 9 | * 10 | * @author wuque 11 | */ 12 | public interface SysNoticeMapper { 13 | /** 14 | * 查询公告信息 15 | * 16 | * @param noticeId 公告ID 17 | * @return 公告信息 18 | */ 19 | public SysNotice selectNoticeById(Long noticeId); 20 | 21 | /** 22 | * 查询公告列表 23 | * 24 | * @param notice 公告信息 25 | * @return 公告集合 26 | */ 27 | public List selectNoticeList(SysNotice notice); 28 | 29 | /** 30 | * 新增公告 31 | * 32 | * @param notice 公告信息 33 | * @return 结果 34 | */ 35 | public int insertNotice(SysNotice notice); 36 | 37 | /** 38 | * 修改公告 39 | * 40 | * @param notice 公告信息 41 | * @return 结果 42 | */ 43 | public int updateNotice(SysNotice notice); 44 | 45 | /** 46 | * 批量删除公告 47 | * 48 | * @param noticeId 公告ID 49 | * @return 结果 50 | */ 51 | public int deleteNoticeById(Long noticeId); 52 | 53 | /** 54 | * 批量删除公告信息 55 | * 56 | * @param noticeIds 需要删除的公告ID 57 | * @return 结果 58 | */ 59 | public int deleteNoticeByIds(Long[] noticeIds); 60 | } 61 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/mapper/SysOperLogMapper.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.mapper; 2 | 3 | import cn.smartcoding.system.domain.SysOperLog; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 操作日志 数据层 9 | * 10 | * @author wuque 11 | */ 12 | public interface SysOperLogMapper { 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 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/mapper/SysRoleDeptMapper.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.mapper; 2 | 3 | import cn.smartcoding.system.domain.SysRoleDept; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 角色与部门关联表 数据层 9 | * 10 | * @author wuque 11 | */ 12 | public interface SysRoleDeptMapper { 13 | /** 14 | * 通过角色ID删除角色和部门关联 15 | * 16 | * @param roleId 角色ID 17 | * @return 结果 18 | */ 19 | public int deleteRoleDeptByRoleId(Long roleId); 20 | 21 | /** 22 | * 批量删除角色部门关联信息 23 | * 24 | * @param ids 需要删除的数据ID 25 | * @return 结果 26 | */ 27 | public int deleteRoleDept(Long[] ids); 28 | 29 | /** 30 | * 查询部门使用数量 31 | * 32 | * @param deptId 部门ID 33 | * @return 结果 34 | */ 35 | public int selectCountRoleDeptByDeptId(Long deptId); 36 | 37 | /** 38 | * 批量新增角色部门信息 39 | * 40 | * @param roleDeptList 角色部门列表 41 | * @return 结果 42 | */ 43 | public int batchRoleDept(List roleDeptList); 44 | } 45 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/mapper/SysRoleMenuMapper.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.mapper; 2 | 3 | import cn.smartcoding.system.domain.SysRoleMenu; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 角色与菜单关联表 数据层 9 | * 10 | * @author wuque 11 | */ 12 | public interface SysRoleMenuMapper { 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 roleMenuList 角色菜单列表 33 | * @return 结果 34 | */ 35 | public int batchRoleMenu(List roleMenuList); 36 | } 37 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/mapper/SysUserPostMapper.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.mapper; 2 | 3 | import cn.smartcoding.system.domain.SysUserPost; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 用户与岗位关联表 数据层 9 | * 10 | * @author wuque 11 | */ 12 | public interface SysUserPostMapper { 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 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/mapper/SysUserRoleMapper.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.mapper; 2 | 3 | import cn.smartcoding.system.domain.SysUserRole; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 用户与角色关联表 数据层 10 | * 11 | * @author wuque 12 | */ 13 | public interface SysUserRoleMapper { 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 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/security/CaptchaException.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.security; 2 | 3 | import org.springframework.security.core.AuthenticationException; 4 | 5 | /** 6 | * 验证码错误异常类 7 | * 8 | * @author wuque 9 | */ 10 | public class CaptchaException extends AuthenticationException { 11 | private static final long serialVersionUID = 1L; 12 | 13 | public CaptchaException(String msg) { 14 | super(msg); 15 | } 16 | 17 | /** 18 | * Constructs an AuthenticationServiceException with the specified 19 | * message and root cause. 20 | * 21 | * @param msg the detail message 22 | * @param t root cause 23 | */ 24 | public CaptchaException(String msg, Throwable t) { 25 | super(msg, t); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/security/CaptchaExpireException.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.security; 2 | 3 | import org.springframework.security.core.AuthenticationException; 4 | 5 | /** 6 | * 验证码失效异常类 7 | * 8 | * @author wuque 9 | */ 10 | public class CaptchaExpireException extends AuthenticationException { 11 | private static final long serialVersionUID = 1L; 12 | 13 | 14 | 15 | public CaptchaExpireException(String msg) { 16 | super(msg); 17 | } 18 | 19 | /** 20 | * Constructs an AuthenticationServiceException with the specified 21 | * message and root cause. 22 | * 23 | * @param msg the detail message 24 | * @param t root cause 25 | */ 26 | public CaptchaExpireException(String msg, Throwable t) { 27 | super(msg, t); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/security/handle/AuthenticationEntryPointImpl.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.security.handle; 2 | 3 | import cn.smartcoding.common.core.domain.CommonErrorCode; 4 | import cn.smartcoding.common.core.domain.ResultModel; 5 | import cn.smartcoding.common.utils.ServletUtils; 6 | import cn.smartcoding.common.utils.StringUtils; 7 | import com.alibaba.fastjson.JSON; 8 | import org.springframework.security.core.AuthenticationException; 9 | import org.springframework.security.web.AuthenticationEntryPoint; 10 | import org.springframework.stereotype.Component; 11 | 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import java.io.IOException; 15 | import java.io.Serializable; 16 | 17 | /** 18 | * 认证失败处理类 返回未授权 19 | * 20 | * @author wuque 21 | */ 22 | @Component 23 | public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint, Serializable { 24 | private static final long serialVersionUID = -8970718410437077606L; 25 | 26 | @Override 27 | public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) 28 | throws IOException { 29 | String message = e.getMessage(); 30 | String msg = message != null ? message : StringUtils.format("请求访问:{},认证失败,无法访问系统资源", request.getRequestURI()); 31 | ServletUtils.renderString(response, JSON.toJSONString(ResultModel.fail(CommonErrorCode.UNAUTHORIZED, msg))); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/service/ISysLdapConfigService.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.service; 2 | 3 | import cn.smartcoding.system.domain.SysLdapConfig; 4 | import org.springframework.ldap.core.LdapTemplate; 5 | 6 | public interface ISysLdapConfigService { 7 | 8 | SysLdapConfig getSysDapConfig(); 9 | 10 | int update(SysLdapConfig sysLdapConfig); 11 | 12 | int addLdapConfig(SysLdapConfig config); 13 | 14 | void testLdap(SysLdapConfig config); 15 | 16 | LdapTemplate getInstance(SysLdapConfig sysLdapConfig); 17 | 18 | LdapTemplate getInstance(SysLdapConfig sysLdapConfig, boolean cache); 19 | } 20 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/service/ISysLogininforService.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.service; 2 | 3 | import cn.smartcoding.system.domain.SysLogininfor; 4 | import com.github.pagehelper.PageInfo; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 系统访问日志情况信息 服务层 10 | * 11 | * @author wuque 12 | */ 13 | public interface ISysLogininforService { 14 | /** 15 | * 新增系统登录日志 16 | * 17 | * @param logininfor 访问日志对象 18 | */ 19 | public void insertLogininfor(SysLogininfor logininfor); 20 | 21 | /** 22 | * 查询系统登录日志集合 23 | * 24 | * @param logininfor 访问日志对象 25 | * @return 登录记录集合 26 | */ 27 | public List selectLogininforList(SysLogininfor logininfor); 28 | 29 | PageInfo selectLogininforList(Integer pageNum, Integer pageSize, SysLogininfor logininfor); 30 | 31 | /** 32 | * 批量删除系统登录日志 33 | * 34 | * @param infoIds 需要删除的登录日志ID 35 | * @return 36 | */ 37 | public int deleteLogininforByIds(Long[] infoIds); 38 | 39 | /** 40 | * 清空系统登录日志 41 | */ 42 | public void cleanLogininfor(); 43 | } 44 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/service/ISysNoticeService.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.service; 2 | 3 | import cn.smartcoding.system.domain.SysNotice; 4 | import com.github.pagehelper.PageInfo; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 公告 服务层 10 | * 11 | * @author wuque 12 | */ 13 | public interface ISysNoticeService { 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 | public PageInfo selectNoticeList(Integer pageNum, Integer pageSize,SysNotice notice); 32 | 33 | /** 34 | * 新增公告 35 | * 36 | * @param notice 公告信息 37 | * @return 结果 38 | */ 39 | public int insertNotice(SysNotice notice); 40 | 41 | /** 42 | * 修改公告 43 | * 44 | * @param notice 公告信息 45 | * @return 结果 46 | */ 47 | public int updateNotice(SysNotice notice); 48 | 49 | /** 50 | * 删除公告信息 51 | * 52 | * @param noticeId 公告ID 53 | * @return 结果 54 | */ 55 | public int deleteNoticeById(Long noticeId); 56 | 57 | /** 58 | * 批量删除公告信息 59 | * 60 | * @param noticeIds 需要删除的公告ID 61 | * @return 结果 62 | */ 63 | public int deleteNoticeByIds(Long[] noticeIds); 64 | } 65 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/service/ISysOperLogService.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.service; 2 | 3 | import cn.smartcoding.system.domain.SysOperLog; 4 | import com.github.pagehelper.PageInfo; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 操作日志 服务层 10 | * 11 | * @author wuque 12 | */ 13 | public interface ISysOperLogService { 14 | /** 15 | * 新增操作日志 16 | * 17 | * @param operLog 操作日志对象 18 | */ 19 | public void insertOperlog(SysOperLog operLog); 20 | 21 | /** 22 | * 查询系统操作日志集合 23 | * 24 | * @param operLog 操作日志对象 25 | * @return 操作日志集合 26 | */ 27 | public List selectOperLogList(SysOperLog operLog); 28 | 29 | 30 | /** 31 | * 批量删除系统操作日志 32 | * 33 | * @param operIds 需要删除的操作日志ID 34 | * @return 结果 35 | */ 36 | public int deleteOperLogByIds(Long[] operIds); 37 | 38 | /** 39 | * 查询操作日志详细 40 | * 41 | * @param operId 操作ID 42 | * @return 操作日志对象 43 | */ 44 | public SysOperLog selectOperLogById(Long operId); 45 | 46 | /** 47 | * 清空操作日志 48 | */ 49 | public void cleanOperLog(); 50 | 51 | PageInfo selectOperLogList(int pageNum, int pageSize, SysOperLog operLog); 52 | 53 | } 54 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/service/ISysUserOnlineService.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.service; 2 | 3 | import cn.smartcoding.common.core.domain.model.LoginUser; 4 | import cn.smartcoding.system.domain.SysUserOnline; 5 | 6 | /** 7 | * 在线用户 服务层 8 | * 9 | * @author wuque 10 | */ 11 | public interface ISysUserOnlineService { 12 | /** 13 | * 通过登录地址查询信息 14 | * 15 | * @param ipaddr 登录地址 16 | * @param user 用户信息 17 | * @return 在线用户信息 18 | */ 19 | public SysUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user); 20 | 21 | /** 22 | * 通过用户名称查询信息 23 | * 24 | * @param userName 用户名称 25 | * @param user 用户信息 26 | * @return 在线用户信息 27 | */ 28 | public SysUserOnline selectOnlineByUserName(String userName, LoginUser user); 29 | 30 | /** 31 | * 通过登录地址/用户名称查询信息 32 | * 33 | * @param ipaddr 登录地址 34 | * @param userName 用户名称 35 | * @param user 用户信息 36 | * @return 在线用户信息 37 | */ 38 | public SysUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user); 39 | 40 | /** 41 | * 设置在线用户信息 42 | * 43 | * @param user 用户信息 44 | * @return 在线用户 45 | */ 46 | public SysUserOnline loginUserToUserOnline(LoginUser user); 47 | } 48 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/service/UserDetailsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.service; 2 | 3 | import cn.smartcoding.common.core.domain.entity.SysUser; 4 | import cn.smartcoding.system.security.authentication.AbstractPreAuthenticationChecks; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.security.core.userdetails.UserDetails; 9 | import org.springframework.security.core.userdetails.UserDetailsService; 10 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 11 | import org.springframework.stereotype.Service; 12 | 13 | /** 14 | * 用户验证处理 15 | * 16 | * @author wuque 17 | */ 18 | @Service 19 | public class UserDetailsServiceImpl extends AbstractPreAuthenticationChecks implements UserDetailsService { 20 | private static final Logger log = LoggerFactory.getLogger(UserDetailsServiceImpl.class); 21 | 22 | @Autowired 23 | private ISysUserService userService; 24 | 25 | @Autowired 26 | private SysPermissionService permissionService; 27 | 28 | @Override 29 | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { 30 | SysUser user = userService.selectUserByUserName(username); 31 | return getUserDetails(username, user, permissionService); 32 | } 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /smart-job-system/src/main/java/cn/smartcoding/system/vo/LdapTestVO.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.system.vo; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class LdapTestVO { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /smart-job-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 | 35 | -------------------------------------------------------------------------------- /smart-job-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 | insert into sys_role_menu(role_id, menu_id) values 22 | 23 | (#{item.roleId},#{item.menuId}) 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /smart-job-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 | 35 | -------------------------------------------------------------------------------- /smart-job-web/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/smart-job-web/.DS_Store -------------------------------------------------------------------------------- /smart-job-web/src/main/java/cn/smartcoding/JobApplication.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 8 | 9 | /** 10 | * 启动程序 11 | * 12 | * @author wuque 13 | */ 14 | @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}) 15 | 16 | public class JobApplication { 17 | 18 | private static Logger LOG = LoggerFactory.getLogger(JobApplication.class); 19 | 20 | public static void main(String[] args) { 21 | SpringApplication.run(JobApplication.class, args); 22 | LOG.info("=============================spring boot start successful !============================="); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /smart-job-web/src/main/java/cn/smartcoding/web/controller/StartCheckController.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.web.controller; 4 | 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.http.HttpStatus; 8 | import org.springframework.http.ResponseEntity; 9 | import org.springframework.validation.annotation.Validated; 10 | import org.springframework.web.bind.annotation.GetMapping; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | @Validated 15 | @RestController 16 | @RequestMapping("/") 17 | public class StartCheckController { 18 | private static final Logger logger = LoggerFactory.getLogger(StartCheckController.class); 19 | 20 | private boolean makeFail = false; 21 | 22 | /** 23 | * SLB状态检查和发布脚本自检都会用到该url 24 | * 25 | * @return 26 | */ 27 | @GetMapping(value = "checkpreload.htm") 28 | public ResponseEntity checkPreload() { 29 | if (makeFail) { 30 | return new ResponseEntity<>("fail", HttpStatus.NOT_FOUND); 31 | } 32 | return new ResponseEntity<>("success", HttpStatus.OK); 33 | } 34 | 35 | /** 36 | * 系统关闭前调用这个接口 37 | * 38 | * @return 39 | */ 40 | @GetMapping(value = "makeFail.htm") 41 | public String makeFail() { 42 | makeFail = true; 43 | return "success"; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /smart-job-web/src/main/java/cn/smartcoding/web/controller/job/IndexController.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.web.controller.job; 4 | 5 | import cn.smartcoding.common.core.controller.BaseController; 6 | import cn.smartcoding.common.core.domain.ResultModel; 7 | import cn.smartcoding.schedule.service.XxlJobService; 8 | import org.springframework.stereotype.Controller; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.ResponseBody; 11 | 12 | import javax.annotation.Resource; 13 | import java.util.Date; 14 | import java.util.Map; 15 | 16 | /** 17 | * index controller 18 | * 19 | * @author xuxueli 2015-12-19 16:13:16 20 | */ 21 | @Controller 22 | @RequestMapping("/api") 23 | public class IndexController extends BaseController { 24 | 25 | @Resource 26 | private XxlJobService xxlJobService; 27 | 28 | 29 | //新的仪表盘接口 30 | @RequestMapping("/dashboardInfo") 31 | @ResponseBody 32 | public ResultModel dashboardInfo() { 33 | return ResultModel.success(xxlJobService.dashboardInfo()); 34 | } 35 | 36 | @RequestMapping("/chartInfo") 37 | @ResponseBody 38 | public ResultModel chartInfo(Date startDate, Date endDate) { 39 | Map chartInfo = xxlJobService.chartInfo(startDate, endDate); 40 | 41 | return ResultModel.success(chartInfo); 42 | } 43 | 44 | 45 | } 46 | -------------------------------------------------------------------------------- /smart-job-web/src/main/java/cn/smartcoding/web/controller/job/JobApiController.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package cn.smartcoding.web.controller.job; 4 | 5 | import cn.smartcoding.schedule.core.conf.XxlJobScheduler; 6 | import cn.smartcoding.job.core.biz.AdminBiz; 7 | import org.springframework.beans.factory.InitializingBean; 8 | import org.springframework.stereotype.Controller; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | 11 | import javax.servlet.ServletException; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import java.io.IOException; 15 | 16 | /** 17 | * api回调页面 18 | * Created by xuxueli on 17/5/10. 19 | */ 20 | @Controller 21 | public class JobApiController implements InitializingBean { 22 | 23 | 24 | @Override 25 | public void afterPropertiesSet() throws Exception { 26 | 27 | } 28 | 29 | @RequestMapping(AdminBiz.MAPPING) 30 | public void api(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { 31 | XxlJobScheduler.invokeAdminService(request, response); 32 | } 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /smart-job-web/src/main/java/cn/smartcoding/web/controller/monitor/ServerController.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.web.controller.monitor; 2 | 3 | import cn.smartcoding.common.core.controller.BaseController; 4 | import cn.smartcoding.common.core.domain.ResultModel; 5 | import cn.smartcoding.framework.web.domain.Server; 6 | import org.springframework.security.access.prepost.PreAuthorize; 7 | import org.springframework.web.bind.annotation.GetMapping; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | /** 12 | * 服务器监控 13 | * 14 | * @author wuque 15 | */ 16 | @RestController 17 | @RequestMapping("/api/monitor/server") 18 | public class ServerController extends BaseController { 19 | 20 | @PreAuthorize("@ss.hasPermi('monitor:server:list')") 21 | @GetMapping() 22 | public ResultModel getInfo() throws Exception { 23 | Server server = new Server(); 24 | server.copyTo(); 25 | return ResultModel.success(server); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /smart-job-web/src/main/java/cn/smartcoding/web/controller/tool/SwaggerController.java: -------------------------------------------------------------------------------- 1 | package cn.smartcoding.web.controller.tool; 2 | 3 | import cn.smartcoding.common.core.controller.BaseController; 4 | import org.springframework.security.access.prepost.PreAuthorize; 5 | import org.springframework.stereotype.Controller; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | 9 | /** 10 | * swagger 接口 11 | * 12 | * @author wuque 13 | */ 14 | @Controller 15 | @RequestMapping("/api/tool/swagger") 16 | public class SwaggerController extends BaseController { 17 | @PreAuthorize("@ss.hasPermi('tool:swagger:view')") 18 | @GetMapping() 19 | public String index() { 20 | return redirect("/swagger-ui.html"); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /smart-job-web/src/main/resources/META-INF/spring-devtools.properties: -------------------------------------------------------------------------------- 1 | restart.include.json=/com.alibaba.fastjson.*.jar -------------------------------------------------------------------------------- /smart-job-web/src/main/resources/application-dev.yml: -------------------------------------------------------------------------------- 1 | # 开发环境配置 2 | server: 3 | port: 7040 4 | # 数据源配置 5 | spring: 6 | datasource: 7 | druid: 8 | # 主库数据源 9 | master: 10 | url: jdbc:mysql://127.0.0.1:3306/xxl_job?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 11 | username: root 12 | password: 123456 13 | # redis 配置 14 | redis: 15 | # 地址 16 | host: 127.0.0.1 17 | # 端口,默认为6379 18 | port: 6379 19 | # 密码 20 | password: 21 | database: 11 22 | xxl: 23 | job: 24 | accessToken: 0e8701d4307a445c90b4e70565893a95 25 | adminAddresses: http://127.0.0.1:7040 26 | applicationName: 调度平台-开发环境 27 | executor: 28 | appName: xxl-job 29 | title: xxl-job 30 | autoCreateJob: true 31 | autoStartJob: true 32 | ip: '' 33 | logpath: /data/logs/xxl-job/jobhandler 34 | logretentiondays: 3 35 | port: 7998 36 | 37 | -------------------------------------------------------------------------------- /smart-job-web/src/main/resources/application-prod.yml: -------------------------------------------------------------------------------- 1 | # 线上环境配置 2 | server: 3 | # 服务器的HTTP端口,默认为8080 4 | port: 7040 5 | # 数据源配置 6 | spring: 7 | profiles: 8 | active: prod 9 | datasource: 10 | druid: 11 | # 主库数据源 12 | master: 13 | url: jdbc:mysql://127.0.0.1:3306/xxl_job_2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 14 | username: root 15 | password: 123456 16 | # redis 配置 17 | redis: 18 | # 地址 19 | host: 127.0.0.1 20 | # 端口,默认为6379 21 | port: 6379 22 | # 密码 23 | password: 24 | xxl: 25 | job: 26 | accessToken: 0e8701d4307a445c90b4e70565893a95 27 | adminAddresses: http://127.0.0.1:7040 28 | applicationName: 调度平台-开发环境 29 | executor: 30 | appName: xxl-job 31 | title: xxl-job 32 | autoCreateJob: true 33 | autoStartJob: true 34 | ip: '' 35 | logpath: /data/logs/xxl-job/jobhandler 36 | logretentiondays: 3 37 | port: 7998 38 | 39 | log: 40 | dir: /data/logs/${spring.application.name} 41 | level: info 42 | -------------------------------------------------------------------------------- /smart-job-web/src/main/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | # 测试环境配置 2 | server: 3 | port: 7040 4 | # 数据源配置 5 | spring: 6 | profiles: 7 | active: test 8 | datasource: 9 | druid: 10 | # 主库数据源 11 | master: 12 | url: jdbc:mysql://127.0.0.1:3306/xxl_job?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 13 | username: root 14 | password: 123456 15 | # redis 配置 16 | redis: 17 | # 地址 18 | host: 127.0.0.1 19 | # 端口,默认为6379 20 | port: 6379 21 | # 密码 22 | password: 23 | xxl: 24 | job: 25 | accessToken: 0e8701d4307a445c90b4e70565893a95 26 | adminAddresses: http://127.0.0.1:7040 27 | applicationName: 调度平台-开发环境 28 | executor: 29 | appName: xxl-job 30 | title: xxl-job 31 | autoCreateJob: true 32 | autoStartJob: true 33 | ip: '' 34 | logpath: /data/logs/xxl-job/jobhandler 35 | logretentiondays: 3 36 | port: 7998 37 | -------------------------------------------------------------------------------- /smart-job-web/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | Application Version: ${smart-job.version} 2 | Spring Boot Version: ${spring-boot.version} 3 | -------------------------------------------------------------------------------- /smart-job-web/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}次,帐户锁定10分钟 9 | user.password.delete=对不起,您的账号已被删除 10 | user.blocked=用户已封禁,请联系管理员 11 | role.blocked=角色已封禁,请联系管理员 12 | user.logout.success=退出成功 13 | 14 | length.not.valid=长度必须在{min}到{max}个字符之间 15 | 16 | user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头 17 | user.password.not.valid=* 5-50个字符 18 | 19 | user.email.not.valid=邮箱格式错误 20 | user.mobile.phone.number.not.valid=手机号格式错误 21 | user.login.success=登录成功 22 | user.notfound=请重新登录 23 | user.forcelogout=管理员强制退出,请重新登录 24 | user.unknown.error=未知错误,请重新登录 25 | 26 | ##文件上传消息 27 | upload.exceed.maxSize=上传的文件大小超出限制的文件大小!
允许的文件最大大小是:{0}MB! 28 | upload.filename.exceed.length=上传的文件名最长{0}个字符 29 | 30 | ##权限 31 | no.permission=您没有数据的权限,请联系管理员添加权限 [{0}] 32 | no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}] 33 | no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}] 34 | no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}] 35 | no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}] 36 | no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}] 37 | --------------------------------------------------------------------------------