mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-18 01:06:40 +08:00
update 格式化代码 统一间隔符
update 格式化代码 统一间隔符
This commit is contained in:
parent
857dec38d1
commit
a0bed51d96
140
README.md
140
README.md
@ -13,41 +13,39 @@
|
|||||||
|
|
||||||
> 系统演示: [传送门](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/系统演示?sort_id=4836388)
|
> 系统演示: [传送门](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/系统演示?sort_id=4836388)
|
||||||
|
|
||||||
| 功能介绍 | 使用技术 | 文档地址 | 特性注意事项 |
|
| 功能介绍 | 使用技术 | 文档地址 | 特性注意事项 |
|
||||||
|---|---|---|---|
|
|-----------|------------------------|---------------------------------------------------------------------------------------------------|--------------------------|
|
||||||
| 当前框架 | RuoYi-Vue-Plus | [RuoYi-Vue-Plus文档](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages) | 重写RuoYi-Vue全方位升级(不兼容原框架) |
|
| 当前框架 | RuoYi-Vue-Plus | [RuoYi-Vue-Plus文档](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages) | 重写RuoYi-Vue全方位升级(不兼容原框架) |
|
||||||
| satoken分支 | RuoYi-Vue-Plus-satoken | [satoken分支地址](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/tree/satoken/) | 高可读性 扩展性(推荐使用) |
|
| 单体分支 | RuoYi-Vue-Plus-fast | [fast分支地址](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/tree/fast/) | 单体应用结构 |
|
||||||
| 单体分支 | RuoYi-Vue-Plus-fast | [fast分支地址](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/tree/fast/) | 单体应用结构 |
|
| Vue3分支 | RuoYi-Vue-Plus-UI | [UI地址](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus-UI) | 由于组件还未完善 仅供学习 |
|
||||||
| Vue3分支 | RuoYi-Vue-Plus-UI | [UI地址](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus-UI) | 由于组件还未完善 仅供学习 |
|
| 原框架 | RuoYi-Vue | [RuoYi-Vue官网](http://ruoyi.vip/) | 定期同步需要的功能 |
|
||||||
| 原框架 | RuoYi-Vue | [RuoYi-Vue官网](http://ruoyi.vip/) | 定期同步需要的功能 |
|
| 前端开发框架 | Vue、Element UI | [Element UI官网](https://element.eleme.cn/#/zh-CN) | |
|
||||||
| 前端开发框架 | Vue、Element UI | [Element UI官网](https://element.eleme.cn/#/zh-CN) | |
|
| 后端开发框架 | SpringBoot | [SpringBoot官网](https://spring.io/projects/spring-boot/#learn) | |
|
||||||
| 后端开发框架 | SpringBoot | [SpringBoot官网](https://spring.io/projects/spring-boot/#learn) | |
|
| 容器框架 | Undertow | [Undertow官网](https://undertow.io/) | 基于 XNIO 的高性能容器 |
|
||||||
| 容器框架 | Undertow | [Undertow官网](https://undertow.io/) | 基于 XNIO 的高性能容器 |
|
| 权限认证框架 | Sa-Token、Jwt | [Sa-Token官网](https://sa-token.dev33.cn/) | 强解耦、强扩展 |
|
||||||
| 权限认证框架 | Spring Security、Jwt | [SpringSecurity官网](https://spring.io/projects/spring-security#learn) | 支持多终端认证系统 |
|
| 关系数据库 | MySQL | [MySQL官网](https://dev.mysql.com/) | 适配 8.X 最低 5.7 |
|
||||||
| 权限认证框架 | Sa-Token、Jwt | [Sa-Token官网](https://sa-token.dev33.cn/) | 强解耦、强扩展 |
|
| 缓存数据库 | Redis | [Redis官网](https://redis.io/) | 适配 6.X 最低 4.X |
|
||||||
| 关系数据库 | MySQL | [MySQL官网](https://dev.mysql.com/) | 适配 8.X 最低 5.7 |
|
| 数据库框架 | Mybatis-Plus | [Mybatis-Plus文档](https://baomidou.com/guide/) | 快速 CRUD 增加开发效率 |
|
||||||
| 缓存数据库 | Redis | [Redis官网](https://redis.io/) | 适配 6.X 最低 4.X |
|
| 数据库框架 | p6spy | [p6spy官网](https://p6spy.readthedocs.io/) | 更强劲的 SQL 分析 |
|
||||||
| 数据库框架 | Mybatis-Plus | [Mybatis-Plus文档](https://baomidou.com/guide/) | 快速 CRUD 增加开发效率 |
|
| 多数据源框架 | dynamic-datasource | [dynamic-ds文档](https://www.kancloud.cn/tracy5546/dynamic-datasource/content) | 支持主从与多种类数据库异构 |
|
||||||
| 数据库框架 | p6spy | [p6spy官网](https://p6spy.readthedocs.io/) | 更强劲的 SQL 分析 |
|
| 序列化框架 | Jackson | [Jackson官网](https://github.com/FasterXML/jackson) | 统一使用 jackson 高效可靠 |
|
||||||
| 多数据源框架 | dynamic-datasource | [dynamic-ds文档](https://www.kancloud.cn/tracy5546/dynamic-datasource/content) | 支持主从与多种类数据库异构 |
|
| Redis客户端 | Redisson | [Redisson文档](https://github.com/redisson/redisson/wiki/%E7%9B%AE%E5%BD%95) | 支持单机、集群配置 |
|
||||||
| 序列化框架 | Jackson | [Jackson官网](https://github.com/FasterXML/jackson) | 统一使用 jackson 高效可靠 |
|
| 分布式限流 | Redisson | [Redisson文档](https://github.com/redisson/redisson/wiki/%E7%9B%AE%E5%BD%95) | 全局、请求IP、集群ID 多种限流 |
|
||||||
| Redis客户端 | Redisson | [Redisson文档](https://github.com/redisson/redisson/wiki/%E7%9B%AE%E5%BD%95) | 支持单机、集群配置 |
|
| 分布式队列 | Redisson | [Redisson文档](https://github.com/redisson/redisson/wiki/%E7%9B%AE%E5%BD%95) | 普通队列、延迟队列、优先队列 等 |
|
||||||
| 分布式限流 | Redisson | [Redisson文档](https://github.com/redisson/redisson/wiki/%E7%9B%AE%E5%BD%95) | 全局、请求IP、集群ID 多种限流 |
|
| 分布式锁 | Lock4j | [Lock4j官网](https://gitee.com/baomidou/lock4j) | 注解锁、工具锁 多种多样 |
|
||||||
| 分布式队列 | Redisson | [Redisson文档](https://github.com/redisson/redisson/wiki/%E7%9B%AE%E5%BD%95) | 普通队列、延迟队列、优先队列 等 |
|
| 分布式幂等 | Redisson | [Lock4j文档](https://gitee.com/baomidou/lock4j) | 拦截重复提交 |
|
||||||
| 分布式锁 | Lock4j | [Lock4j官网](https://gitee.com/baomidou/lock4j) | 注解锁、工具锁 多种多样 |
|
| 分布式日志 | TLog | [TLog文档](https://yomahub.com/tlog/docs) | 支持跟踪链路日志记录、性能分析、链路排查 |
|
||||||
| 分布式幂等 | Redisson | [Lock4j文档](https://gitee.com/baomidou/lock4j) | 拦截重复提交 |
|
| 分布式任务调度 | Xxl-Job | [Xxl-Job官网](https://www.xuxueli.com/xxl-job/) | 高性能 高可靠 易扩展 |
|
||||||
| 分布式日志 | TLog | [TLog文档](https://yomahub.com/tlog/docs) | 支持跟踪链路日志记录、性能分析、链路排查 |
|
| 文件存储 | Minio | [Minio文档](https://docs.min.io/) | 本地存储 |
|
||||||
| 分布式任务调度 | Xxl-Job | [Xxl-Job官网](https://www.xuxueli.com/xxl-job/) | 高性能 高可靠 易扩展 |
|
| 文件存储 | 七牛、阿里、腾讯 | [OSS使用文档](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4359146&doc_id=1469725) | 云存储 |
|
||||||
| 文件存储 | Minio | [Minio文档](https://docs.min.io/) | 本地存储 |
|
| 监控框架 | SpringBoot-Admin | [SpringBoot-Admin文档](https://codecentric.github.io/spring-boot-admin/current/) | 全方位服务监控 |
|
||||||
| 文件存储 | 七牛、阿里、腾讯 | [OSS使用文档](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4359146&doc_id=1469725) | 云存储 |
|
| 校验框架 | Validation | [Validation文档](https://docs.jboss.org/hibernate/stable/validator/reference/en-US/html_single/) | 增强接口安全性、严谨性 支持国际化 |
|
||||||
| 监控框架 | SpringBoot-Admin | [SpringBoot-Admin文档](https://codecentric.github.io/spring-boot-admin/current/) | 全方位服务监控 |
|
| Excel框架 | Alibaba EasyExcel | [EasyExcel文档](https://www.yuque.com/easyexcel/doc/easyexcel) | 性能优异 扩展性强 |
|
||||||
| 校验框架 | Validation | [Validation文档](https://docs.jboss.org/hibernate/stable/validator/reference/en-US/html_single/) | 增强接口安全性、严谨性 支持国际化 |
|
| 文档框架 | Knife4j | [Knife4j文档](https://doc.xiaominfo.com/knife4j/documentation/) | 美化接口文档 |
|
||||||
| Excel框架 | Alibaba EasyExcel | [EasyExcel文档](https://www.yuque.com/easyexcel/doc/easyexcel) | 性能优异 扩展性强 |
|
| 工具类框架 | Hutool、Lombok | [Hutool文档](https://www.hutool.cn/docs/) | 减少代码冗余 增加安全性 |
|
||||||
| 文档框架 | Knife4j | [Knife4j文档](https://doc.xiaominfo.com/knife4j/documentation/) | 美化接口文档 |
|
| 代码生成器 | 适配MP、Knife4j规范化代码 | [Hutool文档](https://www.hutool.cn/docs/) | 一键生成前后端代码 |
|
||||||
| 工具类框架 | Hutool、Lombok | [Hutool文档](https://www.hutool.cn/docs/) | 减少代码冗余 增加安全性 |
|
| 部署方式 | Docker | [Docker文档](https://docs.docker.com/) | 容器编排 一键部署业务集群 |
|
||||||
| 代码生成器 | 适配MP、Knife4j规范化代码 | [Hutool文档](https://www.hutool.cn/docs/) | 一键生成前后端代码 |
|
| 国际化 | SpringMessage | [SpringMVC文档](https://docs.spring.io/spring-framework/docs/current/reference/html/web.html#mvc) | Spring标准国际化方案 |
|
||||||
| 部署方式 | Docker | [Docker文档](https://docs.docker.com/) | 容器编排 一键部署业务集群 |
|
|
||||||
| 国际化 | SpringMessage | [SpringMVC文档](https://docs.spring.io/spring-framework/docs/current/reference/html/web.html#mvc) | Spring标准国际化方案 |
|
|
||||||
|
|
||||||
## 参考文档
|
## 参考文档
|
||||||
|
|
||||||
@ -115,40 +113,40 @@
|
|||||||
## 演示图例
|
## 演示图例
|
||||||
|
|
||||||
<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
|
<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-972235bcbe3518dedd351ff0e2ee7d1031c.png" width="1920" /></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-972235bcbe3518dedd351ff0e2ee7d1031c.png" width="1920" /></td>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-5e0097702fa91e2e36391de8127676a7fa1.png" width="1920" /></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-5e0097702fa91e2e36391de8127676a7fa1.png" width="1920" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<p><img src="https://oscimg.oschina.net/oscnet/up-e56e3828f48cd9886d88731766f06d5f3c1.png" width="1920" /></p>
|
<p><img src="https://oscimg.oschina.net/oscnet/up-e56e3828f48cd9886d88731766f06d5f3c1.png" width="1920" /></p>
|
||||||
</td>
|
</td>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-0715990ea1a9f254ec2138fcd063c1f556a.png" width="1920" /></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-0715990ea1a9f254ec2138fcd063c1f556a.png" width="1920" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-eaf5417ccf921bb64abb959e3d8e290467f.png" width="1920" /></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-eaf5417ccf921bb64abb959e3d8e290467f.png" width="1920" /></td>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-fc285cf33095ebf8318de6999af0f473861.png" width="1920" /></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-fc285cf33095ebf8318de6999af0f473861.png" width="1920" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-60c83fd8bd61c29df6dbf47c88355e9c272.png" width="1920" /></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-60c83fd8bd61c29df6dbf47c88355e9c272.png" width="1920" /></td>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-7f731948c8b73c7d90f67f9e1c7a534d5c3.png" width="1920" /></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-7f731948c8b73c7d90f67f9e1c7a534d5c3.png" width="1920" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-e4de89b5e2d20c52d3c3a47f9eb88eb8526.png" width="1920" /></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-e4de89b5e2d20c52d3c3a47f9eb88eb8526.png" width="1920" /></td>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-8791d823a508eb90e67c604f36f57491a67.png" width="1920" /></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-8791d823a508eb90e67c604f36f57491a67.png" width="1920" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-4589afd99982ead331785299b894174feb6.png" width="1920" /></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-4589afd99982ead331785299b894174feb6.png" width="1920" /></td>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-8ea177cdacaea20995daf2f596b15232561.png" width="1920" /></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-8ea177cdacaea20995daf2f596b15232561.png" width="1920" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-32d1d04c55c11f74c9129fbbc58399728c4.png" width="1920" /></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-32d1d04c55c11f74c9129fbbc58399728c4.png" width="1920" /></td>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-04fa118f7631b7ae6fd72299ca0a1430a63.png" width="1920" /></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-04fa118f7631b7ae6fd72299ca0a1430a63.png" width="1920" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-fe7e85b65827802bfaadf3acd42568b58c7.png" width="1920" /></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-fe7e85b65827802bfaadf3acd42568b58c7.png" width="1920" /></td>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-eff2b02a54f8188022d8498cfe6af6fcc06.png" width="1920" /></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-eff2b02a54f8188022d8498cfe6af6fcc06.png" width="1920" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-vue-plus</artifactId>
|
<artifactId>ruoyi-vue-plus</artifactId>
|
||||||
|
@ -6,7 +6,6 @@ import com.ruoyi.common.core.controller.BaseController;
|
|||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||||
import com.ruoyi.common.core.service.TokenService;
|
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
@ -40,7 +39,6 @@ import java.util.Map;
|
|||||||
public class SysProfileController extends BaseController {
|
public class SysProfileController extends BaseController {
|
||||||
|
|
||||||
private final ISysUserService userService;
|
private final ISysUserService userService;
|
||||||
private final TokenService tokenService;
|
|
||||||
private final ISysOssService iSysOssService;
|
private final ISysOssService iSysOssService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,13 +5,13 @@
|
|||||||
value="%red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}%n) - %msg%n"/>
|
value="%red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}%n) - %msg%n"/>
|
||||||
<property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"/>
|
<property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"/>
|
||||||
|
|
||||||
<!-- 控制台输出 -->
|
<!-- 控制台输出 -->
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
|
<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
|
||||||
<pattern>${console.log.pattern}</pattern>
|
<pattern>${console.log.pattern}</pattern>
|
||||||
<charset>utf-8</charset>
|
<charset>utf-8</charset>
|
||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<!-- 控制台输出 -->
|
<!-- 控制台输出 -->
|
||||||
<appender name="file_console" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
<appender name="file_console" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
@ -32,20 +32,20 @@
|
|||||||
</filter>
|
</filter>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<!-- 系统日志输出 -->
|
<!-- 系统日志输出 -->
|
||||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
<file>${log.path}/sys-info.log</file>
|
<file>${log.path}/sys-info.log</file>
|
||||||
<!-- 循环政策:基于时间创建日志文件 -->
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
<!-- 日志文件名格式 -->
|
<!-- 日志文件名格式 -->
|
||||||
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
<!-- 日志最大的历史 60天 -->
|
<!-- 日志最大的历史 60天 -->
|
||||||
<maxHistory>60</maxHistory>
|
<maxHistory>60</maxHistory>
|
||||||
</rollingPolicy>
|
</rollingPolicy>
|
||||||
<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
|
<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
|
||||||
<pattern>${log.pattern}</pattern>
|
<pattern>${log.pattern}</pattern>
|
||||||
</encoder>
|
</encoder>
|
||||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
<!-- 过滤的级别 -->
|
<!-- 过滤的级别 -->
|
||||||
<level>INFO</level>
|
<level>INFO</level>
|
||||||
<!-- 匹配时的操作:接收(记录) -->
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
@ -53,16 +53,16 @@
|
|||||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
<onMismatch>DENY</onMismatch>
|
<onMismatch>DENY</onMismatch>
|
||||||
</filter>
|
</filter>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
<file>${log.path}/sys-error.log</file>
|
<file>${log.path}/sys-error.log</file>
|
||||||
<!-- 循环政策:基于时间创建日志文件 -->
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
<!-- 日志文件名格式 -->
|
<!-- 日志文件名格式 -->
|
||||||
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
<!-- 日志最大的历史 60天 -->
|
<!-- 日志最大的历史 60天 -->
|
||||||
<maxHistory>60</maxHistory>
|
<maxHistory>60</maxHistory>
|
||||||
</rollingPolicy>
|
</rollingPolicy>
|
||||||
<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
|
<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
|
||||||
<pattern>${log.pattern}</pattern>
|
<pattern>${log.pattern}</pattern>
|
||||||
@ -70,23 +70,23 @@
|
|||||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
<!-- 过滤的级别 -->
|
<!-- 过滤的级别 -->
|
||||||
<level>ERROR</level>
|
<level>ERROR</level>
|
||||||
<!-- 匹配时的操作:接收(记录) -->
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
<onMatch>ACCEPT</onMatch>
|
<onMatch>ACCEPT</onMatch>
|
||||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
<onMismatch>DENY</onMismatch>
|
<onMismatch>DENY</onMismatch>
|
||||||
</filter>
|
</filter>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<!-- 系统模块日志级别控制 -->
|
<!-- 系统模块日志级别控制 -->
|
||||||
<logger name="com.ruoyi" level="info" />
|
<logger name="com.ruoyi" level="info" />
|
||||||
<!-- Spring日志级别控制 -->
|
<!-- Spring日志级别控制 -->
|
||||||
<logger name="org.springframework" level="warn" />
|
<logger name="org.springframework" level="warn" />
|
||||||
|
|
||||||
<root level="info">
|
<root level="info">
|
||||||
<appender-ref ref="console" />
|
<appender-ref ref="console" />
|
||||||
</root>
|
</root>
|
||||||
|
|
||||||
<!--系统操作日志-->
|
<!--系统操作日志-->
|
||||||
<root level="info">
|
<root level="info">
|
||||||
<appender-ref ref="file_info" />
|
<appender-ref ref="file_info" />
|
||||||
<appender-ref ref="file_error" />
|
<appender-ref ref="file_error" />
|
||||||
|
@ -41,7 +41,7 @@ public class TestBatchController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@ApiOperation(value = "新增批量方法")
|
@ApiOperation(value = "新增批量方法")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
// @DS("slave")
|
// @DS("slave")
|
||||||
public AjaxResult<Void> add() {
|
public AjaxResult<Void> add() {
|
||||||
List<TestDemo> list = new ArrayList<>();
|
List<TestDemo> list = new ArrayList<>();
|
||||||
for (int i = 0; i < 1000; i++) {
|
for (int i = 0; i < 1000; i++) {
|
||||||
@ -57,7 +57,7 @@ public class TestBatchController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@ApiOperation(value = "新增或更新批量方法")
|
@ApiOperation(value = "新增或更新批量方法")
|
||||||
@PostMapping("/addOrUpdate")
|
@PostMapping("/addOrUpdate")
|
||||||
// @DS("slave")
|
// @DS("slave")
|
||||||
public AjaxResult<Void> addOrUpdate() {
|
public AjaxResult<Void> addOrUpdate() {
|
||||||
List<TestDemo> list = new ArrayList<>();
|
List<TestDemo> list = new ArrayList<>();
|
||||||
for (int i = 0; i < 1000; i++) {
|
for (int i = 0; i < 1000; i++) {
|
||||||
@ -79,7 +79,7 @@ public class TestBatchController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@ApiOperation(value = "删除批量方法")
|
@ApiOperation(value = "删除批量方法")
|
||||||
@DeleteMapping()
|
@DeleteMapping()
|
||||||
// @DS("slave")
|
// @DS("slave")
|
||||||
public AjaxResult<Void> remove() {
|
public AjaxResult<Void> remove() {
|
||||||
return toAjax(testDemoMapper.delete(new LambdaQueryWrapper<TestDemo>()
|
return toAjax(testDemoMapper.delete(new LambdaQueryWrapper<TestDemo>()
|
||||||
.eq(TestDemo::getOrderNum, -1L)));
|
.eq(TestDemo::getOrderNum, -1L)));
|
||||||
|
@ -95,8 +95,8 @@ public class TestDemoController extends BaseController {
|
|||||||
List<TestDemoVo> list = iTestDemoService.queryList(bo);
|
List<TestDemoVo> list = iTestDemoService.queryList(bo);
|
||||||
// 测试雪花id导出
|
// 测试雪花id导出
|
||||||
// for (TestDemoVo vo : list) {
|
// for (TestDemoVo vo : list) {
|
||||||
// vo.setId(1234567891234567893L);
|
// vo.setId(1234567891234567893L);
|
||||||
// }
|
// }
|
||||||
ExcelUtil.exportExcel(list, "测试单表", TestDemoVo.class, response);
|
ExcelUtil.exportExcel(list, "测试单表", TestDemoVo.class, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,126 +1,126 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi-extend</artifactId>
|
<artifactId>ruoyi-extend</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>3.5.0</version>
|
<version>3.5.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>ruoyi-xxl-job-admin</artifactId>
|
<artifactId>ruoyi-xxl-job-admin</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<mybatis-spring-boot-starter.version>2.1.4</mybatis-spring-boot-starter.version>
|
<mybatis-spring-boot-starter.version>2.1.4</mybatis-spring-boot-starter.version>
|
||||||
<mysql-connector-java.version>8.0.23</mysql-connector-java.version>
|
<mysql-connector-java.version>8.0.23</mysql-connector-java.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>${spring-boot.version}</version>
|
<version>${spring-boot.version}</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!-- starter-web:spring-webmvc + autoconfigure + logback + yaml + tomcat -->
|
<!-- starter-web:spring-webmvc + autoconfigure + logback + yaml + tomcat -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- starter-test:junit + spring-test + mockito -->
|
<!-- starter-test:junit + spring-test + mockito -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- freemarker-starter -->
|
<!-- freemarker-starter -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-freemarker</artifactId>
|
<artifactId>spring-boot-starter-freemarker</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- mail-starter -->
|
<!-- mail-starter -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-mail</artifactId>
|
<artifactId>spring-boot-starter-mail</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- starter-actuator -->
|
<!-- starter-actuator -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- mybatis-starter:mybatis + mybatis-spring + hikari(default) -->
|
<!-- mybatis-starter:mybatis + mybatis-spring + hikari(default) -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mybatis.spring.boot</groupId>
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
<version>${mybatis-spring-boot-starter.version}</version>
|
<version>${mybatis-spring-boot-starter.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- mysql -->
|
<!-- mysql -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>mysql</groupId>
|
<groupId>mysql</groupId>
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
<version>${mysql-connector-java.version}</version>
|
<version>${mysql-connector-java.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.codecentric</groupId>
|
<groupId>de.codecentric</groupId>
|
||||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- xxl-job-core -->
|
<!-- xxl-job-core -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.xuxueli</groupId>
|
<groupId>com.xuxueli</groupId>
|
||||||
<artifactId>xxl-job-core</artifactId>
|
<artifactId>xxl-job-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<finalName>${project.artifactId}</finalName>
|
<finalName>${project.artifactId}</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
<version>${spring-boot.version}</version>
|
<version>${spring-boot.version}</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>repackage</goal>
|
<goal>repackage</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- docker -->
|
<!-- docker -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>com.spotify</groupId>
|
<groupId>com.spotify</groupId>
|
||||||
<artifactId>docker-maven-plugin</artifactId>
|
<artifactId>docker-maven-plugin</artifactId>
|
||||||
<version>${docker.plugin.version}</version>
|
<version>${docker.plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<!-- made of '[a-z0-9-_.]' -->
|
<!-- made of '[a-z0-9-_.]' -->
|
||||||
<imageName>${docker.namespace}/${project.artifactId}:${project.version}</imageName>
|
<imageName>${docker.namespace}/${project.artifactId}:${project.version}</imageName>
|
||||||
<dockerDirectory>${project.basedir}</dockerDirectory>
|
<dockerDirectory>${project.basedir}</dockerDirectory>
|
||||||
<dockerHost>${docker.registry.host}</dockerHost>
|
<dockerHost>${docker.registry.host}</dockerHost>
|
||||||
<registryUrl>${docker.registry.url}</registryUrl>
|
<registryUrl>${docker.registry.url}</registryUrl>
|
||||||
<serverId>${docker.registry.url}</serverId>
|
<serverId>${docker.registry.url}</serverId>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
<targetPath>/</targetPath>
|
<targetPath>/</targetPath>
|
||||||
<directory>${project.build.directory}</directory>
|
<directory>${project.build.directory}</directory>
|
||||||
<include>${project.build.finalName}.jar</include>
|
<include>${project.build.finalName}.jar</include>
|
||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -9,8 +9,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class XxlJobAdminApplication {
|
public class XxlJobAdminApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(XxlJobAdminApplication.class, args);
|
SpringApplication.run(XxlJobAdminApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -24,73 +24,74 @@ import java.util.Map;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* index controller
|
* index controller
|
||||||
|
*
|
||||||
* @author xuxueli 2015-12-19 16:13:16
|
* @author xuxueli 2015-12-19 16:13:16
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
public class IndexController {
|
public class IndexController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private XxlJobService xxlJobService;
|
private XxlJobService xxlJobService;
|
||||||
@Resource
|
@Resource
|
||||||
private LoginService loginService;
|
private LoginService loginService;
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping("/")
|
@RequestMapping("/")
|
||||||
public String index(Model model) {
|
public String index(Model model) {
|
||||||
|
|
||||||
Map<String, Object> dashboardMap = xxlJobService.dashboardInfo();
|
Map<String, Object> dashboardMap = xxlJobService.dashboardInfo();
|
||||||
model.addAllAttributes(dashboardMap);
|
model.addAllAttributes(dashboardMap);
|
||||||
|
|
||||||
return "index";
|
return "index";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/chartInfo")
|
@RequestMapping("/chartInfo")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ReturnT<Map<String, Object>> chartInfo(Date startDate, Date endDate) {
|
public ReturnT<Map<String, Object>> chartInfo(Date startDate, Date endDate) {
|
||||||
ReturnT<Map<String, Object>> chartInfo = xxlJobService.chartInfo(startDate, endDate);
|
ReturnT<Map<String, Object>> chartInfo = xxlJobService.chartInfo(startDate, endDate);
|
||||||
return chartInfo;
|
return chartInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/toLogin")
|
@RequestMapping("/toLogin")
|
||||||
@PermissionLimit(limit=false)
|
@PermissionLimit(limit = false)
|
||||||
public ModelAndView toLogin(HttpServletRequest request, HttpServletResponse response,ModelAndView modelAndView) {
|
public ModelAndView toLogin(HttpServletRequest request, HttpServletResponse response, ModelAndView modelAndView) {
|
||||||
if (loginService.ifLogin(request, response) != null) {
|
if (loginService.ifLogin(request, response) != null) {
|
||||||
modelAndView.setView(new RedirectView("/",true,false));
|
modelAndView.setView(new RedirectView("/" , true, false));
|
||||||
return modelAndView;
|
return modelAndView;
|
||||||
}
|
}
|
||||||
return new ModelAndView("login");
|
return new ModelAndView("login");
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value="login", method=RequestMethod.POST)
|
@RequestMapping(value = "login" , method = RequestMethod.POST)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@PermissionLimit(limit=false)
|
@PermissionLimit(limit = false)
|
||||||
public ReturnT<String> loginDo(HttpServletRequest request, HttpServletResponse response, String userName, String password, String ifRemember){
|
public ReturnT<String> loginDo(HttpServletRequest request, HttpServletResponse response, String userName, String password, String ifRemember) {
|
||||||
boolean ifRem = (ifRemember!=null && ifRemember.trim().length()>0 && "on".equals(ifRemember))?true:false;
|
boolean ifRem = (ifRemember != null && ifRemember.trim().length() > 0 && "on".equals(ifRemember)) ? true : false;
|
||||||
return loginService.login(request, response, userName, password, ifRem);
|
return loginService.login(request, response, userName, password, ifRem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value="logout", method=RequestMethod.POST)
|
@RequestMapping(value = "logout" , method = RequestMethod.POST)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@PermissionLimit(limit=false)
|
@PermissionLimit(limit = false)
|
||||||
public ReturnT<String> logout(HttpServletRequest request, HttpServletResponse response){
|
public ReturnT<String> logout(HttpServletRequest request, HttpServletResponse response) {
|
||||||
return loginService.logout(request, response);
|
return loginService.logout(request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/help")
|
@RequestMapping("/help")
|
||||||
public String help() {
|
public String help() {
|
||||||
|
|
||||||
/*if (!PermissionInterceptor.ifLogin(request)) {
|
/*if (!PermissionInterceptor.ifLogin(request)) {
|
||||||
return "redirect:/toLogin";
|
return "redirect:/toLogin";
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
return "help";
|
return "help";
|
||||||
}
|
}
|
||||||
|
|
||||||
@InitBinder
|
@InitBinder
|
||||||
public void initBinder(WebDataBinder binder) {
|
public void initBinder(WebDataBinder binder) {
|
||||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
dateFormat.setLenient(false);
|
dateFormat.setLenient(false);
|
||||||
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
|
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,78 +19,79 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* job code controller
|
* job code controller
|
||||||
|
*
|
||||||
* @author xuxueli 2015-12-19 16:13:16
|
* @author xuxueli 2015-12-19 16:13:16
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/jobcode")
|
@RequestMapping("/jobcode")
|
||||||
public class JobCodeController {
|
public class JobCodeController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private XxlJobInfoDao xxlJobInfoDao;
|
private XxlJobInfoDao xxlJobInfoDao;
|
||||||
@Resource
|
@Resource
|
||||||
private XxlJobLogGlueDao xxlJobLogGlueDao;
|
private XxlJobLogGlueDao xxlJobLogGlueDao;
|
||||||
|
|
||||||
@RequestMapping
|
@RequestMapping
|
||||||
public String index(HttpServletRequest request, Model model, int jobId) {
|
public String index(HttpServletRequest request, Model model, int jobId) {
|
||||||
XxlJobInfo jobInfo = xxlJobInfoDao.loadById(jobId);
|
XxlJobInfo jobInfo = xxlJobInfoDao.loadById(jobId);
|
||||||
List<XxlJobLogGlue> jobLogGlues = xxlJobLogGlueDao.findByJobId(jobId);
|
List<XxlJobLogGlue> jobLogGlues = xxlJobLogGlueDao.findByJobId(jobId);
|
||||||
|
|
||||||
if (jobInfo == null) {
|
if (jobInfo == null) {
|
||||||
throw new RuntimeException(I18nUtil.getString("jobinfo_glue_jobid_unvalid"));
|
throw new RuntimeException(I18nUtil.getString("jobinfo_glue_jobid_unvalid"));
|
||||||
}
|
}
|
||||||
if (GlueTypeEnum.BEAN == GlueTypeEnum.match(jobInfo.getGlueType())) {
|
if (GlueTypeEnum.BEAN == GlueTypeEnum.match(jobInfo.getGlueType())) {
|
||||||
throw new RuntimeException(I18nUtil.getString("jobinfo_glue_gluetype_unvalid"));
|
throw new RuntimeException(I18nUtil.getString("jobinfo_glue_gluetype_unvalid"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// valid permission
|
// valid permission
|
||||||
JobInfoController.validPermission(request, jobInfo.getJobGroup());
|
JobInfoController.validPermission(request, jobInfo.getJobGroup());
|
||||||
|
|
||||||
// Glue类型-字典
|
// Glue类型-字典
|
||||||
model.addAttribute("GlueTypeEnum", GlueTypeEnum.values());
|
model.addAttribute("GlueTypeEnum" , GlueTypeEnum.values());
|
||||||
|
|
||||||
model.addAttribute("jobInfo", jobInfo);
|
model.addAttribute("jobInfo" , jobInfo);
|
||||||
model.addAttribute("jobLogGlues", jobLogGlues);
|
model.addAttribute("jobLogGlues" , jobLogGlues);
|
||||||
return "jobcode/jobcode.index";
|
return "jobcode/jobcode.index";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/save")
|
@RequestMapping("/save")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ReturnT<String> save(Model model, int id, String glueSource, String glueRemark) {
|
public ReturnT<String> save(Model model, int id, String glueSource, String glueRemark) {
|
||||||
// valid
|
// valid
|
||||||
if (glueRemark==null) {
|
if (glueRemark == null) {
|
||||||
return new ReturnT<String>(500, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_glue_remark")) );
|
return new ReturnT<String>(500, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_glue_remark")));
|
||||||
}
|
}
|
||||||
if (glueRemark.length()<4 || glueRemark.length()>100) {
|
if (glueRemark.length() < 4 || glueRemark.length() > 100) {
|
||||||
return new ReturnT<String>(500, I18nUtil.getString("jobinfo_glue_remark_limit"));
|
return new ReturnT<String>(500, I18nUtil.getString("jobinfo_glue_remark_limit"));
|
||||||
}
|
}
|
||||||
XxlJobInfo exists_jobInfo = xxlJobInfoDao.loadById(id);
|
XxlJobInfo exists_jobInfo = xxlJobInfoDao.loadById(id);
|
||||||
if (exists_jobInfo == null) {
|
if (exists_jobInfo == null) {
|
||||||
return new ReturnT<String>(500, I18nUtil.getString("jobinfo_glue_jobid_unvalid"));
|
return new ReturnT<String>(500, I18nUtil.getString("jobinfo_glue_jobid_unvalid"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// update new code
|
// update new code
|
||||||
exists_jobInfo.setGlueSource(glueSource);
|
exists_jobInfo.setGlueSource(glueSource);
|
||||||
exists_jobInfo.setGlueRemark(glueRemark);
|
exists_jobInfo.setGlueRemark(glueRemark);
|
||||||
exists_jobInfo.setGlueUpdatetime(new Date());
|
exists_jobInfo.setGlueUpdatetime(new Date());
|
||||||
|
|
||||||
exists_jobInfo.setUpdateTime(new Date());
|
exists_jobInfo.setUpdateTime(new Date());
|
||||||
xxlJobInfoDao.update(exists_jobInfo);
|
xxlJobInfoDao.update(exists_jobInfo);
|
||||||
|
|
||||||
// log old code
|
// log old code
|
||||||
XxlJobLogGlue xxlJobLogGlue = new XxlJobLogGlue();
|
XxlJobLogGlue xxlJobLogGlue = new XxlJobLogGlue();
|
||||||
xxlJobLogGlue.setJobId(exists_jobInfo.getId());
|
xxlJobLogGlue.setJobId(exists_jobInfo.getId());
|
||||||
xxlJobLogGlue.setGlueType(exists_jobInfo.getGlueType());
|
xxlJobLogGlue.setGlueType(exists_jobInfo.getGlueType());
|
||||||
xxlJobLogGlue.setGlueSource(glueSource);
|
xxlJobLogGlue.setGlueSource(glueSource);
|
||||||
xxlJobLogGlue.setGlueRemark(glueRemark);
|
xxlJobLogGlue.setGlueRemark(glueRemark);
|
||||||
|
|
||||||
xxlJobLogGlue.setAddTime(new Date());
|
xxlJobLogGlue.setAddTime(new Date());
|
||||||
xxlJobLogGlue.setUpdateTime(new Date());
|
xxlJobLogGlue.setUpdateTime(new Date());
|
||||||
xxlJobLogGlueDao.save(xxlJobLogGlue);
|
xxlJobLogGlueDao.save(xxlJobLogGlue);
|
||||||
|
|
||||||
// remove code backup more than 30
|
// remove code backup more than 30
|
||||||
xxlJobLogGlueDao.removeOld(exists_jobInfo.getId(), 30);
|
xxlJobLogGlueDao.removeOld(exists_jobInfo.getId(), 30);
|
||||||
|
|
||||||
return ReturnT.SUCCESS;
|
return ReturnT.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,178 +20,179 @@ import java.util.*;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* job group controller
|
* job group controller
|
||||||
|
*
|
||||||
* @author xuxueli 2016-10-02 20:52:56
|
* @author xuxueli 2016-10-02 20:52:56
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/jobgroup")
|
@RequestMapping("/jobgroup")
|
||||||
public class JobGroupController {
|
public class JobGroupController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
public XxlJobInfoDao xxlJobInfoDao;
|
public XxlJobInfoDao xxlJobInfoDao;
|
||||||
@Resource
|
@Resource
|
||||||
public XxlJobGroupDao xxlJobGroupDao;
|
public XxlJobGroupDao xxlJobGroupDao;
|
||||||
@Resource
|
@Resource
|
||||||
private XxlJobRegistryDao xxlJobRegistryDao;
|
private XxlJobRegistryDao xxlJobRegistryDao;
|
||||||
|
|
||||||
@RequestMapping
|
@RequestMapping
|
||||||
public String index(Model model) {
|
public String index(Model model) {
|
||||||
return "jobgroup/jobgroup.index";
|
return "jobgroup/jobgroup.index";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/pageList")
|
@RequestMapping("/pageList")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Map<String, Object> pageList(HttpServletRequest request,
|
public Map<String, Object> pageList(HttpServletRequest request,
|
||||||
@RequestParam(required = false, defaultValue = "0") int start,
|
@RequestParam(required = false, defaultValue = "0") int start,
|
||||||
@RequestParam(required = false, defaultValue = "10") int length,
|
@RequestParam(required = false, defaultValue = "10") int length,
|
||||||
String appname, String title) {
|
String appname, String title) {
|
||||||
|
|
||||||
// page query
|
// page query
|
||||||
List<XxlJobGroup> list = xxlJobGroupDao.pageList(start, length, appname, title);
|
List<XxlJobGroup> list = xxlJobGroupDao.pageList(start, length, appname, title);
|
||||||
int list_count = xxlJobGroupDao.pageListCount(start, length, appname, title);
|
int list_count = xxlJobGroupDao.pageListCount(start, length, appname, title);
|
||||||
|
|
||||||
// package result
|
// package result
|
||||||
Map<String, Object> maps = new HashMap<String, Object>();
|
Map<String, Object> maps = new HashMap<String, Object>();
|
||||||
maps.put("recordsTotal", list_count); // 总记录数
|
maps.put("recordsTotal" , list_count); // 总记录数
|
||||||
maps.put("recordsFiltered", list_count); // 过滤后的总记录数
|
maps.put("recordsFiltered" , list_count); // 过滤后的总记录数
|
||||||
maps.put("data", list); // 分页列表
|
maps.put("data" , list); // 分页列表
|
||||||
return maps;
|
return maps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/save")
|
@RequestMapping("/save")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ReturnT<String> save(XxlJobGroup xxlJobGroup){
|
public ReturnT<String> save(XxlJobGroup xxlJobGroup) {
|
||||||
|
|
||||||
// valid
|
// valid
|
||||||
if (xxlJobGroup.getAppname()==null || xxlJobGroup.getAppname().trim().length()==0) {
|
if (xxlJobGroup.getAppname() == null || xxlJobGroup.getAppname().trim().length() == 0) {
|
||||||
return new ReturnT<String>(500, (I18nUtil.getString("system_please_input")+"AppName") );
|
return new ReturnT<String>(500, (I18nUtil.getString("system_please_input") + "AppName"));
|
||||||
}
|
}
|
||||||
if (xxlJobGroup.getAppname().length()<4 || xxlJobGroup.getAppname().length()>64) {
|
if (xxlJobGroup.getAppname().length() < 4 || xxlJobGroup.getAppname().length() > 64) {
|
||||||
return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_appname_length") );
|
return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_appname_length"));
|
||||||
}
|
}
|
||||||
if (xxlJobGroup.getAppname().contains(">") || xxlJobGroup.getAppname().contains("<")) {
|
if (xxlJobGroup.getAppname().contains(">") || xxlJobGroup.getAppname().contains("<")) {
|
||||||
return new ReturnT<String>(500, "AppName"+I18nUtil.getString("system_unvalid") );
|
return new ReturnT<String>(500, "AppName" + I18nUtil.getString("system_unvalid"));
|
||||||
}
|
}
|
||||||
if (xxlJobGroup.getTitle()==null || xxlJobGroup.getTitle().trim().length()==0) {
|
if (xxlJobGroup.getTitle() == null || xxlJobGroup.getTitle().trim().length() == 0) {
|
||||||
return new ReturnT<String>(500, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobgroup_field_title")) );
|
return new ReturnT<String>(500, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobgroup_field_title")));
|
||||||
}
|
}
|
||||||
if (xxlJobGroup.getTitle().contains(">") || xxlJobGroup.getTitle().contains("<")) {
|
if (xxlJobGroup.getTitle().contains(">") || xxlJobGroup.getTitle().contains("<")) {
|
||||||
return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_title")+I18nUtil.getString("system_unvalid") );
|
return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_title") + I18nUtil.getString("system_unvalid"));
|
||||||
}
|
}
|
||||||
if (xxlJobGroup.getAddressType()!=0) {
|
if (xxlJobGroup.getAddressType() != 0) {
|
||||||
if (xxlJobGroup.getAddressList()==null || xxlJobGroup.getAddressList().trim().length()==0) {
|
if (xxlJobGroup.getAddressList() == null || xxlJobGroup.getAddressList().trim().length() == 0) {
|
||||||
return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_addressType_limit") );
|
return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_addressType_limit"));
|
||||||
}
|
}
|
||||||
if (xxlJobGroup.getAddressList().contains(">") || xxlJobGroup.getAddressList().contains("<")) {
|
if (xxlJobGroup.getAddressList().contains(">") || xxlJobGroup.getAddressList().contains("<")) {
|
||||||
return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_registryList")+I18nUtil.getString("system_unvalid") );
|
return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_registryList") + I18nUtil.getString("system_unvalid"));
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] addresss = xxlJobGroup.getAddressList().split(",");
|
String[] addresss = xxlJobGroup.getAddressList().split(",");
|
||||||
for (String item: addresss) {
|
for (String item : addresss) {
|
||||||
if (item==null || item.trim().length()==0) {
|
if (item == null || item.trim().length() == 0) {
|
||||||
return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_registryList_unvalid") );
|
return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_registryList_unvalid"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// process
|
// process
|
||||||
xxlJobGroup.setUpdateTime(new Date());
|
xxlJobGroup.setUpdateTime(new Date());
|
||||||
|
|
||||||
int ret = xxlJobGroupDao.save(xxlJobGroup);
|
int ret = xxlJobGroupDao.save(xxlJobGroup);
|
||||||
return (ret>0)?ReturnT.SUCCESS:ReturnT.FAIL;
|
return (ret > 0) ? ReturnT.SUCCESS : ReturnT.FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/update")
|
@RequestMapping("/update")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ReturnT<String> update(XxlJobGroup xxlJobGroup){
|
public ReturnT<String> update(XxlJobGroup xxlJobGroup) {
|
||||||
// valid
|
// valid
|
||||||
if (xxlJobGroup.getAppname()==null || xxlJobGroup.getAppname().trim().length()==0) {
|
if (xxlJobGroup.getAppname() == null || xxlJobGroup.getAppname().trim().length() == 0) {
|
||||||
return new ReturnT<String>(500, (I18nUtil.getString("system_please_input")+"AppName") );
|
return new ReturnT<String>(500, (I18nUtil.getString("system_please_input") + "AppName"));
|
||||||
}
|
}
|
||||||
if (xxlJobGroup.getAppname().length()<4 || xxlJobGroup.getAppname().length()>64) {
|
if (xxlJobGroup.getAppname().length() < 4 || xxlJobGroup.getAppname().length() > 64) {
|
||||||
return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_appname_length") );
|
return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_appname_length"));
|
||||||
}
|
}
|
||||||
if (xxlJobGroup.getTitle()==null || xxlJobGroup.getTitle().trim().length()==0) {
|
if (xxlJobGroup.getTitle() == null || xxlJobGroup.getTitle().trim().length() == 0) {
|
||||||
return new ReturnT<String>(500, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobgroup_field_title")) );
|
return new ReturnT<String>(500, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobgroup_field_title")));
|
||||||
}
|
}
|
||||||
if (xxlJobGroup.getAddressType() == 0) {
|
if (xxlJobGroup.getAddressType() == 0) {
|
||||||
// 0=自动注册
|
// 0=自动注册
|
||||||
List<String> registryList = findRegistryByAppName(xxlJobGroup.getAppname());
|
List<String> registryList = findRegistryByAppName(xxlJobGroup.getAppname());
|
||||||
String addressListStr = null;
|
String addressListStr = null;
|
||||||
if (registryList!=null && !registryList.isEmpty()) {
|
if (registryList != null && !registryList.isEmpty()) {
|
||||||
Collections.sort(registryList);
|
Collections.sort(registryList);
|
||||||
addressListStr = "";
|
addressListStr = "";
|
||||||
for (String item:registryList) {
|
for (String item : registryList) {
|
||||||
addressListStr += item + ",";
|
addressListStr += item + ",";
|
||||||
}
|
}
|
||||||
addressListStr = addressListStr.substring(0, addressListStr.length()-1);
|
addressListStr = addressListStr.substring(0, addressListStr.length() - 1);
|
||||||
}
|
}
|
||||||
xxlJobGroup.setAddressList(addressListStr);
|
xxlJobGroup.setAddressList(addressListStr);
|
||||||
} else {
|
} else {
|
||||||
// 1=手动录入
|
// 1=手动录入
|
||||||
if (xxlJobGroup.getAddressList()==null || xxlJobGroup.getAddressList().trim().length()==0) {
|
if (xxlJobGroup.getAddressList() == null || xxlJobGroup.getAddressList().trim().length() == 0) {
|
||||||
return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_addressType_limit") );
|
return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_addressType_limit"));
|
||||||
}
|
}
|
||||||
String[] addresss = xxlJobGroup.getAddressList().split(",");
|
String[] addresss = xxlJobGroup.getAddressList().split(",");
|
||||||
for (String item: addresss) {
|
for (String item : addresss) {
|
||||||
if (item==null || item.trim().length()==0) {
|
if (item == null || item.trim().length() == 0) {
|
||||||
return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_registryList_unvalid") );
|
return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_registryList_unvalid"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// process
|
// process
|
||||||
xxlJobGroup.setUpdateTime(new Date());
|
xxlJobGroup.setUpdateTime(new Date());
|
||||||
|
|
||||||
int ret = xxlJobGroupDao.update(xxlJobGroup);
|
int ret = xxlJobGroupDao.update(xxlJobGroup);
|
||||||
return (ret>0)?ReturnT.SUCCESS:ReturnT.FAIL;
|
return (ret > 0) ? ReturnT.SUCCESS : ReturnT.FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> findRegistryByAppName(String appnameParam){
|
private List<String> findRegistryByAppName(String appnameParam) {
|
||||||
HashMap<String, List<String>> appAddressMap = new HashMap<String, List<String>>();
|
HashMap<String, List<String>> appAddressMap = new HashMap<String, List<String>>();
|
||||||
List<XxlJobRegistry> list = xxlJobRegistryDao.findAll(RegistryConfig.DEAD_TIMEOUT, new Date());
|
List<XxlJobRegistry> list = xxlJobRegistryDao.findAll(RegistryConfig.DEAD_TIMEOUT, new Date());
|
||||||
if (list != null) {
|
if (list != null) {
|
||||||
for (XxlJobRegistry item: list) {
|
for (XxlJobRegistry item : list) {
|
||||||
if (RegistryConfig.RegistType.EXECUTOR.name().equals(item.getRegistryGroup())) {
|
if (RegistryConfig.RegistType.EXECUTOR.name().equals(item.getRegistryGroup())) {
|
||||||
String appname = item.getRegistryKey();
|
String appname = item.getRegistryKey();
|
||||||
List<String> registryList = appAddressMap.get(appname);
|
List<String> registryList = appAddressMap.get(appname);
|
||||||
if (registryList == null) {
|
if (registryList == null) {
|
||||||
registryList = new ArrayList<String>();
|
registryList = new ArrayList<String>();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!registryList.contains(item.getRegistryValue())) {
|
if (!registryList.contains(item.getRegistryValue())) {
|
||||||
registryList.add(item.getRegistryValue());
|
registryList.add(item.getRegistryValue());
|
||||||
}
|
}
|
||||||
appAddressMap.put(appname, registryList);
|
appAddressMap.put(appname, registryList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return appAddressMap.get(appnameParam);
|
return appAddressMap.get(appnameParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/remove")
|
@RequestMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ReturnT<String> remove(int id){
|
public ReturnT<String> remove(int id) {
|
||||||
|
|
||||||
// valid
|
// valid
|
||||||
int count = xxlJobInfoDao.pageListCount(0, 10, id, -1, null, null, null);
|
int count = xxlJobInfoDao.pageListCount(0, 10, id, -1, null, null, null);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
return new ReturnT<String>(500, I18nUtil.getString("jobgroup_del_limit_0") );
|
return new ReturnT<String>(500, I18nUtil.getString("jobgroup_del_limit_0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<XxlJobGroup> allList = xxlJobGroupDao.findAll();
|
List<XxlJobGroup> allList = xxlJobGroupDao.findAll();
|
||||||
if (allList.size() == 1) {
|
if (allList.size() == 1) {
|
||||||
return new ReturnT<String>(500, I18nUtil.getString("jobgroup_del_limit_1") );
|
return new ReturnT<String>(500, I18nUtil.getString("jobgroup_del_limit_1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret = xxlJobGroupDao.remove(id);
|
int ret = xxlJobGroupDao.remove(id);
|
||||||
return (ret>0)?ReturnT.SUCCESS:ReturnT.FAIL;
|
return (ret > 0) ? ReturnT.SUCCESS : ReturnT.FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/loadById")
|
@RequestMapping("/loadById")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ReturnT<XxlJobGroup> loadById(int id){
|
public ReturnT<XxlJobGroup> loadById(int id) {
|
||||||
XxlJobGroup jobGroup = xxlJobGroupDao.load(id);
|
XxlJobGroup jobGroup = xxlJobGroupDao.load(id);
|
||||||
return jobGroup!=null?new ReturnT<XxlJobGroup>(jobGroup):new ReturnT<XxlJobGroup>(ReturnT.FAIL_CODE, null);
|
return jobGroup != null ? new ReturnT<XxlJobGroup>(jobGroup) : new ReturnT<XxlJobGroup>(ReturnT.FAIL_CODE, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.xxl.job.admin.controller;
|
package com.xxl.job.admin.controller;
|
||||||
|
|
||||||
import com.xxl.job.admin.core.cron.CronExpression;
|
|
||||||
import com.xxl.job.admin.core.exception.XxlJobException;
|
import com.xxl.job.admin.core.exception.XxlJobException;
|
||||||
import com.xxl.job.admin.core.model.XxlJobGroup;
|
import com.xxl.job.admin.core.model.XxlJobGroup;
|
||||||
import com.xxl.job.admin.core.model.XxlJobInfo;
|
import com.xxl.job.admin.core.model.XxlJobInfo;
|
||||||
@ -29,152 +28,153 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.text.ParseException;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* index controller
|
* index controller
|
||||||
|
*
|
||||||
* @author xuxueli 2015-12-19 16:13:16
|
* @author xuxueli 2015-12-19 16:13:16
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/jobinfo")
|
@RequestMapping("/jobinfo")
|
||||||
public class JobInfoController {
|
public class JobInfoController {
|
||||||
private static Logger logger = LoggerFactory.getLogger(JobInfoController.class);
|
private static Logger logger = LoggerFactory.getLogger(JobInfoController.class);
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private XxlJobGroupDao xxlJobGroupDao;
|
private XxlJobGroupDao xxlJobGroupDao;
|
||||||
@Resource
|
@Resource
|
||||||
private XxlJobService xxlJobService;
|
private XxlJobService xxlJobService;
|
||||||
|
|
||||||
@RequestMapping
|
@RequestMapping
|
||||||
public String index(HttpServletRequest request, Model model, @RequestParam(required = false, defaultValue = "-1") int jobGroup) {
|
public String index(HttpServletRequest request, Model model, @RequestParam(required = false, defaultValue = "-1") int jobGroup) {
|
||||||
|
|
||||||
// 枚举-字典
|
// 枚举-字典
|
||||||
model.addAttribute("ExecutorRouteStrategyEnum", ExecutorRouteStrategyEnum.values()); // 路由策略-列表
|
model.addAttribute("ExecutorRouteStrategyEnum" , ExecutorRouteStrategyEnum.values()); // 路由策略-列表
|
||||||
model.addAttribute("GlueTypeEnum", GlueTypeEnum.values()); // Glue类型-字典
|
model.addAttribute("GlueTypeEnum" , GlueTypeEnum.values()); // Glue类型-字典
|
||||||
model.addAttribute("ExecutorBlockStrategyEnum", ExecutorBlockStrategyEnum.values()); // 阻塞处理策略-字典
|
model.addAttribute("ExecutorBlockStrategyEnum" , ExecutorBlockStrategyEnum.values()); // 阻塞处理策略-字典
|
||||||
model.addAttribute("ScheduleTypeEnum", ScheduleTypeEnum.values()); // 调度类型
|
model.addAttribute("ScheduleTypeEnum" , ScheduleTypeEnum.values()); // 调度类型
|
||||||
model.addAttribute("MisfireStrategyEnum", MisfireStrategyEnum.values()); // 调度过期策略
|
model.addAttribute("MisfireStrategyEnum" , MisfireStrategyEnum.values()); // 调度过期策略
|
||||||
|
|
||||||
// 执行器列表
|
// 执行器列表
|
||||||
List<XxlJobGroup> jobGroupList_all = xxlJobGroupDao.findAll();
|
List<XxlJobGroup> jobGroupList_all = xxlJobGroupDao.findAll();
|
||||||
|
|
||||||
// filter group
|
// filter group
|
||||||
List<XxlJobGroup> jobGroupList = filterJobGroupByRole(request, jobGroupList_all);
|
List<XxlJobGroup> jobGroupList = filterJobGroupByRole(request, jobGroupList_all);
|
||||||
if (jobGroupList==null || jobGroupList.size()==0) {
|
if (jobGroupList == null || jobGroupList.size() == 0) {
|
||||||
throw new XxlJobException(I18nUtil.getString("jobgroup_empty"));
|
throw new XxlJobException(I18nUtil.getString("jobgroup_empty"));
|
||||||
}
|
}
|
||||||
|
|
||||||
model.addAttribute("JobGroupList", jobGroupList);
|
model.addAttribute("JobGroupList" , jobGroupList);
|
||||||
model.addAttribute("jobGroup", jobGroup);
|
model.addAttribute("jobGroup" , jobGroup);
|
||||||
|
|
||||||
return "jobinfo/jobinfo.index";
|
return "jobinfo/jobinfo.index";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<XxlJobGroup> filterJobGroupByRole(HttpServletRequest request, List<XxlJobGroup> jobGroupList_all){
|
public static List<XxlJobGroup> filterJobGroupByRole(HttpServletRequest request, List<XxlJobGroup> jobGroupList_all) {
|
||||||
List<XxlJobGroup> jobGroupList = new ArrayList<>();
|
List<XxlJobGroup> jobGroupList = new ArrayList<>();
|
||||||
if (jobGroupList_all!=null && jobGroupList_all.size()>0) {
|
if (jobGroupList_all != null && jobGroupList_all.size() > 0) {
|
||||||
XxlJobUser loginUser = (XxlJobUser) request.getAttribute(LoginService.LOGIN_IDENTITY_KEY);
|
XxlJobUser loginUser = (XxlJobUser) request.getAttribute(LoginService.LOGIN_IDENTITY_KEY);
|
||||||
if (loginUser.getRole() == 1) {
|
if (loginUser.getRole() == 1) {
|
||||||
jobGroupList = jobGroupList_all;
|
jobGroupList = jobGroupList_all;
|
||||||
} else {
|
} else {
|
||||||
List<String> groupIdStrs = new ArrayList<>();
|
List<String> groupIdStrs = new ArrayList<>();
|
||||||
if (loginUser.getPermission()!=null && loginUser.getPermission().trim().length()>0) {
|
if (loginUser.getPermission() != null && loginUser.getPermission().trim().length() > 0) {
|
||||||
groupIdStrs = Arrays.asList(loginUser.getPermission().trim().split(","));
|
groupIdStrs = Arrays.asList(loginUser.getPermission().trim().split(","));
|
||||||
}
|
}
|
||||||
for (XxlJobGroup groupItem:jobGroupList_all) {
|
for (XxlJobGroup groupItem : jobGroupList_all) {
|
||||||
if (groupIdStrs.contains(String.valueOf(groupItem.getId()))) {
|
if (groupIdStrs.contains(String.valueOf(groupItem.getId()))) {
|
||||||
jobGroupList.add(groupItem);
|
jobGroupList.add(groupItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return jobGroupList;
|
return jobGroupList;
|
||||||
}
|
}
|
||||||
public static void validPermission(HttpServletRequest request, int jobGroup) {
|
|
||||||
XxlJobUser loginUser = (XxlJobUser) request.getAttribute(LoginService.LOGIN_IDENTITY_KEY);
|
|
||||||
if (!loginUser.validPermission(jobGroup)) {
|
|
||||||
throw new RuntimeException(I18nUtil.getString("system_permission_limit") + "[username="+ loginUser.getUsername() +"]");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping("/pageList")
|
public static void validPermission(HttpServletRequest request, int jobGroup) {
|
||||||
@ResponseBody
|
XxlJobUser loginUser = (XxlJobUser) request.getAttribute(LoginService.LOGIN_IDENTITY_KEY);
|
||||||
public Map<String, Object> pageList(@RequestParam(required = false, defaultValue = "0") int start,
|
if (!loginUser.validPermission(jobGroup)) {
|
||||||
@RequestParam(required = false, defaultValue = "10") int length,
|
throw new RuntimeException(I18nUtil.getString("system_permission_limit") + "[username=" + loginUser.getUsername() + "]");
|
||||||
int jobGroup, int triggerStatus, String jobDesc, String executorHandler, String author) {
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return xxlJobService.pageList(start, length, jobGroup, triggerStatus, jobDesc, executorHandler, author);
|
@RequestMapping("/pageList")
|
||||||
}
|
@ResponseBody
|
||||||
|
public Map<String, Object> pageList(@RequestParam(required = false, defaultValue = "0") int start,
|
||||||
|
@RequestParam(required = false, defaultValue = "10") int length,
|
||||||
|
int jobGroup, int triggerStatus, String jobDesc, String executorHandler, String author) {
|
||||||
|
|
||||||
@RequestMapping("/add")
|
return xxlJobService.pageList(start, length, jobGroup, triggerStatus, jobDesc, executorHandler, author);
|
||||||
@ResponseBody
|
}
|
||||||
public ReturnT<String> add(XxlJobInfo jobInfo) {
|
|
||||||
return xxlJobService.add(jobInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping("/update")
|
@RequestMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ReturnT<String> update(XxlJobInfo jobInfo) {
|
public ReturnT<String> add(XxlJobInfo jobInfo) {
|
||||||
return xxlJobService.update(jobInfo);
|
return xxlJobService.add(jobInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/remove")
|
@RequestMapping("/update")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ReturnT<String> remove(int id) {
|
public ReturnT<String> update(XxlJobInfo jobInfo) {
|
||||||
return xxlJobService.remove(id);
|
return xxlJobService.update(jobInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/stop")
|
@RequestMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ReturnT<String> pause(int id) {
|
public ReturnT<String> remove(int id) {
|
||||||
return xxlJobService.stop(id);
|
return xxlJobService.remove(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/start")
|
@RequestMapping("/stop")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ReturnT<String> start(int id) {
|
public ReturnT<String> pause(int id) {
|
||||||
return xxlJobService.start(id);
|
return xxlJobService.stop(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/trigger")
|
@RequestMapping("/start")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
//@PermissionLimit(limit = false)
|
public ReturnT<String> start(int id) {
|
||||||
public ReturnT<String> triggerJob(int id, String executorParam, String addressList) {
|
return xxlJobService.start(id);
|
||||||
// force cover job param
|
}
|
||||||
if (executorParam == null) {
|
|
||||||
executorParam = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
JobTriggerPoolHelper.trigger(id, TriggerTypeEnum.MANUAL, -1, null, executorParam, addressList);
|
@RequestMapping("/trigger")
|
||||||
return ReturnT.SUCCESS;
|
@ResponseBody
|
||||||
}
|
//@PermissionLimit(limit = false)
|
||||||
|
public ReturnT<String> triggerJob(int id, String executorParam, String addressList) {
|
||||||
|
// force cover job param
|
||||||
|
if (executorParam == null) {
|
||||||
|
executorParam = "";
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping("/nextTriggerTime")
|
JobTriggerPoolHelper.trigger(id, TriggerTypeEnum.MANUAL, -1, null, executorParam, addressList);
|
||||||
@ResponseBody
|
return ReturnT.SUCCESS;
|
||||||
public ReturnT<List<String>> nextTriggerTime(String scheduleType, String scheduleConf) {
|
}
|
||||||
|
|
||||||
XxlJobInfo paramXxlJobInfo = new XxlJobInfo();
|
@RequestMapping("/nextTriggerTime")
|
||||||
paramXxlJobInfo.setScheduleType(scheduleType);
|
@ResponseBody
|
||||||
paramXxlJobInfo.setScheduleConf(scheduleConf);
|
public ReturnT<List<String>> nextTriggerTime(String scheduleType, String scheduleConf) {
|
||||||
|
|
||||||
List<String> result = new ArrayList<>();
|
XxlJobInfo paramXxlJobInfo = new XxlJobInfo();
|
||||||
try {
|
paramXxlJobInfo.setScheduleType(scheduleType);
|
||||||
Date lastTime = new Date();
|
paramXxlJobInfo.setScheduleConf(scheduleConf);
|
||||||
for (int i = 0; i < 5; i++) {
|
|
||||||
lastTime = JobScheduleHelper.generateNextValidTime(paramXxlJobInfo, lastTime);
|
|
||||||
if (lastTime != null) {
|
|
||||||
result.add(DateUtil.formatDateTime(lastTime));
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error(e.getMessage(), e);
|
|
||||||
return new ReturnT<List<String>>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) + e.getMessage());
|
|
||||||
}
|
|
||||||
return new ReturnT<List<String>>(result);
|
|
||||||
|
|
||||||
}
|
List<String> result = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
Date lastTime = new Date();
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
|
lastTime = JobScheduleHelper.generateNextValidTime(paramXxlJobInfo, lastTime);
|
||||||
|
if (lastTime != null) {
|
||||||
|
result.add(DateUtil.formatDateTime(lastTime));
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e.getMessage(), e);
|
||||||
|
return new ReturnT<List<String>>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")) + e.getMessage());
|
||||||
|
}
|
||||||
|
return new ReturnT<List<String>>(result);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.xxl.job.admin.controller;
|
package com.xxl.job.admin.controller;
|
||||||
|
|
||||||
import com.xxl.job.admin.core.exception.XxlJobException;
|
|
||||||
import com.xxl.job.admin.core.complete.XxlJobCompleter;
|
import com.xxl.job.admin.core.complete.XxlJobCompleter;
|
||||||
|
import com.xxl.job.admin.core.exception.XxlJobException;
|
||||||
import com.xxl.job.admin.core.model.XxlJobGroup;
|
import com.xxl.job.admin.core.model.XxlJobGroup;
|
||||||
import com.xxl.job.admin.core.model.XxlJobInfo;
|
import com.xxl.job.admin.core.model.XxlJobInfo;
|
||||||
import com.xxl.job.admin.core.model.XxlJobLog;
|
import com.xxl.job.admin.core.model.XxlJobLog;
|
||||||
@ -33,201 +33,202 @@ import java.util.Map;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* index controller
|
* index controller
|
||||||
|
*
|
||||||
* @author xuxueli 2015-12-19 16:13:16
|
* @author xuxueli 2015-12-19 16:13:16
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/joblog")
|
@RequestMapping("/joblog")
|
||||||
public class JobLogController {
|
public class JobLogController {
|
||||||
private static Logger logger = LoggerFactory.getLogger(JobLogController.class);
|
private static Logger logger = LoggerFactory.getLogger(JobLogController.class);
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private XxlJobGroupDao xxlJobGroupDao;
|
private XxlJobGroupDao xxlJobGroupDao;
|
||||||
@Resource
|
@Resource
|
||||||
public XxlJobInfoDao xxlJobInfoDao;
|
public XxlJobInfoDao xxlJobInfoDao;
|
||||||
@Resource
|
@Resource
|
||||||
public XxlJobLogDao xxlJobLogDao;
|
public XxlJobLogDao xxlJobLogDao;
|
||||||
|
|
||||||
@RequestMapping
|
@RequestMapping
|
||||||
public String index(HttpServletRequest request, Model model, @RequestParam(required = false, defaultValue = "0") Integer jobId) {
|
public String index(HttpServletRequest request, Model model, @RequestParam(required = false, defaultValue = "0") Integer jobId) {
|
||||||
|
|
||||||
// 执行器列表
|
// 执行器列表
|
||||||
List<XxlJobGroup> jobGroupList_all = xxlJobGroupDao.findAll();
|
List<XxlJobGroup> jobGroupList_all = xxlJobGroupDao.findAll();
|
||||||
|
|
||||||
// filter group
|
// filter group
|
||||||
List<XxlJobGroup> jobGroupList = JobInfoController.filterJobGroupByRole(request, jobGroupList_all);
|
List<XxlJobGroup> jobGroupList = JobInfoController.filterJobGroupByRole(request, jobGroupList_all);
|
||||||
if (jobGroupList==null || jobGroupList.size()==0) {
|
if (jobGroupList == null || jobGroupList.size() == 0) {
|
||||||
throw new XxlJobException(I18nUtil.getString("jobgroup_empty"));
|
throw new XxlJobException(I18nUtil.getString("jobgroup_empty"));
|
||||||
}
|
}
|
||||||
|
|
||||||
model.addAttribute("JobGroupList", jobGroupList);
|
model.addAttribute("JobGroupList" , jobGroupList);
|
||||||
|
|
||||||
// 任务
|
// 任务
|
||||||
if (jobId > 0) {
|
if (jobId > 0) {
|
||||||
XxlJobInfo jobInfo = xxlJobInfoDao.loadById(jobId);
|
XxlJobInfo jobInfo = xxlJobInfoDao.loadById(jobId);
|
||||||
if (jobInfo == null) {
|
if (jobInfo == null) {
|
||||||
throw new RuntimeException(I18nUtil.getString("jobinfo_field_id") + I18nUtil.getString("system_unvalid"));
|
throw new RuntimeException(I18nUtil.getString("jobinfo_field_id") + I18nUtil.getString("system_unvalid"));
|
||||||
}
|
}
|
||||||
|
|
||||||
model.addAttribute("jobInfo", jobInfo);
|
model.addAttribute("jobInfo" , jobInfo);
|
||||||
|
|
||||||
// valid permission
|
// valid permission
|
||||||
JobInfoController.validPermission(request, jobInfo.getJobGroup());
|
JobInfoController.validPermission(request, jobInfo.getJobGroup());
|
||||||
}
|
}
|
||||||
|
|
||||||
return "joblog/joblog.index";
|
return "joblog/joblog.index";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/getJobsByGroup")
|
@RequestMapping("/getJobsByGroup")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ReturnT<List<XxlJobInfo>> getJobsByGroup(int jobGroup){
|
public ReturnT<List<XxlJobInfo>> getJobsByGroup(int jobGroup) {
|
||||||
List<XxlJobInfo> list = xxlJobInfoDao.getJobsByGroup(jobGroup);
|
List<XxlJobInfo> list = xxlJobInfoDao.getJobsByGroup(jobGroup);
|
||||||
return new ReturnT<List<XxlJobInfo>>(list);
|
return new ReturnT<List<XxlJobInfo>>(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/pageList")
|
@RequestMapping("/pageList")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Map<String, Object> pageList(HttpServletRequest request,
|
public Map<String, Object> pageList(HttpServletRequest request,
|
||||||
@RequestParam(required = false, defaultValue = "0") int start,
|
@RequestParam(required = false, defaultValue = "0") int start,
|
||||||
@RequestParam(required = false, defaultValue = "10") int length,
|
@RequestParam(required = false, defaultValue = "10") int length,
|
||||||
int jobGroup, int jobId, int logStatus, String filterTime) {
|
int jobGroup, int jobId, int logStatus, String filterTime) {
|
||||||
|
|
||||||
// valid permission
|
// valid permission
|
||||||
JobInfoController.validPermission(request, jobGroup); // 仅管理员支持查询全部;普通用户仅支持查询有权限的 jobGroup
|
JobInfoController.validPermission(request, jobGroup); // 仅管理员支持查询全部;普通用户仅支持查询有权限的 jobGroup
|
||||||
|
|
||||||
// parse param
|
// parse param
|
||||||
Date triggerTimeStart = null;
|
Date triggerTimeStart = null;
|
||||||
Date triggerTimeEnd = null;
|
Date triggerTimeEnd = null;
|
||||||
if (filterTime!=null && filterTime.trim().length()>0) {
|
if (filterTime != null && filterTime.trim().length() > 0) {
|
||||||
String[] temp = filterTime.split(" - ");
|
String[] temp = filterTime.split(" - ");
|
||||||
if (temp.length == 2) {
|
if (temp.length == 2) {
|
||||||
triggerTimeStart = DateUtil.parseDateTime(temp[0]);
|
triggerTimeStart = DateUtil.parseDateTime(temp[0]);
|
||||||
triggerTimeEnd = DateUtil.parseDateTime(temp[1]);
|
triggerTimeEnd = DateUtil.parseDateTime(temp[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// page query
|
// page query
|
||||||
List<XxlJobLog> list = xxlJobLogDao.pageList(start, length, jobGroup, jobId, triggerTimeStart, triggerTimeEnd, logStatus);
|
List<XxlJobLog> list = xxlJobLogDao.pageList(start, length, jobGroup, jobId, triggerTimeStart, triggerTimeEnd, logStatus);
|
||||||
int list_count = xxlJobLogDao.pageListCount(start, length, jobGroup, jobId, triggerTimeStart, triggerTimeEnd, logStatus);
|
int list_count = xxlJobLogDao.pageListCount(start, length, jobGroup, jobId, triggerTimeStart, triggerTimeEnd, logStatus);
|
||||||
|
|
||||||
// package result
|
// package result
|
||||||
Map<String, Object> maps = new HashMap<String, Object>();
|
Map<String, Object> maps = new HashMap<String, Object>();
|
||||||
maps.put("recordsTotal", list_count); // 总记录数
|
maps.put("recordsTotal" , list_count); // 总记录数
|
||||||
maps.put("recordsFiltered", list_count); // 过滤后的总记录数
|
maps.put("recordsFiltered" , list_count); // 过滤后的总记录数
|
||||||
maps.put("data", list); // 分页列表
|
maps.put("data" , list); // 分页列表
|
||||||
return maps;
|
return maps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/logDetailPage")
|
@RequestMapping("/logDetailPage")
|
||||||
public String logDetailPage(int id, Model model){
|
public String logDetailPage(int id, Model model) {
|
||||||
|
|
||||||
// base check
|
// base check
|
||||||
ReturnT<String> logStatue = ReturnT.SUCCESS;
|
ReturnT<String> logStatue = ReturnT.SUCCESS;
|
||||||
XxlJobLog jobLog = xxlJobLogDao.load(id);
|
XxlJobLog jobLog = xxlJobLogDao.load(id);
|
||||||
if (jobLog == null) {
|
if (jobLog == null) {
|
||||||
throw new RuntimeException(I18nUtil.getString("joblog_logid_unvalid"));
|
throw new RuntimeException(I18nUtil.getString("joblog_logid_unvalid"));
|
||||||
}
|
}
|
||||||
|
|
||||||
model.addAttribute("triggerCode", jobLog.getTriggerCode());
|
model.addAttribute("triggerCode" , jobLog.getTriggerCode());
|
||||||
model.addAttribute("handleCode", jobLog.getHandleCode());
|
model.addAttribute("handleCode" , jobLog.getHandleCode());
|
||||||
model.addAttribute("executorAddress", jobLog.getExecutorAddress());
|
model.addAttribute("executorAddress" , jobLog.getExecutorAddress());
|
||||||
model.addAttribute("triggerTime", jobLog.getTriggerTime().getTime());
|
model.addAttribute("triggerTime" , jobLog.getTriggerTime().getTime());
|
||||||
model.addAttribute("logId", jobLog.getId());
|
model.addAttribute("logId" , jobLog.getId());
|
||||||
return "joblog/joblog.detail";
|
return "joblog/joblog.detail";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/logDetailCat")
|
@RequestMapping("/logDetailCat")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ReturnT<LogResult> logDetailCat(String executorAddress, long triggerTime, long logId, int fromLineNum){
|
public ReturnT<LogResult> logDetailCat(String executorAddress, long triggerTime, long logId, int fromLineNum) {
|
||||||
try {
|
try {
|
||||||
ExecutorBiz executorBiz = XxlJobScheduler.getExecutorBiz(executorAddress);
|
ExecutorBiz executorBiz = XxlJobScheduler.getExecutorBiz(executorAddress);
|
||||||
ReturnT<LogResult> logResult = executorBiz.log(new LogParam(triggerTime, logId, fromLineNum));
|
ReturnT<LogResult> logResult = executorBiz.log(new LogParam(triggerTime, logId, fromLineNum));
|
||||||
|
|
||||||
// is end
|
// is end
|
||||||
if (logResult.getContent()!=null && logResult.getContent().getFromLineNum() > logResult.getContent().getToLineNum()) {
|
if (logResult.getContent() != null && logResult.getContent().getFromLineNum() > logResult.getContent().getToLineNum()) {
|
||||||
XxlJobLog jobLog = xxlJobLogDao.load(logId);
|
XxlJobLog jobLog = xxlJobLogDao.load(logId);
|
||||||
if (jobLog.getHandleCode() > 0) {
|
if (jobLog.getHandleCode() > 0) {
|
||||||
logResult.getContent().setEnd(true);
|
logResult.getContent().setEnd(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return logResult;
|
return logResult;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
return new ReturnT<LogResult>(ReturnT.FAIL_CODE, e.getMessage());
|
return new ReturnT<LogResult>(ReturnT.FAIL_CODE, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/logKill")
|
@RequestMapping("/logKill")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ReturnT<String> logKill(int id){
|
public ReturnT<String> logKill(int id) {
|
||||||
// base check
|
// base check
|
||||||
XxlJobLog log = xxlJobLogDao.load(id);
|
XxlJobLog log = xxlJobLogDao.load(id);
|
||||||
XxlJobInfo jobInfo = xxlJobInfoDao.loadById(log.getJobId());
|
XxlJobInfo jobInfo = xxlJobInfoDao.loadById(log.getJobId());
|
||||||
if (jobInfo==null) {
|
if (jobInfo == null) {
|
||||||
return new ReturnT<String>(500, I18nUtil.getString("jobinfo_glue_jobid_unvalid"));
|
return new ReturnT<String>(500, I18nUtil.getString("jobinfo_glue_jobid_unvalid"));
|
||||||
}
|
}
|
||||||
if (ReturnT.SUCCESS_CODE != log.getTriggerCode()) {
|
if (ReturnT.SUCCESS_CODE != log.getTriggerCode()) {
|
||||||
return new ReturnT<String>(500, I18nUtil.getString("joblog_kill_log_limit"));
|
return new ReturnT<String>(500, I18nUtil.getString("joblog_kill_log_limit"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// request of kill
|
// request of kill
|
||||||
ReturnT<String> runResult = null;
|
ReturnT<String> runResult = null;
|
||||||
try {
|
try {
|
||||||
ExecutorBiz executorBiz = XxlJobScheduler.getExecutorBiz(log.getExecutorAddress());
|
ExecutorBiz executorBiz = XxlJobScheduler.getExecutorBiz(log.getExecutorAddress());
|
||||||
runResult = executorBiz.kill(new KillParam(jobInfo.getId()));
|
runResult = executorBiz.kill(new KillParam(jobInfo.getId()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
runResult = new ReturnT<String>(500, e.getMessage());
|
runResult = new ReturnT<String>(500, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ReturnT.SUCCESS_CODE == runResult.getCode()) {
|
if (ReturnT.SUCCESS_CODE == runResult.getCode()) {
|
||||||
log.setHandleCode(ReturnT.FAIL_CODE);
|
log.setHandleCode(ReturnT.FAIL_CODE);
|
||||||
log.setHandleMsg( I18nUtil.getString("joblog_kill_log_byman")+":" + (runResult.getMsg()!=null?runResult.getMsg():""));
|
log.setHandleMsg(I18nUtil.getString("joblog_kill_log_byman") + ":" + (runResult.getMsg() != null ? runResult.getMsg() : ""));
|
||||||
log.setHandleTime(new Date());
|
log.setHandleTime(new Date());
|
||||||
XxlJobCompleter.updateHandleInfoAndFinish(log);
|
XxlJobCompleter.updateHandleInfoAndFinish(log);
|
||||||
return new ReturnT<String>(runResult.getMsg());
|
return new ReturnT<String>(runResult.getMsg());
|
||||||
} else {
|
} else {
|
||||||
return new ReturnT<String>(500, runResult.getMsg());
|
return new ReturnT<String>(500, runResult.getMsg());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/clearLog")
|
@RequestMapping("/clearLog")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ReturnT<String> clearLog(int jobGroup, int jobId, int type){
|
public ReturnT<String> clearLog(int jobGroup, int jobId, int type) {
|
||||||
|
|
||||||
Date clearBeforeTime = null;
|
Date clearBeforeTime = null;
|
||||||
int clearBeforeNum = 0;
|
int clearBeforeNum = 0;
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
clearBeforeTime = DateUtil.addMonths(new Date(), -1); // 清理一个月之前日志数据
|
clearBeforeTime = DateUtil.addMonths(new Date(), -1); // 清理一个月之前日志数据
|
||||||
} else if (type == 2) {
|
} else if (type == 2) {
|
||||||
clearBeforeTime = DateUtil.addMonths(new Date(), -3); // 清理三个月之前日志数据
|
clearBeforeTime = DateUtil.addMonths(new Date(), -3); // 清理三个月之前日志数据
|
||||||
} else if (type == 3) {
|
} else if (type == 3) {
|
||||||
clearBeforeTime = DateUtil.addMonths(new Date(), -6); // 清理六个月之前日志数据
|
clearBeforeTime = DateUtil.addMonths(new Date(), -6); // 清理六个月之前日志数据
|
||||||
} else if (type == 4) {
|
} else if (type == 4) {
|
||||||
clearBeforeTime = DateUtil.addYears(new Date(), -1); // 清理一年之前日志数据
|
clearBeforeTime = DateUtil.addYears(new Date(), -1); // 清理一年之前日志数据
|
||||||
} else if (type == 5) {
|
} else if (type == 5) {
|
||||||
clearBeforeNum = 1000; // 清理一千条以前日志数据
|
clearBeforeNum = 1000; // 清理一千条以前日志数据
|
||||||
} else if (type == 6) {
|
} else if (type == 6) {
|
||||||
clearBeforeNum = 10000; // 清理一万条以前日志数据
|
clearBeforeNum = 10000; // 清理一万条以前日志数据
|
||||||
} else if (type == 7) {
|
} else if (type == 7) {
|
||||||
clearBeforeNum = 30000; // 清理三万条以前日志数据
|
clearBeforeNum = 30000; // 清理三万条以前日志数据
|
||||||
} else if (type == 8) {
|
} else if (type == 8) {
|
||||||
clearBeforeNum = 100000; // 清理十万条以前日志数据
|
clearBeforeNum = 100000; // 清理十万条以前日志数据
|
||||||
} else if (type == 9) {
|
} else if (type == 9) {
|
||||||
clearBeforeNum = 0; // 清理所有日志数据
|
clearBeforeNum = 0; // 清理所有日志数据
|
||||||
} else {
|
} else {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("joblog_clean_type_unvalid"));
|
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("joblog_clean_type_unvalid"));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Long> logIds = null;
|
List<Long> logIds = null;
|
||||||
do {
|
do {
|
||||||
logIds = xxlJobLogDao.findClearLogIds(jobGroup, jobId, clearBeforeTime, clearBeforeNum, 1000);
|
logIds = xxlJobLogDao.findClearLogIds(jobGroup, jobId, clearBeforeTime, clearBeforeNum, 1000);
|
||||||
if (logIds!=null && logIds.size()>0) {
|
if (logIds != null && logIds.size() > 0) {
|
||||||
xxlJobLogDao.clearLog(logIds);
|
xxlJobLogDao.clearLog(logIds);
|
||||||
}
|
}
|
||||||
} while (logIds!=null && logIds.size()>0);
|
} while (logIds != null && logIds.size() > 0);
|
||||||
|
|
||||||
return ReturnT.SUCCESS;
|
return ReturnT.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ public class UserController {
|
|||||||
|
|
||||||
// 执行器列表
|
// 执行器列表
|
||||||
List<XxlJobGroup> groupList = xxlJobGroupDao.findAll();
|
List<XxlJobGroup> groupList = xxlJobGroupDao.findAll();
|
||||||
model.addAttribute("groupList", groupList);
|
model.addAttribute("groupList" , groupList);
|
||||||
|
|
||||||
return "user/user.index";
|
return "user/user.index";
|
||||||
}
|
}
|
||||||
@ -57,17 +57,17 @@ public class UserController {
|
|||||||
int list_count = xxlJobUserDao.pageListCount(start, length, username, role);
|
int list_count = xxlJobUserDao.pageListCount(start, length, username, role);
|
||||||
|
|
||||||
// filter
|
// filter
|
||||||
if (list!=null && list.size()>0) {
|
if (list != null && list.size() > 0) {
|
||||||
for (XxlJobUser item: list) {
|
for (XxlJobUser item : list) {
|
||||||
item.setPassword(null);
|
item.setPassword(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// package result
|
// package result
|
||||||
Map<String, Object> maps = new HashMap<String, Object>();
|
Map<String, Object> maps = new HashMap<String, Object>();
|
||||||
maps.put("recordsTotal", list_count); // 总记录数
|
maps.put("recordsTotal" , list_count); // 总记录数
|
||||||
maps.put("recordsFiltered", list_count); // 过滤后的总记录数
|
maps.put("recordsFiltered" , list_count); // 过滤后的总记录数
|
||||||
maps.put("data", list); // 分页列表
|
maps.put("data" , list); // 分页列表
|
||||||
return maps;
|
return maps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,19 +78,19 @@ public class UserController {
|
|||||||
|
|
||||||
// valid username
|
// valid username
|
||||||
if (!StringUtils.hasText(xxlJobUser.getUsername())) {
|
if (!StringUtils.hasText(xxlJobUser.getUsername())) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("system_please_input")+I18nUtil.getString("user_username") );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("system_please_input") + I18nUtil.getString("user_username"));
|
||||||
}
|
}
|
||||||
xxlJobUser.setUsername(xxlJobUser.getUsername().trim());
|
xxlJobUser.setUsername(xxlJobUser.getUsername().trim());
|
||||||
if (!(xxlJobUser.getUsername().length()>=4 && xxlJobUser.getUsername().length()<=20)) {
|
if (!(xxlJobUser.getUsername().length() >= 4 && xxlJobUser.getUsername().length() <= 20)) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("system_lengh_limit")+"[4-20]" );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("system_lengh_limit") + "[4-20]");
|
||||||
}
|
}
|
||||||
// valid password
|
// valid password
|
||||||
if (!StringUtils.hasText(xxlJobUser.getPassword())) {
|
if (!StringUtils.hasText(xxlJobUser.getPassword())) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("system_please_input")+I18nUtil.getString("user_password") );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("system_please_input") + I18nUtil.getString("user_password"));
|
||||||
}
|
}
|
||||||
xxlJobUser.setPassword(xxlJobUser.getPassword().trim());
|
xxlJobUser.setPassword(xxlJobUser.getPassword().trim());
|
||||||
if (!(xxlJobUser.getPassword().length()>=4 && xxlJobUser.getPassword().length()<=20)) {
|
if (!(xxlJobUser.getPassword().length() >= 4 && xxlJobUser.getPassword().length() <= 20)) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("system_lengh_limit")+"[4-20]" );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("system_lengh_limit") + "[4-20]");
|
||||||
}
|
}
|
||||||
// md5 password
|
// md5 password
|
||||||
xxlJobUser.setPassword(DigestUtils.md5DigestAsHex(xxlJobUser.getPassword().getBytes()));
|
xxlJobUser.setPassword(DigestUtils.md5DigestAsHex(xxlJobUser.getPassword().getBytes()));
|
||||||
@ -98,7 +98,7 @@ public class UserController {
|
|||||||
// check repeat
|
// check repeat
|
||||||
XxlJobUser existUser = xxlJobUserDao.loadByUserName(xxlJobUser.getUsername());
|
XxlJobUser existUser = xxlJobUserDao.loadByUserName(xxlJobUser.getUsername());
|
||||||
if (existUser != null) {
|
if (existUser != null) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("user_username_repeat") );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("user_username_repeat"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// write
|
// write
|
||||||
@ -120,8 +120,8 @@ public class UserController {
|
|||||||
// valid password
|
// valid password
|
||||||
if (StringUtils.hasText(xxlJobUser.getPassword())) {
|
if (StringUtils.hasText(xxlJobUser.getPassword())) {
|
||||||
xxlJobUser.setPassword(xxlJobUser.getPassword().trim());
|
xxlJobUser.setPassword(xxlJobUser.getPassword().trim());
|
||||||
if (!(xxlJobUser.getPassword().length()>=4 && xxlJobUser.getPassword().length()<=20)) {
|
if (!(xxlJobUser.getPassword().length() >= 4 && xxlJobUser.getPassword().length() <= 20)) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("system_lengh_limit")+"[4-20]" );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("system_lengh_limit") + "[4-20]");
|
||||||
}
|
}
|
||||||
// md5 password
|
// md5 password
|
||||||
xxlJobUser.setPassword(DigestUtils.md5DigestAsHex(xxlJobUser.getPassword().getBytes()));
|
xxlJobUser.setPassword(DigestUtils.md5DigestAsHex(xxlJobUser.getPassword().getBytes()));
|
||||||
@ -151,15 +151,15 @@ public class UserController {
|
|||||||
|
|
||||||
@RequestMapping("/updatePwd")
|
@RequestMapping("/updatePwd")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ReturnT<String> updatePwd(HttpServletRequest request, String password){
|
public ReturnT<String> updatePwd(HttpServletRequest request, String password) {
|
||||||
|
|
||||||
// valid password
|
// valid password
|
||||||
if (password==null || password.trim().length()==0){
|
if (password == null || password.trim().length() == 0) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL.getCode(), "密码不可为空");
|
return new ReturnT<String>(ReturnT.FAIL.getCode(), "密码不可为空");
|
||||||
}
|
}
|
||||||
password = password.trim();
|
password = password.trim();
|
||||||
if (!(password.length()>=4 && password.length()<=20)) {
|
if (!(password.length() >= 4 && password.length() <= 20)) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("system_lengh_limit")+"[4-20]" );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("system_lengh_limit") + "[4-20]");
|
||||||
}
|
}
|
||||||
|
|
||||||
// md5 password
|
// md5 password
|
||||||
|
@ -8,22 +8,23 @@ import java.lang.annotation.Target;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限限制
|
* 权限限制
|
||||||
|
*
|
||||||
* @author xuxueli 2015-12-12 18:29:02
|
* @author xuxueli 2015-12-12 18:29:02
|
||||||
*/
|
*/
|
||||||
@Target(ElementType.METHOD)
|
@Target(ElementType.METHOD)
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
public @interface PermissionLimit {
|
public @interface PermissionLimit {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录拦截 (默认拦截)
|
* 登录拦截 (默认拦截)
|
||||||
*/
|
*/
|
||||||
boolean limit() default true;
|
boolean limit() default true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 要求管理员权限
|
* 要求管理员权限
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean adminuser() default false;
|
boolean adminuser() default false;
|
||||||
|
|
||||||
}
|
}
|
@ -19,25 +19,25 @@ import java.util.HashMap;
|
|||||||
@Component
|
@Component
|
||||||
public class CookieInterceptor implements AsyncHandlerInterceptor {
|
public class CookieInterceptor implements AsyncHandlerInterceptor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
|
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
|
||||||
ModelAndView modelAndView) throws Exception {
|
ModelAndView modelAndView) throws Exception {
|
||||||
|
|
||||||
// cookie
|
// cookie
|
||||||
if (modelAndView!=null && request.getCookies()!=null && request.getCookies().length>0) {
|
if (modelAndView != null && request.getCookies() != null && request.getCookies().length > 0) {
|
||||||
HashMap<String, Cookie> cookieMap = new HashMap<String, Cookie>();
|
HashMap<String, Cookie> cookieMap = new HashMap<String, Cookie>();
|
||||||
for (Cookie ck : request.getCookies()) {
|
for (Cookie ck : request.getCookies()) {
|
||||||
cookieMap.put(ck.getName(), ck);
|
cookieMap.put(ck.getName(), ck);
|
||||||
}
|
}
|
||||||
modelAndView.addObject("cookieMap", cookieMap);
|
modelAndView.addObject("cookieMap" , cookieMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
// static method
|
// static method
|
||||||
if (modelAndView != null) {
|
if (modelAndView != null) {
|
||||||
modelAndView.addObject("I18nUtil", FtlUtil.generateStaticModel(I18nUtil.class.getName()));
|
modelAndView.addObject("I18nUtil" , FtlUtil.generateStaticModel(I18nUtil.class.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
AsyncHandlerInterceptor.super.postHandle(request, response, handler, modelAndView);
|
AsyncHandlerInterceptor.super.postHandle(request, response, handler, modelAndView);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,40 +20,40 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
@Component
|
@Component
|
||||||
public class PermissionInterceptor implements AsyncHandlerInterceptor {
|
public class PermissionInterceptor implements AsyncHandlerInterceptor {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private LoginService loginService;
|
private LoginService loginService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||||
|
|
||||||
if (!(handler instanceof HandlerMethod)) {
|
if (!(handler instanceof HandlerMethod)) {
|
||||||
return AsyncHandlerInterceptor.super.preHandle(request, response, handler);
|
return AsyncHandlerInterceptor.super.preHandle(request, response, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if need login
|
// if need login
|
||||||
boolean needLogin = true;
|
boolean needLogin = true;
|
||||||
boolean needAdminuser = false;
|
boolean needAdminuser = false;
|
||||||
HandlerMethod method = (HandlerMethod)handler;
|
HandlerMethod method = (HandlerMethod) handler;
|
||||||
PermissionLimit permission = method.getMethodAnnotation(PermissionLimit.class);
|
PermissionLimit permission = method.getMethodAnnotation(PermissionLimit.class);
|
||||||
if (permission!=null) {
|
if (permission != null) {
|
||||||
needLogin = permission.limit();
|
needLogin = permission.limit();
|
||||||
needAdminuser = permission.adminuser();
|
needAdminuser = permission.adminuser();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needLogin) {
|
if (needLogin) {
|
||||||
XxlJobUser loginUser = loginService.ifLogin(request, response);
|
XxlJobUser loginUser = loginService.ifLogin(request, response);
|
||||||
if (loginUser == null) {
|
if (loginUser == null) {
|
||||||
response.setStatus(302);
|
response.setStatus(302);
|
||||||
response.setHeader("location", request.getContextPath()+"/toLogin");
|
response.setHeader("location" , request.getContextPath() + "/toLogin");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (needAdminuser && loginUser.getRole()!=1) {
|
if (needAdminuser && loginUser.getRole() != 1) {
|
||||||
throw new RuntimeException(I18nUtil.getString("system_permission_limit"));
|
throw new RuntimeException(I18nUtil.getString("system_permission_limit"));
|
||||||
}
|
}
|
||||||
request.setAttribute(LoginService.LOGIN_IDENTITY_KEY, loginUser);
|
request.setAttribute(LoginService.LOGIN_IDENTITY_KEY, loginUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
return AsyncHandlerInterceptor.super.preHandle(request, response, handler);
|
return AsyncHandlerInterceptor.super.preHandle(request, response, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.xxl.job.admin.controller.resolver;
|
package com.xxl.job.admin.controller.resolver;
|
||||||
|
|
||||||
import com.xxl.job.admin.core.exception.XxlJobException;
|
import com.xxl.job.admin.core.exception.XxlJobException;
|
||||||
import com.xxl.job.core.biz.model.ReturnT;
|
|
||||||
import com.xxl.job.admin.core.util.JacksonUtil;
|
import com.xxl.job.admin.core.util.JacksonUtil;
|
||||||
|
import com.xxl.job.core.biz.model.ReturnT;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@ -22,45 +22,45 @@ import java.io.IOException;
|
|||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class WebExceptionResolver implements HandlerExceptionResolver {
|
public class WebExceptionResolver implements HandlerExceptionResolver {
|
||||||
private static transient Logger logger = LoggerFactory.getLogger(WebExceptionResolver.class);
|
private static transient Logger logger = LoggerFactory.getLogger(WebExceptionResolver.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ModelAndView resolveException(HttpServletRequest request,
|
public ModelAndView resolveException(HttpServletRequest request,
|
||||||
HttpServletResponse response, Object handler, Exception ex) {
|
HttpServletResponse response, Object handler, Exception ex) {
|
||||||
|
|
||||||
if (!(ex instanceof XxlJobException)) {
|
if (!(ex instanceof XxlJobException)) {
|
||||||
logger.error("WebExceptionResolver:{}", ex);
|
logger.error("WebExceptionResolver:{}" , ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if json
|
// if json
|
||||||
boolean isJson = false;
|
boolean isJson = false;
|
||||||
if (handler instanceof HandlerMethod) {
|
if (handler instanceof HandlerMethod) {
|
||||||
HandlerMethod method = (HandlerMethod)handler;
|
HandlerMethod method = (HandlerMethod) handler;
|
||||||
ResponseBody responseBody = method.getMethodAnnotation(ResponseBody.class);
|
ResponseBody responseBody = method.getMethodAnnotation(ResponseBody.class);
|
||||||
if (responseBody != null) {
|
if (responseBody != null) {
|
||||||
isJson = true;
|
isJson = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// error result
|
// error result
|
||||||
ReturnT<String> errorResult = new ReturnT<String>(ReturnT.FAIL_CODE, ex.toString().replaceAll("\n", "<br/>"));
|
ReturnT<String> errorResult = new ReturnT<String>(ReturnT.FAIL_CODE, ex.toString().replaceAll("\n" , "<br/>"));
|
||||||
|
|
||||||
// response
|
// response
|
||||||
ModelAndView mv = new ModelAndView();
|
ModelAndView mv = new ModelAndView();
|
||||||
if (isJson) {
|
if (isJson) {
|
||||||
try {
|
try {
|
||||||
response.setContentType("application/json;charset=utf-8");
|
response.setContentType("application/json;charset=utf-8");
|
||||||
response.getWriter().print(JacksonUtil.writeValueAsString(errorResult));
|
response.getWriter().print(JacksonUtil.writeValueAsString(errorResult));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
return mv;
|
return mv;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
mv.addObject("exceptionMsg", errorResult.getMsg());
|
mv.addObject("exceptionMsg" , errorResult.getMsg());
|
||||||
mv.setViewName("/common/common.exception");
|
mv.setViewName("/common/common.exception");
|
||||||
return mv;
|
return mv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -9,229 +9,229 @@ import java.util.Date;
|
|||||||
*/
|
*/
|
||||||
public class XxlJobInfo {
|
public class XxlJobInfo {
|
||||||
|
|
||||||
private int id; // 主键ID
|
private int id; // 主键ID
|
||||||
|
|
||||||
private int jobGroup; // 执行器主键ID
|
private int jobGroup; // 执行器主键ID
|
||||||
private String jobDesc;
|
private String jobDesc;
|
||||||
|
|
||||||
private Date addTime;
|
private Date addTime;
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
private String author; // 负责人
|
private String author; // 负责人
|
||||||
private String alarmEmail; // 报警邮件
|
private String alarmEmail; // 报警邮件
|
||||||
|
|
||||||
private String scheduleType; // 调度类型
|
private String scheduleType; // 调度类型
|
||||||
private String scheduleConf; // 调度配置,值含义取决于调度类型
|
private String scheduleConf; // 调度配置,值含义取决于调度类型
|
||||||
private String misfireStrategy; // 调度过期策略
|
private String misfireStrategy; // 调度过期策略
|
||||||
|
|
||||||
private String executorRouteStrategy; // 执行器路由策略
|
private String executorRouteStrategy; // 执行器路由策略
|
||||||
private String executorHandler; // 执行器,任务Handler名称
|
private String executorHandler; // 执行器,任务Handler名称
|
||||||
private String executorParam; // 执行器,任务参数
|
private String executorParam; // 执行器,任务参数
|
||||||
private String executorBlockStrategy; // 阻塞处理策略
|
private String executorBlockStrategy; // 阻塞处理策略
|
||||||
private int executorTimeout; // 任务执行超时时间,单位秒
|
private int executorTimeout; // 任务执行超时时间,单位秒
|
||||||
private int executorFailRetryCount; // 失败重试次数
|
private int executorFailRetryCount; // 失败重试次数
|
||||||
|
|
||||||
private String glueType; // GLUE类型 #com.xxl.job.core.glue.GlueTypeEnum
|
private String glueType; // GLUE类型 #com.xxl.job.core.glue.GlueTypeEnum
|
||||||
private String glueSource; // GLUE源代码
|
private String glueSource; // GLUE源代码
|
||||||
private String glueRemark; // GLUE备注
|
private String glueRemark; // GLUE备注
|
||||||
private Date glueUpdatetime; // GLUE更新时间
|
private Date glueUpdatetime; // GLUE更新时间
|
||||||
|
|
||||||
private String childJobId; // 子任务ID,多个逗号分隔
|
private String childJobId; // 子任务ID,多个逗号分隔
|
||||||
|
|
||||||
private int triggerStatus; // 调度状态:0-停止,1-运行
|
private int triggerStatus; // 调度状态:0-停止,1-运行
|
||||||
private long triggerLastTime; // 上次调度时间
|
private long triggerLastTime; // 上次调度时间
|
||||||
private long triggerNextTime; // 下次调度时间
|
private long triggerNextTime; // 下次调度时间
|
||||||
|
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(int id) {
|
public void setId(int id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getJobGroup() {
|
public int getJobGroup() {
|
||||||
return jobGroup;
|
return jobGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setJobGroup(int jobGroup) {
|
public void setJobGroup(int jobGroup) {
|
||||||
this.jobGroup = jobGroup;
|
this.jobGroup = jobGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getJobDesc() {
|
public String getJobDesc() {
|
||||||
return jobDesc;
|
return jobDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setJobDesc(String jobDesc) {
|
public void setJobDesc(String jobDesc) {
|
||||||
this.jobDesc = jobDesc;
|
this.jobDesc = jobDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getAddTime() {
|
public Date getAddTime() {
|
||||||
return addTime;
|
return addTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAddTime(Date addTime) {
|
public void setAddTime(Date addTime) {
|
||||||
this.addTime = addTime;
|
this.addTime = addTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getUpdateTime() {
|
public Date getUpdateTime() {
|
||||||
return updateTime;
|
return updateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUpdateTime(Date updateTime) {
|
public void setUpdateTime(Date updateTime) {
|
||||||
this.updateTime = updateTime;
|
this.updateTime = updateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAuthor() {
|
public String getAuthor() {
|
||||||
return author;
|
return author;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAuthor(String author) {
|
public void setAuthor(String author) {
|
||||||
this.author = author;
|
this.author = author;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAlarmEmail() {
|
public String getAlarmEmail() {
|
||||||
return alarmEmail;
|
return alarmEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAlarmEmail(String alarmEmail) {
|
public void setAlarmEmail(String alarmEmail) {
|
||||||
this.alarmEmail = alarmEmail;
|
this.alarmEmail = alarmEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getScheduleType() {
|
public String getScheduleType() {
|
||||||
return scheduleType;
|
return scheduleType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setScheduleType(String scheduleType) {
|
public void setScheduleType(String scheduleType) {
|
||||||
this.scheduleType = scheduleType;
|
this.scheduleType = scheduleType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getScheduleConf() {
|
public String getScheduleConf() {
|
||||||
return scheduleConf;
|
return scheduleConf;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setScheduleConf(String scheduleConf) {
|
public void setScheduleConf(String scheduleConf) {
|
||||||
this.scheduleConf = scheduleConf;
|
this.scheduleConf = scheduleConf;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMisfireStrategy() {
|
public String getMisfireStrategy() {
|
||||||
return misfireStrategy;
|
return misfireStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMisfireStrategy(String misfireStrategy) {
|
public void setMisfireStrategy(String misfireStrategy) {
|
||||||
this.misfireStrategy = misfireStrategy;
|
this.misfireStrategy = misfireStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExecutorRouteStrategy() {
|
public String getExecutorRouteStrategy() {
|
||||||
return executorRouteStrategy;
|
return executorRouteStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExecutorRouteStrategy(String executorRouteStrategy) {
|
public void setExecutorRouteStrategy(String executorRouteStrategy) {
|
||||||
this.executorRouteStrategy = executorRouteStrategy;
|
this.executorRouteStrategy = executorRouteStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExecutorHandler() {
|
public String getExecutorHandler() {
|
||||||
return executorHandler;
|
return executorHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExecutorHandler(String executorHandler) {
|
public void setExecutorHandler(String executorHandler) {
|
||||||
this.executorHandler = executorHandler;
|
this.executorHandler = executorHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExecutorParam() {
|
public String getExecutorParam() {
|
||||||
return executorParam;
|
return executorParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExecutorParam(String executorParam) {
|
public void setExecutorParam(String executorParam) {
|
||||||
this.executorParam = executorParam;
|
this.executorParam = executorParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExecutorBlockStrategy() {
|
public String getExecutorBlockStrategy() {
|
||||||
return executorBlockStrategy;
|
return executorBlockStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExecutorBlockStrategy(String executorBlockStrategy) {
|
public void setExecutorBlockStrategy(String executorBlockStrategy) {
|
||||||
this.executorBlockStrategy = executorBlockStrategy;
|
this.executorBlockStrategy = executorBlockStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getExecutorTimeout() {
|
public int getExecutorTimeout() {
|
||||||
return executorTimeout;
|
return executorTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExecutorTimeout(int executorTimeout) {
|
public void setExecutorTimeout(int executorTimeout) {
|
||||||
this.executorTimeout = executorTimeout;
|
this.executorTimeout = executorTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getExecutorFailRetryCount() {
|
public int getExecutorFailRetryCount() {
|
||||||
return executorFailRetryCount;
|
return executorFailRetryCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExecutorFailRetryCount(int executorFailRetryCount) {
|
public void setExecutorFailRetryCount(int executorFailRetryCount) {
|
||||||
this.executorFailRetryCount = executorFailRetryCount;
|
this.executorFailRetryCount = executorFailRetryCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGlueType() {
|
public String getGlueType() {
|
||||||
return glueType;
|
return glueType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGlueType(String glueType) {
|
public void setGlueType(String glueType) {
|
||||||
this.glueType = glueType;
|
this.glueType = glueType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGlueSource() {
|
public String getGlueSource() {
|
||||||
return glueSource;
|
return glueSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGlueSource(String glueSource) {
|
public void setGlueSource(String glueSource) {
|
||||||
this.glueSource = glueSource;
|
this.glueSource = glueSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGlueRemark() {
|
public String getGlueRemark() {
|
||||||
return glueRemark;
|
return glueRemark;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGlueRemark(String glueRemark) {
|
public void setGlueRemark(String glueRemark) {
|
||||||
this.glueRemark = glueRemark;
|
this.glueRemark = glueRemark;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getGlueUpdatetime() {
|
public Date getGlueUpdatetime() {
|
||||||
return glueUpdatetime;
|
return glueUpdatetime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGlueUpdatetime(Date glueUpdatetime) {
|
public void setGlueUpdatetime(Date glueUpdatetime) {
|
||||||
this.glueUpdatetime = glueUpdatetime;
|
this.glueUpdatetime = glueUpdatetime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getChildJobId() {
|
public String getChildJobId() {
|
||||||
return childJobId;
|
return childJobId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChildJobId(String childJobId) {
|
public void setChildJobId(String childJobId) {
|
||||||
this.childJobId = childJobId;
|
this.childJobId = childJobId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTriggerStatus() {
|
public int getTriggerStatus() {
|
||||||
return triggerStatus;
|
return triggerStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTriggerStatus(int triggerStatus) {
|
public void setTriggerStatus(int triggerStatus) {
|
||||||
this.triggerStatus = triggerStatus;
|
this.triggerStatus = triggerStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTriggerLastTime() {
|
public long getTriggerLastTime() {
|
||||||
return triggerLastTime;
|
return triggerLastTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTriggerLastTime(long triggerLastTime) {
|
public void setTriggerLastTime(long triggerLastTime) {
|
||||||
this.triggerLastTime = triggerLastTime;
|
this.triggerLastTime = triggerLastTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTriggerNextTime() {
|
public long getTriggerNextTime() {
|
||||||
return triggerNextTime;
|
return triggerNextTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTriggerNextTime(long triggerNextTime) {
|
public void setTriggerNextTime(long triggerNextTime) {
|
||||||
this.triggerNextTime = triggerNextTime;
|
this.triggerNextTime = triggerNextTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,154 +4,155 @@ import java.util.Date;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* xxl-job log, used to track trigger process
|
* xxl-job log, used to track trigger process
|
||||||
|
*
|
||||||
* @author xuxueli 2015-12-19 23:19:09
|
* @author xuxueli 2015-12-19 23:19:09
|
||||||
*/
|
*/
|
||||||
public class XxlJobLog {
|
public class XxlJobLog {
|
||||||
|
|
||||||
private long id;
|
private long id;
|
||||||
|
|
||||||
// job info
|
// job info
|
||||||
private int jobGroup;
|
private int jobGroup;
|
||||||
private int jobId;
|
private int jobId;
|
||||||
|
|
||||||
// execute info
|
// execute info
|
||||||
private String executorAddress;
|
private String executorAddress;
|
||||||
private String executorHandler;
|
private String executorHandler;
|
||||||
private String executorParam;
|
private String executorParam;
|
||||||
private String executorShardingParam;
|
private String executorShardingParam;
|
||||||
private int executorFailRetryCount;
|
private int executorFailRetryCount;
|
||||||
|
|
||||||
// trigger info
|
// trigger info
|
||||||
private Date triggerTime;
|
private Date triggerTime;
|
||||||
private int triggerCode;
|
private int triggerCode;
|
||||||
private String triggerMsg;
|
private String triggerMsg;
|
||||||
|
|
||||||
// handle info
|
// handle info
|
||||||
private Date handleTime;
|
private Date handleTime;
|
||||||
private int handleCode;
|
private int handleCode;
|
||||||
private String handleMsg;
|
private String handleMsg;
|
||||||
|
|
||||||
// alarm info
|
// alarm info
|
||||||
private int alarmStatus;
|
private int alarmStatus;
|
||||||
|
|
||||||
public long getId() {
|
public long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(long id) {
|
public void setId(long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getJobGroup() {
|
public int getJobGroup() {
|
||||||
return jobGroup;
|
return jobGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setJobGroup(int jobGroup) {
|
public void setJobGroup(int jobGroup) {
|
||||||
this.jobGroup = jobGroup;
|
this.jobGroup = jobGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getJobId() {
|
public int getJobId() {
|
||||||
return jobId;
|
return jobId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setJobId(int jobId) {
|
public void setJobId(int jobId) {
|
||||||
this.jobId = jobId;
|
this.jobId = jobId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExecutorAddress() {
|
public String getExecutorAddress() {
|
||||||
return executorAddress;
|
return executorAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExecutorAddress(String executorAddress) {
|
public void setExecutorAddress(String executorAddress) {
|
||||||
this.executorAddress = executorAddress;
|
this.executorAddress = executorAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExecutorHandler() {
|
public String getExecutorHandler() {
|
||||||
return executorHandler;
|
return executorHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExecutorHandler(String executorHandler) {
|
public void setExecutorHandler(String executorHandler) {
|
||||||
this.executorHandler = executorHandler;
|
this.executorHandler = executorHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExecutorParam() {
|
public String getExecutorParam() {
|
||||||
return executorParam;
|
return executorParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExecutorParam(String executorParam) {
|
public void setExecutorParam(String executorParam) {
|
||||||
this.executorParam = executorParam;
|
this.executorParam = executorParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExecutorShardingParam() {
|
public String getExecutorShardingParam() {
|
||||||
return executorShardingParam;
|
return executorShardingParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExecutorShardingParam(String executorShardingParam) {
|
public void setExecutorShardingParam(String executorShardingParam) {
|
||||||
this.executorShardingParam = executorShardingParam;
|
this.executorShardingParam = executorShardingParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getExecutorFailRetryCount() {
|
public int getExecutorFailRetryCount() {
|
||||||
return executorFailRetryCount;
|
return executorFailRetryCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExecutorFailRetryCount(int executorFailRetryCount) {
|
public void setExecutorFailRetryCount(int executorFailRetryCount) {
|
||||||
this.executorFailRetryCount = executorFailRetryCount;
|
this.executorFailRetryCount = executorFailRetryCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getTriggerTime() {
|
public Date getTriggerTime() {
|
||||||
return triggerTime;
|
return triggerTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTriggerTime(Date triggerTime) {
|
public void setTriggerTime(Date triggerTime) {
|
||||||
this.triggerTime = triggerTime;
|
this.triggerTime = triggerTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTriggerCode() {
|
public int getTriggerCode() {
|
||||||
return triggerCode;
|
return triggerCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTriggerCode(int triggerCode) {
|
public void setTriggerCode(int triggerCode) {
|
||||||
this.triggerCode = triggerCode;
|
this.triggerCode = triggerCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTriggerMsg() {
|
public String getTriggerMsg() {
|
||||||
return triggerMsg;
|
return triggerMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTriggerMsg(String triggerMsg) {
|
public void setTriggerMsg(String triggerMsg) {
|
||||||
this.triggerMsg = triggerMsg;
|
this.triggerMsg = triggerMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getHandleTime() {
|
public Date getHandleTime() {
|
||||||
return handleTime;
|
return handleTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHandleTime(Date handleTime) {
|
public void setHandleTime(Date handleTime) {
|
||||||
this.handleTime = handleTime;
|
this.handleTime = handleTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHandleCode() {
|
public int getHandleCode() {
|
||||||
return handleCode;
|
return handleCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHandleCode(int handleCode) {
|
public void setHandleCode(int handleCode) {
|
||||||
this.handleCode = handleCode;
|
this.handleCode = handleCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHandleMsg() {
|
public String getHandleMsg() {
|
||||||
return handleMsg;
|
return handleMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHandleMsg(String handleMsg) {
|
public void setHandleMsg(String handleMsg) {
|
||||||
this.handleMsg = handleMsg;
|
this.handleMsg = handleMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAlarmStatus() {
|
public int getAlarmStatus() {
|
||||||
return alarmStatus;
|
return alarmStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAlarmStatus(int alarmStatus) {
|
public void setAlarmStatus(int alarmStatus) {
|
||||||
this.alarmStatus = alarmStatus;
|
this.alarmStatus = alarmStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,72 +4,73 @@ import java.util.Date;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* xxl-job log for glue, used to track job code process
|
* xxl-job log for glue, used to track job code process
|
||||||
|
*
|
||||||
* @author xuxueli 2016-5-19 17:57:46
|
* @author xuxueli 2016-5-19 17:57:46
|
||||||
*/
|
*/
|
||||||
public class XxlJobLogGlue {
|
public class XxlJobLogGlue {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
private int jobId; // 任务主键ID
|
private int jobId; // 任务主键ID
|
||||||
private String glueType; // GLUE类型 #com.xxl.job.core.glue.GlueTypeEnum
|
private String glueType; // GLUE类型 #com.xxl.job.core.glue.GlueTypeEnum
|
||||||
private String glueSource;
|
private String glueSource;
|
||||||
private String glueRemark;
|
private String glueRemark;
|
||||||
private Date addTime;
|
private Date addTime;
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(int id) {
|
public void setId(int id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getJobId() {
|
public int getJobId() {
|
||||||
return jobId;
|
return jobId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setJobId(int jobId) {
|
public void setJobId(int jobId) {
|
||||||
this.jobId = jobId;
|
this.jobId = jobId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGlueType() {
|
public String getGlueType() {
|
||||||
return glueType;
|
return glueType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGlueType(String glueType) {
|
public void setGlueType(String glueType) {
|
||||||
this.glueType = glueType;
|
this.glueType = glueType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGlueSource() {
|
public String getGlueSource() {
|
||||||
return glueSource;
|
return glueSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGlueSource(String glueSource) {
|
public void setGlueSource(String glueSource) {
|
||||||
this.glueSource = glueSource;
|
this.glueSource = glueSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGlueRemark() {
|
public String getGlueRemark() {
|
||||||
return glueRemark;
|
return glueRemark;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGlueRemark(String glueRemark) {
|
public void setGlueRemark(String glueRemark) {
|
||||||
this.glueRemark = glueRemark;
|
this.glueRemark = glueRemark;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getAddTime() {
|
public Date getAddTime() {
|
||||||
return addTime;
|
return addTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAddTime(Date addTime) {
|
public void setAddTime(Date addTime) {
|
||||||
this.addTime = addTime;
|
this.addTime = addTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getUpdateTime() {
|
public Date getUpdateTime() {
|
||||||
return updateTime;
|
return updateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUpdateTime(Date updateTime) {
|
public void setUpdateTime(Date updateTime) {
|
||||||
this.updateTime = updateTime;
|
this.updateTime = updateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,67 +7,67 @@ import org.springframework.util.StringUtils;
|
|||||||
*/
|
*/
|
||||||
public class XxlJobUser {
|
public class XxlJobUser {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
private String username; // 账号
|
private String username; // 账号
|
||||||
private String password; // 密码
|
private String password; // 密码
|
||||||
private int role; // 角色:0-普通用户、1-管理员
|
private int role; // 角色:0-普通用户、1-管理员
|
||||||
private String permission; // 权限:执行器ID列表,多个逗号分割
|
private String permission; // 权限:执行器ID列表,多个逗号分割
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(int id) {
|
public void setId(int id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUsername() {
|
public String getUsername() {
|
||||||
return username;
|
return username;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUsername(String username) {
|
public void setUsername(String username) {
|
||||||
this.username = username;
|
this.username = username;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPassword() {
|
public String getPassword() {
|
||||||
return password;
|
return password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPassword(String password) {
|
public void setPassword(String password) {
|
||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRole() {
|
public int getRole() {
|
||||||
return role;
|
return role;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRole(int role) {
|
public void setRole(int role) {
|
||||||
this.role = role;
|
this.role = role;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPermission() {
|
public String getPermission() {
|
||||||
return permission;
|
return permission;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPermission(String permission) {
|
public void setPermission(String permission) {
|
||||||
this.permission = permission;
|
this.permission = permission;
|
||||||
}
|
}
|
||||||
|
|
||||||
// plugin
|
// plugin
|
||||||
public boolean validPermission(int jobGroup){
|
public boolean validPermission(int jobGroup) {
|
||||||
if (this.role == 1) {
|
if (this.role == 1) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (StringUtils.hasText(this.permission)) {
|
if (StringUtils.hasText(this.permission)) {
|
||||||
for (String permissionItem : this.permission.split(",")) {
|
for (String permissionItem : this.permission.split(",")) {
|
||||||
if (String.valueOf(jobGroup).equals(permissionItem)) {
|
if (String.valueOf(jobGroup).equals(permissionItem)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,83 +20,85 @@ import java.util.concurrent.*;
|
|||||||
* @author xuxueli 2015-9-1 18:05:56
|
* @author xuxueli 2015-9-1 18:05:56
|
||||||
*/
|
*/
|
||||||
public class JobCompleteHelper {
|
public class JobCompleteHelper {
|
||||||
private static Logger logger = LoggerFactory.getLogger(JobCompleteHelper.class);
|
private static Logger logger = LoggerFactory.getLogger(JobCompleteHelper.class);
|
||||||
|
|
||||||
private static JobCompleteHelper instance = new JobCompleteHelper();
|
private static JobCompleteHelper instance = new JobCompleteHelper();
|
||||||
public static JobCompleteHelper getInstance(){
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------- monitor ----------------------
|
public static JobCompleteHelper getInstance() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
private ThreadPoolExecutor callbackThreadPool = null;
|
// ---------------------- monitor ----------------------
|
||||||
private Thread monitorThread;
|
|
||||||
private volatile boolean toStop = false;
|
|
||||||
public void start(){
|
|
||||||
|
|
||||||
// for callback
|
private ThreadPoolExecutor callbackThreadPool = null;
|
||||||
callbackThreadPool = new ThreadPoolExecutor(
|
private Thread monitorThread;
|
||||||
2,
|
private volatile boolean toStop = false;
|
||||||
20,
|
|
||||||
30L,
|
public void start() {
|
||||||
TimeUnit.SECONDS,
|
|
||||||
new LinkedBlockingQueue<Runnable>(3000),
|
// for callback
|
||||||
new ThreadFactory() {
|
callbackThreadPool = new ThreadPoolExecutor(
|
||||||
@Override
|
2,
|
||||||
public Thread newThread(Runnable r) {
|
20,
|
||||||
return new Thread(r, "xxl-job, admin JobLosedMonitorHelper-callbackThreadPool-" + r.hashCode());
|
30L,
|
||||||
}
|
TimeUnit.SECONDS,
|
||||||
},
|
new LinkedBlockingQueue<Runnable>(3000),
|
||||||
new RejectedExecutionHandler() {
|
new ThreadFactory() {
|
||||||
@Override
|
@Override
|
||||||
public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
|
public Thread newThread(Runnable r) {
|
||||||
r.run();
|
return new Thread(r, "xxl-job, admin JobLosedMonitorHelper-callbackThreadPool-" + r.hashCode());
|
||||||
logger.warn(">>>>>>>>>>> xxl-job, callback too fast, match threadpool rejected handler(run now).");
|
}
|
||||||
}
|
},
|
||||||
});
|
new RejectedExecutionHandler() {
|
||||||
|
@Override
|
||||||
|
public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
|
||||||
|
r.run();
|
||||||
|
logger.warn(">>>>>>>>>>> xxl-job, callback too fast, match threadpool rejected handler(run now).");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// for monitor
|
// for monitor
|
||||||
monitorThread = new Thread(new Runnable() {
|
monitorThread = new Thread(new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
// wait for JobTriggerPoolHelper-init
|
// wait for JobTriggerPoolHelper-init
|
||||||
try {
|
try {
|
||||||
TimeUnit.MILLISECONDS.sleep(50);
|
TimeUnit.MILLISECONDS.sleep(50);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
if (!toStop) {
|
if (!toStop) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// monitor
|
// monitor
|
||||||
while (!toStop) {
|
while (!toStop) {
|
||||||
try {
|
try {
|
||||||
// 任务结果丢失处理:调度记录停留在 "运行中" 状态超过10min,且对应执行器心跳注册失败不在线,则将本地调度主动标记失败;
|
// 任务结果丢失处理:调度记录停留在 "运行中" 状态超过10min,且对应执行器心跳注册失败不在线,则将本地调度主动标记失败;
|
||||||
Date losedTime = DateUtil.addMinutes(new Date(), -10);
|
Date losedTime = DateUtil.addMinutes(new Date(), -10);
|
||||||
List<Long> losedJobIds = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().findLostJobIds(losedTime);
|
List<Long> losedJobIds = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().findLostJobIds(losedTime);
|
||||||
|
|
||||||
if (losedJobIds!=null && losedJobIds.size()>0) {
|
if (losedJobIds != null && losedJobIds.size() > 0) {
|
||||||
for (Long logId: losedJobIds) {
|
for (Long logId : losedJobIds) {
|
||||||
|
|
||||||
XxlJobLog jobLog = new XxlJobLog();
|
XxlJobLog jobLog = new XxlJobLog();
|
||||||
jobLog.setId(logId);
|
jobLog.setId(logId);
|
||||||
|
|
||||||
jobLog.setHandleTime(new Date());
|
jobLog.setHandleTime(new Date());
|
||||||
jobLog.setHandleCode(ReturnT.FAIL_CODE);
|
jobLog.setHandleCode(ReturnT.FAIL_CODE);
|
||||||
jobLog.setHandleMsg( I18nUtil.getString("joblog_lost_fail") );
|
jobLog.setHandleMsg(I18nUtil.getString("joblog_lost_fail"));
|
||||||
|
|
||||||
XxlJobCompleter.updateHandleInfoAndFinish(jobLog);
|
XxlJobCompleter.updateHandleInfoAndFinish(jobLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (!toStop) {
|
if (!toStop) {
|
||||||
logger.error(">>>>>>>>>>> xxl-job, job fail monitor thread error:{}", e);
|
logger.error(">>>>>>>>>>> xxl-job, job fail monitor thread error:{}" , e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
TimeUnit.SECONDS.sleep(60);
|
TimeUnit.SECONDS.sleep(60);
|
||||||
@ -108,77 +110,76 @@ public class JobCompleteHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info(">>>>>>>>>>> xxl-job, JobLosedMonitorHelper stop");
|
logger.info(">>>>>>>>>>> xxl-job, JobLosedMonitorHelper stop");
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
monitorThread.setDaemon(true);
|
monitorThread.setDaemon(true);
|
||||||
monitorThread.setName("xxl-job, admin JobLosedMonitorHelper");
|
monitorThread.setName("xxl-job, admin JobLosedMonitorHelper");
|
||||||
monitorThread.start();
|
monitorThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toStop(){
|
public void toStop() {
|
||||||
toStop = true;
|
toStop = true;
|
||||||
|
|
||||||
// stop registryOrRemoveThreadPool
|
// stop registryOrRemoveThreadPool
|
||||||
callbackThreadPool.shutdownNow();
|
callbackThreadPool.shutdownNow();
|
||||||
|
|
||||||
// stop monitorThread (interrupt and wait)
|
// stop monitorThread (interrupt and wait)
|
||||||
monitorThread.interrupt();
|
monitorThread.interrupt();
|
||||||
try {
|
try {
|
||||||
monitorThread.join();
|
monitorThread.join();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ---------------------- helper ----------------------
|
// ---------------------- helper ----------------------
|
||||||
|
|
||||||
public ReturnT<String> callback(List<HandleCallbackParam> callbackParamList) {
|
public ReturnT<String> callback(List<HandleCallbackParam> callbackParamList) {
|
||||||
|
|
||||||
callbackThreadPool.execute(new Runnable() {
|
callbackThreadPool.execute(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (HandleCallbackParam handleCallbackParam: callbackParamList) {
|
for (HandleCallbackParam handleCallbackParam : callbackParamList) {
|
||||||
ReturnT<String> callbackResult = callback(handleCallbackParam);
|
ReturnT<String> callbackResult = callback(handleCallbackParam);
|
||||||
logger.debug(">>>>>>>>> JobApiController.callback {}, handleCallbackParam={}, callbackResult={}",
|
logger.debug(">>>>>>>>> JobApiController.callback {}, handleCallbackParam={}, callbackResult={}" ,
|
||||||
(callbackResult.getCode()== ReturnT.SUCCESS_CODE?"success":"fail"), handleCallbackParam, callbackResult);
|
(callbackResult.getCode() == ReturnT.SUCCESS_CODE ? "success" : "fail"), handleCallbackParam, callbackResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return ReturnT.SUCCESS;
|
return ReturnT.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ReturnT<String> callback(HandleCallbackParam handleCallbackParam) {
|
private ReturnT<String> callback(HandleCallbackParam handleCallbackParam) {
|
||||||
// valid log item
|
// valid log item
|
||||||
XxlJobLog log = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().load(handleCallbackParam.getLogId());
|
XxlJobLog log = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().load(handleCallbackParam.getLogId());
|
||||||
if (log == null) {
|
if (log == null) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, "log item not found.");
|
return new ReturnT<String>(ReturnT.FAIL_CODE, "log item not found.");
|
||||||
}
|
}
|
||||||
if (log.getHandleCode() > 0) {
|
if (log.getHandleCode() > 0) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, "log repeate callback."); // avoid repeat callback, trigger child job etc
|
return new ReturnT<String>(ReturnT.FAIL_CODE, "log repeate callback."); // avoid repeat callback, trigger child job etc
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle msg
|
// handle msg
|
||||||
StringBuffer handleMsg = new StringBuffer();
|
StringBuffer handleMsg = new StringBuffer();
|
||||||
if (log.getHandleMsg()!=null) {
|
if (log.getHandleMsg() != null) {
|
||||||
handleMsg.append(log.getHandleMsg()).append("<br>");
|
handleMsg.append(log.getHandleMsg()).append("<br>");
|
||||||
}
|
}
|
||||||
if (handleCallbackParam.getHandleMsg() != null) {
|
if (handleCallbackParam.getHandleMsg() != null) {
|
||||||
handleMsg.append(handleCallbackParam.getHandleMsg());
|
handleMsg.append(handleCallbackParam.getHandleMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
// success, save log
|
// success, save log
|
||||||
log.setHandleTime(new Date());
|
log.setHandleTime(new Date());
|
||||||
log.setHandleCode(handleCallbackParam.getHandleCode());
|
log.setHandleCode(handleCallbackParam.getHandleCode());
|
||||||
log.setHandleMsg(handleMsg.toString());
|
log.setHandleMsg(handleMsg.toString());
|
||||||
XxlJobCompleter.updateHandleInfoAndFinish(log);
|
XxlJobCompleter.updateHandleInfoAndFinish(log);
|
||||||
|
|
||||||
return ReturnT.SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
return ReturnT.SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,65 +17,67 @@ import java.util.concurrent.TimeUnit;
|
|||||||
* @author xuxueli 2015-9-1 18:05:56
|
* @author xuxueli 2015-9-1 18:05:56
|
||||||
*/
|
*/
|
||||||
public class JobFailMonitorHelper {
|
public class JobFailMonitorHelper {
|
||||||
private static Logger logger = LoggerFactory.getLogger(JobFailMonitorHelper.class);
|
private static Logger logger = LoggerFactory.getLogger(JobFailMonitorHelper.class);
|
||||||
|
|
||||||
private static JobFailMonitorHelper instance = new JobFailMonitorHelper();
|
private static JobFailMonitorHelper instance = new JobFailMonitorHelper();
|
||||||
public static JobFailMonitorHelper getInstance(){
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------- monitor ----------------------
|
public static JobFailMonitorHelper getInstance() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
private Thread monitorThread;
|
// ---------------------- monitor ----------------------
|
||||||
private volatile boolean toStop = false;
|
|
||||||
public void start(){
|
|
||||||
monitorThread = new Thread(new Runnable() {
|
|
||||||
|
|
||||||
@Override
|
private Thread monitorThread;
|
||||||
public void run() {
|
private volatile boolean toStop = false;
|
||||||
|
|
||||||
// monitor
|
public void start() {
|
||||||
while (!toStop) {
|
monitorThread = new Thread(new Runnable() {
|
||||||
try {
|
|
||||||
|
|
||||||
List<Long> failLogIds = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().findFailJobLogIds(1000);
|
@Override
|
||||||
if (failLogIds!=null && !failLogIds.isEmpty()) {
|
public void run() {
|
||||||
for (long failLogId: failLogIds) {
|
|
||||||
|
|
||||||
// lock log
|
// monitor
|
||||||
int lockRet = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().updateAlarmStatus(failLogId, 0, -1);
|
while (!toStop) {
|
||||||
if (lockRet < 1) {
|
try {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
XxlJobLog log = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().load(failLogId);
|
|
||||||
XxlJobInfo info = XxlJobAdminConfig.getAdminConfig().getXxlJobInfoDao().loadById(log.getJobId());
|
|
||||||
|
|
||||||
// 1、fail retry monitor
|
List<Long> failLogIds = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().findFailJobLogIds(1000);
|
||||||
if (log.getExecutorFailRetryCount() > 0) {
|
if (failLogIds != null && !failLogIds.isEmpty()) {
|
||||||
JobTriggerPoolHelper.trigger(log.getJobId(), TriggerTypeEnum.RETRY, (log.getExecutorFailRetryCount()-1), log.getExecutorShardingParam(), log.getExecutorParam(), null);
|
for (long failLogId : failLogIds) {
|
||||||
String retryMsg = "<br><br><span style=\"color:#F39C12;\" > >>>>>>>>>>>"+ I18nUtil.getString("jobconf_trigger_type_retry") +"<<<<<<<<<<< </span><br>";
|
|
||||||
log.setTriggerMsg(log.getTriggerMsg() + retryMsg);
|
|
||||||
XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().updateTriggerInfo(log);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2、fail alarm monitor
|
// lock log
|
||||||
int newAlarmStatus = 0; // 告警状态:0-默认、-1=锁定状态、1-无需告警、2-告警成功、3-告警失败
|
int lockRet = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().updateAlarmStatus(failLogId, 0, -1);
|
||||||
if (info!=null && info.getAlarmEmail()!=null && info.getAlarmEmail().trim().length()>0) {
|
if (lockRet < 1) {
|
||||||
boolean alarmResult = XxlJobAdminConfig.getAdminConfig().getJobAlarmer().alarm(info, log);
|
continue;
|
||||||
newAlarmStatus = alarmResult?2:3;
|
}
|
||||||
} else {
|
XxlJobLog log = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().load(failLogId);
|
||||||
newAlarmStatus = 1;
|
XxlJobInfo info = XxlJobAdminConfig.getAdminConfig().getXxlJobInfoDao().loadById(log.getJobId());
|
||||||
}
|
|
||||||
|
|
||||||
XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().updateAlarmStatus(failLogId, -1, newAlarmStatus);
|
// 1、fail retry monitor
|
||||||
}
|
if (log.getExecutorFailRetryCount() > 0) {
|
||||||
}
|
JobTriggerPoolHelper.trigger(log.getJobId(), TriggerTypeEnum.RETRY, (log.getExecutorFailRetryCount() - 1), log.getExecutorShardingParam(), log.getExecutorParam(), null);
|
||||||
|
String retryMsg = "<br><br><span style=\"color:#F39C12;\" > >>>>>>>>>>>" + I18nUtil.getString("jobconf_trigger_type_retry") + "<<<<<<<<<<< </span><br>";
|
||||||
|
log.setTriggerMsg(log.getTriggerMsg() + retryMsg);
|
||||||
|
XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().updateTriggerInfo(log);
|
||||||
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
// 2、fail alarm monitor
|
||||||
if (!toStop) {
|
int newAlarmStatus = 0; // 告警状态:0-默认、-1=锁定状态、1-无需告警、2-告警成功、3-告警失败
|
||||||
logger.error(">>>>>>>>>>> xxl-job, job fail monitor thread error:{}", e);
|
if (info != null && info.getAlarmEmail() != null && info.getAlarmEmail().trim().length() > 0) {
|
||||||
}
|
boolean alarmResult = XxlJobAdminConfig.getAdminConfig().getJobAlarmer().alarm(info, log);
|
||||||
}
|
newAlarmStatus = alarmResult ? 2 : 3;
|
||||||
|
} else {
|
||||||
|
newAlarmStatus = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().updateAlarmStatus(failLogId, -1, newAlarmStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
if (!toStop) {
|
||||||
|
logger.error(">>>>>>>>>>> xxl-job, job fail monitor thread error:{}" , e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
TimeUnit.SECONDS.sleep(10);
|
TimeUnit.SECONDS.sleep(10);
|
||||||
@ -87,24 +89,24 @@ public class JobFailMonitorHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info(">>>>>>>>>>> xxl-job, job fail monitor thread stop");
|
logger.info(">>>>>>>>>>> xxl-job, job fail monitor thread stop");
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
monitorThread.setDaemon(true);
|
monitorThread.setDaemon(true);
|
||||||
monitorThread.setName("xxl-job, admin JobFailMonitorHelper");
|
monitorThread.setName("xxl-job, admin JobFailMonitorHelper");
|
||||||
monitorThread.start();
|
monitorThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toStop(){
|
public void toStop() {
|
||||||
toStop = true;
|
toStop = true;
|
||||||
// interrupt and wait
|
// interrupt and wait
|
||||||
monitorThread.interrupt();
|
monitorThread.interrupt();
|
||||||
try {
|
try {
|
||||||
monitorThread.join();
|
monitorThread.join();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,190 +15,192 @@ import java.util.concurrent.*;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* job registry instance
|
* job registry instance
|
||||||
|
*
|
||||||
* @author xuxueli 2016-10-02 19:10:24
|
* @author xuxueli 2016-10-02 19:10:24
|
||||||
*/
|
*/
|
||||||
public class JobRegistryHelper {
|
public class JobRegistryHelper {
|
||||||
private static Logger logger = LoggerFactory.getLogger(JobRegistryHelper.class);
|
private static Logger logger = LoggerFactory.getLogger(JobRegistryHelper.class);
|
||||||
|
|
||||||
private static JobRegistryHelper instance = new JobRegistryHelper();
|
private static JobRegistryHelper instance = new JobRegistryHelper();
|
||||||
public static JobRegistryHelper getInstance(){
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ThreadPoolExecutor registryOrRemoveThreadPool = null;
|
public static JobRegistryHelper getInstance() {
|
||||||
private Thread registryMonitorThread;
|
return instance;
|
||||||
private volatile boolean toStop = false;
|
}
|
||||||
|
|
||||||
public void start(){
|
private ThreadPoolExecutor registryOrRemoveThreadPool = null;
|
||||||
|
private Thread registryMonitorThread;
|
||||||
|
private volatile boolean toStop = false;
|
||||||
|
|
||||||
// for registry or remove
|
public void start() {
|
||||||
registryOrRemoveThreadPool = new ThreadPoolExecutor(
|
|
||||||
2,
|
|
||||||
10,
|
|
||||||
30L,
|
|
||||||
TimeUnit.SECONDS,
|
|
||||||
new LinkedBlockingQueue<Runnable>(2000),
|
|
||||||
new ThreadFactory() {
|
|
||||||
@Override
|
|
||||||
public Thread newThread(Runnable r) {
|
|
||||||
return new Thread(r, "xxl-job, admin JobRegistryMonitorHelper-registryOrRemoveThreadPool-" + r.hashCode());
|
|
||||||
}
|
|
||||||
},
|
|
||||||
new RejectedExecutionHandler() {
|
|
||||||
@Override
|
|
||||||
public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
|
|
||||||
r.run();
|
|
||||||
logger.warn(">>>>>>>>>>> xxl-job, registry or remove too fast, match threadpool rejected handler(run now).");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// for monitor
|
// for registry or remove
|
||||||
registryMonitorThread = new Thread(new Runnable() {
|
registryOrRemoveThreadPool = new ThreadPoolExecutor(
|
||||||
@Override
|
2,
|
||||||
public void run() {
|
10,
|
||||||
while (!toStop) {
|
30L,
|
||||||
try {
|
TimeUnit.SECONDS,
|
||||||
// auto registry group
|
new LinkedBlockingQueue<Runnable>(2000),
|
||||||
List<XxlJobGroup> groupList = XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().findByAddressType(0);
|
new ThreadFactory() {
|
||||||
if (groupList!=null && !groupList.isEmpty()) {
|
@Override
|
||||||
|
public Thread newThread(Runnable r) {
|
||||||
|
return new Thread(r, "xxl-job, admin JobRegistryMonitorHelper-registryOrRemoveThreadPool-" + r.hashCode());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new RejectedExecutionHandler() {
|
||||||
|
@Override
|
||||||
|
public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
|
||||||
|
r.run();
|
||||||
|
logger.warn(">>>>>>>>>>> xxl-job, registry or remove too fast, match threadpool rejected handler(run now).");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// remove dead address (admin/executor)
|
// for monitor
|
||||||
List<Integer> ids = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().findDead(RegistryConfig.DEAD_TIMEOUT, new Date());
|
registryMonitorThread = new Thread(new Runnable() {
|
||||||
if (ids!=null && ids.size()>0) {
|
@Override
|
||||||
XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().removeDead(ids);
|
public void run() {
|
||||||
}
|
while (!toStop) {
|
||||||
|
try {
|
||||||
|
// auto registry group
|
||||||
|
List<XxlJobGroup> groupList = XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().findByAddressType(0);
|
||||||
|
if (groupList != null && !groupList.isEmpty()) {
|
||||||
|
|
||||||
// fresh online address (admin/executor)
|
// remove dead address (admin/executor)
|
||||||
HashMap<String, List<String>> appAddressMap = new HashMap<String, List<String>>();
|
List<Integer> ids = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().findDead(RegistryConfig.DEAD_TIMEOUT, new Date());
|
||||||
List<XxlJobRegistry> list = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().findAll(RegistryConfig.DEAD_TIMEOUT, new Date());
|
if (ids != null && ids.size() > 0) {
|
||||||
if (list != null) {
|
XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().removeDead(ids);
|
||||||
for (XxlJobRegistry item: list) {
|
}
|
||||||
if (RegistryConfig.RegistType.EXECUTOR.name().equals(item.getRegistryGroup())) {
|
|
||||||
String appname = item.getRegistryKey();
|
|
||||||
List<String> registryList = appAddressMap.get(appname);
|
|
||||||
if (registryList == null) {
|
|
||||||
registryList = new ArrayList<String>();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!registryList.contains(item.getRegistryValue())) {
|
// fresh online address (admin/executor)
|
||||||
registryList.add(item.getRegistryValue());
|
HashMap<String, List<String>> appAddressMap = new HashMap<String, List<String>>();
|
||||||
}
|
List<XxlJobRegistry> list = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().findAll(RegistryConfig.DEAD_TIMEOUT, new Date());
|
||||||
appAddressMap.put(appname, registryList);
|
if (list != null) {
|
||||||
}
|
for (XxlJobRegistry item : list) {
|
||||||
}
|
if (RegistryConfig.RegistType.EXECUTOR.name().equals(item.getRegistryGroup())) {
|
||||||
}
|
String appname = item.getRegistryKey();
|
||||||
|
List<String> registryList = appAddressMap.get(appname);
|
||||||
|
if (registryList == null) {
|
||||||
|
registryList = new ArrayList<String>();
|
||||||
|
}
|
||||||
|
|
||||||
// fresh group address
|
if (!registryList.contains(item.getRegistryValue())) {
|
||||||
for (XxlJobGroup group: groupList) {
|
registryList.add(item.getRegistryValue());
|
||||||
List<String> registryList = appAddressMap.get(group.getAppname());
|
}
|
||||||
String addressListStr = null;
|
appAddressMap.put(appname, registryList);
|
||||||
if (registryList!=null && !registryList.isEmpty()) {
|
}
|
||||||
Collections.sort(registryList);
|
}
|
||||||
StringBuilder addressListSB = new StringBuilder();
|
}
|
||||||
for (String item:registryList) {
|
|
||||||
addressListSB.append(item).append(",");
|
|
||||||
}
|
|
||||||
addressListStr = addressListSB.toString();
|
|
||||||
addressListStr = addressListStr.substring(0, addressListStr.length()-1);
|
|
||||||
}
|
|
||||||
group.setAddressList(addressListStr);
|
|
||||||
group.setUpdateTime(new Date());
|
|
||||||
|
|
||||||
XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().update(group);
|
// fresh group address
|
||||||
}
|
for (XxlJobGroup group : groupList) {
|
||||||
}
|
List<String> registryList = appAddressMap.get(group.getAppname());
|
||||||
} catch (Exception e) {
|
String addressListStr = null;
|
||||||
if (!toStop) {
|
if (registryList != null && !registryList.isEmpty()) {
|
||||||
logger.error(">>>>>>>>>>> xxl-job, job registry monitor thread error:{}", e);
|
Collections.sort(registryList);
|
||||||
}
|
StringBuilder addressListSB = new StringBuilder();
|
||||||
}
|
for (String item : registryList) {
|
||||||
try {
|
addressListSB.append(item).append(",");
|
||||||
TimeUnit.SECONDS.sleep(RegistryConfig.BEAT_TIMEOUT);
|
}
|
||||||
} catch (InterruptedException e) {
|
addressListStr = addressListSB.toString();
|
||||||
if (!toStop) {
|
addressListStr = addressListStr.substring(0, addressListStr.length() - 1);
|
||||||
logger.error(">>>>>>>>>>> xxl-job, job registry monitor thread error:{}", e);
|
}
|
||||||
}
|
group.setAddressList(addressListStr);
|
||||||
}
|
group.setUpdateTime(new Date());
|
||||||
}
|
|
||||||
logger.info(">>>>>>>>>>> xxl-job, job registry monitor thread stop");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
registryMonitorThread.setDaemon(true);
|
|
||||||
registryMonitorThread.setName("xxl-job, admin JobRegistryMonitorHelper-registryMonitorThread");
|
|
||||||
registryMonitorThread.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void toStop(){
|
XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().update(group);
|
||||||
toStop = true;
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
if (!toStop) {
|
||||||
|
logger.error(">>>>>>>>>>> xxl-job, job registry monitor thread error:{}" , e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
TimeUnit.SECONDS.sleep(RegistryConfig.BEAT_TIMEOUT);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
if (!toStop) {
|
||||||
|
logger.error(">>>>>>>>>>> xxl-job, job registry monitor thread error:{}" , e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logger.info(">>>>>>>>>>> xxl-job, job registry monitor thread stop");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
registryMonitorThread.setDaemon(true);
|
||||||
|
registryMonitorThread.setName("xxl-job, admin JobRegistryMonitorHelper-registryMonitorThread");
|
||||||
|
registryMonitorThread.start();
|
||||||
|
}
|
||||||
|
|
||||||
// stop registryOrRemoveThreadPool
|
public void toStop() {
|
||||||
registryOrRemoveThreadPool.shutdownNow();
|
toStop = true;
|
||||||
|
|
||||||
// stop monitir (interrupt and wait)
|
// stop registryOrRemoveThreadPool
|
||||||
registryMonitorThread.interrupt();
|
registryOrRemoveThreadPool.shutdownNow();
|
||||||
try {
|
|
||||||
registryMonitorThread.join();
|
// stop monitir (interrupt and wait)
|
||||||
} catch (InterruptedException e) {
|
registryMonitorThread.interrupt();
|
||||||
logger.error(e.getMessage(), e);
|
try {
|
||||||
}
|
registryMonitorThread.join();
|
||||||
}
|
} catch (InterruptedException e) {
|
||||||
|
logger.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ---------------------- helper ----------------------
|
// ---------------------- helper ----------------------
|
||||||
|
|
||||||
public ReturnT<String> registry(RegistryParam registryParam) {
|
public ReturnT<String> registry(RegistryParam registryParam) {
|
||||||
|
|
||||||
// valid
|
// valid
|
||||||
if (!StringUtils.hasText(registryParam.getRegistryGroup())
|
if (!StringUtils.hasText(registryParam.getRegistryGroup())
|
||||||
|| !StringUtils.hasText(registryParam.getRegistryKey())
|
|| !StringUtils.hasText(registryParam.getRegistryKey())
|
||||||
|| !StringUtils.hasText(registryParam.getRegistryValue())) {
|
|| !StringUtils.hasText(registryParam.getRegistryValue())) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, "Illegal Argument.");
|
return new ReturnT<String>(ReturnT.FAIL_CODE, "Illegal Argument.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// async execute
|
// async execute
|
||||||
registryOrRemoveThreadPool.execute(new Runnable() {
|
registryOrRemoveThreadPool.execute(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
int ret = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().registryUpdate(registryParam.getRegistryGroup(), registryParam.getRegistryKey(), registryParam.getRegistryValue(), new Date());
|
int ret = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().registryUpdate(registryParam.getRegistryGroup(), registryParam.getRegistryKey(), registryParam.getRegistryValue(), new Date());
|
||||||
if (ret < 1) {
|
if (ret < 1) {
|
||||||
XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().registrySave(registryParam.getRegistryGroup(), registryParam.getRegistryKey(), registryParam.getRegistryValue(), new Date());
|
XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().registrySave(registryParam.getRegistryGroup(), registryParam.getRegistryKey(), registryParam.getRegistryValue(), new Date());
|
||||||
|
|
||||||
// fresh
|
// fresh
|
||||||
freshGroupRegistryInfo(registryParam);
|
freshGroupRegistryInfo(registryParam);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return ReturnT.SUCCESS;
|
return ReturnT.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReturnT<String> registryRemove(RegistryParam registryParam) {
|
public ReturnT<String> registryRemove(RegistryParam registryParam) {
|
||||||
|
|
||||||
// valid
|
// valid
|
||||||
if (!StringUtils.hasText(registryParam.getRegistryGroup())
|
if (!StringUtils.hasText(registryParam.getRegistryGroup())
|
||||||
|| !StringUtils.hasText(registryParam.getRegistryKey())
|
|| !StringUtils.hasText(registryParam.getRegistryKey())
|
||||||
|| !StringUtils.hasText(registryParam.getRegistryValue())) {
|
|| !StringUtils.hasText(registryParam.getRegistryValue())) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, "Illegal Argument.");
|
return new ReturnT<String>(ReturnT.FAIL_CODE, "Illegal Argument.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// async execute
|
// async execute
|
||||||
registryOrRemoveThreadPool.execute(new Runnable() {
|
registryOrRemoveThreadPool.execute(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
int ret = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().registryDelete(registryParam.getRegistryGroup(), registryParam.getRegistryKey(), registryParam.getRegistryValue());
|
int ret = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().registryDelete(registryParam.getRegistryGroup(), registryParam.getRegistryKey(), registryParam.getRegistryValue());
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
// fresh
|
// fresh
|
||||||
freshGroupRegistryInfo(registryParam);
|
freshGroupRegistryInfo(registryParam);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return ReturnT.SUCCESS;
|
return ReturnT.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void freshGroupRegistryInfo(RegistryParam registryParam){
|
private void freshGroupRegistryInfo(RegistryParam registryParam) {
|
||||||
// Under consideration, prevent affecting core tables
|
// Under consideration, prevent affecting core tables
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,32 +24,32 @@ public class JobTriggerPoolHelper {
|
|||||||
private ThreadPoolExecutor fastTriggerPool = null;
|
private ThreadPoolExecutor fastTriggerPool = null;
|
||||||
private ThreadPoolExecutor slowTriggerPool = null;
|
private ThreadPoolExecutor slowTriggerPool = null;
|
||||||
|
|
||||||
public void start(){
|
public void start() {
|
||||||
fastTriggerPool = new ThreadPoolExecutor(
|
fastTriggerPool = new ThreadPoolExecutor(
|
||||||
10,
|
10,
|
||||||
XxlJobAdminConfig.getAdminConfig().getTriggerPoolFastMax(),
|
XxlJobAdminConfig.getAdminConfig().getTriggerPoolFastMax(),
|
||||||
60L,
|
60L,
|
||||||
TimeUnit.SECONDS,
|
TimeUnit.SECONDS,
|
||||||
new LinkedBlockingQueue<Runnable>(1000),
|
new LinkedBlockingQueue<Runnable>(1000),
|
||||||
new ThreadFactory() {
|
new ThreadFactory() {
|
||||||
@Override
|
@Override
|
||||||
public Thread newThread(Runnable r) {
|
public Thread newThread(Runnable r) {
|
||||||
return new Thread(r, "xxl-job, admin JobTriggerPoolHelper-fastTriggerPool-" + r.hashCode());
|
return new Thread(r, "xxl-job, admin JobTriggerPoolHelper-fastTriggerPool-" + r.hashCode());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
slowTriggerPool = new ThreadPoolExecutor(
|
slowTriggerPool = new ThreadPoolExecutor(
|
||||||
10,
|
10,
|
||||||
XxlJobAdminConfig.getAdminConfig().getTriggerPoolSlowMax(),
|
XxlJobAdminConfig.getAdminConfig().getTriggerPoolSlowMax(),
|
||||||
60L,
|
60L,
|
||||||
TimeUnit.SECONDS,
|
TimeUnit.SECONDS,
|
||||||
new LinkedBlockingQueue<Runnable>(2000),
|
new LinkedBlockingQueue<Runnable>(2000),
|
||||||
new ThreadFactory() {
|
new ThreadFactory() {
|
||||||
@Override
|
@Override
|
||||||
public Thread newThread(Runnable r) {
|
public Thread newThread(Runnable r) {
|
||||||
return new Thread(r, "xxl-job, admin JobTriggerPoolHelper-slowTriggerPool-" + r.hashCode());
|
return new Thread(r, "xxl-job, admin JobTriggerPoolHelper-slowTriggerPool-" + r.hashCode());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ public class JobTriggerPoolHelper {
|
|||||||
|
|
||||||
|
|
||||||
// job timeout count
|
// job timeout count
|
||||||
private volatile long minTim = System.currentTimeMillis()/60000; // ms > min
|
private volatile long minTim = System.currentTimeMillis() / 60000; // ms > min
|
||||||
private volatile ConcurrentMap<Integer, AtomicInteger> jobTimeoutCountMap = new ConcurrentHashMap<>();
|
private volatile ConcurrentMap<Integer, AtomicInteger> jobTimeoutCountMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ public class JobTriggerPoolHelper {
|
|||||||
// choose thread pool
|
// choose thread pool
|
||||||
ThreadPoolExecutor triggerPool_ = fastTriggerPool;
|
ThreadPoolExecutor triggerPool_ = fastTriggerPool;
|
||||||
AtomicInteger jobTimeoutCount = jobTimeoutCountMap.get(jobId);
|
AtomicInteger jobTimeoutCount = jobTimeoutCountMap.get(jobId);
|
||||||
if (jobTimeoutCount!=null && jobTimeoutCount.get() > 10) { // job-timeout 10 times in 1 min
|
if (jobTimeoutCount != null && jobTimeoutCount.get() > 10) { // job-timeout 10 times in 1 min
|
||||||
triggerPool_ = slowTriggerPool;
|
triggerPool_ = slowTriggerPool;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,14 +98,14 @@ public class JobTriggerPoolHelper {
|
|||||||
} finally {
|
} finally {
|
||||||
|
|
||||||
// check timeout-count-map
|
// check timeout-count-map
|
||||||
long minTim_now = System.currentTimeMillis()/60000;
|
long minTim_now = System.currentTimeMillis() / 60000;
|
||||||
if (minTim != minTim_now) {
|
if (minTim != minTim_now) {
|
||||||
minTim = minTim_now;
|
minTim = minTim_now;
|
||||||
jobTimeoutCountMap.clear();
|
jobTimeoutCountMap.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// incr timeout-count-map
|
// incr timeout-count-map
|
||||||
long cost = System.currentTimeMillis()-start;
|
long cost = System.currentTimeMillis() - start;
|
||||||
if (cost > 500) { // ob-timeout threshold 500ms
|
if (cost > 500) { // ob-timeout threshold 500ms
|
||||||
AtomicInteger timeoutCount = jobTimeoutCountMap.putIfAbsent(jobId, new AtomicInteger(1));
|
AtomicInteger timeoutCount = jobTimeoutCountMap.putIfAbsent(jobId, new AtomicInteger(1));
|
||||||
if (timeoutCount != null) {
|
if (timeoutCount != null) {
|
||||||
@ -120,7 +120,6 @@ public class JobTriggerPoolHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ---------------------- helper ----------------------
|
// ---------------------- helper ----------------------
|
||||||
|
|
||||||
private static JobTriggerPoolHelper helper = new JobTriggerPoolHelper();
|
private static JobTriggerPoolHelper helper = new JobTriggerPoolHelper();
|
||||||
@ -128,6 +127,7 @@ public class JobTriggerPoolHelper {
|
|||||||
public static void toStart() {
|
public static void toStart() {
|
||||||
helper.start();
|
helper.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toStop() {
|
public static void toStop() {
|
||||||
helper.stop();
|
helper.stop();
|
||||||
}
|
}
|
||||||
@ -135,13 +135,11 @@ public class JobTriggerPoolHelper {
|
|||||||
/**
|
/**
|
||||||
* @param jobId
|
* @param jobId
|
||||||
* @param triggerType
|
* @param triggerType
|
||||||
* @param failRetryCount
|
* @param failRetryCount >=0: use this param
|
||||||
* >=0: use this param
|
* <0: use param from job info config
|
||||||
* <0: use param from job info config
|
|
||||||
* @param executorShardingParam
|
* @param executorShardingParam
|
||||||
* @param executorParam
|
* @param executorParam null: use job param
|
||||||
* null: use job param
|
* not null: cover job param
|
||||||
* not null: cover job param
|
|
||||||
*/
|
*/
|
||||||
public static void trigger(int jobId, TriggerTypeEnum triggerType, int failRetryCount, String executorShardingParam, String executorParam, String addressList) {
|
public static void trigger(int jobId, TriggerTypeEnum triggerType, int failRetryCount, String executorShardingParam, String executorParam, String addressList) {
|
||||||
helper.addTrigger(jobId, triggerType, failRetryCount, executorShardingParam, executorParam, addressList);
|
helper.addTrigger(jobId, triggerType, failRetryCount, executorShardingParam, executorParam, addressList);
|
||||||
|
@ -11,88 +11,88 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
*/
|
*/
|
||||||
public class CookieUtil {
|
public class CookieUtil {
|
||||||
|
|
||||||
// 默认缓存时间,单位/秒, 2H
|
// 默认缓存时间,单位/秒, 2H
|
||||||
private static final int COOKIE_MAX_AGE = Integer.MAX_VALUE;
|
private static final int COOKIE_MAX_AGE = Integer.MAX_VALUE;
|
||||||
// 保存路径,根路径
|
// 保存路径,根路径
|
||||||
private static final String COOKIE_PATH = "/";
|
private static final String COOKIE_PATH = "/";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存
|
* 保存
|
||||||
*
|
*
|
||||||
* @param response
|
* @param response
|
||||||
* @param key
|
* @param key
|
||||||
* @param value
|
* @param value
|
||||||
* @param ifRemember
|
* @param ifRemember
|
||||||
*/
|
*/
|
||||||
public static void set(HttpServletResponse response, String key, String value, boolean ifRemember) {
|
public static void set(HttpServletResponse response, String key, String value, boolean ifRemember) {
|
||||||
int age = ifRemember?COOKIE_MAX_AGE:-1;
|
int age = ifRemember ? COOKIE_MAX_AGE : -1;
|
||||||
set(response, key, value, null, COOKIE_PATH, age, true);
|
set(response, key, value, null, COOKIE_PATH, age, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存
|
* 保存
|
||||||
*
|
*
|
||||||
* @param response
|
* @param response
|
||||||
* @param key
|
* @param key
|
||||||
* @param value
|
* @param value
|
||||||
* @param maxAge
|
* @param maxAge
|
||||||
*/
|
*/
|
||||||
private static void set(HttpServletResponse response, String key, String value, String domain, String path, int maxAge, boolean isHttpOnly) {
|
private static void set(HttpServletResponse response, String key, String value, String domain, String path, int maxAge, boolean isHttpOnly) {
|
||||||
Cookie cookie = new Cookie(key, value);
|
Cookie cookie = new Cookie(key, value);
|
||||||
if (domain != null) {
|
if (domain != null) {
|
||||||
cookie.setDomain(domain);
|
cookie.setDomain(domain);
|
||||||
}
|
}
|
||||||
cookie.setPath(path);
|
cookie.setPath(path);
|
||||||
cookie.setMaxAge(maxAge);
|
cookie.setMaxAge(maxAge);
|
||||||
cookie.setHttpOnly(isHttpOnly);
|
cookie.setHttpOnly(isHttpOnly);
|
||||||
response.addCookie(cookie);
|
response.addCookie(cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询value
|
* 查询value
|
||||||
*
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param key
|
* @param key
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String getValue(HttpServletRequest request, String key) {
|
public static String getValue(HttpServletRequest request, String key) {
|
||||||
Cookie cookie = get(request, key);
|
Cookie cookie = get(request, key);
|
||||||
if (cookie != null) {
|
if (cookie != null) {
|
||||||
return cookie.getValue();
|
return cookie.getValue();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询Cookie
|
* 查询Cookie
|
||||||
*
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param key
|
* @param key
|
||||||
*/
|
*/
|
||||||
private static Cookie get(HttpServletRequest request, String key) {
|
private static Cookie get(HttpServletRequest request, String key) {
|
||||||
Cookie[] arr_cookie = request.getCookies();
|
Cookie[] arr_cookie = request.getCookies();
|
||||||
if (arr_cookie != null && arr_cookie.length > 0) {
|
if (arr_cookie != null && arr_cookie.length > 0) {
|
||||||
for (Cookie cookie : arr_cookie) {
|
for (Cookie cookie : arr_cookie) {
|
||||||
if (cookie.getName().equals(key)) {
|
if (cookie.getName().equals(key)) {
|
||||||
return cookie;
|
return cookie;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除Cookie
|
* 删除Cookie
|
||||||
*
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param response
|
* @param response
|
||||||
* @param key
|
* @param key
|
||||||
*/
|
*/
|
||||||
public static void remove(HttpServletRequest request, HttpServletResponse response, String key) {
|
public static void remove(HttpServletRequest request, HttpServletResponse response, String key) {
|
||||||
Cookie cookie = get(request, key);
|
Cookie cookie = get(request, key);
|
||||||
if (cookie != null) {
|
if (cookie != null) {
|
||||||
set(response, key, "", null, COOKIE_PATH, 0, true);
|
set(response, key, "" , null, COOKIE_PATH, 0, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -12,16 +12,17 @@ import java.io.IOException;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Jackson util
|
* Jackson util
|
||||||
*
|
* <p>
|
||||||
* 1、obj need private and set/get;
|
* 1、obj need private and set/get;
|
||||||
* 2、do not support inner class;
|
* 2、do not support inner class;
|
||||||
*
|
*
|
||||||
* @author xuxueli 2015-9-25 18:02:56
|
* @author xuxueli 2015-9-25 18:02:56
|
||||||
*/
|
*/
|
||||||
public class JacksonUtil {
|
public class JacksonUtil {
|
||||||
private static Logger logger = LoggerFactory.getLogger(JacksonUtil.class);
|
private static Logger logger = LoggerFactory.getLogger(JacksonUtil.class);
|
||||||
|
|
||||||
private final static ObjectMapper objectMapper = new ObjectMapper();
|
private final static ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
public static ObjectMapper getInstance() {
|
public static ObjectMapper getInstance() {
|
||||||
return objectMapper;
|
return objectMapper;
|
||||||
}
|
}
|
||||||
@ -34,15 +35,15 @@ public class JacksonUtil {
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static String writeValueAsString(Object obj) {
|
public static String writeValueAsString(Object obj) {
|
||||||
try {
|
try {
|
||||||
return getInstance().writeValueAsString(obj);
|
return getInstance().writeValueAsString(obj);
|
||||||
} catch (JsonGenerationException e) {
|
} catch (JsonGenerationException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
} catch (JsonMappingException e) {
|
} catch (JsonMappingException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,38 +56,38 @@ public class JacksonUtil {
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static <T> T readValue(String jsonStr, Class<T> clazz) {
|
public static <T> T readValue(String jsonStr, Class<T> clazz) {
|
||||||
try {
|
try {
|
||||||
return getInstance().readValue(jsonStr, clazz);
|
return getInstance().readValue(jsonStr, clazz);
|
||||||
} catch (JsonParseException e) {
|
} catch (JsonParseException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
} catch (JsonMappingException e) {
|
} catch (JsonMappingException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* string --> List<Bean>...
|
* string --> List<Bean>...
|
||||||
*
|
*
|
||||||
* @param jsonStr
|
* @param jsonStr
|
||||||
* @param parametrized
|
* @param parametrized
|
||||||
* @param parameterClasses
|
* @param parameterClasses
|
||||||
* @param <T>
|
* @param <T>
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static <T> T readValue(String jsonStr, Class<?> parametrized, Class<?>... parameterClasses) {
|
public static <T> T readValue(String jsonStr, Class<?> parametrized, Class<?>... parameterClasses) {
|
||||||
try {
|
try {
|
||||||
JavaType javaType = getInstance().getTypeFactory().constructParametricType(parametrized, parameterClasses);
|
JavaType javaType = getInstance().getTypeFactory().constructParametricType(parametrized, parameterClasses);
|
||||||
return getInstance().readValue(jsonStr, javaType);
|
return getInstance().readValue(jsonStr, javaType);
|
||||||
} catch (JsonParseException e) {
|
} catch (JsonParseException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
} catch (JsonMappingException e) {
|
} catch (JsonMappingException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,41 +9,43 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* job info
|
* job info
|
||||||
|
*
|
||||||
* @author xuxueli 2016-1-12 18:03:45
|
* @author xuxueli 2016-1-12 18:03:45
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface XxlJobInfoDao {
|
public interface XxlJobInfoDao {
|
||||||
|
|
||||||
public List<XxlJobInfo> pageList(@Param("offset") int offset,
|
public List<XxlJobInfo> pageList(@Param("offset") int offset,
|
||||||
@Param("pagesize") int pagesize,
|
@Param("pagesize") int pagesize,
|
||||||
@Param("jobGroup") int jobGroup,
|
@Param("jobGroup") int jobGroup,
|
||||||
@Param("triggerStatus") int triggerStatus,
|
@Param("triggerStatus") int triggerStatus,
|
||||||
@Param("jobDesc") String jobDesc,
|
@Param("jobDesc") String jobDesc,
|
||||||
@Param("executorHandler") String executorHandler,
|
@Param("executorHandler") String executorHandler,
|
||||||
@Param("author") String author);
|
@Param("author") String author);
|
||||||
public int pageListCount(@Param("offset") int offset,
|
|
||||||
@Param("pagesize") int pagesize,
|
|
||||||
@Param("jobGroup") int jobGroup,
|
|
||||||
@Param("triggerStatus") int triggerStatus,
|
|
||||||
@Param("jobDesc") String jobDesc,
|
|
||||||
@Param("executorHandler") String executorHandler,
|
|
||||||
@Param("author") String author);
|
|
||||||
|
|
||||||
public int save(XxlJobInfo info);
|
public int pageListCount(@Param("offset") int offset,
|
||||||
|
@Param("pagesize") int pagesize,
|
||||||
|
@Param("jobGroup") int jobGroup,
|
||||||
|
@Param("triggerStatus") int triggerStatus,
|
||||||
|
@Param("jobDesc") String jobDesc,
|
||||||
|
@Param("executorHandler") String executorHandler,
|
||||||
|
@Param("author") String author);
|
||||||
|
|
||||||
public XxlJobInfo loadById(@Param("id") int id);
|
public int save(XxlJobInfo info);
|
||||||
|
|
||||||
public int update(XxlJobInfo xxlJobInfo);
|
public XxlJobInfo loadById(@Param("id") int id);
|
||||||
|
|
||||||
public int delete(@Param("id") long id);
|
public int update(XxlJobInfo xxlJobInfo);
|
||||||
|
|
||||||
public List<XxlJobInfo> getJobsByGroup(@Param("jobGroup") int jobGroup);
|
public int delete(@Param("id") long id);
|
||||||
|
|
||||||
public int findAllCount();
|
public List<XxlJobInfo> getJobsByGroup(@Param("jobGroup") int jobGroup);
|
||||||
|
|
||||||
public List<XxlJobInfo> scheduleJobQuery(@Param("maxNextTime") long maxNextTime, @Param("pagesize") int pagesize );
|
public int findAllCount();
|
||||||
|
|
||||||
public int scheduleUpdate(XxlJobInfo xxlJobInfo);
|
public List<XxlJobInfo> scheduleJobQuery(@Param("maxNextTime") long maxNextTime, @Param("pagesize") int pagesize);
|
||||||
|
|
||||||
|
public int scheduleUpdate(XxlJobInfo xxlJobInfo);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,53 +10,56 @@ import java.util.Map;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* job log
|
* job log
|
||||||
|
*
|
||||||
* @author xuxueli 2016-1-12 18:03:06
|
* @author xuxueli 2016-1-12 18:03:06
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface XxlJobLogDao {
|
public interface XxlJobLogDao {
|
||||||
|
|
||||||
// exist jobId not use jobGroup, not exist use jobGroup
|
// exist jobId not use jobGroup, not exist use jobGroup
|
||||||
public List<XxlJobLog> pageList(@Param("offset") int offset,
|
public List<XxlJobLog> pageList(@Param("offset") int offset,
|
||||||
@Param("pagesize") int pagesize,
|
@Param("pagesize") int pagesize,
|
||||||
@Param("jobGroup") int jobGroup,
|
@Param("jobGroup") int jobGroup,
|
||||||
@Param("jobId") int jobId,
|
@Param("jobId") int jobId,
|
||||||
@Param("triggerTimeStart") Date triggerTimeStart,
|
@Param("triggerTimeStart") Date triggerTimeStart,
|
||||||
@Param("triggerTimeEnd") Date triggerTimeEnd,
|
@Param("triggerTimeEnd") Date triggerTimeEnd,
|
||||||
@Param("logStatus") int logStatus);
|
@Param("logStatus") int logStatus);
|
||||||
public int pageListCount(@Param("offset") int offset,
|
|
||||||
@Param("pagesize") int pagesize,
|
|
||||||
@Param("jobGroup") int jobGroup,
|
|
||||||
@Param("jobId") int jobId,
|
|
||||||
@Param("triggerTimeStart") Date triggerTimeStart,
|
|
||||||
@Param("triggerTimeEnd") Date triggerTimeEnd,
|
|
||||||
@Param("logStatus") int logStatus);
|
|
||||||
|
|
||||||
public XxlJobLog load(@Param("id") long id);
|
public int pageListCount(@Param("offset") int offset,
|
||||||
|
@Param("pagesize") int pagesize,
|
||||||
|
@Param("jobGroup") int jobGroup,
|
||||||
|
@Param("jobId") int jobId,
|
||||||
|
@Param("triggerTimeStart") Date triggerTimeStart,
|
||||||
|
@Param("triggerTimeEnd") Date triggerTimeEnd,
|
||||||
|
@Param("logStatus") int logStatus);
|
||||||
|
|
||||||
public long save(XxlJobLog xxlJobLog);
|
public XxlJobLog load(@Param("id") long id);
|
||||||
|
|
||||||
public int updateTriggerInfo(XxlJobLog xxlJobLog);
|
public long save(XxlJobLog xxlJobLog);
|
||||||
|
|
||||||
public int updateHandleInfo(XxlJobLog xxlJobLog);
|
public int updateTriggerInfo(XxlJobLog xxlJobLog);
|
||||||
|
|
||||||
public int delete(@Param("jobId") int jobId);
|
public int updateHandleInfo(XxlJobLog xxlJobLog);
|
||||||
|
|
||||||
public Map<String, Object> findLogReport(@Param("from") Date from,
|
public int delete(@Param("jobId") int jobId);
|
||||||
@Param("to") Date to);
|
|
||||||
|
|
||||||
public List<Long> findClearLogIds(@Param("jobGroup") int jobGroup,
|
public Map<String, Object> findLogReport(@Param("from") Date from,
|
||||||
@Param("jobId") int jobId,
|
@Param("to") Date to);
|
||||||
@Param("clearBeforeTime") Date clearBeforeTime,
|
|
||||||
@Param("clearBeforeNum") int clearBeforeNum,
|
|
||||||
@Param("pagesize") int pagesize);
|
|
||||||
public int clearLog(@Param("logIds") List<Long> logIds);
|
|
||||||
|
|
||||||
public List<Long> findFailJobLogIds(@Param("pagesize") int pagesize);
|
public List<Long> findClearLogIds(@Param("jobGroup") int jobGroup,
|
||||||
|
@Param("jobId") int jobId,
|
||||||
|
@Param("clearBeforeTime") Date clearBeforeTime,
|
||||||
|
@Param("clearBeforeNum") int clearBeforeNum,
|
||||||
|
@Param("pagesize") int pagesize);
|
||||||
|
|
||||||
public int updateAlarmStatus(@Param("logId") long logId,
|
public int clearLog(@Param("logIds") List<Long> logIds);
|
||||||
@Param("oldAlarmStatus") int oldAlarmStatus,
|
|
||||||
@Param("newAlarmStatus") int newAlarmStatus);
|
|
||||||
|
|
||||||
public List<Long> findLostJobIds(@Param("losedTime") Date losedTime);
|
public List<Long> findFailJobLogIds(@Param("pagesize") int pagesize);
|
||||||
|
|
||||||
|
public int updateAlarmStatus(@Param("logId") long logId,
|
||||||
|
@Param("oldAlarmStatus") int oldAlarmStatus,
|
||||||
|
@Param("newAlarmStatus") int newAlarmStatus);
|
||||||
|
|
||||||
|
public List<Long> findLostJobIds(@Param("losedTime") Date losedTime);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,17 +8,18 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* job log for glue
|
* job log for glue
|
||||||
|
*
|
||||||
* @author xuxueli 2016-5-19 18:04:56
|
* @author xuxueli 2016-5-19 18:04:56
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface XxlJobLogGlueDao {
|
public interface XxlJobLogGlueDao {
|
||||||
|
|
||||||
public int save(XxlJobLogGlue xxlJobLogGlue);
|
public int save(XxlJobLogGlue xxlJobLogGlue);
|
||||||
|
|
||||||
public List<XxlJobLogGlue> findByJobId(@Param("jobId") int jobId);
|
public List<XxlJobLogGlue> findByJobId(@Param("jobId") int jobId);
|
||||||
|
|
||||||
public int removeOld(@Param("jobId") int jobId, @Param("limit") int limit);
|
public int removeOld(@Param("jobId") int jobId, @Param("limit") int limit);
|
||||||
|
|
||||||
public int deleteByJobId(@Param("jobId") int jobId);
|
public int deleteByJobId(@Param("jobId") int jobId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,18 +9,19 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* job log
|
* job log
|
||||||
|
*
|
||||||
* @author xuxueli 2019-11-22
|
* @author xuxueli 2019-11-22
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface XxlJobLogReportDao {
|
public interface XxlJobLogReportDao {
|
||||||
|
|
||||||
public int save(XxlJobLogReport xxlJobLogReport);
|
public int save(XxlJobLogReport xxlJobLogReport);
|
||||||
|
|
||||||
public int update(XxlJobLogReport xxlJobLogReport);
|
public int update(XxlJobLogReport xxlJobLogReport);
|
||||||
|
|
||||||
public List<XxlJobLogReport> queryLogReport(@Param("triggerDayFrom") Date triggerDayFrom,
|
public List<XxlJobLogReport> queryLogReport(@Param("triggerDayFrom") Date triggerDayFrom,
|
||||||
@Param("triggerDayTo") Date triggerDayTo);
|
@Param("triggerDayTo") Date triggerDayTo);
|
||||||
|
|
||||||
public XxlJobLogReport queryLogReportTotal();
|
public XxlJobLogReport queryLogReportTotal();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.xxl.job.admin.dao;
|
|||||||
import com.xxl.job.admin.core.model.XxlJobUser;
|
import com.xxl.job.admin.core.model.XxlJobUser;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -11,21 +12,22 @@ import java.util.List;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface XxlJobUserDao {
|
public interface XxlJobUserDao {
|
||||||
|
|
||||||
public List<XxlJobUser> pageList(@Param("offset") int offset,
|
public List<XxlJobUser> pageList(@Param("offset") int offset,
|
||||||
@Param("pagesize") int pagesize,
|
@Param("pagesize") int pagesize,
|
||||||
@Param("username") String username,
|
@Param("username") String username,
|
||||||
@Param("role") int role);
|
@Param("role") int role);
|
||||||
public int pageListCount(@Param("offset") int offset,
|
|
||||||
@Param("pagesize") int pagesize,
|
|
||||||
@Param("username") String username,
|
|
||||||
@Param("role") int role);
|
|
||||||
|
|
||||||
public XxlJobUser loadByUserName(@Param("username") String username);
|
public int pageListCount(@Param("offset") int offset,
|
||||||
|
@Param("pagesize") int pagesize,
|
||||||
|
@Param("username") String username,
|
||||||
|
@Param("role") int role);
|
||||||
|
|
||||||
public int save(XxlJobUser xxlJobUser);
|
public XxlJobUser loadByUserName(@Param("username") String username);
|
||||||
|
|
||||||
public int update(XxlJobUser xxlJobUser);
|
public int save(XxlJobUser xxlJobUser);
|
||||||
|
|
||||||
public int delete(@Param("id") int id);
|
public int update(XxlJobUser xxlJobUser);
|
||||||
|
|
||||||
|
public int delete(@Param("id") int id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,73 +14,74 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public interface XxlJobService {
|
public interface XxlJobService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* page list
|
* page list
|
||||||
*
|
*
|
||||||
* @param start
|
* @param start
|
||||||
* @param length
|
* @param length
|
||||||
* @param jobGroup
|
* @param jobGroup
|
||||||
* @param jobDesc
|
* @param jobDesc
|
||||||
* @param executorHandler
|
* @param executorHandler
|
||||||
* @param author
|
* @param author
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> pageList(int start, int length, int jobGroup, int triggerStatus, String jobDesc, String executorHandler, String author);
|
public Map<String, Object> pageList(int start, int length, int jobGroup, int triggerStatus, String jobDesc, String executorHandler, String author);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* add job
|
* add job
|
||||||
*
|
*
|
||||||
* @param jobInfo
|
* @param jobInfo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ReturnT<String> add(XxlJobInfo jobInfo);
|
public ReturnT<String> add(XxlJobInfo jobInfo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* update job
|
* update job
|
||||||
*
|
*
|
||||||
* @param jobInfo
|
* @param jobInfo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ReturnT<String> update(XxlJobInfo jobInfo);
|
public ReturnT<String> update(XxlJobInfo jobInfo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* remove job
|
* remove job
|
||||||
* *
|
* *
|
||||||
* @param id
|
*
|
||||||
* @return
|
* @param id
|
||||||
*/
|
* @return
|
||||||
public ReturnT<String> remove(int id);
|
*/
|
||||||
|
public ReturnT<String> remove(int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* start job
|
* start job
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ReturnT<String> start(int id);
|
public ReturnT<String> start(int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stop job
|
* stop job
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ReturnT<String> stop(int id);
|
public ReturnT<String> stop(int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dashboard info
|
* dashboard info
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Map<String,Object> dashboardInfo();
|
public Map<String, Object> dashboardInfo();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* chart info
|
* chart info
|
||||||
*
|
*
|
||||||
* @param startDate
|
* @param startDate
|
||||||
* @param endDate
|
* @param endDate
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ReturnT<Map<String,Object>> chartInfo(Date startDate, Date endDate);
|
public ReturnT<Map<String, Object>> chartInfo(Date startDate, Date endDate);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,410 +25,411 @@ import java.util.*;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* core job action for xxl-job
|
* core job action for xxl-job
|
||||||
|
*
|
||||||
* @author xuxueli 2016-5-28 15:30:33
|
* @author xuxueli 2016-5-28 15:30:33
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class XxlJobServiceImpl implements XxlJobService {
|
public class XxlJobServiceImpl implements XxlJobService {
|
||||||
private static Logger logger = LoggerFactory.getLogger(XxlJobServiceImpl.class);
|
private static Logger logger = LoggerFactory.getLogger(XxlJobServiceImpl.class);
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private XxlJobGroupDao xxlJobGroupDao;
|
private XxlJobGroupDao xxlJobGroupDao;
|
||||||
@Resource
|
@Resource
|
||||||
private XxlJobInfoDao xxlJobInfoDao;
|
private XxlJobInfoDao xxlJobInfoDao;
|
||||||
@Resource
|
@Resource
|
||||||
public XxlJobLogDao xxlJobLogDao;
|
public XxlJobLogDao xxlJobLogDao;
|
||||||
@Resource
|
@Resource
|
||||||
private XxlJobLogGlueDao xxlJobLogGlueDao;
|
private XxlJobLogGlueDao xxlJobLogGlueDao;
|
||||||
@Resource
|
@Resource
|
||||||
private XxlJobLogReportDao xxlJobLogReportDao;
|
private XxlJobLogReportDao xxlJobLogReportDao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> pageList(int start, int length, int jobGroup, int triggerStatus, String jobDesc, String executorHandler, String author) {
|
public Map<String, Object> pageList(int start, int length, int jobGroup, int triggerStatus, String jobDesc, String executorHandler, String author) {
|
||||||
|
|
||||||
// page list
|
// page list
|
||||||
List<XxlJobInfo> list = xxlJobInfoDao.pageList(start, length, jobGroup, triggerStatus, jobDesc, executorHandler, author);
|
List<XxlJobInfo> list = xxlJobInfoDao.pageList(start, length, jobGroup, triggerStatus, jobDesc, executorHandler, author);
|
||||||
int list_count = xxlJobInfoDao.pageListCount(start, length, jobGroup, triggerStatus, jobDesc, executorHandler, author);
|
int list_count = xxlJobInfoDao.pageListCount(start, length, jobGroup, triggerStatus, jobDesc, executorHandler, author);
|
||||||
|
|
||||||
// package result
|
// package result
|
||||||
Map<String, Object> maps = new HashMap<String, Object>();
|
Map<String, Object> maps = new HashMap<String, Object>();
|
||||||
maps.put("recordsTotal", list_count); // 总记录数
|
maps.put("recordsTotal" , list_count); // 总记录数
|
||||||
maps.put("recordsFiltered", list_count); // 过滤后的总记录数
|
maps.put("recordsFiltered" , list_count); // 过滤后的总记录数
|
||||||
maps.put("data", list); // 分页列表
|
maps.put("data" , list); // 分页列表
|
||||||
return maps;
|
return maps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ReturnT<String> add(XxlJobInfo jobInfo) {
|
public ReturnT<String> add(XxlJobInfo jobInfo) {
|
||||||
|
|
||||||
// valid base
|
// valid base
|
||||||
XxlJobGroup group = xxlJobGroupDao.load(jobInfo.getJobGroup());
|
XxlJobGroup group = xxlJobGroupDao.load(jobInfo.getJobGroup());
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_choose")+I18nUtil.getString("jobinfo_field_jobgroup")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_choose") + I18nUtil.getString("jobinfo_field_jobgroup")));
|
||||||
}
|
}
|
||||||
if (jobInfo.getJobDesc()==null || jobInfo.getJobDesc().trim().length()==0) {
|
if (jobInfo.getJobDesc() == null || jobInfo.getJobDesc().trim().length() == 0) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input")+I18nUtil.getString("jobinfo_field_jobdesc")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_jobdesc")));
|
||||||
}
|
}
|
||||||
if (jobInfo.getAuthor()==null || jobInfo.getAuthor().trim().length()==0) {
|
if (jobInfo.getAuthor() == null || jobInfo.getAuthor().trim().length() == 0) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input")+I18nUtil.getString("jobinfo_field_author")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_author")));
|
||||||
}
|
}
|
||||||
|
|
||||||
// valid trigger
|
// valid trigger
|
||||||
ScheduleTypeEnum scheduleTypeEnum = ScheduleTypeEnum.match(jobInfo.getScheduleType(), null);
|
ScheduleTypeEnum scheduleTypeEnum = ScheduleTypeEnum.match(jobInfo.getScheduleType(), null);
|
||||||
if (scheduleTypeEnum == null) {
|
if (scheduleTypeEnum == null) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
|
||||||
}
|
}
|
||||||
if (scheduleTypeEnum == ScheduleTypeEnum.CRON) {
|
if (scheduleTypeEnum == ScheduleTypeEnum.CRON) {
|
||||||
if (jobInfo.getScheduleConf()==null || !CronExpression.isValidExpression(jobInfo.getScheduleConf())) {
|
if (jobInfo.getScheduleConf() == null || !CronExpression.isValidExpression(jobInfo.getScheduleConf())) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, "Cron"+I18nUtil.getString("system_unvalid"));
|
return new ReturnT<String>(ReturnT.FAIL_CODE, "Cron" + I18nUtil.getString("system_unvalid"));
|
||||||
}
|
}
|
||||||
} else if (scheduleTypeEnum == ScheduleTypeEnum.FIX_RATE/* || scheduleTypeEnum == ScheduleTypeEnum.FIX_DELAY*/) {
|
} else if (scheduleTypeEnum == ScheduleTypeEnum.FIX_RATE/* || scheduleTypeEnum == ScheduleTypeEnum.FIX_DELAY*/) {
|
||||||
if (jobInfo.getScheduleConf() == null) {
|
if (jobInfo.getScheduleConf() == null) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")));
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
int fixSecond = Integer.valueOf(jobInfo.getScheduleConf());
|
int fixSecond = Integer.valueOf(jobInfo.getScheduleConf());
|
||||||
if (fixSecond < 1) {
|
if (fixSecond < 1) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// valid job
|
// valid job
|
||||||
if (GlueTypeEnum.match(jobInfo.getGlueType()) == null) {
|
if (GlueTypeEnum.match(jobInfo.getGlueType()) == null) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_gluetype")+I18nUtil.getString("system_unvalid")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_gluetype") + I18nUtil.getString("system_unvalid")));
|
||||||
}
|
}
|
||||||
if (GlueTypeEnum.BEAN==GlueTypeEnum.match(jobInfo.getGlueType()) && (jobInfo.getExecutorHandler()==null || jobInfo.getExecutorHandler().trim().length()==0) ) {
|
if (GlueTypeEnum.BEAN == GlueTypeEnum.match(jobInfo.getGlueType()) && (jobInfo.getExecutorHandler() == null || jobInfo.getExecutorHandler().trim().length() == 0)) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input")+"JobHandler") );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + "JobHandler"));
|
||||||
}
|
}
|
||||||
// 》fix "\r" in shell
|
// 》fix "\r" in shell
|
||||||
if (GlueTypeEnum.GLUE_SHELL==GlueTypeEnum.match(jobInfo.getGlueType()) && jobInfo.getGlueSource()!=null) {
|
if (GlueTypeEnum.GLUE_SHELL == GlueTypeEnum.match(jobInfo.getGlueType()) && jobInfo.getGlueSource() != null) {
|
||||||
jobInfo.setGlueSource(jobInfo.getGlueSource().replaceAll("\r", ""));
|
jobInfo.setGlueSource(jobInfo.getGlueSource().replaceAll("\r" , ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
// valid advanced
|
// valid advanced
|
||||||
if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
|
if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorRouteStrategy")+I18nUtil.getString("system_unvalid")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorRouteStrategy") + I18nUtil.getString("system_unvalid")));
|
||||||
}
|
}
|
||||||
if (MisfireStrategyEnum.match(jobInfo.getMisfireStrategy(), null) == null) {
|
if (MisfireStrategyEnum.match(jobInfo.getMisfireStrategy(), null) == null) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("misfire_strategy")+I18nUtil.getString("system_unvalid")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("misfire_strategy") + I18nUtil.getString("system_unvalid")));
|
||||||
}
|
}
|
||||||
if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) {
|
if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy")+I18nUtil.getString("system_unvalid")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy") + I18nUtil.getString("system_unvalid")));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 》ChildJobId valid
|
// 》ChildJobId valid
|
||||||
if (jobInfo.getChildJobId()!=null && jobInfo.getChildJobId().trim().length()>0) {
|
if (jobInfo.getChildJobId() != null && jobInfo.getChildJobId().trim().length() > 0) {
|
||||||
String[] childJobIds = jobInfo.getChildJobId().split(",");
|
String[] childJobIds = jobInfo.getChildJobId().split(",");
|
||||||
for (String childJobIdItem: childJobIds) {
|
for (String childJobIdItem : childJobIds) {
|
||||||
if (childJobIdItem!=null && childJobIdItem.trim().length()>0 && isNumeric(childJobIdItem)) {
|
if (childJobIdItem != null && childJobIdItem.trim().length() > 0 && isNumeric(childJobIdItem)) {
|
||||||
XxlJobInfo childJobInfo = xxlJobInfoDao.loadById(Integer.parseInt(childJobIdItem));
|
XxlJobInfo childJobInfo = xxlJobInfoDao.loadById(Integer.parseInt(childJobIdItem));
|
||||||
if (childJobInfo==null) {
|
if (childJobInfo == null) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE,
|
return new ReturnT<String>(ReturnT.FAIL_CODE,
|
||||||
MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId")+"({0})"+I18nUtil.getString("system_not_found")), childJobIdItem));
|
MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId") + "({0})" + I18nUtil.getString("system_not_found")), childJobIdItem));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE,
|
return new ReturnT<String>(ReturnT.FAIL_CODE,
|
||||||
MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId")+"({0})"+I18nUtil.getString("system_unvalid")), childJobIdItem));
|
MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId") + "({0})" + I18nUtil.getString("system_unvalid")), childJobIdItem));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// join , avoid "xxx,,"
|
// join , avoid "xxx,,"
|
||||||
String temp = "";
|
String temp = "";
|
||||||
for (String item:childJobIds) {
|
for (String item : childJobIds) {
|
||||||
temp += item + ",";
|
temp += item + ",";
|
||||||
}
|
}
|
||||||
temp = temp.substring(0, temp.length()-1);
|
temp = temp.substring(0, temp.length() - 1);
|
||||||
|
|
||||||
jobInfo.setChildJobId(temp);
|
jobInfo.setChildJobId(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add in db
|
// add in db
|
||||||
jobInfo.setAddTime(new Date());
|
jobInfo.setAddTime(new Date());
|
||||||
jobInfo.setUpdateTime(new Date());
|
jobInfo.setUpdateTime(new Date());
|
||||||
jobInfo.setGlueUpdatetime(new Date());
|
jobInfo.setGlueUpdatetime(new Date());
|
||||||
xxlJobInfoDao.save(jobInfo);
|
xxlJobInfoDao.save(jobInfo);
|
||||||
if (jobInfo.getId() < 1) {
|
if (jobInfo.getId() < 1) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_add")+I18nUtil.getString("system_fail")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_add") + I18nUtil.getString("system_fail")));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ReturnT<String>(String.valueOf(jobInfo.getId()));
|
return new ReturnT<String>(String.valueOf(jobInfo.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isNumeric(String str){
|
private boolean isNumeric(String str) {
|
||||||
try {
|
try {
|
||||||
int result = Integer.valueOf(str);
|
int result = Integer.valueOf(str);
|
||||||
return true;
|
return true;
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ReturnT<String> update(XxlJobInfo jobInfo) {
|
public ReturnT<String> update(XxlJobInfo jobInfo) {
|
||||||
|
|
||||||
// valid base
|
// valid base
|
||||||
if (jobInfo.getJobDesc()==null || jobInfo.getJobDesc().trim().length()==0) {
|
if (jobInfo.getJobDesc() == null || jobInfo.getJobDesc().trim().length() == 0) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input")+I18nUtil.getString("jobinfo_field_jobdesc")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_jobdesc")));
|
||||||
}
|
}
|
||||||
if (jobInfo.getAuthor()==null || jobInfo.getAuthor().trim().length()==0) {
|
if (jobInfo.getAuthor() == null || jobInfo.getAuthor().trim().length() == 0) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input")+I18nUtil.getString("jobinfo_field_author")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_author")));
|
||||||
}
|
}
|
||||||
|
|
||||||
// valid trigger
|
// valid trigger
|
||||||
ScheduleTypeEnum scheduleTypeEnum = ScheduleTypeEnum.match(jobInfo.getScheduleType(), null);
|
ScheduleTypeEnum scheduleTypeEnum = ScheduleTypeEnum.match(jobInfo.getScheduleType(), null);
|
||||||
if (scheduleTypeEnum == null) {
|
if (scheduleTypeEnum == null) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
|
||||||
}
|
}
|
||||||
if (scheduleTypeEnum == ScheduleTypeEnum.CRON) {
|
if (scheduleTypeEnum == ScheduleTypeEnum.CRON) {
|
||||||
if (jobInfo.getScheduleConf()==null || !CronExpression.isValidExpression(jobInfo.getScheduleConf())) {
|
if (jobInfo.getScheduleConf() == null || !CronExpression.isValidExpression(jobInfo.getScheduleConf())) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, "Cron"+I18nUtil.getString("system_unvalid") );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, "Cron" + I18nUtil.getString("system_unvalid"));
|
||||||
}
|
}
|
||||||
} else if (scheduleTypeEnum == ScheduleTypeEnum.FIX_RATE /*|| scheduleTypeEnum == ScheduleTypeEnum.FIX_DELAY*/) {
|
} else if (scheduleTypeEnum == ScheduleTypeEnum.FIX_RATE /*|| scheduleTypeEnum == ScheduleTypeEnum.FIX_DELAY*/) {
|
||||||
if (jobInfo.getScheduleConf() == null) {
|
if (jobInfo.getScheduleConf() == null) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
int fixSecond = Integer.valueOf(jobInfo.getScheduleConf());
|
int fixSecond = Integer.valueOf(jobInfo.getScheduleConf());
|
||||||
if (fixSecond < 1) {
|
if (fixSecond < 1) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// valid advanced
|
// valid advanced
|
||||||
if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
|
if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorRouteStrategy")+I18nUtil.getString("system_unvalid")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorRouteStrategy") + I18nUtil.getString("system_unvalid")));
|
||||||
}
|
}
|
||||||
if (MisfireStrategyEnum.match(jobInfo.getMisfireStrategy(), null) == null) {
|
if (MisfireStrategyEnum.match(jobInfo.getMisfireStrategy(), null) == null) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("misfire_strategy")+I18nUtil.getString("system_unvalid")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("misfire_strategy") + I18nUtil.getString("system_unvalid")));
|
||||||
}
|
}
|
||||||
if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) {
|
if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy")+I18nUtil.getString("system_unvalid")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy") + I18nUtil.getString("system_unvalid")));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 》ChildJobId valid
|
// 》ChildJobId valid
|
||||||
if (jobInfo.getChildJobId()!=null && jobInfo.getChildJobId().trim().length()>0) {
|
if (jobInfo.getChildJobId() != null && jobInfo.getChildJobId().trim().length() > 0) {
|
||||||
String[] childJobIds = jobInfo.getChildJobId().split(",");
|
String[] childJobIds = jobInfo.getChildJobId().split(",");
|
||||||
for (String childJobIdItem: childJobIds) {
|
for (String childJobIdItem : childJobIds) {
|
||||||
if (childJobIdItem!=null && childJobIdItem.trim().length()>0 && isNumeric(childJobIdItem)) {
|
if (childJobIdItem != null && childJobIdItem.trim().length() > 0 && isNumeric(childJobIdItem)) {
|
||||||
XxlJobInfo childJobInfo = xxlJobInfoDao.loadById(Integer.parseInt(childJobIdItem));
|
XxlJobInfo childJobInfo = xxlJobInfoDao.loadById(Integer.parseInt(childJobIdItem));
|
||||||
if (childJobInfo==null) {
|
if (childJobInfo == null) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE,
|
return new ReturnT<String>(ReturnT.FAIL_CODE,
|
||||||
MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId")+"({0})"+I18nUtil.getString("system_not_found")), childJobIdItem));
|
MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId") + "({0})" + I18nUtil.getString("system_not_found")), childJobIdItem));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE,
|
return new ReturnT<String>(ReturnT.FAIL_CODE,
|
||||||
MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId")+"({0})"+I18nUtil.getString("system_unvalid")), childJobIdItem));
|
MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId") + "({0})" + I18nUtil.getString("system_unvalid")), childJobIdItem));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// join , avoid "xxx,,"
|
// join , avoid "xxx,,"
|
||||||
String temp = "";
|
String temp = "";
|
||||||
for (String item:childJobIds) {
|
for (String item : childJobIds) {
|
||||||
temp += item + ",";
|
temp += item + ",";
|
||||||
}
|
}
|
||||||
temp = temp.substring(0, temp.length()-1);
|
temp = temp.substring(0, temp.length() - 1);
|
||||||
|
|
||||||
jobInfo.setChildJobId(temp);
|
jobInfo.setChildJobId(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// group valid
|
// group valid
|
||||||
XxlJobGroup jobGroup = xxlJobGroupDao.load(jobInfo.getJobGroup());
|
XxlJobGroup jobGroup = xxlJobGroupDao.load(jobInfo.getJobGroup());
|
||||||
if (jobGroup == null) {
|
if (jobGroup == null) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_jobgroup")+I18nUtil.getString("system_unvalid")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_jobgroup") + I18nUtil.getString("system_unvalid")));
|
||||||
}
|
}
|
||||||
|
|
||||||
// stage job info
|
// stage job info
|
||||||
XxlJobInfo exists_jobInfo = xxlJobInfoDao.loadById(jobInfo.getId());
|
XxlJobInfo exists_jobInfo = xxlJobInfoDao.loadById(jobInfo.getId());
|
||||||
if (exists_jobInfo == null) {
|
if (exists_jobInfo == null) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_id")+I18nUtil.getString("system_not_found")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_id") + I18nUtil.getString("system_not_found")));
|
||||||
}
|
}
|
||||||
|
|
||||||
// next trigger time (5s后生效,避开预读周期)
|
// next trigger time (5s后生效,避开预读周期)
|
||||||
long nextTriggerTime = exists_jobInfo.getTriggerNextTime();
|
long nextTriggerTime = exists_jobInfo.getTriggerNextTime();
|
||||||
boolean scheduleDataNotChanged = jobInfo.getScheduleType().equals(exists_jobInfo.getScheduleType()) && jobInfo.getScheduleConf().equals(exists_jobInfo.getScheduleConf());
|
boolean scheduleDataNotChanged = jobInfo.getScheduleType().equals(exists_jobInfo.getScheduleType()) && jobInfo.getScheduleConf().equals(exists_jobInfo.getScheduleConf());
|
||||||
if (exists_jobInfo.getTriggerStatus() == 1 && !scheduleDataNotChanged) {
|
if (exists_jobInfo.getTriggerStatus() == 1 && !scheduleDataNotChanged) {
|
||||||
try {
|
try {
|
||||||
Date nextValidTime = JobScheduleHelper.generateNextValidTime(jobInfo, new Date(System.currentTimeMillis() + JobScheduleHelper.PRE_READ_MS));
|
Date nextValidTime = JobScheduleHelper.generateNextValidTime(jobInfo, new Date(System.currentTimeMillis() + JobScheduleHelper.PRE_READ_MS));
|
||||||
if (nextValidTime == null) {
|
if (nextValidTime == null) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
|
||||||
}
|
}
|
||||||
nextTriggerTime = nextValidTime.getTime();
|
nextTriggerTime = nextValidTime.getTime();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exists_jobInfo.setJobGroup(jobInfo.getJobGroup());
|
exists_jobInfo.setJobGroup(jobInfo.getJobGroup());
|
||||||
exists_jobInfo.setJobDesc(jobInfo.getJobDesc());
|
exists_jobInfo.setJobDesc(jobInfo.getJobDesc());
|
||||||
exists_jobInfo.setAuthor(jobInfo.getAuthor());
|
exists_jobInfo.setAuthor(jobInfo.getAuthor());
|
||||||
exists_jobInfo.setAlarmEmail(jobInfo.getAlarmEmail());
|
exists_jobInfo.setAlarmEmail(jobInfo.getAlarmEmail());
|
||||||
exists_jobInfo.setScheduleType(jobInfo.getScheduleType());
|
exists_jobInfo.setScheduleType(jobInfo.getScheduleType());
|
||||||
exists_jobInfo.setScheduleConf(jobInfo.getScheduleConf());
|
exists_jobInfo.setScheduleConf(jobInfo.getScheduleConf());
|
||||||
exists_jobInfo.setMisfireStrategy(jobInfo.getMisfireStrategy());
|
exists_jobInfo.setMisfireStrategy(jobInfo.getMisfireStrategy());
|
||||||
exists_jobInfo.setExecutorRouteStrategy(jobInfo.getExecutorRouteStrategy());
|
exists_jobInfo.setExecutorRouteStrategy(jobInfo.getExecutorRouteStrategy());
|
||||||
exists_jobInfo.setExecutorHandler(jobInfo.getExecutorHandler());
|
exists_jobInfo.setExecutorHandler(jobInfo.getExecutorHandler());
|
||||||
exists_jobInfo.setExecutorParam(jobInfo.getExecutorParam());
|
exists_jobInfo.setExecutorParam(jobInfo.getExecutorParam());
|
||||||
exists_jobInfo.setExecutorBlockStrategy(jobInfo.getExecutorBlockStrategy());
|
exists_jobInfo.setExecutorBlockStrategy(jobInfo.getExecutorBlockStrategy());
|
||||||
exists_jobInfo.setExecutorTimeout(jobInfo.getExecutorTimeout());
|
exists_jobInfo.setExecutorTimeout(jobInfo.getExecutorTimeout());
|
||||||
exists_jobInfo.setExecutorFailRetryCount(jobInfo.getExecutorFailRetryCount());
|
exists_jobInfo.setExecutorFailRetryCount(jobInfo.getExecutorFailRetryCount());
|
||||||
exists_jobInfo.setChildJobId(jobInfo.getChildJobId());
|
exists_jobInfo.setChildJobId(jobInfo.getChildJobId());
|
||||||
exists_jobInfo.setTriggerNextTime(nextTriggerTime);
|
exists_jobInfo.setTriggerNextTime(nextTriggerTime);
|
||||||
|
|
||||||
exists_jobInfo.setUpdateTime(new Date());
|
exists_jobInfo.setUpdateTime(new Date());
|
||||||
xxlJobInfoDao.update(exists_jobInfo);
|
xxlJobInfoDao.update(exists_jobInfo);
|
||||||
|
|
||||||
|
|
||||||
return ReturnT.SUCCESS;
|
return ReturnT.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ReturnT<String> remove(int id) {
|
public ReturnT<String> remove(int id) {
|
||||||
XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
|
XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
|
||||||
if (xxlJobInfo == null) {
|
if (xxlJobInfo == null) {
|
||||||
return ReturnT.SUCCESS;
|
return ReturnT.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
xxlJobInfoDao.delete(id);
|
xxlJobInfoDao.delete(id);
|
||||||
xxlJobLogDao.delete(id);
|
xxlJobLogDao.delete(id);
|
||||||
xxlJobLogGlueDao.deleteByJobId(id);
|
xxlJobLogGlueDao.deleteByJobId(id);
|
||||||
return ReturnT.SUCCESS;
|
return ReturnT.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ReturnT<String> start(int id) {
|
public ReturnT<String> start(int id) {
|
||||||
XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
|
|
||||||
|
|
||||||
// valid
|
|
||||||
ScheduleTypeEnum scheduleTypeEnum = ScheduleTypeEnum.match(xxlJobInfo.getScheduleType(), ScheduleTypeEnum.NONE);
|
|
||||||
if (ScheduleTypeEnum.NONE == scheduleTypeEnum) {
|
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type_none_limit_start")) );
|
|
||||||
}
|
|
||||||
|
|
||||||
// next trigger time (5s后生效,避开预读周期)
|
|
||||||
long nextTriggerTime = 0;
|
|
||||||
try {
|
|
||||||
Date nextValidTime = JobScheduleHelper.generateNextValidTime(xxlJobInfo, new Date(System.currentTimeMillis() + JobScheduleHelper.PRE_READ_MS));
|
|
||||||
if (nextValidTime == null) {
|
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
|
||||||
}
|
|
||||||
nextTriggerTime = nextValidTime.getTime();
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error(e.getMessage(), e);
|
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
|
|
||||||
}
|
|
||||||
|
|
||||||
xxlJobInfo.setTriggerStatus(1);
|
|
||||||
xxlJobInfo.setTriggerLastTime(0);
|
|
||||||
xxlJobInfo.setTriggerNextTime(nextTriggerTime);
|
|
||||||
|
|
||||||
xxlJobInfo.setUpdateTime(new Date());
|
|
||||||
xxlJobInfoDao.update(xxlJobInfo);
|
|
||||||
return ReturnT.SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ReturnT<String> stop(int id) {
|
|
||||||
XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
|
XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
|
||||||
|
|
||||||
xxlJobInfo.setTriggerStatus(0);
|
// valid
|
||||||
xxlJobInfo.setTriggerLastTime(0);
|
ScheduleTypeEnum scheduleTypeEnum = ScheduleTypeEnum.match(xxlJobInfo.getScheduleType(), ScheduleTypeEnum.NONE);
|
||||||
xxlJobInfo.setTriggerNextTime(0);
|
if (ScheduleTypeEnum.NONE == scheduleTypeEnum) {
|
||||||
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type_none_limit_start")));
|
||||||
|
}
|
||||||
|
|
||||||
xxlJobInfo.setUpdateTime(new Date());
|
// next trigger time (5s后生效,避开预读周期)
|
||||||
xxlJobInfoDao.update(xxlJobInfo);
|
long nextTriggerTime = 0;
|
||||||
return ReturnT.SUCCESS;
|
try {
|
||||||
}
|
Date nextValidTime = JobScheduleHelper.generateNextValidTime(xxlJobInfo, new Date(System.currentTimeMillis() + JobScheduleHelper.PRE_READ_MS));
|
||||||
|
if (nextValidTime == null) {
|
||||||
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
|
||||||
|
}
|
||||||
|
nextTriggerTime = nextValidTime.getTime();
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e.getMessage(), e);
|
||||||
|
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
xxlJobInfo.setTriggerStatus(1);
|
||||||
public Map<String, Object> dashboardInfo() {
|
xxlJobInfo.setTriggerLastTime(0);
|
||||||
|
xxlJobInfo.setTriggerNextTime(nextTriggerTime);
|
||||||
|
|
||||||
int jobInfoCount = xxlJobInfoDao.findAllCount();
|
xxlJobInfo.setUpdateTime(new Date());
|
||||||
int jobLogCount = 0;
|
xxlJobInfoDao.update(xxlJobInfo);
|
||||||
int jobLogSuccessCount = 0;
|
return ReturnT.SUCCESS;
|
||||||
XxlJobLogReport xxlJobLogReport = xxlJobLogReportDao.queryLogReportTotal();
|
}
|
||||||
if (xxlJobLogReport != null) {
|
|
||||||
jobLogCount = xxlJobLogReport.getRunningCount() + xxlJobLogReport.getSucCount() + xxlJobLogReport.getFailCount();
|
|
||||||
jobLogSuccessCount = xxlJobLogReport.getSucCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
// executor count
|
@Override
|
||||||
Set<String> executorAddressSet = new HashSet<String>();
|
public ReturnT<String> stop(int id) {
|
||||||
List<XxlJobGroup> groupList = xxlJobGroupDao.findAll();
|
XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
|
||||||
|
|
||||||
if (groupList!=null && !groupList.isEmpty()) {
|
xxlJobInfo.setTriggerStatus(0);
|
||||||
for (XxlJobGroup group: groupList) {
|
xxlJobInfo.setTriggerLastTime(0);
|
||||||
if (group.getRegistryList()!=null && !group.getRegistryList().isEmpty()) {
|
xxlJobInfo.setTriggerNextTime(0);
|
||||||
executorAddressSet.addAll(group.getRegistryList());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int executorCount = executorAddressSet.size();
|
xxlJobInfo.setUpdateTime(new Date());
|
||||||
|
xxlJobInfoDao.update(xxlJobInfo);
|
||||||
|
return ReturnT.SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, Object> dashboardMap = new HashMap<String, Object>();
|
@Override
|
||||||
dashboardMap.put("jobInfoCount", jobInfoCount);
|
public Map<String, Object> dashboardInfo() {
|
||||||
dashboardMap.put("jobLogCount", jobLogCount);
|
|
||||||
dashboardMap.put("jobLogSuccessCount", jobLogSuccessCount);
|
|
||||||
dashboardMap.put("executorCount", executorCount);
|
|
||||||
return dashboardMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
int jobInfoCount = xxlJobInfoDao.findAllCount();
|
||||||
public ReturnT<Map<String, Object>> chartInfo(Date startDate, Date endDate) {
|
int jobLogCount = 0;
|
||||||
|
int jobLogSuccessCount = 0;
|
||||||
|
XxlJobLogReport xxlJobLogReport = xxlJobLogReportDao.queryLogReportTotal();
|
||||||
|
if (xxlJobLogReport != null) {
|
||||||
|
jobLogCount = xxlJobLogReport.getRunningCount() + xxlJobLogReport.getSucCount() + xxlJobLogReport.getFailCount();
|
||||||
|
jobLogSuccessCount = xxlJobLogReport.getSucCount();
|
||||||
|
}
|
||||||
|
|
||||||
// process
|
// executor count
|
||||||
List<String> triggerDayList = new ArrayList<String>();
|
Set<String> executorAddressSet = new HashSet<String>();
|
||||||
List<Integer> triggerDayCountRunningList = new ArrayList<Integer>();
|
List<XxlJobGroup> groupList = xxlJobGroupDao.findAll();
|
||||||
List<Integer> triggerDayCountSucList = new ArrayList<Integer>();
|
|
||||||
List<Integer> triggerDayCountFailList = new ArrayList<Integer>();
|
|
||||||
int triggerCountRunningTotal = 0;
|
|
||||||
int triggerCountSucTotal = 0;
|
|
||||||
int triggerCountFailTotal = 0;
|
|
||||||
|
|
||||||
List<XxlJobLogReport> logReportList = xxlJobLogReportDao.queryLogReport(startDate, endDate);
|
if (groupList != null && !groupList.isEmpty()) {
|
||||||
|
for (XxlJobGroup group : groupList) {
|
||||||
|
if (group.getRegistryList() != null && !group.getRegistryList().isEmpty()) {
|
||||||
|
executorAddressSet.addAll(group.getRegistryList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (logReportList!=null && logReportList.size()>0) {
|
int executorCount = executorAddressSet.size();
|
||||||
for (XxlJobLogReport item: logReportList) {
|
|
||||||
String day = DateUtil.formatDate(item.getTriggerDay());
|
|
||||||
int triggerDayCountRunning = item.getRunningCount();
|
|
||||||
int triggerDayCountSuc = item.getSucCount();
|
|
||||||
int triggerDayCountFail = item.getFailCount();
|
|
||||||
|
|
||||||
triggerDayList.add(day);
|
Map<String, Object> dashboardMap = new HashMap<String, Object>();
|
||||||
triggerDayCountRunningList.add(triggerDayCountRunning);
|
dashboardMap.put("jobInfoCount" , jobInfoCount);
|
||||||
triggerDayCountSucList.add(triggerDayCountSuc);
|
dashboardMap.put("jobLogCount" , jobLogCount);
|
||||||
triggerDayCountFailList.add(triggerDayCountFail);
|
dashboardMap.put("jobLogSuccessCount" , jobLogSuccessCount);
|
||||||
|
dashboardMap.put("executorCount" , executorCount);
|
||||||
|
return dashboardMap;
|
||||||
|
}
|
||||||
|
|
||||||
triggerCountRunningTotal += triggerDayCountRunning;
|
@Override
|
||||||
triggerCountSucTotal += triggerDayCountSuc;
|
public ReturnT<Map<String, Object>> chartInfo(Date startDate, Date endDate) {
|
||||||
triggerCountFailTotal += triggerDayCountFail;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int i = -6; i <= 0; i++) {
|
|
||||||
triggerDayList.add(DateUtil.formatDate(DateUtil.addDays(new Date(), i)));
|
|
||||||
triggerDayCountRunningList.add(0);
|
|
||||||
triggerDayCountSucList.add(0);
|
|
||||||
triggerDayCountFailList.add(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, Object> result = new HashMap<String, Object>();
|
// process
|
||||||
result.put("triggerDayList", triggerDayList);
|
List<String> triggerDayList = new ArrayList<String>();
|
||||||
result.put("triggerDayCountRunningList", triggerDayCountRunningList);
|
List<Integer> triggerDayCountRunningList = new ArrayList<Integer>();
|
||||||
result.put("triggerDayCountSucList", triggerDayCountSucList);
|
List<Integer> triggerDayCountSucList = new ArrayList<Integer>();
|
||||||
result.put("triggerDayCountFailList", triggerDayCountFailList);
|
List<Integer> triggerDayCountFailList = new ArrayList<Integer>();
|
||||||
|
int triggerCountRunningTotal = 0;
|
||||||
|
int triggerCountSucTotal = 0;
|
||||||
|
int triggerCountFailTotal = 0;
|
||||||
|
|
||||||
result.put("triggerCountRunningTotal", triggerCountRunningTotal);
|
List<XxlJobLogReport> logReportList = xxlJobLogReportDao.queryLogReport(startDate, endDate);
|
||||||
result.put("triggerCountSucTotal", triggerCountSucTotal);
|
|
||||||
result.put("triggerCountFailTotal", triggerCountFailTotal);
|
|
||||||
|
|
||||||
return new ReturnT<Map<String, Object>>(result);
|
if (logReportList != null && logReportList.size() > 0) {
|
||||||
}
|
for (XxlJobLogReport item : logReportList) {
|
||||||
|
String day = DateUtil.formatDate(item.getTriggerDay());
|
||||||
|
int triggerDayCountRunning = item.getRunningCount();
|
||||||
|
int triggerDayCountSuc = item.getSucCount();
|
||||||
|
int triggerDayCountFail = item.getFailCount();
|
||||||
|
|
||||||
|
triggerDayList.add(day);
|
||||||
|
triggerDayCountRunningList.add(triggerDayCountRunning);
|
||||||
|
triggerDayCountSucList.add(triggerDayCountSuc);
|
||||||
|
triggerDayCountFailList.add(triggerDayCountFail);
|
||||||
|
|
||||||
|
triggerCountRunningTotal += triggerDayCountRunning;
|
||||||
|
triggerCountSucTotal += triggerDayCountSuc;
|
||||||
|
triggerCountFailTotal += triggerDayCountFail;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int i = -6; i <= 0; i++) {
|
||||||
|
triggerDayList.add(DateUtil.formatDate(DateUtil.addDays(new Date(), i)));
|
||||||
|
triggerDayCountRunningList.add(0);
|
||||||
|
triggerDayCountSucList.add(0);
|
||||||
|
triggerDayCountFailList.add(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
result.put("triggerDayList" , triggerDayList);
|
||||||
|
result.put("triggerDayCountRunningList" , triggerDayCountRunningList);
|
||||||
|
result.put("triggerDayCountSucList" , triggerDayCountSucList);
|
||||||
|
result.put("triggerDayCountFailList" , triggerDayCountFailList);
|
||||||
|
|
||||||
|
result.put("triggerCountRunningTotal" , triggerCountRunningTotal);
|
||||||
|
result.put("triggerCountSucTotal" , triggerCountSucTotal);
|
||||||
|
result.put("triggerCountFailTotal" , triggerCountFailTotal);
|
||||||
|
|
||||||
|
return new ReturnT<Map<String, Object>>(result);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,91 +1,91 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.xxl.job.admin.dao.XxlJobGroupDao">
|
<mapper namespace="com.xxl.job.admin.dao.XxlJobGroupDao">
|
||||||
|
|
||||||
<resultMap id="XxlJobGroup" type="com.xxl.job.admin.core.model.XxlJobGroup" >
|
<resultMap id="XxlJobGroup" type="com.xxl.job.admin.core.model.XxlJobGroup" >
|
||||||
<result column="id" property="id" />
|
<result column="id" property="id" />
|
||||||
<result column="app_name" property="appname" />
|
<result column="app_name" property="appname" />
|
||||||
<result column="title" property="title" />
|
<result column="title" property="title" />
|
||||||
<result column="address_type" property="addressType" />
|
<result column="address_type" property="addressType" />
|
||||||
<result column="address_list" property="addressList" />
|
<result column="address_list" property="addressList" />
|
||||||
<result column="update_time" property="updateTime" />
|
<result column="update_time" property="updateTime" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
t.id,
|
t.id,
|
||||||
t.app_name,
|
t.app_name,
|
||||||
t.title,
|
t.title,
|
||||||
t.address_type,
|
t.address_type,
|
||||||
t.address_list,
|
t.address_list,
|
||||||
t.update_time
|
t.update_time
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="findAll" resultMap="XxlJobGroup">
|
<select id="findAll" resultMap="XxlJobGroup">
|
||||||
SELECT <include refid="Base_Column_List" />
|
SELECT <include refid="Base_Column_List" />
|
||||||
FROM xxl_job_group AS t
|
FROM xxl_job_group AS t
|
||||||
ORDER BY t.app_name, t.title, t.id ASC
|
ORDER BY t.app_name, t.title, t.id ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findByAddressType" parameterType="java.lang.Integer" resultMap="XxlJobGroup">
|
<select id="findByAddressType" parameterType="java.lang.Integer" resultMap="XxlJobGroup">
|
||||||
SELECT <include refid="Base_Column_List" />
|
SELECT <include refid="Base_Column_List" />
|
||||||
FROM xxl_job_group AS t
|
FROM xxl_job_group AS t
|
||||||
WHERE t.address_type = #{addressType}
|
WHERE t.address_type = #{addressType}
|
||||||
ORDER BY t.app_name, t.title, t.id ASC
|
ORDER BY t.app_name, t.title, t.id ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobGroup" useGeneratedKeys="true" keyProperty="id" >
|
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobGroup" useGeneratedKeys="true" keyProperty="id" >
|
||||||
INSERT INTO xxl_job_group ( `app_name`, `title`, `address_type`, `address_list`, `update_time`)
|
INSERT INTO xxl_job_group ( `app_name`, `title`, `address_type`, `address_list`, `update_time`)
|
||||||
values ( #{appname}, #{title}, #{addressType}, #{addressList}, #{updateTime} );
|
values ( #{appname}, #{title}, #{addressType}, #{addressList}, #{updateTime} );
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobGroup" >
|
<update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobGroup" >
|
||||||
UPDATE xxl_job_group
|
UPDATE xxl_job_group
|
||||||
SET `app_name` = #{appname},
|
SET `app_name` = #{appname},
|
||||||
`title` = #{title},
|
`title` = #{title},
|
||||||
`address_type` = #{addressType},
|
`address_type` = #{addressType},
|
||||||
`address_list` = #{addressList},
|
`address_list` = #{addressList},
|
||||||
`update_time` = #{updateTime}
|
`update_time` = #{updateTime}
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="remove" parameterType="java.lang.Integer" >
|
<delete id="remove" parameterType="java.lang.Integer" >
|
||||||
DELETE FROM xxl_job_group
|
DELETE FROM xxl_job_group
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="load" parameterType="java.lang.Integer" resultMap="XxlJobGroup">
|
<select id="load" parameterType="java.lang.Integer" resultMap="XxlJobGroup">
|
||||||
SELECT <include refid="Base_Column_List" />
|
SELECT <include refid="Base_Column_List" />
|
||||||
FROM xxl_job_group AS t
|
FROM xxl_job_group AS t
|
||||||
WHERE t.id = #{id}
|
WHERE t.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="pageList" parameterType="java.util.HashMap" resultMap="XxlJobGroup">
|
<select id="pageList" parameterType="java.util.HashMap" resultMap="XxlJobGroup">
|
||||||
SELECT <include refid="Base_Column_List" />
|
SELECT <include refid="Base_Column_List" />
|
||||||
FROM xxl_job_group AS t
|
FROM xxl_job_group AS t
|
||||||
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
||||||
<if test="appname != null and appname != ''">
|
<if test="appname != null and appname != ''">
|
||||||
AND t.app_name like CONCAT(CONCAT('%', #{appname}), '%')
|
AND t.app_name like CONCAT(CONCAT('%', #{appname}), '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="title != null and title != ''">
|
<if test="title != null and title != ''">
|
||||||
AND t.title like CONCAT(CONCAT('%', #{title}), '%')
|
AND t.title like CONCAT(CONCAT('%', #{title}), '%')
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
ORDER BY t.app_name, t.title, t.id ASC
|
ORDER BY t.app_name, t.title, t.id ASC
|
||||||
LIMIT #{offset}, #{pagesize}
|
LIMIT #{offset}, #{pagesize}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="pageListCount" parameterType="java.util.HashMap" resultType="int">
|
<select id="pageListCount" parameterType="java.util.HashMap" resultType="int">
|
||||||
SELECT count(1)
|
SELECT count(1)
|
||||||
FROM xxl_job_group AS t
|
FROM xxl_job_group AS t
|
||||||
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
||||||
<if test="appname != null and appname != ''">
|
<if test="appname != null and appname != ''">
|
||||||
AND t.app_name like CONCAT(CONCAT('%', #{appname}), '%')
|
AND t.app_name like CONCAT(CONCAT('%', #{appname}), '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="title != null and title != ''">
|
<if test="title != null and title != ''">
|
||||||
AND t.title like CONCAT(CONCAT('%', #{title}), '%')
|
AND t.title like CONCAT(CONCAT('%', #{title}), '%')
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -1,240 +1,240 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.xxl.job.admin.dao.XxlJobInfoDao">
|
<mapper namespace="com.xxl.job.admin.dao.XxlJobInfoDao">
|
||||||
|
|
||||||
<resultMap id="XxlJobInfo" type="com.xxl.job.admin.core.model.XxlJobInfo" >
|
<resultMap id="XxlJobInfo" type="com.xxl.job.admin.core.model.XxlJobInfo" >
|
||||||
<result column="id" property="id" />
|
<result column="id" property="id" />
|
||||||
|
|
||||||
<result column="job_group" property="jobGroup" />
|
<result column="job_group" property="jobGroup" />
|
||||||
<result column="job_desc" property="jobDesc" />
|
<result column="job_desc" property="jobDesc" />
|
||||||
|
|
||||||
<result column="add_time" property="addTime" />
|
<result column="add_time" property="addTime" />
|
||||||
<result column="update_time" property="updateTime" />
|
<result column="update_time" property="updateTime" />
|
||||||
|
|
||||||
<result column="author" property="author" />
|
<result column="author" property="author" />
|
||||||
<result column="alarm_email" property="alarmEmail" />
|
<result column="alarm_email" property="alarmEmail" />
|
||||||
|
|
||||||
<result column="schedule_type" property="scheduleType" />
|
<result column="schedule_type" property="scheduleType" />
|
||||||
<result column="schedule_conf" property="scheduleConf" />
|
<result column="schedule_conf" property="scheduleConf" />
|
||||||
<result column="misfire_strategy" property="misfireStrategy" />
|
<result column="misfire_strategy" property="misfireStrategy" />
|
||||||
|
|
||||||
<result column="executor_route_strategy" property="executorRouteStrategy" />
|
<result column="executor_route_strategy" property="executorRouteStrategy" />
|
||||||
<result column="executor_handler" property="executorHandler" />
|
<result column="executor_handler" property="executorHandler" />
|
||||||
<result column="executor_param" property="executorParam" />
|
<result column="executor_param" property="executorParam" />
|
||||||
<result column="executor_block_strategy" property="executorBlockStrategy" />
|
<result column="executor_block_strategy" property="executorBlockStrategy" />
|
||||||
<result column="executor_timeout" property="executorTimeout" />
|
<result column="executor_timeout" property="executorTimeout" />
|
||||||
<result column="executor_fail_retry_count" property="executorFailRetryCount" />
|
<result column="executor_fail_retry_count" property="executorFailRetryCount" />
|
||||||
|
|
||||||
<result column="glue_type" property="glueType" />
|
<result column="glue_type" property="glueType" />
|
||||||
<result column="glue_source" property="glueSource" />
|
<result column="glue_source" property="glueSource" />
|
||||||
<result column="glue_remark" property="glueRemark" />
|
<result column="glue_remark" property="glueRemark" />
|
||||||
<result column="glue_updatetime" property="glueUpdatetime" />
|
<result column="glue_updatetime" property="glueUpdatetime" />
|
||||||
|
|
||||||
<result column="child_jobid" property="childJobId" />
|
<result column="child_jobid" property="childJobId" />
|
||||||
|
|
||||||
<result column="trigger_status" property="triggerStatus" />
|
<result column="trigger_status" property="triggerStatus" />
|
||||||
<result column="trigger_last_time" property="triggerLastTime" />
|
<result column="trigger_last_time" property="triggerLastTime" />
|
||||||
<result column="trigger_next_time" property="triggerNextTime" />
|
<result column="trigger_next_time" property="triggerNextTime" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
t.id,
|
t.id,
|
||||||
t.job_group,
|
t.job_group,
|
||||||
t.job_desc,
|
t.job_desc,
|
||||||
t.add_time,
|
t.add_time,
|
||||||
t.update_time,
|
t.update_time,
|
||||||
t.author,
|
t.author,
|
||||||
t.alarm_email,
|
t.alarm_email,
|
||||||
t.schedule_type,
|
t.schedule_type,
|
||||||
t.schedule_conf,
|
t.schedule_conf,
|
||||||
t.misfire_strategy,
|
t.misfire_strategy,
|
||||||
t.executor_route_strategy,
|
t.executor_route_strategy,
|
||||||
t.executor_handler,
|
t.executor_handler,
|
||||||
t.executor_param,
|
t.executor_param,
|
||||||
t.executor_block_strategy,
|
t.executor_block_strategy,
|
||||||
t.executor_timeout,
|
t.executor_timeout,
|
||||||
t.executor_fail_retry_count,
|
t.executor_fail_retry_count,
|
||||||
t.glue_type,
|
t.glue_type,
|
||||||
t.glue_source,
|
t.glue_source,
|
||||||
t.glue_remark,
|
t.glue_remark,
|
||||||
t.glue_updatetime,
|
t.glue_updatetime,
|
||||||
t.child_jobid,
|
t.child_jobid,
|
||||||
t.trigger_status,
|
t.trigger_status,
|
||||||
t.trigger_last_time,
|
t.trigger_last_time,
|
||||||
t.trigger_next_time
|
t.trigger_next_time
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="pageList" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
|
<select id="pageList" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
|
||||||
SELECT <include refid="Base_Column_List" />
|
SELECT <include refid="Base_Column_List" />
|
||||||
FROM xxl_job_info AS t
|
FROM xxl_job_info AS t
|
||||||
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
||||||
<if test="jobGroup gt 0">
|
<if test="jobGroup gt 0">
|
||||||
AND t.job_group = #{jobGroup}
|
AND t.job_group = #{jobGroup}
|
||||||
</if>
|
</if>
|
||||||
<if test="triggerStatus gte 0">
|
<if test="triggerStatus gte 0">
|
||||||
AND t.trigger_status = #{triggerStatus}
|
AND t.trigger_status = #{triggerStatus}
|
||||||
</if>
|
</if>
|
||||||
<if test="jobDesc != null and jobDesc != ''">
|
<if test="jobDesc != null and jobDesc != ''">
|
||||||
AND t.job_desc like CONCAT(CONCAT('%', #{jobDesc}), '%')
|
AND t.job_desc like CONCAT(CONCAT('%', #{jobDesc}), '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="executorHandler != null and executorHandler != ''">
|
<if test="executorHandler != null and executorHandler != ''">
|
||||||
AND t.executor_handler like CONCAT(CONCAT('%', #{executorHandler}), '%')
|
AND t.executor_handler like CONCAT(CONCAT('%', #{executorHandler}), '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="author != null and author != ''">
|
<if test="author != null and author != ''">
|
||||||
AND t.author like CONCAT(CONCAT('%', #{author}), '%')
|
AND t.author like CONCAT(CONCAT('%', #{author}), '%')
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
ORDER BY id DESC
|
ORDER BY id DESC
|
||||||
LIMIT #{offset}, #{pagesize}
|
LIMIT #{offset}, #{pagesize}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="pageListCount" parameterType="java.util.HashMap" resultType="int">
|
<select id="pageListCount" parameterType="java.util.HashMap" resultType="int">
|
||||||
SELECT count(1)
|
SELECT count(1)
|
||||||
FROM xxl_job_info AS t
|
FROM xxl_job_info AS t
|
||||||
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
||||||
<if test="jobGroup gt 0">
|
<if test="jobGroup gt 0">
|
||||||
AND t.job_group = #{jobGroup}
|
AND t.job_group = #{jobGroup}
|
||||||
</if>
|
</if>
|
||||||
<if test="triggerStatus gte 0">
|
<if test="triggerStatus gte 0">
|
||||||
AND t.trigger_status = #{triggerStatus}
|
AND t.trigger_status = #{triggerStatus}
|
||||||
</if>
|
</if>
|
||||||
<if test="jobDesc != null and jobDesc != ''">
|
<if test="jobDesc != null and jobDesc != ''">
|
||||||
AND t.job_desc like CONCAT(CONCAT('%', #{jobDesc}), '%')
|
AND t.job_desc like CONCAT(CONCAT('%', #{jobDesc}), '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="executorHandler != null and executorHandler != ''">
|
<if test="executorHandler != null and executorHandler != ''">
|
||||||
AND t.executor_handler like CONCAT(CONCAT('%', #{executorHandler}), '%')
|
AND t.executor_handler like CONCAT(CONCAT('%', #{executorHandler}), '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="author != null and author != ''">
|
<if test="author != null and author != ''">
|
||||||
AND t.author like CONCAT(CONCAT('%', #{author}), '%')
|
AND t.author like CONCAT(CONCAT('%', #{author}), '%')
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" useGeneratedKeys="true" keyProperty="id" >
|
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" useGeneratedKeys="true" keyProperty="id" >
|
||||||
INSERT INTO xxl_job_info (
|
INSERT INTO xxl_job_info (
|
||||||
job_group,
|
job_group,
|
||||||
job_desc,
|
job_desc,
|
||||||
add_time,
|
add_time,
|
||||||
update_time,
|
update_time,
|
||||||
author,
|
author,
|
||||||
alarm_email,
|
alarm_email,
|
||||||
schedule_type,
|
schedule_type,
|
||||||
schedule_conf,
|
schedule_conf,
|
||||||
misfire_strategy,
|
misfire_strategy,
|
||||||
executor_route_strategy,
|
executor_route_strategy,
|
||||||
executor_handler,
|
executor_handler,
|
||||||
executor_param,
|
executor_param,
|
||||||
executor_block_strategy,
|
executor_block_strategy,
|
||||||
executor_timeout,
|
executor_timeout,
|
||||||
executor_fail_retry_count,
|
executor_fail_retry_count,
|
||||||
glue_type,
|
glue_type,
|
||||||
glue_source,
|
glue_source,
|
||||||
glue_remark,
|
glue_remark,
|
||||||
glue_updatetime,
|
glue_updatetime,
|
||||||
child_jobid,
|
child_jobid,
|
||||||
trigger_status,
|
trigger_status,
|
||||||
trigger_last_time,
|
trigger_last_time,
|
||||||
trigger_next_time
|
trigger_next_time
|
||||||
) VALUES (
|
) VALUES (
|
||||||
#{jobGroup},
|
#{jobGroup},
|
||||||
#{jobDesc},
|
#{jobDesc},
|
||||||
#{addTime},
|
#{addTime},
|
||||||
#{updateTime},
|
#{updateTime},
|
||||||
#{author},
|
#{author},
|
||||||
#{alarmEmail},
|
#{alarmEmail},
|
||||||
#{scheduleType},
|
#{scheduleType},
|
||||||
#{scheduleConf},
|
#{scheduleConf},
|
||||||
#{misfireStrategy},
|
#{misfireStrategy},
|
||||||
#{executorRouteStrategy},
|
#{executorRouteStrategy},
|
||||||
#{executorHandler},
|
#{executorHandler},
|
||||||
#{executorParam},
|
#{executorParam},
|
||||||
#{executorBlockStrategy},
|
#{executorBlockStrategy},
|
||||||
#{executorTimeout},
|
#{executorTimeout},
|
||||||
#{executorFailRetryCount},
|
#{executorFailRetryCount},
|
||||||
#{glueType},
|
#{glueType},
|
||||||
#{glueSource},
|
#{glueSource},
|
||||||
#{glueRemark},
|
#{glueRemark},
|
||||||
#{glueUpdatetime},
|
#{glueUpdatetime},
|
||||||
#{childJobId},
|
#{childJobId},
|
||||||
#{triggerStatus},
|
#{triggerStatus},
|
||||||
#{triggerLastTime},
|
#{triggerLastTime},
|
||||||
#{triggerNextTime}
|
#{triggerNextTime}
|
||||||
);
|
);
|
||||||
<!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
|
<!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
|
||||||
SELECT LAST_INSERT_ID()
|
SELECT LAST_INSERT_ID()
|
||||||
/*SELECT @@IDENTITY AS id*/
|
/*SELECT @@IDENTITY AS id*/
|
||||||
</selectKey>-->
|
</selectKey>-->
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<select id="loadById" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
|
<select id="loadById" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
|
||||||
SELECT <include refid="Base_Column_List" />
|
SELECT <include refid="Base_Column_List" />
|
||||||
FROM xxl_job_info AS t
|
FROM xxl_job_info AS t
|
||||||
WHERE t.id = #{id}
|
WHERE t.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" >
|
<update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" >
|
||||||
UPDATE xxl_job_info
|
UPDATE xxl_job_info
|
||||||
SET
|
SET
|
||||||
job_group = #{jobGroup},
|
job_group = #{jobGroup},
|
||||||
job_desc = #{jobDesc},
|
job_desc = #{jobDesc},
|
||||||
update_time = #{updateTime},
|
update_time = #{updateTime},
|
||||||
author = #{author},
|
author = #{author},
|
||||||
alarm_email = #{alarmEmail},
|
alarm_email = #{alarmEmail},
|
||||||
schedule_type = #{scheduleType},
|
schedule_type = #{scheduleType},
|
||||||
schedule_conf = #{scheduleConf},
|
schedule_conf = #{scheduleConf},
|
||||||
misfire_strategy = #{misfireStrategy},
|
misfire_strategy = #{misfireStrategy},
|
||||||
executor_route_strategy = #{executorRouteStrategy},
|
executor_route_strategy = #{executorRouteStrategy},
|
||||||
executor_handler = #{executorHandler},
|
executor_handler = #{executorHandler},
|
||||||
executor_param = #{executorParam},
|
executor_param = #{executorParam},
|
||||||
executor_block_strategy = #{executorBlockStrategy},
|
executor_block_strategy = #{executorBlockStrategy},
|
||||||
executor_timeout = ${executorTimeout},
|
executor_timeout = ${executorTimeout},
|
||||||
executor_fail_retry_count = ${executorFailRetryCount},
|
executor_fail_retry_count = ${executorFailRetryCount},
|
||||||
glue_type = #{glueType},
|
glue_type = #{glueType},
|
||||||
glue_source = #{glueSource},
|
glue_source = #{glueSource},
|
||||||
glue_remark = #{glueRemark},
|
glue_remark = #{glueRemark},
|
||||||
glue_updatetime = #{glueUpdatetime},
|
glue_updatetime = #{glueUpdatetime},
|
||||||
child_jobid = #{childJobId},
|
child_jobid = #{childJobId},
|
||||||
trigger_status = #{triggerStatus},
|
trigger_status = #{triggerStatus},
|
||||||
trigger_last_time = #{triggerLastTime},
|
trigger_last_time = #{triggerLastTime},
|
||||||
trigger_next_time = #{triggerNextTime}
|
trigger_next_time = #{triggerNextTime}
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="delete" parameterType="java.util.HashMap">
|
<delete id="delete" parameterType="java.util.HashMap">
|
||||||
DELETE
|
DELETE
|
||||||
FROM xxl_job_info
|
FROM xxl_job_info
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="getJobsByGroup" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
|
<select id="getJobsByGroup" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
|
||||||
SELECT <include refid="Base_Column_List" />
|
SELECT <include refid="Base_Column_List" />
|
||||||
FROM xxl_job_info AS t
|
FROM xxl_job_info AS t
|
||||||
WHERE t.job_group = #{jobGroup}
|
WHERE t.job_group = #{jobGroup}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findAllCount" resultType="int">
|
<select id="findAllCount" resultType="int">
|
||||||
SELECT count(1)
|
SELECT count(1)
|
||||||
FROM xxl_job_info
|
FROM xxl_job_info
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="scheduleJobQuery" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
|
<select id="scheduleJobQuery" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
|
||||||
SELECT <include refid="Base_Column_List" />
|
SELECT <include refid="Base_Column_List" />
|
||||||
FROM xxl_job_info AS t
|
FROM xxl_job_info AS t
|
||||||
WHERE t.trigger_status = 1
|
WHERE t.trigger_status = 1
|
||||||
and t.trigger_next_time <![CDATA[ <= ]]> #{maxNextTime}
|
and t.trigger_next_time <![CDATA[ <= ]]> #{maxNextTime}
|
||||||
ORDER BY id ASC
|
ORDER BY id ASC
|
||||||
LIMIT #{pagesize}
|
LIMIT #{pagesize}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<update id="scheduleUpdate" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" >
|
<update id="scheduleUpdate" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" >
|
||||||
UPDATE xxl_job_info
|
UPDATE xxl_job_info
|
||||||
SET
|
SET
|
||||||
trigger_last_time = #{triggerLastTime},
|
trigger_last_time = #{triggerLastTime},
|
||||||
trigger_next_time = #{triggerNextTime},
|
trigger_next_time = #{triggerNextTime},
|
||||||
trigger_status = #{triggerStatus}
|
trigger_status = #{triggerStatus}
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -1,71 +1,71 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.xxl.job.admin.dao.XxlJobLogGlueDao">
|
<mapper namespace="com.xxl.job.admin.dao.XxlJobLogGlueDao">
|
||||||
|
|
||||||
<resultMap id="XxlJobLogGlue" type="com.xxl.job.admin.core.model.XxlJobLogGlue" >
|
<resultMap id="XxlJobLogGlue" type="com.xxl.job.admin.core.model.XxlJobLogGlue" >
|
||||||
<result column="id" property="id" />
|
<result column="id" property="id" />
|
||||||
<result column="job_id" property="jobId" />
|
<result column="job_id" property="jobId" />
|
||||||
<result column="glue_type" property="glueType" />
|
<result column="glue_type" property="glueType" />
|
||||||
<result column="glue_source" property="glueSource" />
|
<result column="glue_source" property="glueSource" />
|
||||||
<result column="glue_remark" property="glueRemark" />
|
<result column="glue_remark" property="glueRemark" />
|
||||||
<result column="add_time" property="addTime" />
|
<result column="add_time" property="addTime" />
|
||||||
<result column="update_time" property="updateTime" />
|
<result column="update_time" property="updateTime" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
t.id,
|
t.id,
|
||||||
t.job_id,
|
t.job_id,
|
||||||
t.glue_type,
|
t.glue_type,
|
||||||
t.glue_source,
|
t.glue_source,
|
||||||
t.glue_remark,
|
t.glue_remark,
|
||||||
t.add_time,
|
t.add_time,
|
||||||
t.update_time
|
t.update_time
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLogGlue" useGeneratedKeys="true" keyProperty="id" >
|
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLogGlue" useGeneratedKeys="true" keyProperty="id" >
|
||||||
INSERT INTO xxl_job_logglue (
|
INSERT INTO xxl_job_logglue (
|
||||||
`job_id`,
|
`job_id`,
|
||||||
`glue_type`,
|
`glue_type`,
|
||||||
`glue_source`,
|
`glue_source`,
|
||||||
`glue_remark`,
|
`glue_remark`,
|
||||||
`add_time`,
|
`add_time`,
|
||||||
`update_time`
|
`update_time`
|
||||||
) VALUES (
|
) VALUES (
|
||||||
#{jobId},
|
#{jobId},
|
||||||
#{glueType},
|
#{glueType},
|
||||||
#{glueSource},
|
#{glueSource},
|
||||||
#{glueRemark},
|
#{glueRemark},
|
||||||
#{addTime},
|
#{addTime},
|
||||||
#{updateTime}
|
#{updateTime}
|
||||||
);
|
);
|
||||||
<!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
|
<!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
|
||||||
SELECT LAST_INSERT_ID()
|
SELECT LAST_INSERT_ID()
|
||||||
</selectKey>-->
|
</selectKey>-->
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<select id="findByJobId" parameterType="java.lang.Integer" resultMap="XxlJobLogGlue">
|
<select id="findByJobId" parameterType="java.lang.Integer" resultMap="XxlJobLogGlue">
|
||||||
SELECT <include refid="Base_Column_List" />
|
SELECT <include refid="Base_Column_List" />
|
||||||
FROM xxl_job_logglue AS t
|
FROM xxl_job_logglue AS t
|
||||||
WHERE t.job_id = #{jobId}
|
WHERE t.job_id = #{jobId}
|
||||||
ORDER BY id DESC
|
ORDER BY id DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<delete id="removeOld" >
|
<delete id="removeOld" >
|
||||||
DELETE FROM xxl_job_logglue
|
DELETE FROM xxl_job_logglue
|
||||||
WHERE id NOT in(
|
WHERE id NOT in(
|
||||||
SELECT id FROM(
|
SELECT id FROM(
|
||||||
SELECT id FROM xxl_job_logglue
|
SELECT id FROM xxl_job_logglue
|
||||||
WHERE `job_id` = #{jobId}
|
WHERE `job_id` = #{jobId}
|
||||||
ORDER BY update_time desc
|
ORDER BY update_time desc
|
||||||
LIMIT 0, #{limit}
|
LIMIT 0, #{limit}
|
||||||
) t1
|
) t1
|
||||||
) AND `job_id` = #{jobId}
|
) AND `job_id` = #{jobId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteByJobId" parameterType="java.lang.Integer" >
|
<delete id="deleteByJobId" parameterType="java.lang.Integer" >
|
||||||
DELETE FROM xxl_job_logglue
|
DELETE FROM xxl_job_logglue
|
||||||
WHERE `job_id` = #{jobId}
|
WHERE `job_id` = #{jobId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -1,273 +1,273 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.xxl.job.admin.dao.XxlJobLogDao">
|
<mapper namespace="com.xxl.job.admin.dao.XxlJobLogDao">
|
||||||
|
|
||||||
<resultMap id="XxlJobLog" type="com.xxl.job.admin.core.model.XxlJobLog" >
|
<resultMap id="XxlJobLog" type="com.xxl.job.admin.core.model.XxlJobLog" >
|
||||||
<result column="id" property="id" />
|
<result column="id" property="id" />
|
||||||
|
|
||||||
<result column="job_group" property="jobGroup" />
|
<result column="job_group" property="jobGroup" />
|
||||||
<result column="job_id" property="jobId" />
|
<result column="job_id" property="jobId" />
|
||||||
|
|
||||||
<result column="executor_address" property="executorAddress" />
|
<result column="executor_address" property="executorAddress" />
|
||||||
<result column="executor_handler" property="executorHandler" />
|
<result column="executor_handler" property="executorHandler" />
|
||||||
<result column="executor_param" property="executorParam" />
|
<result column="executor_param" property="executorParam" />
|
||||||
<result column="executor_sharding_param" property="executorShardingParam" />
|
<result column="executor_sharding_param" property="executorShardingParam" />
|
||||||
<result column="executor_fail_retry_count" property="executorFailRetryCount" />
|
<result column="executor_fail_retry_count" property="executorFailRetryCount" />
|
||||||
|
|
||||||
<result column="trigger_time" property="triggerTime" />
|
<result column="trigger_time" property="triggerTime" />
|
||||||
<result column="trigger_code" property="triggerCode" />
|
<result column="trigger_code" property="triggerCode" />
|
||||||
<result column="trigger_msg" property="triggerMsg" />
|
<result column="trigger_msg" property="triggerMsg" />
|
||||||
|
|
||||||
<result column="handle_time" property="handleTime" />
|
<result column="handle_time" property="handleTime" />
|
||||||
<result column="handle_code" property="handleCode" />
|
<result column="handle_code" property="handleCode" />
|
||||||
<result column="handle_msg" property="handleMsg" />
|
<result column="handle_msg" property="handleMsg" />
|
||||||
|
|
||||||
<result column="alarm_status" property="alarmStatus" />
|
<result column="alarm_status" property="alarmStatus" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
t.id,
|
t.id,
|
||||||
t.job_group,
|
t.job_group,
|
||||||
t.job_id,
|
t.job_id,
|
||||||
t.executor_address,
|
t.executor_address,
|
||||||
t.executor_handler,
|
t.executor_handler,
|
||||||
t.executor_param,
|
t.executor_param,
|
||||||
t.executor_sharding_param,
|
t.executor_sharding_param,
|
||||||
t.executor_fail_retry_count,
|
t.executor_fail_retry_count,
|
||||||
t.trigger_time,
|
t.trigger_time,
|
||||||
t.trigger_code,
|
t.trigger_code,
|
||||||
t.trigger_msg,
|
t.trigger_msg,
|
||||||
t.handle_time,
|
t.handle_time,
|
||||||
t.handle_code,
|
t.handle_code,
|
||||||
t.handle_msg,
|
t.handle_msg,
|
||||||
t.alarm_status
|
t.alarm_status
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="pageList" resultMap="XxlJobLog">
|
<select id="pageList" resultMap="XxlJobLog">
|
||||||
SELECT <include refid="Base_Column_List" />
|
SELECT <include refid="Base_Column_List" />
|
||||||
FROM xxl_job_log AS t
|
FROM xxl_job_log AS t
|
||||||
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
||||||
<if test="jobId==0 and jobGroup gt 0">
|
<if test="jobId==0 and jobGroup gt 0">
|
||||||
AND t.job_group = #{jobGroup}
|
AND t.job_group = #{jobGroup}
|
||||||
</if>
|
</if>
|
||||||
<if test="jobId gt 0">
|
<if test="jobId gt 0">
|
||||||
AND t.job_id = #{jobId}
|
AND t.job_id = #{jobId}
|
||||||
</if>
|
</if>
|
||||||
<if test="triggerTimeStart != null">
|
<if test="triggerTimeStart != null">
|
||||||
AND t.trigger_time <![CDATA[ >= ]]> #{triggerTimeStart}
|
AND t.trigger_time <![CDATA[ >= ]]> #{triggerTimeStart}
|
||||||
</if>
|
</if>
|
||||||
<if test="triggerTimeEnd != null">
|
<if test="triggerTimeEnd != null">
|
||||||
AND t.trigger_time <![CDATA[ <= ]]> #{triggerTimeEnd}
|
AND t.trigger_time <![CDATA[ <= ]]> #{triggerTimeEnd}
|
||||||
</if>
|
</if>
|
||||||
<if test="logStatus == 1" >
|
<if test="logStatus == 1" >
|
||||||
AND t.handle_code = 200
|
AND t.handle_code = 200
|
||||||
</if>
|
</if>
|
||||||
<if test="logStatus == 2" >
|
<if test="logStatus == 2" >
|
||||||
AND (
|
AND (
|
||||||
t.trigger_code NOT IN (0, 200) OR
|
t.trigger_code NOT IN (0, 200) OR
|
||||||
t.handle_code NOT IN (0, 200)
|
t.handle_code NOT IN (0, 200)
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="logStatus == 3" >
|
<if test="logStatus == 3" >
|
||||||
AND t.trigger_code = 200
|
AND t.trigger_code = 200
|
||||||
AND t.handle_code = 0
|
AND t.handle_code = 0
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
ORDER BY t.trigger_time DESC
|
ORDER BY t.trigger_time DESC
|
||||||
LIMIT #{offset}, #{pagesize}
|
LIMIT #{offset}, #{pagesize}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="pageListCount" resultType="int">
|
<select id="pageListCount" resultType="int">
|
||||||
SELECT count(1)
|
SELECT count(1)
|
||||||
FROM xxl_job_log AS t
|
FROM xxl_job_log AS t
|
||||||
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
||||||
<if test="jobId==0 and jobGroup gt 0">
|
<if test="jobId==0 and jobGroup gt 0">
|
||||||
AND t.job_group = #{jobGroup}
|
AND t.job_group = #{jobGroup}
|
||||||
</if>
|
</if>
|
||||||
<if test="jobId gt 0">
|
<if test="jobId gt 0">
|
||||||
AND t.job_id = #{jobId}
|
AND t.job_id = #{jobId}
|
||||||
</if>
|
</if>
|
||||||
<if test="triggerTimeStart != null">
|
<if test="triggerTimeStart != null">
|
||||||
AND t.trigger_time <![CDATA[ >= ]]> #{triggerTimeStart}
|
AND t.trigger_time <![CDATA[ >= ]]> #{triggerTimeStart}
|
||||||
</if>
|
</if>
|
||||||
<if test="triggerTimeEnd != null">
|
<if test="triggerTimeEnd != null">
|
||||||
AND t.trigger_time <![CDATA[ <= ]]> #{triggerTimeEnd}
|
AND t.trigger_time <![CDATA[ <= ]]> #{triggerTimeEnd}
|
||||||
</if>
|
</if>
|
||||||
<if test="logStatus == 1" >
|
<if test="logStatus == 1" >
|
||||||
AND t.handle_code = 200
|
AND t.handle_code = 200
|
||||||
</if>
|
</if>
|
||||||
<if test="logStatus == 2" >
|
<if test="logStatus == 2" >
|
||||||
AND (
|
AND (
|
||||||
t.trigger_code NOT IN (0, 200) OR
|
t.trigger_code NOT IN (0, 200) OR
|
||||||
t.handle_code NOT IN (0, 200)
|
t.handle_code NOT IN (0, 200)
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="logStatus == 3" >
|
<if test="logStatus == 3" >
|
||||||
AND t.trigger_code = 200
|
AND t.trigger_code = 200
|
||||||
AND t.handle_code = 0
|
AND t.handle_code = 0
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="load" parameterType="java.lang.Long" resultMap="XxlJobLog">
|
<select id="load" parameterType="java.lang.Long" resultMap="XxlJobLog">
|
||||||
SELECT <include refid="Base_Column_List" />
|
SELECT <include refid="Base_Column_List" />
|
||||||
FROM xxl_job_log AS t
|
FROM xxl_job_log AS t
|
||||||
WHERE t.id = #{id}
|
WHERE t.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLog" useGeneratedKeys="true" keyProperty="id" >
|
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLog" useGeneratedKeys="true" keyProperty="id" >
|
||||||
INSERT INTO xxl_job_log (
|
INSERT INTO xxl_job_log (
|
||||||
`job_group`,
|
`job_group`,
|
||||||
`job_id`,
|
`job_id`,
|
||||||
`trigger_time`,
|
`trigger_time`,
|
||||||
`trigger_code`,
|
`trigger_code`,
|
||||||
`handle_code`
|
`handle_code`
|
||||||
) VALUES (
|
) VALUES (
|
||||||
#{jobGroup},
|
#{jobGroup},
|
||||||
#{jobId},
|
#{jobId},
|
||||||
#{triggerTime},
|
#{triggerTime},
|
||||||
#{triggerCode},
|
#{triggerCode},
|
||||||
#{handleCode}
|
#{handleCode}
|
||||||
);
|
);
|
||||||
<!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
|
<!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
|
||||||
SELECT LAST_INSERT_ID()
|
SELECT LAST_INSERT_ID()
|
||||||
</selectKey>-->
|
</selectKey>-->
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="updateTriggerInfo" >
|
<update id="updateTriggerInfo" >
|
||||||
UPDATE xxl_job_log
|
UPDATE xxl_job_log
|
||||||
SET
|
SET
|
||||||
`trigger_time`= #{triggerTime},
|
`trigger_time`= #{triggerTime},
|
||||||
`trigger_code`= #{triggerCode},
|
`trigger_code`= #{triggerCode},
|
||||||
`trigger_msg`= #{triggerMsg},
|
`trigger_msg`= #{triggerMsg},
|
||||||
`executor_address`= #{executorAddress},
|
`executor_address`= #{executorAddress},
|
||||||
`executor_handler`=#{executorHandler},
|
`executor_handler`=#{executorHandler},
|
||||||
`executor_param`= #{executorParam},
|
`executor_param`= #{executorParam},
|
||||||
`executor_sharding_param`= #{executorShardingParam},
|
`executor_sharding_param`= #{executorShardingParam},
|
||||||
`executor_fail_retry_count`= #{executorFailRetryCount}
|
`executor_fail_retry_count`= #{executorFailRetryCount}
|
||||||
WHERE `id`= #{id}
|
WHERE `id`= #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateHandleInfo">
|
<update id="updateHandleInfo">
|
||||||
UPDATE xxl_job_log
|
UPDATE xxl_job_log
|
||||||
SET
|
SET
|
||||||
`handle_time`= #{handleTime},
|
`handle_time`= #{handleTime},
|
||||||
`handle_code`= #{handleCode},
|
`handle_code`= #{handleCode},
|
||||||
`handle_msg`= #{handleMsg}
|
`handle_msg`= #{handleMsg}
|
||||||
WHERE `id`= #{id}
|
WHERE `id`= #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="delete" >
|
<delete id="delete" >
|
||||||
delete from xxl_job_log
|
delete from xxl_job_log
|
||||||
WHERE job_id = #{jobId}
|
WHERE job_id = #{jobId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<!--<select id="triggerCountByDay" resultType="java.util.Map" >
|
<!--<select id="triggerCountByDay" resultType="java.util.Map" >
|
||||||
SELECT
|
SELECT
|
||||||
DATE_FORMAT(trigger_time,'%Y-%m-%d') triggerDay,
|
DATE_FORMAT(trigger_time,'%Y-%m-%d') triggerDay,
|
||||||
COUNT(handle_code) triggerDayCount,
|
COUNT(handle_code) triggerDayCount,
|
||||||
SUM(CASE WHEN (trigger_code in (0, 200) and handle_code = 0) then 1 else 0 end) as triggerDayCountRunning,
|
SUM(CASE WHEN (trigger_code in (0, 200) and handle_code = 0) then 1 else 0 end) as triggerDayCountRunning,
|
||||||
SUM(CASE WHEN handle_code = 200 then 1 else 0 end) as triggerDayCountSuc
|
SUM(CASE WHEN handle_code = 200 then 1 else 0 end) as triggerDayCountSuc
|
||||||
FROM xxl_job_log
|
FROM xxl_job_log
|
||||||
WHERE trigger_time BETWEEN #{from} and #{to}
|
WHERE trigger_time BETWEEN #{from} and #{to}
|
||||||
GROUP BY triggerDay
|
GROUP BY triggerDay
|
||||||
ORDER BY triggerDay
|
ORDER BY triggerDay
|
||||||
</select>-->
|
</select>-->
|
||||||
|
|
||||||
<select id="findLogReport" resultType="java.util.Map" >
|
<select id="findLogReport" resultType="java.util.Map" >
|
||||||
SELECT
|
SELECT
|
||||||
COUNT(handle_code) triggerDayCount,
|
COUNT(handle_code) triggerDayCount,
|
||||||
SUM(CASE WHEN (trigger_code in (0, 200) and handle_code = 0) then 1 else 0 end) as triggerDayCountRunning,
|
SUM(CASE WHEN (trigger_code in (0, 200) and handle_code = 0) then 1 else 0 end) as triggerDayCountRunning,
|
||||||
SUM(CASE WHEN handle_code = 200 then 1 else 0 end) as triggerDayCountSuc
|
SUM(CASE WHEN handle_code = 200 then 1 else 0 end) as triggerDayCountSuc
|
||||||
FROM xxl_job_log
|
FROM xxl_job_log
|
||||||
WHERE trigger_time BETWEEN #{from} and #{to}
|
WHERE trigger_time BETWEEN #{from} and #{to}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findClearLogIds" resultType="long" >
|
<select id="findClearLogIds" resultType="long" >
|
||||||
SELECT id FROM xxl_job_log
|
SELECT id FROM xxl_job_log
|
||||||
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
||||||
<if test="jobGroup gt 0">
|
<if test="jobGroup gt 0">
|
||||||
AND job_group = #{jobGroup}
|
AND job_group = #{jobGroup}
|
||||||
</if>
|
</if>
|
||||||
<if test="jobId gt 0">
|
<if test="jobId gt 0">
|
||||||
AND job_id = #{jobId}
|
AND job_id = #{jobId}
|
||||||
</if>
|
</if>
|
||||||
<if test="clearBeforeTime != null">
|
<if test="clearBeforeTime != null">
|
||||||
AND trigger_time <![CDATA[ <= ]]> #{clearBeforeTime}
|
AND trigger_time <![CDATA[ <= ]]> #{clearBeforeTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="clearBeforeNum gt 0">
|
<if test="clearBeforeNum gt 0">
|
||||||
AND id NOT in(
|
AND id NOT in(
|
||||||
SELECT id FROM(
|
SELECT id FROM(
|
||||||
SELECT id FROM xxl_job_log AS t
|
SELECT id FROM xxl_job_log AS t
|
||||||
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
||||||
<if test="jobGroup gt 0">
|
<if test="jobGroup gt 0">
|
||||||
AND t.job_group = #{jobGroup}
|
AND t.job_group = #{jobGroup}
|
||||||
</if>
|
</if>
|
||||||
<if test="jobId gt 0">
|
<if test="jobId gt 0">
|
||||||
AND t.job_id = #{jobId}
|
AND t.job_id = #{jobId}
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
ORDER BY t.trigger_time desc
|
ORDER BY t.trigger_time desc
|
||||||
LIMIT 0, #{clearBeforeNum}
|
LIMIT 0, #{clearBeforeNum}
|
||||||
) t1
|
) t1
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
order by id asc
|
order by id asc
|
||||||
LIMIT #{pagesize}
|
LIMIT #{pagesize}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<delete id="clearLog" >
|
<delete id="clearLog" >
|
||||||
delete from xxl_job_log
|
delete from xxl_job_log
|
||||||
WHERE id in
|
WHERE id in
|
||||||
<foreach collection="logIds" item="item" open="(" close=")" separator="," >
|
<foreach collection="logIds" item="item" open="(" close=")" separator="," >
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="findFailJobLogIds" resultType="long" >
|
<select id="findFailJobLogIds" resultType="long" >
|
||||||
SELECT id FROM `xxl_job_log`
|
SELECT id FROM `xxl_job_log`
|
||||||
WHERE !(
|
WHERE !(
|
||||||
(trigger_code in (0, 200) and handle_code = 0)
|
(trigger_code in (0, 200) and handle_code = 0)
|
||||||
OR
|
OR
|
||||||
(handle_code = 200)
|
(handle_code = 200)
|
||||||
)
|
)
|
||||||
AND `alarm_status` = 0
|
AND `alarm_status` = 0
|
||||||
ORDER BY id ASC
|
ORDER BY id ASC
|
||||||
LIMIT #{pagesize}
|
LIMIT #{pagesize}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<update id="updateAlarmStatus" >
|
<update id="updateAlarmStatus" >
|
||||||
UPDATE xxl_job_log
|
UPDATE xxl_job_log
|
||||||
SET
|
SET
|
||||||
`alarm_status` = #{newAlarmStatus}
|
`alarm_status` = #{newAlarmStatus}
|
||||||
WHERE `id`= #{logId} AND `alarm_status` = #{oldAlarmStatus}
|
WHERE `id`= #{logId} AND `alarm_status` = #{oldAlarmStatus}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="findLostJobIds" resultType="long" >
|
<select id="findLostJobIds" resultType="long" >
|
||||||
SELECT
|
SELECT
|
||||||
t.id
|
t.id
|
||||||
FROM
|
FROM
|
||||||
xxl_job_log t
|
xxl_job_log t
|
||||||
LEFT JOIN xxl_job_registry t2 ON t.executor_address = t2.registry_value
|
LEFT JOIN xxl_job_registry t2 ON t.executor_address = t2.registry_value
|
||||||
WHERE
|
WHERE
|
||||||
t.trigger_code = 200
|
t.trigger_code = 200
|
||||||
AND t.handle_code = 0
|
AND t.handle_code = 0
|
||||||
AND t.trigger_time <![CDATA[ <= ]]> #{losedTime}
|
AND t.trigger_time <![CDATA[ <= ]]> #{losedTime}
|
||||||
AND t2.id IS NULL;
|
AND t2.id IS NULL;
|
||||||
</select>
|
</select>
|
||||||
<!--
|
<!--
|
||||||
SELECT t.id
|
SELECT t.id
|
||||||
FROM xxl_job_log AS t
|
FROM xxl_job_log AS t
|
||||||
WHERE t.trigger_code = 200
|
WHERE t.trigger_code = 200
|
||||||
and t.handle_code = 0
|
and t.handle_code = 0
|
||||||
and t.trigger_time <![CDATA[ <= ]]> #{losedTime}
|
and t.trigger_time <![CDATA[ <= ]]> #{losedTime}
|
||||||
and t.executor_address not in (
|
and t.executor_address not in (
|
||||||
SELECT t2.registry_value
|
SELECT t2.registry_value
|
||||||
FROM xxl_job_registry AS t2
|
FROM xxl_job_registry AS t2
|
||||||
)
|
)
|
||||||
-->
|
-->
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -1,62 +1,62 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.xxl.job.admin.dao.XxlJobLogReportDao">
|
<mapper namespace="com.xxl.job.admin.dao.XxlJobLogReportDao">
|
||||||
|
|
||||||
<resultMap id="XxlJobLogReport" type="com.xxl.job.admin.core.model.XxlJobLogReport" >
|
<resultMap id="XxlJobLogReport" type="com.xxl.job.admin.core.model.XxlJobLogReport" >
|
||||||
<result column="id" property="id" />
|
<result column="id" property="id" />
|
||||||
<result column="trigger_day" property="triggerDay" />
|
<result column="trigger_day" property="triggerDay" />
|
||||||
<result column="running_count" property="runningCount" />
|
<result column="running_count" property="runningCount" />
|
||||||
<result column="suc_count" property="sucCount" />
|
<result column="suc_count" property="sucCount" />
|
||||||
<result column="fail_count" property="failCount" />
|
<result column="fail_count" property="failCount" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
t.id,
|
t.id,
|
||||||
t.trigger_day,
|
t.trigger_day,
|
||||||
t.running_count,
|
t.running_count,
|
||||||
t.suc_count,
|
t.suc_count,
|
||||||
t.fail_count
|
t.fail_count
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLogReport" useGeneratedKeys="true" keyProperty="id" >
|
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLogReport" useGeneratedKeys="true" keyProperty="id" >
|
||||||
INSERT INTO xxl_job_log_report (
|
INSERT INTO xxl_job_log_report (
|
||||||
`trigger_day`,
|
`trigger_day`,
|
||||||
`running_count`,
|
`running_count`,
|
||||||
`suc_count`,
|
`suc_count`,
|
||||||
`fail_count`
|
`fail_count`
|
||||||
) VALUES (
|
) VALUES (
|
||||||
#{triggerDay},
|
#{triggerDay},
|
||||||
#{runningCount},
|
#{runningCount},
|
||||||
#{sucCount},
|
#{sucCount},
|
||||||
#{failCount}
|
#{failCount}
|
||||||
);
|
);
|
||||||
<!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
|
<!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
|
||||||
SELECT LAST_INSERT_ID()
|
SELECT LAST_INSERT_ID()
|
||||||
</selectKey>-->
|
</selectKey>-->
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="update" >
|
<update id="update" >
|
||||||
UPDATE xxl_job_log_report
|
UPDATE xxl_job_log_report
|
||||||
SET `running_count` = #{runningCount},
|
SET `running_count` = #{runningCount},
|
||||||
`suc_count` = #{sucCount},
|
`suc_count` = #{sucCount},
|
||||||
`fail_count` = #{failCount}
|
`fail_count` = #{failCount}
|
||||||
WHERE `trigger_day` = #{triggerDay}
|
WHERE `trigger_day` = #{triggerDay}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="queryLogReport" resultMap="XxlJobLogReport">
|
<select id="queryLogReport" resultMap="XxlJobLogReport">
|
||||||
SELECT <include refid="Base_Column_List" />
|
SELECT <include refid="Base_Column_List" />
|
||||||
FROM xxl_job_log_report AS t
|
FROM xxl_job_log_report AS t
|
||||||
WHERE t.trigger_day between #{triggerDayFrom} and #{triggerDayTo}
|
WHERE t.trigger_day between #{triggerDayFrom} and #{triggerDayTo}
|
||||||
ORDER BY t.trigger_day ASC
|
ORDER BY t.trigger_day ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="queryLogReportTotal" resultMap="XxlJobLogReport">
|
<select id="queryLogReportTotal" resultMap="XxlJobLogReport">
|
||||||
SELECT
|
SELECT
|
||||||
SUM(running_count) running_count,
|
SUM(running_count) running_count,
|
||||||
SUM(suc_count) suc_count,
|
SUM(suc_count) suc_count,
|
||||||
SUM(fail_count) fail_count
|
SUM(fail_count) fail_count
|
||||||
FROM xxl_job_log_report AS t
|
FROM xxl_job_log_report AS t
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -1,43 +1,43 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.xxl.job.admin.dao.XxlJobRegistryDao">
|
<mapper namespace="com.xxl.job.admin.dao.XxlJobRegistryDao">
|
||||||
|
|
||||||
<resultMap id="XxlJobRegistry" type="com.xxl.job.admin.core.model.XxlJobRegistry" >
|
<resultMap id="XxlJobRegistry" type="com.xxl.job.admin.core.model.XxlJobRegistry" >
|
||||||
<result column="id" property="id" />
|
<result column="id" property="id" />
|
||||||
<result column="registry_group" property="registryGroup" />
|
<result column="registry_group" property="registryGroup" />
|
||||||
<result column="registry_key" property="registryKey" />
|
<result column="registry_key" property="registryKey" />
|
||||||
<result column="registry_value" property="registryValue" />
|
<result column="registry_value" property="registryValue" />
|
||||||
<result column="update_time" property="updateTime" />
|
<result column="update_time" property="updateTime" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
t.id,
|
t.id,
|
||||||
t.registry_group,
|
t.registry_group,
|
||||||
t.registry_key,
|
t.registry_key,
|
||||||
t.registry_value,
|
t.registry_value,
|
||||||
t.update_time
|
t.update_time
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="findDead" parameterType="java.util.HashMap" resultType="java.lang.Integer" >
|
<select id="findDead" parameterType="java.util.HashMap" resultType="java.lang.Integer" >
|
||||||
SELECT t.id
|
SELECT t.id
|
||||||
FROM xxl_job_registry AS t
|
FROM xxl_job_registry AS t
|
||||||
WHERE t.update_time <![CDATA[ < ]]> DATE_ADD(#{nowTime},INTERVAL -#{timeout} SECOND)
|
WHERE t.update_time <![CDATA[ < ]]> DATE_ADD(#{nowTime},INTERVAL -#{timeout} SECOND)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<delete id="removeDead" parameterType="java.lang.Integer" >
|
<delete id="removeDead" parameterType="java.lang.Integer" >
|
||||||
DELETE FROM xxl_job_registry
|
DELETE FROM xxl_job_registry
|
||||||
WHERE id in
|
WHERE id in
|
||||||
<foreach collection="ids" item="item" open="(" close=")" separator="," >
|
<foreach collection="ids" item="item" open="(" close=")" separator="," >
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="findAll" parameterType="java.util.HashMap" resultMap="XxlJobRegistry">
|
<select id="findAll" parameterType="java.util.HashMap" resultMap="XxlJobRegistry">
|
||||||
SELECT <include refid="Base_Column_List" />
|
SELECT <include refid="Base_Column_List" />
|
||||||
FROM xxl_job_registry AS t
|
FROM xxl_job_registry AS t
|
||||||
WHERE t.update_time <![CDATA[ > ]]> DATE_ADD(#{nowTime},INTERVAL -#{timeout} SECOND)
|
WHERE t.update_time <![CDATA[ > ]]> DATE_ADD(#{nowTime},INTERVAL -#{timeout} SECOND)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<update id="registryUpdate" >
|
<update id="registryUpdate" >
|
||||||
UPDATE xxl_job_registry
|
UPDATE xxl_job_registry
|
||||||
@ -52,11 +52,11 @@
|
|||||||
VALUES( #{registryGroup} , #{registryKey} , #{registryValue}, #{updateTime})
|
VALUES( #{registryGroup} , #{registryKey} , #{registryValue}, #{updateTime})
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<delete id="registryDelete" >
|
<delete id="registryDelete" >
|
||||||
DELETE FROM xxl_job_registry
|
DELETE FROM xxl_job_registry
|
||||||
WHERE registry_group = #{registryGroup}
|
WHERE registry_group = #{registryGroup}
|
||||||
AND registry_key = #{registryKey}
|
AND registry_key = #{registryKey}
|
||||||
AND registry_value = #{registryValue}
|
AND registry_value = #{registryValue}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -1,87 +1,87 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.xxl.job.admin.dao.XxlJobUserDao">
|
<mapper namespace="com.xxl.job.admin.dao.XxlJobUserDao">
|
||||||
|
|
||||||
<resultMap id="XxlJobUser" type="com.xxl.job.admin.core.model.XxlJobUser" >
|
<resultMap id="XxlJobUser" type="com.xxl.job.admin.core.model.XxlJobUser" >
|
||||||
<result column="id" property="id" />
|
<result column="id" property="id" />
|
||||||
<result column="username" property="username" />
|
<result column="username" property="username" />
|
||||||
<result column="password" property="password" />
|
<result column="password" property="password" />
|
||||||
<result column="role" property="role" />
|
<result column="role" property="role" />
|
||||||
<result column="permission" property="permission" />
|
<result column="permission" property="permission" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
t.id,
|
t.id,
|
||||||
t.username,
|
t.username,
|
||||||
t.password,
|
t.password,
|
||||||
t.role,
|
t.role,
|
||||||
t.permission
|
t.permission
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="pageList" parameterType="java.util.HashMap" resultMap="XxlJobUser">
|
<select id="pageList" parameterType="java.util.HashMap" resultMap="XxlJobUser">
|
||||||
SELECT <include refid="Base_Column_List" />
|
SELECT <include refid="Base_Column_List" />
|
||||||
FROM xxl_job_user AS t
|
FROM xxl_job_user AS t
|
||||||
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
||||||
<if test="username != null and username != ''">
|
<if test="username != null and username != ''">
|
||||||
AND t.username like CONCAT(CONCAT('%', #{username}), '%')
|
AND t.username like CONCAT(CONCAT('%', #{username}), '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="role gt -1">
|
<if test="role gt -1">
|
||||||
AND t.role = #{role}
|
AND t.role = #{role}
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
ORDER BY username ASC
|
ORDER BY username ASC
|
||||||
LIMIT #{offset}, #{pagesize}
|
LIMIT #{offset}, #{pagesize}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="pageListCount" parameterType="java.util.HashMap" resultType="int">
|
<select id="pageListCount" parameterType="java.util.HashMap" resultType="int">
|
||||||
SELECT count(1)
|
SELECT count(1)
|
||||||
FROM xxl_job_user AS t
|
FROM xxl_job_user AS t
|
||||||
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
||||||
<if test="username != null and username != ''">
|
<if test="username != null and username != ''">
|
||||||
AND t.username like CONCAT(CONCAT('%', #{username}), '%')
|
AND t.username like CONCAT(CONCAT('%', #{username}), '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="role gt -1">
|
<if test="role gt -1">
|
||||||
AND t.role = #{role}
|
AND t.role = #{role}
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="loadByUserName" parameterType="java.util.HashMap" resultMap="XxlJobUser">
|
<select id="loadByUserName" parameterType="java.util.HashMap" resultMap="XxlJobUser">
|
||||||
SELECT <include refid="Base_Column_List" />
|
SELECT <include refid="Base_Column_List" />
|
||||||
FROM xxl_job_user AS t
|
FROM xxl_job_user AS t
|
||||||
WHERE t.username = #{username}
|
WHERE t.username = #{username}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobUser" useGeneratedKeys="true" keyProperty="id" >
|
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobUser" useGeneratedKeys="true" keyProperty="id" >
|
||||||
INSERT INTO xxl_job_user (
|
INSERT INTO xxl_job_user (
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
role,
|
role,
|
||||||
permission
|
permission
|
||||||
) VALUES (
|
) VALUES (
|
||||||
#{username},
|
#{username},
|
||||||
#{password},
|
#{password},
|
||||||
#{role},
|
#{role},
|
||||||
#{permission}
|
#{permission}
|
||||||
);
|
);
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobUser" >
|
<update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobUser" >
|
||||||
UPDATE xxl_job_user
|
UPDATE xxl_job_user
|
||||||
SET
|
SET
|
||||||
<if test="password != null and password != ''">
|
<if test="password != null and password != ''">
|
||||||
password = #{password},
|
password = #{password},
|
||||||
</if>
|
</if>
|
||||||
role = #{role},
|
role = #{role},
|
||||||
permission = #{permission}
|
permission = #{permission}
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="delete" parameterType="java.util.HashMap">
|
<delete id="delete" parameterType="java.util.HashMap">
|
||||||
DELETE
|
DELETE
|
||||||
FROM xxl_job_user
|
FROM xxl_job_user
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -1,48 +1,48 @@
|
|||||||
$(function() {
|
$(function() {
|
||||||
|
|
||||||
// init date tables
|
// init date tables
|
||||||
var userListTable = $("#user_list").dataTable({
|
var userListTable = $("#user_list").dataTable({
|
||||||
"deferRender": true,
|
"deferRender": true,
|
||||||
"processing" : true,
|
"processing" : true,
|
||||||
"serverSide": true,
|
"serverSide": true,
|
||||||
"ajax": {
|
"ajax": {
|
||||||
url: base_url + "/user/pageList",
|
url: base_url + "/user/pageList",
|
||||||
type:"post",
|
type:"post",
|
||||||
data : function ( d ) {
|
data : function ( d ) {
|
||||||
var obj = {};
|
var obj = {};
|
||||||
obj.username = $('#username').val();
|
obj.username = $('#username').val();
|
||||||
obj.role = $('#role').val();
|
obj.role = $('#role').val();
|
||||||
obj.start = d.start;
|
obj.start = d.start;
|
||||||
obj.length = d.length;
|
obj.length = d.length;
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"searching": false,
|
"searching": false,
|
||||||
"ordering": false,
|
"ordering": false,
|
||||||
//"scrollX": true, // scroll x,close self-adaption
|
//"scrollX": true, // scroll x,close self-adaption
|
||||||
"columns": [
|
"columns": [
|
||||||
{
|
{
|
||||||
"data": 'id',
|
"data": 'id',
|
||||||
"visible" : false,
|
"visible" : false,
|
||||||
"width":'10%'
|
"width":'10%'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"data": 'username',
|
"data": 'username',
|
||||||
"visible" : true,
|
"visible" : true,
|
||||||
"width":'20%'
|
"width":'20%'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"data": 'password',
|
"data": 'password',
|
||||||
"visible" : false,
|
"visible" : false,
|
||||||
"width":'20%',
|
"width":'20%',
|
||||||
"render": function ( data, type, row ) {
|
"render": function ( data, type, row ) {
|
||||||
return '*********';
|
return '*********';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"data": 'role',
|
"data": 'role',
|
||||||
"visible" : true,
|
"visible" : true,
|
||||||
"width":'10%',
|
"width":'10%',
|
||||||
"render": function ( data, type, row ) {
|
"render": function ( data, type, row ) {
|
||||||
if (data == 1) {
|
if (data == 1) {
|
||||||
return I18n.user_role_admin
|
return I18n.user_role_admin
|
||||||
@ -50,101 +50,101 @@ $(function() {
|
|||||||
return I18n.user_role_normal
|
return I18n.user_role_normal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"data": 'permission',
|
"data": 'permission',
|
||||||
"width":'10%',
|
"width":'10%',
|
||||||
"visible" : false
|
"visible" : false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"data": I18n.system_opt ,
|
"data": I18n.system_opt ,
|
||||||
"width":'15%',
|
"width":'15%',
|
||||||
"render": function ( data, type, row ) {
|
"render": function ( data, type, row ) {
|
||||||
return function(){
|
return function(){
|
||||||
// html
|
// html
|
||||||
tableData['key'+row.id] = row;
|
tableData['key'+row.id] = row;
|
||||||
var html = '<p id="'+ row.id +'" >'+
|
var html = '<p id="'+ row.id +'" >'+
|
||||||
'<button class="btn btn-warning btn-xs update" type="button">'+ I18n.system_opt_edit +'</button> '+
|
'<button class="btn btn-warning btn-xs update" type="button">'+ I18n.system_opt_edit +'</button> '+
|
||||||
'<button class="btn btn-danger btn-xs delete" type="button">'+ I18n.system_opt_del +'</button> '+
|
'<button class="btn btn-danger btn-xs delete" type="button">'+ I18n.system_opt_del +'</button> '+
|
||||||
'</p>';
|
'</p>';
|
||||||
|
|
||||||
return html;
|
return html;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"language" : {
|
"language" : {
|
||||||
"sProcessing" : I18n.dataTable_sProcessing ,
|
"sProcessing" : I18n.dataTable_sProcessing ,
|
||||||
"sLengthMenu" : I18n.dataTable_sLengthMenu ,
|
"sLengthMenu" : I18n.dataTable_sLengthMenu ,
|
||||||
"sZeroRecords" : I18n.dataTable_sZeroRecords ,
|
"sZeroRecords" : I18n.dataTable_sZeroRecords ,
|
||||||
"sInfo" : I18n.dataTable_sInfo ,
|
"sInfo" : I18n.dataTable_sInfo ,
|
||||||
"sInfoEmpty" : I18n.dataTable_sInfoEmpty ,
|
"sInfoEmpty" : I18n.dataTable_sInfoEmpty ,
|
||||||
"sInfoFiltered" : I18n.dataTable_sInfoFiltered ,
|
"sInfoFiltered" : I18n.dataTable_sInfoFiltered ,
|
||||||
"sInfoPostFix" : "",
|
"sInfoPostFix" : "",
|
||||||
"sSearch" : I18n.dataTable_sSearch ,
|
"sSearch" : I18n.dataTable_sSearch ,
|
||||||
"sUrl" : "",
|
"sUrl" : "",
|
||||||
"sEmptyTable" : I18n.dataTable_sEmptyTable ,
|
"sEmptyTable" : I18n.dataTable_sEmptyTable ,
|
||||||
"sLoadingRecords" : I18n.dataTable_sLoadingRecords ,
|
"sLoadingRecords" : I18n.dataTable_sLoadingRecords ,
|
||||||
"sInfoThousands" : ",",
|
"sInfoThousands" : ",",
|
||||||
"oPaginate" : {
|
"oPaginate" : {
|
||||||
"sFirst" : I18n.dataTable_sFirst ,
|
"sFirst" : I18n.dataTable_sFirst ,
|
||||||
"sPrevious" : I18n.dataTable_sPrevious ,
|
"sPrevious" : I18n.dataTable_sPrevious ,
|
||||||
"sNext" : I18n.dataTable_sNext ,
|
"sNext" : I18n.dataTable_sNext ,
|
||||||
"sLast" : I18n.dataTable_sLast
|
"sLast" : I18n.dataTable_sLast
|
||||||
},
|
},
|
||||||
"oAria" : {
|
"oAria" : {
|
||||||
"sSortAscending" : I18n.dataTable_sSortAscending ,
|
"sSortAscending" : I18n.dataTable_sSortAscending ,
|
||||||
"sSortDescending" : I18n.dataTable_sSortDescending
|
"sSortDescending" : I18n.dataTable_sSortDescending
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// table data
|
// table data
|
||||||
var tableData = {};
|
var tableData = {};
|
||||||
|
|
||||||
// search btn
|
// search btn
|
||||||
$('#searchBtn').on('click', function(){
|
$('#searchBtn').on('click', function(){
|
||||||
userListTable.fnDraw();
|
userListTable.fnDraw();
|
||||||
});
|
});
|
||||||
|
|
||||||
// job operate
|
// job operate
|
||||||
$("#user_list").on('click', '.delete',function() {
|
$("#user_list").on('click', '.delete',function() {
|
||||||
var id = $(this).parent('p').attr("id");
|
var id = $(this).parent('p').attr("id");
|
||||||
|
|
||||||
layer.confirm( I18n.system_ok + I18n.system_opt_del + '?', {
|
layer.confirm( I18n.system_ok + I18n.system_opt_del + '?', {
|
||||||
icon: 3,
|
icon: 3,
|
||||||
title: I18n.system_tips ,
|
title: I18n.system_tips ,
|
||||||
btn: [ I18n.system_ok, I18n.system_cancel ]
|
btn: [ I18n.system_ok, I18n.system_cancel ]
|
||||||
}, function(index){
|
}, function(index){
|
||||||
layer.close(index);
|
layer.close(index);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : 'POST',
|
type : 'POST',
|
||||||
url : base_url + "/user/remove",
|
url : base_url + "/user/remove",
|
||||||
data : {
|
data : {
|
||||||
"id" : id
|
"id" : id
|
||||||
},
|
},
|
||||||
dataType : "json",
|
dataType : "json",
|
||||||
success : function(data){
|
success : function(data){
|
||||||
if (data.code == 200) {
|
if (data.code == 200) {
|
||||||
layer.msg( I18n.system_success );
|
layer.msg( I18n.system_success );
|
||||||
userListTable.fnDraw(false);
|
userListTable.fnDraw(false);
|
||||||
} else {
|
} else {
|
||||||
layer.msg( data.msg || I18n.system_opt_del + I18n.system_fail );
|
layer.msg( data.msg || I18n.system_opt_del + I18n.system_fail );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// add role
|
// add role
|
||||||
$("#addModal .form input[name=role]").change(function () {
|
$("#addModal .form input[name=role]").change(function () {
|
||||||
var role = $(this).val();
|
var role = $(this).val();
|
||||||
if (role == 1) {
|
if (role == 1) {
|
||||||
$("#addModal .form input[name=permission]").parents('.form-group').hide();
|
$("#addModal .form input[name=permission]").parents('.form-group').hide();
|
||||||
} else {
|
} else {
|
||||||
$("#addModal .form input[name=permission]").parents('.form-group').show();
|
$("#addModal .form input[name=permission]").parents('.form-group').show();
|
||||||
}
|
}
|
||||||
$("#addModal .form input[name='permission']").prop("checked",false);
|
$("#addModal .form input[name='permission']").prop("checked",false);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -154,20 +154,20 @@ $(function() {
|
|||||||
return this.optional(element) || valid.test(value);
|
return this.optional(element) || valid.test(value);
|
||||||
}, I18n.user_username_valid );
|
}, I18n.user_username_valid );
|
||||||
|
|
||||||
// add
|
// add
|
||||||
$(".add").click(function(){
|
$(".add").click(function(){
|
||||||
$('#addModal').modal({backdrop: false, keyboard: false}).modal('show');
|
$('#addModal').modal({backdrop: false, keyboard: false}).modal('show');
|
||||||
});
|
});
|
||||||
var addModalValidate = $("#addModal .form").validate({
|
var addModalValidate = $("#addModal .form").validate({
|
||||||
errorElement : 'span',
|
errorElement : 'span',
|
||||||
errorClass : 'help-block',
|
errorClass : 'help-block',
|
||||||
focusInvalid : true,
|
focusInvalid : true,
|
||||||
rules : {
|
rules : {
|
||||||
username : {
|
username : {
|
||||||
required : true,
|
required : true,
|
||||||
rangelength:[4, 20],
|
rangelength:[4, 20],
|
||||||
myValid01: true
|
myValid01: true
|
||||||
},
|
},
|
||||||
password : {
|
password : {
|
||||||
required : true,
|
required : true,
|
||||||
rangelength:[4, 20]
|
rangelength:[4, 20]
|
||||||
@ -175,7 +175,7 @@ $(function() {
|
|||||||
},
|
},
|
||||||
messages : {
|
messages : {
|
||||||
username : {
|
username : {
|
||||||
required : I18n.system_please_input + I18n.user_username,
|
required : I18n.system_please_input + I18n.user_username,
|
||||||
rangelength: I18n.system_lengh_limit + "[4-20]"
|
rangelength: I18n.system_lengh_limit + "[4-20]"
|
||||||
},
|
},
|
||||||
password : {
|
password : {
|
||||||
@ -183,7 +183,7 @@ $(function() {
|
|||||||
rangelength: I18n.system_lengh_limit + "[4-20]"
|
rangelength: I18n.system_lengh_limit + "[4-20]"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
highlight : function(element) {
|
highlight : function(element) {
|
||||||
$(element).closest('.form-group').addClass('has-error');
|
$(element).closest('.form-group').addClass('has-error');
|
||||||
},
|
},
|
||||||
success : function(label) {
|
success : function(label) {
|
||||||
@ -200,38 +200,38 @@ $(function() {
|
|||||||
permissionArr.push($(this).val());
|
permissionArr.push($(this).val());
|
||||||
});
|
});
|
||||||
|
|
||||||
var paramData = {
|
var paramData = {
|
||||||
"username": $("#addModal .form input[name=username]").val(),
|
"username": $("#addModal .form input[name=username]").val(),
|
||||||
"password": $("#addModal .form input[name=password]").val(),
|
"password": $("#addModal .form input[name=password]").val(),
|
||||||
"role": $("#addModal .form input[name=role]:checked").val(),
|
"role": $("#addModal .form input[name=role]:checked").val(),
|
||||||
"permission": permissionArr.join(',')
|
"permission": permissionArr.join(',')
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(base_url + "/user/add", paramData, function(data, status) {
|
$.post(base_url + "/user/add", paramData, function(data, status) {
|
||||||
if (data.code == "200") {
|
if (data.code == "200") {
|
||||||
$('#addModal').modal('hide');
|
$('#addModal').modal('hide');
|
||||||
|
|
||||||
layer.msg( I18n.system_add_suc );
|
layer.msg( I18n.system_add_suc );
|
||||||
userListTable.fnDraw();
|
userListTable.fnDraw();
|
||||||
} else {
|
} else {
|
||||||
layer.open({
|
layer.open({
|
||||||
title: I18n.system_tips ,
|
title: I18n.system_tips ,
|
||||||
btn: [ I18n.system_ok ],
|
btn: [ I18n.system_ok ],
|
||||||
content: (data.msg || I18n.system_add_fail),
|
content: (data.msg || I18n.system_add_fail),
|
||||||
icon: '2'
|
icon: '2'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$("#addModal").on('hide.bs.modal', function () {
|
$("#addModal").on('hide.bs.modal', function () {
|
||||||
$("#addModal .form")[0].reset();
|
$("#addModal .form")[0].reset();
|
||||||
addModalValidate.resetForm();
|
addModalValidate.resetForm();
|
||||||
$("#addModal .form .form-group").removeClass("has-error");
|
$("#addModal .form .form-group").removeClass("has-error");
|
||||||
$(".remote_panel").show(); // remote
|
$(".remote_panel").show(); // remote
|
||||||
|
|
||||||
$("#addModal .form input[name=permission]").parents('.form-group').show();
|
$("#addModal .form input[name=permission]").parents('.form-group').show();
|
||||||
});
|
});
|
||||||
|
|
||||||
// update role
|
// update role
|
||||||
$("#updateModal .form input[name=role]").change(function () {
|
$("#updateModal .form input[name=role]").change(function () {
|
||||||
@ -244,21 +244,21 @@ $(function() {
|
|||||||
$("#updateModal .form input[name='permission']").prop("checked",false);
|
$("#updateModal .form input[name='permission']").prop("checked",false);
|
||||||
});
|
});
|
||||||
|
|
||||||
// update
|
// update
|
||||||
$("#user_list").on('click', '.update',function() {
|
$("#user_list").on('click', '.update',function() {
|
||||||
|
|
||||||
var id = $(this).parent('p').attr("id");
|
var id = $(this).parent('p').attr("id");
|
||||||
var row = tableData['key'+id];
|
var row = tableData['key'+id];
|
||||||
|
|
||||||
// base data
|
// base data
|
||||||
$("#updateModal .form input[name='id']").val( row.id );
|
$("#updateModal .form input[name='id']").val( row.id );
|
||||||
$("#updateModal .form input[name='username']").val( row.username );
|
$("#updateModal .form input[name='username']").val( row.username );
|
||||||
$("#updateModal .form input[name='password']").val( '' );
|
$("#updateModal .form input[name='password']").val( '' );
|
||||||
$("#updateModal .form input[name='role'][value='"+ row.role +"']").click();
|
$("#updateModal .form input[name='role'][value='"+ row.role +"']").click();
|
||||||
var permissionArr = [];
|
var permissionArr = [];
|
||||||
if (row.permission) {
|
if (row.permission) {
|
||||||
permissionArr = row.permission.split(",");
|
permissionArr = row.permission.split(",");
|
||||||
}
|
}
|
||||||
$("#updateModal .form input[name='permission']").each(function () {
|
$("#updateModal .form input[name='permission']").each(function () {
|
||||||
if($.inArray($(this).val(), permissionArr) > -1) {
|
if($.inArray($(this).val(), permissionArr) > -1) {
|
||||||
$(this).prop("checked",true);
|
$(this).prop("checked",true);
|
||||||
@ -267,14 +267,14 @@ $(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// show
|
// show
|
||||||
$('#updateModal').modal({backdrop: false, keyboard: false}).modal('show');
|
$('#updateModal').modal({backdrop: false, keyboard: false}).modal('show');
|
||||||
});
|
});
|
||||||
var updateModalValidate = $("#updateModal .form").validate({
|
var updateModalValidate = $("#updateModal .form").validate({
|
||||||
errorElement : 'span',
|
errorElement : 'span',
|
||||||
errorClass : 'help-block',
|
errorClass : 'help-block',
|
||||||
focusInvalid : true,
|
focusInvalid : true,
|
||||||
highlight : function(element) {
|
highlight : function(element) {
|
||||||
$(element).closest('.form-group').addClass('has-error');
|
$(element).closest('.form-group').addClass('has-error');
|
||||||
},
|
},
|
||||||
success : function(label) {
|
success : function(label) {
|
||||||
@ -314,15 +314,15 @@ $(function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$("#updateModal").on('hide.bs.modal', function () {
|
$("#updateModal").on('hide.bs.modal', function () {
|
||||||
$("#updateModal .form")[0].reset();
|
$("#updateModal .form")[0].reset();
|
||||||
updateModalValidate.resetForm();
|
updateModalValidate.resetForm();
|
||||||
$("#updateModal .form .form-group").removeClass("has-error");
|
$("#updateModal .form .form-group").removeClass("has-error");
|
||||||
$(".remote_panel").show(); // remote
|
$(".remote_panel").show(); // remote
|
||||||
|
|
||||||
$("#updateModal .form input[name=permission]").parents('.form-group').show();
|
$("#updateModal .form input[name=permission]").parents('.form-group').show();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -30,9 +30,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="selectDbTableColumnsByName" parameterType="String" resultMap="GenTableColumnResult">
|
<select id="selectDbTableColumnsByName" parameterType="String" resultMap="GenTableColumnResult">
|
||||||
select column_name, (case when (is_nullable = 'no' <![CDATA[ && ]]> column_key != 'PRI') then '1' else null end) as is_required, (case when column_key = 'PRI' then '1' else '0' end) as is_pk, ordinal_position as sort, column_comment, (case when extra = 'auto_increment' then '1' else '0' end) as is_increment, column_type
|
select column_name, (case when (is_nullable = 'no' <![CDATA[ && ]]> column_key != 'PRI') then '1' else null end) as is_required, (case when column_key = 'PRI' then '1' else '0' end) as is_pk, ordinal_position as sort, column_comment, (case when extra = 'auto_increment' then '1' else '0' end) as is_increment, column_type
|
||||||
from information_schema.columns where table_schema = (select database()) and table_name = (#{tableName})
|
from information_schema.columns where table_schema = (select database()) and table_name = (#{tableName})
|
||||||
order by ordinal_position
|
order by ordinal_position
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -4,31 +4,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.ruoyi.generator.mapper.GenTableMapper">
|
<mapper namespace="com.ruoyi.generator.mapper.GenTableMapper">
|
||||||
|
|
||||||
<resultMap type="GenTable" id="GenTableResult">
|
<resultMap type="GenTable" id="GenTableResult">
|
||||||
<id property="tableId" column="table_id" />
|
<id property="tableId" column="table_id" />
|
||||||
<result property="tableName" column="table_name" />
|
<result property="tableName" column="table_name" />
|
||||||
<result property="tableComment" column="table_comment" />
|
<result property="tableComment" column="table_comment" />
|
||||||
<result property="subTableName" column="sub_table_name" />
|
<result property="subTableName" column="sub_table_name" />
|
||||||
<result property="subTableFkName" column="sub_table_fk_name" />
|
<result property="subTableFkName" column="sub_table_fk_name" />
|
||||||
<result property="className" column="class_name" />
|
<result property="className" column="class_name" />
|
||||||
<result property="tplCategory" column="tpl_category" />
|
<result property="tplCategory" column="tpl_category" />
|
||||||
<result property="packageName" column="package_name" />
|
<result property="packageName" column="package_name" />
|
||||||
<result property="moduleName" column="module_name" />
|
<result property="moduleName" column="module_name" />
|
||||||
<result property="businessName" column="business_name" />
|
<result property="businessName" column="business_name" />
|
||||||
<result property="functionName" column="function_name" />
|
<result property="functionName" column="function_name" />
|
||||||
<result property="functionAuthor" column="function_author" />
|
<result property="functionAuthor" column="function_author" />
|
||||||
<result property="genType" column="gen_type" />
|
<result property="genType" column="gen_type" />
|
||||||
<result property="genPath" column="gen_path" />
|
<result property="genPath" column="gen_path" />
|
||||||
<result property="options" column="options" />
|
<result property="options" column="options" />
|
||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
<result property="remark" column="remark" />
|
<result property="remark" column="remark" />
|
||||||
<collection property="columns" javaType="java.util.List" resultMap="GenTableColumnResult" />
|
<collection property="columns" javaType="java.util.List" resultMap="GenTableColumnResult" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap type="GenTableColumn" id="GenTableColumnResult">
|
<resultMap type="GenTableColumn" id="GenTableColumnResult">
|
||||||
<id property="columnId" column="column_id" />
|
<id property="columnId" column="column_id" />
|
||||||
<result property="tableId" column="table_id" />
|
<result property="tableId" column="table_id" />
|
||||||
<result property="columnName" column="column_name" />
|
<result property="columnName" column="column_name" />
|
||||||
@ -53,124 +53,124 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectGenTableVo">
|
<sql id="selectGenTableVo">
|
||||||
select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table
|
select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectPageGenTableList" parameterType="GenTable" resultMap="GenTableResult">
|
<select id="selectPageGenTableList" parameterType="GenTable" resultMap="GenTableResult">
|
||||||
<include refid="selectGenTableVo"/>
|
<include refid="selectGenTableVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="genTable.tableName != null and genTable.tableName != ''">
|
<if test="genTable.tableName != null and genTable.tableName != ''">
|
||||||
AND lower(table_name) like lower(concat('%', #{genTable.tableName}, '%'))
|
AND lower(table_name) like lower(concat('%', #{genTable.tableName}, '%'))
|
||||||
</if>
|
</if>
|
||||||
<if test="genTable.tableComment != null and genTable.tableComment != ''">
|
<if test="genTable.tableComment != null and genTable.tableComment != ''">
|
||||||
AND lower(table_comment) like lower(concat('%', #{genTable.tableComment}, '%'))
|
AND lower(table_comment) like lower(concat('%', #{genTable.tableComment}, '%'))
|
||||||
</if>
|
</if>
|
||||||
<if test="genTable.params.beginTime != null and genTable.params.beginTime != ''"><!-- 开始时间检索 -->
|
<if test="genTable.params.beginTime != null and genTable.params.beginTime != ''"><!-- 开始时间检索 -->
|
||||||
AND date_format(create_time,'%y%m%d') >= date_format(#{genTable.params.beginTime},'%y%m%d')
|
AND date_format(create_time,'%y%m%d') >= date_format(#{genTable.params.beginTime},'%y%m%d')
|
||||||
</if>
|
</if>
|
||||||
<if test="genTable.params.endTime != null and genTable.params.endTime != ''"><!-- 结束时间检索 -->
|
<if test="genTable.params.endTime != null and genTable.params.endTime != ''"><!-- 结束时间检索 -->
|
||||||
AND date_format(create_time,'%y%m%d') <= date_format(#{genTable.params.endTime},'%y%m%d')
|
AND date_format(create_time,'%y%m%d') <= date_format(#{genTable.params.endTime},'%y%m%d')
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectPageDbTableList" parameterType="GenTable" resultMap="GenTableResult">
|
<select id="selectPageDbTableList" parameterType="GenTable" resultMap="GenTableResult">
|
||||||
select table_name, table_comment, create_time, update_time from information_schema.tables
|
select table_name, table_comment, create_time, update_time from information_schema.tables
|
||||||
where table_schema = (select database())
|
where table_schema = (select database())
|
||||||
AND table_name NOT LIKE 'xxl_job_%' AND table_name NOT LIKE 'gen_%'
|
AND table_name NOT LIKE 'xxl_job_%' AND table_name NOT LIKE 'gen_%'
|
||||||
AND table_name NOT IN (select table_name from gen_table)
|
AND table_name NOT IN (select table_name from gen_table)
|
||||||
<if test="genTable.tableName != null and genTable.tableName != ''">
|
<if test="genTable.tableName != null and genTable.tableName != ''">
|
||||||
AND lower(table_name) like lower(concat('%', #{genTable.tableName}, '%'))
|
AND lower(table_name) like lower(concat('%', #{genTable.tableName}, '%'))
|
||||||
</if>
|
</if>
|
||||||
<if test="genTable.tableComment != null and genTable.tableComment != ''">
|
<if test="genTable.tableComment != null and genTable.tableComment != ''">
|
||||||
AND lower(table_comment) like lower(concat('%', #{genTable.tableComment}, '%'))
|
AND lower(table_comment) like lower(concat('%', #{genTable.tableComment}, '%'))
|
||||||
</if>
|
</if>
|
||||||
<if test="genTable.params.beginTime != null and genTable.params.beginTime != ''"><!-- 开始时间检索 -->
|
<if test="genTable.params.beginTime != null and genTable.params.beginTime != ''"><!-- 开始时间检索 -->
|
||||||
AND date_format(create_time,'%y%m%d') >= date_format(#{genTable.params.beginTime},'%y%m%d')
|
AND date_format(create_time,'%y%m%d') >= date_format(#{genTable.params.beginTime},'%y%m%d')
|
||||||
</if>
|
</if>
|
||||||
<if test="genTable.params.endTime != null and genTable.params.endTime != ''"><!-- 结束时间检索 -->
|
<if test="genTable.params.endTime != null and genTable.params.endTime != ''"><!-- 结束时间检索 -->
|
||||||
AND date_format(create_time,'%y%m%d') <= date_format(#{genTable.params.endTime},'%y%m%d')
|
AND date_format(create_time,'%y%m%d') <= date_format(#{genTable.params.endTime},'%y%m%d')
|
||||||
</if>
|
</if>
|
||||||
order by create_time desc
|
|
||||||
</select>
|
|
||||||
|
|
||||||
|
|
||||||
<select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult">
|
|
||||||
<include refid="selectGenTableVo"/>
|
|
||||||
<where>
|
|
||||||
<if test="tableName != null and tableName != ''">
|
|
||||||
AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
|
|
||||||
</if>
|
|
||||||
<if test="tableComment != null and tableComment != ''">
|
|
||||||
AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
|
|
||||||
</if>
|
|
||||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
|
||||||
AND date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
|
||||||
</if>
|
|
||||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
|
||||||
AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectDbTableList" parameterType="GenTable" resultMap="GenTableResult">
|
|
||||||
select table_name, table_comment, create_time, update_time from information_schema.tables
|
|
||||||
where table_schema = (select database())
|
|
||||||
AND table_name NOT LIKE 'xxl_job_%' AND table_name NOT LIKE 'gen_%'
|
|
||||||
AND table_name NOT IN (select table_name from gen_table)
|
|
||||||
<if test="tableName != null and tableName != ''">
|
|
||||||
AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
|
|
||||||
</if>
|
|
||||||
<if test="tableComment != null and tableComment != ''">
|
|
||||||
AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
|
|
||||||
</if>
|
|
||||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
|
||||||
AND date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
|
||||||
</if>
|
|
||||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
|
||||||
AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
|
||||||
</if>
|
|
||||||
order by create_time desc
|
order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDbTableListByNames" resultMap="GenTableResult">
|
|
||||||
select table_name, table_comment, create_time, update_time from information_schema.tables
|
<select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult">
|
||||||
where table_name NOT LIKE 'xxl_job_%' and table_name NOT LIKE 'gen_%' and table_schema = (select database())
|
<include refid="selectGenTableVo"/>
|
||||||
and table_name in
|
<where>
|
||||||
<foreach collection="array" item="name" open="(" separator="," close=")">
|
<if test="tableName != null and tableName != ''">
|
||||||
#{name}
|
AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
|
||||||
|
</if>
|
||||||
|
<if test="tableComment != null and tableComment != ''">
|
||||||
|
AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
|
||||||
|
</if>
|
||||||
|
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||||
|
AND date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
||||||
|
</if>
|
||||||
|
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||||
|
AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDbTableList" parameterType="GenTable" resultMap="GenTableResult">
|
||||||
|
select table_name, table_comment, create_time, update_time from information_schema.tables
|
||||||
|
where table_schema = (select database())
|
||||||
|
AND table_name NOT LIKE 'xxl_job_%' AND table_name NOT LIKE 'gen_%'
|
||||||
|
AND table_name NOT IN (select table_name from gen_table)
|
||||||
|
<if test="tableName != null and tableName != ''">
|
||||||
|
AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
|
||||||
|
</if>
|
||||||
|
<if test="tableComment != null and tableComment != ''">
|
||||||
|
AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
|
||||||
|
</if>
|
||||||
|
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||||
|
AND date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
||||||
|
</if>
|
||||||
|
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||||
|
AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||||
|
</if>
|
||||||
|
order by create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDbTableListByNames" resultMap="GenTableResult">
|
||||||
|
select table_name, table_comment, create_time, update_time from information_schema.tables
|
||||||
|
where table_name NOT LIKE 'xxl_job_%' and table_name NOT LIKE 'gen_%' and table_schema = (select database())
|
||||||
|
and table_name in
|
||||||
|
<foreach collection="array" item="name" open="(" separator="," close=")">
|
||||||
|
#{name}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectTableByName" parameterType="String" resultMap="GenTableResult">
|
<select id="selectTableByName" parameterType="String" resultMap="GenTableResult">
|
||||||
select table_name, table_comment, create_time, update_time from information_schema.tables
|
select table_name, table_comment, create_time, update_time from information_schema.tables
|
||||||
where table_comment <![CDATA[ <> ]]> '' and table_schema = (select database())
|
where table_comment <![CDATA[ <> ]]> '' and table_schema = (select database())
|
||||||
and table_name = #{tableName}
|
and table_name = #{tableName}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult">
|
<select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult">
|
||||||
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
||||||
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
||||||
FROM gen_table t
|
FROM gen_table t
|
||||||
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
||||||
where t.table_id = #{tableId} order by c.sort
|
where t.table_id = #{tableId} order by c.sort
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult">
|
<select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult">
|
||||||
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
||||||
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
||||||
FROM gen_table t
|
FROM gen_table t
|
||||||
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
||||||
where t.table_name = #{tableName} order by c.sort
|
where t.table_name = #{tableName} order by c.sort
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult">
|
<select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult">
|
||||||
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark,
|
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark,
|
||||||
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
||||||
FROM gen_table t
|
FROM gen_table t
|
||||||
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
||||||
order by c.sort
|
order by c.sort
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -10,29 +10,29 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class OssConstant {
|
public class OssConstant {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OSS模块KEY
|
* OSS模块KEY
|
||||||
*/
|
*/
|
||||||
public static final String SYS_OSS_KEY = "sys_oss:";
|
public static final String SYS_OSS_KEY = "sys_oss:";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对象存储配置KEY
|
* 对象存储配置KEY
|
||||||
*/
|
*/
|
||||||
public static final String OSS_CONFIG_KEY = "OssConfig";
|
public static final String OSS_CONFIG_KEY = "OssConfig";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 缓存配置KEY
|
* 缓存配置KEY
|
||||||
*/
|
*/
|
||||||
public static final String CACHE_CONFIG_KEY = SYS_OSS_KEY + OSS_CONFIG_KEY;
|
public static final String CACHE_CONFIG_KEY = SYS_OSS_KEY + OSS_CONFIG_KEY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预览列表资源开关Key
|
* 预览列表资源开关Key
|
||||||
*/
|
*/
|
||||||
public static final String PEREVIEW_LIST_RESOURCE_KEY = "sys.oss.previewListResource";
|
public static final String PEREVIEW_LIST_RESOURCE_KEY = "sys.oss.previewListResource";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统数据ids
|
* 系统数据ids
|
||||||
*/
|
*/
|
||||||
public static final List<Integer> SYSTEM_DATA_IDS = Arrays.asList(1, 2, 3, 4);
|
public static final List<Integer> SYSTEM_DATA_IDS = Arrays.asList(1, 2, 3, 4);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,13 +14,13 @@ import lombok.experimental.Accessors;
|
|||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class UploadResult {
|
public class UploadResult {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件路径
|
* 文件路径
|
||||||
*/
|
*/
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件名
|
* 文件名
|
||||||
*/
|
*/
|
||||||
private String filename;
|
private String filename;
|
||||||
}
|
}
|
||||||
|
@ -17,47 +17,47 @@ import lombok.Getter;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum OssEnumd {
|
public enum OssEnumd {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 七牛云
|
* 七牛云
|
||||||
*/
|
*/
|
||||||
QINIU("qiniu", QiniuOssStrategy.class),
|
QINIU("qiniu", QiniuOssStrategy.class),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 阿里云
|
* 阿里云
|
||||||
*/
|
*/
|
||||||
ALIYUN("aliyun", AliyunOssStrategy.class),
|
ALIYUN("aliyun", AliyunOssStrategy.class),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 腾讯云
|
* 腾讯云
|
||||||
*/
|
*/
|
||||||
QCLOUD("qcloud", QcloudOssStrategy.class),
|
QCLOUD("qcloud", QcloudOssStrategy.class),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* minio
|
* minio
|
||||||
*/
|
*/
|
||||||
MINIO("minio", MinioOssStrategy.class);
|
MINIO("minio", MinioOssStrategy.class);
|
||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|
||||||
private final Class<?> serviceClass;
|
private final Class<?> serviceClass;
|
||||||
|
|
||||||
public static Class<?> getServiceClass(String value) {
|
public static Class<?> getServiceClass(String value) {
|
||||||
for (OssEnumd clazz : values()) {
|
for (OssEnumd clazz : values()) {
|
||||||
if (clazz.getValue().equals(value)) {
|
if (clazz.getValue().equals(value)) {
|
||||||
return clazz.getServiceClass();
|
return clazz.getServiceClass();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getServiceName(String value) {
|
public static String getServiceName(String value) {
|
||||||
for (OssEnumd clazz : values()) {
|
for (OssEnumd clazz : values()) {
|
||||||
if (clazz.getValue().equals(value)) {
|
if (clazz.getValue().equals(value)) {
|
||||||
return StringUtils.uncapitalize(clazz.getServiceClass().getSimpleName());
|
return StringUtils.uncapitalize(clazz.getServiceClass().getSimpleName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -28,24 +28,24 @@ import lombok.Getter;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum PolicyType {
|
public enum PolicyType {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 只读
|
* 只读
|
||||||
*/
|
*/
|
||||||
READ("read-only"),
|
READ("read-only"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 只写
|
* 只写
|
||||||
*/
|
*/
|
||||||
WRITE("write-only"),
|
WRITE("write-only"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 读写
|
* 读写
|
||||||
*/
|
*/
|
||||||
READ_WRITE("read-write");
|
READ_WRITE("read-write");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类型
|
* 类型
|
||||||
*/
|
*/
|
||||||
private final String type;
|
private final String type;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,10 @@ package com.ruoyi.oss.exception;
|
|||||||
*/
|
*/
|
||||||
public class OssException extends RuntimeException {
|
public class OssException extends RuntimeException {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public OssException(String msg) {
|
public OssException(String msg) {
|
||||||
super(msg);
|
super(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,10 +23,10 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class OssFactory {
|
public class OssFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务实例缓存
|
* 服务实例缓存
|
||||||
*/
|
*/
|
||||||
private static final Map<String, IOssStrategy> SERVICES = new ConcurrentHashMap<>();
|
private static final Map<String, IOssStrategy> SERVICES = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化工厂
|
* 初始化工厂
|
||||||
@ -42,40 +42,40 @@ public class OssFactory {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取默认实例
|
* 获取默认实例
|
||||||
*/
|
*/
|
||||||
public static IOssStrategy instance() {
|
public static IOssStrategy instance() {
|
||||||
// 获取redis 默认类型
|
// 获取redis 默认类型
|
||||||
String type = RedisUtils.getCacheObject(OssConstant.CACHE_CONFIG_KEY);
|
String type = RedisUtils.getCacheObject(OssConstant.CACHE_CONFIG_KEY);
|
||||||
if (StringUtils.isEmpty(type)) {
|
if (StringUtils.isEmpty(type)) {
|
||||||
throw new OssException("文件存储服务类型无法找到!");
|
throw new OssException("文件存储服务类型无法找到!");
|
||||||
}
|
}
|
||||||
return instance(type);
|
return instance(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据类型获取实例
|
* 根据类型获取实例
|
||||||
*/
|
*/
|
||||||
public static IOssStrategy instance(String type) {
|
public static IOssStrategy instance(String type) {
|
||||||
IOssStrategy service = SERVICES.get(type);
|
IOssStrategy service = SERVICES.get(type);
|
||||||
if (service == null) {
|
if (service == null) {
|
||||||
refreshService(type);
|
refreshService(type);
|
||||||
service = SERVICES.get(type);
|
service = SERVICES.get(type);
|
||||||
}
|
}
|
||||||
return service;
|
return service;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void refreshService(String type) {
|
private static void refreshService(String type) {
|
||||||
Object json = RedisUtils.getCacheObject(OssConstant.SYS_OSS_KEY + type);
|
Object json = RedisUtils.getCacheObject(OssConstant.SYS_OSS_KEY + type);
|
||||||
OssProperties properties = JsonUtils.parseObject(json.toString(), OssProperties.class);
|
OssProperties properties = JsonUtils.parseObject(json.toString(), OssProperties.class);
|
||||||
if (properties == null) {
|
if (properties == null) {
|
||||||
throw new OssException("系统异常, '" + type + "'配置信息不存在!");
|
throw new OssException("系统异常, '" + type + "'配置信息不存在!");
|
||||||
}
|
}
|
||||||
// 获取redis配置信息 创建对象 并缓存
|
// 获取redis配置信息 创建对象 并缓存
|
||||||
IOssStrategy service = (IOssStrategy) ReflectUtils.newInstance(OssEnumd.getServiceClass(type));
|
IOssStrategy service = (IOssStrategy) ReflectUtils.newInstance(OssEnumd.getServiceClass(type));
|
||||||
((AbstractOssStrategy)service).init(properties);
|
((AbstractOssStrategy)service).init(properties);
|
||||||
SERVICES.put(type, service);
|
SERVICES.put(type, service);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,39 +10,39 @@ import lombok.Data;
|
|||||||
@Data
|
@Data
|
||||||
public class OssProperties {
|
public class OssProperties {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 域名
|
* 域名
|
||||||
*/
|
*/
|
||||||
private String endpoint;
|
private String endpoint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 前缀
|
* 前缀
|
||||||
*/
|
*/
|
||||||
private String prefix;
|
private String prefix;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ACCESS_KEY
|
* ACCESS_KEY
|
||||||
*/
|
*/
|
||||||
private String accessKey;
|
private String accessKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECRET_KEY
|
* SECRET_KEY
|
||||||
*/
|
*/
|
||||||
private String secretKey;
|
private String secretKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 存储空间名
|
* 存储空间名
|
||||||
*/
|
*/
|
||||||
private String bucketName;
|
private String bucketName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 存储区域
|
* 存储区域
|
||||||
*/
|
*/
|
||||||
private String region;
|
private String region;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否https(Y=是,N=否)
|
* 是否https(Y=是,N=否)
|
||||||
*/
|
*/
|
||||||
private String isHttps;
|
private String isHttps;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,54 +11,54 @@ import java.io.InputStream;
|
|||||||
*/
|
*/
|
||||||
public interface IOssStrategy {
|
public interface IOssStrategy {
|
||||||
|
|
||||||
void createBucket();
|
void createBucket();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取服务商类型
|
* 获取服务商类型
|
||||||
*/
|
*/
|
||||||
String getServiceType();
|
String getServiceType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件上传
|
* 文件上传
|
||||||
*
|
*
|
||||||
* @param data 文件字节数组
|
* @param data 文件字节数组
|
||||||
* @param path 文件路径,包含文件名
|
* @param path 文件路径,包含文件名
|
||||||
* @return 返回http地址
|
* @return 返回http地址
|
||||||
*/
|
*/
|
||||||
UploadResult upload(byte[] data, String path, String contentType);
|
UploadResult upload(byte[] data, String path, String contentType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件删除
|
* 文件删除
|
||||||
*
|
*
|
||||||
* @param path 文件路径,包含文件名
|
* @param path 文件路径,包含文件名
|
||||||
*/
|
*/
|
||||||
void delete(String path);
|
void delete(String path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件上传
|
* 文件上传
|
||||||
*
|
*
|
||||||
* @param data 文件字节数组
|
* @param data 文件字节数组
|
||||||
* @param suffix 后缀
|
* @param suffix 后缀
|
||||||
* @return 返回http地址
|
* @return 返回http地址
|
||||||
*/
|
*/
|
||||||
UploadResult uploadSuffix(byte[] data, String suffix, String contentType);
|
UploadResult uploadSuffix(byte[] data, String suffix, String contentType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件上传
|
* 文件上传
|
||||||
*
|
*
|
||||||
* @param inputStream 字节流
|
* @param inputStream 字节流
|
||||||
* @param path 文件路径,包含文件名
|
* @param path 文件路径,包含文件名
|
||||||
* @return 返回http地址
|
* @return 返回http地址
|
||||||
*/
|
*/
|
||||||
UploadResult upload(InputStream inputStream, String path, String contentType);
|
UploadResult upload(InputStream inputStream, String path, String contentType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件上传
|
* 文件上传
|
||||||
*
|
*
|
||||||
* @param inputStream 字节流
|
* @param inputStream 字节流
|
||||||
* @param suffix 后缀
|
* @param suffix 后缀
|
||||||
* @return 返回http地址
|
* @return 返回http地址
|
||||||
*/
|
*/
|
||||||
UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType);
|
UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,44 +17,44 @@ import java.io.InputStream;
|
|||||||
*/
|
*/
|
||||||
public abstract class AbstractOssStrategy implements IOssStrategy {
|
public abstract class AbstractOssStrategy implements IOssStrategy {
|
||||||
|
|
||||||
protected OssProperties properties;
|
protected OssProperties properties;
|
||||||
|
|
||||||
public abstract void init(OssProperties properties);
|
public abstract void init(OssProperties properties);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public abstract void createBucket();
|
public abstract void createBucket();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public abstract String getServiceType();
|
public abstract String getServiceType();
|
||||||
|
|
||||||
public String getPath(String prefix, String suffix) {
|
public String getPath(String prefix, String suffix) {
|
||||||
// 生成uuid
|
// 生成uuid
|
||||||
String uuid = IdUtil.fastSimpleUUID();
|
String uuid = IdUtil.fastSimpleUUID();
|
||||||
// 文件路径
|
// 文件路径
|
||||||
String path = DateUtils.datePath() + "/" + uuid;
|
String path = DateUtils.datePath() + "/" + uuid;
|
||||||
if (StringUtils.isNotBlank(prefix)) {
|
if (StringUtils.isNotBlank(prefix)) {
|
||||||
path = prefix + "/" + path;
|
path = prefix + "/" + path;
|
||||||
}
|
}
|
||||||
return path + suffix;
|
return path + suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public abstract UploadResult upload(byte[] data, String path, String contentType);
|
public abstract UploadResult upload(byte[] data, String path, String contentType);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public abstract void delete(String path);
|
public abstract void delete(String path);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UploadResult upload(InputStream inputStream, String path, String contentType) {
|
public UploadResult upload(InputStream inputStream, String path, String contentType) {
|
||||||
byte[] data = IoUtil.readBytes(inputStream);
|
byte[] data = IoUtil.readBytes(inputStream);
|
||||||
return this.upload(data, path, contentType);
|
return this.upload(data, path, contentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public abstract UploadResult uploadSuffix(byte[] data, String suffix, String contentType);
|
public abstract UploadResult uploadSuffix(byte[] data, String suffix, String contentType);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public abstract UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType);
|
public abstract UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType);
|
||||||
|
|
||||||
public abstract String getEndpointLink();
|
public abstract String getEndpointLink();
|
||||||
}
|
}
|
||||||
|
@ -24,90 +24,90 @@ import java.io.InputStream;
|
|||||||
*/
|
*/
|
||||||
public class AliyunOssStrategy extends AbstractOssStrategy {
|
public class AliyunOssStrategy extends AbstractOssStrategy {
|
||||||
|
|
||||||
private OSSClient client;
|
private OSSClient client;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(OssProperties cloudStorageProperties) {
|
public void init(OssProperties cloudStorageProperties) {
|
||||||
properties = cloudStorageProperties;
|
properties = cloudStorageProperties;
|
||||||
try {
|
try {
|
||||||
ClientConfiguration configuration = new ClientConfiguration();
|
ClientConfiguration configuration = new ClientConfiguration();
|
||||||
DefaultCredentialProvider credentialProvider = new DefaultCredentialProvider(
|
DefaultCredentialProvider credentialProvider = new DefaultCredentialProvider(
|
||||||
properties.getAccessKey(), properties.getSecretKey());
|
properties.getAccessKey(), properties.getSecretKey());
|
||||||
client = new OSSClient(properties.getEndpoint(), credentialProvider, configuration);
|
client = new OSSClient(properties.getEndpoint(), credentialProvider, configuration);
|
||||||
createBucket();
|
createBucket();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new OssException("阿里云存储配置错误! 请检查系统配置:[" + e.getMessage() + "]");
|
throw new OssException("阿里云存储配置错误! 请检查系统配置:[" + e.getMessage() + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createBucket() {
|
public void createBucket() {
|
||||||
try {
|
try {
|
||||||
String bucketName = properties.getBucketName();
|
String bucketName = properties.getBucketName();
|
||||||
if (client.doesBucketExist(bucketName)) {
|
if (client.doesBucketExist(bucketName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CreateBucketRequest createBucketRequest = new CreateBucketRequest(bucketName);
|
CreateBucketRequest createBucketRequest = new CreateBucketRequest(bucketName);
|
||||||
createBucketRequest.setCannedACL(CannedAccessControlList.PublicRead);
|
createBucketRequest.setCannedACL(CannedAccessControlList.PublicRead);
|
||||||
client.createBucket(createBucketRequest);
|
client.createBucket(createBucketRequest);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new OssException("创建Bucket失败, 请核对阿里云配置信息:[" + e.getMessage() + "]");
|
throw new OssException("创建Bucket失败, 请核对阿里云配置信息:[" + e.getMessage() + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getServiceType() {
|
public String getServiceType() {
|
||||||
return OssEnumd.ALIYUN.getValue();
|
return OssEnumd.ALIYUN.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UploadResult upload(byte[] data, String path, String contentType) {
|
public UploadResult upload(byte[] data, String path, String contentType) {
|
||||||
return upload(new ByteArrayInputStream(data), path, contentType);
|
return upload(new ByteArrayInputStream(data), path, contentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UploadResult upload(InputStream inputStream, String path, String contentType) {
|
public UploadResult upload(InputStream inputStream, String path, String contentType) {
|
||||||
try {
|
try {
|
||||||
ObjectMetadata metadata = new ObjectMetadata();
|
ObjectMetadata metadata = new ObjectMetadata();
|
||||||
metadata.setContentType(contentType);
|
metadata.setContentType(contentType);
|
||||||
client.putObject(new PutObjectRequest(properties.getBucketName(), path, inputStream, metadata));
|
client.putObject(new PutObjectRequest(properties.getBucketName(), path, inputStream, metadata));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new OssException("上传文件失败,请检查阿里云配置信息:[" + e.getMessage() + "]");
|
throw new OssException("上传文件失败,请检查阿里云配置信息:[" + e.getMessage() + "]");
|
||||||
}
|
}
|
||||||
return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path);
|
return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(String path) {
|
public void delete(String path) {
|
||||||
path = path.replace(getEndpointLink() + "/", "");
|
path = path.replace(getEndpointLink() + "/" , "");
|
||||||
try {
|
try {
|
||||||
client.deleteObject(properties.getBucketName(), path);
|
client.deleteObject(properties.getBucketName(), path);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new OssException("上传文件失败,请检查阿里云配置信息:[" + e.getMessage() + "]");
|
throw new OssException("上传文件失败,请检查阿里云配置信息:[" + e.getMessage() + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UploadResult uploadSuffix(byte[] data, String suffix, String contentType) {
|
public UploadResult uploadSuffix(byte[] data, String suffix, String contentType) {
|
||||||
return upload(data, getPath(properties.getPrefix(), suffix), contentType);
|
return upload(data, getPath(properties.getPrefix(), suffix), contentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType) {
|
public UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType) {
|
||||||
return upload(inputStream, getPath(properties.getPrefix(), suffix), contentType);
|
return upload(inputStream, getPath(properties.getPrefix(), suffix), contentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEndpointLink() {
|
public String getEndpointLink() {
|
||||||
String endpoint = properties.getEndpoint();
|
String endpoint = properties.getEndpoint();
|
||||||
StringBuilder sb = new StringBuilder(endpoint);
|
StringBuilder sb = new StringBuilder(endpoint);
|
||||||
if (StringUtils.containsAnyIgnoreCase(endpoint, "http://")) {
|
if (StringUtils.containsAnyIgnoreCase(endpoint, "http://")) {
|
||||||
sb.insert(7, properties.getBucketName() + ".");
|
sb.insert(7, properties.getBucketName() + ".");
|
||||||
} else if (StringUtils.containsAnyIgnoreCase(endpoint, "https://")) {
|
} else if (StringUtils.containsAnyIgnoreCase(endpoint, "https://")) {
|
||||||
sb.insert(8, properties.getBucketName() + ".");
|
sb.insert(8, properties.getBucketName() + ".");
|
||||||
} else {
|
} else {
|
||||||
throw new OssException("Endpoint配置错误");
|
throw new OssException("Endpoint配置错误");
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,162 +20,162 @@ import java.io.InputStream;
|
|||||||
*/
|
*/
|
||||||
public class MinioOssStrategy extends AbstractOssStrategy {
|
public class MinioOssStrategy extends AbstractOssStrategy {
|
||||||
|
|
||||||
private MinioClient minioClient;
|
private MinioClient minioClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(OssProperties cloudStorageProperties) {
|
public void init(OssProperties cloudStorageProperties) {
|
||||||
properties = cloudStorageProperties;
|
properties = cloudStorageProperties;
|
||||||
try {
|
try {
|
||||||
minioClient = MinioClient.builder()
|
minioClient = MinioClient.builder()
|
||||||
.endpoint(properties.getEndpoint())
|
.endpoint(properties.getEndpoint())
|
||||||
.credentials(properties.getAccessKey(), properties.getSecretKey())
|
.credentials(properties.getAccessKey(), properties.getSecretKey())
|
||||||
.build();
|
.build();
|
||||||
createBucket();
|
createBucket();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new OssException("Minio存储配置错误! 请检查系统配置:[" + e.getMessage() + "]");
|
throw new OssException("Minio存储配置错误! 请检查系统配置:[" + e.getMessage() + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createBucket() {
|
public void createBucket() {
|
||||||
try {
|
try {
|
||||||
String bucketName = properties.getBucketName();
|
String bucketName = properties.getBucketName();
|
||||||
boolean exists = minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build());
|
boolean exists = minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build());
|
||||||
if (exists) {
|
if (exists) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 不存在就创建桶
|
// 不存在就创建桶
|
||||||
minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build());
|
minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build());
|
||||||
minioClient.setBucketPolicy(SetBucketPolicyArgs.builder()
|
minioClient.setBucketPolicy(SetBucketPolicyArgs.builder()
|
||||||
.bucket(bucketName)
|
.bucket(bucketName)
|
||||||
.config(getPolicy(bucketName, PolicyType.READ))
|
.config(getPolicy(bucketName, PolicyType.READ))
|
||||||
.build());
|
.build());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new OssException("创建Bucket失败, 请核对Minio配置信息:[" + e.getMessage() + "]");
|
throw new OssException("创建Bucket失败, 请核对Minio配置信息:[" + e.getMessage() + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getServiceType() {
|
public String getServiceType() {
|
||||||
return OssEnumd.MINIO.getValue();
|
return OssEnumd.MINIO.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UploadResult upload(byte[] data, String path, String contentType) {
|
public UploadResult upload(byte[] data, String path, String contentType) {
|
||||||
return upload(new ByteArrayInputStream(data), path, contentType);
|
return upload(new ByteArrayInputStream(data), path, contentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UploadResult upload(InputStream inputStream, String path, String contentType) {
|
public UploadResult upload(InputStream inputStream, String path, String contentType) {
|
||||||
try {
|
try {
|
||||||
minioClient.putObject(PutObjectArgs.builder()
|
minioClient.putObject(PutObjectArgs.builder()
|
||||||
.bucket(properties.getBucketName())
|
.bucket(properties.getBucketName())
|
||||||
.object(path)
|
.object(path)
|
||||||
.contentType(StringUtils.blankToDefault(contentType, MediaType.APPLICATION_OCTET_STREAM_VALUE))
|
.contentType(StringUtils.blankToDefault(contentType, MediaType.APPLICATION_OCTET_STREAM_VALUE))
|
||||||
.stream(inputStream, inputStream.available(), -1)
|
.stream(inputStream, inputStream.available(), -1)
|
||||||
.build());
|
.build());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new OssException("上传文件失败,请核对Minio配置信息:[" + e.getMessage() + "]");
|
throw new OssException("上传文件失败,请核对Minio配置信息:[" + e.getMessage() + "]");
|
||||||
}
|
}
|
||||||
return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path);
|
return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(String path) {
|
public void delete(String path) {
|
||||||
path = path.replace(getEndpointLink() + "/", "");
|
path = path.replace(getEndpointLink() + "/", "");
|
||||||
try {
|
try {
|
||||||
minioClient.removeObject(RemoveObjectArgs.builder()
|
minioClient.removeObject(RemoveObjectArgs.builder()
|
||||||
.bucket(properties.getBucketName())
|
.bucket(properties.getBucketName())
|
||||||
.object(path)
|
.object(path)
|
||||||
.build());
|
.build());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new OssException(e.getMessage());
|
throw new OssException(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UploadResult uploadSuffix(byte[] data, String suffix, String contentType) {
|
public UploadResult uploadSuffix(byte[] data, String suffix, String contentType) {
|
||||||
return upload(data, getPath(properties.getPrefix(), suffix), contentType);
|
return upload(data, getPath(properties.getPrefix(), suffix), contentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType) {
|
public UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType) {
|
||||||
return upload(inputStream, getPath(properties.getPrefix(), suffix), contentType);
|
return upload(inputStream, getPath(properties.getPrefix(), suffix), contentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEndpointLink() {
|
public String getEndpointLink() {
|
||||||
return properties.getEndpoint() + "/" + properties.getBucketName();
|
return properties.getEndpoint() + "/" + properties.getBucketName();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getPolicy(String bucketName, PolicyType policyType) {
|
private String getPolicy(String bucketName, PolicyType policyType) {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append("{\n");
|
builder.append("{\n");
|
||||||
builder.append(" \"Statement\": [\n");
|
builder.append(" \"Statement\": [\n");
|
||||||
builder.append(" {\n");
|
builder.append(" {\n");
|
||||||
builder.append(" \"Action\": [\n");
|
builder.append(" \"Action\": [\n");
|
||||||
if (policyType == PolicyType.WRITE) {
|
if (policyType == PolicyType.WRITE) {
|
||||||
builder.append(" \"s3:GetBucketLocation\",\n");
|
builder.append(" \"s3:GetBucketLocation\",\n");
|
||||||
builder.append(" \"s3:ListBucketMultipartUploads\"\n");
|
builder.append(" \"s3:ListBucketMultipartUploads\"\n");
|
||||||
} else if (policyType == PolicyType.READ_WRITE) {
|
} else if (policyType == PolicyType.READ_WRITE) {
|
||||||
builder.append(" \"s3:GetBucketLocation\",\n");
|
builder.append(" \"s3:GetBucketLocation\",\n");
|
||||||
builder.append(" \"s3:ListBucket\",\n");
|
builder.append(" \"s3:ListBucket\",\n");
|
||||||
builder.append(" \"s3:ListBucketMultipartUploads\"\n");
|
builder.append(" \"s3:ListBucketMultipartUploads\"\n");
|
||||||
} else {
|
} else {
|
||||||
builder.append(" \"s3:GetBucketLocation\"\n");
|
builder.append(" \"s3:GetBucketLocation\"\n");
|
||||||
}
|
}
|
||||||
builder.append(" ],\n");
|
builder.append(" ],\n");
|
||||||
builder.append(" \"Effect\": \"Allow\",\n");
|
builder.append(" \"Effect\": \"Allow\",\n");
|
||||||
builder.append(" \"Principal\": \"*\",\n");
|
builder.append(" \"Principal\": \"*\",\n");
|
||||||
builder.append(" \"Resource\": \"arn:aws:s3:::");
|
builder.append(" \"Resource\": \"arn:aws:s3:::");
|
||||||
builder.append(bucketName);
|
builder.append(bucketName);
|
||||||
builder.append("\"\n");
|
builder.append("\"\n");
|
||||||
builder.append(" },\n");
|
builder.append(" },\n");
|
||||||
if (PolicyType.READ.equals(policyType)) {
|
if (PolicyType.READ.equals(policyType)) {
|
||||||
builder.append(" {\n");
|
builder.append(" {\n");
|
||||||
builder.append(" \"Action\": [\n");
|
builder.append(" \"Action\": [\n");
|
||||||
builder.append(" \"s3:ListBucket\"\n");
|
builder.append(" \"s3:ListBucket\"\n");
|
||||||
builder.append(" ],\n");
|
builder.append(" ],\n");
|
||||||
builder.append(" \"Effect\": \"Deny\",\n");
|
builder.append(" \"Effect\": \"Deny\",\n");
|
||||||
builder.append(" \"Principal\": \"*\",\n");
|
builder.append(" \"Principal\": \"*\",\n");
|
||||||
builder.append(" \"Resource\": \"arn:aws:s3:::");
|
builder.append(" \"Resource\": \"arn:aws:s3:::");
|
||||||
builder.append(bucketName);
|
builder.append(bucketName);
|
||||||
builder.append("\"\n");
|
builder.append("\"\n");
|
||||||
builder.append(" },\n");
|
builder.append(" },\n");
|
||||||
}
|
}
|
||||||
builder.append(" {\n");
|
builder.append(" {\n");
|
||||||
builder.append(" \"Action\": ");
|
builder.append(" \"Action\": ");
|
||||||
switch (policyType) {
|
switch (policyType) {
|
||||||
case WRITE:
|
case WRITE:
|
||||||
builder.append("[\n");
|
builder.append("[\n");
|
||||||
builder.append(" \"s3:AbortMultipartUpload\",\n");
|
builder.append(" \"s3:AbortMultipartUpload\",\n");
|
||||||
builder.append(" \"s3:DeleteObject\",\n");
|
builder.append(" \"s3:DeleteObject\",\n");
|
||||||
builder.append(" \"s3:ListMultipartUploadParts\",\n");
|
builder.append(" \"s3:ListMultipartUploadParts\",\n");
|
||||||
builder.append(" \"s3:PutObject\"\n");
|
builder.append(" \"s3:PutObject\"\n");
|
||||||
builder.append(" ],\n");
|
builder.append(" ],\n");
|
||||||
break;
|
break;
|
||||||
case READ_WRITE:
|
case READ_WRITE:
|
||||||
builder.append("[\n");
|
builder.append("[\n");
|
||||||
builder.append(" \"s3:AbortMultipartUpload\",\n");
|
builder.append(" \"s3:AbortMultipartUpload\",\n");
|
||||||
builder.append(" \"s3:DeleteObject\",\n");
|
builder.append(" \"s3:DeleteObject\",\n");
|
||||||
builder.append(" \"s3:GetObject\",\n");
|
builder.append(" \"s3:GetObject\",\n");
|
||||||
builder.append(" \"s3:ListMultipartUploadParts\",\n");
|
builder.append(" \"s3:ListMultipartUploadParts\",\n");
|
||||||
builder.append(" \"s3:PutObject\"\n");
|
builder.append(" \"s3:PutObject\"\n");
|
||||||
builder.append(" ],\n");
|
builder.append(" ],\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
builder.append("\"s3:GetObject\",\n");
|
builder.append("\"s3:GetObject\",\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
builder.append(" \"Effect\": \"Allow\",\n");
|
builder.append(" \"Effect\": \"Allow\",\n");
|
||||||
builder.append(" \"Principal\": \"*\",\n");
|
builder.append(" \"Principal\": \"*\",\n");
|
||||||
builder.append(" \"Resource\": \"arn:aws:s3:::");
|
builder.append(" \"Resource\": \"arn:aws:s3:::");
|
||||||
builder.append(bucketName);
|
builder.append(bucketName);
|
||||||
builder.append("/*\"\n");
|
builder.append("/*\"\n");
|
||||||
builder.append(" }\n");
|
builder.append(" }\n");
|
||||||
builder.append(" ],\n");
|
builder.append(" ],\n");
|
||||||
builder.append(" \"Version\": \"2012-10-17\"\n");
|
builder.append(" \"Version\": \"2012-10-17\"\n");
|
||||||
builder.append("}\n");
|
builder.append("}\n");
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,98 +24,98 @@ import java.io.InputStream;
|
|||||||
*/
|
*/
|
||||||
public class QcloudOssStrategy extends AbstractOssStrategy {
|
public class QcloudOssStrategy extends AbstractOssStrategy {
|
||||||
|
|
||||||
private COSClient client;
|
private COSClient client;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(OssProperties cloudStorageProperties) {
|
public void init(OssProperties cloudStorageProperties) {
|
||||||
properties = cloudStorageProperties;
|
properties = cloudStorageProperties;
|
||||||
try {
|
try {
|
||||||
COSCredentials credentials = new BasicCOSCredentials(
|
COSCredentials credentials = new BasicCOSCredentials(
|
||||||
properties.getAccessKey(), properties.getSecretKey());
|
properties.getAccessKey(), properties.getSecretKey());
|
||||||
// 初始化客户端配置
|
// 初始化客户端配置
|
||||||
ClientConfig clientConfig = new ClientConfig();
|
ClientConfig clientConfig = new ClientConfig();
|
||||||
// 设置bucket所在的区域,华南:gz 华北:tj 华东:sh
|
// 设置bucket所在的区域,华南:gz 华北:tj 华东:sh
|
||||||
clientConfig.setRegion(new Region(properties.getRegion()));
|
clientConfig.setRegion(new Region(properties.getRegion()));
|
||||||
if ("Y".equals(properties.getIsHttps())) {
|
if ("Y".equals(properties.getIsHttps())) {
|
||||||
clientConfig.setHttpProtocol(HttpProtocol.https);
|
clientConfig.setHttpProtocol(HttpProtocol.https);
|
||||||
} else {
|
} else {
|
||||||
clientConfig.setHttpProtocol(HttpProtocol.http);
|
clientConfig.setHttpProtocol(HttpProtocol.http);
|
||||||
}
|
}
|
||||||
client = new COSClient(credentials, clientConfig);
|
client = new COSClient(credentials, clientConfig);
|
||||||
createBucket();
|
createBucket();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new OssException("腾讯云存储配置错误! 请检查系统配置:[" + e.getMessage() + "]");
|
throw new OssException("腾讯云存储配置错误! 请检查系统配置:[" + e.getMessage() + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createBucket() {
|
public void createBucket() {
|
||||||
try {
|
try {
|
||||||
String bucketName = properties.getBucketName();
|
String bucketName = properties.getBucketName();
|
||||||
if (client.doesBucketExist(bucketName)) {
|
if (client.doesBucketExist(bucketName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CreateBucketRequest createBucketRequest = new CreateBucketRequest(bucketName);
|
CreateBucketRequest createBucketRequest = new CreateBucketRequest(bucketName);
|
||||||
createBucketRequest.setCannedAcl(CannedAccessControlList.PublicRead);
|
createBucketRequest.setCannedAcl(CannedAccessControlList.PublicRead);
|
||||||
client.createBucket(createBucketRequest);
|
client.createBucket(createBucketRequest);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new OssException("创建Bucket失败, 请核对腾讯云配置信息:[" + e.getMessage() + "]");
|
throw new OssException("创建Bucket失败, 请核对腾讯云配置信息:[" + e.getMessage() + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getServiceType() {
|
public String getServiceType() {
|
||||||
return OssEnumd.QCLOUD.getValue();
|
return OssEnumd.QCLOUD.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UploadResult upload(byte[] data, String path, String contentType) {
|
public UploadResult upload(byte[] data, String path, String contentType) {
|
||||||
return upload(new ByteArrayInputStream(data), path, contentType);
|
return upload(new ByteArrayInputStream(data), path, contentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UploadResult upload(InputStream inputStream, String path, String contentType) {
|
public UploadResult upload(InputStream inputStream, String path, String contentType) {
|
||||||
try {
|
try {
|
||||||
ObjectMetadata metadata = new ObjectMetadata();
|
ObjectMetadata metadata = new ObjectMetadata();
|
||||||
metadata.setContentType(contentType);
|
metadata.setContentType(contentType);
|
||||||
client.putObject(new PutObjectRequest(properties.getBucketName(), path, inputStream, metadata));
|
client.putObject(new PutObjectRequest(properties.getBucketName(), path, inputStream, metadata));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new OssException("上传文件失败,请检查腾讯云配置信息:[" + e.getMessage() + "]");
|
throw new OssException("上传文件失败,请检查腾讯云配置信息:[" + e.getMessage() + "]");
|
||||||
}
|
}
|
||||||
return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path);
|
return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(String path) {
|
public void delete(String path) {
|
||||||
path = path.replace(getEndpointLink() + "/", "");
|
path = path.replace(getEndpointLink() + "/", "");
|
||||||
try {
|
try {
|
||||||
client.deleteObject(new DeleteObjectRequest(properties.getBucketName(), path));
|
client.deleteObject(new DeleteObjectRequest(properties.getBucketName(), path));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new OssException("上传文件失败,请检腾讯云查配置信息:[" + e.getMessage() + "]");
|
throw new OssException("上传文件失败,请检腾讯云查配置信息:[" + e.getMessage() + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UploadResult uploadSuffix(byte[] data, String suffix, String contentType) {
|
public UploadResult uploadSuffix(byte[] data, String suffix, String contentType) {
|
||||||
return upload(data, getPath(properties.getPrefix(), suffix), contentType);
|
return upload(data, getPath(properties.getPrefix(), suffix), contentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType) {
|
public UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType) {
|
||||||
return upload(inputStream, getPath(properties.getPrefix(), suffix), contentType);
|
return upload(inputStream, getPath(properties.getPrefix(), suffix), contentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEndpointLink() {
|
public String getEndpointLink() {
|
||||||
String endpoint = properties.getEndpoint();
|
String endpoint = properties.getEndpoint();
|
||||||
StringBuilder sb = new StringBuilder(endpoint);
|
StringBuilder sb = new StringBuilder(endpoint);
|
||||||
if (StringUtils.containsAnyIgnoreCase(endpoint, "http://")) {
|
if (StringUtils.containsAnyIgnoreCase(endpoint, "http://")) {
|
||||||
sb.insert(7, properties.getBucketName() + ".");
|
sb.insert(7, properties.getBucketName() + ".");
|
||||||
} else if (StringUtils.containsAnyIgnoreCase(endpoint, "https://")) {
|
} else if (StringUtils.containsAnyIgnoreCase(endpoint, "https://")) {
|
||||||
sb.insert(8, properties.getBucketName() + ".");
|
sb.insert(8, properties.getBucketName() + ".");
|
||||||
} else {
|
} else {
|
||||||
throw new OssException("Endpoint配置错误");
|
throw new OssException("Endpoint配置错误");
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,106 +22,106 @@ import java.io.InputStream;
|
|||||||
*/
|
*/
|
||||||
public class QiniuOssStrategy extends AbstractOssStrategy {
|
public class QiniuOssStrategy extends AbstractOssStrategy {
|
||||||
|
|
||||||
private UploadManager uploadManager;
|
private UploadManager uploadManager;
|
||||||
private BucketManager bucketManager;
|
private BucketManager bucketManager;
|
||||||
private Auth auth;
|
private Auth auth;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(OssProperties cloudStorageProperties) {
|
public void init(OssProperties cloudStorageProperties) {
|
||||||
properties = cloudStorageProperties;
|
properties = cloudStorageProperties;
|
||||||
try {
|
try {
|
||||||
Configuration config = new Configuration(getRegion(properties.getRegion()));
|
Configuration config = new Configuration(getRegion(properties.getRegion()));
|
||||||
// https设置
|
// https设置
|
||||||
config.useHttpsDomains = false;
|
config.useHttpsDomains = false;
|
||||||
config.useHttpsDomains = "Y".equals(properties.getIsHttps());
|
config.useHttpsDomains = "Y".equals(properties.getIsHttps());
|
||||||
uploadManager = new UploadManager(config);
|
uploadManager = new UploadManager(config);
|
||||||
auth = Auth.create(properties.getAccessKey(), properties.getSecretKey());
|
auth = Auth.create(properties.getAccessKey(), properties.getSecretKey());
|
||||||
String bucketName = properties.getBucketName();
|
String bucketName = properties.getBucketName();
|
||||||
bucketManager = new BucketManager(auth, config);
|
bucketManager = new BucketManager(auth, config);
|
||||||
|
|
||||||
if (!ArrayUtil.contains(bucketManager.buckets(), bucketName)) {
|
if (!ArrayUtil.contains(bucketManager.buckets(), bucketName)) {
|
||||||
bucketManager.createBucket(bucketName, properties.getRegion());
|
bucketManager.createBucket(bucketName, properties.getRegion());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new OssException("七牛云存储配置错误! 请检查系统配置:[" + e.getMessage() + "]");
|
throw new OssException("七牛云存储配置错误! 请检查系统配置:[" + e.getMessage() + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createBucket() {
|
public void createBucket() {
|
||||||
try {
|
try {
|
||||||
String bucketName = properties.getBucketName();
|
String bucketName = properties.getBucketName();
|
||||||
if (ArrayUtil.contains(bucketManager.buckets(), bucketName)) {
|
if (ArrayUtil.contains(bucketManager.buckets(), bucketName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bucketManager.createBucket(bucketName, properties.getRegion());
|
bucketManager.createBucket(bucketName, properties.getRegion());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new OssException("创建Bucket失败, 请核对七牛云配置信息:[" + e.getMessage() + "]");
|
throw new OssException("创建Bucket失败, 请核对七牛云配置信息:[" + e.getMessage() + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getServiceType() {
|
public String getServiceType() {
|
||||||
return OssEnumd.QINIU.getValue();
|
return OssEnumd.QINIU.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UploadResult upload(byte[] data, String path, String contentType) {
|
public UploadResult upload(byte[] data, String path, String contentType) {
|
||||||
try {
|
try {
|
||||||
String token = auth.uploadToken(properties.getBucketName());
|
String token = auth.uploadToken(properties.getBucketName());
|
||||||
Response res = uploadManager.put(data, path, token, null, contentType, false);
|
Response res = uploadManager.put(data, path, token, null, contentType, false);
|
||||||
if (!res.isOK()) {
|
if (!res.isOK()) {
|
||||||
throw new RuntimeException("上传七牛出错:" + res.error);
|
throw new RuntimeException("上传七牛出错:" + res.error);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new OssException("上传文件失败,请核对七牛配置信息:[" + e.getMessage() + "]");
|
throw new OssException("上传文件失败,请核对七牛配置信息:[" + e.getMessage() + "]");
|
||||||
}
|
}
|
||||||
return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path);
|
return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(String path) {
|
public void delete(String path) {
|
||||||
try {
|
try {
|
||||||
path = path.replace(getEndpointLink() + "/", "");
|
path = path.replace(getEndpointLink() + "/", "");
|
||||||
Response res = bucketManager.delete(properties.getBucketName(), path);
|
Response res = bucketManager.delete(properties.getBucketName(), path);
|
||||||
if (!res.isOK()) {
|
if (!res.isOK()) {
|
||||||
throw new RuntimeException("删除七牛文件出错:" + res.error);
|
throw new RuntimeException("删除七牛文件出错:" + res.error);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new OssException(e.getMessage());
|
throw new OssException(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UploadResult uploadSuffix(byte[] data, String suffix, String contentType) {
|
public UploadResult uploadSuffix(byte[] data, String suffix, String contentType) {
|
||||||
return upload(data, getPath(properties.getPrefix(), suffix), contentType);
|
return upload(data, getPath(properties.getPrefix(), suffix), contentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType) {
|
public UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType) {
|
||||||
return upload(inputStream, getPath(properties.getPrefix(), suffix), contentType);
|
return upload(inputStream, getPath(properties.getPrefix(), suffix), contentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEndpointLink() {
|
public String getEndpointLink() {
|
||||||
return properties.getEndpoint();
|
return properties.getEndpoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Region getRegion(String region) {
|
private Region getRegion(String region) {
|
||||||
switch (region) {
|
switch (region) {
|
||||||
case "z0":
|
case "z0":
|
||||||
return Region.region0();
|
return Region.region0();
|
||||||
case "z1":
|
case "z1":
|
||||||
return Region.region1();
|
return Region.region1();
|
||||||
case "z2":
|
case "z2":
|
||||||
return Region.region2();
|
return Region.region2();
|
||||||
case "na0":
|
case "na0":
|
||||||
return Region.regionNa0();
|
return Region.regionNa0();
|
||||||
case "as0":
|
case "as0":
|
||||||
return Region.regionAs0();
|
return Region.regionAs0();
|
||||||
default:
|
default:
|
||||||
return Region.autoRegion();
|
return Region.autoRegion();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,9 +30,9 @@
|
|||||||
<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
|
<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
|
||||||
<include refid="selectDeptVo"/>
|
<include refid="selectDeptVo"/>
|
||||||
where d.del_flag = '0'
|
where d.del_flag = '0'
|
||||||
<if test="deptId != null and deptId != 0">
|
<if test="deptId != null and deptId != 0">
|
||||||
AND dept_id = #{deptId}
|
AND dept_id = #{deptId}
|
||||||
</if>
|
</if>
|
||||||
<if test="parentId != null and parentId != 0">
|
<if test="parentId != null and parentId != 0">
|
||||||
AND parent_id = #{parentId}
|
AND parent_id = #{parentId}
|
||||||
</if>
|
</if>
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
<result property="orderNum" column="order_num"/>
|
<result property="orderNum" column="order_num"/>
|
||||||
<result property="path" column="path"/>
|
<result property="path" column="path"/>
|
||||||
<result property="component" column="component"/>
|
<result property="component" column="component"/>
|
||||||
<result property="query" column="query"/>
|
<result property="query" column="query"/>
|
||||||
<result property="isFrame" column="is_frame"/>
|
<result property="isFrame" column="is_frame"/>
|
||||||
<result property="isCache" column="is_cache"/>
|
<result property="isCache" column="is_cache"/>
|
||||||
<result property="menuType" column="menu_type"/>
|
<result property="menuType" column="menu_type"/>
|
||||||
<result property="visible" column="visible"/>
|
<result property="visible" column="visible"/>
|
||||||
@ -33,8 +33,8 @@
|
|||||||
m.menu_name,
|
m.menu_name,
|
||||||
m.path,
|
m.path,
|
||||||
m.component,
|
m.component,
|
||||||
m.`query`,
|
m.`query`,
|
||||||
m.visible,
|
m.visible,
|
||||||
m.status,
|
m.status,
|
||||||
ifnull(m.perms, '') as perms,
|
ifnull(m.perms, '') as perms,
|
||||||
m.is_frame,
|
m.is_frame,
|
||||||
@ -75,7 +75,7 @@
|
|||||||
m.menu_name,
|
m.menu_name,
|
||||||
m.path,
|
m.path,
|
||||||
m.component,
|
m.component,
|
||||||
m.`query`,
|
m.`query`,
|
||||||
m.visible,
|
m.visible,
|
||||||
m.status,
|
m.status,
|
||||||
ifnull(m.perms, '') as perms,
|
ifnull(m.perms, '') as perms,
|
||||||
|
@ -75,9 +75,9 @@
|
|||||||
r.data_scope,
|
r.data_scope,
|
||||||
r.status as role_status
|
r.status as role_status
|
||||||
from sys_user u
|
from sys_user u
|
||||||
left join sys_dept d on u.dept_id = d.dept_id
|
left join sys_dept d on u.dept_id = d.dept_id
|
||||||
left join sys_user_role ur on u.user_id = ur.user_id
|
left join sys_user_role ur on u.user_id = ur.user_id
|
||||||
left join sys_role r on r.role_id = ur.role_id
|
left join sys_role r on r.role_id = ur.role_id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectPageUserList" parameterType="SysUser" resultMap="SysUserResult">
|
<select id="selectPageUserList" parameterType="SysUser" resultMap="SysUserResult">
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||||
<title><%= webpackConfig.name %></title>
|
<title><%= webpackConfig.name %></title>
|
||||||
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
|
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
|
||||||
<style>
|
<style>
|
||||||
html,
|
html,
|
||||||
body,
|
body,
|
||||||
#app {
|
#app {
|
||||||
@ -197,12 +197,12 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<div id="loader-wrapper">
|
<div id="loader-wrapper">
|
||||||
<div id="loader"></div>
|
<div id="loader"></div>
|
||||||
<div class="loader-section section-left"></div>
|
<div class="loader-section section-left"></div>
|
||||||
<div class="loader-section section-right"></div>
|
<div class="loader-section section-right"></div>
|
||||||
<div class="load_title">正在加载系统资源,请耐心等待</div>
|
<div class="load_title">正在加载系统资源,请耐心等待</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,125 +1,141 @@
|
|||||||
/**
|
/**
|
||||||
* 通用css样式布局处理
|
* 通用css样式布局处理
|
||||||
* Copyright (c) 2019 ruoyi
|
* Copyright (c) 2019 ruoyi
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** 基础通用 **/
|
/** 基础通用 **/
|
||||||
.pt5 {
|
.pt5 {
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pr5 {
|
.pr5 {
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pb5 {
|
.pb5 {
|
||||||
padding-bottom: 5px;
|
padding-bottom: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mt5 {
|
.mt5 {
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mr5 {
|
.mr5 {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mb5 {
|
.mb5 {
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mb8 {
|
.mb8 {
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ml5 {
|
.ml5 {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mt10 {
|
.mt10 {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mr10 {
|
.mr10 {
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mb10 {
|
.mb10 {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ml0 {
|
.ml0 {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mt20 {
|
.mt20 {
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mr20 {
|
.mr20 {
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mb20 {
|
.mb20 {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.m20 {
|
.m20 {
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 {
|
.h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 {
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
line-height: 1.1;
|
line-height: 1.1;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-dialog:not(.is-fullscreen) {
|
.el-dialog:not(.is-fullscreen) {
|
||||||
margin-top: 6vh !important;
|
margin-top: 6vh !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-dialog__wrapper.scrollbar .el-dialog .el-dialog__body {
|
.el-dialog__wrapper.scrollbar .el-dialog .el-dialog__body {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
max-height: 70vh;
|
max-height: 70vh;
|
||||||
padding: 10px 20px 0;
|
padding: 10px 20px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-table {
|
.el-table {
|
||||||
.el-table__header-wrapper, .el-table__fixed-header-wrapper {
|
.el-table__header-wrapper, .el-table__fixed-header-wrapper {
|
||||||
th {
|
th {
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
background-color: #f8f8f9;
|
background-color: #f8f8f9;
|
||||||
color: #515a6e;
|
color: #515a6e;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.el-table__body-wrapper {
|
|
||||||
.el-button [class*="el-icon-"] + span {
|
.el-table__body-wrapper {
|
||||||
margin-left: 1px;
|
.el-button [class*="el-icon-"] + span {
|
||||||
}
|
margin-left: 1px;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 表单布局 **/
|
/** 表单布局 **/
|
||||||
.form-header {
|
.form-header {
|
||||||
font-size:15px;
|
font-size: 15px;
|
||||||
color:#6379bb;
|
color: #6379bb;
|
||||||
border-bottom:1px solid #ddd;
|
border-bottom: 1px solid #ddd;
|
||||||
margin:8px 10px 25px 10px;
|
margin: 8px 10px 25px 10px;
|
||||||
padding-bottom:5px
|
padding-bottom: 5px
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 表格布局 **/
|
/** 表格布局 **/
|
||||||
.pagination-container {
|
.pagination-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 25px;
|
height: 25px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
padding: 10px 20px !important;
|
padding: 10px 20px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* tree border */
|
/* tree border */
|
||||||
.tree-border {
|
.tree-border {
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
border: 1px solid #e5e6e7;
|
border: 1px solid #e5e6e7;
|
||||||
background: #FFFFFF none;
|
background: #FFFFFF none;
|
||||||
border-radius:4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pagination-container .el-pagination {
|
.pagination-container .el-pagination {
|
||||||
right: 0;
|
right: 0;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media ( max-width : 768px) {
|
@media (max-width: 768px) {
|
||||||
.pagination-container .el-pagination > .el-pagination__jump {
|
.pagination-container .el-pagination > .el-pagination__jump {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
@ -129,64 +145,64 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.el-table .fixed-width .el-button--mini {
|
.el-table .fixed-width .el-button--mini {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
width: inherit;
|
width: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 表格更多操作下拉样式 */
|
/** 表格更多操作下拉样式 */
|
||||||
.el-table .el-dropdown-link {
|
.el-table .el-dropdown-link {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
color: #409EFF;
|
color: #409EFF;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-table .el-dropdown, .el-icon-arrow-down {
|
.el-table .el-dropdown, .el-icon-arrow-down {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-tree-node__content > .el-checkbox {
|
.el-tree-node__content > .el-checkbox {
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-group-striped > .list-group-item {
|
.list-group-striped > .list-group-item {
|
||||||
border-left: 0;
|
border-left: 0;
|
||||||
border-right: 0;
|
border-right: 0;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-group {
|
.list-group {
|
||||||
padding-left: 0px;
|
padding-left: 0px;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-group-item {
|
.list-group-item {
|
||||||
border-bottom: 1px solid #e7eaec;
|
border-bottom: 1px solid #e7eaec;
|
||||||
border-top: 1px solid #e7eaec;
|
border-top: 1px solid #e7eaec;
|
||||||
margin-bottom: -1px;
|
margin-bottom: -1px;
|
||||||
padding: 11px 0px;
|
padding: 11px 0px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pull-right {
|
.pull-right {
|
||||||
float: right !important;
|
float: right !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-card__header {
|
.el-card__header {
|
||||||
padding: 14px 15px 7px;
|
padding: 14px 15px 7px;
|
||||||
min-height: 40px;
|
min-height: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-card__body {
|
.el-card__body {
|
||||||
padding: 15px 20px 20px 20px;
|
padding: 15px 20px 20px 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-box {
|
.card-box {
|
||||||
padding-right: 15px;
|
padding-right: 15px;
|
||||||
padding-left: 15px;
|
padding-left: 15px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* button color */
|
/* button color */
|
||||||
@ -212,62 +228,62 @@
|
|||||||
|
|
||||||
/* text color */
|
/* text color */
|
||||||
.text-navy {
|
.text-navy {
|
||||||
color: #1ab394;
|
color: #1ab394;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-primary {
|
.text-primary {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-success {
|
.text-success {
|
||||||
color: #1c84c6;
|
color: #1c84c6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-info {
|
.text-info {
|
||||||
color: #23c6c8;
|
color: #23c6c8;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-warning {
|
.text-warning {
|
||||||
color: #f8ac59;
|
color: #f8ac59;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-danger {
|
.text-danger {
|
||||||
color: #ed5565;
|
color: #ed5565;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-muted {
|
.text-muted {
|
||||||
color: #888888;
|
color: #888888;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* image */
|
/* image */
|
||||||
.img-circle {
|
.img-circle {
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.img-lg {
|
.img-lg {
|
||||||
width: 120px;
|
width: 120px;
|
||||||
height: 120px;
|
height: 120px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar-upload-preview {
|
.avatar-upload-preview {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
transform: translate(50%, -50%);
|
transform: translate(50%, -50%);
|
||||||
width: 200px;
|
width: 200px;
|
||||||
height: 200px;
|
height: 200px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
box-shadow: 0 0 4px #ccc;
|
box-shadow: 0 0 4px #ccc;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 拖拽列样式 */
|
/* 拖拽列样式 */
|
||||||
.sortable-ghost{
|
.sortable-ghost {
|
||||||
opacity: .8;
|
opacity: .8;
|
||||||
color: #fff!important;
|
color: #fff !important;
|
||||||
background: #42b983!important;
|
background: #42b983 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-right-btn {
|
.top-right-btn {
|
||||||
position: relative;
|
position: relative;
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ export default {
|
|||||||
}
|
}
|
||||||
return routes;
|
return routes;
|
||||||
},
|
},
|
||||||
ishttp(url) {
|
ishttp(url) {
|
||||||
return url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1
|
return url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
* 分布式日志 TLog 支持跟踪链路日志记录、性能分析、链路排查<br/>
|
* 分布式日志 TLog 支持跟踪链路日志记录、性能分析、链路排查<br/>
|
||||||
* 分布式任务调度 Xxl-Job 高性能 高可靠 易扩展<br/>
|
* 分布式任务调度 Xxl-Job 高性能 高可靠 易扩展<br/>
|
||||||
* 文件存储 Minio 本地存储<br/>
|
* 文件存储 Minio 本地存储<br/>
|
||||||
* 文件存储 七牛、阿里、腾讯 云存储<br/>
|
* 文件存储 七牛、阿里、腾讯 云存储<br/>
|
||||||
* 监控框架 SpringBoot-Admin 全方位服务监控<br/>
|
* 监控框架 SpringBoot-Admin 全方位服务监控<br/>
|
||||||
* 校验框架 Validation 增强接口安全性 严谨性<br/>
|
* 校验框架 Validation 增强接口安全性 严谨性<br/>
|
||||||
* Excel框架 Alibaba EasyExcel 性能优异 扩展性强<br/>
|
* Excel框架 Alibaba EasyExcel 性能优异 扩展性强<br/>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
v-model="queryParams.ipaddr"
|
v-model="queryParams.ipaddr"
|
||||||
placeholder="请输入登录地址"
|
placeholder="请输入登录地址"
|
||||||
clearable
|
clearable
|
||||||
size="small"
|
size="small"
|
||||||
style="width: 240px;"
|
style="width: 240px;"
|
||||||
@keyup.enter.native="handleQuery"
|
@keyup.enter.native="handleQuery"
|
||||||
/>
|
/>
|
||||||
@ -16,7 +16,7 @@
|
|||||||
v-model="queryParams.userName"
|
v-model="queryParams.userName"
|
||||||
placeholder="请输入用户名称"
|
placeholder="请输入用户名称"
|
||||||
clearable
|
clearable
|
||||||
size="small"
|
size="small"
|
||||||
style="width: 240px;"
|
style="width: 240px;"
|
||||||
@keyup.enter.native="handleQuery"
|
@keyup.enter.native="handleQuery"
|
||||||
/>
|
/>
|
||||||
|
@ -1,67 +1,67 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
rem jar平级目录
|
rem jarƽ<EFBFBD><EFBFBD>Ŀ¼
|
||||||
set AppName=ruoyi-admin.jar
|
set AppName=ruoyi-admin.jar
|
||||||
|
|
||||||
rem JVM参数
|
rem JVM<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
set JVM_OPTS="-Dname=%AppName% -Duser.timezone=Asia/Shanghai -Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC"
|
set JVM_OPTS="-Dname=%AppName% -Duser.timezone=Asia/Shanghai -Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC"
|
||||||
|
|
||||||
|
|
||||||
ECHO.
|
ECHO.
|
||||||
ECHO. [1] 启动%AppName%
|
ECHO. [1] <20><><EFBFBD><EFBFBD>%AppName%
|
||||||
ECHO. [2] 关闭%AppName%
|
ECHO. [2] <20>ر<EFBFBD>%AppName%
|
||||||
ECHO. [3] 重启%AppName%
|
ECHO. [3] <20><><EFBFBD><EFBFBD>%AppName%
|
||||||
ECHO. [4] 启动状态 %AppName%
|
ECHO. [4] <20><><EFBFBD><EFBFBD>״̬ %AppName%
|
||||||
ECHO. [5] 退 出
|
ECHO. [5] <20><> <20><>
|
||||||
ECHO.
|
ECHO.
|
||||||
|
|
||||||
ECHO.请输入选择项目的序号:
|
ECHO.<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
|
||||||
set /p ID=
|
set /p ID=
|
||||||
IF "%id%"=="1" GOTO start
|
IF "%id%"=="1" GOTO start
|
||||||
IF "%id%"=="2" GOTO stop
|
IF "%id%"=="2" GOTO stop
|
||||||
IF "%id%"=="3" GOTO restart
|
IF "%id%"=="3" GOTO restart
|
||||||
IF "%id%"=="4" GOTO status
|
IF "%id%"=="4" GOTO status
|
||||||
IF "%id%"=="5" EXIT
|
IF "%id%"=="5" EXIT
|
||||||
PAUSE
|
PAUSE
|
||||||
:start
|
:start
|
||||||
for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do (
|
for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do (
|
||||||
set pid=%%a
|
set pid=%%a
|
||||||
set image_name=%%b
|
set image_name=%%b
|
||||||
)
|
)
|
||||||
if defined pid (
|
if defined pid (
|
||||||
echo %%is running
|
echo %%is running
|
||||||
PAUSE
|
PAUSE
|
||||||
)
|
)
|
||||||
|
|
||||||
start javaw %JAVA_OPTS% -jar %AppName%
|
start javaw %JAVA_OPTS% -jar %AppName%
|
||||||
|
|
||||||
echo starting……
|
echo starting<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
echo Start %AppName% success...
|
echo Start %AppName% success...
|
||||||
goto:eof
|
goto:eof
|
||||||
|
|
||||||
rem 函数stop通过jps命令查找pid并结束进程
|
rem <EFBFBD><EFBFBD><EFBFBD><EFBFBD>stopͨ<EFBFBD><EFBFBD>jps<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>pid<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
:stop
|
:stop
|
||||||
for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do (
|
for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do (
|
||||||
set pid=%%a
|
set pid=%%a
|
||||||
set image_name=%%b
|
set image_name=%%b
|
||||||
)
|
)
|
||||||
if not defined pid (echo process %AppName% does not exists) else (
|
if not defined pid (echo process %AppName% does not exists) else (
|
||||||
echo prepare to kill %image_name%
|
echo prepare to kill %image_name%
|
||||||
echo start kill %pid% ...
|
echo start kill %pid% ...
|
||||||
rem 根据进程ID,kill进程
|
rem <20><><EFBFBD>ݽ<EFBFBD><DDBD><EFBFBD>ID<49><44>kill<6C><6C><EFBFBD><EFBFBD>
|
||||||
taskkill /f /pid %pid%
|
taskkill /f /pid %pid%
|
||||||
)
|
)
|
||||||
goto:eof
|
goto:eof
|
||||||
:restart
|
:restart
|
||||||
call :stop
|
call :stop
|
||||||
call :start
|
call :start
|
||||||
goto:eof
|
goto:eof
|
||||||
:status
|
:status
|
||||||
for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do (
|
for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do (
|
||||||
set pid=%%a
|
set pid=%%a
|
||||||
set image_name=%%b
|
set image_name=%%b
|
||||||
)
|
)
|
||||||
if not defined pid (echo process %AppName% is dead ) else (
|
if not defined pid (echo process %AppName% is dead ) else (
|
||||||
echo %image_name% is running
|
echo %image_name% is running
|
||||||
)
|
)
|
||||||
goto:eof
|
goto:eof
|
||||||
|
@ -23,36 +23,36 @@ function start()
|
|||||||
{
|
{
|
||||||
PID=`ps -ef |grep java|grep $AppName|grep -v grep|awk '{print $2}'`
|
PID=`ps -ef |grep java|grep $AppName|grep -v grep|awk '{print $2}'`
|
||||||
|
|
||||||
if [ x"$PID" != x"" ]; then
|
if [ x"$PID" != x"" ]; then
|
||||||
echo "$AppName is running..."
|
echo "$AppName is running..."
|
||||||
else
|
else
|
||||||
nohup java $JVM_OPTS -jar $AppName > /dev/null 2>&1 &
|
nohup java $JVM_OPTS -jar $AppName > /dev/null 2>&1 &
|
||||||
echo "Start $AppName success..."
|
echo "Start $AppName success..."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function stop()
|
function stop()
|
||||||
{
|
{
|
||||||
echo "Stop $AppName"
|
echo "Stop $AppName"
|
||||||
|
|
||||||
PID=""
|
PID=""
|
||||||
query(){
|
query(){
|
||||||
PID=`ps -ef |grep java|grep $AppName|grep -v grep|awk '{print $2}'`
|
PID=`ps -ef |grep java|grep $AppName|grep -v grep|awk '{print $2}'`
|
||||||
}
|
}
|
||||||
|
|
||||||
query
|
query
|
||||||
if [ x"$PID" != x"" ]; then
|
if [ x"$PID" != x"" ]; then
|
||||||
kill -TERM $PID
|
kill -TERM $PID
|
||||||
echo "$AppName (pid:$PID) exiting..."
|
echo "$AppName (pid:$PID) exiting..."
|
||||||
while [ x"$PID" != x"" ]
|
while [ x"$PID" != x"" ]
|
||||||
do
|
do
|
||||||
sleep 1
|
sleep 1
|
||||||
query
|
query
|
||||||
done
|
done
|
||||||
echo "$AppName exited."
|
echo "$AppName exited."
|
||||||
else
|
else
|
||||||
echo "$AppName already stopped."
|
echo "$AppName already stopped."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function restart()
|
function restart()
|
||||||
|
@ -2,107 +2,107 @@
|
|||||||
|
|
||||||
#使用说明,用来提示输入参数
|
#使用说明,用来提示输入参数
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: sh 执行脚本.sh [port|mount|monitor|base|start|stop|stopall|rm|rmiNoneTag]"
|
echo "Usage: sh 执行脚本.sh [port|mount|monitor|base|start|stop|stopall|rm|rmiNoneTag]"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
#开启所需端口(生产环境不推荐开启)
|
#开启所需端口(生产环境不推荐开启)
|
||||||
port(){
|
port(){
|
||||||
# mysql 端口
|
# mysql 端口
|
||||||
firewall-cmd --add-port=3306/tcp --permanent
|
firewall-cmd --add-port=3306/tcp --permanent
|
||||||
# redis 端口
|
# redis 端口
|
||||||
firewall-cmd --add-port=6379/tcp --permanent
|
firewall-cmd --add-port=6379/tcp --permanent
|
||||||
# minio api 端口
|
# minio api 端口
|
||||||
firewall-cmd --add-port=9000/tcp --permanent
|
firewall-cmd --add-port=9000/tcp --permanent
|
||||||
# minio 控制台端口
|
# minio 控制台端口
|
||||||
firewall-cmd --add-port=9001/tcp --permanent
|
firewall-cmd --add-port=9001/tcp --permanent
|
||||||
# 监控中心端口
|
# 监控中心端口
|
||||||
firewall-cmd --add-port=9090/tcp --permanent
|
firewall-cmd --add-port=9090/tcp --permanent
|
||||||
# 任务调度中心端口
|
# 任务调度中心端口
|
||||||
firewall-cmd --add-port=9100/tcp --permanent
|
firewall-cmd --add-port=9100/tcp --permanent
|
||||||
# 重启防火墙
|
# 重启防火墙
|
||||||
service firewalld restart
|
service firewalld restart
|
||||||
}
|
}
|
||||||
|
|
||||||
##放置挂载文件
|
##放置挂载文件
|
||||||
mount(){
|
mount(){
|
||||||
#挂载 nginx 配置文件
|
#挂载 nginx 配置文件
|
||||||
if test ! -f "/docker/nginx/conf/nginx.conf" ;then
|
if test ! -f "/docker/nginx/conf/nginx.conf" ;then
|
||||||
mkdir -p /docker/nginx/conf
|
mkdir -p /docker/nginx/conf
|
||||||
cp nginx/nginx.conf /docker/nginx/conf/nginx.conf
|
cp nginx/nginx.conf /docker/nginx/conf/nginx.conf
|
||||||
fi
|
fi
|
||||||
#挂载 redis 配置文件
|
#挂载 redis 配置文件
|
||||||
if test ! -f "/docker/redis/conf/redis.conf" ;then
|
if test ! -f "/docker/redis/conf/redis.conf" ;then
|
||||||
mkdir -p /docker/redis/conf
|
mkdir -p /docker/redis/conf
|
||||||
cp redis/redis.conf /docker/redis/conf/redis.conf
|
cp redis/redis.conf /docker/redis/conf/redis.conf
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#启动基础模块
|
#启动基础模块
|
||||||
base(){
|
base(){
|
||||||
docker-compose up -d mysql nginx-web redis minio
|
docker-compose up -d mysql nginx-web redis minio
|
||||||
}
|
}
|
||||||
|
|
||||||
#启动监控模块
|
#启动监控模块
|
||||||
monitor(){
|
monitor(){
|
||||||
docker-compose up -d ruoyi-monitor-admin
|
docker-compose up -d ruoyi-monitor-admin
|
||||||
}
|
}
|
||||||
|
|
||||||
#启动程序模块
|
#启动程序模块
|
||||||
start(){
|
start(){
|
||||||
docker-compose up -d ruoyi-xxl-job-admin ruoyi-server1 ruoyi-server2
|
docker-compose up -d ruoyi-xxl-job-admin ruoyi-server1 ruoyi-server2
|
||||||
}
|
}
|
||||||
|
|
||||||
#停止程序模块
|
#停止程序模块
|
||||||
stop(){
|
stop(){
|
||||||
docker-compose stop ruoyi-xxl-job-admin ruoyi-server1 ruoyi-server2
|
docker-compose stop ruoyi-xxl-job-admin ruoyi-server1 ruoyi-server2
|
||||||
}
|
}
|
||||||
|
|
||||||
#关闭所有模块
|
#关闭所有模块
|
||||||
stopall(){
|
stopall(){
|
||||||
docker-compose stop
|
docker-compose stop
|
||||||
}
|
}
|
||||||
|
|
||||||
#删除所有模块
|
#删除所有模块
|
||||||
rm(){
|
rm(){
|
||||||
docker-compose rm
|
docker-compose rm
|
||||||
}
|
}
|
||||||
|
|
||||||
#删除Tag为空的镜像
|
#删除Tag为空的镜像
|
||||||
rmiNoneTag(){
|
rmiNoneTag(){
|
||||||
docker images|grep none|awk '{print $3}'|xargs docker rmi -f
|
docker images|grep none|awk '{print $3}'|xargs docker rmi -f
|
||||||
}
|
}
|
||||||
|
|
||||||
#根据输入参数,选择执行对应方法,不输入则执行使用说明
|
#根据输入参数,选择执行对应方法,不输入则执行使用说明
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"port")
|
"port")
|
||||||
port
|
port
|
||||||
;;
|
;;
|
||||||
"mount")
|
"mount")
|
||||||
mount
|
mount
|
||||||
;;
|
;;
|
||||||
"base")
|
"base")
|
||||||
base
|
base
|
||||||
;;
|
;;
|
||||||
"monitor")
|
"monitor")
|
||||||
monitor
|
monitor
|
||||||
;;
|
;;
|
||||||
"start")
|
"start")
|
||||||
start
|
start
|
||||||
;;
|
;;
|
||||||
"stop")
|
"stop")
|
||||||
stop
|
stop
|
||||||
;;
|
;;
|
||||||
"stopall")
|
"stopall")
|
||||||
stopall
|
stopall
|
||||||
;;
|
;;
|
||||||
"rm")
|
"rm")
|
||||||
rm
|
rm
|
||||||
;;
|
;;
|
||||||
"rmiNoneTag")
|
"rmiNoneTag")
|
||||||
rmiNoneTag
|
rmiNoneTag
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -21,11 +21,11 @@ http {
|
|||||||
|
|
||||||
access_log /var/log/nginx/access.log main;
|
access_log /var/log/nginx/access.log main;
|
||||||
|
|
||||||
upstream server {
|
upstream server {
|
||||||
ip_hash;
|
ip_hash;
|
||||||
server 172.30.0.60:8080;
|
server 172.30.0.60:8080;
|
||||||
server 172.30.0.61:8080;
|
server 172.30.0.61:8080;
|
||||||
}
|
}
|
||||||
|
|
||||||
upstream monitor-admin {
|
upstream monitor-admin {
|
||||||
server 172.30.0.90:9090;
|
server 172.30.0.90:9090;
|
||||||
@ -62,30 +62,30 @@ http {
|
|||||||
# return 200 '{"msg":"演示模式,不允许操作","code":500}';
|
# return 200 '{"msg":"演示模式,不允许操作","code":500}';
|
||||||
# }
|
# }
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
try_files $uri $uri/ /index.html;
|
try_files $uri $uri/ /index.html;
|
||||||
index index.html index.htm;
|
index index.html index.htm;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /prod-api/ {
|
location /prod-api/ {
|
||||||
proxy_set_header Host $http_host;
|
proxy_set_header Host $http_host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header REMOTE-HOST $remote_addr;
|
proxy_set_header REMOTE-HOST $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_pass http://server/;
|
proxy_pass http://server/;
|
||||||
}
|
}
|
||||||
|
|
||||||
# https 会拦截内链所有的 http 请求 造成功能无法使用
|
# https 会拦截内链所有的 http 请求 造成功能无法使用
|
||||||
# 解决方案1 将 admin 服务 也配置成 https
|
# 解决方案1 将 admin 服务 也配置成 https
|
||||||
# 解决方案2 将菜单配置为外链访问 走独立页面 http 访问
|
# 解决方案2 将菜单配置为外链访问 走独立页面 http 访问
|
||||||
location /admin/ {
|
location /admin/ {
|
||||||
proxy_set_header Host $http_host;
|
proxy_set_header Host $http_host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header REMOTE-HOST $remote_addr;
|
proxy_set_header REMOTE-HOST $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_pass http://monitor-admin/admin/;
|
proxy_pass http://monitor-admin/admin/;
|
||||||
}
|
}
|
||||||
|
|
||||||
# https 会拦截内链所有的 http 请求 造成功能无法使用
|
# https 会拦截内链所有的 http 请求 造成功能无法使用
|
||||||
# 解决方案1 将 xxljob 服务 也配置成 https
|
# 解决方案1 将 xxljob 服务 也配置成 https
|
||||||
|
@ -14,7 +14,7 @@ create table sys_dept (
|
|||||||
status char(1) default '0' comment '部门状态(0正常 1停用)',
|
status char(1) default '0' comment '部门状态(0正常 1停用)',
|
||||||
del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)',
|
del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)',
|
||||||
create_by varchar(64) default '' comment '创建者',
|
create_by varchar(64) default '' comment '创建者',
|
||||||
create_time datetime comment '创建时间',
|
create_time datetime comment '创建时间',
|
||||||
update_by varchar(64) default '' comment '更新者',
|
update_by varchar(64) default '' comment '更新者',
|
||||||
update_time datetime comment '更新时间',
|
update_time datetime comment '更新时间',
|
||||||
primary key (dept_id)
|
primary key (dept_id)
|
||||||
@ -82,7 +82,7 @@ create table sys_post
|
|||||||
status char(1) not null comment '状态(0正常 1停用)',
|
status char(1) not null comment '状态(0正常 1停用)',
|
||||||
create_by varchar(64) default '' comment '创建者',
|
create_by varchar(64) default '' comment '创建者',
|
||||||
create_time datetime comment '创建时间',
|
create_time datetime comment '创建时间',
|
||||||
update_by varchar(64) default '' comment '更新者',
|
update_by varchar(64) default '' comment '更新者',
|
||||||
update_time datetime comment '更新时间',
|
update_time datetime comment '更新时间',
|
||||||
remark varchar(500) default null comment '备注',
|
remark varchar(500) default null comment '备注',
|
||||||
primary key (post_id)
|
primary key (post_id)
|
||||||
@ -600,7 +600,7 @@ create table gen_table (
|
|||||||
gen_path varchar(200) default '/' comment '生成路径(不填默认项目路径)',
|
gen_path varchar(200) default '/' comment '生成路径(不填默认项目路径)',
|
||||||
options varchar(1000) comment '其它生成选项',
|
options varchar(1000) comment '其它生成选项',
|
||||||
create_by varchar(64) default '' comment '创建者',
|
create_by varchar(64) default '' comment '创建者',
|
||||||
create_time datetime comment '创建时间',
|
create_time datetime comment '创建时间',
|
||||||
update_by varchar(64) default '' comment '更新者',
|
update_by varchar(64) default '' comment '更新者',
|
||||||
update_time datetime comment '更新时间',
|
update_time datetime comment '更新时间',
|
||||||
remark varchar(500) default null comment '备注',
|
remark varchar(500) default null comment '备注',
|
||||||
@ -632,7 +632,7 @@ create table gen_table_column (
|
|||||||
dict_type varchar(200) default '' comment '字典类型',
|
dict_type varchar(200) default '' comment '字典类型',
|
||||||
sort int comment '排序',
|
sort int comment '排序',
|
||||||
create_by varchar(64) default '' comment '创建者',
|
create_by varchar(64) default '' comment '创建者',
|
||||||
create_time datetime comment '创建时间',
|
create_time datetime comment '创建时间',
|
||||||
update_by varchar(64) default '' comment '更新者',
|
update_by varchar(64) default '' comment '更新者',
|
||||||
update_time datetime comment '更新时间',
|
update_time datetime comment '更新时间',
|
||||||
primary key (column_id)
|
primary key (column_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user