mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 08:13:44 +08:00 
			
		
		
		
	发布 4.0.0
This commit is contained in:
		
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -25,6 +25,9 @@ target/
 | 
			
		||||
*.iml
 | 
			
		||||
*.ipr
 | 
			
		||||
 | 
			
		||||
### JRebel ###
 | 
			
		||||
rebel.xml
 | 
			
		||||
 | 
			
		||||
### NetBeans ###
 | 
			
		||||
nbproject/private/
 | 
			
		||||
build/*
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										146
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										146
									
								
								README.md
									
									
									
									
									
								
							@@ -4,7 +4,7 @@
 | 
			
		||||
[](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/blob/master/LICENSE)
 | 
			
		||||
[](https://www.jetbrains.com/?from=RuoYi-Vue-Plus)
 | 
			
		||||
<br>
 | 
			
		||||
[](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus)
 | 
			
		||||
[](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus)
 | 
			
		||||
[]()
 | 
			
		||||
[]()
 | 
			
		||||
[]()
 | 
			
		||||
@@ -13,40 +13,40 @@
 | 
			
		||||
 | 
			
		||||
> 系统演示: [传送门](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全方位升级(不兼容原框架) |
 | 
			
		||||
| 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/) | 单体应用结构 |
 | 
			
		||||
| Vue3分支 | RuoYi-Vue-Plus-UI | [UI地址](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus-UI) | 由于组件还未完善 仅供学习 |
 | 
			
		||||
| 原框架 | RuoYi-Vue | [RuoYi-Vue官网](http://ruoyi.vip/) | 定期同步需要的功能 |
 | 
			
		||||
| 前端开发框架 | Vue、Element UI | [Element UI官网](https://element.eleme.cn/#/zh-CN) | |
 | 
			
		||||
| 后端开发框架 | SpringBoot | [SpringBoot官网](https://spring.io/projects/spring-boot/#learn) | |
 | 
			
		||||
| 容器框架 | Undertow | [Undertow官网](https://undertow.io/) | 基于 XNIO 的高性能容器 |
 | 
			
		||||
| 权限认证框架 | Spring Security、Jwt | [SpringSecurity官网](https://spring.io/projects/spring-security#learn) | 支持多终端认证系统 |
 | 
			
		||||
| 权限认证框架 | Sa-Token、Jwt | [Sa-Token官网](https://sa-token.dev33.cn/) | 强解耦、强扩展 |
 | 
			
		||||
| 关系数据库 | MySQL | [MySQL官网](https://dev.mysql.com/) | 适配 8.X 最低 5.7 |
 | 
			
		||||
| 缓存数据库 | Redis | [Redis官网](https://redis.io/) | 适配 6.X 最低 4.X |
 | 
			
		||||
| 数据库框架 | Mybatis-Plus | [Mybatis-Plus文档](https://baomidou.com/guide/) | 快速 CRUD 增加开发效率 |
 | 
			
		||||
| 数据库框架 | p6spy | [p6spy官网](https://p6spy.readthedocs.io/) | 更强劲的 SQL 分析 |
 | 
			
		||||
| 多数据源框架 | dynamic-datasource | [dynamic-ds文档](https://www.kancloud.cn/tracy5546/dynamic-datasource/content) | 支持主从与多种类数据库异构 |
 | 
			
		||||
| 序列化框架 | Jackson | [Jackson官网](https://github.com/FasterXML/jackson) | 统一使用 jackson 高效可靠 |
 | 
			
		||||
| 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) | 全局、请求IP、集群ID 多种限流 |
 | 
			
		||||
| 分布式锁 | Lock4j | [Lock4j官网](https://gitee.com/baomidou/lock4j) | 注解锁、工具锁 多种多样 |
 | 
			
		||||
| 分布式幂等 | Redisson | [Lock4j文档](https://gitee.com/baomidou/lock4j) | 拦截重复提交 |
 | 
			
		||||
| 分布式日志 | TLog | [TLog文档](https://yomahub.com/tlog/docs) | 支持跟踪链路日志记录、性能分析、链路排查 |
 | 
			
		||||
| 分布式任务调度 | Xxl-Job | [Xxl-Job官网](https://www.xuxueli.com/xxl-job/) | 高性能 高可靠 易扩展 |
 | 
			
		||||
| 文件存储 | Minio | [Minio文档](https://docs.min.io/) | 本地存储 |
 | 
			
		||||
| 文件存储 | 七牛、阿里、腾讯 | [OSS使用文档](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4359146&doc_id=1469725) | 云存储 |
 | 
			
		||||
| 监控框架 | SpringBoot-Admin | [SpringBoot-Admin文档](https://codecentric.github.io/spring-boot-admin/current/) | 全方位服务监控 |
 | 
			
		||||
| 校验框架 | Validation | [Validation文档](https://docs.jboss.org/hibernate/stable/validator/reference/en-US/html_single/) | 增强接口安全性、严谨性 支持国际化 |
 | 
			
		||||
| Excel框架 | Alibaba EasyExcel | [EasyExcel文档](https://www.yuque.com/easyexcel/doc/easyexcel) | 性能优异 扩展性强 |
 | 
			
		||||
| 文档框架 | Knife4j | [Knife4j文档](https://doc.xiaominfo.com/knife4j/documentation/) | 美化接口文档 |
 | 
			
		||||
| 工具类框架 | Hutool、Lombok | [Hutool文档](https://www.hutool.cn/docs/) | 减少代码冗余 增加安全性 |
 | 
			
		||||
| 代码生成器 | 适配MP、Knife4j规范化代码 | [Hutool文档](https://www.hutool.cn/docs/) | 一键生成前后端代码 |
 | 
			
		||||
| 部署方式 | Docker | [Docker文档](https://docs.docker.com/) | 容器编排 一键部署业务集群 |
 | 
			
		||||
| 国际化 | SpringMessage | [SpringMVC文档](https://docs.spring.io/spring-framework/docs/current/reference/html/web.html#mvc) | Spring标准国际化方案 |
 | 
			
		||||
| 功能介绍     | 使用技术                | 文档地址                                                                                              | 特性注意事项                     |
 | 
			
		||||
|----------|---------------------|---------------------------------------------------------------------------------------------------|----------------------------|
 | 
			
		||||
| 当前框架     | RuoYi-Vue-Plus      | [RuoYi-Vue-Plus文档](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages)                       | 重写RuoYi-Vue全方位升级(不兼容原框架)   |
 | 
			
		||||
| 微服务分支    | RuoYi-Cloud-Plus    | [微服务分支地址](https://gitee.com/JavaLionLi/RuoYi-Cloud-Plus)                                          | 重写RuoYi-Cloud全方位升级(不兼容原框架) |
 | 
			
		||||
| 单体分支     | 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)                                            | 由于组件还未完善 仅供学习              |
 | 
			
		||||
| 原框架      | RuoYi-Vue           | [RuoYi-Vue官网](http://ruoyi.vip/)                                                                  | 定期同步需要的功能                  |
 | 
			
		||||
| 前端开发框架   | Vue、Element UI      | [Element UI官网](https://element.eleme.cn/#/zh-CN)                                                  |                            |
 | 
			
		||||
| 后端开发框架   | SpringBoot          | [SpringBoot官网](https://spring.io/projects/spring-boot/#learn)                                     |                            |
 | 
			
		||||
| 容器框架     | Undertow            | [Undertow官网](https://undertow.io/)                                                                | 基于 XNIO 的高性能容器             |
 | 
			
		||||
| 权限认证框架   | Sa-Token、Jwt        | [Sa-Token官网](https://sa-token.dev33.cn/)                                                          | 强解耦、强扩展                    |
 | 
			
		||||
| 关系数据库    | MySQL               | [MySQL官网](https://dev.mysql.com/)                                                                 | 适配 8.X 最低 5.7              |
 | 
			
		||||
| 缓存数据库    | Redis               | [Redis官网](https://redis.io/)                                                                      | 适配 6.X 最低 4.X              |
 | 
			
		||||
| 数据库框架    | Mybatis-Plus        | [Mybatis-Plus文档](https://baomidou.com/guide/)                                                     | 快速 CRUD 增加开发效率             |
 | 
			
		||||
| 数据库框架    | p6spy               | [p6spy官网](https://p6spy.readthedocs.io/)                                                          | 更强劲的 SQL 分析                |
 | 
			
		||||
| 多数据源框架   | dynamic-datasource  | [dynamic-ds文档](https://www.kancloud.cn/tracy5546/dynamic-datasource/content)                      | 支持主从与多种类数据库异构              |
 | 
			
		||||
| 序列化框架    | Jackson             | [Jackson官网](https://github.com/FasterXML/jackson)                                                 | 统一使用 jackson 高效可靠          |
 | 
			
		||||
| 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)                        | 全局、请求IP、集群ID 多种限流          |
 | 
			
		||||
| 分布式队列    | Redisson            | [Redisson文档](https://github.com/redisson/redisson/wiki/%E7%9B%AE%E5%BD%95)                        | 普通队列、延迟队列、优先队列 等           |
 | 
			
		||||
| 分布式锁     | Lock4j              | [Lock4j官网](https://gitee.com/baomidou/lock4j)                                                     | 注解锁、工具锁 多种多样               |
 | 
			
		||||
| 分布式幂等    | Redisson            | [Lock4j文档](https://gitee.com/baomidou/lock4j)                                                     | 拦截重复提交                     |
 | 
			
		||||
| 分布式日志    | TLog                | [TLog文档](https://yomahub.com/tlog/docs)                                                           | 支持跟踪链路日志记录、性能分析、链路排查       |
 | 
			
		||||
| 分布式任务调度  | Xxl-Job             | [Xxl-Job官网](https://www.xuxueli.com/xxl-job/)                                                     | 高性能 高可靠 易扩展                |
 | 
			
		||||
| 文件存储     | Minio               | [Minio文档](https://docs.min.io/)                                                                   | 本地存储                       |
 | 
			
		||||
| 文件存储     | 七牛、阿里、腾讯            | [OSS使用文档](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4359146&doc_id=1469725) | 云存储                        |
 | 
			
		||||
| 监控框架     | SpringBoot-Admin    | [SpringBoot-Admin文档](https://codecentric.github.io/spring-boot-admin/current/)                    | 全方位服务监控                    |
 | 
			
		||||
| 校验框架     | Validation          | [Validation文档](https://docs.jboss.org/hibernate/stable/validator/reference/en-US/html_single/)    | 增强接口安全性、严谨性 支持国际化          |
 | 
			
		||||
| Excel框架  | Alibaba EasyExcel   | [EasyExcel文档](https://www.yuque.com/easyexcel/doc/easyexcel)                                      | 性能优异 扩展性强                  |
 | 
			
		||||
| 文档框架     | Knife4j             | [Knife4j文档](https://doc.xiaominfo.com/knife4j/documentation/)                                     | 美化接口文档                     |
 | 
			
		||||
| 工具类框架    | Hutool、Lombok       | [Hutool文档](https://www.hutool.cn/docs/)                                                           | 减少代码冗余 增加安全性               |
 | 
			
		||||
| 代码生成器    | 适配MP、Knife4j规范化代码   | [Hutool文档](https://www.hutool.cn/docs/)                                                           | 一键生成前后端代码                  |
 | 
			
		||||
| 部署方式     | Docker              | [Docker文档](https://docs.docker.com/)                                                              | 容器编排 一键部署业务集群              |
 | 
			
		||||
| 国际化      | SpringMessage       | [SpringMVC文档](https://docs.spring.io/spring-framework/docs/current/reference/html/web.html#mvc)   | Spring标准国际化方案              |
 | 
			
		||||
 | 
			
		||||
## 参考文档
 | 
			
		||||
 | 
			
		||||
@@ -74,8 +74,8 @@
 | 
			
		||||
 | 
			
		||||
* 同步升级 RuoYi-Vue
 | 
			
		||||
* GitHub 地址 [RuoYi-Vue-Plus-github](https://github.com/JavaLionLi/RuoYi-Vue-Plus)
 | 
			
		||||
* 单模块 fast 分支 [RuoYi-Vue-Plus-fast](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/tree/fast/)
 | 
			
		||||
* satoken 分支 [RuoYi-Vue-Plus-satoken](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/tree/satoken/)
 | 
			
		||||
* 单模块 分支 [RuoYi-Vue-Plus-fast](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/tree/fast/)
 | 
			
		||||
* 微服务 分支 [RuoYi-Cloud-Plus](https://gitee.com/JavaLionLi/RuoYi-Cloud-Plus)
 | 
			
		||||
* 用户扩展项目 [扩展项目列表](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4478302&doc_id=1469725)
 | 
			
		||||
 | 
			
		||||
## 加群与捐献
 | 
			
		||||
@@ -114,40 +114,40 @@
 | 
			
		||||
## 演示图例
 | 
			
		||||
 | 
			
		||||
<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
 | 
			
		||||
	<tbody>
 | 
			
		||||
		<tr>
 | 
			
		||||
			<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>
 | 
			
		||||
		</tr>
 | 
			
		||||
		<tr>
 | 
			
		||||
			<td>
 | 
			
		||||
			<p><img src="https://oscimg.oschina.net/oscnet/up-e56e3828f48cd9886d88731766f06d5f3c1.png" width="1920" /></p>
 | 
			
		||||
			</td>
 | 
			
		||||
			<td><img src="https://oscimg.oschina.net/oscnet/up-0715990ea1a9f254ec2138fcd063c1f556a.png" width="1920" /></td>
 | 
			
		||||
		</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-fc285cf33095ebf8318de6999af0f473861.png" width="1920" /></td>
 | 
			
		||||
		</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-7f731948c8b73c7d90f67f9e1c7a534d5c3.png" width="1920" /></td>
 | 
			
		||||
		</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-8791d823a508eb90e67c604f36f57491a67.png" width="1920" /></td>
 | 
			
		||||
		</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-8ea177cdacaea20995daf2f596b15232561.png" width="1920" /></td>
 | 
			
		||||
		</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-04fa118f7631b7ae6fd72299ca0a1430a63.png" width="1920" /></td>
 | 
			
		||||
		</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-eff2b02a54f8188022d8498cfe6af6fcc06.png" width="1920" /></td>
 | 
			
		||||
		</tr>
 | 
			
		||||
	</tbody>
 | 
			
		||||
    <tbody>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <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>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <td>
 | 
			
		||||
            <p><img src="https://oscimg.oschina.net/oscnet/up-e56e3828f48cd9886d88731766f06d5f3c1.png" width="1920" /></p>
 | 
			
		||||
            </td>
 | 
			
		||||
            <td><img src="https://oscimg.oschina.net/oscnet/up-0715990ea1a9f254ec2138fcd063c1f556a.png" width="1920" /></td>
 | 
			
		||||
        </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-fc285cf33095ebf8318de6999af0f473861.png" width="1920" /></td>
 | 
			
		||||
        </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-7f731948c8b73c7d90f67f9e1c7a534d5c3.png" width="1920" /></td>
 | 
			
		||||
        </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-8791d823a508eb90e67c604f36f57491a67.png" width="1920" /></td>
 | 
			
		||||
        </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-8ea177cdacaea20995daf2f596b15232561.png" width="1920" /></td>
 | 
			
		||||
        </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-04fa118f7631b7ae6fd72299ca0a1430a63.png" width="1920" /></td>
 | 
			
		||||
        </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-eff2b02a54f8188022d8498cfe6af6fcc06.png" width="1920" /></td>
 | 
			
		||||
        </tr>
 | 
			
		||||
    </tbody>
 | 
			
		||||
</table>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										95
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										95
									
								
								pom.xml
									
									
									
									
									
								
							@@ -2,36 +2,37 @@
 | 
			
		||||
<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">
 | 
			
		||||
	<modelVersion>4.0.0</modelVersion>
 | 
			
		||||
    <modelVersion>4.0.0</modelVersion>
 | 
			
		||||
 | 
			
		||||
    <groupId>com.ruoyi</groupId>
 | 
			
		||||
    <artifactId>ruoyi-vue-plus</artifactId>
 | 
			
		||||
    <version>3.5.0</version>
 | 
			
		||||
    <version>4.0.0</version>
 | 
			
		||||
 | 
			
		||||
    <name>RuoYi-Vue-Plus</name>
 | 
			
		||||
    <url>https://gitee.com/JavaLionLi/RuoYi-Vue-Plus</url>
 | 
			
		||||
    <description>RuoYi-Vue-Plus后台管理系统</description>
 | 
			
		||||
 | 
			
		||||
    <properties>
 | 
			
		||||
        <ruoyi-vue-plus.version>3.5.0</ruoyi-vue-plus.version>
 | 
			
		||||
        <spring-boot.version>2.5.8</spring-boot.version>
 | 
			
		||||
        <ruoyi-vue-plus.version>4.0.0</ruoyi-vue-plus.version>
 | 
			
		||||
        <spring-boot.version>2.6.3</spring-boot.version>
 | 
			
		||||
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 | 
			
		||||
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
 | 
			
		||||
        <java.version>1.8</java.version>
 | 
			
		||||
        <maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
 | 
			
		||||
        <maven-jar-plugin.version>3.2.2</maven-jar-plugin.version>
 | 
			
		||||
        <druid.version>1.2.8</druid.version>
 | 
			
		||||
        <knife4j.version>3.0.3</knife4j.version>
 | 
			
		||||
        <swagger-annotations.version>1.5.22</swagger-annotations.version>
 | 
			
		||||
        <poi.version>4.1.2</poi.version>
 | 
			
		||||
        <easyexcel.version>2.2.11</easyexcel.version>
 | 
			
		||||
        <easyexcel.version>3.0.5</easyexcel.version>
 | 
			
		||||
        <cglib.version>3.3.0</cglib.version>
 | 
			
		||||
        <velocity.version>2.3</velocity.version>
 | 
			
		||||
        <mybatis-plus.version>3.4.3.4</mybatis-plus.version>
 | 
			
		||||
        <satoken.version>1.29.0</satoken.version>
 | 
			
		||||
        <mybatis-plus.version>3.5.1</mybatis-plus.version>
 | 
			
		||||
        <p6spy.version>3.9.1</p6spy.version>
 | 
			
		||||
        <hutool.version>5.7.18</hutool.version>
 | 
			
		||||
        <hutool.version>5.7.20</hutool.version>
 | 
			
		||||
        <okhttp.version>4.9.2</okhttp.version>
 | 
			
		||||
        <spring-boot-admin.version>2.5.5</spring-boot-admin.version>
 | 
			
		||||
        <redisson.version>3.16.7</redisson.version>
 | 
			
		||||
        <spring-boot-admin.version>2.6.2</spring-boot-admin.version>
 | 
			
		||||
        <redisson.version>3.16.8</redisson.version>
 | 
			
		||||
        <lock4j.version>2.2.1</lock4j.version>
 | 
			
		||||
        <dynamic-ds.version>3.5.0</dynamic-ds.version>
 | 
			
		||||
        <tlog.version>1.3.6</tlog.version>
 | 
			
		||||
@@ -41,10 +42,10 @@
 | 
			
		||||
        <jaxb.version>3.0.1</jaxb.version>
 | 
			
		||||
 | 
			
		||||
        <!-- OSS 配置 -->
 | 
			
		||||
        <qiniu.version>7.9.0</qiniu.version>
 | 
			
		||||
        <aliyun.oss.version>3.13.1</aliyun.oss.version>
 | 
			
		||||
        <qcloud.cos.version>5.6.58</qcloud.cos.version>
 | 
			
		||||
        <minio.version>8.3.4</minio.version>
 | 
			
		||||
        <qiniu.version>7.9.2</qiniu.version>
 | 
			
		||||
        <aliyun.oss.version>3.14.0</aliyun.oss.version>
 | 
			
		||||
        <qcloud.cos.version>5.6.68</qcloud.cos.version>
 | 
			
		||||
        <minio.version>8.3.5</minio.version>
 | 
			
		||||
 | 
			
		||||
        <!-- docker 配置 -->
 | 
			
		||||
        <docker.registry.url>localhost</docker.registry.url>
 | 
			
		||||
@@ -67,6 +68,15 @@
 | 
			
		||||
                <scope>import</scope>
 | 
			
		||||
            </dependency>
 | 
			
		||||
 | 
			
		||||
            <!-- hutool 的依赖配置-->
 | 
			
		||||
            <dependency>
 | 
			
		||||
                <groupId>cn.hutool</groupId>
 | 
			
		||||
                <artifactId>hutool-bom</artifactId>
 | 
			
		||||
                <version>${hutool.version}</version>
 | 
			
		||||
                <type>pom</type>
 | 
			
		||||
                <scope>import</scope>
 | 
			
		||||
            </dependency>
 | 
			
		||||
 | 
			
		||||
            <!-- 阿里数据库连接池 -->
 | 
			
		||||
            <dependency>
 | 
			
		||||
                <groupId>com.alibaba</groupId>
 | 
			
		||||
@@ -128,6 +138,19 @@
 | 
			
		||||
                <version>${velocity.version}</version>
 | 
			
		||||
            </dependency>
 | 
			
		||||
 | 
			
		||||
            <!-- Sa-Token 权限认证, 在线文档:http://sa-token.dev33.cn/ -->
 | 
			
		||||
            <dependency>
 | 
			
		||||
                <groupId>cn.dev33</groupId>
 | 
			
		||||
                <artifactId>sa-token-spring-boot-starter</artifactId>
 | 
			
		||||
                <version>${satoken.version}</version>
 | 
			
		||||
            </dependency>
 | 
			
		||||
            <!-- Sa-Token 整合 jwt -->
 | 
			
		||||
            <dependency>
 | 
			
		||||
                <groupId>cn.dev33</groupId>
 | 
			
		||||
                <artifactId>sa-token-jwt</artifactId>
 | 
			
		||||
                <version>${satoken.version}</version>
 | 
			
		||||
            </dependency>
 | 
			
		||||
 | 
			
		||||
            <!-- jdk11 缺失依赖 jaxb-->
 | 
			
		||||
            <dependency>
 | 
			
		||||
                <groupId>com.sun.xml.bind</groupId>
 | 
			
		||||
@@ -159,36 +182,6 @@
 | 
			
		||||
                <version>${p6spy.version}</version>
 | 
			
		||||
            </dependency>
 | 
			
		||||
 | 
			
		||||
            <dependency>
 | 
			
		||||
                <groupId>cn.hutool</groupId>
 | 
			
		||||
                <artifactId>hutool-core</artifactId>
 | 
			
		||||
                <version>${hutool.version}</version>
 | 
			
		||||
            </dependency>
 | 
			
		||||
 | 
			
		||||
            <dependency>
 | 
			
		||||
                <groupId>cn.hutool</groupId>
 | 
			
		||||
                <artifactId>hutool-http</artifactId>
 | 
			
		||||
                <version>${hutool.version}</version>
 | 
			
		||||
            </dependency>
 | 
			
		||||
 | 
			
		||||
            <dependency>
 | 
			
		||||
                <groupId>cn.hutool</groupId>
 | 
			
		||||
                <artifactId>hutool-captcha</artifactId>
 | 
			
		||||
                <version>${hutool.version}</version>
 | 
			
		||||
            </dependency>
 | 
			
		||||
 | 
			
		||||
            <dependency>
 | 
			
		||||
                <groupId>cn.hutool</groupId>
 | 
			
		||||
                <artifactId>hutool-extra</artifactId>
 | 
			
		||||
                <version>${hutool.version}</version>
 | 
			
		||||
            </dependency>
 | 
			
		||||
 | 
			
		||||
            <dependency>
 | 
			
		||||
                <groupId>cn.hutool</groupId>
 | 
			
		||||
                <artifactId>hutool-jwt</artifactId>
 | 
			
		||||
                <version>${hutool.version}</version>
 | 
			
		||||
            </dependency>
 | 
			
		||||
 | 
			
		||||
            <dependency>
 | 
			
		||||
                <groupId>com.squareup.okhttp3</groupId>
 | 
			
		||||
                <artifactId>okhttp</artifactId>
 | 
			
		||||
@@ -251,7 +244,7 @@
 | 
			
		||||
            <plugin>
 | 
			
		||||
                <groupId>org.apache.maven.plugins</groupId>
 | 
			
		||||
                <artifactId>maven-compiler-plugin</artifactId>
 | 
			
		||||
                <version>3.1</version>
 | 
			
		||||
                <version>3.9.0</version>
 | 
			
		||||
                <configuration>
 | 
			
		||||
                    <source>${java.version}</source>
 | 
			
		||||
                    <target>${java.version}</target>
 | 
			
		||||
@@ -261,8 +254,18 @@
 | 
			
		||||
        </plugins>
 | 
			
		||||
        <resources>
 | 
			
		||||
            <resource>
 | 
			
		||||
                <!--打包该目录下的 application.yml -->
 | 
			
		||||
                <directory>src/main/resources</directory>
 | 
			
		||||
                <!-- 关闭过滤 -->
 | 
			
		||||
                <filtering>false</filtering>
 | 
			
		||||
            </resource>
 | 
			
		||||
            <resource>
 | 
			
		||||
                <directory>src/main/resources</directory>
 | 
			
		||||
                <!-- 引入所有 匹配文件进行过滤 -->
 | 
			
		||||
                <includes>
 | 
			
		||||
                    <include>application*</include>
 | 
			
		||||
                    <include>bootstrap*</include>
 | 
			
		||||
                    <include>banner*</include>
 | 
			
		||||
                </includes>
 | 
			
		||||
                <!-- 启用过滤 即该资源中的变量将会被过滤器中的值替换 -->
 | 
			
		||||
                <filtering>true</filtering>
 | 
			
		||||
            </resource>
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@
 | 
			
		||||
    <parent>
 | 
			
		||||
        <artifactId>ruoyi-vue-plus</artifactId>
 | 
			
		||||
        <groupId>com.ruoyi</groupId>
 | 
			
		||||
        <version>3.5.0</version>
 | 
			
		||||
        <version>4.0.0</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
    <modelVersion>4.0.0</modelVersion>
 | 
			
		||||
    <artifactId>ruoyi-extend</artifactId>
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@
 | 
			
		||||
    <parent>
 | 
			
		||||
        <artifactId>ruoyi-extend</artifactId>
 | 
			
		||||
        <groupId>com.ruoyi</groupId>
 | 
			
		||||
        <version>3.5.0</version>
 | 
			
		||||
        <version>4.0.0</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
    <modelVersion>4.0.0</modelVersion>
 | 
			
		||||
    <packaging>jar</packaging>
 | 
			
		||||
@@ -34,6 +34,11 @@
 | 
			
		||||
            <artifactId>spring-boot-admin-starter-client</artifactId>
 | 
			
		||||
        </dependency>
 | 
			
		||||
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>org.projectlombok</groupId>
 | 
			
		||||
            <artifactId>lombok</artifactId>
 | 
			
		||||
        </dependency>
 | 
			
		||||
 | 
			
		||||
    </dependencies>
 | 
			
		||||
 | 
			
		||||
    <build>
 | 
			
		||||
 
 | 
			
		||||
@@ -11,9 +11,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 | 
			
		||||
@SpringBootApplication
 | 
			
		||||
public class MonitorAdminApplication {
 | 
			
		||||
 | 
			
		||||
	public static void main(String[] args) {
 | 
			
		||||
		SpringApplication.run(MonitorAdminApplication.class, args);
 | 
			
		||||
		System.out.println("Admin 监控启动成功" );
 | 
			
		||||
	}
 | 
			
		||||
    public static void main(String[] args) {
 | 
			
		||||
        SpringApplication.run(MonitorAdminApplication.class, args);
 | 
			
		||||
        System.out.println("Admin 监控启动成功");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -16,33 +16,33 @@ import org.springframework.security.web.authentication.SavedRequestAwareAuthenti
 | 
			
		||||
@EnableWebSecurity
 | 
			
		||||
public class SecurityConfig extends WebSecurityConfigurerAdapter {
 | 
			
		||||
 | 
			
		||||
	private final String adminContextPath;
 | 
			
		||||
    private final String adminContextPath;
 | 
			
		||||
 | 
			
		||||
	public SecurityConfig(AdminServerProperties adminServerProperties) {
 | 
			
		||||
		this.adminContextPath = adminServerProperties.getContextPath();
 | 
			
		||||
	}
 | 
			
		||||
    public SecurityConfig(AdminServerProperties adminServerProperties) {
 | 
			
		||||
        this.adminContextPath = adminServerProperties.getContextPath();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	protected void configure(HttpSecurity httpSecurity) throws Exception {
 | 
			
		||||
		SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
 | 
			
		||||
		successHandler.setTargetUrlParameter("redirectTo");
 | 
			
		||||
		successHandler.setDefaultTargetUrl(adminContextPath + "/");
 | 
			
		||||
		// admin监控 用户鉴权
 | 
			
		||||
		httpSecurity.authorizeRequests()
 | 
			
		||||
			//授予对所有静态资产和登录页面的公共访问权限。
 | 
			
		||||
			.antMatchers(adminContextPath + "/assets/**").permitAll()
 | 
			
		||||
			.antMatchers(adminContextPath + "/login").permitAll()
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void configure(HttpSecurity httpSecurity) throws Exception {
 | 
			
		||||
        SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
 | 
			
		||||
        successHandler.setTargetUrlParameter("redirectTo");
 | 
			
		||||
        successHandler.setDefaultTargetUrl(adminContextPath + "/");
 | 
			
		||||
        // admin监控 用户鉴权
 | 
			
		||||
        httpSecurity.authorizeRequests()
 | 
			
		||||
            //授予对所有静态资产和登录页面的公共访问权限。
 | 
			
		||||
            .antMatchers(adminContextPath + "/assets/**").permitAll()
 | 
			
		||||
            .antMatchers(adminContextPath + "/login").permitAll()
 | 
			
		||||
            .antMatchers("/actuator").permitAll()
 | 
			
		||||
            .antMatchers("/actuator/**").permitAll()
 | 
			
		||||
			//必须对每个其他请求进行身份验证
 | 
			
		||||
			.anyRequest().authenticated().and()
 | 
			
		||||
			//配置登录和注销
 | 
			
		||||
			.formLogin().loginPage(adminContextPath + "/login")
 | 
			
		||||
			.successHandler(successHandler).and()
 | 
			
		||||
			.logout().logoutUrl(adminContextPath + "/logout").and()
 | 
			
		||||
			//启用HTTP-Basic支持。这是Spring Boot Admin Client注册所必需的
 | 
			
		||||
			.httpBasic().and().csrf().disable()
 | 
			
		||||
			.headers().frameOptions().disable();
 | 
			
		||||
	}
 | 
			
		||||
            //必须对每个其他请求进行身份验证
 | 
			
		||||
            .anyRequest().authenticated().and()
 | 
			
		||||
            //配置登录和注销
 | 
			
		||||
            .formLogin().loginPage(adminContextPath + "/login")
 | 
			
		||||
            .successHandler(successHandler).and()
 | 
			
		||||
            .logout().logoutUrl(adminContextPath + "/logout").and()
 | 
			
		||||
            //启用HTTP-Basic支持。这是Spring Boot Admin Client注册所必需的
 | 
			
		||||
            .httpBasic().and().csrf().disable()
 | 
			
		||||
            .headers().frameOptions().disable();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,40 @@
 | 
			
		||||
package com.ruoyi.monitor.admin.notifier;
 | 
			
		||||
 | 
			
		||||
import de.codecentric.boot.admin.server.domain.entities.Instance;
 | 
			
		||||
import de.codecentric.boot.admin.server.domain.entities.InstanceRepository;
 | 
			
		||||
import de.codecentric.boot.admin.server.domain.events.InstanceEvent;
 | 
			
		||||
import de.codecentric.boot.admin.server.domain.events.InstanceStatusChangedEvent;
 | 
			
		||||
import de.codecentric.boot.admin.server.notify.AbstractEventNotifier;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
import org.springframework.stereotype.Component;
 | 
			
		||||
import reactor.core.publisher.Mono;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 自定义事件通知处理
 | 
			
		||||
 *
 | 
			
		||||
 * @author Lion Li
 | 
			
		||||
 */
 | 
			
		||||
@Slf4j
 | 
			
		||||
@Component
 | 
			
		||||
public class CustomNotifier extends AbstractEventNotifier {
 | 
			
		||||
 | 
			
		||||
    protected CustomNotifier(InstanceRepository repository) {
 | 
			
		||||
        super(repository);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @SuppressWarnings("all")
 | 
			
		||||
    protected Mono<Void> doNotify(InstanceEvent event, Instance instance) {
 | 
			
		||||
        return Mono.fromRunnable(() -> {
 | 
			
		||||
            // 实例状态改变事件
 | 
			
		||||
            if (event instanceof InstanceStatusChangedEvent) {
 | 
			
		||||
                String registName = instance.getRegistration().getName();
 | 
			
		||||
                String instanceId = event.getInstance().getValue();
 | 
			
		||||
                String status = ((InstanceStatusChangedEvent) event).getStatusInfo().getStatus();
 | 
			
		||||
                log.info("Instance Status Change: [{}],[{}],[{}]", registName, instanceId, status);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -9,6 +9,6 @@ spring:
 | 
			
		||||
        # 设置 Spring Boot Admin Server 地址
 | 
			
		||||
        url: http://localhost:9090/admin
 | 
			
		||||
        instance:
 | 
			
		||||
          prefer-ip: true # 注册实例时,优先使用 IP
 | 
			
		||||
          service-host-type: IP
 | 
			
		||||
        username: ruoyi
 | 
			
		||||
        password: 123456
 | 
			
		||||
 
 | 
			
		||||
@@ -9,6 +9,6 @@ spring:
 | 
			
		||||
        # 设置 Spring Boot Admin Server 地址
 | 
			
		||||
        url: http://172.30.0.90:9090/admin
 | 
			
		||||
        instance:
 | 
			
		||||
          prefer-ip: true # 注册实例时,优先使用 IP
 | 
			
		||||
          service-host-type: IP
 | 
			
		||||
        username: ruoyi
 | 
			
		||||
        password: 123456
 | 
			
		||||
 
 | 
			
		||||
@@ -1,139 +1,126 @@
 | 
			
		||||
<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">
 | 
			
		||||
	<modelVersion>4.0.0</modelVersion>
 | 
			
		||||
	<parent>
 | 
			
		||||
    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>
 | 
			
		||||
    <parent>
 | 
			
		||||
        <artifactId>ruoyi-extend</artifactId>
 | 
			
		||||
        <groupId>com.ruoyi</groupId>
 | 
			
		||||
        <version>3.5.0</version>
 | 
			
		||||
	</parent>
 | 
			
		||||
	<artifactId>ruoyi-xxl-job-admin</artifactId>
 | 
			
		||||
	<packaging>jar</packaging>
 | 
			
		||||
        <version>4.0.0</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
    <artifactId>ruoyi-xxl-job-admin</artifactId>
 | 
			
		||||
    <packaging>jar</packaging>
 | 
			
		||||
 | 
			
		||||
	<properties>
 | 
			
		||||
		<mybatis-spring-boot-starter.version>2.1.4</mybatis-spring-boot-starter.version>
 | 
			
		||||
		<mysql-connector-java.version>8.0.23</mysql-connector-java.version>
 | 
			
		||||
	</properties>
 | 
			
		||||
    <properties>
 | 
			
		||||
        <mybatis-spring-boot-starter.version>2.1.4</mybatis-spring-boot-starter.version>
 | 
			
		||||
        <mysql-connector-java.version>8.0.23</mysql-connector-java.version>
 | 
			
		||||
    </properties>
 | 
			
		||||
 | 
			
		||||
	<dependencyManagement>
 | 
			
		||||
		<dependencies>
 | 
			
		||||
			<dependency>
 | 
			
		||||
				<groupId>org.springframework.boot</groupId>
 | 
			
		||||
				<artifactId>spring-boot-starter-parent</artifactId>
 | 
			
		||||
				<version>${spring-boot.version}</version>
 | 
			
		||||
				<type>pom</type>
 | 
			
		||||
				<scope>import</scope>
 | 
			
		||||
			</dependency>
 | 
			
		||||
		</dependencies>
 | 
			
		||||
	</dependencyManagement>
 | 
			
		||||
    <dependencyManagement>
 | 
			
		||||
        <dependencies>
 | 
			
		||||
            <dependency>
 | 
			
		||||
                <groupId>org.springframework.boot</groupId>
 | 
			
		||||
                <artifactId>spring-boot-starter-parent</artifactId>
 | 
			
		||||
                <version>${spring-boot.version}</version>
 | 
			
		||||
                <type>pom</type>
 | 
			
		||||
                <scope>import</scope>
 | 
			
		||||
            </dependency>
 | 
			
		||||
        </dependencies>
 | 
			
		||||
    </dependencyManagement>
 | 
			
		||||
 | 
			
		||||
	<dependencies>
 | 
			
		||||
    <dependencies>
 | 
			
		||||
 | 
			
		||||
		<!-- starter-web:spring-webmvc + autoconfigure + logback + yaml + tomcat -->
 | 
			
		||||
		<dependency>
 | 
			
		||||
			<groupId>org.springframework.boot</groupId>
 | 
			
		||||
			<artifactId>spring-boot-starter-web</artifactId>
 | 
			
		||||
		</dependency>
 | 
			
		||||
		<!-- starter-test:junit + spring-test + mockito -->
 | 
			
		||||
		<dependency>
 | 
			
		||||
			<groupId>org.springframework.boot</groupId>
 | 
			
		||||
			<artifactId>spring-boot-starter-test</artifactId>
 | 
			
		||||
			<scope>test</scope>
 | 
			
		||||
		</dependency>
 | 
			
		||||
        <!-- starter-web:spring-webmvc + autoconfigure + logback + yaml + tomcat -->
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>org.springframework.boot</groupId>
 | 
			
		||||
            <artifactId>spring-boot-starter-web</artifactId>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <!-- starter-test:junit + spring-test + mockito -->
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>org.springframework.boot</groupId>
 | 
			
		||||
            <artifactId>spring-boot-starter-test</artifactId>
 | 
			
		||||
            <scope>test</scope>
 | 
			
		||||
        </dependency>
 | 
			
		||||
 | 
			
		||||
		<!-- freemarker-starter -->
 | 
			
		||||
		<dependency>
 | 
			
		||||
			<groupId>org.springframework.boot</groupId>
 | 
			
		||||
			<artifactId>spring-boot-starter-freemarker</artifactId>
 | 
			
		||||
		</dependency>
 | 
			
		||||
        <!-- freemarker-starter -->
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>org.springframework.boot</groupId>
 | 
			
		||||
            <artifactId>spring-boot-starter-freemarker</artifactId>
 | 
			
		||||
        </dependency>
 | 
			
		||||
 | 
			
		||||
		<!-- mail-starter -->
 | 
			
		||||
		<dependency>
 | 
			
		||||
			<groupId>org.springframework.boot</groupId>
 | 
			
		||||
			<artifactId>spring-boot-starter-mail</artifactId>
 | 
			
		||||
		</dependency>
 | 
			
		||||
        <!-- mail-starter -->
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>org.springframework.boot</groupId>
 | 
			
		||||
            <artifactId>spring-boot-starter-mail</artifactId>
 | 
			
		||||
        </dependency>
 | 
			
		||||
 | 
			
		||||
		<!-- starter-actuator -->
 | 
			
		||||
		<dependency>
 | 
			
		||||
			<groupId>org.springframework.boot</groupId>
 | 
			
		||||
			<artifactId>spring-boot-starter-actuator</artifactId>
 | 
			
		||||
		</dependency>
 | 
			
		||||
        <!-- starter-actuator -->
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>org.springframework.boot</groupId>
 | 
			
		||||
            <artifactId>spring-boot-starter-actuator</artifactId>
 | 
			
		||||
        </dependency>
 | 
			
		||||
 | 
			
		||||
		<!-- mybatis-starter:mybatis + mybatis-spring + hikari(default) -->
 | 
			
		||||
		<dependency>
 | 
			
		||||
			<groupId>org.mybatis.spring.boot</groupId>
 | 
			
		||||
			<artifactId>mybatis-spring-boot-starter</artifactId>
 | 
			
		||||
			<version>${mybatis-spring-boot-starter.version}</version>
 | 
			
		||||
		</dependency>
 | 
			
		||||
		<!-- mysql -->
 | 
			
		||||
		<dependency>
 | 
			
		||||
			<groupId>mysql</groupId>
 | 
			
		||||
			<artifactId>mysql-connector-java</artifactId>
 | 
			
		||||
			<version>${mysql-connector-java.version}</version>
 | 
			
		||||
		</dependency>
 | 
			
		||||
        <!-- mybatis-starter:mybatis + mybatis-spring + hikari(default) -->
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>org.mybatis.spring.boot</groupId>
 | 
			
		||||
            <artifactId>mybatis-spring-boot-starter</artifactId>
 | 
			
		||||
            <version>${mybatis-spring-boot-starter.version}</version>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <!-- mysql -->
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>mysql</groupId>
 | 
			
		||||
            <artifactId>mysql-connector-java</artifactId>
 | 
			
		||||
            <version>${mysql-connector-java.version}</version>
 | 
			
		||||
        </dependency>
 | 
			
		||||
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>de.codecentric</groupId>
 | 
			
		||||
            <artifactId>spring-boot-admin-starter-client</artifactId>
 | 
			
		||||
        </dependency>
 | 
			
		||||
 | 
			
		||||
		<!-- xxl-job-core -->
 | 
			
		||||
		<dependency>
 | 
			
		||||
			<groupId>com.xuxueli</groupId>
 | 
			
		||||
			<artifactId>xxl-job-core</artifactId>
 | 
			
		||||
		</dependency>
 | 
			
		||||
        <!-- xxl-job-core -->
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>com.xuxueli</groupId>
 | 
			
		||||
            <artifactId>xxl-job-core</artifactId>
 | 
			
		||||
        </dependency>
 | 
			
		||||
 | 
			
		||||
	</dependencies>
 | 
			
		||||
    </dependencies>
 | 
			
		||||
 | 
			
		||||
	<build>
 | 
			
		||||
    <build>
 | 
			
		||||
        <finalName>${project.artifactId}</finalName>
 | 
			
		||||
		<plugins>
 | 
			
		||||
			<plugin>
 | 
			
		||||
				<groupId>org.springframework.boot</groupId>
 | 
			
		||||
				<artifactId>spring-boot-maven-plugin</artifactId>
 | 
			
		||||
				<version>${spring-boot.version}</version>
 | 
			
		||||
				<executions>
 | 
			
		||||
					<execution>
 | 
			
		||||
						<goals>
 | 
			
		||||
							<goal>repackage</goal>
 | 
			
		||||
						</goals>
 | 
			
		||||
					</execution>
 | 
			
		||||
				</executions>
 | 
			
		||||
			</plugin>
 | 
			
		||||
			<plugin>
 | 
			
		||||
				<groupId>org.apache.maven.plugins</groupId>
 | 
			
		||||
				<artifactId>maven-resources-plugin</artifactId>
 | 
			
		||||
                <version>2.6</version>
 | 
			
		||||
				<configuration>
 | 
			
		||||
					<nonFilteredFileExtensions>
 | 
			
		||||
						<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
 | 
			
		||||
						<nonFilteredFileExtension>jks</nonFilteredFileExtension>
 | 
			
		||||
						<nonFilteredFileExtension>woff</nonFilteredFileExtension>
 | 
			
		||||
						<nonFilteredFileExtension>woff2</nonFilteredFileExtension>
 | 
			
		||||
					</nonFilteredFileExtensions>
 | 
			
		||||
				</configuration>
 | 
			
		||||
			</plugin>
 | 
			
		||||
			<!-- docker -->
 | 
			
		||||
			<plugin>
 | 
			
		||||
				<groupId>com.spotify</groupId>
 | 
			
		||||
				<artifactId>docker-maven-plugin</artifactId>
 | 
			
		||||
				<version>${docker.plugin.version}</version>
 | 
			
		||||
				<configuration>
 | 
			
		||||
					<!-- made of '[a-z0-9-_.]' -->
 | 
			
		||||
					<imageName>${docker.namespace}/${project.artifactId}:${project.version}</imageName>
 | 
			
		||||
					<dockerDirectory>${project.basedir}</dockerDirectory>
 | 
			
		||||
					<dockerHost>${docker.registry.host}</dockerHost>
 | 
			
		||||
					<registryUrl>${docker.registry.url}</registryUrl>
 | 
			
		||||
					<serverId>${docker.registry.url}</serverId>
 | 
			
		||||
					<resources>
 | 
			
		||||
						<resource>
 | 
			
		||||
							<targetPath>/</targetPath>
 | 
			
		||||
							<directory>${project.build.directory}</directory>
 | 
			
		||||
							<include>${project.build.finalName}.jar</include>
 | 
			
		||||
						</resource>
 | 
			
		||||
					</resources>
 | 
			
		||||
				</configuration>
 | 
			
		||||
			</plugin>
 | 
			
		||||
		</plugins>
 | 
			
		||||
	</build>
 | 
			
		||||
        <plugins>
 | 
			
		||||
            <plugin>
 | 
			
		||||
                <groupId>org.springframework.boot</groupId>
 | 
			
		||||
                <artifactId>spring-boot-maven-plugin</artifactId>
 | 
			
		||||
                <version>${spring-boot.version}</version>
 | 
			
		||||
                <executions>
 | 
			
		||||
                    <execution>
 | 
			
		||||
                        <goals>
 | 
			
		||||
                            <goal>repackage</goal>
 | 
			
		||||
                        </goals>
 | 
			
		||||
                    </execution>
 | 
			
		||||
                </executions>
 | 
			
		||||
            </plugin>
 | 
			
		||||
            <!-- docker -->
 | 
			
		||||
            <plugin>
 | 
			
		||||
                <groupId>com.spotify</groupId>
 | 
			
		||||
                <artifactId>docker-maven-plugin</artifactId>
 | 
			
		||||
                <version>${docker.plugin.version}</version>
 | 
			
		||||
                <configuration>
 | 
			
		||||
                    <!-- made of '[a-z0-9-_.]' -->
 | 
			
		||||
                    <imageName>${docker.namespace}/${project.artifactId}:${project.version}</imageName>
 | 
			
		||||
                    <dockerDirectory>${project.basedir}</dockerDirectory>
 | 
			
		||||
                    <dockerHost>${docker.registry.host}</dockerHost>
 | 
			
		||||
                    <registryUrl>${docker.registry.url}</registryUrl>
 | 
			
		||||
                    <serverId>${docker.registry.url}</serverId>
 | 
			
		||||
                    <resources>
 | 
			
		||||
                        <resource>
 | 
			
		||||
                            <targetPath>/</targetPath>
 | 
			
		||||
                            <directory>${project.build.directory}</directory>
 | 
			
		||||
                            <include>${project.build.finalName}.jar</include>
 | 
			
		||||
                        </resource>
 | 
			
		||||
                    </resources>
 | 
			
		||||
                </configuration>
 | 
			
		||||
            </plugin>
 | 
			
		||||
        </plugins>
 | 
			
		||||
    </build>
 | 
			
		||||
 | 
			
		||||
</project>
 | 
			
		||||
 
 | 
			
		||||
@@ -9,8 +9,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 | 
			
		||||
@SpringBootApplication
 | 
			
		||||
public class XxlJobAdminApplication {
 | 
			
		||||
 | 
			
		||||
	public static void main(String[] args) {
 | 
			
		||||
    public static void main(String[] args) {
 | 
			
		||||
        SpringApplication.run(XxlJobAdminApplication.class, args);
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -24,73 +24,74 @@ import java.util.Map;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * index controller
 | 
			
		||||
 *
 | 
			
		||||
 * @author xuxueli 2015-12-19 16:13:16
 | 
			
		||||
 */
 | 
			
		||||
@Controller
 | 
			
		||||
public class IndexController {
 | 
			
		||||
 | 
			
		||||
	@Resource
 | 
			
		||||
	private XxlJobService xxlJobService;
 | 
			
		||||
	@Resource
 | 
			
		||||
	private LoginService loginService;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private XxlJobService xxlJobService;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private LoginService loginService;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@RequestMapping("/")
 | 
			
		||||
	public String index(Model model) {
 | 
			
		||||
    @RequestMapping("/")
 | 
			
		||||
    public String index(Model model) {
 | 
			
		||||
 | 
			
		||||
		Map<String, Object> dashboardMap = xxlJobService.dashboardInfo();
 | 
			
		||||
		model.addAllAttributes(dashboardMap);
 | 
			
		||||
        Map<String, Object> dashboardMap = xxlJobService.dashboardInfo();
 | 
			
		||||
        model.addAllAttributes(dashboardMap);
 | 
			
		||||
 | 
			
		||||
		return "index";
 | 
			
		||||
	}
 | 
			
		||||
        return "index";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @RequestMapping("/chartInfo")
 | 
			
		||||
	@ResponseBody
 | 
			
		||||
	public ReturnT<Map<String, Object>> chartInfo(Date startDate, Date endDate) {
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    public ReturnT<Map<String, Object>> chartInfo(Date startDate, Date endDate) {
 | 
			
		||||
        ReturnT<Map<String, Object>> chartInfo = xxlJobService.chartInfo(startDate, endDate);
 | 
			
		||||
        return chartInfo;
 | 
			
		||||
    }
 | 
			
		||||
	
 | 
			
		||||
	@RequestMapping("/toLogin")
 | 
			
		||||
	@PermissionLimit(limit=false)
 | 
			
		||||
	public ModelAndView toLogin(HttpServletRequest request, HttpServletResponse response,ModelAndView modelAndView) {
 | 
			
		||||
		if (loginService.ifLogin(request, response) != null) {
 | 
			
		||||
			modelAndView.setView(new RedirectView("/",true,false));
 | 
			
		||||
			return modelAndView;
 | 
			
		||||
		}
 | 
			
		||||
		return new ModelAndView("login");
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@RequestMapping(value="login", method=RequestMethod.POST)
 | 
			
		||||
	@ResponseBody
 | 
			
		||||
	@PermissionLimit(limit=false)
 | 
			
		||||
	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;
 | 
			
		||||
		return loginService.login(request, response, userName, password, ifRem);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@RequestMapping(value="logout", method=RequestMethod.POST)
 | 
			
		||||
	@ResponseBody
 | 
			
		||||
	@PermissionLimit(limit=false)
 | 
			
		||||
	public ReturnT<String> logout(HttpServletRequest request, HttpServletResponse response){
 | 
			
		||||
		return loginService.logout(request, response);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@RequestMapping("/help")
 | 
			
		||||
	public String help() {
 | 
			
		||||
 | 
			
		||||
		/*if (!PermissionInterceptor.ifLogin(request)) {
 | 
			
		||||
			return "redirect:/toLogin";
 | 
			
		||||
		}*/
 | 
			
		||||
    @RequestMapping("/toLogin")
 | 
			
		||||
    @PermissionLimit(limit = false)
 | 
			
		||||
    public ModelAndView toLogin(HttpServletRequest request, HttpServletResponse response, ModelAndView modelAndView) {
 | 
			
		||||
        if (loginService.ifLogin(request, response) != null) {
 | 
			
		||||
            modelAndView.setView(new RedirectView("/" , true, false));
 | 
			
		||||
            return modelAndView;
 | 
			
		||||
        }
 | 
			
		||||
        return new ModelAndView("login");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		return "help";
 | 
			
		||||
	}
 | 
			
		||||
    @RequestMapping(value = "login" , method = RequestMethod.POST)
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    @PermissionLimit(limit = false)
 | 
			
		||||
    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;
 | 
			
		||||
        return loginService.login(request, response, userName, password, ifRem);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @RequestMapping(value = "logout" , method = RequestMethod.POST)
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    @PermissionLimit(limit = false)
 | 
			
		||||
    public ReturnT<String> logout(HttpServletRequest request, HttpServletResponse response) {
 | 
			
		||||
        return loginService.logout(request, response);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @RequestMapping("/help")
 | 
			
		||||
    public String help() {
 | 
			
		||||
 | 
			
		||||
        /*if (!PermissionInterceptor.ifLogin(request)) {
 | 
			
		||||
            return "redirect:/toLogin";
 | 
			
		||||
        }*/
 | 
			
		||||
 | 
			
		||||
        return "help";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @InitBinder
 | 
			
		||||
    public void initBinder(WebDataBinder binder) {
 | 
			
		||||
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 | 
			
		||||
        dateFormat.setLenient(false);
 | 
			
		||||
        binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@InitBinder
 | 
			
		||||
	public void initBinder(WebDataBinder binder) {
 | 
			
		||||
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 | 
			
		||||
		dateFormat.setLenient(false);
 | 
			
		||||
		binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -19,78 +19,79 @@ import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * job code controller
 | 
			
		||||
 *
 | 
			
		||||
 * @author xuxueli 2015-12-19 16:13:16
 | 
			
		||||
 */
 | 
			
		||||
@Controller
 | 
			
		||||
@RequestMapping("/jobcode")
 | 
			
		||||
public class JobCodeController {
 | 
			
		||||
	
 | 
			
		||||
	@Resource
 | 
			
		||||
	private XxlJobInfoDao xxlJobInfoDao;
 | 
			
		||||
	@Resource
 | 
			
		||||
	private XxlJobLogGlueDao xxlJobLogGlueDao;
 | 
			
		||||
 | 
			
		||||
	@RequestMapping
 | 
			
		||||
	public String index(HttpServletRequest request, Model model, int jobId) {
 | 
			
		||||
		XxlJobInfo jobInfo = xxlJobInfoDao.loadById(jobId);
 | 
			
		||||
		List<XxlJobLogGlue> jobLogGlues = xxlJobLogGlueDao.findByJobId(jobId);
 | 
			
		||||
    @Resource
 | 
			
		||||
    private XxlJobInfoDao xxlJobInfoDao;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private XxlJobLogGlueDao xxlJobLogGlueDao;
 | 
			
		||||
 | 
			
		||||
		if (jobInfo == null) {
 | 
			
		||||
			throw new RuntimeException(I18nUtil.getString("jobinfo_glue_jobid_unvalid"));
 | 
			
		||||
		}
 | 
			
		||||
		if (GlueTypeEnum.BEAN == GlueTypeEnum.match(jobInfo.getGlueType())) {
 | 
			
		||||
			throw new RuntimeException(I18nUtil.getString("jobinfo_glue_gluetype_unvalid"));
 | 
			
		||||
		}
 | 
			
		||||
    @RequestMapping
 | 
			
		||||
    public String index(HttpServletRequest request, Model model, int jobId) {
 | 
			
		||||
        XxlJobInfo jobInfo = xxlJobInfoDao.loadById(jobId);
 | 
			
		||||
        List<XxlJobLogGlue> jobLogGlues = xxlJobLogGlueDao.findByJobId(jobId);
 | 
			
		||||
 | 
			
		||||
		// valid permission
 | 
			
		||||
		JobInfoController.validPermission(request, jobInfo.getJobGroup());
 | 
			
		||||
        if (jobInfo == null) {
 | 
			
		||||
            throw new RuntimeException(I18nUtil.getString("jobinfo_glue_jobid_unvalid"));
 | 
			
		||||
        }
 | 
			
		||||
        if (GlueTypeEnum.BEAN == GlueTypeEnum.match(jobInfo.getGlueType())) {
 | 
			
		||||
            throw new RuntimeException(I18nUtil.getString("jobinfo_glue_gluetype_unvalid"));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		// Glue类型-字典
 | 
			
		||||
		model.addAttribute("GlueTypeEnum", GlueTypeEnum.values());
 | 
			
		||||
        // valid permission
 | 
			
		||||
        JobInfoController.validPermission(request, jobInfo.getJobGroup());
 | 
			
		||||
 | 
			
		||||
		model.addAttribute("jobInfo", jobInfo);
 | 
			
		||||
		model.addAttribute("jobLogGlues", jobLogGlues);
 | 
			
		||||
		return "jobcode/jobcode.index";
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@RequestMapping("/save")
 | 
			
		||||
	@ResponseBody
 | 
			
		||||
	public ReturnT<String> save(Model model, int id, String glueSource, String glueRemark) {
 | 
			
		||||
		// valid
 | 
			
		||||
		if (glueRemark==null) {
 | 
			
		||||
			return new ReturnT<String>(500, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_glue_remark")) );
 | 
			
		||||
		}
 | 
			
		||||
		if (glueRemark.length()<4 || glueRemark.length()>100) {
 | 
			
		||||
			return new ReturnT<String>(500, I18nUtil.getString("jobinfo_glue_remark_limit"));
 | 
			
		||||
		}
 | 
			
		||||
		XxlJobInfo exists_jobInfo = xxlJobInfoDao.loadById(id);
 | 
			
		||||
		if (exists_jobInfo == null) {
 | 
			
		||||
			return new ReturnT<String>(500, I18nUtil.getString("jobinfo_glue_jobid_unvalid"));
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		// update new code
 | 
			
		||||
		exists_jobInfo.setGlueSource(glueSource);
 | 
			
		||||
		exists_jobInfo.setGlueRemark(glueRemark);
 | 
			
		||||
		exists_jobInfo.setGlueUpdatetime(new Date());
 | 
			
		||||
        // Glue类型-字典
 | 
			
		||||
        model.addAttribute("GlueTypeEnum" , GlueTypeEnum.values());
 | 
			
		||||
 | 
			
		||||
		exists_jobInfo.setUpdateTime(new Date());
 | 
			
		||||
		xxlJobInfoDao.update(exists_jobInfo);
 | 
			
		||||
        model.addAttribute("jobInfo" , jobInfo);
 | 
			
		||||
        model.addAttribute("jobLogGlues" , jobLogGlues);
 | 
			
		||||
        return "jobcode/jobcode.index";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		// log old code
 | 
			
		||||
		XxlJobLogGlue xxlJobLogGlue = new XxlJobLogGlue();
 | 
			
		||||
		xxlJobLogGlue.setJobId(exists_jobInfo.getId());
 | 
			
		||||
		xxlJobLogGlue.setGlueType(exists_jobInfo.getGlueType());
 | 
			
		||||
		xxlJobLogGlue.setGlueSource(glueSource);
 | 
			
		||||
		xxlJobLogGlue.setGlueRemark(glueRemark);
 | 
			
		||||
    @RequestMapping("/save")
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    public ReturnT<String> save(Model model, int id, String glueSource, String glueRemark) {
 | 
			
		||||
        // valid
 | 
			
		||||
        if (glueRemark == null) {
 | 
			
		||||
            return new ReturnT<String>(500, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_glue_remark")));
 | 
			
		||||
        }
 | 
			
		||||
        if (glueRemark.length() < 4 || glueRemark.length() > 100) {
 | 
			
		||||
            return new ReturnT<String>(500, I18nUtil.getString("jobinfo_glue_remark_limit"));
 | 
			
		||||
        }
 | 
			
		||||
        XxlJobInfo exists_jobInfo = xxlJobInfoDao.loadById(id);
 | 
			
		||||
        if (exists_jobInfo == null) {
 | 
			
		||||
            return new ReturnT<String>(500, I18nUtil.getString("jobinfo_glue_jobid_unvalid"));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		xxlJobLogGlue.setAddTime(new Date());
 | 
			
		||||
		xxlJobLogGlue.setUpdateTime(new Date());
 | 
			
		||||
		xxlJobLogGlueDao.save(xxlJobLogGlue);
 | 
			
		||||
        // update new code
 | 
			
		||||
        exists_jobInfo.setGlueSource(glueSource);
 | 
			
		||||
        exists_jobInfo.setGlueRemark(glueRemark);
 | 
			
		||||
        exists_jobInfo.setGlueUpdatetime(new Date());
 | 
			
		||||
 | 
			
		||||
		// remove code backup more than 30
 | 
			
		||||
		xxlJobLogGlueDao.removeOld(exists_jobInfo.getId(), 30);
 | 
			
		||||
        exists_jobInfo.setUpdateTime(new Date());
 | 
			
		||||
        xxlJobInfoDao.update(exists_jobInfo);
 | 
			
		||||
 | 
			
		||||
        // log old code
 | 
			
		||||
        XxlJobLogGlue xxlJobLogGlue = new XxlJobLogGlue();
 | 
			
		||||
        xxlJobLogGlue.setJobId(exists_jobInfo.getId());
 | 
			
		||||
        xxlJobLogGlue.setGlueType(exists_jobInfo.getGlueType());
 | 
			
		||||
        xxlJobLogGlue.setGlueSource(glueSource);
 | 
			
		||||
        xxlJobLogGlue.setGlueRemark(glueRemark);
 | 
			
		||||
 | 
			
		||||
        xxlJobLogGlue.setAddTime(new Date());
 | 
			
		||||
        xxlJobLogGlue.setUpdateTime(new Date());
 | 
			
		||||
        xxlJobLogGlueDao.save(xxlJobLogGlue);
 | 
			
		||||
 | 
			
		||||
        // remove code backup more than 30
 | 
			
		||||
        xxlJobLogGlueDao.removeOld(exists_jobInfo.getId(), 30);
 | 
			
		||||
 | 
			
		||||
        return ReturnT.SUCCESS;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		return ReturnT.SUCCESS;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -20,178 +20,179 @@ import java.util.*;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * job group controller
 | 
			
		||||
 *
 | 
			
		||||
 * @author xuxueli 2016-10-02 20:52:56
 | 
			
		||||
 */
 | 
			
		||||
@Controller
 | 
			
		||||
@RequestMapping("/jobgroup")
 | 
			
		||||
public class JobGroupController {
 | 
			
		||||
 | 
			
		||||
	@Resource
 | 
			
		||||
	public XxlJobInfoDao xxlJobInfoDao;
 | 
			
		||||
	@Resource
 | 
			
		||||
	public XxlJobGroupDao xxlJobGroupDao;
 | 
			
		||||
	@Resource
 | 
			
		||||
	private XxlJobRegistryDao xxlJobRegistryDao;
 | 
			
		||||
    @Resource
 | 
			
		||||
    public XxlJobInfoDao xxlJobInfoDao;
 | 
			
		||||
    @Resource
 | 
			
		||||
    public XxlJobGroupDao xxlJobGroupDao;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private XxlJobRegistryDao xxlJobRegistryDao;
 | 
			
		||||
 | 
			
		||||
	@RequestMapping
 | 
			
		||||
	public String index(Model model) {
 | 
			
		||||
		return "jobgroup/jobgroup.index";
 | 
			
		||||
	}
 | 
			
		||||
    @RequestMapping
 | 
			
		||||
    public String index(Model model) {
 | 
			
		||||
        return "jobgroup/jobgroup.index";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@RequestMapping("/pageList")
 | 
			
		||||
	@ResponseBody
 | 
			
		||||
	public Map<String, Object> pageList(HttpServletRequest request,
 | 
			
		||||
										@RequestParam(required = false, defaultValue = "0") int start,
 | 
			
		||||
										@RequestParam(required = false, defaultValue = "10") int length,
 | 
			
		||||
										String appname, String title) {
 | 
			
		||||
    @RequestMapping("/pageList")
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    public Map<String, Object> pageList(HttpServletRequest request,
 | 
			
		||||
                                        @RequestParam(required = false, defaultValue = "0") int start,
 | 
			
		||||
                                        @RequestParam(required = false, defaultValue = "10") int length,
 | 
			
		||||
                                        String appname, String title) {
 | 
			
		||||
 | 
			
		||||
		// page query
 | 
			
		||||
		List<XxlJobGroup> list = xxlJobGroupDao.pageList(start, length, appname, title);
 | 
			
		||||
		int list_count = xxlJobGroupDao.pageListCount(start, length, appname, title);
 | 
			
		||||
        // page query
 | 
			
		||||
        List<XxlJobGroup> list = xxlJobGroupDao.pageList(start, length, appname, title);
 | 
			
		||||
        int list_count = xxlJobGroupDao.pageListCount(start, length, appname, title);
 | 
			
		||||
 | 
			
		||||
		// package result
 | 
			
		||||
		Map<String, Object> maps = new HashMap<String, Object>();
 | 
			
		||||
		maps.put("recordsTotal", list_count);		// 总记录数
 | 
			
		||||
		maps.put("recordsFiltered", list_count);	// 过滤后的总记录数
 | 
			
		||||
		maps.put("data", list);  					// 分页列表
 | 
			
		||||
		return maps;
 | 
			
		||||
	}
 | 
			
		||||
        // package result
 | 
			
		||||
        Map<String, Object> maps = new HashMap<String, Object>();
 | 
			
		||||
        maps.put("recordsTotal" , list_count);        // 总记录数
 | 
			
		||||
        maps.put("recordsFiltered" , list_count);    // 过滤后的总记录数
 | 
			
		||||
        maps.put("data" , list);                    // 分页列表
 | 
			
		||||
        return maps;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@RequestMapping("/save")
 | 
			
		||||
	@ResponseBody
 | 
			
		||||
	public ReturnT<String> save(XxlJobGroup xxlJobGroup){
 | 
			
		||||
    @RequestMapping("/save")
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    public ReturnT<String> save(XxlJobGroup xxlJobGroup) {
 | 
			
		||||
 | 
			
		||||
		// valid
 | 
			
		||||
		if (xxlJobGroup.getAppname()==null || xxlJobGroup.getAppname().trim().length()==0) {
 | 
			
		||||
			return new ReturnT<String>(500, (I18nUtil.getString("system_please_input")+"AppName") );
 | 
			
		||||
		}
 | 
			
		||||
		if (xxlJobGroup.getAppname().length()<4 || xxlJobGroup.getAppname().length()>64) {
 | 
			
		||||
			return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_appname_length") );
 | 
			
		||||
		}
 | 
			
		||||
		if (xxlJobGroup.getAppname().contains(">") || xxlJobGroup.getAppname().contains("<")) {
 | 
			
		||||
			return new ReturnT<String>(500, "AppName"+I18nUtil.getString("system_unvalid") );
 | 
			
		||||
		}
 | 
			
		||||
		if (xxlJobGroup.getTitle()==null || xxlJobGroup.getTitle().trim().length()==0) {
 | 
			
		||||
			return new ReturnT<String>(500, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobgroup_field_title")) );
 | 
			
		||||
		}
 | 
			
		||||
		if (xxlJobGroup.getTitle().contains(">") || xxlJobGroup.getTitle().contains("<")) {
 | 
			
		||||
			return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_title")+I18nUtil.getString("system_unvalid") );
 | 
			
		||||
		}
 | 
			
		||||
		if (xxlJobGroup.getAddressType()!=0) {
 | 
			
		||||
			if (xxlJobGroup.getAddressList()==null || xxlJobGroup.getAddressList().trim().length()==0) {
 | 
			
		||||
				return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_addressType_limit") );
 | 
			
		||||
			}
 | 
			
		||||
			if (xxlJobGroup.getAddressList().contains(">") || xxlJobGroup.getAddressList().contains("<")) {
 | 
			
		||||
				return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_registryList")+I18nUtil.getString("system_unvalid") );
 | 
			
		||||
			}
 | 
			
		||||
        // valid
 | 
			
		||||
        if (xxlJobGroup.getAppname() == null || xxlJobGroup.getAppname().trim().length() == 0) {
 | 
			
		||||
            return new ReturnT<String>(500, (I18nUtil.getString("system_please_input") + "AppName"));
 | 
			
		||||
        }
 | 
			
		||||
        if (xxlJobGroup.getAppname().length() < 4 || xxlJobGroup.getAppname().length() > 64) {
 | 
			
		||||
            return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_appname_length"));
 | 
			
		||||
        }
 | 
			
		||||
        if (xxlJobGroup.getAppname().contains(">") || xxlJobGroup.getAppname().contains("<")) {
 | 
			
		||||
            return new ReturnT<String>(500, "AppName" + I18nUtil.getString("system_unvalid"));
 | 
			
		||||
        }
 | 
			
		||||
        if (xxlJobGroup.getTitle() == null || xxlJobGroup.getTitle().trim().length() == 0) {
 | 
			
		||||
            return new ReturnT<String>(500, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobgroup_field_title")));
 | 
			
		||||
        }
 | 
			
		||||
        if (xxlJobGroup.getTitle().contains(">") || xxlJobGroup.getTitle().contains("<")) {
 | 
			
		||||
            return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_title") + I18nUtil.getString("system_unvalid"));
 | 
			
		||||
        }
 | 
			
		||||
        if (xxlJobGroup.getAddressType() != 0) {
 | 
			
		||||
            if (xxlJobGroup.getAddressList() == null || xxlJobGroup.getAddressList().trim().length() == 0) {
 | 
			
		||||
                return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_addressType_limit"));
 | 
			
		||||
            }
 | 
			
		||||
            if (xxlJobGroup.getAddressList().contains(">") || xxlJobGroup.getAddressList().contains("<")) {
 | 
			
		||||
                return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_registryList") + I18nUtil.getString("system_unvalid"));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
			String[] addresss = xxlJobGroup.getAddressList().split(",");
 | 
			
		||||
			for (String item: addresss) {
 | 
			
		||||
				if (item==null || item.trim().length()==0) {
 | 
			
		||||
					return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_registryList_unvalid") );
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
            String[] addresss = xxlJobGroup.getAddressList().split(",");
 | 
			
		||||
            for (String item : addresss) {
 | 
			
		||||
                if (item == null || item.trim().length() == 0) {
 | 
			
		||||
                    return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_registryList_unvalid"));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		// process
 | 
			
		||||
		xxlJobGroup.setUpdateTime(new Date());
 | 
			
		||||
        // process
 | 
			
		||||
        xxlJobGroup.setUpdateTime(new Date());
 | 
			
		||||
 | 
			
		||||
		int ret = xxlJobGroupDao.save(xxlJobGroup);
 | 
			
		||||
		return (ret>0)?ReturnT.SUCCESS:ReturnT.FAIL;
 | 
			
		||||
	}
 | 
			
		||||
        int ret = xxlJobGroupDao.save(xxlJobGroup);
 | 
			
		||||
        return (ret > 0) ? ReturnT.SUCCESS : ReturnT.FAIL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@RequestMapping("/update")
 | 
			
		||||
	@ResponseBody
 | 
			
		||||
	public ReturnT<String> update(XxlJobGroup xxlJobGroup){
 | 
			
		||||
		// valid
 | 
			
		||||
		if (xxlJobGroup.getAppname()==null || xxlJobGroup.getAppname().trim().length()==0) {
 | 
			
		||||
			return new ReturnT<String>(500, (I18nUtil.getString("system_please_input")+"AppName") );
 | 
			
		||||
		}
 | 
			
		||||
		if (xxlJobGroup.getAppname().length()<4 || xxlJobGroup.getAppname().length()>64) {
 | 
			
		||||
			return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_appname_length") );
 | 
			
		||||
		}
 | 
			
		||||
		if (xxlJobGroup.getTitle()==null || xxlJobGroup.getTitle().trim().length()==0) {
 | 
			
		||||
			return new ReturnT<String>(500, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobgroup_field_title")) );
 | 
			
		||||
		}
 | 
			
		||||
		if (xxlJobGroup.getAddressType() == 0) {
 | 
			
		||||
			// 0=自动注册
 | 
			
		||||
			List<String> registryList = findRegistryByAppName(xxlJobGroup.getAppname());
 | 
			
		||||
			String addressListStr = null;
 | 
			
		||||
			if (registryList!=null && !registryList.isEmpty()) {
 | 
			
		||||
				Collections.sort(registryList);
 | 
			
		||||
				addressListStr = "";
 | 
			
		||||
				for (String item:registryList) {
 | 
			
		||||
					addressListStr += item + ",";
 | 
			
		||||
				}
 | 
			
		||||
				addressListStr = addressListStr.substring(0, addressListStr.length()-1);
 | 
			
		||||
			}
 | 
			
		||||
			xxlJobGroup.setAddressList(addressListStr);
 | 
			
		||||
		} else {
 | 
			
		||||
			// 1=手动录入
 | 
			
		||||
			if (xxlJobGroup.getAddressList()==null || xxlJobGroup.getAddressList().trim().length()==0) {
 | 
			
		||||
				return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_addressType_limit") );
 | 
			
		||||
			}
 | 
			
		||||
			String[] addresss = xxlJobGroup.getAddressList().split(",");
 | 
			
		||||
			for (String item: addresss) {
 | 
			
		||||
				if (item==null || item.trim().length()==0) {
 | 
			
		||||
					return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_registryList_unvalid") );
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
    @RequestMapping("/update")
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    public ReturnT<String> update(XxlJobGroup xxlJobGroup) {
 | 
			
		||||
        // valid
 | 
			
		||||
        if (xxlJobGroup.getAppname() == null || xxlJobGroup.getAppname().trim().length() == 0) {
 | 
			
		||||
            return new ReturnT<String>(500, (I18nUtil.getString("system_please_input") + "AppName"));
 | 
			
		||||
        }
 | 
			
		||||
        if (xxlJobGroup.getAppname().length() < 4 || xxlJobGroup.getAppname().length() > 64) {
 | 
			
		||||
            return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_appname_length"));
 | 
			
		||||
        }
 | 
			
		||||
        if (xxlJobGroup.getTitle() == null || xxlJobGroup.getTitle().trim().length() == 0) {
 | 
			
		||||
            return new ReturnT<String>(500, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobgroup_field_title")));
 | 
			
		||||
        }
 | 
			
		||||
        if (xxlJobGroup.getAddressType() == 0) {
 | 
			
		||||
            // 0=自动注册
 | 
			
		||||
            List<String> registryList = findRegistryByAppName(xxlJobGroup.getAppname());
 | 
			
		||||
            String addressListStr = null;
 | 
			
		||||
            if (registryList != null && !registryList.isEmpty()) {
 | 
			
		||||
                Collections.sort(registryList);
 | 
			
		||||
                addressListStr = "";
 | 
			
		||||
                for (String item : registryList) {
 | 
			
		||||
                    addressListStr += item + ",";
 | 
			
		||||
                }
 | 
			
		||||
                addressListStr = addressListStr.substring(0, addressListStr.length() - 1);
 | 
			
		||||
            }
 | 
			
		||||
            xxlJobGroup.setAddressList(addressListStr);
 | 
			
		||||
        } else {
 | 
			
		||||
            // 1=手动录入
 | 
			
		||||
            if (xxlJobGroup.getAddressList() == null || xxlJobGroup.getAddressList().trim().length() == 0) {
 | 
			
		||||
                return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_addressType_limit"));
 | 
			
		||||
            }
 | 
			
		||||
            String[] addresss = xxlJobGroup.getAddressList().split(",");
 | 
			
		||||
            for (String item : addresss) {
 | 
			
		||||
                if (item == null || item.trim().length() == 0) {
 | 
			
		||||
                    return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_registryList_unvalid"));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		// process
 | 
			
		||||
		xxlJobGroup.setUpdateTime(new Date());
 | 
			
		||||
        // process
 | 
			
		||||
        xxlJobGroup.setUpdateTime(new Date());
 | 
			
		||||
 | 
			
		||||
		int ret = xxlJobGroupDao.update(xxlJobGroup);
 | 
			
		||||
		return (ret>0)?ReturnT.SUCCESS:ReturnT.FAIL;
 | 
			
		||||
	}
 | 
			
		||||
        int ret = xxlJobGroupDao.update(xxlJobGroup);
 | 
			
		||||
        return (ret > 0) ? ReturnT.SUCCESS : ReturnT.FAIL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	private List<String> findRegistryByAppName(String appnameParam){
 | 
			
		||||
		HashMap<String, List<String>> appAddressMap = new HashMap<String, List<String>>();
 | 
			
		||||
		List<XxlJobRegistry> list = xxlJobRegistryDao.findAll(RegistryConfig.DEAD_TIMEOUT, new Date());
 | 
			
		||||
		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>();
 | 
			
		||||
					}
 | 
			
		||||
    private List<String> findRegistryByAppName(String appnameParam) {
 | 
			
		||||
        HashMap<String, List<String>> appAddressMap = new HashMap<String, List<String>>();
 | 
			
		||||
        List<XxlJobRegistry> list = xxlJobRegistryDao.findAll(RegistryConfig.DEAD_TIMEOUT, new Date());
 | 
			
		||||
        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>();
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
					if (!registryList.contains(item.getRegistryValue())) {
 | 
			
		||||
						registryList.add(item.getRegistryValue());
 | 
			
		||||
					}
 | 
			
		||||
					appAddressMap.put(appname, registryList);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		return appAddressMap.get(appnameParam);
 | 
			
		||||
	}
 | 
			
		||||
                    if (!registryList.contains(item.getRegistryValue())) {
 | 
			
		||||
                        registryList.add(item.getRegistryValue());
 | 
			
		||||
                    }
 | 
			
		||||
                    appAddressMap.put(appname, registryList);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return appAddressMap.get(appnameParam);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@RequestMapping("/remove")
 | 
			
		||||
	@ResponseBody
 | 
			
		||||
	public ReturnT<String> remove(int id){
 | 
			
		||||
    @RequestMapping("/remove")
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    public ReturnT<String> remove(int id) {
 | 
			
		||||
 | 
			
		||||
		// valid
 | 
			
		||||
		int count = xxlJobInfoDao.pageListCount(0, 10, id, -1,  null, null, null);
 | 
			
		||||
		if (count > 0) {
 | 
			
		||||
			return new ReturnT<String>(500, I18nUtil.getString("jobgroup_del_limit_0") );
 | 
			
		||||
		}
 | 
			
		||||
        // valid
 | 
			
		||||
        int count = xxlJobInfoDao.pageListCount(0, 10, id, -1, null, null, null);
 | 
			
		||||
        if (count > 0) {
 | 
			
		||||
            return new ReturnT<String>(500, I18nUtil.getString("jobgroup_del_limit_0"));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		List<XxlJobGroup> allList = xxlJobGroupDao.findAll();
 | 
			
		||||
		if (allList.size() == 1) {
 | 
			
		||||
			return new ReturnT<String>(500, I18nUtil.getString("jobgroup_del_limit_1") );
 | 
			
		||||
		}
 | 
			
		||||
        List<XxlJobGroup> allList = xxlJobGroupDao.findAll();
 | 
			
		||||
        if (allList.size() == 1) {
 | 
			
		||||
            return new ReturnT<String>(500, I18nUtil.getString("jobgroup_del_limit_1"));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		int ret = xxlJobGroupDao.remove(id);
 | 
			
		||||
		return (ret>0)?ReturnT.SUCCESS:ReturnT.FAIL;
 | 
			
		||||
	}
 | 
			
		||||
        int ret = xxlJobGroupDao.remove(id);
 | 
			
		||||
        return (ret > 0) ? ReturnT.SUCCESS : ReturnT.FAIL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@RequestMapping("/loadById")
 | 
			
		||||
	@ResponseBody
 | 
			
		||||
	public ReturnT<XxlJobGroup> loadById(int id){
 | 
			
		||||
		XxlJobGroup jobGroup = xxlJobGroupDao.load(id);
 | 
			
		||||
		return jobGroup!=null?new ReturnT<XxlJobGroup>(jobGroup):new ReturnT<XxlJobGroup>(ReturnT.FAIL_CODE, null);
 | 
			
		||||
	}
 | 
			
		||||
    @RequestMapping("/loadById")
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    public ReturnT<XxlJobGroup> loadById(int id) {
 | 
			
		||||
        XxlJobGroup jobGroup = xxlJobGroupDao.load(id);
 | 
			
		||||
        return jobGroup != null ? new ReturnT<XxlJobGroup>(jobGroup) : new ReturnT<XxlJobGroup>(ReturnT.FAIL_CODE, null);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,5 @@
 | 
			
		||||
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.model.XxlJobGroup;
 | 
			
		||||
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.servlet.http.HttpServletRequest;
 | 
			
		||||
import java.text.ParseException;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * index controller
 | 
			
		||||
 *
 | 
			
		||||
 * @author xuxueli 2015-12-19 16:13:16
 | 
			
		||||
 */
 | 
			
		||||
@Controller
 | 
			
		||||
@RequestMapping("/jobinfo")
 | 
			
		||||
public class JobInfoController {
 | 
			
		||||
	private static Logger logger = LoggerFactory.getLogger(JobInfoController.class);
 | 
			
		||||
    private static Logger logger = LoggerFactory.getLogger(JobInfoController.class);
 | 
			
		||||
 | 
			
		||||
	@Resource
 | 
			
		||||
	private XxlJobGroupDao xxlJobGroupDao;
 | 
			
		||||
	@Resource
 | 
			
		||||
	private XxlJobService xxlJobService;
 | 
			
		||||
	
 | 
			
		||||
	@RequestMapping
 | 
			
		||||
	public String index(HttpServletRequest request, Model model, @RequestParam(required = false, defaultValue = "-1") int jobGroup) {
 | 
			
		||||
    @Resource
 | 
			
		||||
    private XxlJobGroupDao xxlJobGroupDao;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private XxlJobService xxlJobService;
 | 
			
		||||
 | 
			
		||||
		// 枚举-字典
 | 
			
		||||
		model.addAttribute("ExecutorRouteStrategyEnum", ExecutorRouteStrategyEnum.values());	    // 路由策略-列表
 | 
			
		||||
		model.addAttribute("GlueTypeEnum", GlueTypeEnum.values());								// Glue类型-字典
 | 
			
		||||
		model.addAttribute("ExecutorBlockStrategyEnum", ExecutorBlockStrategyEnum.values());	    // 阻塞处理策略-字典
 | 
			
		||||
		model.addAttribute("ScheduleTypeEnum", ScheduleTypeEnum.values());	    				// 调度类型
 | 
			
		||||
		model.addAttribute("MisfireStrategyEnum", MisfireStrategyEnum.values());	    			// 调度过期策略
 | 
			
		||||
    @RequestMapping
 | 
			
		||||
    public String index(HttpServletRequest request, Model model, @RequestParam(required = false, defaultValue = "-1") int jobGroup) {
 | 
			
		||||
 | 
			
		||||
		// 执行器列表
 | 
			
		||||
		List<XxlJobGroup> jobGroupList_all =  xxlJobGroupDao.findAll();
 | 
			
		||||
        // 枚举-字典
 | 
			
		||||
        model.addAttribute("ExecutorRouteStrategyEnum" , ExecutorRouteStrategyEnum.values());        // 路由策略-列表
 | 
			
		||||
        model.addAttribute("GlueTypeEnum" , GlueTypeEnum.values());                                // Glue类型-字典
 | 
			
		||||
        model.addAttribute("ExecutorBlockStrategyEnum" , ExecutorBlockStrategyEnum.values());        // 阻塞处理策略-字典
 | 
			
		||||
        model.addAttribute("ScheduleTypeEnum" , ScheduleTypeEnum.values());                        // 调度类型
 | 
			
		||||
        model.addAttribute("MisfireStrategyEnum" , MisfireStrategyEnum.values());                    // 调度过期策略
 | 
			
		||||
 | 
			
		||||
		// filter group
 | 
			
		||||
		List<XxlJobGroup> jobGroupList = filterJobGroupByRole(request, jobGroupList_all);
 | 
			
		||||
		if (jobGroupList==null || jobGroupList.size()==0) {
 | 
			
		||||
			throw new XxlJobException(I18nUtil.getString("jobgroup_empty"));
 | 
			
		||||
		}
 | 
			
		||||
        // 执行器列表
 | 
			
		||||
        List<XxlJobGroup> jobGroupList_all = xxlJobGroupDao.findAll();
 | 
			
		||||
 | 
			
		||||
		model.addAttribute("JobGroupList", jobGroupList);
 | 
			
		||||
		model.addAttribute("jobGroup", jobGroup);
 | 
			
		||||
        // filter group
 | 
			
		||||
        List<XxlJobGroup> jobGroupList = filterJobGroupByRole(request, jobGroupList_all);
 | 
			
		||||
        if (jobGroupList == null || jobGroupList.size() == 0) {
 | 
			
		||||
            throw new XxlJobException(I18nUtil.getString("jobgroup_empty"));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		return "jobinfo/jobinfo.index";
 | 
			
		||||
	}
 | 
			
		||||
        model.addAttribute("JobGroupList" , jobGroupList);
 | 
			
		||||
        model.addAttribute("jobGroup" , jobGroup);
 | 
			
		||||
 | 
			
		||||
	public static List<XxlJobGroup> filterJobGroupByRole(HttpServletRequest request, List<XxlJobGroup> jobGroupList_all){
 | 
			
		||||
		List<XxlJobGroup> jobGroupList = new ArrayList<>();
 | 
			
		||||
		if (jobGroupList_all!=null && jobGroupList_all.size()>0) {
 | 
			
		||||
			XxlJobUser loginUser = (XxlJobUser) request.getAttribute(LoginService.LOGIN_IDENTITY_KEY);
 | 
			
		||||
			if (loginUser.getRole() == 1) {
 | 
			
		||||
				jobGroupList = jobGroupList_all;
 | 
			
		||||
			} else {
 | 
			
		||||
				List<String> groupIdStrs = new ArrayList<>();
 | 
			
		||||
				if (loginUser.getPermission()!=null && loginUser.getPermission().trim().length()>0) {
 | 
			
		||||
					groupIdStrs = Arrays.asList(loginUser.getPermission().trim().split(","));
 | 
			
		||||
				}
 | 
			
		||||
				for (XxlJobGroup groupItem:jobGroupList_all) {
 | 
			
		||||
					if (groupIdStrs.contains(String.valueOf(groupItem.getId()))) {
 | 
			
		||||
						jobGroupList.add(groupItem);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		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")
 | 
			
		||||
	@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) {
 | 
			
		||||
		
 | 
			
		||||
		return xxlJobService.pageList(start, length, jobGroup, triggerStatus, jobDesc, executorHandler, author);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@RequestMapping("/add")
 | 
			
		||||
	@ResponseBody
 | 
			
		||||
	public ReturnT<String> add(XxlJobInfo jobInfo) {
 | 
			
		||||
		return xxlJobService.add(jobInfo);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@RequestMapping("/update")
 | 
			
		||||
	@ResponseBody
 | 
			
		||||
	public ReturnT<String> update(XxlJobInfo jobInfo) {
 | 
			
		||||
		return xxlJobService.update(jobInfo);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@RequestMapping("/remove")
 | 
			
		||||
	@ResponseBody
 | 
			
		||||
	public ReturnT<String> remove(int id) {
 | 
			
		||||
		return xxlJobService.remove(id);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@RequestMapping("/stop")
 | 
			
		||||
	@ResponseBody
 | 
			
		||||
	public ReturnT<String> pause(int id) {
 | 
			
		||||
		return xxlJobService.stop(id);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@RequestMapping("/start")
 | 
			
		||||
	@ResponseBody
 | 
			
		||||
	public ReturnT<String> start(int id) {
 | 
			
		||||
		return xxlJobService.start(id);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@RequestMapping("/trigger")
 | 
			
		||||
	@ResponseBody
 | 
			
		||||
	//@PermissionLimit(limit = false)
 | 
			
		||||
	public ReturnT<String> triggerJob(int id, String executorParam, String addressList) {
 | 
			
		||||
		// force cover job param
 | 
			
		||||
		if (executorParam == null) {
 | 
			
		||||
			executorParam = "";
 | 
			
		||||
		}
 | 
			
		||||
        return "jobinfo/jobinfo.index";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		JobTriggerPoolHelper.trigger(id, TriggerTypeEnum.MANUAL, -1, null, executorParam, addressList);
 | 
			
		||||
		return ReturnT.SUCCESS;
 | 
			
		||||
	}
 | 
			
		||||
    public static List<XxlJobGroup> filterJobGroupByRole(HttpServletRequest request, List<XxlJobGroup> jobGroupList_all) {
 | 
			
		||||
        List<XxlJobGroup> jobGroupList = new ArrayList<>();
 | 
			
		||||
        if (jobGroupList_all != null && jobGroupList_all.size() > 0) {
 | 
			
		||||
            XxlJobUser loginUser = (XxlJobUser) request.getAttribute(LoginService.LOGIN_IDENTITY_KEY);
 | 
			
		||||
            if (loginUser.getRole() == 1) {
 | 
			
		||||
                jobGroupList = jobGroupList_all;
 | 
			
		||||
            } else {
 | 
			
		||||
                List<String> groupIdStrs = new ArrayList<>();
 | 
			
		||||
                if (loginUser.getPermission() != null && loginUser.getPermission().trim().length() > 0) {
 | 
			
		||||
                    groupIdStrs = Arrays.asList(loginUser.getPermission().trim().split(","));
 | 
			
		||||
                }
 | 
			
		||||
                for (XxlJobGroup groupItem : jobGroupList_all) {
 | 
			
		||||
                    if (groupIdStrs.contains(String.valueOf(groupItem.getId()))) {
 | 
			
		||||
                        jobGroupList.add(groupItem);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return jobGroupList;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@RequestMapping("/nextTriggerTime")
 | 
			
		||||
	@ResponseBody
 | 
			
		||||
	public ReturnT<List<String>> nextTriggerTime(String scheduleType, String scheduleConf) {
 | 
			
		||||
    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() + "]");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		XxlJobInfo paramXxlJobInfo = new XxlJobInfo();
 | 
			
		||||
		paramXxlJobInfo.setScheduleType(scheduleType);
 | 
			
		||||
		paramXxlJobInfo.setScheduleConf(scheduleConf);
 | 
			
		||||
    @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) {
 | 
			
		||||
 | 
			
		||||
		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);
 | 
			
		||||
        return xxlJobService.pageList(start, length, jobGroup, triggerStatus, jobDesc, executorHandler, author);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @RequestMapping("/add")
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    public ReturnT<String> add(XxlJobInfo jobInfo) {
 | 
			
		||||
        return xxlJobService.add(jobInfo);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @RequestMapping("/update")
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    public ReturnT<String> update(XxlJobInfo jobInfo) {
 | 
			
		||||
        return xxlJobService.update(jobInfo);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @RequestMapping("/remove")
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    public ReturnT<String> remove(int id) {
 | 
			
		||||
        return xxlJobService.remove(id);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @RequestMapping("/stop")
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    public ReturnT<String> pause(int id) {
 | 
			
		||||
        return xxlJobService.stop(id);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @RequestMapping("/start")
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    public ReturnT<String> start(int id) {
 | 
			
		||||
        return xxlJobService.start(id);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @RequestMapping("/trigger")
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    //@PermissionLimit(limit = false)
 | 
			
		||||
    public ReturnT<String> triggerJob(int id, String executorParam, String addressList) {
 | 
			
		||||
        // force cover job param
 | 
			
		||||
        if (executorParam == null) {
 | 
			
		||||
            executorParam = "";
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        JobTriggerPoolHelper.trigger(id, TriggerTypeEnum.MANUAL, -1, null, executorParam, addressList);
 | 
			
		||||
        return ReturnT.SUCCESS;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @RequestMapping("/nextTriggerTime")
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    public ReturnT<List<String>> nextTriggerTime(String scheduleType, String scheduleConf) {
 | 
			
		||||
 | 
			
		||||
        XxlJobInfo paramXxlJobInfo = new XxlJobInfo();
 | 
			
		||||
        paramXxlJobInfo.setScheduleType(scheduleType);
 | 
			
		||||
        paramXxlJobInfo.setScheduleConf(scheduleConf);
 | 
			
		||||
 | 
			
		||||
        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;
 | 
			
		||||
 | 
			
		||||
import com.xxl.job.admin.core.exception.XxlJobException;
 | 
			
		||||
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.XxlJobInfo;
 | 
			
		||||
import com.xxl.job.admin.core.model.XxlJobLog;
 | 
			
		||||
@@ -33,201 +33,202 @@ import java.util.Map;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * index controller
 | 
			
		||||
 *
 | 
			
		||||
 * @author xuxueli 2015-12-19 16:13:16
 | 
			
		||||
 */
 | 
			
		||||
@Controller
 | 
			
		||||
@RequestMapping("/joblog")
 | 
			
		||||
public class JobLogController {
 | 
			
		||||
	private static Logger logger = LoggerFactory.getLogger(JobLogController.class);
 | 
			
		||||
    private static Logger logger = LoggerFactory.getLogger(JobLogController.class);
 | 
			
		||||
 | 
			
		||||
	@Resource
 | 
			
		||||
	private XxlJobGroupDao xxlJobGroupDao;
 | 
			
		||||
	@Resource
 | 
			
		||||
	public XxlJobInfoDao xxlJobInfoDao;
 | 
			
		||||
	@Resource
 | 
			
		||||
	public XxlJobLogDao xxlJobLogDao;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private XxlJobGroupDao xxlJobGroupDao;
 | 
			
		||||
    @Resource
 | 
			
		||||
    public XxlJobInfoDao xxlJobInfoDao;
 | 
			
		||||
    @Resource
 | 
			
		||||
    public XxlJobLogDao xxlJobLogDao;
 | 
			
		||||
 | 
			
		||||
	@RequestMapping
 | 
			
		||||
	public String index(HttpServletRequest request, Model model, @RequestParam(required = false, defaultValue = "0") Integer jobId) {
 | 
			
		||||
    @RequestMapping
 | 
			
		||||
    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
 | 
			
		||||
		List<XxlJobGroup> jobGroupList = JobInfoController.filterJobGroupByRole(request, jobGroupList_all);
 | 
			
		||||
		if (jobGroupList==null || jobGroupList.size()==0) {
 | 
			
		||||
			throw new XxlJobException(I18nUtil.getString("jobgroup_empty"));
 | 
			
		||||
		}
 | 
			
		||||
        // filter group
 | 
			
		||||
        List<XxlJobGroup> jobGroupList = JobInfoController.filterJobGroupByRole(request, jobGroupList_all);
 | 
			
		||||
        if (jobGroupList == null || jobGroupList.size() == 0) {
 | 
			
		||||
            throw new XxlJobException(I18nUtil.getString("jobgroup_empty"));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		model.addAttribute("JobGroupList", jobGroupList);
 | 
			
		||||
        model.addAttribute("JobGroupList" , jobGroupList);
 | 
			
		||||
 | 
			
		||||
		// 任务
 | 
			
		||||
		if (jobId > 0) {
 | 
			
		||||
			XxlJobInfo jobInfo = xxlJobInfoDao.loadById(jobId);
 | 
			
		||||
			if (jobInfo == null) {
 | 
			
		||||
				throw new RuntimeException(I18nUtil.getString("jobinfo_field_id") + I18nUtil.getString("system_unvalid"));
 | 
			
		||||
			}
 | 
			
		||||
        // 任务
 | 
			
		||||
        if (jobId > 0) {
 | 
			
		||||
            XxlJobInfo jobInfo = xxlJobInfoDao.loadById(jobId);
 | 
			
		||||
            if (jobInfo == null) {
 | 
			
		||||
                throw new RuntimeException(I18nUtil.getString("jobinfo_field_id") + I18nUtil.getString("system_unvalid"));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
			model.addAttribute("jobInfo", jobInfo);
 | 
			
		||||
            model.addAttribute("jobInfo" , jobInfo);
 | 
			
		||||
 | 
			
		||||
			// valid permission
 | 
			
		||||
			JobInfoController.validPermission(request, jobInfo.getJobGroup());
 | 
			
		||||
		}
 | 
			
		||||
            // valid permission
 | 
			
		||||
            JobInfoController.validPermission(request, jobInfo.getJobGroup());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		return "joblog/joblog.index";
 | 
			
		||||
	}
 | 
			
		||||
        return "joblog/joblog.index";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@RequestMapping("/getJobsByGroup")
 | 
			
		||||
	@ResponseBody
 | 
			
		||||
	public ReturnT<List<XxlJobInfo>> getJobsByGroup(int jobGroup){
 | 
			
		||||
		List<XxlJobInfo> list = xxlJobInfoDao.getJobsByGroup(jobGroup);
 | 
			
		||||
		return new ReturnT<List<XxlJobInfo>>(list);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@RequestMapping("/pageList")
 | 
			
		||||
	@ResponseBody
 | 
			
		||||
	public Map<String, Object> pageList(HttpServletRequest request,
 | 
			
		||||
										@RequestParam(required = false, defaultValue = "0") int start,
 | 
			
		||||
										@RequestParam(required = false, defaultValue = "10") int length,
 | 
			
		||||
										int jobGroup, int jobId, int logStatus, String filterTime) {
 | 
			
		||||
    @RequestMapping("/getJobsByGroup")
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    public ReturnT<List<XxlJobInfo>> getJobsByGroup(int jobGroup) {
 | 
			
		||||
        List<XxlJobInfo> list = xxlJobInfoDao.getJobsByGroup(jobGroup);
 | 
			
		||||
        return new ReturnT<List<XxlJobInfo>>(list);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		// valid permission
 | 
			
		||||
		JobInfoController.validPermission(request, jobGroup);	// 仅管理员支持查询全部;普通用户仅支持查询有权限的 jobGroup
 | 
			
		||||
		
 | 
			
		||||
		// parse param
 | 
			
		||||
		Date triggerTimeStart = null;
 | 
			
		||||
		Date triggerTimeEnd = null;
 | 
			
		||||
		if (filterTime!=null && filterTime.trim().length()>0) {
 | 
			
		||||
			String[] temp = filterTime.split(" - ");
 | 
			
		||||
			if (temp.length == 2) {
 | 
			
		||||
				triggerTimeStart = DateUtil.parseDateTime(temp[0]);
 | 
			
		||||
				triggerTimeEnd = DateUtil.parseDateTime(temp[1]);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		// page query
 | 
			
		||||
		List<XxlJobLog> list = xxlJobLogDao.pageList(start, length, jobGroup, jobId, triggerTimeStart, triggerTimeEnd, logStatus);
 | 
			
		||||
		int list_count = xxlJobLogDao.pageListCount(start, length, jobGroup, jobId, triggerTimeStart, triggerTimeEnd, logStatus);
 | 
			
		||||
		
 | 
			
		||||
		// package result
 | 
			
		||||
		Map<String, Object> maps = new HashMap<String, Object>();
 | 
			
		||||
	    maps.put("recordsTotal", list_count);		// 总记录数
 | 
			
		||||
	    maps.put("recordsFiltered", list_count);	// 过滤后的总记录数
 | 
			
		||||
	    maps.put("data", list);  					// 分页列表
 | 
			
		||||
		return maps;
 | 
			
		||||
	}
 | 
			
		||||
    @RequestMapping("/pageList")
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    public Map<String, Object> pageList(HttpServletRequest request,
 | 
			
		||||
                                        @RequestParam(required = false, defaultValue = "0") int start,
 | 
			
		||||
                                        @RequestParam(required = false, defaultValue = "10") int length,
 | 
			
		||||
                                        int jobGroup, int jobId, int logStatus, String filterTime) {
 | 
			
		||||
 | 
			
		||||
	@RequestMapping("/logDetailPage")
 | 
			
		||||
	public String logDetailPage(int id, Model model){
 | 
			
		||||
        // valid permission
 | 
			
		||||
        JobInfoController.validPermission(request, jobGroup);    // 仅管理员支持查询全部;普通用户仅支持查询有权限的 jobGroup
 | 
			
		||||
 | 
			
		||||
		// base check
 | 
			
		||||
		ReturnT<String> logStatue = ReturnT.SUCCESS;
 | 
			
		||||
		XxlJobLog jobLog = xxlJobLogDao.load(id);
 | 
			
		||||
		if (jobLog == null) {
 | 
			
		||||
        // parse param
 | 
			
		||||
        Date triggerTimeStart = null;
 | 
			
		||||
        Date triggerTimeEnd = null;
 | 
			
		||||
        if (filterTime != null && filterTime.trim().length() > 0) {
 | 
			
		||||
            String[] temp = filterTime.split(" - ");
 | 
			
		||||
            if (temp.length == 2) {
 | 
			
		||||
                triggerTimeStart = DateUtil.parseDateTime(temp[0]);
 | 
			
		||||
                triggerTimeEnd = DateUtil.parseDateTime(temp[1]);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // page query
 | 
			
		||||
        List<XxlJobLog> list = xxlJobLogDao.pageList(start, length, jobGroup, jobId, triggerTimeStart, triggerTimeEnd, logStatus);
 | 
			
		||||
        int list_count = xxlJobLogDao.pageListCount(start, length, jobGroup, jobId, triggerTimeStart, triggerTimeEnd, logStatus);
 | 
			
		||||
 | 
			
		||||
        // package result
 | 
			
		||||
        Map<String, Object> maps = new HashMap<String, Object>();
 | 
			
		||||
        maps.put("recordsTotal" , list_count);        // 总记录数
 | 
			
		||||
        maps.put("recordsFiltered" , list_count);    // 过滤后的总记录数
 | 
			
		||||
        maps.put("data" , list);                    // 分页列表
 | 
			
		||||
        return maps;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @RequestMapping("/logDetailPage")
 | 
			
		||||
    public String logDetailPage(int id, Model model) {
 | 
			
		||||
 | 
			
		||||
        // base check
 | 
			
		||||
        ReturnT<String> logStatue = ReturnT.SUCCESS;
 | 
			
		||||
        XxlJobLog jobLog = xxlJobLogDao.load(id);
 | 
			
		||||
        if (jobLog == null) {
 | 
			
		||||
            throw new RuntimeException(I18nUtil.getString("joblog_logid_unvalid"));
 | 
			
		||||
		}
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        model.addAttribute("triggerCode", jobLog.getTriggerCode());
 | 
			
		||||
        model.addAttribute("handleCode", jobLog.getHandleCode());
 | 
			
		||||
        model.addAttribute("executorAddress", jobLog.getExecutorAddress());
 | 
			
		||||
        model.addAttribute("triggerTime", jobLog.getTriggerTime().getTime());
 | 
			
		||||
        model.addAttribute("logId", jobLog.getId());
 | 
			
		||||
		return "joblog/joblog.detail";
 | 
			
		||||
	}
 | 
			
		||||
        model.addAttribute("triggerCode" , jobLog.getTriggerCode());
 | 
			
		||||
        model.addAttribute("handleCode" , jobLog.getHandleCode());
 | 
			
		||||
        model.addAttribute("executorAddress" , jobLog.getExecutorAddress());
 | 
			
		||||
        model.addAttribute("triggerTime" , jobLog.getTriggerTime().getTime());
 | 
			
		||||
        model.addAttribute("logId" , jobLog.getId());
 | 
			
		||||
        return "joblog/joblog.detail";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@RequestMapping("/logDetailCat")
 | 
			
		||||
	@ResponseBody
 | 
			
		||||
	public ReturnT<LogResult> logDetailCat(String executorAddress, long triggerTime, long logId, int fromLineNum){
 | 
			
		||||
		try {
 | 
			
		||||
			ExecutorBiz executorBiz = XxlJobScheduler.getExecutorBiz(executorAddress);
 | 
			
		||||
			ReturnT<LogResult> logResult = executorBiz.log(new LogParam(triggerTime, logId, fromLineNum));
 | 
			
		||||
    @RequestMapping("/logDetailCat")
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    public ReturnT<LogResult> logDetailCat(String executorAddress, long triggerTime, long logId, int fromLineNum) {
 | 
			
		||||
        try {
 | 
			
		||||
            ExecutorBiz executorBiz = XxlJobScheduler.getExecutorBiz(executorAddress);
 | 
			
		||||
            ReturnT<LogResult> logResult = executorBiz.log(new LogParam(triggerTime, logId, fromLineNum));
 | 
			
		||||
 | 
			
		||||
			// is end
 | 
			
		||||
            if (logResult.getContent()!=null && logResult.getContent().getFromLineNum() > logResult.getContent().getToLineNum()) {
 | 
			
		||||
            // is end
 | 
			
		||||
            if (logResult.getContent() != null && logResult.getContent().getFromLineNum() > logResult.getContent().getToLineNum()) {
 | 
			
		||||
                XxlJobLog jobLog = xxlJobLogDao.load(logId);
 | 
			
		||||
                if (jobLog.getHandleCode() > 0) {
 | 
			
		||||
                    logResult.getContent().setEnd(true);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
			return logResult;
 | 
			
		||||
		} catch (Exception e) {
 | 
			
		||||
			logger.error(e.getMessage(), e);
 | 
			
		||||
			return new ReturnT<LogResult>(ReturnT.FAIL_CODE, e.getMessage());
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
            return logResult;
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            logger.error(e.getMessage(), e);
 | 
			
		||||
            return new ReturnT<LogResult>(ReturnT.FAIL_CODE, e.getMessage());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@RequestMapping("/logKill")
 | 
			
		||||
	@ResponseBody
 | 
			
		||||
	public ReturnT<String> logKill(int id){
 | 
			
		||||
		// base check
 | 
			
		||||
		XxlJobLog log = xxlJobLogDao.load(id);
 | 
			
		||||
		XxlJobInfo jobInfo = xxlJobInfoDao.loadById(log.getJobId());
 | 
			
		||||
		if (jobInfo==null) {
 | 
			
		||||
			return new ReturnT<String>(500, I18nUtil.getString("jobinfo_glue_jobid_unvalid"));
 | 
			
		||||
		}
 | 
			
		||||
		if (ReturnT.SUCCESS_CODE != log.getTriggerCode()) {
 | 
			
		||||
			return new ReturnT<String>(500, I18nUtil.getString("joblog_kill_log_limit"));
 | 
			
		||||
		}
 | 
			
		||||
    @RequestMapping("/logKill")
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    public ReturnT<String> logKill(int id) {
 | 
			
		||||
        // base check
 | 
			
		||||
        XxlJobLog log = xxlJobLogDao.load(id);
 | 
			
		||||
        XxlJobInfo jobInfo = xxlJobInfoDao.loadById(log.getJobId());
 | 
			
		||||
        if (jobInfo == null) {
 | 
			
		||||
            return new ReturnT<String>(500, I18nUtil.getString("jobinfo_glue_jobid_unvalid"));
 | 
			
		||||
        }
 | 
			
		||||
        if (ReturnT.SUCCESS_CODE != log.getTriggerCode()) {
 | 
			
		||||
            return new ReturnT<String>(500, I18nUtil.getString("joblog_kill_log_limit"));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		// request of kill
 | 
			
		||||
		ReturnT<String> runResult = null;
 | 
			
		||||
		try {
 | 
			
		||||
			ExecutorBiz executorBiz = XxlJobScheduler.getExecutorBiz(log.getExecutorAddress());
 | 
			
		||||
			runResult = executorBiz.kill(new KillParam(jobInfo.getId()));
 | 
			
		||||
		} catch (Exception e) {
 | 
			
		||||
			logger.error(e.getMessage(), e);
 | 
			
		||||
			runResult = new ReturnT<String>(500, e.getMessage());
 | 
			
		||||
		}
 | 
			
		||||
        // request of kill
 | 
			
		||||
        ReturnT<String> runResult = null;
 | 
			
		||||
        try {
 | 
			
		||||
            ExecutorBiz executorBiz = XxlJobScheduler.getExecutorBiz(log.getExecutorAddress());
 | 
			
		||||
            runResult = executorBiz.kill(new KillParam(jobInfo.getId()));
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            logger.error(e.getMessage(), e);
 | 
			
		||||
            runResult = new ReturnT<String>(500, e.getMessage());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		if (ReturnT.SUCCESS_CODE == runResult.getCode()) {
 | 
			
		||||
			log.setHandleCode(ReturnT.FAIL_CODE);
 | 
			
		||||
			log.setHandleMsg( I18nUtil.getString("joblog_kill_log_byman")+":" + (runResult.getMsg()!=null?runResult.getMsg():""));
 | 
			
		||||
			log.setHandleTime(new Date());
 | 
			
		||||
			XxlJobCompleter.updateHandleInfoAndFinish(log);
 | 
			
		||||
			return new ReturnT<String>(runResult.getMsg());
 | 
			
		||||
		} else {
 | 
			
		||||
			return new ReturnT<String>(500, runResult.getMsg());
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
        if (ReturnT.SUCCESS_CODE == runResult.getCode()) {
 | 
			
		||||
            log.setHandleCode(ReturnT.FAIL_CODE);
 | 
			
		||||
            log.setHandleMsg(I18nUtil.getString("joblog_kill_log_byman") + ":" + (runResult.getMsg() != null ? runResult.getMsg() : ""));
 | 
			
		||||
            log.setHandleTime(new Date());
 | 
			
		||||
            XxlJobCompleter.updateHandleInfoAndFinish(log);
 | 
			
		||||
            return new ReturnT<String>(runResult.getMsg());
 | 
			
		||||
        } else {
 | 
			
		||||
            return new ReturnT<String>(500, runResult.getMsg());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@RequestMapping("/clearLog")
 | 
			
		||||
	@ResponseBody
 | 
			
		||||
	public ReturnT<String> clearLog(int jobGroup, int jobId, int type){
 | 
			
		||||
    @RequestMapping("/clearLog")
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    public ReturnT<String> clearLog(int jobGroup, int jobId, int type) {
 | 
			
		||||
 | 
			
		||||
		Date clearBeforeTime = null;
 | 
			
		||||
		int clearBeforeNum = 0;
 | 
			
		||||
		if (type == 1) {
 | 
			
		||||
			clearBeforeTime = DateUtil.addMonths(new Date(), -1);	// 清理一个月之前日志数据
 | 
			
		||||
		} else if (type == 2) {
 | 
			
		||||
			clearBeforeTime = DateUtil.addMonths(new Date(), -3);	// 清理三个月之前日志数据
 | 
			
		||||
		} else if (type == 3) {
 | 
			
		||||
			clearBeforeTime = DateUtil.addMonths(new Date(), -6);	// 清理六个月之前日志数据
 | 
			
		||||
		} else if (type == 4) {
 | 
			
		||||
			clearBeforeTime = DateUtil.addYears(new Date(), -1);	// 清理一年之前日志数据
 | 
			
		||||
		} else if (type == 5) {
 | 
			
		||||
			clearBeforeNum = 1000;		// 清理一千条以前日志数据
 | 
			
		||||
		} else if (type == 6) {
 | 
			
		||||
			clearBeforeNum = 10000;		// 清理一万条以前日志数据
 | 
			
		||||
		} else if (type == 7) {
 | 
			
		||||
			clearBeforeNum = 30000;		// 清理三万条以前日志数据
 | 
			
		||||
		} else if (type == 8) {
 | 
			
		||||
			clearBeforeNum = 100000;	// 清理十万条以前日志数据
 | 
			
		||||
		} else if (type == 9) {
 | 
			
		||||
			clearBeforeNum = 0;			// 清理所有日志数据
 | 
			
		||||
		} else {
 | 
			
		||||
			return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("joblog_clean_type_unvalid"));
 | 
			
		||||
		}
 | 
			
		||||
        Date clearBeforeTime = null;
 | 
			
		||||
        int clearBeforeNum = 0;
 | 
			
		||||
        if (type == 1) {
 | 
			
		||||
            clearBeforeTime = DateUtil.addMonths(new Date(), -1);    // 清理一个月之前日志数据
 | 
			
		||||
        } else if (type == 2) {
 | 
			
		||||
            clearBeforeTime = DateUtil.addMonths(new Date(), -3);    // 清理三个月之前日志数据
 | 
			
		||||
        } else if (type == 3) {
 | 
			
		||||
            clearBeforeTime = DateUtil.addMonths(new Date(), -6);    // 清理六个月之前日志数据
 | 
			
		||||
        } else if (type == 4) {
 | 
			
		||||
            clearBeforeTime = DateUtil.addYears(new Date(), -1);    // 清理一年之前日志数据
 | 
			
		||||
        } else if (type == 5) {
 | 
			
		||||
            clearBeforeNum = 1000;        // 清理一千条以前日志数据
 | 
			
		||||
        } else if (type == 6) {
 | 
			
		||||
            clearBeforeNum = 10000;        // 清理一万条以前日志数据
 | 
			
		||||
        } else if (type == 7) {
 | 
			
		||||
            clearBeforeNum = 30000;        // 清理三万条以前日志数据
 | 
			
		||||
        } else if (type == 8) {
 | 
			
		||||
            clearBeforeNum = 100000;    // 清理十万条以前日志数据
 | 
			
		||||
        } else if (type == 9) {
 | 
			
		||||
            clearBeforeNum = 0;            // 清理所有日志数据
 | 
			
		||||
        } else {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("joblog_clean_type_unvalid"));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		List<Long> logIds = null;
 | 
			
		||||
		do {
 | 
			
		||||
			logIds = xxlJobLogDao.findClearLogIds(jobGroup, jobId, clearBeforeTime, clearBeforeNum, 1000);
 | 
			
		||||
			if (logIds!=null && logIds.size()>0) {
 | 
			
		||||
				xxlJobLogDao.clearLog(logIds);
 | 
			
		||||
			}
 | 
			
		||||
		} while (logIds!=null && logIds.size()>0);
 | 
			
		||||
        List<Long> logIds = null;
 | 
			
		||||
        do {
 | 
			
		||||
            logIds = xxlJobLogDao.findClearLogIds(jobGroup, jobId, clearBeforeTime, clearBeforeNum, 1000);
 | 
			
		||||
            if (logIds != null && logIds.size() > 0) {
 | 
			
		||||
                xxlJobLogDao.clearLog(logIds);
 | 
			
		||||
            }
 | 
			
		||||
        } while (logIds != null && logIds.size() > 0);
 | 
			
		||||
 | 
			
		||||
		return ReturnT.SUCCESS;
 | 
			
		||||
	}
 | 
			
		||||
        return ReturnT.SUCCESS;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -40,7 +40,7 @@ public class UserController {
 | 
			
		||||
 | 
			
		||||
        // 执行器列表
 | 
			
		||||
        List<XxlJobGroup> groupList = xxlJobGroupDao.findAll();
 | 
			
		||||
        model.addAttribute("groupList", groupList);
 | 
			
		||||
        model.addAttribute("groupList" , groupList);
 | 
			
		||||
 | 
			
		||||
        return "user/user.index";
 | 
			
		||||
    }
 | 
			
		||||
@@ -57,17 +57,17 @@ public class UserController {
 | 
			
		||||
        int list_count = xxlJobUserDao.pageListCount(start, length, username, role);
 | 
			
		||||
 | 
			
		||||
        // filter
 | 
			
		||||
        if (list!=null && list.size()>0) {
 | 
			
		||||
            for (XxlJobUser item: list) {
 | 
			
		||||
        if (list != null && list.size() > 0) {
 | 
			
		||||
            for (XxlJobUser item : list) {
 | 
			
		||||
                item.setPassword(null);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // package result
 | 
			
		||||
        Map<String, Object> maps = new HashMap<String, Object>();
 | 
			
		||||
        maps.put("recordsTotal", list_count);		// 总记录数
 | 
			
		||||
        maps.put("recordsFiltered", list_count);	// 过滤后的总记录数
 | 
			
		||||
        maps.put("data", list);  					// 分页列表
 | 
			
		||||
        maps.put("recordsTotal" , list_count);        // 总记录数
 | 
			
		||||
        maps.put("recordsFiltered" , list_count);    // 过滤后的总记录数
 | 
			
		||||
        maps.put("data" , list);                      // 分页列表
 | 
			
		||||
        return maps;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -78,19 +78,19 @@ public class UserController {
 | 
			
		||||
 | 
			
		||||
        // valid username
 | 
			
		||||
        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());
 | 
			
		||||
        if (!(xxlJobUser.getUsername().length()>=4 && xxlJobUser.getUsername().length()<=20)) {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("system_lengh_limit")+"[4-20]" );
 | 
			
		||||
        if (!(xxlJobUser.getUsername().length() >= 4 && xxlJobUser.getUsername().length() <= 20)) {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("system_lengh_limit") + "[4-20]");
 | 
			
		||||
        }
 | 
			
		||||
        // valid password
 | 
			
		||||
        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());
 | 
			
		||||
        if (!(xxlJobUser.getPassword().length()>=4 && xxlJobUser.getPassword().length()<=20)) {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("system_lengh_limit")+"[4-20]" );
 | 
			
		||||
        if (!(xxlJobUser.getPassword().length() >= 4 && xxlJobUser.getPassword().length() <= 20)) {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("system_lengh_limit") + "[4-20]");
 | 
			
		||||
        }
 | 
			
		||||
        // md5 password
 | 
			
		||||
        xxlJobUser.setPassword(DigestUtils.md5DigestAsHex(xxlJobUser.getPassword().getBytes()));
 | 
			
		||||
@@ -98,7 +98,7 @@ public class UserController {
 | 
			
		||||
        // check repeat
 | 
			
		||||
        XxlJobUser existUser = xxlJobUserDao.loadByUserName(xxlJobUser.getUsername());
 | 
			
		||||
        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
 | 
			
		||||
@@ -120,8 +120,8 @@ public class UserController {
 | 
			
		||||
        // valid password
 | 
			
		||||
        if (StringUtils.hasText(xxlJobUser.getPassword())) {
 | 
			
		||||
            xxlJobUser.setPassword(xxlJobUser.getPassword().trim());
 | 
			
		||||
            if (!(xxlJobUser.getPassword().length()>=4 && xxlJobUser.getPassword().length()<=20)) {
 | 
			
		||||
                return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("system_lengh_limit")+"[4-20]" );
 | 
			
		||||
            if (!(xxlJobUser.getPassword().length() >= 4 && xxlJobUser.getPassword().length() <= 20)) {
 | 
			
		||||
                return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("system_lengh_limit") + "[4-20]");
 | 
			
		||||
            }
 | 
			
		||||
            // md5 password
 | 
			
		||||
            xxlJobUser.setPassword(DigestUtils.md5DigestAsHex(xxlJobUser.getPassword().getBytes()));
 | 
			
		||||
@@ -151,15 +151,15 @@ public class UserController {
 | 
			
		||||
 | 
			
		||||
    @RequestMapping("/updatePwd")
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    public ReturnT<String> updatePwd(HttpServletRequest request, String password){
 | 
			
		||||
    public ReturnT<String> updatePwd(HttpServletRequest request, String password) {
 | 
			
		||||
 | 
			
		||||
        // valid password
 | 
			
		||||
        if (password==null || password.trim().length()==0){
 | 
			
		||||
        if (password == null || password.trim().length() == 0) {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL.getCode(), "密码不可为空");
 | 
			
		||||
        }
 | 
			
		||||
        password = password.trim();
 | 
			
		||||
        if (!(password.length()>=4 && password.length()<=20)) {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("system_lengh_limit")+"[4-20]" );
 | 
			
		||||
        if (!(password.length() >= 4 && password.length() <= 20)) {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("system_lengh_limit") + "[4-20]");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // md5 password
 | 
			
		||||
 
 | 
			
		||||
@@ -8,22 +8,23 @@ import java.lang.annotation.Target;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 权限限制
 | 
			
		||||
 *
 | 
			
		||||
 * @author xuxueli 2015-12-12 18:29:02
 | 
			
		||||
 */
 | 
			
		||||
@Target(ElementType.METHOD)
 | 
			
		||||
@Retention(RetentionPolicy.RUNTIME)
 | 
			
		||||
public @interface PermissionLimit {
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * 登录拦截 (默认拦截)
 | 
			
		||||
	 */
 | 
			
		||||
	boolean limit() default true;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 要求管理员权限
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return
 | 
			
		||||
	 */
 | 
			
		||||
	boolean adminuser() default false;
 | 
			
		||||
    /**
 | 
			
		||||
     * 登录拦截 (默认拦截)
 | 
			
		||||
     */
 | 
			
		||||
    boolean limit() default true;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
    /**
 | 
			
		||||
     * 要求管理员权限
 | 
			
		||||
     *
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    boolean adminuser() default false;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -19,25 +19,25 @@ import java.util.HashMap;
 | 
			
		||||
@Component
 | 
			
		||||
public class CookieInterceptor implements AsyncHandlerInterceptor {
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
 | 
			
		||||
			ModelAndView modelAndView) throws Exception {
 | 
			
		||||
    @Override
 | 
			
		||||
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
 | 
			
		||||
                           ModelAndView modelAndView) throws Exception {
 | 
			
		||||
 | 
			
		||||
		// cookie
 | 
			
		||||
		if (modelAndView!=null && request.getCookies()!=null && request.getCookies().length>0) {
 | 
			
		||||
			HashMap<String, Cookie> cookieMap = new HashMap<String, Cookie>();
 | 
			
		||||
			for (Cookie ck : request.getCookies()) {
 | 
			
		||||
				cookieMap.put(ck.getName(), ck);
 | 
			
		||||
			}
 | 
			
		||||
			modelAndView.addObject("cookieMap", cookieMap);
 | 
			
		||||
		}
 | 
			
		||||
        // cookie
 | 
			
		||||
        if (modelAndView != null && request.getCookies() != null && request.getCookies().length > 0) {
 | 
			
		||||
            HashMap<String, Cookie> cookieMap = new HashMap<String, Cookie>();
 | 
			
		||||
            for (Cookie ck : request.getCookies()) {
 | 
			
		||||
                cookieMap.put(ck.getName(), ck);
 | 
			
		||||
            }
 | 
			
		||||
            modelAndView.addObject("cookieMap" , cookieMap);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		// static method
 | 
			
		||||
		if (modelAndView != null) {
 | 
			
		||||
			modelAndView.addObject("I18nUtil", FtlUtil.generateStaticModel(I18nUtil.class.getName()));
 | 
			
		||||
		}
 | 
			
		||||
        // static method
 | 
			
		||||
        if (modelAndView != null) {
 | 
			
		||||
            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
 | 
			
		||||
public class PermissionInterceptor implements AsyncHandlerInterceptor {
 | 
			
		||||
 | 
			
		||||
	@Resource
 | 
			
		||||
	private LoginService loginService;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private LoginService loginService;
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
 | 
			
		||||
 | 
			
		||||
		if (!(handler instanceof HandlerMethod)) {
 | 
			
		||||
			return AsyncHandlerInterceptor.super.preHandle(request, response, handler);
 | 
			
		||||
		}
 | 
			
		||||
        if (!(handler instanceof HandlerMethod)) {
 | 
			
		||||
            return AsyncHandlerInterceptor.super.preHandle(request, response, handler);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		// if need login
 | 
			
		||||
		boolean needLogin = true;
 | 
			
		||||
		boolean needAdminuser = false;
 | 
			
		||||
		HandlerMethod method = (HandlerMethod)handler;
 | 
			
		||||
		PermissionLimit permission = method.getMethodAnnotation(PermissionLimit.class);
 | 
			
		||||
		if (permission!=null) {
 | 
			
		||||
			needLogin = permission.limit();
 | 
			
		||||
			needAdminuser = permission.adminuser();
 | 
			
		||||
		}
 | 
			
		||||
        // if need login
 | 
			
		||||
        boolean needLogin = true;
 | 
			
		||||
        boolean needAdminuser = false;
 | 
			
		||||
        HandlerMethod method = (HandlerMethod) handler;
 | 
			
		||||
        PermissionLimit permission = method.getMethodAnnotation(PermissionLimit.class);
 | 
			
		||||
        if (permission != null) {
 | 
			
		||||
            needLogin = permission.limit();
 | 
			
		||||
            needAdminuser = permission.adminuser();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		if (needLogin) {
 | 
			
		||||
			XxlJobUser loginUser = loginService.ifLogin(request, response);
 | 
			
		||||
			if (loginUser == null) {
 | 
			
		||||
				response.setStatus(302);
 | 
			
		||||
				response.setHeader("location", request.getContextPath()+"/toLogin");
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
			if (needAdminuser && loginUser.getRole()!=1) {
 | 
			
		||||
				throw new RuntimeException(I18nUtil.getString("system_permission_limit"));
 | 
			
		||||
			}
 | 
			
		||||
			request.setAttribute(LoginService.LOGIN_IDENTITY_KEY, loginUser);
 | 
			
		||||
		}
 | 
			
		||||
        if (needLogin) {
 | 
			
		||||
            XxlJobUser loginUser = loginService.ifLogin(request, response);
 | 
			
		||||
            if (loginUser == null) {
 | 
			
		||||
                response.setStatus(302);
 | 
			
		||||
                response.setHeader("location" , request.getContextPath() + "/toLogin");
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
            if (needAdminuser && loginUser.getRole() != 1) {
 | 
			
		||||
                throw new RuntimeException(I18nUtil.getString("system_permission_limit"));
 | 
			
		||||
            }
 | 
			
		||||
            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;
 | 
			
		||||
 | 
			
		||||
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.core.biz.model.ReturnT;
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
import org.springframework.stereotype.Component;
 | 
			
		||||
@@ -22,45 +22,45 @@ import java.io.IOException;
 | 
			
		||||
 */
 | 
			
		||||
@Component
 | 
			
		||||
public class WebExceptionResolver implements HandlerExceptionResolver {
 | 
			
		||||
	private static transient Logger logger = LoggerFactory.getLogger(WebExceptionResolver.class);
 | 
			
		||||
    private static transient Logger logger = LoggerFactory.getLogger(WebExceptionResolver.class);
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public ModelAndView resolveException(HttpServletRequest request,
 | 
			
		||||
			HttpServletResponse response, Object handler, Exception ex) {
 | 
			
		||||
    @Override
 | 
			
		||||
    public ModelAndView resolveException(HttpServletRequest request,
 | 
			
		||||
                                         HttpServletResponse response, Object handler, Exception ex) {
 | 
			
		||||
 | 
			
		||||
		if (!(ex instanceof XxlJobException)) {
 | 
			
		||||
			logger.error("WebExceptionResolver:{}", ex);
 | 
			
		||||
		}
 | 
			
		||||
        if (!(ex instanceof XxlJobException)) {
 | 
			
		||||
            logger.error("WebExceptionResolver:{}" , ex);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		// if json
 | 
			
		||||
		boolean isJson = false;
 | 
			
		||||
		if (handler instanceof HandlerMethod) {
 | 
			
		||||
			HandlerMethod method = (HandlerMethod)handler;
 | 
			
		||||
			ResponseBody responseBody = method.getMethodAnnotation(ResponseBody.class);
 | 
			
		||||
			if (responseBody != null) {
 | 
			
		||||
				isJson = true;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
        // if json
 | 
			
		||||
        boolean isJson = false;
 | 
			
		||||
        if (handler instanceof HandlerMethod) {
 | 
			
		||||
            HandlerMethod method = (HandlerMethod) handler;
 | 
			
		||||
            ResponseBody responseBody = method.getMethodAnnotation(ResponseBody.class);
 | 
			
		||||
            if (responseBody != null) {
 | 
			
		||||
                isJson = true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		// error result
 | 
			
		||||
		ReturnT<String> errorResult = new ReturnT<String>(ReturnT.FAIL_CODE, ex.toString().replaceAll("\n", "<br/>"));
 | 
			
		||||
        // error result
 | 
			
		||||
        ReturnT<String> errorResult = new ReturnT<String>(ReturnT.FAIL_CODE, ex.toString().replaceAll("\n" , "<br/>"));
 | 
			
		||||
 | 
			
		||||
		// response
 | 
			
		||||
		ModelAndView mv = new ModelAndView();
 | 
			
		||||
		if (isJson) {
 | 
			
		||||
			try {
 | 
			
		||||
				response.setContentType("application/json;charset=utf-8");
 | 
			
		||||
				response.getWriter().print(JacksonUtil.writeValueAsString(errorResult));
 | 
			
		||||
			} catch (IOException e) {
 | 
			
		||||
				logger.error(e.getMessage(), e);
 | 
			
		||||
			}
 | 
			
		||||
			return mv;
 | 
			
		||||
		} else {
 | 
			
		||||
        // response
 | 
			
		||||
        ModelAndView mv = new ModelAndView();
 | 
			
		||||
        if (isJson) {
 | 
			
		||||
            try {
 | 
			
		||||
                response.setContentType("application/json;charset=utf-8");
 | 
			
		||||
                response.getWriter().print(JacksonUtil.writeValueAsString(errorResult));
 | 
			
		||||
            } catch (IOException e) {
 | 
			
		||||
                logger.error(e.getMessage(), e);
 | 
			
		||||
            }
 | 
			
		||||
            return mv;
 | 
			
		||||
        } else {
 | 
			
		||||
 | 
			
		||||
			mv.addObject("exceptionMsg", errorResult.getMsg());
 | 
			
		||||
			mv.setViewName("/common/common.exception");
 | 
			
		||||
			return mv;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
            mv.addObject("exceptionMsg" , errorResult.getMsg());
 | 
			
		||||
            mv.setViewName("/common/common.exception");
 | 
			
		||||
            return mv;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -8,230 +8,230 @@ import java.util.Date;
 | 
			
		||||
 * @author xuxueli  2016-1-12 18:25:49
 | 
			
		||||
 */
 | 
			
		||||
public class XxlJobInfo {
 | 
			
		||||
	
 | 
			
		||||
	private int id;				// 主键ID
 | 
			
		||||
	
 | 
			
		||||
	private int jobGroup;		// 执行器主键ID
 | 
			
		||||
	private String jobDesc;
 | 
			
		||||
	
 | 
			
		||||
	private Date addTime;
 | 
			
		||||
	private Date updateTime;
 | 
			
		||||
	
 | 
			
		||||
	private String author;		// 负责人
 | 
			
		||||
	private String alarmEmail;	// 报警邮件
 | 
			
		||||
 | 
			
		||||
	private String scheduleType;			// 调度类型
 | 
			
		||||
	private String scheduleConf;			// 调度配置,值含义取决于调度类型
 | 
			
		||||
	private String misfireStrategy;			// 调度过期策略
 | 
			
		||||
    private int id;                // 主键ID
 | 
			
		||||
 | 
			
		||||
	private String executorRouteStrategy;	// 执行器路由策略
 | 
			
		||||
	private String executorHandler;		    // 执行器,任务Handler名称
 | 
			
		||||
	private String executorParam;		    // 执行器,任务参数
 | 
			
		||||
	private String executorBlockStrategy;	// 阻塞处理策略
 | 
			
		||||
	private int executorTimeout;     		// 任务执行超时时间,单位秒
 | 
			
		||||
	private int executorFailRetryCount;		// 失败重试次数
 | 
			
		||||
	
 | 
			
		||||
	private String glueType;		// GLUE类型	#com.xxl.job.core.glue.GlueTypeEnum
 | 
			
		||||
	private String glueSource;		// GLUE源代码
 | 
			
		||||
	private String glueRemark;		// GLUE备注
 | 
			
		||||
	private Date glueUpdatetime;	// GLUE更新时间
 | 
			
		||||
    private int jobGroup;        // 执行器主键ID
 | 
			
		||||
    private String jobDesc;
 | 
			
		||||
 | 
			
		||||
	private String childJobId;		// 子任务ID,多个逗号分隔
 | 
			
		||||
    private Date addTime;
 | 
			
		||||
    private Date updateTime;
 | 
			
		||||
 | 
			
		||||
	private int triggerStatus;		// 调度状态:0-停止,1-运行
 | 
			
		||||
	private long triggerLastTime;	// 上次调度时间
 | 
			
		||||
	private long triggerNextTime;	// 下次调度时间
 | 
			
		||||
    private String author;        // 负责人
 | 
			
		||||
    private String alarmEmail;    // 报警邮件
 | 
			
		||||
 | 
			
		||||
    private String scheduleType;            // 调度类型
 | 
			
		||||
    private String scheduleConf;            // 调度配置,值含义取决于调度类型
 | 
			
		||||
    private String misfireStrategy;            // 调度过期策略
 | 
			
		||||
 | 
			
		||||
    private String executorRouteStrategy;    // 执行器路由策略
 | 
			
		||||
    private String executorHandler;            // 执行器,任务Handler名称
 | 
			
		||||
    private String executorParam;            // 执行器,任务参数
 | 
			
		||||
    private String executorBlockStrategy;    // 阻塞处理策略
 | 
			
		||||
    private int executorTimeout;            // 任务执行超时时间,单位秒
 | 
			
		||||
    private int executorFailRetryCount;        // 失败重试次数
 | 
			
		||||
 | 
			
		||||
    private String glueType;        // GLUE类型    #com.xxl.job.core.glue.GlueTypeEnum
 | 
			
		||||
    private String glueSource;        // GLUE源代码
 | 
			
		||||
    private String glueRemark;        // GLUE备注
 | 
			
		||||
    private Date glueUpdatetime;    // GLUE更新时间
 | 
			
		||||
 | 
			
		||||
    private String childJobId;        // 子任务ID,多个逗号分隔
 | 
			
		||||
 | 
			
		||||
    private int triggerStatus;        // 调度状态:0-停止,1-运行
 | 
			
		||||
    private long triggerLastTime;    // 上次调度时间
 | 
			
		||||
    private long triggerNextTime;    // 下次调度时间
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	public int getId() {
 | 
			
		||||
		return id;
 | 
			
		||||
	}
 | 
			
		||||
    public int getId() {
 | 
			
		||||
        return id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setId(int id) {
 | 
			
		||||
		this.id = id;
 | 
			
		||||
	}
 | 
			
		||||
    public void setId(int id) {
 | 
			
		||||
        this.id = id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public int getJobGroup() {
 | 
			
		||||
		return jobGroup;
 | 
			
		||||
	}
 | 
			
		||||
    public int getJobGroup() {
 | 
			
		||||
        return jobGroup;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setJobGroup(int jobGroup) {
 | 
			
		||||
		this.jobGroup = jobGroup;
 | 
			
		||||
	}
 | 
			
		||||
    public void setJobGroup(int jobGroup) {
 | 
			
		||||
        this.jobGroup = jobGroup;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getJobDesc() {
 | 
			
		||||
		return jobDesc;
 | 
			
		||||
	}
 | 
			
		||||
    public String getJobDesc() {
 | 
			
		||||
        return jobDesc;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setJobDesc(String jobDesc) {
 | 
			
		||||
		this.jobDesc = jobDesc;
 | 
			
		||||
	}
 | 
			
		||||
    public void setJobDesc(String jobDesc) {
 | 
			
		||||
        this.jobDesc = jobDesc;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public Date getAddTime() {
 | 
			
		||||
		return addTime;
 | 
			
		||||
	}
 | 
			
		||||
    public Date getAddTime() {
 | 
			
		||||
        return addTime;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setAddTime(Date addTime) {
 | 
			
		||||
		this.addTime = addTime;
 | 
			
		||||
	}
 | 
			
		||||
    public void setAddTime(Date addTime) {
 | 
			
		||||
        this.addTime = addTime;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public Date getUpdateTime() {
 | 
			
		||||
		return updateTime;
 | 
			
		||||
	}
 | 
			
		||||
    public Date getUpdateTime() {
 | 
			
		||||
        return updateTime;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setUpdateTime(Date updateTime) {
 | 
			
		||||
		this.updateTime = updateTime;
 | 
			
		||||
	}
 | 
			
		||||
    public void setUpdateTime(Date updateTime) {
 | 
			
		||||
        this.updateTime = updateTime;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getAuthor() {
 | 
			
		||||
		return author;
 | 
			
		||||
	}
 | 
			
		||||
    public String getAuthor() {
 | 
			
		||||
        return author;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setAuthor(String author) {
 | 
			
		||||
		this.author = author;
 | 
			
		||||
	}
 | 
			
		||||
    public void setAuthor(String author) {
 | 
			
		||||
        this.author = author;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getAlarmEmail() {
 | 
			
		||||
		return alarmEmail;
 | 
			
		||||
	}
 | 
			
		||||
    public String getAlarmEmail() {
 | 
			
		||||
        return alarmEmail;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setAlarmEmail(String alarmEmail) {
 | 
			
		||||
		this.alarmEmail = alarmEmail;
 | 
			
		||||
	}
 | 
			
		||||
    public void setAlarmEmail(String alarmEmail) {
 | 
			
		||||
        this.alarmEmail = alarmEmail;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getScheduleType() {
 | 
			
		||||
		return scheduleType;
 | 
			
		||||
	}
 | 
			
		||||
    public String getScheduleType() {
 | 
			
		||||
        return scheduleType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setScheduleType(String scheduleType) {
 | 
			
		||||
		this.scheduleType = scheduleType;
 | 
			
		||||
	}
 | 
			
		||||
    public void setScheduleType(String scheduleType) {
 | 
			
		||||
        this.scheduleType = scheduleType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getScheduleConf() {
 | 
			
		||||
		return scheduleConf;
 | 
			
		||||
	}
 | 
			
		||||
    public String getScheduleConf() {
 | 
			
		||||
        return scheduleConf;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setScheduleConf(String scheduleConf) {
 | 
			
		||||
		this.scheduleConf = scheduleConf;
 | 
			
		||||
	}
 | 
			
		||||
    public void setScheduleConf(String scheduleConf) {
 | 
			
		||||
        this.scheduleConf = scheduleConf;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getMisfireStrategy() {
 | 
			
		||||
		return misfireStrategy;
 | 
			
		||||
	}
 | 
			
		||||
    public String getMisfireStrategy() {
 | 
			
		||||
        return misfireStrategy;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setMisfireStrategy(String misfireStrategy) {
 | 
			
		||||
		this.misfireStrategy = misfireStrategy;
 | 
			
		||||
	}
 | 
			
		||||
    public void setMisfireStrategy(String misfireStrategy) {
 | 
			
		||||
        this.misfireStrategy = misfireStrategy;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getExecutorRouteStrategy() {
 | 
			
		||||
		return executorRouteStrategy;
 | 
			
		||||
	}
 | 
			
		||||
    public String getExecutorRouteStrategy() {
 | 
			
		||||
        return executorRouteStrategy;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setExecutorRouteStrategy(String executorRouteStrategy) {
 | 
			
		||||
		this.executorRouteStrategy = executorRouteStrategy;
 | 
			
		||||
	}
 | 
			
		||||
    public void setExecutorRouteStrategy(String executorRouteStrategy) {
 | 
			
		||||
        this.executorRouteStrategy = executorRouteStrategy;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getExecutorHandler() {
 | 
			
		||||
		return executorHandler;
 | 
			
		||||
	}
 | 
			
		||||
    public String getExecutorHandler() {
 | 
			
		||||
        return executorHandler;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setExecutorHandler(String executorHandler) {
 | 
			
		||||
		this.executorHandler = executorHandler;
 | 
			
		||||
	}
 | 
			
		||||
    public void setExecutorHandler(String executorHandler) {
 | 
			
		||||
        this.executorHandler = executorHandler;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getExecutorParam() {
 | 
			
		||||
		return executorParam;
 | 
			
		||||
	}
 | 
			
		||||
    public String getExecutorParam() {
 | 
			
		||||
        return executorParam;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setExecutorParam(String executorParam) {
 | 
			
		||||
		this.executorParam = executorParam;
 | 
			
		||||
	}
 | 
			
		||||
    public void setExecutorParam(String executorParam) {
 | 
			
		||||
        this.executorParam = executorParam;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getExecutorBlockStrategy() {
 | 
			
		||||
		return executorBlockStrategy;
 | 
			
		||||
	}
 | 
			
		||||
    public String getExecutorBlockStrategy() {
 | 
			
		||||
        return executorBlockStrategy;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setExecutorBlockStrategy(String executorBlockStrategy) {
 | 
			
		||||
		this.executorBlockStrategy = executorBlockStrategy;
 | 
			
		||||
	}
 | 
			
		||||
    public void setExecutorBlockStrategy(String executorBlockStrategy) {
 | 
			
		||||
        this.executorBlockStrategy = executorBlockStrategy;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public int getExecutorTimeout() {
 | 
			
		||||
		return executorTimeout;
 | 
			
		||||
	}
 | 
			
		||||
    public int getExecutorTimeout() {
 | 
			
		||||
        return executorTimeout;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setExecutorTimeout(int executorTimeout) {
 | 
			
		||||
		this.executorTimeout = executorTimeout;
 | 
			
		||||
	}
 | 
			
		||||
    public void setExecutorTimeout(int executorTimeout) {
 | 
			
		||||
        this.executorTimeout = executorTimeout;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public int getExecutorFailRetryCount() {
 | 
			
		||||
		return executorFailRetryCount;
 | 
			
		||||
	}
 | 
			
		||||
    public int getExecutorFailRetryCount() {
 | 
			
		||||
        return executorFailRetryCount;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setExecutorFailRetryCount(int executorFailRetryCount) {
 | 
			
		||||
		this.executorFailRetryCount = executorFailRetryCount;
 | 
			
		||||
	}
 | 
			
		||||
    public void setExecutorFailRetryCount(int executorFailRetryCount) {
 | 
			
		||||
        this.executorFailRetryCount = executorFailRetryCount;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getGlueType() {
 | 
			
		||||
		return glueType;
 | 
			
		||||
	}
 | 
			
		||||
    public String getGlueType() {
 | 
			
		||||
        return glueType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setGlueType(String glueType) {
 | 
			
		||||
		this.glueType = glueType;
 | 
			
		||||
	}
 | 
			
		||||
    public void setGlueType(String glueType) {
 | 
			
		||||
        this.glueType = glueType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getGlueSource() {
 | 
			
		||||
		return glueSource;
 | 
			
		||||
	}
 | 
			
		||||
    public String getGlueSource() {
 | 
			
		||||
        return glueSource;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setGlueSource(String glueSource) {
 | 
			
		||||
		this.glueSource = glueSource;
 | 
			
		||||
	}
 | 
			
		||||
    public void setGlueSource(String glueSource) {
 | 
			
		||||
        this.glueSource = glueSource;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getGlueRemark() {
 | 
			
		||||
		return glueRemark;
 | 
			
		||||
	}
 | 
			
		||||
    public String getGlueRemark() {
 | 
			
		||||
        return glueRemark;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setGlueRemark(String glueRemark) {
 | 
			
		||||
		this.glueRemark = glueRemark;
 | 
			
		||||
	}
 | 
			
		||||
    public void setGlueRemark(String glueRemark) {
 | 
			
		||||
        this.glueRemark = glueRemark;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public Date getGlueUpdatetime() {
 | 
			
		||||
		return glueUpdatetime;
 | 
			
		||||
	}
 | 
			
		||||
    public Date getGlueUpdatetime() {
 | 
			
		||||
        return glueUpdatetime;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setGlueUpdatetime(Date glueUpdatetime) {
 | 
			
		||||
		this.glueUpdatetime = glueUpdatetime;
 | 
			
		||||
	}
 | 
			
		||||
    public void setGlueUpdatetime(Date glueUpdatetime) {
 | 
			
		||||
        this.glueUpdatetime = glueUpdatetime;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getChildJobId() {
 | 
			
		||||
		return childJobId;
 | 
			
		||||
	}
 | 
			
		||||
    public String getChildJobId() {
 | 
			
		||||
        return childJobId;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setChildJobId(String childJobId) {
 | 
			
		||||
		this.childJobId = childJobId;
 | 
			
		||||
	}
 | 
			
		||||
    public void setChildJobId(String childJobId) {
 | 
			
		||||
        this.childJobId = childJobId;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public int getTriggerStatus() {
 | 
			
		||||
		return triggerStatus;
 | 
			
		||||
	}
 | 
			
		||||
    public int getTriggerStatus() {
 | 
			
		||||
        return triggerStatus;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setTriggerStatus(int triggerStatus) {
 | 
			
		||||
		this.triggerStatus = triggerStatus;
 | 
			
		||||
	}
 | 
			
		||||
    public void setTriggerStatus(int triggerStatus) {
 | 
			
		||||
        this.triggerStatus = triggerStatus;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public long getTriggerLastTime() {
 | 
			
		||||
		return triggerLastTime;
 | 
			
		||||
	}
 | 
			
		||||
    public long getTriggerLastTime() {
 | 
			
		||||
        return triggerLastTime;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setTriggerLastTime(long triggerLastTime) {
 | 
			
		||||
		this.triggerLastTime = triggerLastTime;
 | 
			
		||||
	}
 | 
			
		||||
    public void setTriggerLastTime(long triggerLastTime) {
 | 
			
		||||
        this.triggerLastTime = triggerLastTime;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public long getTriggerNextTime() {
 | 
			
		||||
		return triggerNextTime;
 | 
			
		||||
	}
 | 
			
		||||
    public long getTriggerNextTime() {
 | 
			
		||||
        return triggerNextTime;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setTriggerNextTime(long triggerNextTime) {
 | 
			
		||||
		this.triggerNextTime = triggerNextTime;
 | 
			
		||||
	}
 | 
			
		||||
    public void setTriggerNextTime(long triggerNextTime) {
 | 
			
		||||
        this.triggerNextTime = triggerNextTime;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -4,154 +4,155 @@ import java.util.Date;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * xxl-job log, used to track trigger process
 | 
			
		||||
 *
 | 
			
		||||
 * @author xuxueli  2015-12-19 23:19:09
 | 
			
		||||
 */
 | 
			
		||||
public class XxlJobLog {
 | 
			
		||||
	
 | 
			
		||||
	private long id;
 | 
			
		||||
	
 | 
			
		||||
	// job info
 | 
			
		||||
	private int jobGroup;
 | 
			
		||||
	private int jobId;
 | 
			
		||||
 | 
			
		||||
	// execute info
 | 
			
		||||
	private String executorAddress;
 | 
			
		||||
	private String executorHandler;
 | 
			
		||||
	private String executorParam;
 | 
			
		||||
	private String executorShardingParam;
 | 
			
		||||
	private int executorFailRetryCount;
 | 
			
		||||
	
 | 
			
		||||
	// trigger info
 | 
			
		||||
	private Date triggerTime;
 | 
			
		||||
	private int triggerCode;
 | 
			
		||||
	private String triggerMsg;
 | 
			
		||||
	
 | 
			
		||||
	// handle info
 | 
			
		||||
	private Date handleTime;
 | 
			
		||||
	private int handleCode;
 | 
			
		||||
	private String handleMsg;
 | 
			
		||||
    private long id;
 | 
			
		||||
 | 
			
		||||
	// alarm info
 | 
			
		||||
	private int alarmStatus;
 | 
			
		||||
    // job info
 | 
			
		||||
    private int jobGroup;
 | 
			
		||||
    private int jobId;
 | 
			
		||||
 | 
			
		||||
	public long getId() {
 | 
			
		||||
		return id;
 | 
			
		||||
	}
 | 
			
		||||
    // execute info
 | 
			
		||||
    private String executorAddress;
 | 
			
		||||
    private String executorHandler;
 | 
			
		||||
    private String executorParam;
 | 
			
		||||
    private String executorShardingParam;
 | 
			
		||||
    private int executorFailRetryCount;
 | 
			
		||||
 | 
			
		||||
	public void setId(long id) {
 | 
			
		||||
		this.id = id;
 | 
			
		||||
	}
 | 
			
		||||
    // trigger info
 | 
			
		||||
    private Date triggerTime;
 | 
			
		||||
    private int triggerCode;
 | 
			
		||||
    private String triggerMsg;
 | 
			
		||||
 | 
			
		||||
	public int getJobGroup() {
 | 
			
		||||
		return jobGroup;
 | 
			
		||||
	}
 | 
			
		||||
    // handle info
 | 
			
		||||
    private Date handleTime;
 | 
			
		||||
    private int handleCode;
 | 
			
		||||
    private String handleMsg;
 | 
			
		||||
 | 
			
		||||
	public void setJobGroup(int jobGroup) {
 | 
			
		||||
		this.jobGroup = jobGroup;
 | 
			
		||||
	}
 | 
			
		||||
    // alarm info
 | 
			
		||||
    private int alarmStatus;
 | 
			
		||||
 | 
			
		||||
	public int getJobId() {
 | 
			
		||||
		return jobId;
 | 
			
		||||
	}
 | 
			
		||||
    public long getId() {
 | 
			
		||||
        return id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setJobId(int jobId) {
 | 
			
		||||
		this.jobId = jobId;
 | 
			
		||||
	}
 | 
			
		||||
    public void setId(long id) {
 | 
			
		||||
        this.id = id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getExecutorAddress() {
 | 
			
		||||
		return executorAddress;
 | 
			
		||||
	}
 | 
			
		||||
    public int getJobGroup() {
 | 
			
		||||
        return jobGroup;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setExecutorAddress(String executorAddress) {
 | 
			
		||||
		this.executorAddress = executorAddress;
 | 
			
		||||
	}
 | 
			
		||||
    public void setJobGroup(int jobGroup) {
 | 
			
		||||
        this.jobGroup = jobGroup;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getExecutorHandler() {
 | 
			
		||||
		return executorHandler;
 | 
			
		||||
	}
 | 
			
		||||
    public int getJobId() {
 | 
			
		||||
        return jobId;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setExecutorHandler(String executorHandler) {
 | 
			
		||||
		this.executorHandler = executorHandler;
 | 
			
		||||
	}
 | 
			
		||||
    public void setJobId(int jobId) {
 | 
			
		||||
        this.jobId = jobId;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getExecutorParam() {
 | 
			
		||||
		return executorParam;
 | 
			
		||||
	}
 | 
			
		||||
    public String getExecutorAddress() {
 | 
			
		||||
        return executorAddress;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setExecutorParam(String executorParam) {
 | 
			
		||||
		this.executorParam = executorParam;
 | 
			
		||||
	}
 | 
			
		||||
    public void setExecutorAddress(String executorAddress) {
 | 
			
		||||
        this.executorAddress = executorAddress;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getExecutorShardingParam() {
 | 
			
		||||
		return executorShardingParam;
 | 
			
		||||
	}
 | 
			
		||||
    public String getExecutorHandler() {
 | 
			
		||||
        return executorHandler;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setExecutorShardingParam(String executorShardingParam) {
 | 
			
		||||
		this.executorShardingParam = executorShardingParam;
 | 
			
		||||
	}
 | 
			
		||||
    public void setExecutorHandler(String executorHandler) {
 | 
			
		||||
        this.executorHandler = executorHandler;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public int getExecutorFailRetryCount() {
 | 
			
		||||
		return executorFailRetryCount;
 | 
			
		||||
	}
 | 
			
		||||
    public String getExecutorParam() {
 | 
			
		||||
        return executorParam;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setExecutorFailRetryCount(int executorFailRetryCount) {
 | 
			
		||||
		this.executorFailRetryCount = executorFailRetryCount;
 | 
			
		||||
	}
 | 
			
		||||
    public void setExecutorParam(String executorParam) {
 | 
			
		||||
        this.executorParam = executorParam;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public Date getTriggerTime() {
 | 
			
		||||
		return triggerTime;
 | 
			
		||||
	}
 | 
			
		||||
    public String getExecutorShardingParam() {
 | 
			
		||||
        return executorShardingParam;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setTriggerTime(Date triggerTime) {
 | 
			
		||||
		this.triggerTime = triggerTime;
 | 
			
		||||
	}
 | 
			
		||||
    public void setExecutorShardingParam(String executorShardingParam) {
 | 
			
		||||
        this.executorShardingParam = executorShardingParam;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public int getTriggerCode() {
 | 
			
		||||
		return triggerCode;
 | 
			
		||||
	}
 | 
			
		||||
    public int getExecutorFailRetryCount() {
 | 
			
		||||
        return executorFailRetryCount;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setTriggerCode(int triggerCode) {
 | 
			
		||||
		this.triggerCode = triggerCode;
 | 
			
		||||
	}
 | 
			
		||||
    public void setExecutorFailRetryCount(int executorFailRetryCount) {
 | 
			
		||||
        this.executorFailRetryCount = executorFailRetryCount;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getTriggerMsg() {
 | 
			
		||||
		return triggerMsg;
 | 
			
		||||
	}
 | 
			
		||||
    public Date getTriggerTime() {
 | 
			
		||||
        return triggerTime;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setTriggerMsg(String triggerMsg) {
 | 
			
		||||
		this.triggerMsg = triggerMsg;
 | 
			
		||||
	}
 | 
			
		||||
    public void setTriggerTime(Date triggerTime) {
 | 
			
		||||
        this.triggerTime = triggerTime;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public Date getHandleTime() {
 | 
			
		||||
		return handleTime;
 | 
			
		||||
	}
 | 
			
		||||
    public int getTriggerCode() {
 | 
			
		||||
        return triggerCode;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setHandleTime(Date handleTime) {
 | 
			
		||||
		this.handleTime = handleTime;
 | 
			
		||||
	}
 | 
			
		||||
    public void setTriggerCode(int triggerCode) {
 | 
			
		||||
        this.triggerCode = triggerCode;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public int getHandleCode() {
 | 
			
		||||
		return handleCode;
 | 
			
		||||
	}
 | 
			
		||||
    public String getTriggerMsg() {
 | 
			
		||||
        return triggerMsg;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setHandleCode(int handleCode) {
 | 
			
		||||
		this.handleCode = handleCode;
 | 
			
		||||
	}
 | 
			
		||||
    public void setTriggerMsg(String triggerMsg) {
 | 
			
		||||
        this.triggerMsg = triggerMsg;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getHandleMsg() {
 | 
			
		||||
		return handleMsg;
 | 
			
		||||
	}
 | 
			
		||||
    public Date getHandleTime() {
 | 
			
		||||
        return handleTime;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setHandleMsg(String handleMsg) {
 | 
			
		||||
		this.handleMsg = handleMsg;
 | 
			
		||||
	}
 | 
			
		||||
    public void setHandleTime(Date handleTime) {
 | 
			
		||||
        this.handleTime = handleTime;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public int getAlarmStatus() {
 | 
			
		||||
		return alarmStatus;
 | 
			
		||||
	}
 | 
			
		||||
    public int getHandleCode() {
 | 
			
		||||
        return handleCode;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setAlarmStatus(int alarmStatus) {
 | 
			
		||||
		this.alarmStatus = alarmStatus;
 | 
			
		||||
	}
 | 
			
		||||
    public void setHandleCode(int handleCode) {
 | 
			
		||||
        this.handleCode = handleCode;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getHandleMsg() {
 | 
			
		||||
        return handleMsg;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setHandleMsg(String handleMsg) {
 | 
			
		||||
        this.handleMsg = handleMsg;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int getAlarmStatus() {
 | 
			
		||||
        return alarmStatus;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setAlarmStatus(int alarmStatus) {
 | 
			
		||||
        this.alarmStatus = alarmStatus;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -4,72 +4,73 @@ import java.util.Date;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * xxl-job log for glue, used to track job code process
 | 
			
		||||
 *
 | 
			
		||||
 * @author xuxueli 2016-5-19 17:57:46
 | 
			
		||||
 */
 | 
			
		||||
public class XxlJobLogGlue {
 | 
			
		||||
	
 | 
			
		||||
	private int id;
 | 
			
		||||
	private int jobId;				// 任务主键ID
 | 
			
		||||
	private String glueType;		// GLUE类型	#com.xxl.job.core.glue.GlueTypeEnum
 | 
			
		||||
	private String glueSource;
 | 
			
		||||
	private String glueRemark;
 | 
			
		||||
	private Date addTime;
 | 
			
		||||
	private Date updateTime;
 | 
			
		||||
 | 
			
		||||
	public int getId() {
 | 
			
		||||
		return id;
 | 
			
		||||
	}
 | 
			
		||||
    private int id;
 | 
			
		||||
    private int jobId;                // 任务主键ID
 | 
			
		||||
    private String glueType;        // GLUE类型	#com.xxl.job.core.glue.GlueTypeEnum
 | 
			
		||||
    private String glueSource;
 | 
			
		||||
    private String glueRemark;
 | 
			
		||||
    private Date addTime;
 | 
			
		||||
    private Date updateTime;
 | 
			
		||||
 | 
			
		||||
	public void setId(int id) {
 | 
			
		||||
		this.id = id;
 | 
			
		||||
	}
 | 
			
		||||
    public int getId() {
 | 
			
		||||
        return id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public int getJobId() {
 | 
			
		||||
		return jobId;
 | 
			
		||||
	}
 | 
			
		||||
    public void setId(int id) {
 | 
			
		||||
        this.id = id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setJobId(int jobId) {
 | 
			
		||||
		this.jobId = jobId;
 | 
			
		||||
	}
 | 
			
		||||
    public int getJobId() {
 | 
			
		||||
        return jobId;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getGlueType() {
 | 
			
		||||
		return glueType;
 | 
			
		||||
	}
 | 
			
		||||
    public void setJobId(int jobId) {
 | 
			
		||||
        this.jobId = jobId;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setGlueType(String glueType) {
 | 
			
		||||
		this.glueType = glueType;
 | 
			
		||||
	}
 | 
			
		||||
    public String getGlueType() {
 | 
			
		||||
        return glueType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getGlueSource() {
 | 
			
		||||
		return glueSource;
 | 
			
		||||
	}
 | 
			
		||||
    public void setGlueType(String glueType) {
 | 
			
		||||
        this.glueType = glueType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setGlueSource(String glueSource) {
 | 
			
		||||
		this.glueSource = glueSource;
 | 
			
		||||
	}
 | 
			
		||||
    public String getGlueSource() {
 | 
			
		||||
        return glueSource;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getGlueRemark() {
 | 
			
		||||
		return glueRemark;
 | 
			
		||||
	}
 | 
			
		||||
    public void setGlueSource(String glueSource) {
 | 
			
		||||
        this.glueSource = glueSource;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setGlueRemark(String glueRemark) {
 | 
			
		||||
		this.glueRemark = glueRemark;
 | 
			
		||||
	}
 | 
			
		||||
    public String getGlueRemark() {
 | 
			
		||||
        return glueRemark;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public Date getAddTime() {
 | 
			
		||||
		return addTime;
 | 
			
		||||
	}
 | 
			
		||||
    public void setGlueRemark(String glueRemark) {
 | 
			
		||||
        this.glueRemark = glueRemark;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setAddTime(Date addTime) {
 | 
			
		||||
		this.addTime = addTime;
 | 
			
		||||
	}
 | 
			
		||||
    public Date getAddTime() {
 | 
			
		||||
        return addTime;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public Date getUpdateTime() {
 | 
			
		||||
		return updateTime;
 | 
			
		||||
	}
 | 
			
		||||
    public void setAddTime(Date addTime) {
 | 
			
		||||
        this.addTime = addTime;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setUpdateTime(Date updateTime) {
 | 
			
		||||
		this.updateTime = updateTime;
 | 
			
		||||
	}
 | 
			
		||||
    public Date getUpdateTime() {
 | 
			
		||||
        return updateTime;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setUpdateTime(Date updateTime) {
 | 
			
		||||
        this.updateTime = updateTime;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -6,68 +6,68 @@ import org.springframework.util.StringUtils;
 | 
			
		||||
 * @author xuxueli 2019-05-04 16:43:12
 | 
			
		||||
 */
 | 
			
		||||
public class XxlJobUser {
 | 
			
		||||
	
 | 
			
		||||
	private int id;
 | 
			
		||||
	private String username;		// 账号
 | 
			
		||||
	private String password;		// 密码
 | 
			
		||||
	private int role;				// 角色:0-普通用户、1-管理员
 | 
			
		||||
	private String permission;	// 权限:执行器ID列表,多个逗号分割
 | 
			
		||||
 | 
			
		||||
	public int getId() {
 | 
			
		||||
		return id;
 | 
			
		||||
	}
 | 
			
		||||
    private int id;
 | 
			
		||||
    private String username;        // 账号
 | 
			
		||||
    private String password;        // 密码
 | 
			
		||||
    private int role;                // 角色:0-普通用户、1-管理员
 | 
			
		||||
    private String permission;    // 权限:执行器ID列表,多个逗号分割
 | 
			
		||||
 | 
			
		||||
	public void setId(int id) {
 | 
			
		||||
		this.id = id;
 | 
			
		||||
	}
 | 
			
		||||
    public int getId() {
 | 
			
		||||
        return id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getUsername() {
 | 
			
		||||
		return username;
 | 
			
		||||
	}
 | 
			
		||||
    public void setId(int id) {
 | 
			
		||||
        this.id = id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setUsername(String username) {
 | 
			
		||||
		this.username = username;
 | 
			
		||||
	}
 | 
			
		||||
    public String getUsername() {
 | 
			
		||||
        return username;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getPassword() {
 | 
			
		||||
		return password;
 | 
			
		||||
	}
 | 
			
		||||
    public void setUsername(String username) {
 | 
			
		||||
        this.username = username;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setPassword(String password) {
 | 
			
		||||
		this.password = password;
 | 
			
		||||
	}
 | 
			
		||||
    public String getPassword() {
 | 
			
		||||
        return password;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public int getRole() {
 | 
			
		||||
		return role;
 | 
			
		||||
	}
 | 
			
		||||
    public void setPassword(String password) {
 | 
			
		||||
        this.password = password;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setRole(int role) {
 | 
			
		||||
		this.role = role;
 | 
			
		||||
	}
 | 
			
		||||
    public int getRole() {
 | 
			
		||||
        return role;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public String getPermission() {
 | 
			
		||||
		return permission;
 | 
			
		||||
	}
 | 
			
		||||
    public void setRole(int role) {
 | 
			
		||||
        this.role = role;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setPermission(String permission) {
 | 
			
		||||
		this.permission = permission;
 | 
			
		||||
	}
 | 
			
		||||
    public String getPermission() {
 | 
			
		||||
        return permission;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	// plugin
 | 
			
		||||
	public boolean validPermission(int jobGroup){
 | 
			
		||||
		if (this.role == 1) {
 | 
			
		||||
			return true;
 | 
			
		||||
		} else {
 | 
			
		||||
			if (StringUtils.hasText(this.permission)) {
 | 
			
		||||
				for (String permissionItem : this.permission.split(",")) {
 | 
			
		||||
					if (String.valueOf(jobGroup).equals(permissionItem)) {
 | 
			
		||||
						return true;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
    public void setPermission(String permission) {
 | 
			
		||||
        this.permission = permission;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
    // plugin
 | 
			
		||||
    public boolean validPermission(int jobGroup) {
 | 
			
		||||
        if (this.role == 1) {
 | 
			
		||||
            return true;
 | 
			
		||||
        } else {
 | 
			
		||||
            if (StringUtils.hasText(this.permission)) {
 | 
			
		||||
                for (String permissionItem : this.permission.split(",")) {
 | 
			
		||||
                    if (String.valueOf(jobGroup).equals(permissionItem)) {
 | 
			
		||||
                        return true;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -20,83 +20,85 @@ import java.util.concurrent.*;
 | 
			
		||||
 * @author xuxueli 2015-9-1 18:05:56
 | 
			
		||||
 */
 | 
			
		||||
public class JobCompleteHelper {
 | 
			
		||||
	private static Logger logger = LoggerFactory.getLogger(JobCompleteHelper.class);
 | 
			
		||||
	
 | 
			
		||||
	private static JobCompleteHelper instance = new JobCompleteHelper();
 | 
			
		||||
	public static JobCompleteHelper getInstance(){
 | 
			
		||||
		return instance;
 | 
			
		||||
	}
 | 
			
		||||
    private static Logger logger = LoggerFactory.getLogger(JobCompleteHelper.class);
 | 
			
		||||
 | 
			
		||||
	// ---------------------- monitor ----------------------
 | 
			
		||||
    private static JobCompleteHelper instance = new JobCompleteHelper();
 | 
			
		||||
 | 
			
		||||
	private ThreadPoolExecutor callbackThreadPool = null;
 | 
			
		||||
	private Thread monitorThread;
 | 
			
		||||
	private volatile boolean toStop = false;
 | 
			
		||||
	public void start(){
 | 
			
		||||
    public static JobCompleteHelper getInstance() {
 | 
			
		||||
        return instance;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		// for callback
 | 
			
		||||
		callbackThreadPool = new ThreadPoolExecutor(
 | 
			
		||||
				2,
 | 
			
		||||
				20,
 | 
			
		||||
				30L,
 | 
			
		||||
				TimeUnit.SECONDS,
 | 
			
		||||
				new LinkedBlockingQueue<Runnable>(3000),
 | 
			
		||||
				new ThreadFactory() {
 | 
			
		||||
					@Override
 | 
			
		||||
					public Thread newThread(Runnable r) {
 | 
			
		||||
						return new Thread(r, "xxl-job, admin JobLosedMonitorHelper-callbackThreadPool-" + r.hashCode());
 | 
			
		||||
					}
 | 
			
		||||
				},
 | 
			
		||||
				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).");
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
    // ---------------------- monitor ----------------------
 | 
			
		||||
 | 
			
		||||
    private ThreadPoolExecutor callbackThreadPool = null;
 | 
			
		||||
    private Thread monitorThread;
 | 
			
		||||
    private volatile boolean toStop = false;
 | 
			
		||||
 | 
			
		||||
    public void start() {
 | 
			
		||||
 | 
			
		||||
        // for callback
 | 
			
		||||
        callbackThreadPool = new ThreadPoolExecutor(
 | 
			
		||||
            2,
 | 
			
		||||
            20,
 | 
			
		||||
            30L,
 | 
			
		||||
            TimeUnit.SECONDS,
 | 
			
		||||
            new LinkedBlockingQueue<Runnable>(3000),
 | 
			
		||||
            new ThreadFactory() {
 | 
			
		||||
                @Override
 | 
			
		||||
                public Thread newThread(Runnable r) {
 | 
			
		||||
                    return new Thread(r, "xxl-job, admin JobLosedMonitorHelper-callbackThreadPool-" + r.hashCode());
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            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
 | 
			
		||||
		monitorThread = new Thread(new Runnable() {
 | 
			
		||||
        // for monitor
 | 
			
		||||
        monitorThread = new Thread(new Runnable() {
 | 
			
		||||
 | 
			
		||||
			@Override
 | 
			
		||||
			public void run() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void run() {
 | 
			
		||||
 | 
			
		||||
				// wait for JobTriggerPoolHelper-init
 | 
			
		||||
				try {
 | 
			
		||||
					TimeUnit.MILLISECONDS.sleep(50);
 | 
			
		||||
				} catch (InterruptedException e) {
 | 
			
		||||
					if (!toStop) {
 | 
			
		||||
						logger.error(e.getMessage(), e);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
                // wait for JobTriggerPoolHelper-init
 | 
			
		||||
                try {
 | 
			
		||||
                    TimeUnit.MILLISECONDS.sleep(50);
 | 
			
		||||
                } catch (InterruptedException e) {
 | 
			
		||||
                    if (!toStop) {
 | 
			
		||||
                        logger.error(e.getMessage(), e);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
				// monitor
 | 
			
		||||
				while (!toStop) {
 | 
			
		||||
					try {
 | 
			
		||||
						// 任务结果丢失处理:调度记录停留在 "运行中" 状态超过10min,且对应执行器心跳注册失败不在线,则将本地调度主动标记失败;
 | 
			
		||||
						Date losedTime = DateUtil.addMinutes(new Date(), -10);
 | 
			
		||||
						List<Long> losedJobIds  = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().findLostJobIds(losedTime);
 | 
			
		||||
                // monitor
 | 
			
		||||
                while (!toStop) {
 | 
			
		||||
                    try {
 | 
			
		||||
                        // 任务结果丢失处理:调度记录停留在 "运行中" 状态超过10min,且对应执行器心跳注册失败不在线,则将本地调度主动标记失败;
 | 
			
		||||
                        Date losedTime = DateUtil.addMinutes(new Date(), -10);
 | 
			
		||||
                        List<Long> losedJobIds = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().findLostJobIds(losedTime);
 | 
			
		||||
 | 
			
		||||
						if (losedJobIds!=null && losedJobIds.size()>0) {
 | 
			
		||||
							for (Long logId: losedJobIds) {
 | 
			
		||||
                        if (losedJobIds != null && losedJobIds.size() > 0) {
 | 
			
		||||
                            for (Long logId : losedJobIds) {
 | 
			
		||||
 | 
			
		||||
								XxlJobLog jobLog = new XxlJobLog();
 | 
			
		||||
								jobLog.setId(logId);
 | 
			
		||||
                                XxlJobLog jobLog = new XxlJobLog();
 | 
			
		||||
                                jobLog.setId(logId);
 | 
			
		||||
 | 
			
		||||
								jobLog.setHandleTime(new Date());
 | 
			
		||||
								jobLog.setHandleCode(ReturnT.FAIL_CODE);
 | 
			
		||||
								jobLog.setHandleMsg( I18nUtil.getString("joblog_lost_fail") );
 | 
			
		||||
                                jobLog.setHandleTime(new Date());
 | 
			
		||||
                                jobLog.setHandleCode(ReturnT.FAIL_CODE);
 | 
			
		||||
                                jobLog.setHandleMsg(I18nUtil.getString("joblog_lost_fail"));
 | 
			
		||||
 | 
			
		||||
								XxlJobCompleter.updateHandleInfoAndFinish(jobLog);
 | 
			
		||||
							}
 | 
			
		||||
                                XxlJobCompleter.updateHandleInfoAndFinish(jobLog);
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
						}
 | 
			
		||||
					} catch (Exception e) {
 | 
			
		||||
						if (!toStop) {
 | 
			
		||||
							logger.error(">>>>>>>>>>> xxl-job, job fail monitor thread error:{}", e);
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
                        }
 | 
			
		||||
                    } catch (Exception e) {
 | 
			
		||||
                        if (!toStop) {
 | 
			
		||||
                            logger.error(">>>>>>>>>>> xxl-job, job fail monitor thread error:{}" , e);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    try {
 | 
			
		||||
                        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.setName("xxl-job, admin JobLosedMonitorHelper");
 | 
			
		||||
		monitorThread.start();
 | 
			
		||||
	}
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
        monitorThread.setDaemon(true);
 | 
			
		||||
        monitorThread.setName("xxl-job, admin JobLosedMonitorHelper");
 | 
			
		||||
        monitorThread.start();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void toStop(){
 | 
			
		||||
		toStop = true;
 | 
			
		||||
    public void toStop() {
 | 
			
		||||
        toStop = true;
 | 
			
		||||
 | 
			
		||||
		// stop registryOrRemoveThreadPool
 | 
			
		||||
		callbackThreadPool.shutdownNow();
 | 
			
		||||
        // stop registryOrRemoveThreadPool
 | 
			
		||||
        callbackThreadPool.shutdownNow();
 | 
			
		||||
 | 
			
		||||
		// stop monitorThread (interrupt and wait)
 | 
			
		||||
		monitorThread.interrupt();
 | 
			
		||||
		try {
 | 
			
		||||
			monitorThread.join();
 | 
			
		||||
		} catch (InterruptedException e) {
 | 
			
		||||
			logger.error(e.getMessage(), e);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
        // stop monitorThread (interrupt and wait)
 | 
			
		||||
        monitorThread.interrupt();
 | 
			
		||||
        try {
 | 
			
		||||
            monitorThread.join();
 | 
			
		||||
        } catch (InterruptedException 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() {
 | 
			
		||||
			@Override
 | 
			
		||||
			public void run() {
 | 
			
		||||
				for (HandleCallbackParam handleCallbackParam: callbackParamList) {
 | 
			
		||||
					ReturnT<String> callbackResult = callback(handleCallbackParam);
 | 
			
		||||
					logger.debug(">>>>>>>>> JobApiController.callback {}, handleCallbackParam={}, callbackResult={}",
 | 
			
		||||
							(callbackResult.getCode()== ReturnT.SUCCESS_CODE?"success":"fail"), handleCallbackParam, callbackResult);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
        callbackThreadPool.execute(new Runnable() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void run() {
 | 
			
		||||
                for (HandleCallbackParam handleCallbackParam : callbackParamList) {
 | 
			
		||||
                    ReturnT<String> callbackResult = callback(handleCallbackParam);
 | 
			
		||||
                    logger.debug(">>>>>>>>> JobApiController.callback {}, handleCallbackParam={}, callbackResult={}" ,
 | 
			
		||||
                        (callbackResult.getCode() == ReturnT.SUCCESS_CODE ? "success" : "fail"), handleCallbackParam, callbackResult);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
		return ReturnT.SUCCESS;
 | 
			
		||||
	}
 | 
			
		||||
        return ReturnT.SUCCESS;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	private ReturnT<String> callback(HandleCallbackParam handleCallbackParam) {
 | 
			
		||||
		// valid log item
 | 
			
		||||
		XxlJobLog log = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().load(handleCallbackParam.getLogId());
 | 
			
		||||
		if (log == null) {
 | 
			
		||||
			return new ReturnT<String>(ReturnT.FAIL_CODE, "log item not found.");
 | 
			
		||||
		}
 | 
			
		||||
		if (log.getHandleCode() > 0) {
 | 
			
		||||
			return new ReturnT<String>(ReturnT.FAIL_CODE, "log repeate callback.");     // avoid repeat callback, trigger child job etc
 | 
			
		||||
		}
 | 
			
		||||
    private ReturnT<String> callback(HandleCallbackParam handleCallbackParam) {
 | 
			
		||||
        // valid log item
 | 
			
		||||
        XxlJobLog log = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().load(handleCallbackParam.getLogId());
 | 
			
		||||
        if (log == null) {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL_CODE, "log item not found.");
 | 
			
		||||
        }
 | 
			
		||||
        if (log.getHandleCode() > 0) {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL_CODE, "log repeate callback.");     // avoid repeat callback, trigger child job etc
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		// handle msg
 | 
			
		||||
		StringBuffer handleMsg = new StringBuffer();
 | 
			
		||||
		if (log.getHandleMsg()!=null) {
 | 
			
		||||
			handleMsg.append(log.getHandleMsg()).append("<br>");
 | 
			
		||||
		}
 | 
			
		||||
		if (handleCallbackParam.getHandleMsg() != null) {
 | 
			
		||||
			handleMsg.append(handleCallbackParam.getHandleMsg());
 | 
			
		||||
		}
 | 
			
		||||
        // handle msg
 | 
			
		||||
        StringBuffer handleMsg = new StringBuffer();
 | 
			
		||||
        if (log.getHandleMsg() != null) {
 | 
			
		||||
            handleMsg.append(log.getHandleMsg()).append("<br>");
 | 
			
		||||
        }
 | 
			
		||||
        if (handleCallbackParam.getHandleMsg() != null) {
 | 
			
		||||
            handleMsg.append(handleCallbackParam.getHandleMsg());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		// success, save log
 | 
			
		||||
		log.setHandleTime(new Date());
 | 
			
		||||
		log.setHandleCode(handleCallbackParam.getHandleCode());
 | 
			
		||||
		log.setHandleMsg(handleMsg.toString());
 | 
			
		||||
		XxlJobCompleter.updateHandleInfoAndFinish(log);
 | 
			
		||||
 | 
			
		||||
		return ReturnT.SUCCESS;
 | 
			
		||||
	}
 | 
			
		||||
        // success, save log
 | 
			
		||||
        log.setHandleTime(new Date());
 | 
			
		||||
        log.setHandleCode(handleCallbackParam.getHandleCode());
 | 
			
		||||
        log.setHandleMsg(handleMsg.toString());
 | 
			
		||||
        XxlJobCompleter.updateHandleInfoAndFinish(log);
 | 
			
		||||
 | 
			
		||||
        return ReturnT.SUCCESS;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -17,65 +17,67 @@ import java.util.concurrent.TimeUnit;
 | 
			
		||||
 * @author xuxueli 2015-9-1 18:05:56
 | 
			
		||||
 */
 | 
			
		||||
public class JobFailMonitorHelper {
 | 
			
		||||
	private static Logger logger = LoggerFactory.getLogger(JobFailMonitorHelper.class);
 | 
			
		||||
	
 | 
			
		||||
	private static JobFailMonitorHelper instance = new JobFailMonitorHelper();
 | 
			
		||||
	public static JobFailMonitorHelper getInstance(){
 | 
			
		||||
		return instance;
 | 
			
		||||
	}
 | 
			
		||||
    private static Logger logger = LoggerFactory.getLogger(JobFailMonitorHelper.class);
 | 
			
		||||
 | 
			
		||||
	// ---------------------- monitor ----------------------
 | 
			
		||||
    private static JobFailMonitorHelper instance = new JobFailMonitorHelper();
 | 
			
		||||
 | 
			
		||||
	private Thread monitorThread;
 | 
			
		||||
	private volatile boolean toStop = false;
 | 
			
		||||
	public void start(){
 | 
			
		||||
		monitorThread = new Thread(new Runnable() {
 | 
			
		||||
    public static JobFailMonitorHelper getInstance() {
 | 
			
		||||
        return instance;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
			@Override
 | 
			
		||||
			public void run() {
 | 
			
		||||
    // ---------------------- monitor ----------------------
 | 
			
		||||
 | 
			
		||||
				// monitor
 | 
			
		||||
				while (!toStop) {
 | 
			
		||||
					try {
 | 
			
		||||
    private Thread monitorThread;
 | 
			
		||||
    private volatile boolean toStop = false;
 | 
			
		||||
 | 
			
		||||
						List<Long> failLogIds = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().findFailJobLogIds(1000);
 | 
			
		||||
						if (failLogIds!=null && !failLogIds.isEmpty()) {
 | 
			
		||||
							for (long failLogId: failLogIds) {
 | 
			
		||||
    public void start() {
 | 
			
		||||
        monitorThread = new Thread(new Runnable() {
 | 
			
		||||
 | 
			
		||||
								// lock log
 | 
			
		||||
								int lockRet = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().updateAlarmStatus(failLogId, 0, -1);
 | 
			
		||||
								if (lockRet < 1) {
 | 
			
		||||
									continue;
 | 
			
		||||
								}
 | 
			
		||||
								XxlJobLog log = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().load(failLogId);
 | 
			
		||||
								XxlJobInfo info = XxlJobAdminConfig.getAdminConfig().getXxlJobInfoDao().loadById(log.getJobId());
 | 
			
		||||
            @Override
 | 
			
		||||
            public void run() {
 | 
			
		||||
 | 
			
		||||
								// 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);
 | 
			
		||||
								}
 | 
			
		||||
                // monitor
 | 
			
		||||
                while (!toStop) {
 | 
			
		||||
                    try {
 | 
			
		||||
 | 
			
		||||
								// 2、fail alarm monitor
 | 
			
		||||
								int newAlarmStatus = 0;		// 告警状态:0-默认、-1=锁定状态、1-无需告警、2-告警成功、3-告警失败
 | 
			
		||||
								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;
 | 
			
		||||
								}
 | 
			
		||||
                        List<Long> failLogIds = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().findFailJobLogIds(1000);
 | 
			
		||||
                        if (failLogIds != null && !failLogIds.isEmpty()) {
 | 
			
		||||
                            for (long failLogId : failLogIds) {
 | 
			
		||||
 | 
			
		||||
								XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().updateAlarmStatus(failLogId, -1, newAlarmStatus);
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
                                // lock log
 | 
			
		||||
                                int lockRet = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().updateAlarmStatus(failLogId, 0, -1);
 | 
			
		||||
                                if (lockRet < 1) {
 | 
			
		||||
                                    continue;
 | 
			
		||||
                                }
 | 
			
		||||
                                XxlJobLog log = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().load(failLogId);
 | 
			
		||||
                                XxlJobInfo info = XxlJobAdminConfig.getAdminConfig().getXxlJobInfoDao().loadById(log.getJobId());
 | 
			
		||||
 | 
			
		||||
					} catch (Exception e) {
 | 
			
		||||
						if (!toStop) {
 | 
			
		||||
							logger.error(">>>>>>>>>>> xxl-job, job fail monitor thread error:{}", e);
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
                                // 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);
 | 
			
		||||
                                }
 | 
			
		||||
 | 
			
		||||
                                // 2、fail alarm monitor
 | 
			
		||||
                                int newAlarmStatus = 0;        // 告警状态:0-默认、-1=锁定状态、1-无需告警、2-告警成功、3-告警失败
 | 
			
		||||
                                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 {
 | 
			
		||||
                        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.setName("xxl-job, admin JobFailMonitorHelper");
 | 
			
		||||
		monitorThread.start();
 | 
			
		||||
	}
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
        monitorThread.setDaemon(true);
 | 
			
		||||
        monitorThread.setName("xxl-job, admin JobFailMonitorHelper");
 | 
			
		||||
        monitorThread.start();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void toStop(){
 | 
			
		||||
		toStop = true;
 | 
			
		||||
		// interrupt and wait
 | 
			
		||||
		monitorThread.interrupt();
 | 
			
		||||
		try {
 | 
			
		||||
			monitorThread.join();
 | 
			
		||||
		} catch (InterruptedException e) {
 | 
			
		||||
			logger.error(e.getMessage(), e);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
    public void toStop() {
 | 
			
		||||
        toStop = true;
 | 
			
		||||
        // interrupt and wait
 | 
			
		||||
        monitorThread.interrupt();
 | 
			
		||||
        try {
 | 
			
		||||
            monitorThread.join();
 | 
			
		||||
        } catch (InterruptedException e) {
 | 
			
		||||
            logger.error(e.getMessage(), e);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -15,190 +15,192 @@ import java.util.concurrent.*;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * job registry instance
 | 
			
		||||
 *
 | 
			
		||||
 * @author xuxueli 2016-10-02 19:10:24
 | 
			
		||||
 */
 | 
			
		||||
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();
 | 
			
		||||
	public static JobRegistryHelper getInstance(){
 | 
			
		||||
		return instance;
 | 
			
		||||
	}
 | 
			
		||||
    private static JobRegistryHelper instance = new JobRegistryHelper();
 | 
			
		||||
 | 
			
		||||
	private ThreadPoolExecutor registryOrRemoveThreadPool = null;
 | 
			
		||||
	private Thread registryMonitorThread;
 | 
			
		||||
	private volatile boolean toStop = false;
 | 
			
		||||
    public static JobRegistryHelper getInstance() {
 | 
			
		||||
        return instance;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void start(){
 | 
			
		||||
    private ThreadPoolExecutor registryOrRemoveThreadPool = null;
 | 
			
		||||
    private Thread registryMonitorThread;
 | 
			
		||||
    private volatile boolean toStop = false;
 | 
			
		||||
 | 
			
		||||
		// for registry or remove
 | 
			
		||||
		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).");
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
    public void start() {
 | 
			
		||||
 | 
			
		||||
		// for monitor
 | 
			
		||||
		registryMonitorThread = new Thread(new Runnable() {
 | 
			
		||||
			@Override
 | 
			
		||||
			public void run() {
 | 
			
		||||
				while (!toStop) {
 | 
			
		||||
					try {
 | 
			
		||||
						// auto registry group
 | 
			
		||||
						List<XxlJobGroup> groupList = XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().findByAddressType(0);
 | 
			
		||||
						if (groupList!=null && !groupList.isEmpty()) {
 | 
			
		||||
        // for registry or remove
 | 
			
		||||
        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).");
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
							// remove dead address (admin/executor)
 | 
			
		||||
							List<Integer> ids = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().findDead(RegistryConfig.DEAD_TIMEOUT, new Date());
 | 
			
		||||
							if (ids!=null && ids.size()>0) {
 | 
			
		||||
								XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().removeDead(ids);
 | 
			
		||||
							}
 | 
			
		||||
        // for monitor
 | 
			
		||||
        registryMonitorThread = new Thread(new Runnable() {
 | 
			
		||||
            @Override
 | 
			
		||||
            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)
 | 
			
		||||
							HashMap<String, List<String>> appAddressMap = new HashMap<String, List<String>>();
 | 
			
		||||
							List<XxlJobRegistry> list = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().findAll(RegistryConfig.DEAD_TIMEOUT, new Date());
 | 
			
		||||
							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>();
 | 
			
		||||
										}
 | 
			
		||||
                            // remove dead address (admin/executor)
 | 
			
		||||
                            List<Integer> ids = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().findDead(RegistryConfig.DEAD_TIMEOUT, new Date());
 | 
			
		||||
                            if (ids != null && ids.size() > 0) {
 | 
			
		||||
                                XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().removeDead(ids);
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
										if (!registryList.contains(item.getRegistryValue())) {
 | 
			
		||||
											registryList.add(item.getRegistryValue());
 | 
			
		||||
										}
 | 
			
		||||
										appAddressMap.put(appname, registryList);
 | 
			
		||||
									}
 | 
			
		||||
								}
 | 
			
		||||
							}
 | 
			
		||||
                            // fresh online address (admin/executor)
 | 
			
		||||
                            HashMap<String, List<String>> appAddressMap = new HashMap<String, List<String>>();
 | 
			
		||||
                            List<XxlJobRegistry> list = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().findAll(RegistryConfig.DEAD_TIMEOUT, new Date());
 | 
			
		||||
                            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
 | 
			
		||||
							for (XxlJobGroup group: groupList) {
 | 
			
		||||
								List<String> registryList = appAddressMap.get(group.getAppname());
 | 
			
		||||
								String addressListStr = null;
 | 
			
		||||
								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());
 | 
			
		||||
                                        if (!registryList.contains(item.getRegistryValue())) {
 | 
			
		||||
                                            registryList.add(item.getRegistryValue());
 | 
			
		||||
                                        }
 | 
			
		||||
                                        appAddressMap.put(appname, registryList);
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
								XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().update(group);
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					} 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();
 | 
			
		||||
	}
 | 
			
		||||
                            // fresh group address
 | 
			
		||||
                            for (XxlJobGroup group : groupList) {
 | 
			
		||||
                                List<String> registryList = appAddressMap.get(group.getAppname());
 | 
			
		||||
                                String addressListStr = null;
 | 
			
		||||
                                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());
 | 
			
		||||
 | 
			
		||||
	public void toStop(){
 | 
			
		||||
		toStop = true;
 | 
			
		||||
                                XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().update(group);
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    } 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
 | 
			
		||||
		registryOrRemoveThreadPool.shutdownNow();
 | 
			
		||||
    public void toStop() {
 | 
			
		||||
        toStop = true;
 | 
			
		||||
 | 
			
		||||
		// stop monitir (interrupt and wait)
 | 
			
		||||
		registryMonitorThread.interrupt();
 | 
			
		||||
		try {
 | 
			
		||||
			registryMonitorThread.join();
 | 
			
		||||
		} catch (InterruptedException e) {
 | 
			
		||||
			logger.error(e.getMessage(), e);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
        // stop registryOrRemoveThreadPool
 | 
			
		||||
        registryOrRemoveThreadPool.shutdownNow();
 | 
			
		||||
 | 
			
		||||
        // stop monitir (interrupt and wait)
 | 
			
		||||
        registryMonitorThread.interrupt();
 | 
			
		||||
        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
 | 
			
		||||
		if (!StringUtils.hasText(registryParam.getRegistryGroup())
 | 
			
		||||
				|| !StringUtils.hasText(registryParam.getRegistryKey())
 | 
			
		||||
				|| !StringUtils.hasText(registryParam.getRegistryValue())) {
 | 
			
		||||
			return new ReturnT<String>(ReturnT.FAIL_CODE, "Illegal Argument.");
 | 
			
		||||
		}
 | 
			
		||||
        // valid
 | 
			
		||||
        if (!StringUtils.hasText(registryParam.getRegistryGroup())
 | 
			
		||||
            || !StringUtils.hasText(registryParam.getRegistryKey())
 | 
			
		||||
            || !StringUtils.hasText(registryParam.getRegistryValue())) {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL_CODE, "Illegal Argument.");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		// async execute
 | 
			
		||||
		registryOrRemoveThreadPool.execute(new Runnable() {
 | 
			
		||||
			@Override
 | 
			
		||||
			public void run() {
 | 
			
		||||
				int ret = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().registryUpdate(registryParam.getRegistryGroup(), registryParam.getRegistryKey(), registryParam.getRegistryValue(), new Date());
 | 
			
		||||
				if (ret < 1) {
 | 
			
		||||
					XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().registrySave(registryParam.getRegistryGroup(), registryParam.getRegistryKey(), registryParam.getRegistryValue(), new Date());
 | 
			
		||||
        // async execute
 | 
			
		||||
        registryOrRemoveThreadPool.execute(new Runnable() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void run() {
 | 
			
		||||
                int ret = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().registryUpdate(registryParam.getRegistryGroup(), registryParam.getRegistryKey(), registryParam.getRegistryValue(), new Date());
 | 
			
		||||
                if (ret < 1) {
 | 
			
		||||
                    XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().registrySave(registryParam.getRegistryGroup(), registryParam.getRegistryKey(), registryParam.getRegistryValue(), new Date());
 | 
			
		||||
 | 
			
		||||
					// fresh
 | 
			
		||||
					freshGroupRegistryInfo(registryParam);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
                    // fresh
 | 
			
		||||
                    freshGroupRegistryInfo(registryParam);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
		return ReturnT.SUCCESS;
 | 
			
		||||
	}
 | 
			
		||||
        return ReturnT.SUCCESS;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public ReturnT<String> registryRemove(RegistryParam registryParam) {
 | 
			
		||||
    public ReturnT<String> registryRemove(RegistryParam registryParam) {
 | 
			
		||||
 | 
			
		||||
		// valid
 | 
			
		||||
		if (!StringUtils.hasText(registryParam.getRegistryGroup())
 | 
			
		||||
				|| !StringUtils.hasText(registryParam.getRegistryKey())
 | 
			
		||||
				|| !StringUtils.hasText(registryParam.getRegistryValue())) {
 | 
			
		||||
			return new ReturnT<String>(ReturnT.FAIL_CODE, "Illegal Argument.");
 | 
			
		||||
		}
 | 
			
		||||
        // valid
 | 
			
		||||
        if (!StringUtils.hasText(registryParam.getRegistryGroup())
 | 
			
		||||
            || !StringUtils.hasText(registryParam.getRegistryKey())
 | 
			
		||||
            || !StringUtils.hasText(registryParam.getRegistryValue())) {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL_CODE, "Illegal Argument.");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		// async execute
 | 
			
		||||
		registryOrRemoveThreadPool.execute(new Runnable() {
 | 
			
		||||
			@Override
 | 
			
		||||
			public void run() {
 | 
			
		||||
				int ret = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().registryDelete(registryParam.getRegistryGroup(), registryParam.getRegistryKey(), registryParam.getRegistryValue());
 | 
			
		||||
				if (ret > 0) {
 | 
			
		||||
					// fresh
 | 
			
		||||
					freshGroupRegistryInfo(registryParam);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
        // async execute
 | 
			
		||||
        registryOrRemoveThreadPool.execute(new Runnable() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void run() {
 | 
			
		||||
                int ret = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().registryDelete(registryParam.getRegistryGroup(), registryParam.getRegistryKey(), registryParam.getRegistryValue());
 | 
			
		||||
                if (ret > 0) {
 | 
			
		||||
                    // fresh
 | 
			
		||||
                    freshGroupRegistryInfo(registryParam);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
		return ReturnT.SUCCESS;
 | 
			
		||||
	}
 | 
			
		||||
        return ReturnT.SUCCESS;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	private void freshGroupRegistryInfo(RegistryParam registryParam){
 | 
			
		||||
		// Under consideration, prevent affecting core tables
 | 
			
		||||
	}
 | 
			
		||||
    private void freshGroupRegistryInfo(RegistryParam registryParam) {
 | 
			
		||||
        // Under consideration, prevent affecting core tables
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -24,32 +24,32 @@ public class JobTriggerPoolHelper {
 | 
			
		||||
    private ThreadPoolExecutor fastTriggerPool = null;
 | 
			
		||||
    private ThreadPoolExecutor slowTriggerPool = null;
 | 
			
		||||
 | 
			
		||||
    public void start(){
 | 
			
		||||
    public void start() {
 | 
			
		||||
        fastTriggerPool = new ThreadPoolExecutor(
 | 
			
		||||
                10,
 | 
			
		||||
                XxlJobAdminConfig.getAdminConfig().getTriggerPoolFastMax(),
 | 
			
		||||
                60L,
 | 
			
		||||
                TimeUnit.SECONDS,
 | 
			
		||||
                new LinkedBlockingQueue<Runnable>(1000),
 | 
			
		||||
                new ThreadFactory() {
 | 
			
		||||
                    @Override
 | 
			
		||||
                    public Thread newThread(Runnable r) {
 | 
			
		||||
                        return new Thread(r, "xxl-job, admin JobTriggerPoolHelper-fastTriggerPool-" + r.hashCode());
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
            10,
 | 
			
		||||
            XxlJobAdminConfig.getAdminConfig().getTriggerPoolFastMax(),
 | 
			
		||||
            60L,
 | 
			
		||||
            TimeUnit.SECONDS,
 | 
			
		||||
            new LinkedBlockingQueue<Runnable>(1000),
 | 
			
		||||
            new ThreadFactory() {
 | 
			
		||||
                @Override
 | 
			
		||||
                public Thread newThread(Runnable r) {
 | 
			
		||||
                    return new Thread(r, "xxl-job, admin JobTriggerPoolHelper-fastTriggerPool-" + r.hashCode());
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
        slowTriggerPool = new ThreadPoolExecutor(
 | 
			
		||||
                10,
 | 
			
		||||
                XxlJobAdminConfig.getAdminConfig().getTriggerPoolSlowMax(),
 | 
			
		||||
                60L,
 | 
			
		||||
                TimeUnit.SECONDS,
 | 
			
		||||
                new LinkedBlockingQueue<Runnable>(2000),
 | 
			
		||||
                new ThreadFactory() {
 | 
			
		||||
                    @Override
 | 
			
		||||
                    public Thread newThread(Runnable r) {
 | 
			
		||||
                        return new Thread(r, "xxl-job, admin JobTriggerPoolHelper-slowTriggerPool-" + r.hashCode());
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
            10,
 | 
			
		||||
            XxlJobAdminConfig.getAdminConfig().getTriggerPoolSlowMax(),
 | 
			
		||||
            60L,
 | 
			
		||||
            TimeUnit.SECONDS,
 | 
			
		||||
            new LinkedBlockingQueue<Runnable>(2000),
 | 
			
		||||
            new ThreadFactory() {
 | 
			
		||||
                @Override
 | 
			
		||||
                public Thread newThread(Runnable r) {
 | 
			
		||||
                    return new Thread(r, "xxl-job, admin JobTriggerPoolHelper-slowTriggerPool-" + r.hashCode());
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -62,7 +62,7 @@ public class JobTriggerPoolHelper {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // 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<>();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -79,7 +79,7 @@ public class JobTriggerPoolHelper {
 | 
			
		||||
        // choose thread pool
 | 
			
		||||
        ThreadPoolExecutor triggerPool_ = fastTriggerPool;
 | 
			
		||||
        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;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -98,14 +98,14 @@ public class JobTriggerPoolHelper {
 | 
			
		||||
                } finally {
 | 
			
		||||
 | 
			
		||||
                    // check timeout-count-map
 | 
			
		||||
                    long minTim_now = System.currentTimeMillis()/60000;
 | 
			
		||||
                    long minTim_now = System.currentTimeMillis() / 60000;
 | 
			
		||||
                    if (minTim != minTim_now) {
 | 
			
		||||
                        minTim = minTim_now;
 | 
			
		||||
                        jobTimeoutCountMap.clear();
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    // incr timeout-count-map
 | 
			
		||||
                    long cost = System.currentTimeMillis()-start;
 | 
			
		||||
                    long cost = System.currentTimeMillis() - start;
 | 
			
		||||
                    if (cost > 500) {       // ob-timeout threshold 500ms
 | 
			
		||||
                        AtomicInteger timeoutCount = jobTimeoutCountMap.putIfAbsent(jobId, new AtomicInteger(1));
 | 
			
		||||
                        if (timeoutCount != null) {
 | 
			
		||||
@@ -120,7 +120,6 @@ public class JobTriggerPoolHelper {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // ---------------------- helper ----------------------
 | 
			
		||||
 | 
			
		||||
    private static JobTriggerPoolHelper helper = new JobTriggerPoolHelper();
 | 
			
		||||
@@ -128,6 +127,7 @@ public class JobTriggerPoolHelper {
 | 
			
		||||
    public static void toStart() {
 | 
			
		||||
        helper.start();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void toStop() {
 | 
			
		||||
        helper.stop();
 | 
			
		||||
    }
 | 
			
		||||
@@ -135,13 +135,11 @@ public class JobTriggerPoolHelper {
 | 
			
		||||
    /**
 | 
			
		||||
     * @param jobId
 | 
			
		||||
     * @param triggerType
 | 
			
		||||
     * @param failRetryCount
 | 
			
		||||
     * 			>=0: use this param
 | 
			
		||||
     * 			<0: use param from job info config
 | 
			
		||||
     * @param failRetryCount        >=0: use this param
 | 
			
		||||
     *                              <0: use param from job info config
 | 
			
		||||
     * @param executorShardingParam
 | 
			
		||||
     * @param executorParam
 | 
			
		||||
     *          null: use job param
 | 
			
		||||
     *          not null: cover job param
 | 
			
		||||
     * @param executorParam         null: use job param
 | 
			
		||||
     *                              not null: cover job param
 | 
			
		||||
     */
 | 
			
		||||
    public static void trigger(int jobId, TriggerTypeEnum triggerType, int failRetryCount, String executorShardingParam, String executorParam, String addressList) {
 | 
			
		||||
        helper.addTrigger(jobId, triggerType, failRetryCount, executorShardingParam, executorParam, addressList);
 | 
			
		||||
 
 | 
			
		||||
@@ -11,88 +11,88 @@ import javax.servlet.http.HttpServletResponse;
 | 
			
		||||
 */
 | 
			
		||||
public class CookieUtil {
 | 
			
		||||
 | 
			
		||||
	// 默认缓存时间,单位/秒, 2H
 | 
			
		||||
	private static final int COOKIE_MAX_AGE = Integer.MAX_VALUE;
 | 
			
		||||
	// 保存路径,根路径
 | 
			
		||||
	private static final String COOKIE_PATH = "/";
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * 保存
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param response
 | 
			
		||||
	 * @param key
 | 
			
		||||
	 * @param value
 | 
			
		||||
	 * @param ifRemember 
 | 
			
		||||
	 */
 | 
			
		||||
	public static void set(HttpServletResponse response, String key, String value, boolean ifRemember) {
 | 
			
		||||
		int age = ifRemember?COOKIE_MAX_AGE:-1;
 | 
			
		||||
		set(response, key, value, null, COOKIE_PATH, age, true);
 | 
			
		||||
	}
 | 
			
		||||
    // 默认缓存时间,单位/秒, 2H
 | 
			
		||||
    private static final int COOKIE_MAX_AGE = Integer.MAX_VALUE;
 | 
			
		||||
    // 保存路径,根路径
 | 
			
		||||
    private static final String COOKIE_PATH = "/";
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 保存
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param response
 | 
			
		||||
	 * @param key
 | 
			
		||||
	 * @param value
 | 
			
		||||
	 * @param maxAge
 | 
			
		||||
	 */
 | 
			
		||||
	private static void set(HttpServletResponse response, String key, String value, String domain, String path, int maxAge, boolean isHttpOnly) {
 | 
			
		||||
		Cookie cookie = new Cookie(key, value);
 | 
			
		||||
		if (domain != null) {
 | 
			
		||||
			cookie.setDomain(domain);
 | 
			
		||||
		}
 | 
			
		||||
		cookie.setPath(path);
 | 
			
		||||
		cookie.setMaxAge(maxAge);
 | 
			
		||||
		cookie.setHttpOnly(isHttpOnly);
 | 
			
		||||
		response.addCookie(cookie);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * 查询value
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param request
 | 
			
		||||
	 * @param key
 | 
			
		||||
	 * @return
 | 
			
		||||
	 */
 | 
			
		||||
	public static String getValue(HttpServletRequest request, String key) {
 | 
			
		||||
		Cookie cookie = get(request, key);
 | 
			
		||||
		if (cookie != null) {
 | 
			
		||||
			return cookie.getValue();
 | 
			
		||||
		}
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
    /**
 | 
			
		||||
     * 保存
 | 
			
		||||
     *
 | 
			
		||||
     * @param response
 | 
			
		||||
     * @param key
 | 
			
		||||
     * @param value
 | 
			
		||||
     * @param ifRemember
 | 
			
		||||
     */
 | 
			
		||||
    public static void set(HttpServletResponse response, String key, String value, boolean ifRemember) {
 | 
			
		||||
        int age = ifRemember ? COOKIE_MAX_AGE : -1;
 | 
			
		||||
        set(response, key, value, null, COOKIE_PATH, age, true);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 查询Cookie
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param request
 | 
			
		||||
	 * @param key
 | 
			
		||||
	 */
 | 
			
		||||
	private static Cookie get(HttpServletRequest request, String key) {
 | 
			
		||||
		Cookie[] arr_cookie = request.getCookies();
 | 
			
		||||
		if (arr_cookie != null && arr_cookie.length > 0) {
 | 
			
		||||
			for (Cookie cookie : arr_cookie) {
 | 
			
		||||
				if (cookie.getName().equals(key)) {
 | 
			
		||||
					return cookie;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * 删除Cookie
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param request
 | 
			
		||||
	 * @param response
 | 
			
		||||
	 * @param key
 | 
			
		||||
	 */
 | 
			
		||||
	public static void remove(HttpServletRequest request, HttpServletResponse response, String key) {
 | 
			
		||||
		Cookie cookie = get(request, key);
 | 
			
		||||
		if (cookie != null) {
 | 
			
		||||
			set(response, key, "", null, COOKIE_PATH, 0, true);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
    /**
 | 
			
		||||
     * 保存
 | 
			
		||||
     *
 | 
			
		||||
     * @param response
 | 
			
		||||
     * @param key
 | 
			
		||||
     * @param value
 | 
			
		||||
     * @param maxAge
 | 
			
		||||
     */
 | 
			
		||||
    private static void set(HttpServletResponse response, String key, String value, String domain, String path, int maxAge, boolean isHttpOnly) {
 | 
			
		||||
        Cookie cookie = new Cookie(key, value);
 | 
			
		||||
        if (domain != null) {
 | 
			
		||||
            cookie.setDomain(domain);
 | 
			
		||||
        }
 | 
			
		||||
        cookie.setPath(path);
 | 
			
		||||
        cookie.setMaxAge(maxAge);
 | 
			
		||||
        cookie.setHttpOnly(isHttpOnly);
 | 
			
		||||
        response.addCookie(cookie);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询value
 | 
			
		||||
     *
 | 
			
		||||
     * @param request
 | 
			
		||||
     * @param key
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public static String getValue(HttpServletRequest request, String key) {
 | 
			
		||||
        Cookie cookie = get(request, key);
 | 
			
		||||
        if (cookie != null) {
 | 
			
		||||
            return cookie.getValue();
 | 
			
		||||
        }
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询Cookie
 | 
			
		||||
     *
 | 
			
		||||
     * @param request
 | 
			
		||||
     * @param key
 | 
			
		||||
     */
 | 
			
		||||
    private static Cookie get(HttpServletRequest request, String key) {
 | 
			
		||||
        Cookie[] arr_cookie = request.getCookies();
 | 
			
		||||
        if (arr_cookie != null && arr_cookie.length > 0) {
 | 
			
		||||
            for (Cookie cookie : arr_cookie) {
 | 
			
		||||
                if (cookie.getName().equals(key)) {
 | 
			
		||||
                    return cookie;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 删除Cookie
 | 
			
		||||
     *
 | 
			
		||||
     * @param request
 | 
			
		||||
     * @param response
 | 
			
		||||
     * @param key
 | 
			
		||||
     */
 | 
			
		||||
    public static void remove(HttpServletRequest request, HttpServletResponse response, String key) {
 | 
			
		||||
        Cookie cookie = get(request, key);
 | 
			
		||||
        if (cookie != null) {
 | 
			
		||||
            set(response, key, "" , null, COOKIE_PATH, 0, true);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -12,81 +12,82 @@ import java.io.IOException;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Jackson util
 | 
			
		||||
 * 
 | 
			
		||||
 * <p>
 | 
			
		||||
 * 1、obj need private and set/get;
 | 
			
		||||
 * 2、do not support inner class;
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * @author xuxueli 2015-9-25 18:02:56
 | 
			
		||||
 */
 | 
			
		||||
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();
 | 
			
		||||
 | 
			
		||||
    public static ObjectMapper getInstance() {
 | 
			
		||||
        return objectMapper;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * bean、array、List、Map --> json
 | 
			
		||||
     * 
 | 
			
		||||
     *
 | 
			
		||||
     * @param obj
 | 
			
		||||
     * @return json string
 | 
			
		||||
     * @throws Exception
 | 
			
		||||
     */
 | 
			
		||||
    public static String writeValueAsString(Object obj) {
 | 
			
		||||
    	try {
 | 
			
		||||
			return getInstance().writeValueAsString(obj);
 | 
			
		||||
		} catch (JsonGenerationException e) {
 | 
			
		||||
			logger.error(e.getMessage(), e);
 | 
			
		||||
		} catch (JsonMappingException e) {
 | 
			
		||||
			logger.error(e.getMessage(), e);
 | 
			
		||||
		} catch (IOException e) {
 | 
			
		||||
			logger.error(e.getMessage(), e);
 | 
			
		||||
		}
 | 
			
		||||
        try {
 | 
			
		||||
            return getInstance().writeValueAsString(obj);
 | 
			
		||||
        } catch (JsonGenerationException e) {
 | 
			
		||||
            logger.error(e.getMessage(), e);
 | 
			
		||||
        } catch (JsonMappingException e) {
 | 
			
		||||
            logger.error(e.getMessage(), e);
 | 
			
		||||
        } catch (IOException e) {
 | 
			
		||||
            logger.error(e.getMessage(), e);
 | 
			
		||||
        }
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * string --> bean、Map、List(array)
 | 
			
		||||
     * 
 | 
			
		||||
     *
 | 
			
		||||
     * @param jsonStr
 | 
			
		||||
     * @param clazz
 | 
			
		||||
     * @return obj
 | 
			
		||||
     * @throws Exception
 | 
			
		||||
     */
 | 
			
		||||
    public static <T> T readValue(String jsonStr, Class<T> clazz) {
 | 
			
		||||
    	try {
 | 
			
		||||
			return getInstance().readValue(jsonStr, clazz);
 | 
			
		||||
		} catch (JsonParseException e) {
 | 
			
		||||
			logger.error(e.getMessage(), e);
 | 
			
		||||
		} catch (JsonMappingException e) {
 | 
			
		||||
			logger.error(e.getMessage(), e);
 | 
			
		||||
		} catch (IOException e) {
 | 
			
		||||
			logger.error(e.getMessage(), e);
 | 
			
		||||
		}
 | 
			
		||||
    	return null;
 | 
			
		||||
        try {
 | 
			
		||||
            return getInstance().readValue(jsonStr, clazz);
 | 
			
		||||
        } catch (JsonParseException e) {
 | 
			
		||||
            logger.error(e.getMessage(), e);
 | 
			
		||||
        } catch (JsonMappingException e) {
 | 
			
		||||
            logger.error(e.getMessage(), e);
 | 
			
		||||
        } catch (IOException e) {
 | 
			
		||||
            logger.error(e.getMessage(), e);
 | 
			
		||||
        }
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * string --> List<Bean>...
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param jsonStr
 | 
			
		||||
	 * @param parametrized
 | 
			
		||||
	 * @param parameterClasses
 | 
			
		||||
	 * @param <T>
 | 
			
		||||
	 * @return
 | 
			
		||||
	 */
 | 
			
		||||
	public static <T> T readValue(String jsonStr, Class<?> parametrized, Class<?>... parameterClasses) {
 | 
			
		||||
		try {
 | 
			
		||||
			JavaType javaType = getInstance().getTypeFactory().constructParametricType(parametrized, parameterClasses);
 | 
			
		||||
			return getInstance().readValue(jsonStr, javaType);
 | 
			
		||||
		} catch (JsonParseException e) {
 | 
			
		||||
			logger.error(e.getMessage(), e);
 | 
			
		||||
		} catch (JsonMappingException e) {
 | 
			
		||||
			logger.error(e.getMessage(), e);
 | 
			
		||||
		} catch (IOException e) {
 | 
			
		||||
			logger.error(e.getMessage(), e);
 | 
			
		||||
		}
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
    /**
 | 
			
		||||
     * string --> List<Bean>...
 | 
			
		||||
     *
 | 
			
		||||
     * @param jsonStr
 | 
			
		||||
     * @param parametrized
 | 
			
		||||
     * @param parameterClasses
 | 
			
		||||
     * @param <T>
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public static <T> T readValue(String jsonStr, Class<?> parametrized, Class<?>... parameterClasses) {
 | 
			
		||||
        try {
 | 
			
		||||
            JavaType javaType = getInstance().getTypeFactory().constructParametricType(parametrized, parameterClasses);
 | 
			
		||||
            return getInstance().readValue(jsonStr, javaType);
 | 
			
		||||
        } catch (JsonParseException e) {
 | 
			
		||||
            logger.error(e.getMessage(), e);
 | 
			
		||||
        } catch (JsonMappingException e) {
 | 
			
		||||
            logger.error(e.getMessage(), e);
 | 
			
		||||
        } catch (IOException e) {
 | 
			
		||||
            logger.error(e.getMessage(), e);
 | 
			
		||||
        }
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -9,41 +9,43 @@ import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * job info
 | 
			
		||||
 *
 | 
			
		||||
 * @author xuxueli 2016-1-12 18:03:45
 | 
			
		||||
 */
 | 
			
		||||
@Mapper
 | 
			
		||||
public interface XxlJobInfoDao {
 | 
			
		||||
 | 
			
		||||
	public List<XxlJobInfo> pageList(@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 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 List<XxlJobInfo> pageList(@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 update(XxlJobInfo xxlJobInfo);
 | 
			
		||||
	
 | 
			
		||||
	public int delete(@Param("id") long id);
 | 
			
		||||
    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 List<XxlJobInfo> getJobsByGroup(@Param("jobGroup") int jobGroup);
 | 
			
		||||
    public int save(XxlJobInfo info);
 | 
			
		||||
 | 
			
		||||
	public int findAllCount();
 | 
			
		||||
    public XxlJobInfo loadById(@Param("id") int id);
 | 
			
		||||
 | 
			
		||||
	public List<XxlJobInfo> scheduleJobQuery(@Param("maxNextTime") long maxNextTime, @Param("pagesize") int pagesize );
 | 
			
		||||
    public int update(XxlJobInfo xxlJobInfo);
 | 
			
		||||
 | 
			
		||||
	public int scheduleUpdate(XxlJobInfo xxlJobInfo);
 | 
			
		||||
    public int delete(@Param("id") long id);
 | 
			
		||||
 | 
			
		||||
    public List<XxlJobInfo> getJobsByGroup(@Param("jobGroup") int jobGroup);
 | 
			
		||||
 | 
			
		||||
    public int findAllCount();
 | 
			
		||||
 | 
			
		||||
    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
 | 
			
		||||
 *
 | 
			
		||||
 * @author xuxueli 2016-1-12 18:03:06
 | 
			
		||||
 */
 | 
			
		||||
@Mapper
 | 
			
		||||
public interface XxlJobLogDao {
 | 
			
		||||
 | 
			
		||||
	// exist jobId not use jobGroup, not exist use jobGroup
 | 
			
		||||
	public List<XxlJobLog> pageList(@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 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);
 | 
			
		||||
    // exist jobId not use jobGroup, not exist use jobGroup
 | 
			
		||||
    public List<XxlJobLog> pageList(@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 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 int updateTriggerInfo(XxlJobLog xxlJobLog);
 | 
			
		||||
    public XxlJobLog load(@Param("id") long id);
 | 
			
		||||
 | 
			
		||||
	public int updateHandleInfo(XxlJobLog xxlJobLog);
 | 
			
		||||
	
 | 
			
		||||
	public int delete(@Param("jobId") int jobId);
 | 
			
		||||
    public long save(XxlJobLog xxlJobLog);
 | 
			
		||||
 | 
			
		||||
	public Map<String, Object> findLogReport(@Param("from") Date from,
 | 
			
		||||
											 @Param("to") Date to);
 | 
			
		||||
    public int updateTriggerInfo(XxlJobLog xxlJobLog);
 | 
			
		||||
 | 
			
		||||
	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 clearLog(@Param("logIds") List<Long> logIds);
 | 
			
		||||
    public int updateHandleInfo(XxlJobLog xxlJobLog);
 | 
			
		||||
 | 
			
		||||
	public List<Long> findFailJobLogIds(@Param("pagesize") int pagesize);
 | 
			
		||||
    public int delete(@Param("jobId") int jobId);
 | 
			
		||||
 | 
			
		||||
	public int updateAlarmStatus(@Param("logId") long logId,
 | 
			
		||||
								 @Param("oldAlarmStatus") int oldAlarmStatus,
 | 
			
		||||
								 @Param("newAlarmStatus") int newAlarmStatus);
 | 
			
		||||
    public Map<String, Object> findLogReport(@Param("from") Date from,
 | 
			
		||||
                                             @Param("to") Date to);
 | 
			
		||||
 | 
			
		||||
	public List<Long> findLostJobIds(@Param("losedTime") Date losedTime);
 | 
			
		||||
    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 clearLog(@Param("logIds") List<Long> logIds);
 | 
			
		||||
 | 
			
		||||
    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
 | 
			
		||||
 *
 | 
			
		||||
 * @author xuxueli 2016-5-19 18:04:56
 | 
			
		||||
 */
 | 
			
		||||
@Mapper
 | 
			
		||||
public interface XxlJobLogGlueDao {
 | 
			
		||||
	
 | 
			
		||||
	public int save(XxlJobLogGlue xxlJobLogGlue);
 | 
			
		||||
	
 | 
			
		||||
	public List<XxlJobLogGlue> findByJobId(@Param("jobId") int jobId);
 | 
			
		||||
 | 
			
		||||
	public int removeOld(@Param("jobId") int jobId, @Param("limit") int limit);
 | 
			
		||||
    public int save(XxlJobLogGlue xxlJobLogGlue);
 | 
			
		||||
 | 
			
		||||
    public List<XxlJobLogGlue> findByJobId(@Param("jobId") int jobId);
 | 
			
		||||
 | 
			
		||||
    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
 | 
			
		||||
 *
 | 
			
		||||
 * @author xuxueli 2019-11-22
 | 
			
		||||
 */
 | 
			
		||||
@Mapper
 | 
			
		||||
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,
 | 
			
		||||
												@Param("triggerDayTo") Date triggerDayTo);
 | 
			
		||||
    public List<XxlJobLogReport> queryLogReport(@Param("triggerDayFrom") Date triggerDayFrom,
 | 
			
		||||
                                                @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 org.apache.ibatis.annotations.Mapper;
 | 
			
		||||
import org.apache.ibatis.annotations.Param;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -11,21 +12,22 @@ import java.util.List;
 | 
			
		||||
@Mapper
 | 
			
		||||
public interface XxlJobUserDao {
 | 
			
		||||
 | 
			
		||||
	public List<XxlJobUser> pageList(@Param("offset") int offset,
 | 
			
		||||
    public List<XxlJobUser> pageList(@Param("offset") int offset,
 | 
			
		||||
                                     @Param("pagesize") int pagesize,
 | 
			
		||||
                                     @Param("username") String username,
 | 
			
		||||
									 @Param("role") int role);
 | 
			
		||||
	public int pageListCount(@Param("offset") int offset,
 | 
			
		||||
							 @Param("pagesize") int pagesize,
 | 
			
		||||
							 @Param("username") String username,
 | 
			
		||||
							 @Param("role") int role);
 | 
			
		||||
                                     @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 delete(@Param("id") int id);
 | 
			
		||||
    public int save(XxlJobUser xxlJobUser);
 | 
			
		||||
 | 
			
		||||
    public int update(XxlJobUser xxlJobUser);
 | 
			
		||||
 | 
			
		||||
    public int delete(@Param("id") int id);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -9,78 +9,79 @@ import java.util.Map;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * core job action for xxl-job
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * @author xuxueli 2016-5-28 15:30:33
 | 
			
		||||
 */
 | 
			
		||||
public interface XxlJobService {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * page list
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param start
 | 
			
		||||
	 * @param length
 | 
			
		||||
	 * @param jobGroup
 | 
			
		||||
	 * @param jobDesc
 | 
			
		||||
	 * @param executorHandler
 | 
			
		||||
	 * @param author
 | 
			
		||||
	 * @return
 | 
			
		||||
	 */
 | 
			
		||||
	public Map<String, Object> pageList(int start, int length, int jobGroup, int triggerStatus, String jobDesc, String executorHandler, String author);
 | 
			
		||||
    /**
 | 
			
		||||
     * page list
 | 
			
		||||
     *
 | 
			
		||||
     * @param start
 | 
			
		||||
     * @param length
 | 
			
		||||
     * @param jobGroup
 | 
			
		||||
     * @param jobDesc
 | 
			
		||||
     * @param executorHandler
 | 
			
		||||
     * @param author
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public Map<String, Object> pageList(int start, int length, int jobGroup, int triggerStatus, String jobDesc, String executorHandler, String author);
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * add job
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param jobInfo
 | 
			
		||||
	 * @return
 | 
			
		||||
	 */
 | 
			
		||||
	public ReturnT<String> add(XxlJobInfo jobInfo);
 | 
			
		||||
    /**
 | 
			
		||||
     * add job
 | 
			
		||||
     *
 | 
			
		||||
     * @param jobInfo
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public ReturnT<String> add(XxlJobInfo jobInfo);
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * update job
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param jobInfo
 | 
			
		||||
	 * @return
 | 
			
		||||
	 */
 | 
			
		||||
	public ReturnT<String> update(XxlJobInfo jobInfo);
 | 
			
		||||
    /**
 | 
			
		||||
     * update job
 | 
			
		||||
     *
 | 
			
		||||
     * @param jobInfo
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public ReturnT<String> update(XxlJobInfo jobInfo);
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * remove job
 | 
			
		||||
	 * 	 *
 | 
			
		||||
	 * @param id
 | 
			
		||||
	 * @return
 | 
			
		||||
	 */
 | 
			
		||||
	public ReturnT<String> remove(int id);
 | 
			
		||||
    /**
 | 
			
		||||
     * remove job
 | 
			
		||||
     * *
 | 
			
		||||
     *
 | 
			
		||||
     * @param id
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public ReturnT<String> remove(int id);
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * start job
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param id
 | 
			
		||||
	 * @return
 | 
			
		||||
	 */
 | 
			
		||||
	public ReturnT<String> start(int id);
 | 
			
		||||
    /**
 | 
			
		||||
     * start job
 | 
			
		||||
     *
 | 
			
		||||
     * @param id
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public ReturnT<String> start(int id);
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * stop job
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param id
 | 
			
		||||
	 * @return
 | 
			
		||||
	 */
 | 
			
		||||
	public ReturnT<String> stop(int id);
 | 
			
		||||
    /**
 | 
			
		||||
     * stop job
 | 
			
		||||
     *
 | 
			
		||||
     * @param id
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public ReturnT<String> stop(int id);
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * dashboard info
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return
 | 
			
		||||
	 */
 | 
			
		||||
	public Map<String,Object> dashboardInfo();
 | 
			
		||||
    /**
 | 
			
		||||
     * dashboard info
 | 
			
		||||
     *
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public Map<String, Object> dashboardInfo();
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * chart info
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param startDate
 | 
			
		||||
	 * @param endDate
 | 
			
		||||
	 * @return
 | 
			
		||||
	 */
 | 
			
		||||
	public ReturnT<Map<String,Object>> chartInfo(Date startDate, Date endDate);
 | 
			
		||||
    /**
 | 
			
		||||
     * chart info
 | 
			
		||||
     *
 | 
			
		||||
     * @param startDate
 | 
			
		||||
     * @param endDate
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public ReturnT<Map<String, Object>> chartInfo(Date startDate, Date endDate);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -25,410 +25,411 @@ import java.util.*;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * core job action for xxl-job
 | 
			
		||||
 *
 | 
			
		||||
 * @author xuxueli 2016-5-28 15:30:33
 | 
			
		||||
 */
 | 
			
		||||
@Service
 | 
			
		||||
public class XxlJobServiceImpl implements XxlJobService {
 | 
			
		||||
	private static Logger logger = LoggerFactory.getLogger(XxlJobServiceImpl.class);
 | 
			
		||||
    private static Logger logger = LoggerFactory.getLogger(XxlJobServiceImpl.class);
 | 
			
		||||
 | 
			
		||||
	@Resource
 | 
			
		||||
	private XxlJobGroupDao xxlJobGroupDao;
 | 
			
		||||
	@Resource
 | 
			
		||||
	private XxlJobInfoDao xxlJobInfoDao;
 | 
			
		||||
	@Resource
 | 
			
		||||
	public XxlJobLogDao xxlJobLogDao;
 | 
			
		||||
	@Resource
 | 
			
		||||
	private XxlJobLogGlueDao xxlJobLogGlueDao;
 | 
			
		||||
	@Resource
 | 
			
		||||
	private XxlJobLogReportDao xxlJobLogReportDao;
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public Map<String, Object> pageList(int start, int length, int jobGroup, int triggerStatus, String jobDesc, String executorHandler, String author) {
 | 
			
		||||
    @Resource
 | 
			
		||||
    private XxlJobGroupDao xxlJobGroupDao;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private XxlJobInfoDao xxlJobInfoDao;
 | 
			
		||||
    @Resource
 | 
			
		||||
    public XxlJobLogDao xxlJobLogDao;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private XxlJobLogGlueDao xxlJobLogGlueDao;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private XxlJobLogReportDao xxlJobLogReportDao;
 | 
			
		||||
 | 
			
		||||
		// page list
 | 
			
		||||
		List<XxlJobInfo> list = xxlJobInfoDao.pageList(start, length, jobGroup, triggerStatus, jobDesc, executorHandler, author);
 | 
			
		||||
		int list_count = xxlJobInfoDao.pageListCount(start, length, jobGroup, triggerStatus, jobDesc, executorHandler, author);
 | 
			
		||||
		
 | 
			
		||||
		// package result
 | 
			
		||||
		Map<String, Object> maps = new HashMap<String, Object>();
 | 
			
		||||
	    maps.put("recordsTotal", list_count);		// 总记录数
 | 
			
		||||
	    maps.put("recordsFiltered", list_count);	// 过滤后的总记录数
 | 
			
		||||
	    maps.put("data", list);  					// 分页列表
 | 
			
		||||
		return maps;
 | 
			
		||||
	}
 | 
			
		||||
    @Override
 | 
			
		||||
    public Map<String, Object> pageList(int start, int length, int jobGroup, int triggerStatus, String jobDesc, String executorHandler, String author) {
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public ReturnT<String> add(XxlJobInfo jobInfo) {
 | 
			
		||||
        // page list
 | 
			
		||||
        List<XxlJobInfo> list = xxlJobInfoDao.pageList(start, length, jobGroup, triggerStatus, jobDesc, executorHandler, author);
 | 
			
		||||
        int list_count = xxlJobInfoDao.pageListCount(start, length, jobGroup, triggerStatus, jobDesc, executorHandler, author);
 | 
			
		||||
 | 
			
		||||
		// valid base
 | 
			
		||||
		XxlJobGroup group = xxlJobGroupDao.load(jobInfo.getJobGroup());
 | 
			
		||||
		if (group == null) {
 | 
			
		||||
			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) {
 | 
			
		||||
			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) {
 | 
			
		||||
			return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input")+I18nUtil.getString("jobinfo_field_author")) );
 | 
			
		||||
		}
 | 
			
		||||
        // package result
 | 
			
		||||
        Map<String, Object> maps = new HashMap<String, Object>();
 | 
			
		||||
        maps.put("recordsTotal" , list_count);        // 总记录数
 | 
			
		||||
        maps.put("recordsFiltered" , list_count);    // 过滤后的总记录数
 | 
			
		||||
        maps.put("data" , list);                    // 分页列表
 | 
			
		||||
        return maps;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		// valid trigger
 | 
			
		||||
		ScheduleTypeEnum scheduleTypeEnum = ScheduleTypeEnum.match(jobInfo.getScheduleType(), null);
 | 
			
		||||
		if (scheduleTypeEnum == null) {
 | 
			
		||||
			return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
 | 
			
		||||
		}
 | 
			
		||||
		if (scheduleTypeEnum == ScheduleTypeEnum.CRON) {
 | 
			
		||||
			if (jobInfo.getScheduleConf()==null || !CronExpression.isValidExpression(jobInfo.getScheduleConf())) {
 | 
			
		||||
				return new ReturnT<String>(ReturnT.FAIL_CODE, "Cron"+I18nUtil.getString("system_unvalid"));
 | 
			
		||||
			}
 | 
			
		||||
		} else if (scheduleTypeEnum == ScheduleTypeEnum.FIX_RATE/* || scheduleTypeEnum == ScheduleTypeEnum.FIX_DELAY*/) {
 | 
			
		||||
			if (jobInfo.getScheduleConf() == null) {
 | 
			
		||||
				return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")) );
 | 
			
		||||
			}
 | 
			
		||||
			try {
 | 
			
		||||
				int fixSecond = Integer.valueOf(jobInfo.getScheduleConf());
 | 
			
		||||
				if (fixSecond < 1) {
 | 
			
		||||
					return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
 | 
			
		||||
				}
 | 
			
		||||
			} catch (Exception e) {
 | 
			
		||||
				return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
    @Override
 | 
			
		||||
    public ReturnT<String> add(XxlJobInfo jobInfo) {
 | 
			
		||||
 | 
			
		||||
		// valid job
 | 
			
		||||
		if (GlueTypeEnum.match(jobInfo.getGlueType()) == null) {
 | 
			
		||||
			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) ) {
 | 
			
		||||
			return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input")+"JobHandler") );
 | 
			
		||||
		}
 | 
			
		||||
		// 》fix "\r" in shell
 | 
			
		||||
		if (GlueTypeEnum.GLUE_SHELL==GlueTypeEnum.match(jobInfo.getGlueType()) && jobInfo.getGlueSource()!=null) {
 | 
			
		||||
			jobInfo.setGlueSource(jobInfo.getGlueSource().replaceAll("\r", ""));
 | 
			
		||||
		}
 | 
			
		||||
        // valid base
 | 
			
		||||
        XxlJobGroup group = xxlJobGroupDao.load(jobInfo.getJobGroup());
 | 
			
		||||
        if (group == null) {
 | 
			
		||||
            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) {
 | 
			
		||||
            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) {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_author")));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		// valid advanced
 | 
			
		||||
		if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
 | 
			
		||||
			return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorRouteStrategy")+I18nUtil.getString("system_unvalid")) );
 | 
			
		||||
		}
 | 
			
		||||
		if (MisfireStrategyEnum.match(jobInfo.getMisfireStrategy(), null) == null) {
 | 
			
		||||
			return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("misfire_strategy")+I18nUtil.getString("system_unvalid")) );
 | 
			
		||||
		}
 | 
			
		||||
		if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) {
 | 
			
		||||
			return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy")+I18nUtil.getString("system_unvalid")) );
 | 
			
		||||
		}
 | 
			
		||||
        // valid trigger
 | 
			
		||||
        ScheduleTypeEnum scheduleTypeEnum = ScheduleTypeEnum.match(jobInfo.getScheduleType(), null);
 | 
			
		||||
        if (scheduleTypeEnum == null) {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
 | 
			
		||||
        }
 | 
			
		||||
        if (scheduleTypeEnum == ScheduleTypeEnum.CRON) {
 | 
			
		||||
            if (jobInfo.getScheduleConf() == null || !CronExpression.isValidExpression(jobInfo.getScheduleConf())) {
 | 
			
		||||
                return new ReturnT<String>(ReturnT.FAIL_CODE, "Cron" + I18nUtil.getString("system_unvalid"));
 | 
			
		||||
            }
 | 
			
		||||
        } else if (scheduleTypeEnum == ScheduleTypeEnum.FIX_RATE/* || scheduleTypeEnum == ScheduleTypeEnum.FIX_DELAY*/) {
 | 
			
		||||
            if (jobInfo.getScheduleConf() == null) {
 | 
			
		||||
                return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")));
 | 
			
		||||
            }
 | 
			
		||||
            try {
 | 
			
		||||
                int fixSecond = Integer.valueOf(jobInfo.getScheduleConf());
 | 
			
		||||
                if (fixSecond < 1) {
 | 
			
		||||
                    return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
 | 
			
		||||
                }
 | 
			
		||||
            } catch (Exception e) {
 | 
			
		||||
                return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		// 》ChildJobId valid
 | 
			
		||||
		if (jobInfo.getChildJobId()!=null && jobInfo.getChildJobId().trim().length()>0) {
 | 
			
		||||
			String[] childJobIds = jobInfo.getChildJobId().split(",");
 | 
			
		||||
			for (String childJobIdItem: childJobIds) {
 | 
			
		||||
				if (childJobIdItem!=null && childJobIdItem.trim().length()>0 && isNumeric(childJobIdItem)) {
 | 
			
		||||
					XxlJobInfo childJobInfo = xxlJobInfoDao.loadById(Integer.parseInt(childJobIdItem));
 | 
			
		||||
					if (childJobInfo==null) {
 | 
			
		||||
						return new ReturnT<String>(ReturnT.FAIL_CODE,
 | 
			
		||||
								MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId")+"({0})"+I18nUtil.getString("system_not_found")), childJobIdItem));
 | 
			
		||||
					}
 | 
			
		||||
				} else {
 | 
			
		||||
					return new ReturnT<String>(ReturnT.FAIL_CODE,
 | 
			
		||||
							MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId")+"({0})"+I18nUtil.getString("system_unvalid")), childJobIdItem));
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
        // valid job
 | 
			
		||||
        if (GlueTypeEnum.match(jobInfo.getGlueType()) == null) {
 | 
			
		||||
            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)) {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + "JobHandler"));
 | 
			
		||||
        }
 | 
			
		||||
        // 》fix "\r" in shell
 | 
			
		||||
        if (GlueTypeEnum.GLUE_SHELL == GlueTypeEnum.match(jobInfo.getGlueType()) && jobInfo.getGlueSource() != null) {
 | 
			
		||||
            jobInfo.setGlueSource(jobInfo.getGlueSource().replaceAll("\r" , ""));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
			// join , avoid "xxx,,"
 | 
			
		||||
			String temp = "";
 | 
			
		||||
			for (String item:childJobIds) {
 | 
			
		||||
				temp += item + ",";
 | 
			
		||||
			}
 | 
			
		||||
			temp = temp.substring(0, temp.length()-1);
 | 
			
		||||
        // valid advanced
 | 
			
		||||
        if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorRouteStrategy") + I18nUtil.getString("system_unvalid")));
 | 
			
		||||
        }
 | 
			
		||||
        if (MisfireStrategyEnum.match(jobInfo.getMisfireStrategy(), null) == null) {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("misfire_strategy") + I18nUtil.getString("system_unvalid")));
 | 
			
		||||
        }
 | 
			
		||||
        if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy") + I18nUtil.getString("system_unvalid")));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
			jobInfo.setChildJobId(temp);
 | 
			
		||||
		}
 | 
			
		||||
        // 》ChildJobId valid
 | 
			
		||||
        if (jobInfo.getChildJobId() != null && jobInfo.getChildJobId().trim().length() > 0) {
 | 
			
		||||
            String[] childJobIds = jobInfo.getChildJobId().split(",");
 | 
			
		||||
            for (String childJobIdItem : childJobIds) {
 | 
			
		||||
                if (childJobIdItem != null && childJobIdItem.trim().length() > 0 && isNumeric(childJobIdItem)) {
 | 
			
		||||
                    XxlJobInfo childJobInfo = xxlJobInfoDao.loadById(Integer.parseInt(childJobIdItem));
 | 
			
		||||
                    if (childJobInfo == null) {
 | 
			
		||||
                        return new ReturnT<String>(ReturnT.FAIL_CODE,
 | 
			
		||||
                            MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId") + "({0})" + I18nUtil.getString("system_not_found")), childJobIdItem));
 | 
			
		||||
                    }
 | 
			
		||||
                } else {
 | 
			
		||||
                    return new ReturnT<String>(ReturnT.FAIL_CODE,
 | 
			
		||||
                        MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId") + "({0})" + I18nUtil.getString("system_unvalid")), childJobIdItem));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
		// add in db
 | 
			
		||||
		jobInfo.setAddTime(new Date());
 | 
			
		||||
		jobInfo.setUpdateTime(new Date());
 | 
			
		||||
		jobInfo.setGlueUpdatetime(new Date());
 | 
			
		||||
		xxlJobInfoDao.save(jobInfo);
 | 
			
		||||
		if (jobInfo.getId() < 1) {
 | 
			
		||||
			return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_add")+I18nUtil.getString("system_fail")) );
 | 
			
		||||
		}
 | 
			
		||||
            // join , avoid "xxx,,"
 | 
			
		||||
            String temp = "";
 | 
			
		||||
            for (String item : childJobIds) {
 | 
			
		||||
                temp += item + ",";
 | 
			
		||||
            }
 | 
			
		||||
            temp = temp.substring(0, temp.length() - 1);
 | 
			
		||||
 | 
			
		||||
		return new ReturnT<String>(String.valueOf(jobInfo.getId()));
 | 
			
		||||
	}
 | 
			
		||||
            jobInfo.setChildJobId(temp);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
	private boolean isNumeric(String str){
 | 
			
		||||
		try {
 | 
			
		||||
			int result = Integer.valueOf(str);
 | 
			
		||||
			return true;
 | 
			
		||||
		} catch (NumberFormatException e) {
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
        // add in db
 | 
			
		||||
        jobInfo.setAddTime(new Date());
 | 
			
		||||
        jobInfo.setUpdateTime(new Date());
 | 
			
		||||
        jobInfo.setGlueUpdatetime(new Date());
 | 
			
		||||
        xxlJobInfoDao.save(jobInfo);
 | 
			
		||||
        if (jobInfo.getId() < 1) {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_add") + I18nUtil.getString("system_fail")));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public ReturnT<String> update(XxlJobInfo jobInfo) {
 | 
			
		||||
        return new ReturnT<String>(String.valueOf(jobInfo.getId()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		// valid base
 | 
			
		||||
		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")) );
 | 
			
		||||
		}
 | 
			
		||||
		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")) );
 | 
			
		||||
		}
 | 
			
		||||
    private boolean isNumeric(String str) {
 | 
			
		||||
        try {
 | 
			
		||||
            int result = Integer.valueOf(str);
 | 
			
		||||
            return true;
 | 
			
		||||
        } catch (NumberFormatException e) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		// valid trigger
 | 
			
		||||
		ScheduleTypeEnum scheduleTypeEnum = ScheduleTypeEnum.match(jobInfo.getScheduleType(), null);
 | 
			
		||||
		if (scheduleTypeEnum == null) {
 | 
			
		||||
			return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
 | 
			
		||||
		}
 | 
			
		||||
		if (scheduleTypeEnum == ScheduleTypeEnum.CRON) {
 | 
			
		||||
			if (jobInfo.getScheduleConf()==null || !CronExpression.isValidExpression(jobInfo.getScheduleConf())) {
 | 
			
		||||
				return new ReturnT<String>(ReturnT.FAIL_CODE, "Cron"+I18nUtil.getString("system_unvalid") );
 | 
			
		||||
			}
 | 
			
		||||
		} else if (scheduleTypeEnum == ScheduleTypeEnum.FIX_RATE /*|| scheduleTypeEnum == ScheduleTypeEnum.FIX_DELAY*/) {
 | 
			
		||||
			if (jobInfo.getScheduleConf() == null) {
 | 
			
		||||
				return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
 | 
			
		||||
			}
 | 
			
		||||
			try {
 | 
			
		||||
				int fixSecond = Integer.valueOf(jobInfo.getScheduleConf());
 | 
			
		||||
				if (fixSecond < 1) {
 | 
			
		||||
					return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
 | 
			
		||||
				}
 | 
			
		||||
			} catch (Exception e) {
 | 
			
		||||
				return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
    @Override
 | 
			
		||||
    public ReturnT<String> update(XxlJobInfo jobInfo) {
 | 
			
		||||
 | 
			
		||||
		// valid advanced
 | 
			
		||||
		if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
 | 
			
		||||
			return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorRouteStrategy")+I18nUtil.getString("system_unvalid")) );
 | 
			
		||||
		}
 | 
			
		||||
		if (MisfireStrategyEnum.match(jobInfo.getMisfireStrategy(), null) == null) {
 | 
			
		||||
			return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("misfire_strategy")+I18nUtil.getString("system_unvalid")) );
 | 
			
		||||
		}
 | 
			
		||||
		if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) {
 | 
			
		||||
			return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy")+I18nUtil.getString("system_unvalid")) );
 | 
			
		||||
		}
 | 
			
		||||
        // valid base
 | 
			
		||||
        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")));
 | 
			
		||||
        }
 | 
			
		||||
        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")));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		// 》ChildJobId valid
 | 
			
		||||
		if (jobInfo.getChildJobId()!=null && jobInfo.getChildJobId().trim().length()>0) {
 | 
			
		||||
			String[] childJobIds = jobInfo.getChildJobId().split(",");
 | 
			
		||||
			for (String childJobIdItem: childJobIds) {
 | 
			
		||||
				if (childJobIdItem!=null && childJobIdItem.trim().length()>0 && isNumeric(childJobIdItem)) {
 | 
			
		||||
					XxlJobInfo childJobInfo = xxlJobInfoDao.loadById(Integer.parseInt(childJobIdItem));
 | 
			
		||||
					if (childJobInfo==null) {
 | 
			
		||||
						return new ReturnT<String>(ReturnT.FAIL_CODE,
 | 
			
		||||
								MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId")+"({0})"+I18nUtil.getString("system_not_found")), childJobIdItem));
 | 
			
		||||
					}
 | 
			
		||||
				} else {
 | 
			
		||||
					return new ReturnT<String>(ReturnT.FAIL_CODE,
 | 
			
		||||
							MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId")+"({0})"+I18nUtil.getString("system_unvalid")), childJobIdItem));
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
        // valid trigger
 | 
			
		||||
        ScheduleTypeEnum scheduleTypeEnum = ScheduleTypeEnum.match(jobInfo.getScheduleType(), null);
 | 
			
		||||
        if (scheduleTypeEnum == null) {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
 | 
			
		||||
        }
 | 
			
		||||
        if (scheduleTypeEnum == ScheduleTypeEnum.CRON) {
 | 
			
		||||
            if (jobInfo.getScheduleConf() == null || !CronExpression.isValidExpression(jobInfo.getScheduleConf())) {
 | 
			
		||||
                return new ReturnT<String>(ReturnT.FAIL_CODE, "Cron" + I18nUtil.getString("system_unvalid"));
 | 
			
		||||
            }
 | 
			
		||||
        } else if (scheduleTypeEnum == ScheduleTypeEnum.FIX_RATE /*|| scheduleTypeEnum == ScheduleTypeEnum.FIX_DELAY*/) {
 | 
			
		||||
            if (jobInfo.getScheduleConf() == null) {
 | 
			
		||||
                return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
 | 
			
		||||
            }
 | 
			
		||||
            try {
 | 
			
		||||
                int fixSecond = Integer.valueOf(jobInfo.getScheduleConf());
 | 
			
		||||
                if (fixSecond < 1) {
 | 
			
		||||
                    return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
 | 
			
		||||
                }
 | 
			
		||||
            } catch (Exception e) {
 | 
			
		||||
                return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type") + I18nUtil.getString("system_unvalid")));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
			// join , avoid "xxx,,"
 | 
			
		||||
			String temp = "";
 | 
			
		||||
			for (String item:childJobIds) {
 | 
			
		||||
				temp += item + ",";
 | 
			
		||||
			}
 | 
			
		||||
			temp = temp.substring(0, temp.length()-1);
 | 
			
		||||
        // valid advanced
 | 
			
		||||
        if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorRouteStrategy") + I18nUtil.getString("system_unvalid")));
 | 
			
		||||
        }
 | 
			
		||||
        if (MisfireStrategyEnum.match(jobInfo.getMisfireStrategy(), null) == null) {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("misfire_strategy") + I18nUtil.getString("system_unvalid")));
 | 
			
		||||
        }
 | 
			
		||||
        if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy") + I18nUtil.getString("system_unvalid")));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
			jobInfo.setChildJobId(temp);
 | 
			
		||||
		}
 | 
			
		||||
        // 》ChildJobId valid
 | 
			
		||||
        if (jobInfo.getChildJobId() != null && jobInfo.getChildJobId().trim().length() > 0) {
 | 
			
		||||
            String[] childJobIds = jobInfo.getChildJobId().split(",");
 | 
			
		||||
            for (String childJobIdItem : childJobIds) {
 | 
			
		||||
                if (childJobIdItem != null && childJobIdItem.trim().length() > 0 && isNumeric(childJobIdItem)) {
 | 
			
		||||
                    XxlJobInfo childJobInfo = xxlJobInfoDao.loadById(Integer.parseInt(childJobIdItem));
 | 
			
		||||
                    if (childJobInfo == null) {
 | 
			
		||||
                        return new ReturnT<String>(ReturnT.FAIL_CODE,
 | 
			
		||||
                            MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId") + "({0})" + I18nUtil.getString("system_not_found")), childJobIdItem));
 | 
			
		||||
                    }
 | 
			
		||||
                } else {
 | 
			
		||||
                    return new ReturnT<String>(ReturnT.FAIL_CODE,
 | 
			
		||||
                        MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId") + "({0})" + I18nUtil.getString("system_unvalid")), childJobIdItem));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
		// group valid
 | 
			
		||||
		XxlJobGroup jobGroup = xxlJobGroupDao.load(jobInfo.getJobGroup());
 | 
			
		||||
		if (jobGroup == null) {
 | 
			
		||||
			return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_jobgroup")+I18nUtil.getString("system_unvalid")) );
 | 
			
		||||
		}
 | 
			
		||||
            // join , avoid "xxx,,"
 | 
			
		||||
            String temp = "";
 | 
			
		||||
            for (String item : childJobIds) {
 | 
			
		||||
                temp += item + ",";
 | 
			
		||||
            }
 | 
			
		||||
            temp = temp.substring(0, temp.length() - 1);
 | 
			
		||||
 | 
			
		||||
		// stage job info
 | 
			
		||||
		XxlJobInfo exists_jobInfo = xxlJobInfoDao.loadById(jobInfo.getId());
 | 
			
		||||
		if (exists_jobInfo == null) {
 | 
			
		||||
			return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_id")+I18nUtil.getString("system_not_found")) );
 | 
			
		||||
		}
 | 
			
		||||
            jobInfo.setChildJobId(temp);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		// next trigger time (5s后生效,避开预读周期)
 | 
			
		||||
		long nextTriggerTime = exists_jobInfo.getTriggerNextTime();
 | 
			
		||||
		boolean scheduleDataNotChanged = jobInfo.getScheduleType().equals(exists_jobInfo.getScheduleType()) && jobInfo.getScheduleConf().equals(exists_jobInfo.getScheduleConf());
 | 
			
		||||
		if (exists_jobInfo.getTriggerStatus() == 1 && !scheduleDataNotChanged) {
 | 
			
		||||
			try {
 | 
			
		||||
				Date nextValidTime = JobScheduleHelper.generateNextValidTime(jobInfo, 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")) );
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
        // group valid
 | 
			
		||||
        XxlJobGroup jobGroup = xxlJobGroupDao.load(jobInfo.getJobGroup());
 | 
			
		||||
        if (jobGroup == null) {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_jobgroup") + I18nUtil.getString("system_unvalid")));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		exists_jobInfo.setJobGroup(jobInfo.getJobGroup());
 | 
			
		||||
		exists_jobInfo.setJobDesc(jobInfo.getJobDesc());
 | 
			
		||||
		exists_jobInfo.setAuthor(jobInfo.getAuthor());
 | 
			
		||||
		exists_jobInfo.setAlarmEmail(jobInfo.getAlarmEmail());
 | 
			
		||||
		exists_jobInfo.setScheduleType(jobInfo.getScheduleType());
 | 
			
		||||
		exists_jobInfo.setScheduleConf(jobInfo.getScheduleConf());
 | 
			
		||||
		exists_jobInfo.setMisfireStrategy(jobInfo.getMisfireStrategy());
 | 
			
		||||
		exists_jobInfo.setExecutorRouteStrategy(jobInfo.getExecutorRouteStrategy());
 | 
			
		||||
		exists_jobInfo.setExecutorHandler(jobInfo.getExecutorHandler());
 | 
			
		||||
		exists_jobInfo.setExecutorParam(jobInfo.getExecutorParam());
 | 
			
		||||
		exists_jobInfo.setExecutorBlockStrategy(jobInfo.getExecutorBlockStrategy());
 | 
			
		||||
		exists_jobInfo.setExecutorTimeout(jobInfo.getExecutorTimeout());
 | 
			
		||||
		exists_jobInfo.setExecutorFailRetryCount(jobInfo.getExecutorFailRetryCount());
 | 
			
		||||
		exists_jobInfo.setChildJobId(jobInfo.getChildJobId());
 | 
			
		||||
		exists_jobInfo.setTriggerNextTime(nextTriggerTime);
 | 
			
		||||
        // stage job info
 | 
			
		||||
        XxlJobInfo exists_jobInfo = xxlJobInfoDao.loadById(jobInfo.getId());
 | 
			
		||||
        if (exists_jobInfo == null) {
 | 
			
		||||
            return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_id") + I18nUtil.getString("system_not_found")));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		exists_jobInfo.setUpdateTime(new Date());
 | 
			
		||||
        // next trigger time (5s后生效,避开预读周期)
 | 
			
		||||
        long nextTriggerTime = exists_jobInfo.getTriggerNextTime();
 | 
			
		||||
        boolean scheduleDataNotChanged = jobInfo.getScheduleType().equals(exists_jobInfo.getScheduleType()) && jobInfo.getScheduleConf().equals(exists_jobInfo.getScheduleConf());
 | 
			
		||||
        if (exists_jobInfo.getTriggerStatus() == 1 && !scheduleDataNotChanged) {
 | 
			
		||||
            try {
 | 
			
		||||
                Date nextValidTime = JobScheduleHelper.generateNextValidTime(jobInfo, 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")));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        exists_jobInfo.setJobGroup(jobInfo.getJobGroup());
 | 
			
		||||
        exists_jobInfo.setJobDesc(jobInfo.getJobDesc());
 | 
			
		||||
        exists_jobInfo.setAuthor(jobInfo.getAuthor());
 | 
			
		||||
        exists_jobInfo.setAlarmEmail(jobInfo.getAlarmEmail());
 | 
			
		||||
        exists_jobInfo.setScheduleType(jobInfo.getScheduleType());
 | 
			
		||||
        exists_jobInfo.setScheduleConf(jobInfo.getScheduleConf());
 | 
			
		||||
        exists_jobInfo.setMisfireStrategy(jobInfo.getMisfireStrategy());
 | 
			
		||||
        exists_jobInfo.setExecutorRouteStrategy(jobInfo.getExecutorRouteStrategy());
 | 
			
		||||
        exists_jobInfo.setExecutorHandler(jobInfo.getExecutorHandler());
 | 
			
		||||
        exists_jobInfo.setExecutorParam(jobInfo.getExecutorParam());
 | 
			
		||||
        exists_jobInfo.setExecutorBlockStrategy(jobInfo.getExecutorBlockStrategy());
 | 
			
		||||
        exists_jobInfo.setExecutorTimeout(jobInfo.getExecutorTimeout());
 | 
			
		||||
        exists_jobInfo.setExecutorFailRetryCount(jobInfo.getExecutorFailRetryCount());
 | 
			
		||||
        exists_jobInfo.setChildJobId(jobInfo.getChildJobId());
 | 
			
		||||
        exists_jobInfo.setTriggerNextTime(nextTriggerTime);
 | 
			
		||||
 | 
			
		||||
        exists_jobInfo.setUpdateTime(new Date());
 | 
			
		||||
        xxlJobInfoDao.update(exists_jobInfo);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		return ReturnT.SUCCESS;
 | 
			
		||||
	}
 | 
			
		||||
        return ReturnT.SUCCESS;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public ReturnT<String> remove(int id) {
 | 
			
		||||
		XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
 | 
			
		||||
		if (xxlJobInfo == null) {
 | 
			
		||||
			return ReturnT.SUCCESS;
 | 
			
		||||
		}
 | 
			
		||||
    @Override
 | 
			
		||||
    public ReturnT<String> remove(int id) {
 | 
			
		||||
        XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
 | 
			
		||||
        if (xxlJobInfo == null) {
 | 
			
		||||
            return ReturnT.SUCCESS;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		xxlJobInfoDao.delete(id);
 | 
			
		||||
		xxlJobLogDao.delete(id);
 | 
			
		||||
		xxlJobLogGlueDao.deleteByJobId(id);
 | 
			
		||||
		return ReturnT.SUCCESS;
 | 
			
		||||
	}
 | 
			
		||||
        xxlJobInfoDao.delete(id);
 | 
			
		||||
        xxlJobLogDao.delete(id);
 | 
			
		||||
        xxlJobLogGlueDao.deleteByJobId(id);
 | 
			
		||||
        return ReturnT.SUCCESS;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	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) {
 | 
			
		||||
    @Override
 | 
			
		||||
    public ReturnT<String> start(int id) {
 | 
			
		||||
        XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
 | 
			
		||||
 | 
			
		||||
		xxlJobInfo.setTriggerStatus(0);
 | 
			
		||||
		xxlJobInfo.setTriggerLastTime(0);
 | 
			
		||||
		xxlJobInfo.setTriggerNextTime(0);
 | 
			
		||||
        // 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")));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		xxlJobInfo.setUpdateTime(new Date());
 | 
			
		||||
		xxlJobInfoDao.update(xxlJobInfo);
 | 
			
		||||
		return ReturnT.SUCCESS;
 | 
			
		||||
	}
 | 
			
		||||
        // 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")));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public Map<String, Object> dashboardInfo() {
 | 
			
		||||
        xxlJobInfo.setTriggerStatus(1);
 | 
			
		||||
        xxlJobInfo.setTriggerLastTime(0);
 | 
			
		||||
        xxlJobInfo.setTriggerNextTime(nextTriggerTime);
 | 
			
		||||
 | 
			
		||||
		int jobInfoCount = xxlJobInfoDao.findAllCount();
 | 
			
		||||
		int jobLogCount = 0;
 | 
			
		||||
		int jobLogSuccessCount = 0;
 | 
			
		||||
		XxlJobLogReport xxlJobLogReport = xxlJobLogReportDao.queryLogReportTotal();
 | 
			
		||||
		if (xxlJobLogReport != null) {
 | 
			
		||||
			jobLogCount = xxlJobLogReport.getRunningCount() + xxlJobLogReport.getSucCount() + xxlJobLogReport.getFailCount();
 | 
			
		||||
			jobLogSuccessCount = xxlJobLogReport.getSucCount();
 | 
			
		||||
		}
 | 
			
		||||
        xxlJobInfo.setUpdateTime(new Date());
 | 
			
		||||
        xxlJobInfoDao.update(xxlJobInfo);
 | 
			
		||||
        return ReturnT.SUCCESS;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		// executor count
 | 
			
		||||
		Set<String> executorAddressSet = new HashSet<String>();
 | 
			
		||||
		List<XxlJobGroup> groupList = xxlJobGroupDao.findAll();
 | 
			
		||||
    @Override
 | 
			
		||||
    public ReturnT<String> stop(int id) {
 | 
			
		||||
        XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
 | 
			
		||||
 | 
			
		||||
		if (groupList!=null && !groupList.isEmpty()) {
 | 
			
		||||
			for (XxlJobGroup group: groupList) {
 | 
			
		||||
				if (group.getRegistryList()!=null && !group.getRegistryList().isEmpty()) {
 | 
			
		||||
					executorAddressSet.addAll(group.getRegistryList());
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
        xxlJobInfo.setTriggerStatus(0);
 | 
			
		||||
        xxlJobInfo.setTriggerLastTime(0);
 | 
			
		||||
        xxlJobInfo.setTriggerNextTime(0);
 | 
			
		||||
 | 
			
		||||
		int executorCount = executorAddressSet.size();
 | 
			
		||||
        xxlJobInfo.setUpdateTime(new Date());
 | 
			
		||||
        xxlJobInfoDao.update(xxlJobInfo);
 | 
			
		||||
        return ReturnT.SUCCESS;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		Map<String, Object> dashboardMap = new HashMap<String, Object>();
 | 
			
		||||
		dashboardMap.put("jobInfoCount", jobInfoCount);
 | 
			
		||||
		dashboardMap.put("jobLogCount", jobLogCount);
 | 
			
		||||
		dashboardMap.put("jobLogSuccessCount", jobLogSuccessCount);
 | 
			
		||||
		dashboardMap.put("executorCount", executorCount);
 | 
			
		||||
		return dashboardMap;
 | 
			
		||||
	}
 | 
			
		||||
    @Override
 | 
			
		||||
    public Map<String, Object> dashboardInfo() {
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public ReturnT<Map<String, Object>> chartInfo(Date startDate, Date endDate) {
 | 
			
		||||
        int jobInfoCount = xxlJobInfoDao.findAllCount();
 | 
			
		||||
        int jobLogCount = 0;
 | 
			
		||||
        int jobLogSuccessCount = 0;
 | 
			
		||||
        XxlJobLogReport xxlJobLogReport = xxlJobLogReportDao.queryLogReportTotal();
 | 
			
		||||
        if (xxlJobLogReport != null) {
 | 
			
		||||
            jobLogCount = xxlJobLogReport.getRunningCount() + xxlJobLogReport.getSucCount() + xxlJobLogReport.getFailCount();
 | 
			
		||||
            jobLogSuccessCount = xxlJobLogReport.getSucCount();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		// process
 | 
			
		||||
		List<String> triggerDayList = new ArrayList<String>();
 | 
			
		||||
		List<Integer> triggerDayCountRunningList = new ArrayList<Integer>();
 | 
			
		||||
		List<Integer> triggerDayCountSucList = new ArrayList<Integer>();
 | 
			
		||||
		List<Integer> triggerDayCountFailList = new ArrayList<Integer>();
 | 
			
		||||
		int triggerCountRunningTotal = 0;
 | 
			
		||||
		int triggerCountSucTotal = 0;
 | 
			
		||||
		int triggerCountFailTotal = 0;
 | 
			
		||||
        // executor count
 | 
			
		||||
        Set<String> executorAddressSet = new HashSet<String>();
 | 
			
		||||
        List<XxlJobGroup> groupList = xxlJobGroupDao.findAll();
 | 
			
		||||
 | 
			
		||||
		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) {
 | 
			
		||||
			for (XxlJobLogReport item: logReportList) {
 | 
			
		||||
				String day = DateUtil.formatDate(item.getTriggerDay());
 | 
			
		||||
				int triggerDayCountRunning = item.getRunningCount();
 | 
			
		||||
				int triggerDayCountSuc = item.getSucCount();
 | 
			
		||||
				int triggerDayCountFail = item.getFailCount();
 | 
			
		||||
        int executorCount = executorAddressSet.size();
 | 
			
		||||
 | 
			
		||||
				triggerDayList.add(day);
 | 
			
		||||
				triggerDayCountRunningList.add(triggerDayCountRunning);
 | 
			
		||||
				triggerDayCountSucList.add(triggerDayCountSuc);
 | 
			
		||||
				triggerDayCountFailList.add(triggerDayCountFail);
 | 
			
		||||
        Map<String, Object> dashboardMap = new HashMap<String, Object>();
 | 
			
		||||
        dashboardMap.put("jobInfoCount" , jobInfoCount);
 | 
			
		||||
        dashboardMap.put("jobLogCount" , jobLogCount);
 | 
			
		||||
        dashboardMap.put("jobLogSuccessCount" , jobLogSuccessCount);
 | 
			
		||||
        dashboardMap.put("executorCount" , executorCount);
 | 
			
		||||
        return dashboardMap;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
				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);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
    @Override
 | 
			
		||||
    public ReturnT<Map<String, Object>> chartInfo(Date startDate, Date endDate) {
 | 
			
		||||
 | 
			
		||||
		Map<String, Object> result = new HashMap<String, Object>();
 | 
			
		||||
		result.put("triggerDayList", triggerDayList);
 | 
			
		||||
		result.put("triggerDayCountRunningList", triggerDayCountRunningList);
 | 
			
		||||
		result.put("triggerDayCountSucList", triggerDayCountSucList);
 | 
			
		||||
		result.put("triggerDayCountFailList", triggerDayCountFailList);
 | 
			
		||||
        // process
 | 
			
		||||
        List<String> triggerDayList = new ArrayList<String>();
 | 
			
		||||
        List<Integer> triggerDayCountRunningList = new ArrayList<Integer>();
 | 
			
		||||
        List<Integer> triggerDayCountSucList = new ArrayList<Integer>();
 | 
			
		||||
        List<Integer> triggerDayCountFailList = new ArrayList<Integer>();
 | 
			
		||||
        int triggerCountRunningTotal = 0;
 | 
			
		||||
        int triggerCountSucTotal = 0;
 | 
			
		||||
        int triggerCountFailTotal = 0;
 | 
			
		||||
 | 
			
		||||
		result.put("triggerCountRunningTotal", triggerCountRunningTotal);
 | 
			
		||||
		result.put("triggerCountSucTotal", triggerCountSucTotal);
 | 
			
		||||
		result.put("triggerCountFailTotal", triggerCountFailTotal);
 | 
			
		||||
        List<XxlJobLogReport> logReportList = xxlJobLogReportDao.queryLogReport(startDate, endDate);
 | 
			
		||||
 | 
			
		||||
		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);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ spring:
 | 
			
		||||
        # 设置 Spring Boot Admin Server 地址
 | 
			
		||||
        url: http://localhost:9090/admin
 | 
			
		||||
        instance:
 | 
			
		||||
          prefer-ip: true # 注册实例时,优先使用 IP
 | 
			
		||||
          service-host-type: IP
 | 
			
		||||
        username: ruoyi
 | 
			
		||||
        password: 123456
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ spring:
 | 
			
		||||
        # 设置 Spring Boot Admin Server 地址
 | 
			
		||||
        url: http://172.30.0.90:9090/admin
 | 
			
		||||
        instance:
 | 
			
		||||
          prefer-ip: true # 注册实例时,优先使用 IP
 | 
			
		||||
          service-host-type: IP
 | 
			
		||||
        username: ruoyi
 | 
			
		||||
        password: 123456
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,91 +1,91 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
 | 
			
		||||
	"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
			
		||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		||||
    "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
			
		||||
<mapper namespace="com.xxl.job.admin.dao.XxlJobGroupDao">
 | 
			
		||||
	
 | 
			
		||||
	<resultMap id="XxlJobGroup" type="com.xxl.job.admin.core.model.XxlJobGroup" >
 | 
			
		||||
		<result column="id" property="id" />
 | 
			
		||||
	    <result column="app_name" property="appname" />
 | 
			
		||||
	    <result column="title" property="title" />
 | 
			
		||||
		<result column="address_type" property="addressType" />
 | 
			
		||||
		<result column="address_list" property="addressList" />
 | 
			
		||||
		<result column="update_time" property="updateTime" />
 | 
			
		||||
	</resultMap>
 | 
			
		||||
 | 
			
		||||
	<sql id="Base_Column_List">
 | 
			
		||||
		t.id,
 | 
			
		||||
		t.app_name,
 | 
			
		||||
		t.title,
 | 
			
		||||
		t.address_type,
 | 
			
		||||
		t.address_list,
 | 
			
		||||
		t.update_time
 | 
			
		||||
	</sql>
 | 
			
		||||
    <resultMap id="XxlJobGroup" type="com.xxl.job.admin.core.model.XxlJobGroup" >
 | 
			
		||||
        <result column="id" property="id" />
 | 
			
		||||
        <result column="app_name" property="appname" />
 | 
			
		||||
        <result column="title" property="title" />
 | 
			
		||||
        <result column="address_type" property="addressType" />
 | 
			
		||||
        <result column="address_list" property="addressList" />
 | 
			
		||||
        <result column="update_time" property="updateTime" />
 | 
			
		||||
    </resultMap>
 | 
			
		||||
 | 
			
		||||
	<select id="findAll" resultMap="XxlJobGroup">
 | 
			
		||||
		SELECT <include refid="Base_Column_List" />
 | 
			
		||||
		FROM xxl_job_group AS t
 | 
			
		||||
		ORDER BY t.app_name, t.title, t.id ASC
 | 
			
		||||
	</select>
 | 
			
		||||
    <sql id="Base_Column_List">
 | 
			
		||||
        t.id,
 | 
			
		||||
        t.app_name,
 | 
			
		||||
        t.title,
 | 
			
		||||
        t.address_type,
 | 
			
		||||
        t.address_list,
 | 
			
		||||
        t.update_time
 | 
			
		||||
    </sql>
 | 
			
		||||
 | 
			
		||||
	<select id="findByAddressType" parameterType="java.lang.Integer" resultMap="XxlJobGroup">
 | 
			
		||||
		SELECT <include refid="Base_Column_List" />
 | 
			
		||||
		FROM xxl_job_group AS t
 | 
			
		||||
		WHERE t.address_type = #{addressType}
 | 
			
		||||
		ORDER BY t.app_name, t.title, t.id ASC
 | 
			
		||||
	</select>
 | 
			
		||||
    <select id="findAll" resultMap="XxlJobGroup">
 | 
			
		||||
        SELECT <include refid="Base_Column_List" />
 | 
			
		||||
        FROM xxl_job_group AS t
 | 
			
		||||
        ORDER BY t.app_name, t.title, t.id ASC
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
	<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`)
 | 
			
		||||
		values ( #{appname}, #{title}, #{addressType}, #{addressList}, #{updateTime} );
 | 
			
		||||
	</insert>
 | 
			
		||||
    <select id="findByAddressType" parameterType="java.lang.Integer" resultMap="XxlJobGroup">
 | 
			
		||||
        SELECT <include refid="Base_Column_List" />
 | 
			
		||||
        FROM xxl_job_group AS t
 | 
			
		||||
        WHERE t.address_type = #{addressType}
 | 
			
		||||
        ORDER BY t.app_name, t.title, t.id ASC
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
	<update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobGroup" >
 | 
			
		||||
		UPDATE xxl_job_group
 | 
			
		||||
		SET `app_name` = #{appname},
 | 
			
		||||
			`title` = #{title},
 | 
			
		||||
			`address_type` = #{addressType},
 | 
			
		||||
			`address_list` = #{addressList},
 | 
			
		||||
			`update_time` = #{updateTime}
 | 
			
		||||
		WHERE id = #{id}
 | 
			
		||||
	</update>
 | 
			
		||||
    <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`)
 | 
			
		||||
        values ( #{appname}, #{title}, #{addressType}, #{addressList}, #{updateTime} );
 | 
			
		||||
    </insert>
 | 
			
		||||
 | 
			
		||||
	<delete id="remove" parameterType="java.lang.Integer" >
 | 
			
		||||
		DELETE FROM xxl_job_group
 | 
			
		||||
		WHERE id = #{id}
 | 
			
		||||
	</delete>
 | 
			
		||||
    <update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobGroup" >
 | 
			
		||||
        UPDATE xxl_job_group
 | 
			
		||||
        SET `app_name` = #{appname},
 | 
			
		||||
            `title` = #{title},
 | 
			
		||||
            `address_type` = #{addressType},
 | 
			
		||||
            `address_list` = #{addressList},
 | 
			
		||||
            `update_time` = #{updateTime}
 | 
			
		||||
        WHERE id = #{id}
 | 
			
		||||
    </update>
 | 
			
		||||
 | 
			
		||||
	<select id="load" parameterType="java.lang.Integer" resultMap="XxlJobGroup">
 | 
			
		||||
		SELECT <include refid="Base_Column_List" />
 | 
			
		||||
		FROM xxl_job_group AS t
 | 
			
		||||
		WHERE t.id = #{id}
 | 
			
		||||
	</select>
 | 
			
		||||
    <delete id="remove" parameterType="java.lang.Integer" >
 | 
			
		||||
        DELETE FROM xxl_job_group
 | 
			
		||||
        WHERE id = #{id}
 | 
			
		||||
    </delete>
 | 
			
		||||
 | 
			
		||||
	<select id="pageList" parameterType="java.util.HashMap" resultMap="XxlJobGroup">
 | 
			
		||||
		SELECT <include refid="Base_Column_List" />
 | 
			
		||||
		FROM xxl_job_group AS t
 | 
			
		||||
		<trim prefix="WHERE" prefixOverrides="AND | OR" >
 | 
			
		||||
			<if test="appname != null and appname != ''">
 | 
			
		||||
				AND t.app_name like CONCAT(CONCAT('%', #{appname}), '%')
 | 
			
		||||
			</if>
 | 
			
		||||
			<if test="title != null and title != ''">
 | 
			
		||||
				AND t.title like CONCAT(CONCAT('%', #{title}), '%')
 | 
			
		||||
			</if>
 | 
			
		||||
		</trim>
 | 
			
		||||
		ORDER BY t.app_name, t.title, t.id ASC
 | 
			
		||||
		LIMIT #{offset}, #{pagesize}
 | 
			
		||||
	</select>
 | 
			
		||||
    <select id="load" parameterType="java.lang.Integer" resultMap="XxlJobGroup">
 | 
			
		||||
        SELECT <include refid="Base_Column_List" />
 | 
			
		||||
        FROM xxl_job_group AS t
 | 
			
		||||
        WHERE t.id = #{id}
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
	<select id="pageListCount" parameterType="java.util.HashMap" resultType="int">
 | 
			
		||||
		SELECT count(1)
 | 
			
		||||
		FROM xxl_job_group AS t
 | 
			
		||||
		<trim prefix="WHERE" prefixOverrides="AND | OR" >
 | 
			
		||||
			<if test="appname != null and appname != ''">
 | 
			
		||||
				AND t.app_name like CONCAT(CONCAT('%', #{appname}), '%')
 | 
			
		||||
			</if>
 | 
			
		||||
			<if test="title != null and title != ''">
 | 
			
		||||
				AND t.title like CONCAT(CONCAT('%', #{title}), '%')
 | 
			
		||||
			</if>
 | 
			
		||||
		</trim>
 | 
			
		||||
	</select>
 | 
			
		||||
    <select id="pageList" parameterType="java.util.HashMap" resultMap="XxlJobGroup">
 | 
			
		||||
        SELECT <include refid="Base_Column_List" />
 | 
			
		||||
        FROM xxl_job_group AS t
 | 
			
		||||
        <trim prefix="WHERE" prefixOverrides="AND | OR" >
 | 
			
		||||
            <if test="appname != null and appname != ''">
 | 
			
		||||
                AND t.app_name like CONCAT(CONCAT('%', #{appname}), '%')
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="title != null and title != ''">
 | 
			
		||||
                AND t.title like CONCAT(CONCAT('%', #{title}), '%')
 | 
			
		||||
            </if>
 | 
			
		||||
        </trim>
 | 
			
		||||
        ORDER BY t.app_name, t.title, t.id ASC
 | 
			
		||||
        LIMIT #{offset}, #{pagesize}
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
    <select id="pageListCount" parameterType="java.util.HashMap" resultType="int">
 | 
			
		||||
        SELECT count(1)
 | 
			
		||||
        FROM xxl_job_group AS t
 | 
			
		||||
        <trim prefix="WHERE" prefixOverrides="AND | OR" >
 | 
			
		||||
            <if test="appname != null and appname != ''">
 | 
			
		||||
                AND t.app_name like CONCAT(CONCAT('%', #{appname}), '%')
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="title != null and title != ''">
 | 
			
		||||
                AND t.title like CONCAT(CONCAT('%', #{title}), '%')
 | 
			
		||||
            </if>
 | 
			
		||||
        </trim>
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,240 +1,240 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<!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">
 | 
			
		||||
 | 
			
		||||
	<resultMap id="XxlJobInfo" type="com.xxl.job.admin.core.model.XxlJobInfo" >
 | 
			
		||||
		<result column="id" property="id" />
 | 
			
		||||
    <resultMap id="XxlJobInfo" type="com.xxl.job.admin.core.model.XxlJobInfo" >
 | 
			
		||||
        <result column="id" property="id" />
 | 
			
		||||
 | 
			
		||||
		<result column="job_group" property="jobGroup" />
 | 
			
		||||
	    <result column="job_desc" property="jobDesc" />
 | 
			
		||||
        <result column="job_group" property="jobGroup" />
 | 
			
		||||
        <result column="job_desc" property="jobDesc" />
 | 
			
		||||
 | 
			
		||||
	    <result column="add_time" property="addTime" />
 | 
			
		||||
	    <result column="update_time" property="updateTime" />
 | 
			
		||||
        <result column="add_time" property="addTime" />
 | 
			
		||||
        <result column="update_time" property="updateTime" />
 | 
			
		||||
 | 
			
		||||
	    <result column="author" property="author" />
 | 
			
		||||
	    <result column="alarm_email" property="alarmEmail" />
 | 
			
		||||
        <result column="author" property="author" />
 | 
			
		||||
        <result column="alarm_email" property="alarmEmail" />
 | 
			
		||||
 | 
			
		||||
		<result column="schedule_type" property="scheduleType" />
 | 
			
		||||
		<result column="schedule_conf" property="scheduleConf" />
 | 
			
		||||
		<result column="misfire_strategy" property="misfireStrategy" />
 | 
			
		||||
        <result column="schedule_type" property="scheduleType" />
 | 
			
		||||
        <result column="schedule_conf" property="scheduleConf" />
 | 
			
		||||
        <result column="misfire_strategy" property="misfireStrategy" />
 | 
			
		||||
 | 
			
		||||
		<result column="executor_route_strategy" property="executorRouteStrategy" />
 | 
			
		||||
		<result column="executor_handler" property="executorHandler" />
 | 
			
		||||
	    <result column="executor_param" property="executorParam" />
 | 
			
		||||
		<result column="executor_block_strategy" property="executorBlockStrategy" />
 | 
			
		||||
		<result column="executor_timeout" property="executorTimeout" />
 | 
			
		||||
		<result column="executor_fail_retry_count" property="executorFailRetryCount" />
 | 
			
		||||
        <result column="executor_route_strategy" property="executorRouteStrategy" />
 | 
			
		||||
        <result column="executor_handler" property="executorHandler" />
 | 
			
		||||
        <result column="executor_param" property="executorParam" />
 | 
			
		||||
        <result column="executor_block_strategy" property="executorBlockStrategy" />
 | 
			
		||||
        <result column="executor_timeout" property="executorTimeout" />
 | 
			
		||||
        <result column="executor_fail_retry_count" property="executorFailRetryCount" />
 | 
			
		||||
 | 
			
		||||
	    <result column="glue_type" property="glueType" />
 | 
			
		||||
	    <result column="glue_source" property="glueSource" />
 | 
			
		||||
	    <result column="glue_remark" property="glueRemark" />
 | 
			
		||||
		<result column="glue_updatetime" property="glueUpdatetime" />
 | 
			
		||||
        <result column="glue_type" property="glueType" />
 | 
			
		||||
        <result column="glue_source" property="glueSource" />
 | 
			
		||||
        <result column="glue_remark" property="glueRemark" />
 | 
			
		||||
        <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_last_time" property="triggerLastTime" />
 | 
			
		||||
		<result column="trigger_next_time" property="triggerNextTime" />
 | 
			
		||||
	</resultMap>
 | 
			
		||||
        <result column="trigger_status" property="triggerStatus" />
 | 
			
		||||
        <result column="trigger_last_time" property="triggerLastTime" />
 | 
			
		||||
        <result column="trigger_next_time" property="triggerNextTime" />
 | 
			
		||||
    </resultMap>
 | 
			
		||||
 | 
			
		||||
	<sql id="Base_Column_List">
 | 
			
		||||
		t.id,
 | 
			
		||||
		t.job_group,
 | 
			
		||||
		t.job_desc,
 | 
			
		||||
		t.add_time,
 | 
			
		||||
		t.update_time,
 | 
			
		||||
		t.author,
 | 
			
		||||
		t.alarm_email,
 | 
			
		||||
		t.schedule_type,
 | 
			
		||||
		t.schedule_conf,
 | 
			
		||||
		t.misfire_strategy,
 | 
			
		||||
		t.executor_route_strategy,
 | 
			
		||||
		t.executor_handler,
 | 
			
		||||
		t.executor_param,
 | 
			
		||||
		t.executor_block_strategy,
 | 
			
		||||
		t.executor_timeout,
 | 
			
		||||
		t.executor_fail_retry_count,
 | 
			
		||||
		t.glue_type,
 | 
			
		||||
		t.glue_source,
 | 
			
		||||
		t.glue_remark,
 | 
			
		||||
		t.glue_updatetime,
 | 
			
		||||
		t.child_jobid,
 | 
			
		||||
		t.trigger_status,
 | 
			
		||||
		t.trigger_last_time,
 | 
			
		||||
		t.trigger_next_time
 | 
			
		||||
	</sql>
 | 
			
		||||
    <sql id="Base_Column_List">
 | 
			
		||||
        t.id,
 | 
			
		||||
        t.job_group,
 | 
			
		||||
        t.job_desc,
 | 
			
		||||
        t.add_time,
 | 
			
		||||
        t.update_time,
 | 
			
		||||
        t.author,
 | 
			
		||||
        t.alarm_email,
 | 
			
		||||
        t.schedule_type,
 | 
			
		||||
        t.schedule_conf,
 | 
			
		||||
        t.misfire_strategy,
 | 
			
		||||
        t.executor_route_strategy,
 | 
			
		||||
        t.executor_handler,
 | 
			
		||||
        t.executor_param,
 | 
			
		||||
        t.executor_block_strategy,
 | 
			
		||||
        t.executor_timeout,
 | 
			
		||||
        t.executor_fail_retry_count,
 | 
			
		||||
        t.glue_type,
 | 
			
		||||
        t.glue_source,
 | 
			
		||||
        t.glue_remark,
 | 
			
		||||
        t.glue_updatetime,
 | 
			
		||||
        t.child_jobid,
 | 
			
		||||
        t.trigger_status,
 | 
			
		||||
        t.trigger_last_time,
 | 
			
		||||
        t.trigger_next_time
 | 
			
		||||
    </sql>
 | 
			
		||||
 | 
			
		||||
	<select id="pageList" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
 | 
			
		||||
		SELECT <include refid="Base_Column_List" />
 | 
			
		||||
		FROM xxl_job_info AS t
 | 
			
		||||
		<trim prefix="WHERE" prefixOverrides="AND | OR" >
 | 
			
		||||
			<if test="jobGroup gt 0">
 | 
			
		||||
				AND t.job_group = #{jobGroup}
 | 
			
		||||
			</if>
 | 
			
		||||
    <select id="pageList" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
 | 
			
		||||
        SELECT <include refid="Base_Column_List" />
 | 
			
		||||
        FROM xxl_job_info AS t
 | 
			
		||||
        <trim prefix="WHERE" prefixOverrides="AND | OR" >
 | 
			
		||||
            <if test="jobGroup gt 0">
 | 
			
		||||
                AND t.job_group = #{jobGroup}
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="triggerStatus gte 0">
 | 
			
		||||
                AND t.trigger_status = #{triggerStatus}
 | 
			
		||||
            </if>
 | 
			
		||||
			<if test="jobDesc != null and jobDesc != ''">
 | 
			
		||||
				AND t.job_desc like CONCAT(CONCAT('%', #{jobDesc}), '%')
 | 
			
		||||
			</if>
 | 
			
		||||
			<if test="executorHandler != null and executorHandler != ''">
 | 
			
		||||
				AND t.executor_handler like CONCAT(CONCAT('%', #{executorHandler}), '%')
 | 
			
		||||
			</if>
 | 
			
		||||
			<if test="author != null and author != ''">
 | 
			
		||||
				AND t.author like CONCAT(CONCAT('%', #{author}), '%')
 | 
			
		||||
			</if>
 | 
			
		||||
		</trim>
 | 
			
		||||
		ORDER BY id DESC
 | 
			
		||||
		LIMIT #{offset}, #{pagesize}
 | 
			
		||||
	</select>
 | 
			
		||||
            <if test="jobDesc != null and jobDesc != ''">
 | 
			
		||||
                AND t.job_desc like CONCAT(CONCAT('%', #{jobDesc}), '%')
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="executorHandler != null and executorHandler != ''">
 | 
			
		||||
                AND t.executor_handler like CONCAT(CONCAT('%', #{executorHandler}), '%')
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="author != null and author != ''">
 | 
			
		||||
                AND t.author like CONCAT(CONCAT('%', #{author}), '%')
 | 
			
		||||
            </if>
 | 
			
		||||
        </trim>
 | 
			
		||||
        ORDER BY id DESC
 | 
			
		||||
        LIMIT #{offset}, #{pagesize}
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
	<select id="pageListCount" parameterType="java.util.HashMap" resultType="int">
 | 
			
		||||
		SELECT count(1)
 | 
			
		||||
		FROM xxl_job_info AS t
 | 
			
		||||
		<trim prefix="WHERE" prefixOverrides="AND | OR" >
 | 
			
		||||
			<if test="jobGroup gt 0">
 | 
			
		||||
				AND t.job_group = #{jobGroup}
 | 
			
		||||
			</if>
 | 
			
		||||
    <select id="pageListCount" parameterType="java.util.HashMap" resultType="int">
 | 
			
		||||
        SELECT count(1)
 | 
			
		||||
        FROM xxl_job_info AS t
 | 
			
		||||
        <trim prefix="WHERE" prefixOverrides="AND | OR" >
 | 
			
		||||
            <if test="jobGroup gt 0">
 | 
			
		||||
                AND t.job_group = #{jobGroup}
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="triggerStatus gte 0">
 | 
			
		||||
                AND t.trigger_status = #{triggerStatus}
 | 
			
		||||
            </if>
 | 
			
		||||
			<if test="jobDesc != null and jobDesc != ''">
 | 
			
		||||
				AND t.job_desc like CONCAT(CONCAT('%', #{jobDesc}), '%')
 | 
			
		||||
			</if>
 | 
			
		||||
			<if test="executorHandler != null and executorHandler != ''">
 | 
			
		||||
				AND t.executor_handler like CONCAT(CONCAT('%', #{executorHandler}), '%')
 | 
			
		||||
			</if>
 | 
			
		||||
			<if test="author != null and author != ''">
 | 
			
		||||
				AND t.author like CONCAT(CONCAT('%', #{author}), '%')
 | 
			
		||||
			</if>
 | 
			
		||||
		</trim>
 | 
			
		||||
	</select>
 | 
			
		||||
            <if test="jobDesc != null and jobDesc != ''">
 | 
			
		||||
                AND t.job_desc like CONCAT(CONCAT('%', #{jobDesc}), '%')
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="executorHandler != null and executorHandler != ''">
 | 
			
		||||
                AND t.executor_handler like CONCAT(CONCAT('%', #{executorHandler}), '%')
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="author != null and author != ''">
 | 
			
		||||
                AND t.author like CONCAT(CONCAT('%', #{author}), '%')
 | 
			
		||||
            </if>
 | 
			
		||||
        </trim>
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
	<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" useGeneratedKeys="true" keyProperty="id" >
 | 
			
		||||
		INSERT INTO xxl_job_info (
 | 
			
		||||
			job_group,
 | 
			
		||||
			job_desc,
 | 
			
		||||
			add_time,
 | 
			
		||||
			update_time,
 | 
			
		||||
			author,
 | 
			
		||||
			alarm_email,
 | 
			
		||||
			schedule_type,
 | 
			
		||||
			schedule_conf,
 | 
			
		||||
			misfire_strategy,
 | 
			
		||||
    <insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" useGeneratedKeys="true" keyProperty="id" >
 | 
			
		||||
        INSERT INTO xxl_job_info (
 | 
			
		||||
            job_group,
 | 
			
		||||
            job_desc,
 | 
			
		||||
            add_time,
 | 
			
		||||
            update_time,
 | 
			
		||||
            author,
 | 
			
		||||
            alarm_email,
 | 
			
		||||
            schedule_type,
 | 
			
		||||
            schedule_conf,
 | 
			
		||||
            misfire_strategy,
 | 
			
		||||
            executor_route_strategy,
 | 
			
		||||
			executor_handler,
 | 
			
		||||
			executor_param,
 | 
			
		||||
			executor_block_strategy,
 | 
			
		||||
			executor_timeout,
 | 
			
		||||
			executor_fail_retry_count,
 | 
			
		||||
			glue_type,
 | 
			
		||||
			glue_source,
 | 
			
		||||
			glue_remark,
 | 
			
		||||
			glue_updatetime,
 | 
			
		||||
			child_jobid,
 | 
			
		||||
			trigger_status,
 | 
			
		||||
			trigger_last_time,
 | 
			
		||||
			trigger_next_time
 | 
			
		||||
		) VALUES (
 | 
			
		||||
			#{jobGroup},
 | 
			
		||||
			#{jobDesc},
 | 
			
		||||
			#{addTime},
 | 
			
		||||
			#{updateTime},
 | 
			
		||||
			#{author},
 | 
			
		||||
			#{alarmEmail},
 | 
			
		||||
			#{scheduleType},
 | 
			
		||||
			#{scheduleConf},
 | 
			
		||||
			#{misfireStrategy},
 | 
			
		||||
			#{executorRouteStrategy},
 | 
			
		||||
			#{executorHandler},
 | 
			
		||||
			#{executorParam},
 | 
			
		||||
			#{executorBlockStrategy},
 | 
			
		||||
			#{executorTimeout},
 | 
			
		||||
			#{executorFailRetryCount},
 | 
			
		||||
			#{glueType},
 | 
			
		||||
			#{glueSource},
 | 
			
		||||
			#{glueRemark},
 | 
			
		||||
			#{glueUpdatetime},
 | 
			
		||||
			#{childJobId},
 | 
			
		||||
			#{triggerStatus},
 | 
			
		||||
			#{triggerLastTime},
 | 
			
		||||
			#{triggerNextTime}
 | 
			
		||||
		);
 | 
			
		||||
		<!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
 | 
			
		||||
			SELECT LAST_INSERT_ID()
 | 
			
		||||
			/*SELECT @@IDENTITY AS id*/
 | 
			
		||||
		</selectKey>-->
 | 
			
		||||
	</insert>
 | 
			
		||||
            executor_handler,
 | 
			
		||||
            executor_param,
 | 
			
		||||
            executor_block_strategy,
 | 
			
		||||
            executor_timeout,
 | 
			
		||||
            executor_fail_retry_count,
 | 
			
		||||
            glue_type,
 | 
			
		||||
            glue_source,
 | 
			
		||||
            glue_remark,
 | 
			
		||||
            glue_updatetime,
 | 
			
		||||
            child_jobid,
 | 
			
		||||
            trigger_status,
 | 
			
		||||
            trigger_last_time,
 | 
			
		||||
            trigger_next_time
 | 
			
		||||
        ) VALUES (
 | 
			
		||||
            #{jobGroup},
 | 
			
		||||
            #{jobDesc},
 | 
			
		||||
            #{addTime},
 | 
			
		||||
            #{updateTime},
 | 
			
		||||
            #{author},
 | 
			
		||||
            #{alarmEmail},
 | 
			
		||||
            #{scheduleType},
 | 
			
		||||
            #{scheduleConf},
 | 
			
		||||
            #{misfireStrategy},
 | 
			
		||||
            #{executorRouteStrategy},
 | 
			
		||||
            #{executorHandler},
 | 
			
		||||
            #{executorParam},
 | 
			
		||||
            #{executorBlockStrategy},
 | 
			
		||||
            #{executorTimeout},
 | 
			
		||||
            #{executorFailRetryCount},
 | 
			
		||||
            #{glueType},
 | 
			
		||||
            #{glueSource},
 | 
			
		||||
            #{glueRemark},
 | 
			
		||||
            #{glueUpdatetime},
 | 
			
		||||
            #{childJobId},
 | 
			
		||||
            #{triggerStatus},
 | 
			
		||||
            #{triggerLastTime},
 | 
			
		||||
            #{triggerNextTime}
 | 
			
		||||
        );
 | 
			
		||||
        <!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
 | 
			
		||||
            SELECT LAST_INSERT_ID()
 | 
			
		||||
            /*SELECT @@IDENTITY AS id*/
 | 
			
		||||
        </selectKey>-->
 | 
			
		||||
    </insert>
 | 
			
		||||
 | 
			
		||||
	<select id="loadById" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
 | 
			
		||||
		SELECT <include refid="Base_Column_List" />
 | 
			
		||||
		FROM xxl_job_info AS t
 | 
			
		||||
		WHERE t.id = #{id}
 | 
			
		||||
	</select>
 | 
			
		||||
    <select id="loadById" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
 | 
			
		||||
        SELECT <include refid="Base_Column_List" />
 | 
			
		||||
        FROM xxl_job_info AS t
 | 
			
		||||
        WHERE t.id = #{id}
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
	<update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" >
 | 
			
		||||
		UPDATE xxl_job_info
 | 
			
		||||
		SET
 | 
			
		||||
			job_group = #{jobGroup},
 | 
			
		||||
			job_desc = #{jobDesc},
 | 
			
		||||
			update_time = #{updateTime},
 | 
			
		||||
			author = #{author},
 | 
			
		||||
			alarm_email = #{alarmEmail},
 | 
			
		||||
			schedule_type = #{scheduleType},
 | 
			
		||||
			schedule_conf = #{scheduleConf},
 | 
			
		||||
			misfire_strategy = #{misfireStrategy},
 | 
			
		||||
			executor_route_strategy = #{executorRouteStrategy},
 | 
			
		||||
			executor_handler = #{executorHandler},
 | 
			
		||||
			executor_param = #{executorParam},
 | 
			
		||||
			executor_block_strategy = #{executorBlockStrategy},
 | 
			
		||||
			executor_timeout = ${executorTimeout},
 | 
			
		||||
			executor_fail_retry_count = ${executorFailRetryCount},
 | 
			
		||||
			glue_type = #{glueType},
 | 
			
		||||
			glue_source = #{glueSource},
 | 
			
		||||
			glue_remark = #{glueRemark},
 | 
			
		||||
			glue_updatetime = #{glueUpdatetime},
 | 
			
		||||
			child_jobid = #{childJobId},
 | 
			
		||||
			trigger_status = #{triggerStatus},
 | 
			
		||||
			trigger_last_time = #{triggerLastTime},
 | 
			
		||||
			trigger_next_time = #{triggerNextTime}
 | 
			
		||||
		WHERE id = #{id}
 | 
			
		||||
	</update>
 | 
			
		||||
    <update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" >
 | 
			
		||||
        UPDATE xxl_job_info
 | 
			
		||||
        SET
 | 
			
		||||
            job_group = #{jobGroup},
 | 
			
		||||
            job_desc = #{jobDesc},
 | 
			
		||||
            update_time = #{updateTime},
 | 
			
		||||
            author = #{author},
 | 
			
		||||
            alarm_email = #{alarmEmail},
 | 
			
		||||
            schedule_type = #{scheduleType},
 | 
			
		||||
            schedule_conf = #{scheduleConf},
 | 
			
		||||
            misfire_strategy = #{misfireStrategy},
 | 
			
		||||
            executor_route_strategy = #{executorRouteStrategy},
 | 
			
		||||
            executor_handler = #{executorHandler},
 | 
			
		||||
            executor_param = #{executorParam},
 | 
			
		||||
            executor_block_strategy = #{executorBlockStrategy},
 | 
			
		||||
            executor_timeout = ${executorTimeout},
 | 
			
		||||
            executor_fail_retry_count = ${executorFailRetryCount},
 | 
			
		||||
            glue_type = #{glueType},
 | 
			
		||||
            glue_source = #{glueSource},
 | 
			
		||||
            glue_remark = #{glueRemark},
 | 
			
		||||
            glue_updatetime = #{glueUpdatetime},
 | 
			
		||||
            child_jobid = #{childJobId},
 | 
			
		||||
            trigger_status = #{triggerStatus},
 | 
			
		||||
            trigger_last_time = #{triggerLastTime},
 | 
			
		||||
            trigger_next_time = #{triggerNextTime}
 | 
			
		||||
        WHERE id = #{id}
 | 
			
		||||
    </update>
 | 
			
		||||
 | 
			
		||||
	<delete id="delete" parameterType="java.util.HashMap">
 | 
			
		||||
		DELETE
 | 
			
		||||
		FROM xxl_job_info
 | 
			
		||||
		WHERE id = #{id}
 | 
			
		||||
	</delete>
 | 
			
		||||
    <delete id="delete" parameterType="java.util.HashMap">
 | 
			
		||||
        DELETE
 | 
			
		||||
        FROM xxl_job_info
 | 
			
		||||
        WHERE id = #{id}
 | 
			
		||||
    </delete>
 | 
			
		||||
 | 
			
		||||
	<select id="getJobsByGroup" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
 | 
			
		||||
		SELECT <include refid="Base_Column_List" />
 | 
			
		||||
		FROM xxl_job_info AS t
 | 
			
		||||
		WHERE t.job_group = #{jobGroup}
 | 
			
		||||
	</select>
 | 
			
		||||
    <select id="getJobsByGroup" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
 | 
			
		||||
        SELECT <include refid="Base_Column_List" />
 | 
			
		||||
        FROM xxl_job_info AS t
 | 
			
		||||
        WHERE t.job_group = #{jobGroup}
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
	<select id="findAllCount" resultType="int">
 | 
			
		||||
		SELECT count(1)
 | 
			
		||||
		FROM xxl_job_info
 | 
			
		||||
	</select>
 | 
			
		||||
    <select id="findAllCount" resultType="int">
 | 
			
		||||
        SELECT count(1)
 | 
			
		||||
        FROM xxl_job_info
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	<select id="scheduleJobQuery" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
 | 
			
		||||
		SELECT <include refid="Base_Column_List" />
 | 
			
		||||
		FROM xxl_job_info AS t
 | 
			
		||||
		WHERE t.trigger_status = 1
 | 
			
		||||
			and t.trigger_next_time <![CDATA[ <= ]]> #{maxNextTime}
 | 
			
		||||
		ORDER BY id ASC
 | 
			
		||||
		LIMIT #{pagesize}
 | 
			
		||||
	</select>
 | 
			
		||||
    <select id="scheduleJobQuery" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
 | 
			
		||||
        SELECT <include refid="Base_Column_List" />
 | 
			
		||||
        FROM xxl_job_info AS t
 | 
			
		||||
        WHERE t.trigger_status = 1
 | 
			
		||||
            and t.trigger_next_time <![CDATA[ <= ]]> #{maxNextTime}
 | 
			
		||||
        ORDER BY id ASC
 | 
			
		||||
        LIMIT #{pagesize}
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
	<update id="scheduleUpdate" parameterType="com.xxl.job.admin.core.model.XxlJobInfo"  >
 | 
			
		||||
		UPDATE xxl_job_info
 | 
			
		||||
		SET
 | 
			
		||||
			trigger_last_time = #{triggerLastTime},
 | 
			
		||||
			trigger_next_time = #{triggerNextTime},
 | 
			
		||||
			trigger_status = #{triggerStatus}
 | 
			
		||||
		WHERE id = #{id}
 | 
			
		||||
	</update>
 | 
			
		||||
    <update id="scheduleUpdate" parameterType="com.xxl.job.admin.core.model.XxlJobInfo"  >
 | 
			
		||||
        UPDATE xxl_job_info
 | 
			
		||||
        SET
 | 
			
		||||
            trigger_last_time = #{triggerLastTime},
 | 
			
		||||
            trigger_next_time = #{triggerNextTime},
 | 
			
		||||
            trigger_status = #{triggerStatus}
 | 
			
		||||
        WHERE id = #{id}
 | 
			
		||||
    </update>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
</mapper>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,71 +1,71 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
 | 
			
		||||
	"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
			
		||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		||||
    "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
			
		||||
<mapper namespace="com.xxl.job.admin.dao.XxlJobLogGlueDao">
 | 
			
		||||
	
 | 
			
		||||
	<resultMap id="XxlJobLogGlue" type="com.xxl.job.admin.core.model.XxlJobLogGlue" >
 | 
			
		||||
		<result column="id" property="id" />
 | 
			
		||||
	    <result column="job_id" property="jobId" />
 | 
			
		||||
		<result column="glue_type" property="glueType" />
 | 
			
		||||
	    <result column="glue_source" property="glueSource" />
 | 
			
		||||
	    <result column="glue_remark" property="glueRemark" />
 | 
			
		||||
	    <result column="add_time" property="addTime" />
 | 
			
		||||
	    <result column="update_time" property="updateTime" />
 | 
			
		||||
	</resultMap>
 | 
			
		||||
 | 
			
		||||
	<sql id="Base_Column_List">
 | 
			
		||||
		t.id,
 | 
			
		||||
		t.job_id,
 | 
			
		||||
		t.glue_type,
 | 
			
		||||
		t.glue_source,
 | 
			
		||||
		t.glue_remark,
 | 
			
		||||
		t.add_time,
 | 
			
		||||
		t.update_time
 | 
			
		||||
	</sql>
 | 
			
		||||
	
 | 
			
		||||
	<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLogGlue" useGeneratedKeys="true" keyProperty="id" >
 | 
			
		||||
		INSERT INTO xxl_job_logglue (
 | 
			
		||||
			`job_id`,
 | 
			
		||||
			`glue_type`,
 | 
			
		||||
			`glue_source`,
 | 
			
		||||
			`glue_remark`,
 | 
			
		||||
			`add_time`, 
 | 
			
		||||
			`update_time`
 | 
			
		||||
		) VALUES (
 | 
			
		||||
			#{jobId},
 | 
			
		||||
			#{glueType},
 | 
			
		||||
			#{glueSource},
 | 
			
		||||
			#{glueRemark},
 | 
			
		||||
			#{addTime},
 | 
			
		||||
			#{updateTime}
 | 
			
		||||
		);
 | 
			
		||||
		<!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
 | 
			
		||||
			SELECT LAST_INSERT_ID() 
 | 
			
		||||
		</selectKey>-->
 | 
			
		||||
	</insert>
 | 
			
		||||
	
 | 
			
		||||
	<select id="findByJobId" parameterType="java.lang.Integer" resultMap="XxlJobLogGlue">
 | 
			
		||||
		SELECT <include refid="Base_Column_List" />
 | 
			
		||||
		FROM xxl_job_logglue AS t
 | 
			
		||||
		WHERE t.job_id = #{jobId}
 | 
			
		||||
		ORDER BY id DESC
 | 
			
		||||
	</select>
 | 
			
		||||
	
 | 
			
		||||
	<delete id="removeOld" >
 | 
			
		||||
		DELETE FROM xxl_job_logglue
 | 
			
		||||
		WHERE id NOT in(
 | 
			
		||||
			SELECT id FROM(
 | 
			
		||||
				SELECT id FROM xxl_job_logglue
 | 
			
		||||
				WHERE `job_id` = #{jobId}
 | 
			
		||||
				ORDER BY update_time desc
 | 
			
		||||
				LIMIT 0, #{limit}
 | 
			
		||||
			) t1
 | 
			
		||||
		) AND `job_id` = #{jobId}
 | 
			
		||||
	</delete>
 | 
			
		||||
	
 | 
			
		||||
	<delete id="deleteByJobId" parameterType="java.lang.Integer" >
 | 
			
		||||
		DELETE FROM xxl_job_logglue
 | 
			
		||||
		WHERE `job_id` = #{jobId}
 | 
			
		||||
	</delete>
 | 
			
		||||
	
 | 
			
		||||
</mapper>
 | 
			
		||||
    <resultMap id="XxlJobLogGlue" type="com.xxl.job.admin.core.model.XxlJobLogGlue" >
 | 
			
		||||
        <result column="id" property="id" />
 | 
			
		||||
        <result column="job_id" property="jobId" />
 | 
			
		||||
        <result column="glue_type" property="glueType" />
 | 
			
		||||
        <result column="glue_source" property="glueSource" />
 | 
			
		||||
        <result column="glue_remark" property="glueRemark" />
 | 
			
		||||
        <result column="add_time" property="addTime" />
 | 
			
		||||
        <result column="update_time" property="updateTime" />
 | 
			
		||||
    </resultMap>
 | 
			
		||||
 | 
			
		||||
    <sql id="Base_Column_List">
 | 
			
		||||
        t.id,
 | 
			
		||||
        t.job_id,
 | 
			
		||||
        t.glue_type,
 | 
			
		||||
        t.glue_source,
 | 
			
		||||
        t.glue_remark,
 | 
			
		||||
        t.add_time,
 | 
			
		||||
        t.update_time
 | 
			
		||||
    </sql>
 | 
			
		||||
 | 
			
		||||
    <insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLogGlue" useGeneratedKeys="true" keyProperty="id" >
 | 
			
		||||
        INSERT INTO xxl_job_logglue (
 | 
			
		||||
            `job_id`,
 | 
			
		||||
            `glue_type`,
 | 
			
		||||
            `glue_source`,
 | 
			
		||||
            `glue_remark`,
 | 
			
		||||
            `add_time`,
 | 
			
		||||
            `update_time`
 | 
			
		||||
        ) VALUES (
 | 
			
		||||
            #{jobId},
 | 
			
		||||
            #{glueType},
 | 
			
		||||
            #{glueSource},
 | 
			
		||||
            #{glueRemark},
 | 
			
		||||
            #{addTime},
 | 
			
		||||
            #{updateTime}
 | 
			
		||||
        );
 | 
			
		||||
        <!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
 | 
			
		||||
            SELECT LAST_INSERT_ID()
 | 
			
		||||
        </selectKey>-->
 | 
			
		||||
    </insert>
 | 
			
		||||
 | 
			
		||||
    <select id="findByJobId" parameterType="java.lang.Integer" resultMap="XxlJobLogGlue">
 | 
			
		||||
        SELECT <include refid="Base_Column_List" />
 | 
			
		||||
        FROM xxl_job_logglue AS t
 | 
			
		||||
        WHERE t.job_id = #{jobId}
 | 
			
		||||
        ORDER BY id DESC
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <delete id="removeOld" >
 | 
			
		||||
        DELETE FROM xxl_job_logglue
 | 
			
		||||
        WHERE id NOT in(
 | 
			
		||||
            SELECT id FROM(
 | 
			
		||||
                SELECT id FROM xxl_job_logglue
 | 
			
		||||
                WHERE `job_id` = #{jobId}
 | 
			
		||||
                ORDER BY update_time desc
 | 
			
		||||
                LIMIT 0, #{limit}
 | 
			
		||||
            ) t1
 | 
			
		||||
        ) AND `job_id` = #{jobId}
 | 
			
		||||
    </delete>
 | 
			
		||||
 | 
			
		||||
    <delete id="deleteByJobId" parameterType="java.lang.Integer" >
 | 
			
		||||
        DELETE FROM xxl_job_logglue
 | 
			
		||||
        WHERE `job_id` = #{jobId}
 | 
			
		||||
    </delete>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,273 +1,273 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
 | 
			
		||||
	"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
			
		||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		||||
    "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
			
		||||
<mapper namespace="com.xxl.job.admin.dao.XxlJobLogDao">
 | 
			
		||||
	
 | 
			
		||||
	<resultMap id="XxlJobLog" type="com.xxl.job.admin.core.model.XxlJobLog" >
 | 
			
		||||
		<result column="id" property="id" />
 | 
			
		||||
 | 
			
		||||
		<result column="job_group" property="jobGroup" />
 | 
			
		||||
		<result column="job_id" property="jobId" />
 | 
			
		||||
    <resultMap id="XxlJobLog" type="com.xxl.job.admin.core.model.XxlJobLog" >
 | 
			
		||||
        <result column="id" property="id" />
 | 
			
		||||
 | 
			
		||||
		<result column="executor_address" property="executorAddress" />
 | 
			
		||||
		<result column="executor_handler" property="executorHandler" />
 | 
			
		||||
	    <result column="executor_param" property="executorParam" />
 | 
			
		||||
		<result column="executor_sharding_param" property="executorShardingParam" />
 | 
			
		||||
		<result column="executor_fail_retry_count" property="executorFailRetryCount" />
 | 
			
		||||
	    
 | 
			
		||||
	    <result column="trigger_time" property="triggerTime" />
 | 
			
		||||
	    <result column="trigger_code" property="triggerCode" />
 | 
			
		||||
	    <result column="trigger_msg" property="triggerMsg" />
 | 
			
		||||
	    
 | 
			
		||||
	    <result column="handle_time" property="handleTime" />
 | 
			
		||||
	    <result column="handle_code" property="handleCode" />
 | 
			
		||||
	    <result column="handle_msg" property="handleMsg" />
 | 
			
		||||
        <result column="job_group" property="jobGroup" />
 | 
			
		||||
        <result column="job_id" property="jobId" />
 | 
			
		||||
 | 
			
		||||
		<result column="alarm_status" property="alarmStatus" />
 | 
			
		||||
	</resultMap>
 | 
			
		||||
        <result column="executor_address" property="executorAddress" />
 | 
			
		||||
        <result column="executor_handler" property="executorHandler" />
 | 
			
		||||
        <result column="executor_param" property="executorParam" />
 | 
			
		||||
        <result column="executor_sharding_param" property="executorShardingParam" />
 | 
			
		||||
        <result column="executor_fail_retry_count" property="executorFailRetryCount" />
 | 
			
		||||
 | 
			
		||||
	<sql id="Base_Column_List">
 | 
			
		||||
		t.id,
 | 
			
		||||
		t.job_group,
 | 
			
		||||
		t.job_id,
 | 
			
		||||
		t.executor_address,
 | 
			
		||||
		t.executor_handler,
 | 
			
		||||
		t.executor_param,
 | 
			
		||||
		t.executor_sharding_param,
 | 
			
		||||
		t.executor_fail_retry_count,
 | 
			
		||||
		t.trigger_time,
 | 
			
		||||
		t.trigger_code,
 | 
			
		||||
		t.trigger_msg,
 | 
			
		||||
		t.handle_time,
 | 
			
		||||
		t.handle_code,
 | 
			
		||||
		t.handle_msg,
 | 
			
		||||
		t.alarm_status
 | 
			
		||||
	</sql>
 | 
			
		||||
	
 | 
			
		||||
	<select id="pageList" resultMap="XxlJobLog">
 | 
			
		||||
		SELECT <include refid="Base_Column_List" />
 | 
			
		||||
		FROM xxl_job_log AS t
 | 
			
		||||
		<trim prefix="WHERE" prefixOverrides="AND | OR" >
 | 
			
		||||
			<if test="jobId==0 and jobGroup gt 0">
 | 
			
		||||
				AND t.job_group = #{jobGroup}
 | 
			
		||||
			</if>
 | 
			
		||||
			<if test="jobId gt 0">
 | 
			
		||||
				AND t.job_id = #{jobId}
 | 
			
		||||
			</if>
 | 
			
		||||
			<if test="triggerTimeStart != null">
 | 
			
		||||
				AND t.trigger_time <![CDATA[ >= ]]> #{triggerTimeStart}
 | 
			
		||||
			</if>
 | 
			
		||||
			<if test="triggerTimeEnd != null">
 | 
			
		||||
				AND t.trigger_time <![CDATA[ <= ]]> #{triggerTimeEnd}
 | 
			
		||||
			</if>
 | 
			
		||||
			<if test="logStatus == 1" >
 | 
			
		||||
				AND t.handle_code = 200
 | 
			
		||||
			</if>
 | 
			
		||||
			<if test="logStatus == 2" >
 | 
			
		||||
				AND (
 | 
			
		||||
					t.trigger_code NOT IN (0, 200) OR
 | 
			
		||||
					t.handle_code NOT IN (0, 200)
 | 
			
		||||
				)
 | 
			
		||||
			</if>
 | 
			
		||||
			<if test="logStatus == 3" >
 | 
			
		||||
				AND t.trigger_code = 200
 | 
			
		||||
				AND t.handle_code = 0
 | 
			
		||||
			</if>
 | 
			
		||||
		</trim>
 | 
			
		||||
		ORDER BY t.trigger_time DESC
 | 
			
		||||
		LIMIT #{offset}, #{pagesize}
 | 
			
		||||
	</select>
 | 
			
		||||
	
 | 
			
		||||
	<select id="pageListCount" resultType="int">
 | 
			
		||||
		SELECT count(1)
 | 
			
		||||
		FROM xxl_job_log AS t
 | 
			
		||||
		<trim prefix="WHERE" prefixOverrides="AND | OR" >
 | 
			
		||||
			<if test="jobId==0 and jobGroup gt 0">
 | 
			
		||||
				AND t.job_group = #{jobGroup}
 | 
			
		||||
			</if>
 | 
			
		||||
			<if test="jobId gt 0">
 | 
			
		||||
				AND t.job_id = #{jobId}
 | 
			
		||||
			</if>
 | 
			
		||||
			<if test="triggerTimeStart != null">
 | 
			
		||||
				AND t.trigger_time <![CDATA[ >= ]]> #{triggerTimeStart}
 | 
			
		||||
			</if>
 | 
			
		||||
			<if test="triggerTimeEnd != null">
 | 
			
		||||
				AND t.trigger_time <![CDATA[ <= ]]> #{triggerTimeEnd}
 | 
			
		||||
			</if>
 | 
			
		||||
			<if test="logStatus == 1" >
 | 
			
		||||
				AND t.handle_code = 200
 | 
			
		||||
			</if>
 | 
			
		||||
			<if test="logStatus == 2" >
 | 
			
		||||
				AND (
 | 
			
		||||
					t.trigger_code NOT IN (0, 200) OR
 | 
			
		||||
					t.handle_code NOT IN (0, 200)
 | 
			
		||||
				)
 | 
			
		||||
			</if>
 | 
			
		||||
			<if test="logStatus == 3" >
 | 
			
		||||
				AND t.trigger_code = 200
 | 
			
		||||
				AND t.handle_code = 0
 | 
			
		||||
			</if>
 | 
			
		||||
		</trim>
 | 
			
		||||
	</select>
 | 
			
		||||
	
 | 
			
		||||
	<select id="load" parameterType="java.lang.Long" resultMap="XxlJobLog">
 | 
			
		||||
		SELECT <include refid="Base_Column_List" />
 | 
			
		||||
		FROM xxl_job_log AS t
 | 
			
		||||
		WHERE t.id = #{id}
 | 
			
		||||
	</select>
 | 
			
		||||
        <result column="trigger_time" property="triggerTime" />
 | 
			
		||||
        <result column="trigger_code" property="triggerCode" />
 | 
			
		||||
        <result column="trigger_msg" property="triggerMsg" />
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLog" useGeneratedKeys="true" keyProperty="id" >
 | 
			
		||||
		INSERT INTO xxl_job_log (
 | 
			
		||||
			`job_group`,
 | 
			
		||||
			`job_id`,
 | 
			
		||||
			`trigger_time`,
 | 
			
		||||
			`trigger_code`,
 | 
			
		||||
			`handle_code`
 | 
			
		||||
		) VALUES (
 | 
			
		||||
			#{jobGroup},
 | 
			
		||||
			#{jobId},
 | 
			
		||||
			#{triggerTime},
 | 
			
		||||
			#{triggerCode},
 | 
			
		||||
			#{handleCode}
 | 
			
		||||
		);
 | 
			
		||||
		<!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
 | 
			
		||||
			SELECT LAST_INSERT_ID() 
 | 
			
		||||
		</selectKey>-->
 | 
			
		||||
	</insert>
 | 
			
		||||
        <result column="handle_time" property="handleTime" />
 | 
			
		||||
        <result column="handle_code" property="handleCode" />
 | 
			
		||||
        <result column="handle_msg" property="handleMsg" />
 | 
			
		||||
 | 
			
		||||
	<update id="updateTriggerInfo" >
 | 
			
		||||
		UPDATE xxl_job_log
 | 
			
		||||
		SET
 | 
			
		||||
			`trigger_time`= #{triggerTime},
 | 
			
		||||
			`trigger_code`= #{triggerCode},
 | 
			
		||||
			`trigger_msg`= #{triggerMsg},
 | 
			
		||||
			`executor_address`= #{executorAddress},
 | 
			
		||||
			`executor_handler`=#{executorHandler},
 | 
			
		||||
			`executor_param`= #{executorParam},
 | 
			
		||||
			`executor_sharding_param`= #{executorShardingParam},
 | 
			
		||||
			`executor_fail_retry_count`= #{executorFailRetryCount}
 | 
			
		||||
		WHERE `id`= #{id}
 | 
			
		||||
	</update>
 | 
			
		||||
        <result column="alarm_status" property="alarmStatus" />
 | 
			
		||||
    </resultMap>
 | 
			
		||||
 | 
			
		||||
	<update id="updateHandleInfo">
 | 
			
		||||
		UPDATE xxl_job_log
 | 
			
		||||
		SET 
 | 
			
		||||
			`handle_time`= #{handleTime}, 
 | 
			
		||||
			`handle_code`= #{handleCode},
 | 
			
		||||
			`handle_msg`= #{handleMsg}
 | 
			
		||||
		WHERE `id`= #{id}
 | 
			
		||||
	</update>
 | 
			
		||||
	
 | 
			
		||||
	<delete id="delete" >
 | 
			
		||||
		delete from xxl_job_log
 | 
			
		||||
		WHERE job_id = #{jobId}
 | 
			
		||||
	</delete>
 | 
			
		||||
    <sql id="Base_Column_List">
 | 
			
		||||
        t.id,
 | 
			
		||||
        t.job_group,
 | 
			
		||||
        t.job_id,
 | 
			
		||||
        t.executor_address,
 | 
			
		||||
        t.executor_handler,
 | 
			
		||||
        t.executor_param,
 | 
			
		||||
        t.executor_sharding_param,
 | 
			
		||||
        t.executor_fail_retry_count,
 | 
			
		||||
        t.trigger_time,
 | 
			
		||||
        t.trigger_code,
 | 
			
		||||
        t.trigger_msg,
 | 
			
		||||
        t.handle_time,
 | 
			
		||||
        t.handle_code,
 | 
			
		||||
        t.handle_msg,
 | 
			
		||||
        t.alarm_status
 | 
			
		||||
    </sql>
 | 
			
		||||
 | 
			
		||||
    <select id="pageList" resultMap="XxlJobLog">
 | 
			
		||||
        SELECT <include refid="Base_Column_List" />
 | 
			
		||||
        FROM xxl_job_log AS t
 | 
			
		||||
        <trim prefix="WHERE" prefixOverrides="AND | OR" >
 | 
			
		||||
            <if test="jobId==0 and jobGroup gt 0">
 | 
			
		||||
                AND t.job_group = #{jobGroup}
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="jobId gt 0">
 | 
			
		||||
                AND t.job_id = #{jobId}
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="triggerTimeStart != null">
 | 
			
		||||
                AND t.trigger_time <![CDATA[ >= ]]> #{triggerTimeStart}
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="triggerTimeEnd != null">
 | 
			
		||||
                AND t.trigger_time <![CDATA[ <= ]]> #{triggerTimeEnd}
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="logStatus == 1" >
 | 
			
		||||
                AND t.handle_code = 200
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="logStatus == 2" >
 | 
			
		||||
                AND (
 | 
			
		||||
                    t.trigger_code NOT IN (0, 200) OR
 | 
			
		||||
                    t.handle_code NOT IN (0, 200)
 | 
			
		||||
                )
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="logStatus == 3" >
 | 
			
		||||
                AND t.trigger_code = 200
 | 
			
		||||
                AND t.handle_code = 0
 | 
			
		||||
            </if>
 | 
			
		||||
        </trim>
 | 
			
		||||
        ORDER BY t.trigger_time DESC
 | 
			
		||||
        LIMIT #{offset}, #{pagesize}
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <select id="pageListCount" resultType="int">
 | 
			
		||||
        SELECT count(1)
 | 
			
		||||
        FROM xxl_job_log AS t
 | 
			
		||||
        <trim prefix="WHERE" prefixOverrides="AND | OR" >
 | 
			
		||||
            <if test="jobId==0 and jobGroup gt 0">
 | 
			
		||||
                AND t.job_group = #{jobGroup}
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="jobId gt 0">
 | 
			
		||||
                AND t.job_id = #{jobId}
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="triggerTimeStart != null">
 | 
			
		||||
                AND t.trigger_time <![CDATA[ >= ]]> #{triggerTimeStart}
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="triggerTimeEnd != null">
 | 
			
		||||
                AND t.trigger_time <![CDATA[ <= ]]> #{triggerTimeEnd}
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="logStatus == 1" >
 | 
			
		||||
                AND t.handle_code = 200
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="logStatus == 2" >
 | 
			
		||||
                AND (
 | 
			
		||||
                    t.trigger_code NOT IN (0, 200) OR
 | 
			
		||||
                    t.handle_code NOT IN (0, 200)
 | 
			
		||||
                )
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="logStatus == 3" >
 | 
			
		||||
                AND t.trigger_code = 200
 | 
			
		||||
                AND t.handle_code = 0
 | 
			
		||||
            </if>
 | 
			
		||||
        </trim>
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <select id="load" parameterType="java.lang.Long" resultMap="XxlJobLog">
 | 
			
		||||
        SELECT <include refid="Base_Column_List" />
 | 
			
		||||
        FROM xxl_job_log AS t
 | 
			
		||||
        WHERE t.id = #{id}
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    <insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLog" useGeneratedKeys="true" keyProperty="id" >
 | 
			
		||||
        INSERT INTO xxl_job_log (
 | 
			
		||||
            `job_group`,
 | 
			
		||||
            `job_id`,
 | 
			
		||||
            `trigger_time`,
 | 
			
		||||
            `trigger_code`,
 | 
			
		||||
            `handle_code`
 | 
			
		||||
        ) VALUES (
 | 
			
		||||
            #{jobGroup},
 | 
			
		||||
            #{jobId},
 | 
			
		||||
            #{triggerTime},
 | 
			
		||||
            #{triggerCode},
 | 
			
		||||
            #{handleCode}
 | 
			
		||||
        );
 | 
			
		||||
        <!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
 | 
			
		||||
            SELECT LAST_INSERT_ID()
 | 
			
		||||
        </selectKey>-->
 | 
			
		||||
    </insert>
 | 
			
		||||
 | 
			
		||||
    <update id="updateTriggerInfo" >
 | 
			
		||||
        UPDATE xxl_job_log
 | 
			
		||||
        SET
 | 
			
		||||
            `trigger_time`= #{triggerTime},
 | 
			
		||||
            `trigger_code`= #{triggerCode},
 | 
			
		||||
            `trigger_msg`= #{triggerMsg},
 | 
			
		||||
            `executor_address`= #{executorAddress},
 | 
			
		||||
            `executor_handler`=#{executorHandler},
 | 
			
		||||
            `executor_param`= #{executorParam},
 | 
			
		||||
            `executor_sharding_param`= #{executorShardingParam},
 | 
			
		||||
            `executor_fail_retry_count`= #{executorFailRetryCount}
 | 
			
		||||
        WHERE `id`= #{id}
 | 
			
		||||
    </update>
 | 
			
		||||
 | 
			
		||||
    <update id="updateHandleInfo">
 | 
			
		||||
        UPDATE xxl_job_log
 | 
			
		||||
        SET
 | 
			
		||||
            `handle_time`= #{handleTime},
 | 
			
		||||
            `handle_code`= #{handleCode},
 | 
			
		||||
            `handle_msg`= #{handleMsg}
 | 
			
		||||
        WHERE `id`= #{id}
 | 
			
		||||
    </update>
 | 
			
		||||
 | 
			
		||||
    <delete id="delete" >
 | 
			
		||||
        delete from xxl_job_log
 | 
			
		||||
        WHERE job_id = #{jobId}
 | 
			
		||||
    </delete>
 | 
			
		||||
 | 
			
		||||
    <!--<select id="triggerCountByDay" resultType="java.util.Map" >
 | 
			
		||||
		SELECT
 | 
			
		||||
			DATE_FORMAT(trigger_time,'%Y-%m-%d') triggerDay,
 | 
			
		||||
			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 handle_code = 200 then 1 else 0 end) as triggerDayCountSuc
 | 
			
		||||
		FROM xxl_job_log
 | 
			
		||||
		WHERE trigger_time BETWEEN #{from} and #{to}
 | 
			
		||||
		GROUP BY triggerDay
 | 
			
		||||
		ORDER BY triggerDay
 | 
			
		||||
        SELECT
 | 
			
		||||
            DATE_FORMAT(trigger_time,'%Y-%m-%d') triggerDay,
 | 
			
		||||
            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 handle_code = 200 then 1 else 0 end) as triggerDayCountSuc
 | 
			
		||||
        FROM xxl_job_log
 | 
			
		||||
        WHERE trigger_time BETWEEN #{from} and #{to}
 | 
			
		||||
        GROUP BY triggerDay
 | 
			
		||||
        ORDER BY triggerDay
 | 
			
		||||
    </select>-->
 | 
			
		||||
 | 
			
		||||
    <select id="findLogReport" resultType="java.util.Map" >
 | 
			
		||||
		SELECT
 | 
			
		||||
			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 handle_code = 200 then 1 else 0 end) as triggerDayCountSuc
 | 
			
		||||
		FROM xxl_job_log
 | 
			
		||||
		WHERE trigger_time BETWEEN #{from} and #{to}
 | 
			
		||||
        SELECT
 | 
			
		||||
            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 handle_code = 200 then 1 else 0 end) as triggerDayCountSuc
 | 
			
		||||
        FROM xxl_job_log
 | 
			
		||||
        WHERE trigger_time BETWEEN #{from} and #{to}
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
	<select id="findClearLogIds" resultType="long" >
 | 
			
		||||
		SELECT id FROM xxl_job_log
 | 
			
		||||
		<trim prefix="WHERE" prefixOverrides="AND | OR" >
 | 
			
		||||
			<if test="jobGroup gt 0">
 | 
			
		||||
				AND job_group = #{jobGroup}
 | 
			
		||||
			</if>
 | 
			
		||||
			<if test="jobId gt 0">
 | 
			
		||||
				AND job_id = #{jobId}
 | 
			
		||||
			</if>
 | 
			
		||||
			<if test="clearBeforeTime != null">
 | 
			
		||||
				AND trigger_time <![CDATA[ <= ]]> #{clearBeforeTime}
 | 
			
		||||
			</if>
 | 
			
		||||
			<if test="clearBeforeNum gt 0">
 | 
			
		||||
				AND id NOT in(
 | 
			
		||||
				SELECT id FROM(
 | 
			
		||||
				SELECT id FROM xxl_job_log AS t
 | 
			
		||||
				<trim prefix="WHERE" prefixOverrides="AND | OR" >
 | 
			
		||||
					<if test="jobGroup gt 0">
 | 
			
		||||
						AND t.job_group = #{jobGroup}
 | 
			
		||||
					</if>
 | 
			
		||||
					<if test="jobId gt 0">
 | 
			
		||||
						AND t.job_id = #{jobId}
 | 
			
		||||
					</if>
 | 
			
		||||
				</trim>
 | 
			
		||||
				ORDER BY t.trigger_time desc
 | 
			
		||||
				LIMIT 0, #{clearBeforeNum}
 | 
			
		||||
				) t1
 | 
			
		||||
				)
 | 
			
		||||
			</if>
 | 
			
		||||
		</trim>
 | 
			
		||||
		order by id asc
 | 
			
		||||
		LIMIT #{pagesize}
 | 
			
		||||
	</select>
 | 
			
		||||
    <select id="findClearLogIds" resultType="long" >
 | 
			
		||||
        SELECT id FROM xxl_job_log
 | 
			
		||||
        <trim prefix="WHERE" prefixOverrides="AND | OR" >
 | 
			
		||||
            <if test="jobGroup gt 0">
 | 
			
		||||
                AND job_group = #{jobGroup}
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="jobId gt 0">
 | 
			
		||||
                AND job_id = #{jobId}
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="clearBeforeTime != null">
 | 
			
		||||
                AND trigger_time <![CDATA[ <= ]]> #{clearBeforeTime}
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="clearBeforeNum gt 0">
 | 
			
		||||
                AND id NOT in(
 | 
			
		||||
                SELECT id FROM(
 | 
			
		||||
                SELECT id FROM xxl_job_log AS t
 | 
			
		||||
                <trim prefix="WHERE" prefixOverrides="AND | OR" >
 | 
			
		||||
                    <if test="jobGroup gt 0">
 | 
			
		||||
                        AND t.job_group = #{jobGroup}
 | 
			
		||||
                    </if>
 | 
			
		||||
                    <if test="jobId gt 0">
 | 
			
		||||
                        AND t.job_id = #{jobId}
 | 
			
		||||
                    </if>
 | 
			
		||||
                </trim>
 | 
			
		||||
                ORDER BY t.trigger_time desc
 | 
			
		||||
                LIMIT 0, #{clearBeforeNum}
 | 
			
		||||
                ) t1
 | 
			
		||||
                )
 | 
			
		||||
            </if>
 | 
			
		||||
        </trim>
 | 
			
		||||
        order by id asc
 | 
			
		||||
        LIMIT #{pagesize}
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
	<delete id="clearLog" >
 | 
			
		||||
		delete from xxl_job_log
 | 
			
		||||
		WHERE id in
 | 
			
		||||
		<foreach collection="logIds" item="item" open="(" close=")" separator="," >
 | 
			
		||||
			#{item}
 | 
			
		||||
		</foreach>
 | 
			
		||||
	</delete>
 | 
			
		||||
    <delete id="clearLog" >
 | 
			
		||||
        delete from xxl_job_log
 | 
			
		||||
        WHERE id in
 | 
			
		||||
        <foreach collection="logIds" item="item" open="(" close=")" separator="," >
 | 
			
		||||
            #{item}
 | 
			
		||||
        </foreach>
 | 
			
		||||
    </delete>
 | 
			
		||||
 | 
			
		||||
	<select id="findFailJobLogIds" resultType="long" >
 | 
			
		||||
		SELECT id FROM `xxl_job_log`
 | 
			
		||||
		WHERE !(
 | 
			
		||||
			(trigger_code in (0, 200) and handle_code = 0)
 | 
			
		||||
			OR
 | 
			
		||||
			(handle_code = 200)
 | 
			
		||||
		)
 | 
			
		||||
		AND `alarm_status` = 0
 | 
			
		||||
		ORDER BY id ASC
 | 
			
		||||
		LIMIT #{pagesize}
 | 
			
		||||
	</select>
 | 
			
		||||
    <select id="findFailJobLogIds" resultType="long" >
 | 
			
		||||
        SELECT id FROM `xxl_job_log`
 | 
			
		||||
        WHERE !(
 | 
			
		||||
            (trigger_code in (0, 200) and handle_code = 0)
 | 
			
		||||
            OR
 | 
			
		||||
            (handle_code = 200)
 | 
			
		||||
        )
 | 
			
		||||
        AND `alarm_status` = 0
 | 
			
		||||
        ORDER BY id ASC
 | 
			
		||||
        LIMIT #{pagesize}
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
	<update id="updateAlarmStatus" >
 | 
			
		||||
		UPDATE xxl_job_log
 | 
			
		||||
		SET
 | 
			
		||||
			`alarm_status` = #{newAlarmStatus}
 | 
			
		||||
		WHERE `id`= #{logId} AND `alarm_status` = #{oldAlarmStatus}
 | 
			
		||||
	</update>
 | 
			
		||||
    <update id="updateAlarmStatus" >
 | 
			
		||||
        UPDATE xxl_job_log
 | 
			
		||||
        SET
 | 
			
		||||
            `alarm_status` = #{newAlarmStatus}
 | 
			
		||||
        WHERE `id`= #{logId} AND `alarm_status` = #{oldAlarmStatus}
 | 
			
		||||
    </update>
 | 
			
		||||
 | 
			
		||||
	<select id="findLostJobIds" resultType="long" >
 | 
			
		||||
		SELECT
 | 
			
		||||
			t.id
 | 
			
		||||
		FROM
 | 
			
		||||
			xxl_job_log t
 | 
			
		||||
			LEFT JOIN xxl_job_registry t2 ON t.executor_address = t2.registry_value
 | 
			
		||||
		WHERE
 | 
			
		||||
			t.trigger_code = 200
 | 
			
		||||
				AND t.handle_code = 0
 | 
			
		||||
				AND t.trigger_time <![CDATA[ <= ]]> #{losedTime}
 | 
			
		||||
				AND t2.id IS NULL;
 | 
			
		||||
	</select>
 | 
			
		||||
	<!--
 | 
			
		||||
	SELECT t.id
 | 
			
		||||
	FROM xxl_job_log AS t
 | 
			
		||||
	WHERE t.trigger_code = 200
 | 
			
		||||
		and t.handle_code = 0
 | 
			
		||||
		and t.trigger_time <![CDATA[ <= ]]> #{losedTime}
 | 
			
		||||
		and t.executor_address not in (
 | 
			
		||||
			SELECT t2.registry_value
 | 
			
		||||
			FROM xxl_job_registry AS t2
 | 
			
		||||
		)
 | 
			
		||||
	-->
 | 
			
		||||
    <select id="findLostJobIds" resultType="long" >
 | 
			
		||||
        SELECT
 | 
			
		||||
            t.id
 | 
			
		||||
        FROM
 | 
			
		||||
            xxl_job_log t
 | 
			
		||||
            LEFT JOIN xxl_job_registry t2 ON t.executor_address = t2.registry_value
 | 
			
		||||
        WHERE
 | 
			
		||||
            t.trigger_code = 200
 | 
			
		||||
                AND t.handle_code = 0
 | 
			
		||||
                AND t.trigger_time <![CDATA[ <= ]]> #{losedTime}
 | 
			
		||||
                AND t2.id IS NULL;
 | 
			
		||||
    </select>
 | 
			
		||||
    <!--
 | 
			
		||||
    SELECT t.id
 | 
			
		||||
    FROM xxl_job_log AS t
 | 
			
		||||
    WHERE t.trigger_code = 200
 | 
			
		||||
        and t.handle_code = 0
 | 
			
		||||
        and t.trigger_time <![CDATA[ <= ]]> #{losedTime}
 | 
			
		||||
        and t.executor_address not in (
 | 
			
		||||
            SELECT t2.registry_value
 | 
			
		||||
            FROM xxl_job_registry AS t2
 | 
			
		||||
        )
 | 
			
		||||
    -->
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
</mapper>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,62 +1,62 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
 | 
			
		||||
	"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
			
		||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		||||
    "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
			
		||||
<mapper namespace="com.xxl.job.admin.dao.XxlJobLogReportDao">
 | 
			
		||||
	
 | 
			
		||||
	<resultMap id="XxlJobLogReport" type="com.xxl.job.admin.core.model.XxlJobLogReport" >
 | 
			
		||||
		<result column="id" property="id" />
 | 
			
		||||
	    <result column="trigger_day" property="triggerDay" />
 | 
			
		||||
		<result column="running_count" property="runningCount" />
 | 
			
		||||
	    <result column="suc_count" property="sucCount" />
 | 
			
		||||
	    <result column="fail_count" property="failCount" />
 | 
			
		||||
	</resultMap>
 | 
			
		||||
 | 
			
		||||
	<sql id="Base_Column_List">
 | 
			
		||||
		t.id,
 | 
			
		||||
		t.trigger_day,
 | 
			
		||||
		t.running_count,
 | 
			
		||||
		t.suc_count,
 | 
			
		||||
		t.fail_count
 | 
			
		||||
	</sql>
 | 
			
		||||
	
 | 
			
		||||
	<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLogReport" useGeneratedKeys="true" keyProperty="id" >
 | 
			
		||||
		INSERT INTO xxl_job_log_report (
 | 
			
		||||
			`trigger_day`,
 | 
			
		||||
			`running_count`,
 | 
			
		||||
			`suc_count`,
 | 
			
		||||
			`fail_count`
 | 
			
		||||
		) VALUES (
 | 
			
		||||
			#{triggerDay},
 | 
			
		||||
			#{runningCount},
 | 
			
		||||
			#{sucCount},
 | 
			
		||||
			#{failCount}
 | 
			
		||||
		);
 | 
			
		||||
		<!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
 | 
			
		||||
			SELECT LAST_INSERT_ID() 
 | 
			
		||||
		</selectKey>-->
 | 
			
		||||
	</insert>
 | 
			
		||||
    <resultMap id="XxlJobLogReport" type="com.xxl.job.admin.core.model.XxlJobLogReport" >
 | 
			
		||||
        <result column="id" property="id" />
 | 
			
		||||
        <result column="trigger_day" property="triggerDay" />
 | 
			
		||||
        <result column="running_count" property="runningCount" />
 | 
			
		||||
        <result column="suc_count" property="sucCount" />
 | 
			
		||||
        <result column="fail_count" property="failCount" />
 | 
			
		||||
    </resultMap>
 | 
			
		||||
 | 
			
		||||
	<update id="update" >
 | 
			
		||||
    <sql id="Base_Column_List">
 | 
			
		||||
        t.id,
 | 
			
		||||
        t.trigger_day,
 | 
			
		||||
        t.running_count,
 | 
			
		||||
        t.suc_count,
 | 
			
		||||
        t.fail_count
 | 
			
		||||
    </sql>
 | 
			
		||||
 | 
			
		||||
    <insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLogReport" useGeneratedKeys="true" keyProperty="id" >
 | 
			
		||||
        INSERT INTO xxl_job_log_report (
 | 
			
		||||
            `trigger_day`,
 | 
			
		||||
            `running_count`,
 | 
			
		||||
            `suc_count`,
 | 
			
		||||
            `fail_count`
 | 
			
		||||
        ) VALUES (
 | 
			
		||||
            #{triggerDay},
 | 
			
		||||
            #{runningCount},
 | 
			
		||||
            #{sucCount},
 | 
			
		||||
            #{failCount}
 | 
			
		||||
        );
 | 
			
		||||
        <!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
 | 
			
		||||
            SELECT LAST_INSERT_ID()
 | 
			
		||||
        </selectKey>-->
 | 
			
		||||
    </insert>
 | 
			
		||||
 | 
			
		||||
    <update id="update" >
 | 
			
		||||
        UPDATE xxl_job_log_report
 | 
			
		||||
        SET `running_count` = #{runningCount},
 | 
			
		||||
        	`suc_count` = #{sucCount},
 | 
			
		||||
        	`fail_count` = #{failCount}
 | 
			
		||||
            `suc_count` = #{sucCount},
 | 
			
		||||
            `fail_count` = #{failCount}
 | 
			
		||||
        WHERE `trigger_day` = #{triggerDay}
 | 
			
		||||
    </update>
 | 
			
		||||
 | 
			
		||||
	<select id="queryLogReport" resultMap="XxlJobLogReport">
 | 
			
		||||
		SELECT <include refid="Base_Column_List" />
 | 
			
		||||
		FROM xxl_job_log_report AS t
 | 
			
		||||
		WHERE t.trigger_day between #{triggerDayFrom} and #{triggerDayTo}
 | 
			
		||||
		ORDER BY t.trigger_day ASC
 | 
			
		||||
	</select>
 | 
			
		||||
    <select id="queryLogReport" resultMap="XxlJobLogReport">
 | 
			
		||||
        SELECT <include refid="Base_Column_List" />
 | 
			
		||||
        FROM xxl_job_log_report AS t
 | 
			
		||||
        WHERE t.trigger_day between #{triggerDayFrom} and #{triggerDayTo}
 | 
			
		||||
        ORDER BY t.trigger_day ASC
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
	<select id="queryLogReportTotal" resultMap="XxlJobLogReport">
 | 
			
		||||
		SELECT
 | 
			
		||||
			SUM(running_count) running_count,
 | 
			
		||||
			SUM(suc_count) suc_count,
 | 
			
		||||
			SUM(fail_count) fail_count
 | 
			
		||||
		FROM xxl_job_log_report AS t
 | 
			
		||||
	</select>
 | 
			
		||||
    <select id="queryLogReportTotal" resultMap="XxlJobLogReport">
 | 
			
		||||
        SELECT
 | 
			
		||||
            SUM(running_count) running_count,
 | 
			
		||||
            SUM(suc_count) suc_count,
 | 
			
		||||
            SUM(fail_count) fail_count
 | 
			
		||||
        FROM xxl_job_log_report AS t
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
</mapper>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,43 +1,43 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
 | 
			
		||||
	"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
			
		||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		||||
    "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
			
		||||
<mapper namespace="com.xxl.job.admin.dao.XxlJobRegistryDao">
 | 
			
		||||
	
 | 
			
		||||
	<resultMap id="XxlJobRegistry" type="com.xxl.job.admin.core.model.XxlJobRegistry" >
 | 
			
		||||
		<result column="id" property="id" />
 | 
			
		||||
	    <result column="registry_group" property="registryGroup" />
 | 
			
		||||
	    <result column="registry_key" property="registryKey" />
 | 
			
		||||
	    <result column="registry_value" property="registryValue" />
 | 
			
		||||
		<result column="update_time" property="updateTime" />
 | 
			
		||||
	</resultMap>
 | 
			
		||||
 | 
			
		||||
	<sql id="Base_Column_List">
 | 
			
		||||
		t.id,
 | 
			
		||||
		t.registry_group,
 | 
			
		||||
		t.registry_key,
 | 
			
		||||
		t.registry_value,
 | 
			
		||||
		t.update_time
 | 
			
		||||
	</sql>
 | 
			
		||||
    <resultMap id="XxlJobRegistry" type="com.xxl.job.admin.core.model.XxlJobRegistry" >
 | 
			
		||||
        <result column="id" property="id" />
 | 
			
		||||
        <result column="registry_group" property="registryGroup" />
 | 
			
		||||
        <result column="registry_key" property="registryKey" />
 | 
			
		||||
        <result column="registry_value" property="registryValue" />
 | 
			
		||||
        <result column="update_time" property="updateTime" />
 | 
			
		||||
    </resultMap>
 | 
			
		||||
 | 
			
		||||
	<select id="findDead" parameterType="java.util.HashMap" resultType="java.lang.Integer" >
 | 
			
		||||
		SELECT t.id
 | 
			
		||||
		FROM xxl_job_registry AS t
 | 
			
		||||
		WHERE t.update_time <![CDATA[ < ]]> DATE_ADD(#{nowTime},INTERVAL -#{timeout} SECOND)
 | 
			
		||||
	</select>
 | 
			
		||||
	
 | 
			
		||||
	<delete id="removeDead" parameterType="java.lang.Integer" >
 | 
			
		||||
		DELETE FROM xxl_job_registry
 | 
			
		||||
		WHERE id in
 | 
			
		||||
		<foreach collection="ids" item="item" open="(" close=")" separator="," >
 | 
			
		||||
			#{item}
 | 
			
		||||
		</foreach>
 | 
			
		||||
	</delete>
 | 
			
		||||
    <sql id="Base_Column_List">
 | 
			
		||||
        t.id,
 | 
			
		||||
        t.registry_group,
 | 
			
		||||
        t.registry_key,
 | 
			
		||||
        t.registry_value,
 | 
			
		||||
        t.update_time
 | 
			
		||||
    </sql>
 | 
			
		||||
 | 
			
		||||
	<select id="findAll" parameterType="java.util.HashMap" resultMap="XxlJobRegistry">
 | 
			
		||||
		SELECT <include refid="Base_Column_List" />
 | 
			
		||||
		FROM xxl_job_registry AS t
 | 
			
		||||
		WHERE t.update_time <![CDATA[ > ]]> DATE_ADD(#{nowTime},INTERVAL -#{timeout} SECOND)
 | 
			
		||||
	</select>
 | 
			
		||||
    <select id="findDead" parameterType="java.util.HashMap" resultType="java.lang.Integer" >
 | 
			
		||||
        SELECT t.id
 | 
			
		||||
        FROM xxl_job_registry AS t
 | 
			
		||||
        WHERE t.update_time <![CDATA[ < ]]> DATE_ADD(#{nowTime},INTERVAL -#{timeout} SECOND)
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <delete id="removeDead" parameterType="java.lang.Integer" >
 | 
			
		||||
        DELETE FROM xxl_job_registry
 | 
			
		||||
        WHERE id in
 | 
			
		||||
        <foreach collection="ids" item="item" open="(" close=")" separator="," >
 | 
			
		||||
            #{item}
 | 
			
		||||
        </foreach>
 | 
			
		||||
    </delete>
 | 
			
		||||
 | 
			
		||||
    <select id="findAll" parameterType="java.util.HashMap" resultMap="XxlJobRegistry">
 | 
			
		||||
        SELECT <include refid="Base_Column_List" />
 | 
			
		||||
        FROM xxl_job_registry AS t
 | 
			
		||||
        WHERE t.update_time <![CDATA[ > ]]> DATE_ADD(#{nowTime},INTERVAL -#{timeout} SECOND)
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <update id="registryUpdate" >
 | 
			
		||||
        UPDATE xxl_job_registry
 | 
			
		||||
@@ -52,11 +52,11 @@
 | 
			
		||||
        VALUES( #{registryGroup}  , #{registryKey} , #{registryValue}, #{updateTime})
 | 
			
		||||
    </insert>
 | 
			
		||||
 | 
			
		||||
	<delete id="registryDelete" >
 | 
			
		||||
		DELETE FROM xxl_job_registry
 | 
			
		||||
		WHERE registry_group = #{registryGroup}
 | 
			
		||||
			AND registry_key = #{registryKey}
 | 
			
		||||
			AND registry_value = #{registryValue}
 | 
			
		||||
	</delete>
 | 
			
		||||
    <delete id="registryDelete" >
 | 
			
		||||
        DELETE FROM xxl_job_registry
 | 
			
		||||
        WHERE registry_group = #{registryGroup}
 | 
			
		||||
            AND registry_key = #{registryKey}
 | 
			
		||||
            AND registry_value = #{registryValue}
 | 
			
		||||
    </delete>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
</mapper>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,87 +1,87 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<!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">
 | 
			
		||||
 | 
			
		||||
	<resultMap id="XxlJobUser" type="com.xxl.job.admin.core.model.XxlJobUser" >
 | 
			
		||||
		<result column="id" property="id" />
 | 
			
		||||
		<result column="username" property="username" />
 | 
			
		||||
	    <result column="password" property="password" />
 | 
			
		||||
	    <result column="role" property="role" />
 | 
			
		||||
	    <result column="permission" property="permission" />
 | 
			
		||||
	</resultMap>
 | 
			
		||||
    <resultMap id="XxlJobUser" type="com.xxl.job.admin.core.model.XxlJobUser" >
 | 
			
		||||
        <result column="id" property="id" />
 | 
			
		||||
        <result column="username" property="username" />
 | 
			
		||||
        <result column="password" property="password" />
 | 
			
		||||
        <result column="role" property="role" />
 | 
			
		||||
        <result column="permission" property="permission" />
 | 
			
		||||
    </resultMap>
 | 
			
		||||
 | 
			
		||||
	<sql id="Base_Column_List">
 | 
			
		||||
		t.id,
 | 
			
		||||
		t.username,
 | 
			
		||||
		t.password,
 | 
			
		||||
		t.role,
 | 
			
		||||
		t.permission
 | 
			
		||||
	</sql>
 | 
			
		||||
    <sql id="Base_Column_List">
 | 
			
		||||
        t.id,
 | 
			
		||||
        t.username,
 | 
			
		||||
        t.password,
 | 
			
		||||
        t.role,
 | 
			
		||||
        t.permission
 | 
			
		||||
    </sql>
 | 
			
		||||
 | 
			
		||||
	<select id="pageList" parameterType="java.util.HashMap" resultMap="XxlJobUser">
 | 
			
		||||
		SELECT <include refid="Base_Column_List" />
 | 
			
		||||
		FROM xxl_job_user AS t
 | 
			
		||||
		<trim prefix="WHERE" prefixOverrides="AND | OR" >
 | 
			
		||||
			<if test="username != null and username != ''">
 | 
			
		||||
				AND t.username like CONCAT(CONCAT('%', #{username}), '%')
 | 
			
		||||
			</if>
 | 
			
		||||
			<if test="role gt -1">
 | 
			
		||||
				AND t.role = #{role}
 | 
			
		||||
			</if>
 | 
			
		||||
		</trim>
 | 
			
		||||
		ORDER BY username ASC
 | 
			
		||||
		LIMIT #{offset}, #{pagesize}
 | 
			
		||||
	</select>
 | 
			
		||||
    <select id="pageList" parameterType="java.util.HashMap" resultMap="XxlJobUser">
 | 
			
		||||
        SELECT <include refid="Base_Column_List" />
 | 
			
		||||
        FROM xxl_job_user AS t
 | 
			
		||||
        <trim prefix="WHERE" prefixOverrides="AND | OR" >
 | 
			
		||||
            <if test="username != null and username != ''">
 | 
			
		||||
                AND t.username like CONCAT(CONCAT('%', #{username}), '%')
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="role gt -1">
 | 
			
		||||
                AND t.role = #{role}
 | 
			
		||||
            </if>
 | 
			
		||||
        </trim>
 | 
			
		||||
        ORDER BY username ASC
 | 
			
		||||
        LIMIT #{offset}, #{pagesize}
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
	<select id="pageListCount" parameterType="java.util.HashMap" resultType="int">
 | 
			
		||||
		SELECT count(1)
 | 
			
		||||
		FROM xxl_job_user AS t
 | 
			
		||||
		<trim prefix="WHERE" prefixOverrides="AND | OR" >
 | 
			
		||||
			<if test="username != null and username != ''">
 | 
			
		||||
				AND t.username like CONCAT(CONCAT('%', #{username}), '%')
 | 
			
		||||
			</if>
 | 
			
		||||
			<if test="role gt -1">
 | 
			
		||||
				AND t.role = #{role}
 | 
			
		||||
			</if>
 | 
			
		||||
		</trim>
 | 
			
		||||
	</select>
 | 
			
		||||
    <select id="pageListCount" parameterType="java.util.HashMap" resultType="int">
 | 
			
		||||
        SELECT count(1)
 | 
			
		||||
        FROM xxl_job_user AS t
 | 
			
		||||
        <trim prefix="WHERE" prefixOverrides="AND | OR" >
 | 
			
		||||
            <if test="username != null and username != ''">
 | 
			
		||||
                AND t.username like CONCAT(CONCAT('%', #{username}), '%')
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="role gt -1">
 | 
			
		||||
                AND t.role = #{role}
 | 
			
		||||
            </if>
 | 
			
		||||
        </trim>
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
	<select id="loadByUserName" parameterType="java.util.HashMap" resultMap="XxlJobUser">
 | 
			
		||||
		SELECT <include refid="Base_Column_List" />
 | 
			
		||||
		FROM xxl_job_user AS t
 | 
			
		||||
		WHERE t.username = #{username}
 | 
			
		||||
	</select>
 | 
			
		||||
    <select id="loadByUserName" parameterType="java.util.HashMap" resultMap="XxlJobUser">
 | 
			
		||||
        SELECT <include refid="Base_Column_List" />
 | 
			
		||||
        FROM xxl_job_user AS t
 | 
			
		||||
        WHERE t.username = #{username}
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
	<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobUser" useGeneratedKeys="true" keyProperty="id" >
 | 
			
		||||
		INSERT INTO xxl_job_user (
 | 
			
		||||
			username,
 | 
			
		||||
			password,
 | 
			
		||||
			role,
 | 
			
		||||
			permission
 | 
			
		||||
		) VALUES (
 | 
			
		||||
			#{username},
 | 
			
		||||
			#{password},
 | 
			
		||||
			#{role},
 | 
			
		||||
			#{permission}
 | 
			
		||||
		);
 | 
			
		||||
	</insert>
 | 
			
		||||
    <insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobUser" useGeneratedKeys="true" keyProperty="id" >
 | 
			
		||||
        INSERT INTO xxl_job_user (
 | 
			
		||||
            username,
 | 
			
		||||
            password,
 | 
			
		||||
            role,
 | 
			
		||||
            permission
 | 
			
		||||
        ) VALUES (
 | 
			
		||||
            #{username},
 | 
			
		||||
            #{password},
 | 
			
		||||
            #{role},
 | 
			
		||||
            #{permission}
 | 
			
		||||
        );
 | 
			
		||||
    </insert>
 | 
			
		||||
 | 
			
		||||
	<update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobUser" >
 | 
			
		||||
		UPDATE xxl_job_user
 | 
			
		||||
		SET
 | 
			
		||||
			<if test="password != null and password != ''">
 | 
			
		||||
				password = #{password},
 | 
			
		||||
			</if>
 | 
			
		||||
			role = #{role},
 | 
			
		||||
			permission = #{permission}
 | 
			
		||||
		WHERE id = #{id}
 | 
			
		||||
	</update>
 | 
			
		||||
    <update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobUser" >
 | 
			
		||||
        UPDATE xxl_job_user
 | 
			
		||||
        SET
 | 
			
		||||
            <if test="password != null and password != ''">
 | 
			
		||||
                password = #{password},
 | 
			
		||||
            </if>
 | 
			
		||||
            role = #{role},
 | 
			
		||||
            permission = #{permission}
 | 
			
		||||
        WHERE id = #{id}
 | 
			
		||||
    </update>
 | 
			
		||||
 | 
			
		||||
	<delete id="delete" parameterType="java.util.HashMap">
 | 
			
		||||
		DELETE
 | 
			
		||||
		FROM xxl_job_user
 | 
			
		||||
		WHERE id = #{id}
 | 
			
		||||
	</delete>
 | 
			
		||||
    <delete id="delete" parameterType="java.util.HashMap">
 | 
			
		||||
        DELETE
 | 
			
		||||
        FROM xxl_job_user
 | 
			
		||||
        WHERE id = #{id}
 | 
			
		||||
    </delete>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
</mapper>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,48 +1,48 @@
 | 
			
		||||
$(function() {
 | 
			
		||||
 | 
			
		||||
	// init date tables
 | 
			
		||||
	var userListTable = $("#user_list").dataTable({
 | 
			
		||||
		"deferRender": true,
 | 
			
		||||
		"processing" : true, 
 | 
			
		||||
	    "serverSide": true,
 | 
			
		||||
		"ajax": {
 | 
			
		||||
			url: base_url + "/user/pageList",
 | 
			
		||||
			type:"post",
 | 
			
		||||
	        data : function ( d ) {
 | 
			
		||||
	        	var obj = {};
 | 
			
		||||
    // init date tables
 | 
			
		||||
    var userListTable = $("#user_list").dataTable({
 | 
			
		||||
        "deferRender": true,
 | 
			
		||||
        "processing" : true,
 | 
			
		||||
        "serverSide": true,
 | 
			
		||||
        "ajax": {
 | 
			
		||||
            url: base_url + "/user/pageList",
 | 
			
		||||
            type:"post",
 | 
			
		||||
            data : function ( d ) {
 | 
			
		||||
                var obj = {};
 | 
			
		||||
                obj.username = $('#username').val();
 | 
			
		||||
                obj.role = $('#role').val();
 | 
			
		||||
	        	obj.start = d.start;
 | 
			
		||||
	        	obj.length = d.length;
 | 
			
		||||
                obj.start = d.start;
 | 
			
		||||
                obj.length = d.length;
 | 
			
		||||
                return obj;
 | 
			
		||||
            }
 | 
			
		||||
	    },
 | 
			
		||||
	    "searching": false,
 | 
			
		||||
	    "ordering": false,
 | 
			
		||||
	    //"scrollX": true,	// scroll x,close self-adaption
 | 
			
		||||
	    "columns": [
 | 
			
		||||
	                {
 | 
			
		||||
	                	"data": 'id',
 | 
			
		||||
						"visible" : false,
 | 
			
		||||
						"width":'10%'
 | 
			
		||||
					},
 | 
			
		||||
	                {
 | 
			
		||||
	                	"data": 'username',
 | 
			
		||||
						"visible" : true,
 | 
			
		||||
						"width":'20%'
 | 
			
		||||
					},
 | 
			
		||||
	                {
 | 
			
		||||
	                	"data": 'password',
 | 
			
		||||
						"visible" : false,
 | 
			
		||||
        },
 | 
			
		||||
        "searching": false,
 | 
			
		||||
        "ordering": false,
 | 
			
		||||
        //"scrollX": true,    // scroll x,close self-adaption
 | 
			
		||||
        "columns": [
 | 
			
		||||
                    {
 | 
			
		||||
                        "data": 'id',
 | 
			
		||||
                        "visible" : false,
 | 
			
		||||
                        "width":'10%'
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        "data": 'username',
 | 
			
		||||
                        "visible" : true,
 | 
			
		||||
                        "width":'20%'
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        "data": 'password',
 | 
			
		||||
                        "visible" : false,
 | 
			
		||||
                        "width":'20%',
 | 
			
		||||
                        "render": function ( data, type, row ) {
 | 
			
		||||
                            return '*********';
 | 
			
		||||
                        }
 | 
			
		||||
					},
 | 
			
		||||
					{
 | 
			
		||||
						"data": 'role',
 | 
			
		||||
						"visible" : true,
 | 
			
		||||
						"width":'10%',
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        "data": 'role',
 | 
			
		||||
                        "visible" : true,
 | 
			
		||||
                        "width":'10%',
 | 
			
		||||
                        "render": function ( data, type, row ) {
 | 
			
		||||
                            if (data == 1) {
 | 
			
		||||
                                return I18n.user_role_admin
 | 
			
		||||
@@ -50,101 +50,101 @@ $(function() {
 | 
			
		||||
                                return I18n.user_role_normal
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
					},
 | 
			
		||||
	                {
 | 
			
		||||
	                	"data": 'permission',
 | 
			
		||||
						"width":'10%',
 | 
			
		||||
	                	"visible" : false
 | 
			
		||||
	                },
 | 
			
		||||
	                {
 | 
			
		||||
						"data": I18n.system_opt ,
 | 
			
		||||
						"width":'15%',
 | 
			
		||||
	                	"render": function ( data, type, row ) {
 | 
			
		||||
	                		return function(){
 | 
			
		||||
								// html
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        "data": 'permission',
 | 
			
		||||
                        "width":'10%',
 | 
			
		||||
                        "visible" : false
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        "data": I18n.system_opt ,
 | 
			
		||||
                        "width":'15%',
 | 
			
		||||
                        "render": function ( data, type, row ) {
 | 
			
		||||
                            return function(){
 | 
			
		||||
                                // html
 | 
			
		||||
                                tableData['key'+row.id] = row;
 | 
			
		||||
								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-danger btn-xs delete" type="button">'+ I18n.system_opt_del +'</button>  '+
 | 
			
		||||
									'</p>';
 | 
			
		||||
                                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-danger btn-xs delete" type="button">'+ I18n.system_opt_del +'</button>  '+
 | 
			
		||||
                                    '</p>';
 | 
			
		||||
 | 
			
		||||
	                			return html;
 | 
			
		||||
							};
 | 
			
		||||
	                	}
 | 
			
		||||
	                }
 | 
			
		||||
	            ],
 | 
			
		||||
		"language" : {
 | 
			
		||||
			"sProcessing" : I18n.dataTable_sProcessing ,
 | 
			
		||||
			"sLengthMenu" : I18n.dataTable_sLengthMenu ,
 | 
			
		||||
			"sZeroRecords" : I18n.dataTable_sZeroRecords ,
 | 
			
		||||
			"sInfo" : I18n.dataTable_sInfo ,
 | 
			
		||||
			"sInfoEmpty" : I18n.dataTable_sInfoEmpty ,
 | 
			
		||||
			"sInfoFiltered" : I18n.dataTable_sInfoFiltered ,
 | 
			
		||||
			"sInfoPostFix" : "",
 | 
			
		||||
			"sSearch" : I18n.dataTable_sSearch ,
 | 
			
		||||
			"sUrl" : "",
 | 
			
		||||
			"sEmptyTable" : I18n.dataTable_sEmptyTable ,
 | 
			
		||||
			"sLoadingRecords" : I18n.dataTable_sLoadingRecords ,
 | 
			
		||||
			"sInfoThousands" : ",",
 | 
			
		||||
			"oPaginate" : {
 | 
			
		||||
				"sFirst" : I18n.dataTable_sFirst ,
 | 
			
		||||
				"sPrevious" : I18n.dataTable_sPrevious ,
 | 
			
		||||
				"sNext" : I18n.dataTable_sNext ,
 | 
			
		||||
				"sLast" : I18n.dataTable_sLast
 | 
			
		||||
			},
 | 
			
		||||
			"oAria" : {
 | 
			
		||||
				"sSortAscending" : I18n.dataTable_sSortAscending ,
 | 
			
		||||
				"sSortDescending" : I18n.dataTable_sSortDescending
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	});
 | 
			
		||||
                                return html;
 | 
			
		||||
                            };
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
        "language" : {
 | 
			
		||||
            "sProcessing" : I18n.dataTable_sProcessing ,
 | 
			
		||||
            "sLengthMenu" : I18n.dataTable_sLengthMenu ,
 | 
			
		||||
            "sZeroRecords" : I18n.dataTable_sZeroRecords ,
 | 
			
		||||
            "sInfo" : I18n.dataTable_sInfo ,
 | 
			
		||||
            "sInfoEmpty" : I18n.dataTable_sInfoEmpty ,
 | 
			
		||||
            "sInfoFiltered" : I18n.dataTable_sInfoFiltered ,
 | 
			
		||||
            "sInfoPostFix" : "",
 | 
			
		||||
            "sSearch" : I18n.dataTable_sSearch ,
 | 
			
		||||
            "sUrl" : "",
 | 
			
		||||
            "sEmptyTable" : I18n.dataTable_sEmptyTable ,
 | 
			
		||||
            "sLoadingRecords" : I18n.dataTable_sLoadingRecords ,
 | 
			
		||||
            "sInfoThousands" : ",",
 | 
			
		||||
            "oPaginate" : {
 | 
			
		||||
                "sFirst" : I18n.dataTable_sFirst ,
 | 
			
		||||
                "sPrevious" : I18n.dataTable_sPrevious ,
 | 
			
		||||
                "sNext" : I18n.dataTable_sNext ,
 | 
			
		||||
                "sLast" : I18n.dataTable_sLast
 | 
			
		||||
            },
 | 
			
		||||
            "oAria" : {
 | 
			
		||||
                "sSortAscending" : I18n.dataTable_sSortAscending ,
 | 
			
		||||
                "sSortDescending" : I18n.dataTable_sSortDescending
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // table data
 | 
			
		||||
    var tableData = {};
 | 
			
		||||
 | 
			
		||||
	// search btn
 | 
			
		||||
	$('#searchBtn').on('click', function(){
 | 
			
		||||
    // search btn
 | 
			
		||||
    $('#searchBtn').on('click', function(){
 | 
			
		||||
        userListTable.fnDraw();
 | 
			
		||||
	});
 | 
			
		||||
	
 | 
			
		||||
	// job operate
 | 
			
		||||
	$("#user_list").on('click', '.delete',function() {
 | 
			
		||||
		var id = $(this).parent('p').attr("id");
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
		layer.confirm( I18n.system_ok + I18n.system_opt_del + '?', {
 | 
			
		||||
			icon: 3,
 | 
			
		||||
			title: I18n.system_tips ,
 | 
			
		||||
    // job operate
 | 
			
		||||
    $("#user_list").on('click', '.delete',function() {
 | 
			
		||||
        var id = $(this).parent('p').attr("id");
 | 
			
		||||
 | 
			
		||||
        layer.confirm( I18n.system_ok + I18n.system_opt_del + '?', {
 | 
			
		||||
            icon: 3,
 | 
			
		||||
            title: I18n.system_tips ,
 | 
			
		||||
            btn: [ I18n.system_ok, I18n.system_cancel ]
 | 
			
		||||
		}, function(index){
 | 
			
		||||
			layer.close(index);
 | 
			
		||||
        }, function(index){
 | 
			
		||||
            layer.close(index);
 | 
			
		||||
 | 
			
		||||
			$.ajax({
 | 
			
		||||
				type : 'POST',
 | 
			
		||||
				url : base_url + "/user/remove",
 | 
			
		||||
				data : {
 | 
			
		||||
					"id" : id
 | 
			
		||||
				},
 | 
			
		||||
				dataType : "json",
 | 
			
		||||
				success : function(data){
 | 
			
		||||
					if (data.code == 200) {
 | 
			
		||||
            $.ajax({
 | 
			
		||||
                type : 'POST',
 | 
			
		||||
                url : base_url + "/user/remove",
 | 
			
		||||
                data : {
 | 
			
		||||
                    "id" : id
 | 
			
		||||
                },
 | 
			
		||||
                dataType : "json",
 | 
			
		||||
                success : function(data){
 | 
			
		||||
                    if (data.code == 200) {
 | 
			
		||||
                        layer.msg( I18n.system_success );
 | 
			
		||||
						userListTable.fnDraw(false);
 | 
			
		||||
					} else {
 | 
			
		||||
                        userListTable.fnDraw(false);
 | 
			
		||||
                    } else {
 | 
			
		||||
                        layer.msg( data.msg || I18n.system_opt_del + I18n.system_fail );
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
		});
 | 
			
		||||
	});
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
	// add role
 | 
			
		||||
    // add role
 | 
			
		||||
    $("#addModal .form input[name=role]").change(function () {
 | 
			
		||||
		var role = $(this).val();
 | 
			
		||||
		if (role == 1) {
 | 
			
		||||
        var role = $(this).val();
 | 
			
		||||
        if (role == 1) {
 | 
			
		||||
            $("#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']").prop("checked",false);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -154,28 +154,28 @@ $(function() {
 | 
			
		||||
        return this.optional(element) || valid.test(value);
 | 
			
		||||
    }, I18n.user_username_valid );
 | 
			
		||||
 | 
			
		||||
	// add
 | 
			
		||||
	$(".add").click(function(){
 | 
			
		||||
		$('#addModal').modal({backdrop: false, keyboard: false}).modal('show');
 | 
			
		||||
	});
 | 
			
		||||
	var addModalValidate = $("#addModal .form").validate({
 | 
			
		||||
		errorElement : 'span',  
 | 
			
		||||
    // add
 | 
			
		||||
    $(".add").click(function(){
 | 
			
		||||
        $('#addModal').modal({backdrop: false, keyboard: false}).modal('show');
 | 
			
		||||
    });
 | 
			
		||||
    var addModalValidate = $("#addModal .form").validate({
 | 
			
		||||
        errorElement : 'span',
 | 
			
		||||
        errorClass : 'help-block',
 | 
			
		||||
        focusInvalid : true,  
 | 
			
		||||
        focusInvalid : true,
 | 
			
		||||
        rules : {
 | 
			
		||||
            username : {
 | 
			
		||||
				required : true,
 | 
			
		||||
                required : true,
 | 
			
		||||
                rangelength:[4, 20],
 | 
			
		||||
                myValid01: true
 | 
			
		||||
			},
 | 
			
		||||
            },
 | 
			
		||||
            password : {
 | 
			
		||||
                required : true,
 | 
			
		||||
                rangelength:[4, 20]
 | 
			
		||||
            }
 | 
			
		||||
        }, 
 | 
			
		||||
        },
 | 
			
		||||
        messages : {
 | 
			
		||||
            username : {
 | 
			
		||||
            	required : I18n.system_please_input + I18n.user_username,
 | 
			
		||||
                required : I18n.system_please_input + I18n.user_username,
 | 
			
		||||
                rangelength: I18n.system_lengh_limit + "[4-20]"
 | 
			
		||||
            },
 | 
			
		||||
            password : {
 | 
			
		||||
@@ -183,15 +183,15 @@ $(function() {
 | 
			
		||||
                rangelength: I18n.system_lengh_limit + "[4-20]"
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
		highlight : function(element) {  
 | 
			
		||||
            $(element).closest('.form-group').addClass('has-error');  
 | 
			
		||||
        highlight : function(element) {
 | 
			
		||||
            $(element).closest('.form-group').addClass('has-error');
 | 
			
		||||
        },
 | 
			
		||||
        success : function(label) {  
 | 
			
		||||
            label.closest('.form-group').removeClass('has-error');  
 | 
			
		||||
            label.remove();  
 | 
			
		||||
        success : function(label) {
 | 
			
		||||
            label.closest('.form-group').removeClass('has-error');
 | 
			
		||||
            label.remove();
 | 
			
		||||
        },
 | 
			
		||||
        errorPlacement : function(error, element) {  
 | 
			
		||||
            element.parent('div').append(error);  
 | 
			
		||||
        errorPlacement : function(error, element) {
 | 
			
		||||
            element.parent('div').append(error);
 | 
			
		||||
        },
 | 
			
		||||
        submitHandler : function(form) {
 | 
			
		||||
 | 
			
		||||
@@ -200,38 +200,38 @@ $(function() {
 | 
			
		||||
                permissionArr.push($(this).val());
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
			var paramData = {
 | 
			
		||||
				"username": $("#addModal .form input[name=username]").val(),
 | 
			
		||||
            var paramData = {
 | 
			
		||||
                "username": $("#addModal .form input[name=username]").val(),
 | 
			
		||||
                "password": $("#addModal .form input[name=password]").val(),
 | 
			
		||||
                "role": $("#addModal .form input[name=role]:checked").val(),
 | 
			
		||||
                "permission": permissionArr.join(',')
 | 
			
		||||
			};
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
        	$.post(base_url + "/user/add", paramData, function(data, status) {
 | 
			
		||||
    			if (data.code == "200") {
 | 
			
		||||
					$('#addModal').modal('hide');
 | 
			
		||||
            $.post(base_url + "/user/add", paramData, function(data, status) {
 | 
			
		||||
                if (data.code == "200") {
 | 
			
		||||
                    $('#addModal').modal('hide');
 | 
			
		||||
 | 
			
		||||
                    layer.msg( I18n.system_add_suc );
 | 
			
		||||
                    userListTable.fnDraw();
 | 
			
		||||
    			} else {
 | 
			
		||||
					layer.open({
 | 
			
		||||
						title: I18n.system_tips ,
 | 
			
		||||
                } else {
 | 
			
		||||
                    layer.open({
 | 
			
		||||
                        title: I18n.system_tips ,
 | 
			
		||||
                        btn: [ I18n.system_ok ],
 | 
			
		||||
						content: (data.msg || I18n.system_add_fail),
 | 
			
		||||
						icon: '2'
 | 
			
		||||
					});
 | 
			
		||||
    			}
 | 
			
		||||
    		});
 | 
			
		||||
		}
 | 
			
		||||
	});
 | 
			
		||||
	$("#addModal").on('hide.bs.modal', function () {
 | 
			
		||||
		$("#addModal .form")[0].reset();
 | 
			
		||||
		addModalValidate.resetForm();
 | 
			
		||||
		$("#addModal .form .form-group").removeClass("has-error");
 | 
			
		||||
		$(".remote_panel").show();	// remote
 | 
			
		||||
                        content: (data.msg || I18n.system_add_fail),
 | 
			
		||||
                        icon: '2'
 | 
			
		||||
                    });
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
    $("#addModal").on('hide.bs.modal', function () {
 | 
			
		||||
        $("#addModal .form")[0].reset();
 | 
			
		||||
        addModalValidate.resetForm();
 | 
			
		||||
        $("#addModal .form .form-group").removeClass("has-error");
 | 
			
		||||
        $(".remote_panel").show();    // remote
 | 
			
		||||
 | 
			
		||||
        $("#addModal .form input[name=permission]").parents('.form-group').show();
 | 
			
		||||
	});
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // update role
 | 
			
		||||
    $("#updateModal .form input[name=role]").change(function () {
 | 
			
		||||
@@ -244,21 +244,21 @@ $(function() {
 | 
			
		||||
        $("#updateModal .form input[name='permission']").prop("checked",false);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
	// update
 | 
			
		||||
	$("#user_list").on('click', '.update',function() {
 | 
			
		||||
    // update
 | 
			
		||||
    $("#user_list").on('click', '.update',function() {
 | 
			
		||||
 | 
			
		||||
        var id = $(this).parent('p').attr("id");
 | 
			
		||||
        var row = tableData['key'+id];
 | 
			
		||||
 | 
			
		||||
		// base data
 | 
			
		||||
		$("#updateModal .form input[name='id']").val( row.id );
 | 
			
		||||
		$("#updateModal .form input[name='username']").val( row.username );
 | 
			
		||||
		$("#updateModal .form input[name='password']").val( '' );
 | 
			
		||||
		$("#updateModal .form input[name='role'][value='"+ row.role +"']").click();
 | 
			
		||||
        // base data
 | 
			
		||||
        $("#updateModal .form input[name='id']").val( row.id );
 | 
			
		||||
        $("#updateModal .form input[name='username']").val( row.username );
 | 
			
		||||
        $("#updateModal .form input[name='password']").val( '' );
 | 
			
		||||
        $("#updateModal .form input[name='role'][value='"+ row.role +"']").click();
 | 
			
		||||
        var permissionArr = [];
 | 
			
		||||
        if (row.permission) {
 | 
			
		||||
            permissionArr = row.permission.split(",");
 | 
			
		||||
		}
 | 
			
		||||
        }
 | 
			
		||||
        $("#updateModal .form input[name='permission']").each(function () {
 | 
			
		||||
            if($.inArray($(this).val(), permissionArr) > -1) {
 | 
			
		||||
                $(this).prop("checked",true);
 | 
			
		||||
@@ -267,22 +267,22 @@ $(function() {
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
		// show
 | 
			
		||||
		$('#updateModal').modal({backdrop: false, keyboard: false}).modal('show');
 | 
			
		||||
	});
 | 
			
		||||
	var updateModalValidate = $("#updateModal .form").validate({
 | 
			
		||||
		errorElement : 'span',  
 | 
			
		||||
        // show
 | 
			
		||||
        $('#updateModal').modal({backdrop: false, keyboard: false}).modal('show');
 | 
			
		||||
    });
 | 
			
		||||
    var updateModalValidate = $("#updateModal .form").validate({
 | 
			
		||||
        errorElement : 'span',
 | 
			
		||||
        errorClass : 'help-block',
 | 
			
		||||
        focusInvalid : true,
 | 
			
		||||
		highlight : function(element) {
 | 
			
		||||
            $(element).closest('.form-group').addClass('has-error');  
 | 
			
		||||
        highlight : function(element) {
 | 
			
		||||
            $(element).closest('.form-group').addClass('has-error');
 | 
			
		||||
        },
 | 
			
		||||
        success : function(label) {  
 | 
			
		||||
            label.closest('.form-group').removeClass('has-error');  
 | 
			
		||||
            label.remove();  
 | 
			
		||||
        success : function(label) {
 | 
			
		||||
            label.closest('.form-group').removeClass('has-error');
 | 
			
		||||
            label.remove();
 | 
			
		||||
        },
 | 
			
		||||
        errorPlacement : function(error, element) {  
 | 
			
		||||
            element.parent('div').append(error);  
 | 
			
		||||
        errorPlacement : function(error, element) {
 | 
			
		||||
            element.parent('div').append(error);
 | 
			
		||||
        },
 | 
			
		||||
        submitHandler : function(form) {
 | 
			
		||||
 | 
			
		||||
@@ -314,15 +314,15 @@ $(function() {
 | 
			
		||||
                    });
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
		}
 | 
			
		||||
	});
 | 
			
		||||
	$("#updateModal").on('hide.bs.modal', function () {
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
    $("#updateModal").on('hide.bs.modal', function () {
 | 
			
		||||
        $("#updateModal .form")[0].reset();
 | 
			
		||||
        updateModalValidate.resetForm();
 | 
			
		||||
        $("#updateModal .form .form-group").removeClass("has-error");
 | 
			
		||||
        $(".remote_panel").show();	// remote
 | 
			
		||||
        $(".remote_panel").show();    // remote
 | 
			
		||||
 | 
			
		||||
        $("#updateModal .form input[name=permission]").parents('.form-group').show();
 | 
			
		||||
	});
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "ruoyi-vue-plus",
 | 
			
		||||
  "version": "3.5.0",
 | 
			
		||||
  "version": "4.0.0",
 | 
			
		||||
  "description": "RuoYi-Vue-Plus后台管理系统",
 | 
			
		||||
  "author": "LionLi",
 | 
			
		||||
  "license": "MIT",
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
 | 
			
		||||
    <title><%= webpackConfig.name %></title>
 | 
			
		||||
    <!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
 | 
			
		||||
	  <style>
 | 
			
		||||
    <style>
 | 
			
		||||
    html,
 | 
			
		||||
    body,
 | 
			
		||||
    #app {
 | 
			
		||||
@@ -197,12 +197,12 @@
 | 
			
		||||
  </head>
 | 
			
		||||
  <body>
 | 
			
		||||
    <div id="app">
 | 
			
		||||
	    <div id="loader-wrapper">
 | 
			
		||||
		    <div id="loader"></div>
 | 
			
		||||
		    <div class="loader-section section-left"></div>
 | 
			
		||||
		    <div class="loader-section section-right"></div>
 | 
			
		||||
		    <div class="load_title">正在加载系统资源,请耐心等待</div>
 | 
			
		||||
        <div id="loader-wrapper">
 | 
			
		||||
            <div id="loader"></div>
 | 
			
		||||
            <div class="loader-section section-left"></div>
 | 
			
		||||
            <div class="loader-section section-right"></div>
 | 
			
		||||
            <div class="load_title">正在加载系统资源,请耐心等待</div>
 | 
			
		||||
        </div>
 | 
			
		||||
	</div>
 | 
			
		||||
    </div>
 | 
			
		||||
  </body>
 | 
			
		||||
</html>
 | 
			
		||||
 
 | 
			
		||||
@@ -43,6 +43,18 @@ export function updateConfig(data) {
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 修改参数配置
 | 
			
		||||
export function updateConfigByKey(key, value) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/system/config/updateByKey',
 | 
			
		||||
    method: 'put',
 | 
			
		||||
    data: {
 | 
			
		||||
      configKey: key,
 | 
			
		||||
      configValue: value
 | 
			
		||||
    }
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 删除参数配置
 | 
			
		||||
export function delConfig(configId) {
 | 
			
		||||
  return request({
 | 
			
		||||
 
 | 
			
		||||
@@ -17,13 +17,3 @@ export function delOss(ossId) {
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function changePreviewListResource(previewListResource) {
 | 
			
		||||
  const data = {
 | 
			
		||||
    previewListResource
 | 
			
		||||
  }
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/system/oss/changePreviewListResource',
 | 
			
		||||
    method: 'put',
 | 
			
		||||
    data: data
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
import request from '@/utils/request'
 | 
			
		||||
import { praseStrEmpty } from "@/utils/ruoyi";
 | 
			
		||||
import { parseStrEmpty } from "@/utils/ruoyi";
 | 
			
		||||
 | 
			
		||||
// 查询用户列表
 | 
			
		||||
export function listUser(query) {
 | 
			
		||||
@@ -13,7 +13,7 @@ export function listUser(query) {
 | 
			
		||||
// 查询用户详细
 | 
			
		||||
export function getUser(userId) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/system/user/' + praseStrEmpty(userId),
 | 
			
		||||
    url: '/system/user/' + parseStrEmpty(userId),
 | 
			
		||||
    method: 'get'
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,125 +1,139 @@
 | 
			
		||||
 /**
 | 
			
		||||
 * 通用css样式布局处理
 | 
			
		||||
 * Copyright (c) 2019 ruoyi
 | 
			
		||||
 */
 | 
			
		||||
/**
 | 
			
		||||
* 通用css样式布局处理
 | 
			
		||||
* Copyright (c) 2019 ruoyi
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 /** 基础通用 **/
 | 
			
		||||
/** 基础通用 **/
 | 
			
		||||
.pt5 {
 | 
			
		||||
	padding-top: 5px;
 | 
			
		||||
  padding-top: 5px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.pr5 {
 | 
			
		||||
	padding-right: 5px;
 | 
			
		||||
  padding-right: 5px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.pb5 {
 | 
			
		||||
	padding-bottom: 5px;
 | 
			
		||||
  padding-bottom: 5px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.mt5 {
 | 
			
		||||
	margin-top: 5px;
 | 
			
		||||
  margin-top: 5px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.mr5 {
 | 
			
		||||
	margin-right: 5px;
 | 
			
		||||
  margin-right: 5px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.mb5 {
 | 
			
		||||
	margin-bottom: 5px;
 | 
			
		||||
  margin-bottom: 5px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.mb8 {
 | 
			
		||||
	margin-bottom: 8px;
 | 
			
		||||
  margin-bottom: 8px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.ml5 {
 | 
			
		||||
	margin-left: 5px;
 | 
			
		||||
  margin-left: 5px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.mt10 {
 | 
			
		||||
	margin-top: 10px;
 | 
			
		||||
  margin-top: 10px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.mr10 {
 | 
			
		||||
	margin-right: 10px;
 | 
			
		||||
  margin-right: 10px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.mb10 {
 | 
			
		||||
	margin-bottom: 10px;
 | 
			
		||||
  margin-bottom: 10px;
 | 
			
		||||
}
 | 
			
		||||
.ml0 {
 | 
			
		||||
.ml10 {
 | 
			
		||||
	margin-left: 10px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.mt20 {
 | 
			
		||||
	margin-top: 20px;
 | 
			
		||||
  margin-top: 20px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.mr20 {
 | 
			
		||||
	margin-right: 20px;
 | 
			
		||||
  margin-right: 20px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.mb20 {
 | 
			
		||||
	margin-bottom: 20px;
 | 
			
		||||
  margin-bottom: 20px;
 | 
			
		||||
}
 | 
			
		||||
.m20 {
 | 
			
		||||
.ml20 {
 | 
			
		||||
	margin-left: 20px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 {
 | 
			
		||||
	font-family: inherit;
 | 
			
		||||
	font-weight: 500;
 | 
			
		||||
	line-height: 1.1;
 | 
			
		||||
	color: inherit;
 | 
			
		||||
  font-family: inherit;
 | 
			
		||||
  font-weight: 500;
 | 
			
		||||
  line-height: 1.1;
 | 
			
		||||
  color: inherit;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.el-dialog:not(.is-fullscreen) {
 | 
			
		||||
	margin-top: 6vh !important;
 | 
			
		||||
  margin-top: 6vh !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.el-dialog__wrapper.scrollbar .el-dialog .el-dialog__body {
 | 
			
		||||
    overflow: auto;
 | 
			
		||||
	overflow-x: hidden;
 | 
			
		||||
	max-height: 70vh;
 | 
			
		||||
	padding: 10px 20px 0;
 | 
			
		||||
  overflow: auto;
 | 
			
		||||
  overflow-x: hidden;
 | 
			
		||||
  max-height: 70vh;
 | 
			
		||||
  padding: 10px 20px 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.el-table {
 | 
			
		||||
	.el-table__header-wrapper, .el-table__fixed-header-wrapper {
 | 
			
		||||
		th {
 | 
			
		||||
			word-break: break-word;
 | 
			
		||||
			background-color: #f8f8f9;
 | 
			
		||||
			color: #515a6e;
 | 
			
		||||
			height: 40px;
 | 
			
		||||
			font-size: 13px;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	.el-table__body-wrapper {
 | 
			
		||||
		.el-button [class*="el-icon-"] + span {
 | 
			
		||||
			margin-left: 1px;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
  .el-table__header-wrapper, .el-table__fixed-header-wrapper {
 | 
			
		||||
    th {
 | 
			
		||||
      word-break: break-word;
 | 
			
		||||
      background-color: #f8f8f9;
 | 
			
		||||
      color: #515a6e;
 | 
			
		||||
      height: 40px;
 | 
			
		||||
      font-size: 13px;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .el-table__body-wrapper {
 | 
			
		||||
    .el-button [class*="el-icon-"] + span {
 | 
			
		||||
      margin-left: 1px;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 表单布局 **/
 | 
			
		||||
.form-header {
 | 
			
		||||
    font-size:15px;
 | 
			
		||||
	color:#6379bb;
 | 
			
		||||
	border-bottom:1px solid #ddd;
 | 
			
		||||
	margin:8px 10px 25px 10px;
 | 
			
		||||
	padding-bottom:5px
 | 
			
		||||
  font-size: 15px;
 | 
			
		||||
  color: #6379bb;
 | 
			
		||||
  border-bottom: 1px solid #ddd;
 | 
			
		||||
  margin: 8px 10px 25px 10px;
 | 
			
		||||
  padding-bottom: 5px
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 表格布局 **/
 | 
			
		||||
.pagination-container {
 | 
			
		||||
	position: relative;
 | 
			
		||||
	height: 25px;
 | 
			
		||||
	margin-bottom: 10px;
 | 
			
		||||
	margin-top: 15px;
 | 
			
		||||
	padding: 10px 20px !important;
 | 
			
		||||
  position: relative;
 | 
			
		||||
  height: 25px;
 | 
			
		||||
  margin-bottom: 10px;
 | 
			
		||||
  margin-top: 15px;
 | 
			
		||||
  padding: 10px 20px !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* tree border */
 | 
			
		||||
.tree-border {
 | 
			
		||||
    margin-top: 5px;
 | 
			
		||||
    border: 1px solid #e5e6e7;
 | 
			
		||||
    background: #FFFFFF none;
 | 
			
		||||
    border-radius:4px;
 | 
			
		||||
  margin-top: 5px;
 | 
			
		||||
  border: 1px solid #e5e6e7;
 | 
			
		||||
  background: #FFFFFF none;
 | 
			
		||||
  border-radius: 4px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.pagination-container .el-pagination {
 | 
			
		||||
	right: 0;
 | 
			
		||||
	position: absolute;
 | 
			
		||||
  right: 0;
 | 
			
		||||
  position: absolute;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@media ( max-width : 768px) {
 | 
			
		||||
@media (max-width: 768px) {
 | 
			
		||||
  .pagination-container .el-pagination > .el-pagination__jump {
 | 
			
		||||
    display: none !important;
 | 
			
		||||
  }
 | 
			
		||||
@@ -129,64 +143,64 @@
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.el-table .fixed-width .el-button--mini {
 | 
			
		||||
	padding-left: 0;
 | 
			
		||||
	padding-right: 0;
 | 
			
		||||
	width: inherit;
 | 
			
		||||
  padding-left: 0;
 | 
			
		||||
  padding-right: 0;
 | 
			
		||||
  width: inherit;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 表格更多操作下拉样式 */
 | 
			
		||||
.el-table .el-dropdown-link {
 | 
			
		||||
	cursor: pointer;
 | 
			
		||||
	color: #409EFF;
 | 
			
		||||
	margin-left: 5px;
 | 
			
		||||
  cursor: pointer;
 | 
			
		||||
  color: #409EFF;
 | 
			
		||||
  margin-left: 5px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.el-table .el-dropdown, .el-icon-arrow-down {
 | 
			
		||||
	font-size: 12px;
 | 
			
		||||
  font-size: 12px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.el-tree-node__content > .el-checkbox {
 | 
			
		||||
	margin-right: 8px;
 | 
			
		||||
  margin-right: 8px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.list-group-striped > .list-group-item {
 | 
			
		||||
	border-left: 0;
 | 
			
		||||
	border-right: 0;
 | 
			
		||||
	border-radius: 0;
 | 
			
		||||
	padding-left: 0;
 | 
			
		||||
	padding-right: 0;
 | 
			
		||||
  border-left: 0;
 | 
			
		||||
  border-right: 0;
 | 
			
		||||
  border-radius: 0;
 | 
			
		||||
  padding-left: 0;
 | 
			
		||||
  padding-right: 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.list-group {
 | 
			
		||||
	padding-left: 0px;
 | 
			
		||||
	list-style: none;
 | 
			
		||||
  padding-left: 0px;
 | 
			
		||||
  list-style: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.list-group-item {
 | 
			
		||||
	border-bottom: 1px solid #e7eaec;
 | 
			
		||||
	border-top: 1px solid #e7eaec;
 | 
			
		||||
	margin-bottom: -1px;
 | 
			
		||||
	padding: 11px 0px;
 | 
			
		||||
	font-size: 13px;
 | 
			
		||||
  border-bottom: 1px solid #e7eaec;
 | 
			
		||||
  border-top: 1px solid #e7eaec;
 | 
			
		||||
  margin-bottom: -1px;
 | 
			
		||||
  padding: 11px 0px;
 | 
			
		||||
  font-size: 13px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.pull-right {
 | 
			
		||||
	float: right !important;
 | 
			
		||||
  float: right !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.el-card__header {
 | 
			
		||||
	padding: 14px 15px 7px;
 | 
			
		||||
	min-height: 40px;
 | 
			
		||||
  padding: 14px 15px 7px;
 | 
			
		||||
  min-height: 40px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.el-card__body {
 | 
			
		||||
	padding: 15px 20px 20px 20px;
 | 
			
		||||
  padding: 15px 20px 20px 20px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.card-box {
 | 
			
		||||
	padding-right: 15px;
 | 
			
		||||
	padding-left: 15px;
 | 
			
		||||
	margin-bottom: 10px;
 | 
			
		||||
  padding-right: 15px;
 | 
			
		||||
  padding-left: 15px;
 | 
			
		||||
  margin-bottom: 10px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* button color */
 | 
			
		||||
@@ -212,62 +226,62 @@
 | 
			
		||||
 | 
			
		||||
/* text color */
 | 
			
		||||
.text-navy {
 | 
			
		||||
	color: #1ab394;
 | 
			
		||||
  color: #1ab394;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.text-primary {
 | 
			
		||||
	color: inherit;
 | 
			
		||||
  color: inherit;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.text-success {
 | 
			
		||||
	color: #1c84c6;
 | 
			
		||||
  color: #1c84c6;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.text-info {
 | 
			
		||||
	color: #23c6c8;
 | 
			
		||||
  color: #23c6c8;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.text-warning {
 | 
			
		||||
	color: #f8ac59;
 | 
			
		||||
  color: #f8ac59;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.text-danger {
 | 
			
		||||
	color: #ed5565;
 | 
			
		||||
  color: #ed5565;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.text-muted {
 | 
			
		||||
	color: #888888;
 | 
			
		||||
  color: #888888;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* image */
 | 
			
		||||
.img-circle {
 | 
			
		||||
	border-radius: 50%;
 | 
			
		||||
  border-radius: 50%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.img-lg {
 | 
			
		||||
	width: 120px;
 | 
			
		||||
	height: 120px;
 | 
			
		||||
  width: 120px;
 | 
			
		||||
  height: 120px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.avatar-upload-preview {
 | 
			
		||||
	position: absolute;
 | 
			
		||||
	top: 50%;
 | 
			
		||||
	transform: translate(50%, -50%);
 | 
			
		||||
	width: 200px;
 | 
			
		||||
	height: 200px;
 | 
			
		||||
	border-radius: 50%;
 | 
			
		||||
	box-shadow: 0 0 4px #ccc;
 | 
			
		||||
	overflow: hidden;
 | 
			
		||||
  position: absolute;
 | 
			
		||||
  top: 50%;
 | 
			
		||||
  transform: translate(50%, -50%);
 | 
			
		||||
  width: 200px;
 | 
			
		||||
  height: 200px;
 | 
			
		||||
  border-radius: 50%;
 | 
			
		||||
  box-shadow: 0 0 4px #ccc;
 | 
			
		||||
  overflow: hidden;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* 拖拽列样式 */
 | 
			
		||||
.sortable-ghost{
 | 
			
		||||
	opacity: .8;
 | 
			
		||||
	color: #fff!important;
 | 
			
		||||
	background: #42b983!important;
 | 
			
		||||
.sortable-ghost {
 | 
			
		||||
  opacity: .8;
 | 
			
		||||
  color: #fff !important;
 | 
			
		||||
  background: #42b983 !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.top-right-btn {
 | 
			
		||||
	position: relative;
 | 
			
		||||
	float: right;
 | 
			
		||||
  position: relative;
 | 
			
		||||
  float: right;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@
 | 
			
		||||
			<el-radio v-model='radioValue' :label="4">
 | 
			
		||||
				指定
 | 
			
		||||
				<el-select clearable v-model="checkboxList" placeholder="可多选" multiple style="width:100%">
 | 
			
		||||
					<el-option v-for="item in 60" :key="item" :value="item-1">{{item-1}}</el-option>
 | 
			
		||||
					<el-option v-for="item in 24" :key="item" :value="item-1">{{item-1}}</el-option>
 | 
			
		||||
				</el-select>
 | 
			
		||||
			</el-radio>
 | 
			
		||||
		</el-form-item>
 | 
			
		||||
@@ -111,4 +111,4 @@ export default {
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@
 | 
			
		||||
 | 
			
		||||
    <!-- 文件列表 -->
 | 
			
		||||
    <transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
 | 
			
		||||
      <li :key="file.uid" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">
 | 
			
		||||
      <li :key="file.url" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">
 | 
			
		||||
        <el-link :href="`${file.url}`" :underline="false" target="_blank">
 | 
			
		||||
          <span class="el-icon-document"> {{ getFileName(file.name) }} </span>
 | 
			
		||||
        </el-link>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,67 +1,84 @@
 | 
			
		||||
<template>
 | 
			
		||||
    <el-image :src="`${realSrc}`" fit="cover" :style="`width:${realWidth};height:${realHeight};`" :preview-src-list="[`${realSrc}`]">
 | 
			
		||||
        <div slot="error" class="image-slot">
 | 
			
		||||
          <i class="el-icon-picture-outline"></i>
 | 
			
		||||
        </div>
 | 
			
		||||
    </el-image>
 | 
			
		||||
  <el-image
 | 
			
		||||
    :src="`${realSrc}`"
 | 
			
		||||
    fit="cover"
 | 
			
		||||
    :style="`width:${realWidth};height:${realHeight};`"
 | 
			
		||||
    :preview-src-list="realSrcList"
 | 
			
		||||
  >
 | 
			
		||||
    <div slot="error" class="image-slot">
 | 
			
		||||
      <i class="el-icon-picture-outline"></i>
 | 
			
		||||
    </div>
 | 
			
		||||
  </el-image>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import { isExternal } from '@/utils/validate'
 | 
			
		||||
import { isExternal } from "@/utils/validate";
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
    name: 'ImagePreview',
 | 
			
		||||
    props: {
 | 
			
		||||
        src: {
 | 
			
		||||
            type: String,
 | 
			
		||||
            required: true
 | 
			
		||||
        },
 | 
			
		||||
        width: {
 | 
			
		||||
            type: [Number, String],
 | 
			
		||||
            default: ''
 | 
			
		||||
        },
 | 
			
		||||
        height: {
 | 
			
		||||
            type: [Number, String],
 | 
			
		||||
            default: ''
 | 
			
		||||
        }
 | 
			
		||||
  name: "ImagePreview",
 | 
			
		||||
  props: {
 | 
			
		||||
    src: {
 | 
			
		||||
      type: String,
 | 
			
		||||
      required: true
 | 
			
		||||
    },
 | 
			
		||||
    computed: {
 | 
			
		||||
        realSrc() {
 | 
			
		||||
            if (isExternal(this.src)) {
 | 
			
		||||
                return this.src
 | 
			
		||||
            }
 | 
			
		||||
            return process.env.VUE_APP_BASE_API + this.src
 | 
			
		||||
        },
 | 
			
		||||
        realWidth() {
 | 
			
		||||
            return typeof this.width == 'string' ? this.width : `${this.width}px`
 | 
			
		||||
        },
 | 
			
		||||
        realHeight() {
 | 
			
		||||
            return typeof this.height == 'string' ? this.height : `${this.height}px`
 | 
			
		||||
        }
 | 
			
		||||
    width: {
 | 
			
		||||
      type: [Number, String],
 | 
			
		||||
      default: ""
 | 
			
		||||
    },
 | 
			
		||||
    height: {
 | 
			
		||||
      type: [Number, String],
 | 
			
		||||
      default: ""
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
  },
 | 
			
		||||
  computed: {
 | 
			
		||||
    realSrc() {
 | 
			
		||||
      let real_src = this.src.split(",")[0];
 | 
			
		||||
      if (isExternal(real_src)) {
 | 
			
		||||
        return real_src;
 | 
			
		||||
      }
 | 
			
		||||
      return process.env.VUE_APP_BASE_API + real_src;
 | 
			
		||||
    },
 | 
			
		||||
    realSrcList() {
 | 
			
		||||
      let real_src_list = this.src.split(",");
 | 
			
		||||
      let srcList = [];
 | 
			
		||||
      real_src_list.forEach(item => {
 | 
			
		||||
        if (isExternal(item)) {
 | 
			
		||||
          return srcList.push(item);
 | 
			
		||||
        }
 | 
			
		||||
        return srcList.push(process.env.VUE_APP_BASE_API + item);
 | 
			
		||||
      });
 | 
			
		||||
      return srcList;
 | 
			
		||||
    },
 | 
			
		||||
    realWidth() {
 | 
			
		||||
      return typeof this.width == "string" ? this.width : `${this.width}px`;
 | 
			
		||||
    },
 | 
			
		||||
    realHeight() {
 | 
			
		||||
      return typeof this.height == "string" ? this.height : `${this.height}px`;
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style lang="scss" scoped>
 | 
			
		||||
.el-image {
 | 
			
		||||
    border-radius: 5px;
 | 
			
		||||
    background-color: #ebeef5;
 | 
			
		||||
    box-shadow: 0 0 5px 1px #ccc;
 | 
			
		||||
    ::v-deep .el-image__inner {
 | 
			
		||||
        transition: all 0.3s;
 | 
			
		||||
        cursor: pointer;
 | 
			
		||||
        &:hover {
 | 
			
		||||
            transform: scale(1.2);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    ::v-deep .image-slot {
 | 
			
		||||
        display: flex;
 | 
			
		||||
        justify-content: center;
 | 
			
		||||
        align-items: center;
 | 
			
		||||
        width: 100%;
 | 
			
		||||
        height: 100%;
 | 
			
		||||
        color: #909399;
 | 
			
		||||
        font-size: 30px;
 | 
			
		||||
  border-radius: 5px;
 | 
			
		||||
  background-color: #ebeef5;
 | 
			
		||||
  box-shadow: 0 0 5px 1px #ccc;
 | 
			
		||||
  ::v-deep .el-image__inner {
 | 
			
		||||
    transition: all 0.3s;
 | 
			
		||||
    cursor: pointer;
 | 
			
		||||
    &:hover {
 | 
			
		||||
      transform: scale(1.2);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  ::v-deep .image-slot {
 | 
			
		||||
    display: flex;
 | 
			
		||||
    justify-content: center;
 | 
			
		||||
    align-items: center;
 | 
			
		||||
    width: 100%;
 | 
			
		||||
    height: 100%;
 | 
			
		||||
    color: #909399;
 | 
			
		||||
    font-size: 30px;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div :class="{'hidden':hidden}" class="pagination-container">
 | 
			
		||||
    <el-pagination
 | 
			
		||||
      v-if="pageShow"
 | 
			
		||||
      :background="background"
 | 
			
		||||
      :current-page.sync="currentPage"
 | 
			
		||||
      :page-size.sync="pageSize"
 | 
			
		||||
@@ -61,6 +62,11 @@ export default {
 | 
			
		||||
      default: false
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      pageShow: true
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  computed: {
 | 
			
		||||
    currentPage: {
 | 
			
		||||
      get() {
 | 
			
		||||
@@ -81,6 +87,12 @@ export default {
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    handleSizeChange(val) {
 | 
			
		||||
      if (this.currentPage * val > this.total) {
 | 
			
		||||
        this.pageShow = false;
 | 
			
		||||
        this.$nextTick(() => {
 | 
			
		||||
          this.pageShow = true
 | 
			
		||||
        })
 | 
			
		||||
      }
 | 
			
		||||
      this.$emit('pagination', { page: this.currentPage, limit: val })
 | 
			
		||||
      if (this.autoScroll) {
 | 
			
		||||
        scrollTo(0, 800)
 | 
			
		||||
 
 | 
			
		||||
@@ -161,7 +161,7 @@ export default {
 | 
			
		||||
      }
 | 
			
		||||
      return routes;
 | 
			
		||||
    },
 | 
			
		||||
	ishttp(url) {
 | 
			
		||||
    ishttp(url) {
 | 
			
		||||
      return url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@ import { download } from '@/utils/request'
 | 
			
		||||
import './assets/icons' // icon
 | 
			
		||||
import './permission' // permission control
 | 
			
		||||
import { getDicts } from "@/api/system/dict/data";
 | 
			
		||||
import { getConfigKey } from "@/api/system/config";
 | 
			
		||||
import { getConfigKey, updateConfigByKey } from "@/api/system/config";
 | 
			
		||||
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
 | 
			
		||||
// 分页组件
 | 
			
		||||
import Pagination from "@/components/Pagination";
 | 
			
		||||
@@ -41,6 +41,7 @@ import DictData from '@/components/DictData'
 | 
			
		||||
// 全局方法挂载
 | 
			
		||||
Vue.prototype.getDicts = getDicts
 | 
			
		||||
Vue.prototype.getConfigKey = getConfigKey
 | 
			
		||||
Vue.prototype.updateConfigByKey = updateConfigByKey
 | 
			
		||||
Vue.prototype.parseTime = parseTime
 | 
			
		||||
Vue.prototype.resetForm = resetForm
 | 
			
		||||
Vue.prototype.addDateRange = addDateRange
 | 
			
		||||
 
 | 
			
		||||
@@ -4,20 +4,21 @@ import router from '@/router';
 | 
			
		||||
export default {
 | 
			
		||||
  // 刷新当前tab页签
 | 
			
		||||
  refreshPage(obj) {
 | 
			
		||||
    const { path, matched } = router.currentRoute;
 | 
			
		||||
    const { path, query, matched } = router.currentRoute;
 | 
			
		||||
    if (obj === undefined) {
 | 
			
		||||
      matched.forEach((m) => {
 | 
			
		||||
        if (m.components && m.components.default && m.components.default.name) {
 | 
			
		||||
          if (!['Layout', 'ParentView'].includes(m.components.default.name)) {
 | 
			
		||||
            obj = { name: m.components.default.name, path: path };
 | 
			
		||||
            obj = { name: m.components.default.name, path: path, query: query };
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
    return store.dispatch('tagsView/delCachedView', obj).then(() => {
 | 
			
		||||
      const { path } = obj
 | 
			
		||||
      const { path, query } = obj
 | 
			
		||||
      router.replace({
 | 
			
		||||
        path: '/redirect' + path
 | 
			
		||||
        path: '/redirect' + path,
 | 
			
		||||
        query: query
 | 
			
		||||
      })
 | 
			
		||||
    })
 | 
			
		||||
  },
 | 
			
		||||
 
 | 
			
		||||
@@ -155,7 +155,7 @@ export const dynamicRoutes = [
 | 
			
		||||
    permissions: ['tool:gen:edit'],
 | 
			
		||||
    children: [
 | 
			
		||||
      {
 | 
			
		||||
        path: 'index',
 | 
			
		||||
        path: 'index/:tableId(\\d+)',
 | 
			
		||||
        component: () => import('@/views/tool/gen/editTable'),
 | 
			
		||||
        name: 'GenEdit',
 | 
			
		||||
        meta: { title: '修改生成配置', activeMenu: '/tool/gen' }
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										29
									
								
								ruoyi-ui/src/utils/generator/drawingDefault.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								ruoyi-ui/src/utils/generator/drawingDefault.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
			
		||||
export default [
 | 
			
		||||
  {
 | 
			
		||||
    layout: 'colFormItem',
 | 
			
		||||
    tagIcon: 'input',
 | 
			
		||||
    label: '手机号',
 | 
			
		||||
    vModel: 'mobile',
 | 
			
		||||
    formId: 6,
 | 
			
		||||
    tag: 'el-input',
 | 
			
		||||
    placeholder: '请输入手机号',
 | 
			
		||||
    defaultValue: '',
 | 
			
		||||
    span: 24,
 | 
			
		||||
    style: { width: '100%' },
 | 
			
		||||
    clearable: true,
 | 
			
		||||
    prepend: '',
 | 
			
		||||
    append: '',
 | 
			
		||||
    'prefix-icon': 'el-icon-mobile',
 | 
			
		||||
    'suffix-icon': '',
 | 
			
		||||
    maxlength: 11,
 | 
			
		||||
    'show-word-limit': true,
 | 
			
		||||
    readonly: false,
 | 
			
		||||
    disabled: false,
 | 
			
		||||
    required: true,
 | 
			
		||||
    changeTag: true,
 | 
			
		||||
    regList: [{
 | 
			
		||||
      pattern: '/^1(3|4|5|7|8|9)\\d{9}$/',
 | 
			
		||||
      message: '手机号格式错误'
 | 
			
		||||
    }]
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
@@ -5,11 +5,11 @@ let confGlobal
 | 
			
		||||
let someSpanIsNot24
 | 
			
		||||
 | 
			
		||||
export function dialogWrapper(str) {
 | 
			
		||||
  return `<el-dialog v-bind="$attrs" v-on="$listeners" @open="onOpen" @close="onClose" title="Dialog Titile">
 | 
			
		||||
  return `<el-dialog v-bind="$attrs" v-on="$listeners" @open="onOpen" @close="onClose" title="Dialog Title">
 | 
			
		||||
    ${str}
 | 
			
		||||
    <div slot="footer">
 | 
			
		||||
      <el-button @click="close">取消</el-button>
 | 
			
		||||
      <el-button type="primary" @click="handelConfirm">确定</el-button>
 | 
			
		||||
      <el-button type="primary" @click="handleConfirm">确定</el-button>
 | 
			
		||||
    </div>
 | 
			
		||||
  </el-dialog>`
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -98,7 +98,7 @@ function mixinMethod(type) {
 | 
			
		||||
        close: `close() {
 | 
			
		||||
        this.$emit('update:visible', false)
 | 
			
		||||
      },`,
 | 
			
		||||
        handelConfirm: `handelConfirm() {
 | 
			
		||||
        handleConfirm: `handleConfirm() {
 | 
			
		||||
        this.$refs['${confGlobal.formRef}'].validate(valid => {
 | 
			
		||||
          if(!valid) return
 | 
			
		||||
          this.close()
 | 
			
		||||
 
 | 
			
		||||
@@ -4,9 +4,12 @@ import store from '@/store'
 | 
			
		||||
import { getToken } from '@/utils/auth'
 | 
			
		||||
import errorCode from '@/utils/errorCode'
 | 
			
		||||
import { tansParams, blobValidate } from "@/utils/ruoyi";
 | 
			
		||||
import cache from '@/plugins/cache'
 | 
			
		||||
import { saveAs } from 'file-saver'
 | 
			
		||||
 | 
			
		||||
let downloadLoadingInstance;
 | 
			
		||||
// 是否显示重新登录
 | 
			
		||||
let isReloginShow;
 | 
			
		||||
 | 
			
		||||
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
 | 
			
		||||
// 对应国际化资源文件后缀
 | 
			
		||||
@@ -23,6 +26,8 @@ const service = axios.create({
 | 
			
		||||
service.interceptors.request.use(config => {
 | 
			
		||||
  // 是否需要设置 token
 | 
			
		||||
  const isToken = (config.headers || {}).isToken === false
 | 
			
		||||
  // 是否需要防止数据重复提交
 | 
			
		||||
  const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
 | 
			
		||||
  if (getToken() && !isToken) {
 | 
			
		||||
    config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
 | 
			
		||||
  }
 | 
			
		||||
@@ -33,6 +38,29 @@ service.interceptors.request.use(config => {
 | 
			
		||||
    config.params = {};
 | 
			
		||||
    config.url = url;
 | 
			
		||||
  }
 | 
			
		||||
  if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
 | 
			
		||||
    const requestObj = {
 | 
			
		||||
      url: config.url,
 | 
			
		||||
      data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,
 | 
			
		||||
      time: new Date().getTime()
 | 
			
		||||
    }
 | 
			
		||||
    const sessionObj = cache.session.getJSON('sessionObj')
 | 
			
		||||
    if (sessionObj === undefined || sessionObj === null || sessionObj === '') {
 | 
			
		||||
      cache.session.setJSON('sessionObj', requestObj)
 | 
			
		||||
    } else {
 | 
			
		||||
      const s_url = sessionObj.url;                  // 请求地址
 | 
			
		||||
      const s_data = sessionObj.data;                // 请求数据
 | 
			
		||||
      const s_time = sessionObj.time;                // 请求时间
 | 
			
		||||
      const interval = 1000;                         // 间隔时间(ms),小于此时间视为重复提交
 | 
			
		||||
      if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) {
 | 
			
		||||
        const message = '数据正在处理,请勿重复提交';
 | 
			
		||||
        console.warn(`[${s_url}]: ` + message)
 | 
			
		||||
        return Promise.reject(new Error(message))
 | 
			
		||||
      } else {
 | 
			
		||||
        cache.session.setJSON('sessionObj', requestObj)
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return config
 | 
			
		||||
}, error => {
 | 
			
		||||
    console.log(error)
 | 
			
		||||
@@ -50,16 +78,25 @@ service.interceptors.response.use(res => {
 | 
			
		||||
      return res.data
 | 
			
		||||
    }
 | 
			
		||||
    if (code === 401) {
 | 
			
		||||
      MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
 | 
			
		||||
      if (!isReloginShow) {
 | 
			
		||||
        isReloginShow = true;
 | 
			
		||||
        MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
 | 
			
		||||
          confirmButtonText: '重新登录',
 | 
			
		||||
          cancelButtonText: '取消',
 | 
			
		||||
          type: 'warning'
 | 
			
		||||
        }
 | 
			
		||||
      ).then(() => {
 | 
			
		||||
        isReloginShow = false;
 | 
			
		||||
        store.dispatch('LogOut').then(() => {
 | 
			
		||||
          location.href = process.env.VUE_APP_CONTEXT_PATH + "index";
 | 
			
		||||
          // 如果是登录页面不需要重新加载
 | 
			
		||||
          if (window.location.hash.indexOf("#/login") != 0) {
 | 
			
		||||
            location.href = process.env.VUE_APP_CONTEXT_PATH + "index";
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
      }).catch(() => {});
 | 
			
		||||
      }).catch(() => {
 | 
			
		||||
        isReloginShow = false;
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
      return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
 | 
			
		||||
    } else if (code === 500) {
 | 
			
		||||
      Message({
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,5 @@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 通用js方法封装处理
 | 
			
		||||
 * Copyright (c) 2019 ruoyi
 | 
			
		||||
@@ -5,130 +7,133 @@
 | 
			
		||||
 | 
			
		||||
// 日期格式化
 | 
			
		||||
export function parseTime(time, pattern) {
 | 
			
		||||
	if (arguments.length === 0 || !time) {
 | 
			
		||||
		return null
 | 
			
		||||
	}
 | 
			
		||||
	const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
 | 
			
		||||
	let date
 | 
			
		||||
	if (typeof time === 'object') {
 | 
			
		||||
		date = time
 | 
			
		||||
	} else {
 | 
			
		||||
		if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
 | 
			
		||||
			time = parseInt(time)
 | 
			
		||||
		} else if (typeof time === 'string') {
 | 
			
		||||
			time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm),'');
 | 
			
		||||
		}
 | 
			
		||||
		if ((typeof time === 'number') && (time.toString().length === 10)) {
 | 
			
		||||
			time = time * 1000
 | 
			
		||||
		}
 | 
			
		||||
		date = new Date(time)
 | 
			
		||||
	}
 | 
			
		||||
	const formatObj = {
 | 
			
		||||
		y: date.getFullYear(),
 | 
			
		||||
		m: date.getMonth() + 1,
 | 
			
		||||
		d: date.getDate(),
 | 
			
		||||
		h: date.getHours(),
 | 
			
		||||
		i: date.getMinutes(),
 | 
			
		||||
		s: date.getSeconds(),
 | 
			
		||||
		a: date.getDay()
 | 
			
		||||
	}
 | 
			
		||||
	const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
 | 
			
		||||
		let value = formatObj[key]
 | 
			
		||||
		// Note: getDay() returns 0 on Sunday
 | 
			
		||||
		if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
 | 
			
		||||
		if (result.length > 0 && value < 10) {
 | 
			
		||||
			value = '0' + value
 | 
			
		||||
		}
 | 
			
		||||
		return value || 0
 | 
			
		||||
	})
 | 
			
		||||
	return time_str
 | 
			
		||||
  if (arguments.length === 0 || !time) {
 | 
			
		||||
    return null
 | 
			
		||||
  }
 | 
			
		||||
  const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
 | 
			
		||||
  let date
 | 
			
		||||
  if (typeof time === 'object') {
 | 
			
		||||
    date = time
 | 
			
		||||
  } else {
 | 
			
		||||
    if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
 | 
			
		||||
      time = parseInt(time)
 | 
			
		||||
    } else if (typeof time === 'string') {
 | 
			
		||||
      time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm), '');
 | 
			
		||||
    }
 | 
			
		||||
    if ((typeof time === 'number') && (time.toString().length === 10)) {
 | 
			
		||||
      time = time * 1000
 | 
			
		||||
    }
 | 
			
		||||
    date = new Date(time)
 | 
			
		||||
  }
 | 
			
		||||
  const formatObj = {
 | 
			
		||||
    y: date.getFullYear(),
 | 
			
		||||
    m: date.getMonth() + 1,
 | 
			
		||||
    d: date.getDate(),
 | 
			
		||||
    h: date.getHours(),
 | 
			
		||||
    i: date.getMinutes(),
 | 
			
		||||
    s: date.getSeconds(),
 | 
			
		||||
    a: date.getDay()
 | 
			
		||||
  }
 | 
			
		||||
  const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
 | 
			
		||||
    let value = formatObj[key]
 | 
			
		||||
    // Note: getDay() returns 0 on Sunday
 | 
			
		||||
    if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
 | 
			
		||||
    if (result.length > 0 && value < 10) {
 | 
			
		||||
      value = '0' + value
 | 
			
		||||
    }
 | 
			
		||||
    return value || 0
 | 
			
		||||
  })
 | 
			
		||||
  return time_str
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 表单重置
 | 
			
		||||
export function resetForm(refName) {
 | 
			
		||||
	if (this.$refs[refName]) {
 | 
			
		||||
		this.$refs[refName].resetFields();
 | 
			
		||||
	}
 | 
			
		||||
  if (this.$refs[refName]) {
 | 
			
		||||
    this.$refs[refName].resetFields();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 添加日期范围
 | 
			
		||||
export function addDateRange(params, dateRange, propName) {
 | 
			
		||||
	let search = params;
 | 
			
		||||
	search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {};
 | 
			
		||||
	dateRange = Array.isArray(dateRange) ? dateRange : [];
 | 
			
		||||
	if (typeof (propName) === 'undefined') {
 | 
			
		||||
		search.params['beginTime'] = dateRange[0];
 | 
			
		||||
		search.params['endTime'] = dateRange[1];
 | 
			
		||||
	} else {
 | 
			
		||||
		search.params['begin' + propName] = dateRange[0];
 | 
			
		||||
		search.params['end' + propName] = dateRange[1];
 | 
			
		||||
	}
 | 
			
		||||
	return search;
 | 
			
		||||
  let search = params;
 | 
			
		||||
  search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {};
 | 
			
		||||
  dateRange = Array.isArray(dateRange) ? dateRange : [];
 | 
			
		||||
  if (typeof (propName) === 'undefined') {
 | 
			
		||||
    search.params['beginTime'] = dateRange[0];
 | 
			
		||||
    search.params['endTime'] = dateRange[1];
 | 
			
		||||
  } else {
 | 
			
		||||
    search.params['begin' + propName] = dateRange[0];
 | 
			
		||||
    search.params['end' + propName] = dateRange[1];
 | 
			
		||||
  }
 | 
			
		||||
  return search;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 回显数据字典
 | 
			
		||||
// 回显数据字典 
 | 
			
		||||
export function selectDictLabel(datas, value) {
 | 
			
		||||
	var actions = [];
 | 
			
		||||
	Object.keys(datas).some((key) => {
 | 
			
		||||
		if (datas[key].value == ('' + value)) {
 | 
			
		||||
			actions.push(datas[key].label);
 | 
			
		||||
			return true;
 | 
			
		||||
		}
 | 
			
		||||
	})
 | 
			
		||||
	return actions.join('');
 | 
			
		||||
  var actions = [];
 | 
			
		||||
  Object.keys(datas).some((key) => {
 | 
			
		||||
    if (datas[key].value == ('' + value)) {
 | 
			
		||||
      actions.push(datas[key].label);
 | 
			
		||||
      return true;
 | 
			
		||||
    }
 | 
			
		||||
  })
 | 
			
		||||
  return actions.join('');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 回显数据字典(字符串数组)
 | 
			
		||||
export function selectDictLabels(datas, value, separator) {
 | 
			
		||||
	var actions = [];
 | 
			
		||||
	var currentSeparator = undefined === separator ? "," : separator;
 | 
			
		||||
	var temp = value.split(currentSeparator);
 | 
			
		||||
	Object.keys(value.split(currentSeparator)).some((val) => {
 | 
			
		||||
		Object.keys(datas).some((key) => {
 | 
			
		||||
			if (datas[key].value == ('' + temp[val])) {
 | 
			
		||||
				actions.push(datas[key].label + currentSeparator);
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
	})
 | 
			
		||||
	return actions.join('').substring(0, actions.join('').length - 1);
 | 
			
		||||
  if(value === undefined) {
 | 
			
		||||
    return "";
 | 
			
		||||
  }
 | 
			
		||||
  var actions = [];
 | 
			
		||||
  var currentSeparator = undefined === separator ? "," : separator;
 | 
			
		||||
  var temp = value.split(currentSeparator);
 | 
			
		||||
  Object.keys(value.split(currentSeparator)).some((val) => {
 | 
			
		||||
    Object.keys(datas).some((key) => {
 | 
			
		||||
      if (datas[key].value == ('' + temp[val])) {
 | 
			
		||||
        actions.push(datas[key].label + currentSeparator);
 | 
			
		||||
      }
 | 
			
		||||
    })
 | 
			
		||||
  })
 | 
			
		||||
  return actions.join('').substring(0, actions.join('').length - 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 字符串格式化(%s )
 | 
			
		||||
export function sprintf(str) {
 | 
			
		||||
	var args = arguments, flag = true, i = 1;
 | 
			
		||||
	str = str.replace(/%s/g, function () {
 | 
			
		||||
		var arg = args[i++];
 | 
			
		||||
		if (typeof arg === 'undefined') {
 | 
			
		||||
			flag = false;
 | 
			
		||||
			return '';
 | 
			
		||||
		}
 | 
			
		||||
		return arg;
 | 
			
		||||
	});
 | 
			
		||||
	return flag ? str : '';
 | 
			
		||||
  var args = arguments, flag = true, i = 1;
 | 
			
		||||
  str = str.replace(/%s/g, function () {
 | 
			
		||||
    var arg = args[i++];
 | 
			
		||||
    if (typeof arg === 'undefined') {
 | 
			
		||||
      flag = false;
 | 
			
		||||
      return '';
 | 
			
		||||
    }
 | 
			
		||||
    return arg;
 | 
			
		||||
  });
 | 
			
		||||
  return flag ? str : '';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 转换字符串,undefined,null等转化为""
 | 
			
		||||
export function praseStrEmpty(str) {
 | 
			
		||||
	if (!str || str == "undefined" || str == "null") {
 | 
			
		||||
		return "";
 | 
			
		||||
	}
 | 
			
		||||
	return str;
 | 
			
		||||
export function parseStrEmpty(str) {
 | 
			
		||||
  if (!str || str == "undefined" || str == "null") {
 | 
			
		||||
    return "";
 | 
			
		||||
  }
 | 
			
		||||
  return str;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 数据合并
 | 
			
		||||
export function mergeRecursive(source, target) {
 | 
			
		||||
    for (var p in target) {
 | 
			
		||||
        try {
 | 
			
		||||
            if (target[p].constructor == Object) {
 | 
			
		||||
                source[p] = mergeRecursive(source[p], target[p]);
 | 
			
		||||
            } else {
 | 
			
		||||
                source[p] = target[p];
 | 
			
		||||
            }
 | 
			
		||||
        } catch(e) {
 | 
			
		||||
            source[p] = target[p];
 | 
			
		||||
        }
 | 
			
		||||
  for (var p in target) {
 | 
			
		||||
    try {
 | 
			
		||||
      if (target[p].constructor == Object) {
 | 
			
		||||
        source[p] = mergeRecursive(source[p], target[p]);
 | 
			
		||||
      } else {
 | 
			
		||||
        source[p] = target[p];
 | 
			
		||||
      }
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
      source[p] = target[p];
 | 
			
		||||
    }
 | 
			
		||||
    return source;
 | 
			
		||||
  }
 | 
			
		||||
  return source;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -139,47 +144,47 @@ export function mergeRecursive(source, target) {
 | 
			
		||||
 * @param {*} children 孩子节点字段 默认 'children'
 | 
			
		||||
 */
 | 
			
		||||
export function handleTree(data, id, parentId, children) {
 | 
			
		||||
	let config = {
 | 
			
		||||
		id: id || 'id',
 | 
			
		||||
		parentId: parentId || 'parentId',
 | 
			
		||||
		childrenList: children || 'children'
 | 
			
		||||
	};
 | 
			
		||||
  let config = {
 | 
			
		||||
    id: id || 'id',
 | 
			
		||||
    parentId: parentId || 'parentId',
 | 
			
		||||
    childrenList: children || 'children'
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
	var childrenListMap = {};
 | 
			
		||||
	var nodeIds = {};
 | 
			
		||||
	var tree = [];
 | 
			
		||||
  var childrenListMap = {};
 | 
			
		||||
  var nodeIds = {};
 | 
			
		||||
  var tree = [];
 | 
			
		||||
 | 
			
		||||
	for (let d of data) {
 | 
			
		||||
		let parentId = d[config.parentId];
 | 
			
		||||
		if (childrenListMap[parentId] == null) {
 | 
			
		||||
			childrenListMap[parentId] = [];
 | 
			
		||||
		}
 | 
			
		||||
		nodeIds[d[config.id]] = d;
 | 
			
		||||
		childrenListMap[parentId].push(d);
 | 
			
		||||
	}
 | 
			
		||||
  for (let d of data) {
 | 
			
		||||
    let parentId = d[config.parentId];
 | 
			
		||||
    if (childrenListMap[parentId] == null) {
 | 
			
		||||
      childrenListMap[parentId] = [];
 | 
			
		||||
    }
 | 
			
		||||
    nodeIds[d[config.id]] = d;
 | 
			
		||||
    childrenListMap[parentId].push(d);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
	for (let d of data) {
 | 
			
		||||
		let parentId = d[config.parentId];
 | 
			
		||||
		if (nodeIds[parentId] == null) {
 | 
			
		||||
			tree.push(d);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
  for (let d of data) {
 | 
			
		||||
    let parentId = d[config.parentId];
 | 
			
		||||
    if (nodeIds[parentId] == null) {
 | 
			
		||||
      tree.push(d);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
	for (let t of tree) {
 | 
			
		||||
		adaptToChildrenList(t);
 | 
			
		||||
	}
 | 
			
		||||
  for (let t of tree) {
 | 
			
		||||
    adaptToChildrenList(t);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
	function adaptToChildrenList(o) {
 | 
			
		||||
		if (childrenListMap[o[config.id]] !== null) {
 | 
			
		||||
			o[config.childrenList] = childrenListMap[o[config.id]];
 | 
			
		||||
		}
 | 
			
		||||
		if (o[config.childrenList]) {
 | 
			
		||||
			for (let c of o[config.childrenList]) {
 | 
			
		||||
				adaptToChildrenList(c);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return tree;
 | 
			
		||||
  function adaptToChildrenList(o) {
 | 
			
		||||
    if (childrenListMap[o[config.id]] !== null) {
 | 
			
		||||
      o[config.childrenList] = childrenListMap[o[config.id]];
 | 
			
		||||
    }
 | 
			
		||||
    if (o[config.childrenList]) {
 | 
			
		||||
      for (let c of o[config.childrenList]) {
 | 
			
		||||
        adaptToChildrenList(c);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return tree;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -187,34 +192,34 @@ export function handleTree(data, id, parentId, children) {
 | 
			
		||||
* @param {*} params  参数
 | 
			
		||||
*/
 | 
			
		||||
export function tansParams(params) {
 | 
			
		||||
	let result = ''
 | 
			
		||||
	for (const propName of Object.keys(params)) {
 | 
			
		||||
		const value = params[propName];
 | 
			
		||||
		var part = encodeURIComponent(propName) + "=";
 | 
			
		||||
		if (value !== null && typeof (value) !== "undefined") {
 | 
			
		||||
			if (typeof value === 'object') {
 | 
			
		||||
				for (const key of Object.keys(value)) {
 | 
			
		||||
					if (value[key] !== null && typeof (value[key]) !== 'undefined') {
 | 
			
		||||
						let params = propName + '[' + key + ']';
 | 
			
		||||
						var subPart = encodeURIComponent(params) + "=";
 | 
			
		||||
						result += subPart + encodeURIComponent(value[key]) + "&";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			} else {
 | 
			
		||||
				result += part + encodeURIComponent(value) + "&";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return result
 | 
			
		||||
  let result = ''
 | 
			
		||||
  for (const propName of Object.keys(params)) {
 | 
			
		||||
    const value = params[propName];
 | 
			
		||||
    var part = encodeURIComponent(propName) + "=";
 | 
			
		||||
    if (value !== null && typeof (value) !== "undefined") {
 | 
			
		||||
      if (typeof value === 'object') {
 | 
			
		||||
        for (const key of Object.keys(value)) {
 | 
			
		||||
          if (value[key] !== null && typeof (value[key]) !== 'undefined') {
 | 
			
		||||
            let params = propName + '[' + key + ']';
 | 
			
		||||
            var subPart = encodeURIComponent(params) + "=";
 | 
			
		||||
            result += subPart + encodeURIComponent(value[key]) + "&";
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      } else {
 | 
			
		||||
        result += part + encodeURIComponent(value) + "&";
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return result
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 验证是否为blob格式
 | 
			
		||||
export async function blobValidate(data) {
 | 
			
		||||
    try {
 | 
			
		||||
      const text = await data.text();
 | 
			
		||||
      JSON.parse(text);
 | 
			
		||||
      return false;
 | 
			
		||||
    } catch (error) {
 | 
			
		||||
      return true;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
  try {
 | 
			
		||||
    const text = await data.text();
 | 
			
		||||
    JSON.parse(text);
 | 
			
		||||
    return false;
 | 
			
		||||
  } catch (error) {
 | 
			
		||||
    return true;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -23,7 +23,7 @@
 | 
			
		||||
          * 分布式日志 TLog 支持跟踪链路日志记录、性能分析、链路排查<br/>
 | 
			
		||||
          * 分布式任务调度 Xxl-Job 高性能 高可靠 易扩展<br/>
 | 
			
		||||
          * 文件存储 Minio 本地存储<br/>
 | 
			
		||||
          * 文件存储 七牛、阿里、腾讯	云存储<br/>
 | 
			
		||||
          * 文件存储 七牛、阿里、腾讯 云存储<br/>
 | 
			
		||||
          * 监控框架 SpringBoot-Admin 全方位服务监控<br/>
 | 
			
		||||
          * 校验框架 Validation 增强接口安全性 严谨性<br/>
 | 
			
		||||
          * Excel框架 Alibaba EasyExcel 性能优异 扩展性强<br/>
 | 
			
		||||
@@ -101,6 +101,70 @@
 | 
			
		||||
            <span>更新日志</span>
 | 
			
		||||
          </div>
 | 
			
		||||
          <el-collapse accordion>
 | 
			
		||||
            <el-collapse-item title="v4.0.0 - 2022-02-18">
 | 
			
		||||
              <ol>
 | 
			
		||||
                <li>[重大更新] 重写项目整体结构 数据处理下沉至Mapper符合MVC规范 减少循环依赖</li>
 | 
			
		||||
                <li>[重磅更新] 主分支与satoken分支合并 权限统一使用 sa-token</li>
 | 
			
		||||
                <li>[重磅更新] 适配升级 SpringBoot 2.6</li>
 | 
			
		||||
                <li>[重磅更新] EasyExcel大版本升级3.X</li>
 | 
			
		||||
                <li>[重磅更新] 移除链式调用注解 因链式调用不符合java规范 导致很多问题</li>
 | 
			
		||||
                <li>[重磅更新] 增加 轻量级 分布式队列 支持</li>
 | 
			
		||||
                <li>[重磅更新] 增加 数据脱敏注解 使用序列化控制脱敏 支持多种表达式</li>
 | 
			
		||||
                <li>[重磅更新] 重构 使用 Spring 简化 oss 模块代码</li>
 | 
			
		||||
                <li>[重磅更新] 重构 调整返回类型为 R 精简 Controller 代码</li>
 | 
			
		||||
                <li>update springboot 2.5.8 => 2.6.3</li>
 | 
			
		||||
                <li>update mybatis-plus 3.4.3.4 => 3.5.1</li>
 | 
			
		||||
                <li>update maven-jar-plugin 3.2.0 => 3.2.2</li>
 | 
			
		||||
                <li>update maven-war-plugin 3.2.0 => 3.2.2</li>
 | 
			
		||||
                <li>update maven-compiler-plugin 3.1 => 3.9.0</li>
 | 
			
		||||
                <li>update hutool 5.7.18 => 5.7.20</li>
 | 
			
		||||
                <li>update springboot-admin 2.6.0 => 2.6.2</li>
 | 
			
		||||
                <li>update redisson 3.16.7 => 3.16.8</li>
 | 
			
		||||
                <li>update qiniu 7.9.0 => 7.9.2</li>
 | 
			
		||||
                <li>update aliyun 3.13.1 => 3.14.0</li>
 | 
			
		||||
                <li>update qcloud 5.6.58 => 5.6.68</li>
 | 
			
		||||
                <li>update minio 8.3.4 => 8.3.5</li>
 | 
			
		||||
                <li>update 用户管理部门查询选择节点后分页参数初始</li>
 | 
			
		||||
                <li>update 防重复提交标识组合(key + url + header)</li>
 | 
			
		||||
                <li>update 接口文档增加 basic 账号密码验证</li>
 | 
			
		||||
                <li>update 用户修改减少一次角色列表关联查询</li>
 | 
			
		||||
                <li>update 优化部门修改缩放后出现的错位问题</li>
 | 
			
		||||
                <li>update 指定 maven 资源过滤为具体文件 防止错误过滤</li>
 | 
			
		||||
                <li>update hutool 引入改为 bom 依赖项引入</li>
 | 
			
		||||
                <li>update 降低开发环境 redis连接池数量</li>
 | 
			
		||||
                <li>update 升级 springboot 2.6.X 解决 springfox 兼容性问题</li>
 | 
			
		||||
                <li>update 优化多用户体系处理 更名 LoginUtils 为 LoginHelper 支持 LoginUser 多级缓存</li>
 | 
			
		||||
                <li>update 优化加载字典缓存数据</li>
 | 
			
		||||
                <li>update 数据库更改 对接多用户体系</li>
 | 
			
		||||
                <li>update 移除掉 StringUtils 语义不明确的api方法 使用特定工具替换</li>
 | 
			
		||||
                <li>update 优化登录、注册在接口通过`@Validated`注解进行数据基础校验</li>
 | 
			
		||||
                <li>update 优化 查询登录用户数据 统一走缓存</li>
 | 
			
		||||
                <li>update 优化 redisson 配置 去除掉不常用的配置 使用默认配置</li>
 | 
			
		||||
                <li>update 用户访问控制时校验数据权限,防止越权</li>
 | 
			
		||||
                <li>update 修改用户注册报未登录警告</li>
 | 
			
		||||
                <li>update 调整oss预览开关 使用前端直接调用更改配置参数</li>
 | 
			
		||||
                <li>update 使用 satoken 自带的 BCrypt 工具 替换 Security 加密工具 减少依赖</li>
 | 
			
		||||
                <li>update 优化 TreeBuildUtils 工具 使用反射自动获取顶级父id</li>
 | 
			
		||||
                <li>update 使用 hutool Dict 优化 JsonUtils 防止类型解析异常</li>
 | 
			
		||||
                <li>update 优化代码生成 使用新 JsonUtils.parseMap 方法</li>
 | 
			
		||||
                <li>update 更新 所有 oss 均支持 https 配置</li>
 | 
			
		||||
                <li>add 增加 RedisUtils 工具 hasKey 检查key存在方法</li>
 | 
			
		||||
                <li>add 增加 监控中心 自定义事件通知</li>
 | 
			
		||||
                <li>add 增加 3.X update 4.0 更新sql</li>
 | 
			
		||||
                <li>fix 修复登录失效后多次请求提示多次弹窗问题</li>
 | 
			
		||||
                <li>fix 修复 StringUtils 通配符匹配无效</li>
 | 
			
		||||
                <li>fix 修复选项卡点击右键刷新丢失参数问题</li>
 | 
			
		||||
                <li>fix 修复 数据权限 缓存方法名错误问题</li>
 | 
			
		||||
                <li>fix 修复自定义组件`file-upload`无法显示第一个文件,列表显示的文件比实际文件少一个的问题</li>
 | 
			
		||||
                <li>fix 修复因升级 sa-token 导致 doLogin 无法获取 token 问题</li>
 | 
			
		||||
                <li>fix 修复分页组件请求两次问题</li>
 | 
			
		||||
                <li>remove 移除过期代码 分页工具相关</li>
 | 
			
		||||
                <li>remove 移除过期代码 多数据源切换</li>
 | 
			
		||||
                <li>remove 移除过期代码 数据权限</li>
 | 
			
		||||
                <li>3.X 版本进入维护阶段 不进行更新 只修复bug 持续维护到2022年10月</li>
 | 
			
		||||
                <li>4.X 版本公测将近一个月 大部分bug已修复 官网主分支更改为 4.X 版本 推荐使用</li>
 | 
			
		||||
              </ol>
 | 
			
		||||
            </el-collapse-item>
 | 
			
		||||
            <el-collapse-item title="v3.5.0 - 2021-12-28">
 | 
			
		||||
              <ol>
 | 
			
		||||
                <li>[重大更新] 重写数据权限实现</li>
 | 
			
		||||
@@ -644,7 +708,7 @@ export default {
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      // 版本号
 | 
			
		||||
      version: "3.5.0",
 | 
			
		||||
      version: "4.0.0",
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
 
 | 
			
		||||
@@ -56,7 +56,7 @@
 | 
			
		||||
    </el-form>
 | 
			
		||||
    <!--  底部  -->
 | 
			
		||||
    <div class="el-login-footer">
 | 
			
		||||
      <span>Copyright © 2018-2021 ruoyi.vip All Rights Reserved.</span>
 | 
			
		||||
      <span>Copyright © 2018-2022 ruoyi.vip All Rights Reserved.</span>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@
 | 
			
		||||
          v-model="queryParams.ipaddr"
 | 
			
		||||
          placeholder="请输入登录地址"
 | 
			
		||||
          clearable
 | 
			
		||||
		  size="small"
 | 
			
		||||
          size="small"
 | 
			
		||||
          style="width: 240px;"
 | 
			
		||||
          @keyup.enter.native="handleQuery"
 | 
			
		||||
        />
 | 
			
		||||
@@ -16,7 +16,7 @@
 | 
			
		||||
          v-model="queryParams.userName"
 | 
			
		||||
          placeholder="请输入用户名称"
 | 
			
		||||
          clearable
 | 
			
		||||
		  size="small"
 | 
			
		||||
          size="small"
 | 
			
		||||
          style="width: 240px;"
 | 
			
		||||
          @keyup.enter.native="handleQuery"
 | 
			
		||||
        />
 | 
			
		||||
 
 | 
			
		||||
@@ -61,7 +61,7 @@
 | 
			
		||||
    </el-form>
 | 
			
		||||
    <!--  底部  -->
 | 
			
		||||
    <div class="el-register-footer">
 | 
			
		||||
      <span>Copyright © 2018-2021 ruoyi.vip All Rights Reserved.</span>
 | 
			
		||||
      <span>Copyright © 2018-2022 ruoyi.vip All Rights Reserved.</span>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
@@ -124,7 +124,9 @@ export default {
 | 
			
		||||
      this.$refs.registerForm.validate(valid => {
 | 
			
		||||
        if (valid) {
 | 
			
		||||
          this.loading = true;
 | 
			
		||||
          register(this.registerForm).then(res => {
 | 
			
		||||
          let registerForm = this.registerForm;
 | 
			
		||||
          registerForm.userType = "sys_user"
 | 
			
		||||
          register(registerForm).then(res => {
 | 
			
		||||
            const username = this.registerForm.username;
 | 
			
		||||
            this.$alert("<font color='red'>恭喜你,您的账号 " + username + " 注册成功!</font>", '系统提示', {
 | 
			
		||||
              dangerouslyUseHTMLString: true,
 | 
			
		||||
 
 | 
			
		||||
@@ -106,6 +106,8 @@
 | 
			
		||||
              <treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级部门" />
 | 
			
		||||
            </el-form-item>
 | 
			
		||||
          </el-col>
 | 
			
		||||
        </el-row>
 | 
			
		||||
        <el-row>
 | 
			
		||||
          <el-col :span="12">
 | 
			
		||||
            <el-form-item label="部门名称" prop="deptName">
 | 
			
		||||
              <el-input v-model="form.deptName" placeholder="请输入部门名称" />
 | 
			
		||||
@@ -116,6 +118,8 @@
 | 
			
		||||
              <el-input-number v-model="form.orderNum" controls-position="right" :min="0" />
 | 
			
		||||
            </el-form-item>
 | 
			
		||||
          </el-col>
 | 
			
		||||
        </el-row>
 | 
			
		||||
        <el-row>
 | 
			
		||||
          <el-col :span="12">
 | 
			
		||||
            <el-form-item label="负责人" prop="leader">
 | 
			
		||||
              <el-input v-model="form.leader" placeholder="请输入负责人" maxlength="20" />
 | 
			
		||||
@@ -126,6 +130,8 @@
 | 
			
		||||
              <el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11" />
 | 
			
		||||
            </el-form-item>
 | 
			
		||||
          </el-col>
 | 
			
		||||
        </el-row>
 | 
			
		||||
        <el-row>
 | 
			
		||||
          <el-col :span="12">
 | 
			
		||||
            <el-form-item label="邮箱" prop="email">
 | 
			
		||||
              <el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
 | 
			
		||||
 
 | 
			
		||||
@@ -187,7 +187,7 @@
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import { listOss, delOss, changePreviewListResource } from "@/api/system/oss";
 | 
			
		||||
import { listOss, delOss } from "@/api/system/oss";
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  name: "Oss",
 | 
			
		||||
@@ -344,7 +344,7 @@ export default {
 | 
			
		||||
    handlePreviewListResource(previewListResource) {
 | 
			
		||||
      let text = previewListResource ? "启用" : "停用";
 | 
			
		||||
      this.$modal.confirm('确认要"' + text + '""预览列表图片"配置吗?').then(() => {
 | 
			
		||||
        return changePreviewListResource(previewListResource);
 | 
			
		||||
        return this.updateConfigByKey("sys.oss.previewListResource", previewListResource);
 | 
			
		||||
      }).then(() => {
 | 
			
		||||
        this.getList()
 | 
			
		||||
        this.$modal.msgSuccess(text + "成功");
 | 
			
		||||
 
 | 
			
		||||
@@ -495,7 +495,7 @@ export default {
 | 
			
		||||
    // 节点单击事件
 | 
			
		||||
    handleNodeClick(data) {
 | 
			
		||||
      this.queryParams.deptId = data.id;
 | 
			
		||||
      this.getList();
 | 
			
		||||
      this.handleQuery();
 | 
			
		||||
    },
 | 
			
		||||
    // 用户状态修改
 | 
			
		||||
    handleStatusChange(row) {
 | 
			
		||||
 
 | 
			
		||||
@@ -41,7 +41,7 @@
 | 
			
		||||
        <el-button @click="close">
 | 
			
		||||
          取消
 | 
			
		||||
        </el-button>
 | 
			
		||||
        <el-button type="primary" @click="handelConfirm">
 | 
			
		||||
        <el-button type="primary" @click="handleConfirm">
 | 
			
		||||
          确定
 | 
			
		||||
        </el-button>
 | 
			
		||||
      </div>
 | 
			
		||||
@@ -94,7 +94,7 @@ export default {
 | 
			
		||||
    close(e) {
 | 
			
		||||
      this.$emit('update:visible', false)
 | 
			
		||||
    },
 | 
			
		||||
    handelConfirm() {
 | 
			
		||||
    handleConfirm() {
 | 
			
		||||
      this.$refs.elForm.validate(valid => {
 | 
			
		||||
        if (!valid) return
 | 
			
		||||
        this.$emit('confirm', { ...this.formData })
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,7 @@
 | 
			
		||||
      <div slot="footer">
 | 
			
		||||
        <el-button
 | 
			
		||||
          type="primary"
 | 
			
		||||
          @click="handelConfirm"
 | 
			
		||||
          @click="handleConfirm"
 | 
			
		||||
        >
 | 
			
		||||
          确定
 | 
			
		||||
        </el-button>
 | 
			
		||||
@@ -133,7 +133,7 @@ export default {
 | 
			
		||||
    close() {
 | 
			
		||||
      this.$emit('update:visible', false)
 | 
			
		||||
    },
 | 
			
		||||
    handelConfirm() {
 | 
			
		||||
    handleConfirm() {
 | 
			
		||||
      this.$refs.elForm.validate(valid => {
 | 
			
		||||
        if (!valid) return
 | 
			
		||||
        if (this.dataType === 'number') {
 | 
			
		||||
 
 | 
			
		||||
@@ -146,7 +146,7 @@ import { beautifierConf, titleCase } from '@/utils/index'
 | 
			
		||||
import { makeUpHtml, vueTemplate, vueScript, cssStyle } from '@/utils/generator/html'
 | 
			
		||||
import { makeUpJs } from '@/utils/generator/js'
 | 
			
		||||
import { makeUpCss } from '@/utils/generator/css'
 | 
			
		||||
import drawingDefalut from '@/utils/generator/drawingDefalut'
 | 
			
		||||
import drawingDefault from '@/utils/generator/drawingDefault'
 | 
			
		||||
import logo from '@/assets/logo/logo.png'
 | 
			
		||||
import CodeTypeDialog from './CodeTypeDialog'
 | 
			
		||||
import DraggableItem from './DraggableItem'
 | 
			
		||||
@@ -171,15 +171,15 @@ export default {
 | 
			
		||||
      selectComponents,
 | 
			
		||||
      layoutComponents,
 | 
			
		||||
      labelWidth: 100,
 | 
			
		||||
      drawingList: drawingDefalut,
 | 
			
		||||
      drawingList: drawingDefault,
 | 
			
		||||
      drawingData: {},
 | 
			
		||||
      activeId: drawingDefalut[0].formId,
 | 
			
		||||
      activeId: drawingDefault[0].formId,
 | 
			
		||||
      drawerVisible: false,
 | 
			
		||||
      formData: {},
 | 
			
		||||
      dialogVisible: false,
 | 
			
		||||
      generateConf: null,
 | 
			
		||||
      showFileName: false,
 | 
			
		||||
      activeData: drawingDefalut[0]
 | 
			
		||||
      activeData: drawingDefault[0]
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  created() {
 | 
			
		||||
 
 | 
			
		||||
@@ -33,6 +33,7 @@
 | 
			
		||||
                <el-option label="Double" value="Double" />
 | 
			
		||||
                <el-option label="BigDecimal" value="BigDecimal" />
 | 
			
		||||
                <el-option label="Date" value="Date" />
 | 
			
		||||
                <el-option label="Boolean" value="Boolean" />
 | 
			
		||||
              </el-select>
 | 
			
		||||
            </template>
 | 
			
		||||
          </el-table-column>
 | 
			
		||||
@@ -158,7 +159,7 @@ export default {
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  created() {
 | 
			
		||||
    const tableId = this.$route.query && this.$route.query.tableId;
 | 
			
		||||
    const tableId = this.$route.params && this.$route.params.tableId;
 | 
			
		||||
    if (tableId) {
 | 
			
		||||
      // 获取表详细信息
 | 
			
		||||
      getGenTable(tableId).then(res => {
 | 
			
		||||
 
 | 
			
		||||
@@ -321,7 +321,7 @@ export default {
 | 
			
		||||
    /** 修改按钮操作 */
 | 
			
		||||
    handleEditTable(row) {
 | 
			
		||||
      const tableId = row.tableId || this.ids[0];
 | 
			
		||||
      this.$router.push({ path: '/tool/gen-edit/index', query: { tableId: tableId, pageNum: this.queryParams.pageNum } });
 | 
			
		||||
      this.$router.push({ path: '/tool/gen-edit/index/' + tableId, query: { pageNum: this.queryParams.pageNum } });
 | 
			
		||||
    },
 | 
			
		||||
    /** 删除按钮操作 */
 | 
			
		||||
    handleDelete(row) {
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@
 | 
			
		||||
    <parent>
 | 
			
		||||
        <artifactId>ruoyi-vue-plus</artifactId>
 | 
			
		||||
        <groupId>com.ruoyi</groupId>
 | 
			
		||||
        <version>3.5.0</version>
 | 
			
		||||
        <version>4.0.0</version>
 | 
			
		||||
    </parent>
 | 
			
		||||
    <modelVersion>4.0.0</modelVersion>
 | 
			
		||||
    <packaging>jar</packaging>
 | 
			
		||||
@@ -73,10 +73,15 @@
 | 
			
		||||
            <artifactId>mysql-connector-java</artifactId>
 | 
			
		||||
        </dependency>
 | 
			
		||||
 | 
			
		||||
        <!-- spring security 安全认证 -->
 | 
			
		||||
        <!-- Sa-Token 权限认证, 在线文档:http://sa-token.dev33.cn/ -->
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>org.springframework.boot</groupId>
 | 
			
		||||
            <artifactId>spring-boot-starter-security</artifactId>
 | 
			
		||||
            <groupId>cn.dev33</groupId>
 | 
			
		||||
            <artifactId>sa-token-spring-boot-starter</artifactId>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <!-- Sa-Token 整合 jwt -->
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>cn.dev33</groupId>
 | 
			
		||||
            <artifactId>sa-token-jwt</artifactId>
 | 
			
		||||
        </dependency>
 | 
			
		||||
 | 
			
		||||
        <dependency>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,32 +0,0 @@
 | 
			
		||||
package com.ruoyi.common.annotation;
 | 
			
		||||
 | 
			
		||||
import java.lang.annotation.*;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 数据权限过滤注解
 | 
			
		||||
 *
 | 
			
		||||
 * @author ruoyi
 | 
			
		||||
 * @deprecated 3.6.0 移除 {@link com.ruoyi.common.annotation.DataPermission}
 | 
			
		||||
 */
 | 
			
		||||
@Target(ElementType.METHOD)
 | 
			
		||||
@Retention(RetentionPolicy.RUNTIME)
 | 
			
		||||
@Documented
 | 
			
		||||
@Deprecated
 | 
			
		||||
public @interface DataScope {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 部门表的别名
 | 
			
		||||
     */
 | 
			
		||||
    String deptAlias() default "";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 用户表的别名
 | 
			
		||||
     */
 | 
			
		||||
    String userAlias() default "";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 是否过滤用户权限
 | 
			
		||||
     */
 | 
			
		||||
    boolean isUser() default false;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,25 +0,0 @@
 | 
			
		||||
package com.ruoyi.common.annotation;
 | 
			
		||||
 | 
			
		||||
import com.ruoyi.common.enums.DataSourceType;
 | 
			
		||||
 | 
			
		||||
import java.lang.annotation.*;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 自定义多数据源切换注解
 | 
			
		||||
 * <p>
 | 
			
		||||
 * 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准
 | 
			
		||||
 *
 | 
			
		||||
 * @author ruoyi
 | 
			
		||||
 * @deprecated 3.6.0 移除 使用原生注解处理 方法更全 {@link com.baomidou.dynamic.datasource.annotation.DS}
 | 
			
		||||
 */
 | 
			
		||||
@Target({ElementType.METHOD, ElementType.TYPE})
 | 
			
		||||
@Retention(RetentionPolicy.RUNTIME)
 | 
			
		||||
@Documented
 | 
			
		||||
@Inherited
 | 
			
		||||
@Deprecated
 | 
			
		||||
public @interface DataSource {
 | 
			
		||||
    /**
 | 
			
		||||
     * 切换数据源名称
 | 
			
		||||
     */
 | 
			
		||||
    DataSourceType value() default DataSourceType.MASTER;
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,24 @@
 | 
			
		||||
package com.ruoyi.common.annotation;
 | 
			
		||||
 | 
			
		||||
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
 | 
			
		||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 | 
			
		||||
import com.ruoyi.common.enums.SensitiveStrategy;
 | 
			
		||||
import com.ruoyi.common.jackson.SensitiveJsonSerializer;
 | 
			
		||||
 | 
			
		||||
import java.lang.annotation.ElementType;
 | 
			
		||||
import java.lang.annotation.Retention;
 | 
			
		||||
import java.lang.annotation.RetentionPolicy;
 | 
			
		||||
import java.lang.annotation.Target;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 数据脱敏注解
 | 
			
		||||
 *
 | 
			
		||||
 * @author zhujie
 | 
			
		||||
 */
 | 
			
		||||
@Retention(RetentionPolicy.RUNTIME)
 | 
			
		||||
@Target(ElementType.FIELD)
 | 
			
		||||
@JacksonAnnotationsInside
 | 
			
		||||
@JsonSerialize(using = SensitiveJsonSerializer.class)
 | 
			
		||||
public @interface Sensitive {
 | 
			
		||||
    SensitiveStrategy strategy();
 | 
			
		||||
}
 | 
			
		||||
@@ -13,73 +13,73 @@ import com.ruoyi.common.utils.StringUtils;
 | 
			
		||||
 */
 | 
			
		||||
public class UnsignedMathGenerator implements CodeGenerator {
 | 
			
		||||
 | 
			
		||||
	private static final long serialVersionUID = -5514819971774091076L;
 | 
			
		||||
    private static final long serialVersionUID = -5514819971774091076L;
 | 
			
		||||
 | 
			
		||||
	private static final String operators = "+-*";
 | 
			
		||||
    private static final String OPERATORS = "+-*";
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 参与计算数字最大长度
 | 
			
		||||
	 */
 | 
			
		||||
	private final int numberLength;
 | 
			
		||||
    /**
 | 
			
		||||
     * 参与计算数字最大长度
 | 
			
		||||
     */
 | 
			
		||||
    private final int numberLength;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 构造
 | 
			
		||||
	 */
 | 
			
		||||
	public UnsignedMathGenerator() {
 | 
			
		||||
		this(2);
 | 
			
		||||
	}
 | 
			
		||||
    /**
 | 
			
		||||
     * 构造
 | 
			
		||||
     */
 | 
			
		||||
    public UnsignedMathGenerator() {
 | 
			
		||||
        this(2);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 构造
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param numberLength 参与计算最大数字位数
 | 
			
		||||
	 */
 | 
			
		||||
	public UnsignedMathGenerator(int numberLength) {
 | 
			
		||||
		this.numberLength = numberLength;
 | 
			
		||||
	}
 | 
			
		||||
    /**
 | 
			
		||||
     * 构造
 | 
			
		||||
     *
 | 
			
		||||
     * @param numberLength 参与计算最大数字位数
 | 
			
		||||
     */
 | 
			
		||||
    public UnsignedMathGenerator(int numberLength) {
 | 
			
		||||
        this.numberLength = numberLength;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public String generate() {
 | 
			
		||||
		final int limit = getLimit();
 | 
			
		||||
		int min = RandomUtil.randomInt(limit);
 | 
			
		||||
		int max = RandomUtil.randomInt(min, limit);
 | 
			
		||||
		String number1 = Integer.toString(max);
 | 
			
		||||
		String number2 = Integer.toString(min);
 | 
			
		||||
		number1 = StringUtils.rightPad(number1, this.numberLength, CharUtil.SPACE);
 | 
			
		||||
		number2 = StringUtils.rightPad(number2, this.numberLength, CharUtil.SPACE);
 | 
			
		||||
    @Override
 | 
			
		||||
    public String generate() {
 | 
			
		||||
        final int limit = getLimit();
 | 
			
		||||
        int min = RandomUtil.randomInt(limit);
 | 
			
		||||
        int max = RandomUtil.randomInt(min, limit);
 | 
			
		||||
        String number1 = Integer.toString(max);
 | 
			
		||||
        String number2 = Integer.toString(min);
 | 
			
		||||
        number1 = StringUtils.rightPad(number1, this.numberLength, CharUtil.SPACE);
 | 
			
		||||
        number2 = StringUtils.rightPad(number2, this.numberLength, CharUtil.SPACE);
 | 
			
		||||
 | 
			
		||||
		return number1 + RandomUtil.randomChar(operators) + number2 + '=';
 | 
			
		||||
	}
 | 
			
		||||
        return number1 + RandomUtil.randomChar(OPERATORS) + number2 + '=';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public boolean verify(String code, String userInputCode) {
 | 
			
		||||
		int result;
 | 
			
		||||
		try {
 | 
			
		||||
			result = Integer.parseInt(userInputCode);
 | 
			
		||||
		} catch (NumberFormatException e) {
 | 
			
		||||
			// 用户输入非数字
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean verify(String code, String userInputCode) {
 | 
			
		||||
        int result;
 | 
			
		||||
        try {
 | 
			
		||||
            result = Integer.parseInt(userInputCode);
 | 
			
		||||
        } catch (NumberFormatException e) {
 | 
			
		||||
            // 用户输入非数字
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		final int calculateResult = (int) Calculator.conversion(code);
 | 
			
		||||
		return result == calculateResult;
 | 
			
		||||
	}
 | 
			
		||||
        final int calculateResult = (int) Calculator.conversion(code);
 | 
			
		||||
        return result == calculateResult;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 获取验证码长度
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return 验证码长度
 | 
			
		||||
	 */
 | 
			
		||||
	public int getLength() {
 | 
			
		||||
		return this.numberLength * 2 + 2;
 | 
			
		||||
	}
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取验证码长度
 | 
			
		||||
     *
 | 
			
		||||
     * @return 验证码长度
 | 
			
		||||
     */
 | 
			
		||||
    public int getLength() {
 | 
			
		||||
        return this.numberLength * 2 + 2;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 根据长度获取参与计算数字最大值
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return 最大值
 | 
			
		||||
	 */
 | 
			
		||||
	private int getLimit() {
 | 
			
		||||
		return Integer.parseInt("1" + StringUtils.repeat('0', this.numberLength));
 | 
			
		||||
	}
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据长度获取参与计算数字最大值
 | 
			
		||||
     *
 | 
			
		||||
     * @return 最大值
 | 
			
		||||
     */
 | 
			
		||||
    private int getLimit() {
 | 
			
		||||
        return Integer.parseInt("1" + StringUtils.repeat('0', this.numberLength));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,6 @@ package com.ruoyi.common.config;
 | 
			
		||||
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.Getter;
 | 
			
		||||
import lombok.experimental.Accessors;
 | 
			
		||||
import org.springframework.boot.context.properties.ConfigurationProperties;
 | 
			
		||||
import org.springframework.stereotype.Component;
 | 
			
		||||
 | 
			
		||||
@@ -13,7 +12,6 @@ import org.springframework.stereotype.Component;
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
@Data
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
@Component
 | 
			
		||||
@ConfigurationProperties(prefix = "ruoyi")
 | 
			
		||||
public class RuoYiConfig {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,5 @@
 | 
			
		||||
package com.ruoyi.common.constant;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 通用常量信息
 | 
			
		||||
 *
 | 
			
		||||
@@ -66,7 +65,12 @@ public interface Constants {
 | 
			
		||||
    /**
 | 
			
		||||
     * 登录用户 redis key
 | 
			
		||||
     */
 | 
			
		||||
    String LOGIN_TOKEN_KEY = "login_tokens:";
 | 
			
		||||
    public static final String LOGIN_TOKEN_KEY = "Authorization:login:token:";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 在线用户 redis key
 | 
			
		||||
     */
 | 
			
		||||
    public static final String ONLINE_TOKEN_KEY = "online_tokens:";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 防重提交 redis key
 | 
			
		||||
@@ -103,41 +107,11 @@ public interface Constants {
 | 
			
		||||
     */
 | 
			
		||||
    String TOKEN = "token";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 令牌前缀
 | 
			
		||||
     */
 | 
			
		||||
    String TOKEN_PREFIX = "Bearer ";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 令牌前缀
 | 
			
		||||
     */
 | 
			
		||||
    String LOGIN_USER_KEY = "login_user_key";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 用户ID
 | 
			
		||||
     */
 | 
			
		||||
    String JWT_USERID = "userid";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 用户名称
 | 
			
		||||
     */
 | 
			
		||||
    String JWT_USERNAME = "sub";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 用户头像
 | 
			
		||||
     */
 | 
			
		||||
    String JWT_AVATAR = "avatar";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 创建时间
 | 
			
		||||
     */
 | 
			
		||||
    String JWT_CREATED = "created";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 用户权限
 | 
			
		||||
     */
 | 
			
		||||
    String JWT_AUTHORITIES = "authorities";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 参数管理 cache key
 | 
			
		||||
     */
 | 
			
		||||
@@ -149,3 +123,4 @@ public interface Constants {
 | 
			
		||||
    String SYS_DICT_KEY = "sys_dict:";
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -181,6 +181,11 @@ public interface GenConstants {
 | 
			
		||||
     */
 | 
			
		||||
    String QUERY_LIKE = "LIKE";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 相等查询
 | 
			
		||||
     */
 | 
			
		||||
    String QUERY_EQ = "EQ";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 需要
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -4,8 +4,9 @@ import cn.hutool.core.convert.Convert;
 | 
			
		||||
import cn.hutool.core.util.ObjectUtil;
 | 
			
		||||
import com.alibaba.excel.converters.Converter;
 | 
			
		||||
import com.alibaba.excel.enums.CellDataTypeEnum;
 | 
			
		||||
import com.alibaba.excel.metadata.CellData;
 | 
			
		||||
import com.alibaba.excel.metadata.GlobalConfiguration;
 | 
			
		||||
import com.alibaba.excel.metadata.data.ReadCellData;
 | 
			
		||||
import com.alibaba.excel.metadata.data.WriteCellData;
 | 
			
		||||
import com.alibaba.excel.metadata.property.ExcelContentProperty;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
 | 
			
		||||
@@ -20,32 +21,32 @@ import java.math.BigDecimal;
 | 
			
		||||
@Slf4j
 | 
			
		||||
public class ExcelBigNumberConvert implements Converter<Long> {
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public Class<Long> supportJavaTypeKey() {
 | 
			
		||||
		return Long.class;
 | 
			
		||||
	}
 | 
			
		||||
    @Override
 | 
			
		||||
    public Class<Long> supportJavaTypeKey() {
 | 
			
		||||
        return Long.class;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public CellDataTypeEnum supportExcelTypeKey() {
 | 
			
		||||
		return CellDataTypeEnum.STRING;
 | 
			
		||||
	}
 | 
			
		||||
    @Override
 | 
			
		||||
    public CellDataTypeEnum supportExcelTypeKey() {
 | 
			
		||||
        return CellDataTypeEnum.STRING;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public Long convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
 | 
			
		||||
		return Convert.toLong(cellData.getData());
 | 
			
		||||
	}
 | 
			
		||||
    @Override
 | 
			
		||||
    public Long convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
 | 
			
		||||
        return Convert.toLong(cellData.getData());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public CellData<Object> convertToExcelData(Long object, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
 | 
			
		||||
		if (ObjectUtil.isNotNull(object)) {
 | 
			
		||||
			String str = Convert.toStr(object);
 | 
			
		||||
			if (str.length() > 15) {
 | 
			
		||||
				return new CellData<>(str);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		CellData<Object> cellData = new CellData<>(new BigDecimal(object));
 | 
			
		||||
		cellData.setType(CellDataTypeEnum.NUMBER);
 | 
			
		||||
		return cellData;
 | 
			
		||||
	}
 | 
			
		||||
    @Override
 | 
			
		||||
    public WriteCellData<Object> convertToExcelData(Long object, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
 | 
			
		||||
        if (ObjectUtil.isNotNull(object)) {
 | 
			
		||||
            String str = Convert.toStr(object);
 | 
			
		||||
            if (str.length() > 15) {
 | 
			
		||||
                return new WriteCellData<>(str);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        WriteCellData<Object> cellData = new WriteCellData<>(new BigDecimal(object));
 | 
			
		||||
        cellData.setType(CellDataTypeEnum.NUMBER);
 | 
			
		||||
        return cellData;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,10 +2,12 @@ package com.ruoyi.common.convert;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.annotation.AnnotationUtil;
 | 
			
		||||
import cn.hutool.core.convert.Convert;
 | 
			
		||||
import cn.hutool.core.util.ObjectUtil;
 | 
			
		||||
import com.alibaba.excel.converters.Converter;
 | 
			
		||||
import com.alibaba.excel.enums.CellDataTypeEnum;
 | 
			
		||||
import com.alibaba.excel.metadata.CellData;
 | 
			
		||||
import com.alibaba.excel.metadata.GlobalConfiguration;
 | 
			
		||||
import com.alibaba.excel.metadata.data.ReadCellData;
 | 
			
		||||
import com.alibaba.excel.metadata.data.WriteCellData;
 | 
			
		||||
import com.alibaba.excel.metadata.property.ExcelContentProperty;
 | 
			
		||||
import com.ruoyi.common.annotation.ExcelDictFormat;
 | 
			
		||||
import com.ruoyi.common.core.service.DictService;
 | 
			
		||||
@@ -24,48 +26,48 @@ import java.lang.reflect.Field;
 | 
			
		||||
@Slf4j
 | 
			
		||||
public class ExcelDictConvert implements Converter<Object> {
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public Class<Object> supportJavaTypeKey() {
 | 
			
		||||
		return Object.class;
 | 
			
		||||
	}
 | 
			
		||||
    @Override
 | 
			
		||||
    public Class<Object> supportJavaTypeKey() {
 | 
			
		||||
        return Object.class;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public CellDataTypeEnum supportExcelTypeKey() {
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
    @Override
 | 
			
		||||
    public CellDataTypeEnum supportExcelTypeKey() {
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public Object convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
 | 
			
		||||
		ExcelDictFormat anno = getAnnotation(contentProperty.getField());
 | 
			
		||||
		String type = anno.dictType();
 | 
			
		||||
		String label = cellData.getStringValue();
 | 
			
		||||
		String value;
 | 
			
		||||
		if (StringUtils.isBlank(type)) {
 | 
			
		||||
			value = ExcelUtil.reverseByExp(label, anno.readConverterExp(), anno.separator());
 | 
			
		||||
		} else {
 | 
			
		||||
			value = SpringUtils.getBean(DictService.class).getDictValue(type, label, anno.separator());
 | 
			
		||||
		}
 | 
			
		||||
		return Convert.convert(contentProperty.getField().getType(), value);
 | 
			
		||||
	}
 | 
			
		||||
    @Override
 | 
			
		||||
    public Object convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
 | 
			
		||||
        ExcelDictFormat anno = getAnnotation(contentProperty.getField());
 | 
			
		||||
        String type = anno.dictType();
 | 
			
		||||
        String label = cellData.getStringValue();
 | 
			
		||||
        String value;
 | 
			
		||||
        if (StringUtils.isBlank(type)) {
 | 
			
		||||
            value = ExcelUtil.reverseByExp(label, anno.readConverterExp(), anno.separator());
 | 
			
		||||
        } else {
 | 
			
		||||
            value = SpringUtils.getBean(DictService.class).getDictValue(type, label, anno.separator());
 | 
			
		||||
        }
 | 
			
		||||
        return Convert.convert(contentProperty.getField().getType(), value);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public CellData<String> convertToExcelData(Object object, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
 | 
			
		||||
		if (StringUtils.isNull(object)) {
 | 
			
		||||
			return new CellData<>("");
 | 
			
		||||
		}
 | 
			
		||||
		ExcelDictFormat anno = getAnnotation(contentProperty.getField());
 | 
			
		||||
		String type = anno.dictType();
 | 
			
		||||
		String value = Convert.toStr(object);
 | 
			
		||||
		String label;
 | 
			
		||||
		if (StringUtils.isBlank(type)) {
 | 
			
		||||
			label = ExcelUtil.convertByExp(value, anno.readConverterExp(), anno.separator());
 | 
			
		||||
		} else {
 | 
			
		||||
			label = SpringUtils.getBean(DictService.class).getDictLabel(type, value, anno.separator());
 | 
			
		||||
		}
 | 
			
		||||
		return new CellData<>(label);
 | 
			
		||||
	}
 | 
			
		||||
    @Override
 | 
			
		||||
    public WriteCellData<String> convertToExcelData(Object object, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
 | 
			
		||||
        if (ObjectUtil.isNull(object)) {
 | 
			
		||||
            return new WriteCellData<>("");
 | 
			
		||||
        }
 | 
			
		||||
        ExcelDictFormat anno = getAnnotation(contentProperty.getField());
 | 
			
		||||
        String type = anno.dictType();
 | 
			
		||||
        String value = Convert.toStr(object);
 | 
			
		||||
        String label;
 | 
			
		||||
        if (StringUtils.isBlank(type)) {
 | 
			
		||||
            label = ExcelUtil.convertByExp(value, anno.readConverterExp(), anno.separator());
 | 
			
		||||
        } else {
 | 
			
		||||
            label = SpringUtils.getBean(DictService.class).getDictLabel(type, value, anno.separator());
 | 
			
		||||
        }
 | 
			
		||||
        return new WriteCellData<>(label);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	private ExcelDictFormat getAnnotation(Field field) {
 | 
			
		||||
		return AnnotationUtil.getAnnotation(field, ExcelDictFormat.class);
 | 
			
		||||
	}
 | 
			
		||||
    private ExcelDictFormat getAnnotation(Field field) {
 | 
			
		||||
        return AnnotationUtil.getAnnotation(field, ExcelDictFormat.class);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,53 +1,25 @@
 | 
			
		||||
package com.ruoyi.common.core.controller;
 | 
			
		||||
 | 
			
		||||
import com.ruoyi.common.core.domain.AjaxResult;
 | 
			
		||||
import com.ruoyi.common.core.domain.R;
 | 
			
		||||
import com.ruoyi.common.core.domain.model.LoginUser;
 | 
			
		||||
import com.ruoyi.common.utils.SecurityUtils;
 | 
			
		||||
import com.ruoyi.common.helper.LoginHelper;
 | 
			
		||||
import com.ruoyi.common.utils.StringUtils;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * web层通用数据处理
 | 
			
		||||
 *
 | 
			
		||||
 * @author ruoyi
 | 
			
		||||
 * @author Lion Li
 | 
			
		||||
 */
 | 
			
		||||
public class BaseController {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 返回成功
 | 
			
		||||
     */
 | 
			
		||||
    public AjaxResult<Void> success() {
 | 
			
		||||
        return AjaxResult.success();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 返回失败消息
 | 
			
		||||
     */
 | 
			
		||||
    public AjaxResult<Void> error() {
 | 
			
		||||
        return AjaxResult.error();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 返回成功消息
 | 
			
		||||
     */
 | 
			
		||||
    public AjaxResult<Void> success(String message) {
 | 
			
		||||
        return AjaxResult.success(message);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 返回失败消息
 | 
			
		||||
     */
 | 
			
		||||
    public AjaxResult<Void> error(String message) {
 | 
			
		||||
        return AjaxResult.error(message);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 响应返回结果
 | 
			
		||||
     *
 | 
			
		||||
     * @param rows 影响行数
 | 
			
		||||
     * @return 操作结果
 | 
			
		||||
     */
 | 
			
		||||
    protected AjaxResult<Void> toAjax(int rows) {
 | 
			
		||||
        return rows > 0 ? AjaxResult.success() : AjaxResult.error();
 | 
			
		||||
    protected R<Void> toAjax(int rows) {
 | 
			
		||||
        return rows > 0 ? R.ok() : R.fail();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -56,8 +28,8 @@ public class BaseController {
 | 
			
		||||
     * @param result 结果
 | 
			
		||||
     * @return 操作结果
 | 
			
		||||
     */
 | 
			
		||||
    protected AjaxResult<Void> toAjax(boolean result) {
 | 
			
		||||
        return result ? success() : error();
 | 
			
		||||
    protected R<Void> toAjax(boolean result) {
 | 
			
		||||
        return result ? R.ok() : R.fail();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -71,27 +43,27 @@ public class BaseController {
 | 
			
		||||
     * 获取用户缓存信息
 | 
			
		||||
     */
 | 
			
		||||
    public LoginUser getLoginUser() {
 | 
			
		||||
        return SecurityUtils.getLoginUser();
 | 
			
		||||
        return LoginHelper.getLoginUser();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取登录用户id
 | 
			
		||||
     */
 | 
			
		||||
    public Long getUserId() {
 | 
			
		||||
        return getLoginUser().getUserId();
 | 
			
		||||
        return LoginHelper.getUserId();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取登录部门id
 | 
			
		||||
     */
 | 
			
		||||
    public Long getDeptId() {
 | 
			
		||||
        return getLoginUser().getDeptId();
 | 
			
		||||
        return LoginHelper.getDeptId();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取登录用户名
 | 
			
		||||
     */
 | 
			
		||||
    public String getUsername() {
 | 
			
		||||
        return getLoginUser().getUsername();
 | 
			
		||||
        return LoginHelper.getUsername();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,134 +0,0 @@
 | 
			
		||||
package com.ruoyi.common.core.domain;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.http.HttpStatus;
 | 
			
		||||
import io.swagger.annotations.ApiModel;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.AllArgsConstructor;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.NoArgsConstructor;
 | 
			
		||||
import lombok.experimental.Accessors;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 操作消息提醒
 | 
			
		||||
 *
 | 
			
		||||
 * @author Lion Li
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@NoArgsConstructor
 | 
			
		||||
@AllArgsConstructor
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
@ApiModel("请求响应对象")
 | 
			
		||||
public class AjaxResult<T> {
 | 
			
		||||
 | 
			
		||||
	private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 状态码
 | 
			
		||||
	 */
 | 
			
		||||
	@ApiModelProperty("消息状态码")
 | 
			
		||||
	private int code;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 返回内容
 | 
			
		||||
	 */
 | 
			
		||||
	@ApiModelProperty("消息内容")
 | 
			
		||||
	private String msg;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 数据对象
 | 
			
		||||
	 */
 | 
			
		||||
	@ApiModelProperty("数据对象")
 | 
			
		||||
	private T data;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 初始化一个新创建的 AjaxResult 对象
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param code 状态码
 | 
			
		||||
	 * @param msg  返回内容
 | 
			
		||||
	 */
 | 
			
		||||
	public AjaxResult(int code, String msg) {
 | 
			
		||||
		this.code = code;
 | 
			
		||||
		this.msg = msg;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 返回成功消息
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return 成功消息
 | 
			
		||||
	 */
 | 
			
		||||
	public static AjaxResult<Void> success() {
 | 
			
		||||
		return AjaxResult.success("操作成功");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 返回成功数据
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return 成功消息
 | 
			
		||||
	 */
 | 
			
		||||
	public static <T> AjaxResult<T> success(T data) {
 | 
			
		||||
		return AjaxResult.success("操作成功", data);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 返回成功消息
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param msg 返回内容
 | 
			
		||||
	 * @return 成功消息
 | 
			
		||||
	 */
 | 
			
		||||
	public static AjaxResult<Void> success(String msg) {
 | 
			
		||||
		return AjaxResult.success(msg, null);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 返回成功消息
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param msg  返回内容
 | 
			
		||||
	 * @param data 数据对象
 | 
			
		||||
	 * @return 成功消息
 | 
			
		||||
	 */
 | 
			
		||||
	public static <T> AjaxResult<T> success(String msg, T data) {
 | 
			
		||||
		return new AjaxResult<>(HttpStatus.HTTP_OK, msg, data);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 返回错误消息
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return
 | 
			
		||||
	 */
 | 
			
		||||
	public static AjaxResult<Void> error() {
 | 
			
		||||
		return AjaxResult.error("操作失败");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 返回错误消息
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param msg 返回内容
 | 
			
		||||
	 * @return 警告消息
 | 
			
		||||
	 */
 | 
			
		||||
	public static AjaxResult<Void> error(String msg) {
 | 
			
		||||
		return AjaxResult.error(msg, null);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 返回错误消息
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param msg  返回内容
 | 
			
		||||
	 * @param data 数据对象
 | 
			
		||||
	 * @return 警告消息
 | 
			
		||||
	 */
 | 
			
		||||
	public static <T> AjaxResult<T> error(String msg, T data) {
 | 
			
		||||
		return new AjaxResult<>(HttpStatus.HTTP_INTERNAL_ERROR, msg, data);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 返回错误消息
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param code 状态码
 | 
			
		||||
	 * @param msg  返回内容
 | 
			
		||||
	 * @return 警告消息
 | 
			
		||||
	 */
 | 
			
		||||
	public static AjaxResult<Void> error(int code, String msg) {
 | 
			
		||||
		return new AjaxResult<>(code, msg, null);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
 | 
			
		||||
import com.baomidou.mybatisplus.annotation.TableField;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.experimental.Accessors;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
@@ -18,51 +17,50 @@ import java.util.Map;
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
@Data
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
public class BaseEntity implements Serializable {
 | 
			
		||||
 | 
			
		||||
	private static final long serialVersionUID = 1L;
 | 
			
		||||
    private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 搜索值
 | 
			
		||||
	 */
 | 
			
		||||
	@ApiModelProperty(value = "搜索值")
 | 
			
		||||
	@TableField(exist = false)
 | 
			
		||||
	private String searchValue;
 | 
			
		||||
    /**
 | 
			
		||||
     * 搜索值
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "搜索值")
 | 
			
		||||
    @TableField(exist = false)
 | 
			
		||||
    private String searchValue;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 创建者
 | 
			
		||||
	 */
 | 
			
		||||
	@ApiModelProperty(value = "创建者")
 | 
			
		||||
	@TableField(fill = FieldFill.INSERT)
 | 
			
		||||
	private String createBy;
 | 
			
		||||
    /**
 | 
			
		||||
     * 创建者
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "创建者")
 | 
			
		||||
    @TableField(fill = FieldFill.INSERT)
 | 
			
		||||
    private String createBy;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 创建时间
 | 
			
		||||
	 */
 | 
			
		||||
	@ApiModelProperty(value = "创建时间")
 | 
			
		||||
	@TableField(fill = FieldFill.INSERT)
 | 
			
		||||
	private Date createTime;
 | 
			
		||||
    /**
 | 
			
		||||
     * 创建时间
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "创建时间")
 | 
			
		||||
    @TableField(fill = FieldFill.INSERT)
 | 
			
		||||
    private Date createTime;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 更新者
 | 
			
		||||
	 */
 | 
			
		||||
	@ApiModelProperty(value = "更新者")
 | 
			
		||||
	@TableField(fill = FieldFill.INSERT_UPDATE)
 | 
			
		||||
	private String updateBy;
 | 
			
		||||
    /**
 | 
			
		||||
     * 更新者
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "更新者")
 | 
			
		||||
    @TableField(fill = FieldFill.INSERT_UPDATE)
 | 
			
		||||
    private String updateBy;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 更新时间
 | 
			
		||||
	 */
 | 
			
		||||
	@ApiModelProperty(value = "更新时间")
 | 
			
		||||
	@TableField(fill = FieldFill.INSERT_UPDATE)
 | 
			
		||||
	private Date updateTime;
 | 
			
		||||
    /**
 | 
			
		||||
     * 更新时间
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "更新时间")
 | 
			
		||||
    @TableField(fill = FieldFill.INSERT_UPDATE)
 | 
			
		||||
    private Date updateTime;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 请求参数
 | 
			
		||||
	 */
 | 
			
		||||
	@ApiModelProperty(value = "请求参数")
 | 
			
		||||
	@TableField(exist = false)
 | 
			
		||||
	private Map<String, Object> params = new HashMap<>();
 | 
			
		||||
    /**
 | 
			
		||||
     * 请求参数
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "请求参数")
 | 
			
		||||
    @TableField(exist = false)
 | 
			
		||||
    private Map<String, Object> params = new HashMap<>();
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,6 @@ import com.ruoyi.common.utils.StringUtils;
 | 
			
		||||
import com.ruoyi.common.utils.sql.SqlUtil;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.experimental.Accessors;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
 | 
			
		||||
@@ -18,10 +17,9 @@ import java.io.Serializable;
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
@Data
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
public class PageQuery implements Serializable {
 | 
			
		||||
 | 
			
		||||
	private static final long serialVersionUID = 1L;
 | 
			
		||||
    private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 分页大小
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										84
									
								
								ruoyi/src/main/java/com/ruoyi/common/core/domain/R.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										84
									
								
								ruoyi/src/main/java/com/ruoyi/common/core/domain/R.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,84 @@
 | 
			
		||||
package com.ruoyi.common.core.domain;
 | 
			
		||||
 | 
			
		||||
import io.swagger.annotations.ApiModel;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.NoArgsConstructor;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 响应信息主体
 | 
			
		||||
 *
 | 
			
		||||
 * @author Lion Li
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@NoArgsConstructor
 | 
			
		||||
@ApiModel("请求响应对象")
 | 
			
		||||
public class R<T> implements Serializable {
 | 
			
		||||
    private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 成功
 | 
			
		||||
     */
 | 
			
		||||
    public static final int SUCCESS = 200;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 失败
 | 
			
		||||
     */
 | 
			
		||||
    public static final int FAIL = 500;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty("消息状态码")
 | 
			
		||||
    private int code;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty("消息内容")
 | 
			
		||||
    private String msg;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty("数据对象")
 | 
			
		||||
    private T data;
 | 
			
		||||
 | 
			
		||||
    public static <T> R<T> ok() {
 | 
			
		||||
        return restResult(null, SUCCESS, null);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static <T> R<T> ok(T data) {
 | 
			
		||||
        return restResult(data, SUCCESS, null);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static <T> R<T> ok(String msg) {
 | 
			
		||||
        return restResult(null, SUCCESS, msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static <T> R<T> ok(String msg, T data) {
 | 
			
		||||
        return restResult(data, SUCCESS, msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static <T> R<T> fail() {
 | 
			
		||||
        return restResult(null, FAIL, null);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static <T> R<T> fail(String msg) {
 | 
			
		||||
        return restResult(null, FAIL, msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static <T> R<T> fail(T data) {
 | 
			
		||||
        return restResult(data, FAIL, null);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static <T> R<T> fail(String msg, T data) {
 | 
			
		||||
        return restResult(data, FAIL, msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static <T> R<T> fail(int code, String msg) {
 | 
			
		||||
        return restResult(null, code, msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static <T> R<T> restResult(T data, int code, String msg) {
 | 
			
		||||
        R<T> r = new R<>();
 | 
			
		||||
        r.setCode(code);
 | 
			
		||||
        r.setData(data);
 | 
			
		||||
        r.setMsg(msg);
 | 
			
		||||
        return r;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.annotation.TableField;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.EqualsAndHashCode;
 | 
			
		||||
import lombok.experimental.Accessors;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
@@ -17,29 +16,28 @@ import java.util.List;
 | 
			
		||||
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = true)
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
public class TreeEntity extends BaseEntity {
 | 
			
		||||
 | 
			
		||||
	private static final long serialVersionUID = 1L;
 | 
			
		||||
    private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 父菜单名称
 | 
			
		||||
	 */
 | 
			
		||||
	@TableField(exist = false)
 | 
			
		||||
	@ApiModelProperty(value = "父菜单名称")
 | 
			
		||||
	private String parentName;
 | 
			
		||||
    /**
 | 
			
		||||
     * 父菜单名称
 | 
			
		||||
     */
 | 
			
		||||
    @TableField(exist = false)
 | 
			
		||||
    @ApiModelProperty(value = "父菜单名称")
 | 
			
		||||
    private String parentName;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 父菜单ID
 | 
			
		||||
	 */
 | 
			
		||||
	@ApiModelProperty(value = "父菜单ID")
 | 
			
		||||
	private Long parentId;
 | 
			
		||||
    /**
 | 
			
		||||
     * 父菜单ID
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "父菜单ID")
 | 
			
		||||
    private Long parentId;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 子部门
 | 
			
		||||
	 */
 | 
			
		||||
	@TableField(exist = false)
 | 
			
		||||
	@ApiModelProperty(value = "子部门")
 | 
			
		||||
	private List<?> children = new ArrayList<>();
 | 
			
		||||
    /**
 | 
			
		||||
     * 子部门
 | 
			
		||||
     */
 | 
			
		||||
    @TableField(exist = false)
 | 
			
		||||
    @ApiModelProperty(value = "子部门")
 | 
			
		||||
    private List<?> children = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,6 @@
 | 
			
		||||
package com.ruoyi.common.core.domain.dto;
 | 
			
		||||
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.NoArgsConstructor;
 | 
			
		||||
import lombok.experimental.Accessors;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
@@ -14,8 +12,6 @@ import java.util.Date;
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
@Data
 | 
			
		||||
@NoArgsConstructor
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
public class OperLogDTO implements Serializable {
 | 
			
		||||
 | 
			
		||||
    private static final long serialVersionUID = 1L;
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,38 @@
 | 
			
		||||
package com.ruoyi.common.core.domain.dto;
 | 
			
		||||
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.NoArgsConstructor;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 角色
 | 
			
		||||
 *
 | 
			
		||||
 * @author Lion Li
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
@Data
 | 
			
		||||
@NoArgsConstructor
 | 
			
		||||
public class RoleDTO implements Serializable {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 角色ID
 | 
			
		||||
     */
 | 
			
		||||
    private Long roleId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 角色名称
 | 
			
		||||
     */
 | 
			
		||||
    private String roleName;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 角色权限
 | 
			
		||||
     */
 | 
			
		||||
    private String roleKey;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限)
 | 
			
		||||
     */
 | 
			
		||||
    private String dataScope;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,61 @@
 | 
			
		||||
package com.ruoyi.common.core.domain.dto;
 | 
			
		||||
 | 
			
		||||
import lombok.Builder;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.NoArgsConstructor;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 当前在线会话
 | 
			
		||||
 *
 | 
			
		||||
 * @author ruoyi
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
@Data
 | 
			
		||||
@NoArgsConstructor
 | 
			
		||||
public class UserOnlineDTO implements Serializable {
 | 
			
		||||
 | 
			
		||||
    private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 会话编号
 | 
			
		||||
     */
 | 
			
		||||
    private String tokenId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 部门名称
 | 
			
		||||
     */
 | 
			
		||||
    private String deptName;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 用户名称
 | 
			
		||||
     */
 | 
			
		||||
    private String userName;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 登录IP地址
 | 
			
		||||
     */
 | 
			
		||||
    private String ipaddr;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 登录地址
 | 
			
		||||
     */
 | 
			
		||||
    private String loginLocation;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 浏览器类型
 | 
			
		||||
     */
 | 
			
		||||
    private String browser;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 操作系统
 | 
			
		||||
     */
 | 
			
		||||
    private String os;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 登录时间
 | 
			
		||||
     */
 | 
			
		||||
    private Long loginTime;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -8,10 +8,10 @@ import io.swagger.annotations.ApiModel;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.EqualsAndHashCode;
 | 
			
		||||
import lombok.experimental.Accessors;
 | 
			
		||||
 | 
			
		||||
import javax.validation.constraints.Email;
 | 
			
		||||
import javax.validation.constraints.NotBlank;
 | 
			
		||||
import javax.validation.constraints.NotNull;
 | 
			
		||||
import javax.validation.constraints.Size;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -22,72 +22,71 @@ import javax.validation.constraints.Size;
 | 
			
		||||
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = true)
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
@TableName("sys_dept")
 | 
			
		||||
@ApiModel("部门业务对象")
 | 
			
		||||
public class SysDept extends TreeEntity {
 | 
			
		||||
	private static final long serialVersionUID = 1L;
 | 
			
		||||
    private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 部门ID
 | 
			
		||||
	 */
 | 
			
		||||
	@ApiModelProperty(value = "部门id")
 | 
			
		||||
	@TableId(value = "dept_id")
 | 
			
		||||
	private Long deptId;
 | 
			
		||||
    /**
 | 
			
		||||
     * 部门ID
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "部门id")
 | 
			
		||||
    @TableId(value = "dept_id")
 | 
			
		||||
    private Long deptId;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 部门名称
 | 
			
		||||
	 */
 | 
			
		||||
	@ApiModelProperty(value = "部门名称")
 | 
			
		||||
	@NotBlank(message = "部门名称不能为空")
 | 
			
		||||
	@Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
 | 
			
		||||
	private String deptName;
 | 
			
		||||
    /**
 | 
			
		||||
     * 部门名称
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "部门名称")
 | 
			
		||||
    @NotBlank(message = "部门名称不能为空")
 | 
			
		||||
    @Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
 | 
			
		||||
    private String deptName;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 显示顺序
 | 
			
		||||
	 */
 | 
			
		||||
	@ApiModelProperty(value = "显示顺序")
 | 
			
		||||
	@NotBlank(message = "显示顺序不能为空")
 | 
			
		||||
	private String orderNum;
 | 
			
		||||
    /**
 | 
			
		||||
     * 显示顺序
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "显示顺序")
 | 
			
		||||
    @NotNull(message = "显示顺序不能为空")
 | 
			
		||||
    private Long orderNum;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 负责人
 | 
			
		||||
	 */
 | 
			
		||||
	@ApiModelProperty(value = "负责人")
 | 
			
		||||
	private String leader;
 | 
			
		||||
    /**
 | 
			
		||||
     * 负责人
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "负责人")
 | 
			
		||||
    private String leader;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 联系电话
 | 
			
		||||
	 */
 | 
			
		||||
	@ApiModelProperty(value = "联系电话")
 | 
			
		||||
	@Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
 | 
			
		||||
	private String phone;
 | 
			
		||||
    /**
 | 
			
		||||
     * 联系电话
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "联系电话")
 | 
			
		||||
    @Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
 | 
			
		||||
    private String phone;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 邮箱
 | 
			
		||||
	 */
 | 
			
		||||
	@ApiModelProperty(value = "邮箱")
 | 
			
		||||
	@Email(message = "邮箱格式不正确")
 | 
			
		||||
	@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
 | 
			
		||||
	private String email;
 | 
			
		||||
    /**
 | 
			
		||||
     * 邮箱
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "邮箱")
 | 
			
		||||
    @Email(message = "邮箱格式不正确")
 | 
			
		||||
    @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
 | 
			
		||||
    private String email;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 部门状态:0正常,1停用
 | 
			
		||||
	 */
 | 
			
		||||
	@ApiModelProperty(value = "部门状态:0正常,1停用")
 | 
			
		||||
	private String status;
 | 
			
		||||
    /**
 | 
			
		||||
     * 部门状态:0正常,1停用
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "部门状态:0正常,1停用")
 | 
			
		||||
    private String status;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 删除标志(0代表存在 2代表删除)
 | 
			
		||||
	 */
 | 
			
		||||
	@ApiModelProperty(value = "删除标志(0代表存在 2代表删除)")
 | 
			
		||||
	@TableLogic
 | 
			
		||||
	private String delFlag;
 | 
			
		||||
    /**
 | 
			
		||||
     * 删除标志(0代表存在 2代表删除)
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "删除标志(0代表存在 2代表删除)")
 | 
			
		||||
    @TableLogic
 | 
			
		||||
    private String delFlag;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 祖级列表
 | 
			
		||||
	 */
 | 
			
		||||
	@ApiModelProperty(value = "祖级列表")
 | 
			
		||||
	private String ancestors;
 | 
			
		||||
    /**
 | 
			
		||||
     * 祖级列表
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty(value = "祖级列表")
 | 
			
		||||
    private String ancestors;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user