mirror of
https://gitee.com/y_project/RuoYi-Vue.git
synced 2025-12-08 15:02:29 +08:00
Compare commits
113 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6bfae2652f | |||
| 9bc730866f | |||
| a2d3f987c0 | |||
| bf4ac3ad7a | |||
| f28a91969a | |||
| ca285f5e53 | |||
| 34f2552cad | |||
| 89e7cb19b9 | |||
| ea71c9b214 | |||
| e5fd1f76db | |||
| 664192da0b | |||
| 9fc3e220a7 | |||
| 64f6a69d9a | |||
| 16734b1d88 | |||
| 31106c91fb | |||
| 026a427103 | |||
| bafb1372a7 | |||
| b4f032fab4 | |||
| 4f194aa101 | |||
| ef4bfde4a8 | |||
| 421593c0ba | |||
| 91ad85aec1 | |||
| d1eacc1d1c | |||
| e41dd8a0f1 | |||
| 9a7bb81cd0 | |||
| fcf606acde | |||
| 084907eeca | |||
| 8de93d35ed | |||
| cedd2d1daf | |||
| 2ab96587ef | |||
| cb9c0e79eb | |||
| 96d2b2d6b8 | |||
| b00171366f | |||
| 4e817a1109 | |||
| d185d4e4cc | |||
| bbbe83b737 | |||
| cc4c52c998 | |||
| bd09e5b11c | |||
| 181f62c15e | |||
| 3ae5ec92a5 | |||
| 2fe919b6ce | |||
| 13c770b6be | |||
| 2eb55528ec | |||
| 839f631d6b | |||
| 8faae71157 | |||
| b87e0fa124 | |||
| b6596d021b | |||
| 0628dc9b2f | |||
| 790aa0d24b | |||
| 8a7dcf8a80 | |||
| 0c30ffa11f | |||
| 0904bf6446 | |||
| 4583787759 | |||
| 17550a5f4b | |||
| a4558c32b2 | |||
| ef4fef3d56 | |||
| 3dbbc6a223 | |||
| d3696f5223 | |||
| 2d7d137abd | |||
| c2a179e9dd | |||
| 519ea854d5 | |||
| e66d0e4f74 | |||
| e7afea4cb7 | |||
| 6d6271d6c9 | |||
| eb4376b649 | |||
| b1e5ebab8f | |||
| 8bd6296721 | |||
| ae5c68368b | |||
| 4fdb0f48ec | |||
| c4207f640b | |||
| f6e477b4f5 | |||
| 7ae47b50b8 | |||
| 0b14155a75 | |||
| f1fed76273 | |||
| 48813161f6 | |||
| a006904724 | |||
| 5477ce3c39 | |||
| 25f50d74c5 | |||
| 266f4d6806 | |||
| ded99502ae | |||
| 02b95f95a8 | |||
| 2a6d2d733e | |||
| 30c89b33fe | |||
| 7479ff4b06 | |||
| 821f40882f | |||
| 02ce9868a7 | |||
| a8f2ff4531 | |||
| eaa3baab3c | |||
| 6480282826 | |||
| 6197ad5090 | |||
| b477e40d3c | |||
| f8cc7ce328 | |||
| 1a5881b1d0 | |||
| fa124aeb8b | |||
| 258335cc65 | |||
| 3b42abef44 | |||
| 26f0737c60 | |||
| ac94242875 | |||
| 54bfa627f0 | |||
| 36c058188a | |||
| a292cccb63 | |||
| 5ccd9877b4 | |||
| 7108ec41b5 | |||
| 5188d56b4a | |||
| 8f7ed66544 | |||
| aaae404b2a | |||
| f3a8b4625f | |||
| 12ab8b03d9 | |||
| 23270c60bc | |||
| 2cb6709323 | |||
| 917bc03a43 | |||
| dbe3446b63 | |||
| b84e7013d2 |
@ -7,6 +7,7 @@
|
|||||||
* 权限认证使用Jwt,支持多终端认证系统。
|
* 权限认证使用Jwt,支持多终端认证系统。
|
||||||
* 支持加载动态权限菜单,多方式轻松权限控制。
|
* 支持加载动态权限菜单,多方式轻松权限控制。
|
||||||
* 高效率开发,使用代码生成器可以一键生成前后端代码。
|
* 高效率开发,使用代码生成器可以一键生成前后端代码。
|
||||||
|
* 提供了技术栈([Vue3](https://v3.cn.vuejs.org) [Element Plus](https://element-plus.org/zh-CN) [Vite](https://cn.vitejs.dev))版本[RuoYi-Vue3](https://github.com/yangzongzhuan/RuoYi-Vue3),保持同步更新。
|
||||||
* 提供了单应用版本[RuoYi-Vue-fast](https://github.com/yangzongzhuan/RuoYi-Vue-fast),Oracle版本[RuoYi-Vue-Oracle](https://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。
|
* 提供了单应用版本[RuoYi-Vue-fast](https://github.com/yangzongzhuan/RuoYi-Vue-fast),Oracle版本[RuoYi-Vue-Oracle](https://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。
|
||||||
* 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud)
|
* 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud)
|
||||||
* 特别鸣谢:[element](https://github.com/ElemeFE/element),[vue-element-admin](https://github.com/PanJiaChen/vue-element-admin),[eladmin-web](https://github.com/elunez/eladmin-web)。
|
* 特别鸣谢:[element](https://github.com/ElemeFE/element),[vue-element-admin](https://github.com/PanJiaChen/vue-element-admin),[eladmin-web](https://github.com/elunez/eladmin-web)。
|
||||||
@ -82,4 +83,4 @@
|
|||||||
|
|
||||||
## 若依前后端分离交流群
|
## 若依前后端分离交流群
|
||||||
|
|
||||||
QQ群: [](https://jq.qq.com/?_wv=1027&k=5bVB1og) [](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [](https://jq.qq.com/?_wv=1027&k=51G72yr) [](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [](https://jq.qq.com/?_wv=1027&k=5vYAqA05) [](https://jq.qq.com/?_wv=1027&k=kOIINEb5) 点击按钮入群。
|
QQ群: [](https://jq.qq.com/?_wv=1027&k=5bVB1og) [](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [](https://jq.qq.com/?_wv=1027&k=51G72yr) [](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [](https://jq.qq.com/?_wv=1027&k=5vYAqA05) [](https://jq.qq.com/?_wv=1027&k=kOIINEb5) [](https://jq.qq.com/?_wv=1027&k=UKtX5jhs) 点击按钮入群。
|
||||||
32
pom.xml
32
pom.xml
@ -6,32 +6,32 @@
|
|||||||
|
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<version>3.7.0</version>
|
<version>3.8.0</version>
|
||||||
|
|
||||||
<name>ruoyi</name>
|
<name>ruoyi</name>
|
||||||
<url>http://www.ruoyi.vip</url>
|
<url>http://www.ruoyi.vip</url>
|
||||||
<description>若依管理系统</description>
|
<description>若依管理系统</description>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<ruoyi.version>3.7.0</ruoyi.version>
|
<ruoyi.version>3.8.0</ruoyi.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
||||||
<druid.version>1.2.6</druid.version>
|
<druid.version>1.2.8</druid.version>
|
||||||
<bitwalker.version>1.21</bitwalker.version>
|
<bitwalker.version>1.21</bitwalker.version>
|
||||||
<swagger.version>3.0.0</swagger.version>
|
<swagger.version>3.0.0</swagger.version>
|
||||||
<kaptcha.version>2.3.2</kaptcha.version>
|
<kaptcha.version>2.3.2</kaptcha.version>
|
||||||
<mybatis-spring-boot.version>2.1.4</mybatis-spring-boot.version>
|
<mybatis-spring-boot.version>2.2.0</mybatis-spring-boot.version>
|
||||||
<pagehelper.boot.version>1.3.1</pagehelper.boot.version>
|
<pagehelper.boot.version>1.4.0</pagehelper.boot.version>
|
||||||
<fastjson.version>1.2.76</fastjson.version>
|
<fastjson.version>1.2.78</fastjson.version>
|
||||||
<oshi.version>5.8.0</oshi.version>
|
<oshi.version>5.8.2</oshi.version>
|
||||||
<jna.version>5.8.0</jna.version>
|
<jna.version>5.9.0</jna.version>
|
||||||
<commons.io.version>2.11.0</commons.io.version>
|
<commons.io.version>2.11.0</commons.io.version>
|
||||||
<commons.fileupload.version>1.4</commons.fileupload.version>
|
<commons.fileupload.version>1.4</commons.fileupload.version>
|
||||||
<commons.collections.version>3.2.2</commons.collections.version>
|
<commons.collections.version>3.2.2</commons.collections.version>
|
||||||
<poi.version>4.1.2</poi.version>
|
<poi.version>4.1.2</poi.version>
|
||||||
<velocity.version>1.7</velocity.version>
|
<velocity.version>2.3</velocity.version>
|
||||||
<jwt.version>0.9.1</jwt.version>
|
<jwt.version>0.9.1</jwt.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
@ -43,7 +43,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-dependencies</artifactId>
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
<version>2.2.13.RELEASE</version>
|
<version>2.5.6</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
@ -132,14 +132,8 @@
|
|||||||
<!-- velocity代码生成使用模板 -->
|
<!-- velocity代码生成使用模板 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.velocity</groupId>
|
<groupId>org.apache.velocity</groupId>
|
||||||
<artifactId>velocity</artifactId>
|
<artifactId>velocity-engine-core</artifactId>
|
||||||
<version>${velocity.version}</version>
|
<version>${velocity.version}</version>
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>commons-collections</groupId>
|
|
||||||
<artifactId>commons-collections</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- collections工具类 -->
|
<!-- collections工具类 -->
|
||||||
@ -242,7 +236,7 @@
|
|||||||
<repository>
|
<repository>
|
||||||
<id>public</id>
|
<id>public</id>
|
||||||
<name>aliyun nexus</name>
|
<name>aliyun nexus</name>
|
||||||
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
<url>https://maven.aliyun.com/repository/public</url>
|
||||||
<releases>
|
<releases>
|
||||||
<enabled>true</enabled>
|
<enabled>true</enabled>
|
||||||
</releases>
|
</releases>
|
||||||
@ -253,7 +247,7 @@
|
|||||||
<pluginRepository>
|
<pluginRepository>
|
||||||
<id>public</id>
|
<id>public</id>
|
||||||
<name>aliyun nexus</name>
|
<name>aliyun nexus</name>
|
||||||
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
<url>https://maven.aliyun.com/repository/public</url>
|
||||||
<releases>
|
<releases>
|
||||||
<enabled>true</enabled>
|
<enabled>true</enabled>
|
||||||
</releases>
|
</releases>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>3.7.0</version>
|
<version>3.8.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|||||||
@ -6,8 +6,8 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.util.FastByteArrayOutputStream;
|
import org.springframework.util.FastByteArrayOutputStream;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@ -36,10 +36,6 @@ public class CaptchaController
|
|||||||
@Autowired
|
@Autowired
|
||||||
private RedisCache redisCache;
|
private RedisCache redisCache;
|
||||||
|
|
||||||
// 验证码类型
|
|
||||||
@Value("${ruoyi.captchaType}")
|
|
||||||
private String captchaType;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysConfigService configService;
|
private ISysConfigService configService;
|
||||||
/**
|
/**
|
||||||
@ -64,6 +60,7 @@ public class CaptchaController
|
|||||||
BufferedImage image = null;
|
BufferedImage image = null;
|
||||||
|
|
||||||
// 生成验证码
|
// 生成验证码
|
||||||
|
String captchaType = RuoYiConfig.getCaptchaType();
|
||||||
if ("math".equals(captchaType))
|
if ("math".equals(captchaType))
|
||||||
{
|
{
|
||||||
String capText = captchaProducerMath.createText();
|
String capText = captchaProducerMath.createText();
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
package com.ruoyi.web.controller.monitor;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
@ -40,12 +42,12 @@ public class SysLogininforController extends BaseController
|
|||||||
|
|
||||||
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
|
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
|
||||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
|
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
|
||||||
@GetMapping("/export")
|
@PostMapping("/export")
|
||||||
public AjaxResult export(SysLogininfor logininfor)
|
public void export(HttpServletResponse response, SysLogininfor logininfor)
|
||||||
{
|
{
|
||||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||||
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
||||||
return util.exportExcel(list, "登录日志");
|
util.exportExcel(response, list, "登录日志");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
package com.ruoyi.web.controller.monitor;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
@ -40,12 +42,12 @@ public class SysOperlogController extends BaseController
|
|||||||
|
|
||||||
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
||||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
|
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
|
||||||
@GetMapping("/export")
|
@PostMapping("/export")
|
||||||
public AjaxResult export(SysOperLog operLog)
|
public void export(HttpServletResponse response, SysOperLog operLog)
|
||||||
{
|
{
|
||||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||||
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
|
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
|
||||||
return util.exportExcel(list, "操作日志");
|
util.exportExcel(response, list, "操作日志");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "操作日志", businessType = BusinessType.DELETE)
|
@Log(title = "操作日志", businessType = BusinessType.DELETE)
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -13,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
@ -49,12 +49,12 @@ public class SysConfigController extends BaseController
|
|||||||
|
|
||||||
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
||||||
@PreAuthorize("@ss.hasPermi('system:config:export')")
|
@PreAuthorize("@ss.hasPermi('system:config:export')")
|
||||||
@GetMapping("/export")
|
@PostMapping("/export")
|
||||||
public AjaxResult export(SysConfig config)
|
public void export(HttpServletResponse response, SysConfig config)
|
||||||
{
|
{
|
||||||
List<SysConfig> list = configService.selectConfigList(config);
|
List<SysConfig> list = configService.selectConfigList(config);
|
||||||
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
|
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
|
||||||
return util.exportExcel(list, "参数数据");
|
util.exportExcel(response, list, "参数数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,7 +82,6 @@ public class SysConfigController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('system:config:add')")
|
@PreAuthorize("@ss.hasPermi('system:config:add')")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@RepeatSubmit
|
|
||||||
public AjaxResult add(@Validated @RequestBody SysConfig config)
|
public AjaxResult add(@Validated @RequestBody SysConfig config)
|
||||||
{
|
{
|
||||||
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.ruoyi.web.controller.system;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -50,12 +51,12 @@ public class SysDictDataController extends BaseController
|
|||||||
|
|
||||||
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
||||||
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||||
@GetMapping("/export")
|
@PostMapping("/export")
|
||||||
public AjaxResult export(SysDictData dictData)
|
public void export(HttpServletResponse response, SysDictData dictData)
|
||||||
{
|
{
|
||||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||||
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
|
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
|
||||||
return util.exportExcel(list, "字典数据");
|
util.exportExcel(response, list, "字典数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -45,12 +46,12 @@ public class SysDictTypeController extends BaseController
|
|||||||
|
|
||||||
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
||||||
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||||
@GetMapping("/export")
|
@PostMapping("/export")
|
||||||
public AjaxResult export(SysDictType dictType)
|
public void export(HttpServletResponse response, SysDictType dictType)
|
||||||
{
|
{
|
||||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||||
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
||||||
return util.exportExcel(list, "字典类型");
|
util.exportExcel(response, list, "字典类型");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -48,12 +49,12 @@ public class SysPostController extends BaseController
|
|||||||
|
|
||||||
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
||||||
@PreAuthorize("@ss.hasPermi('system:post:export')")
|
@PreAuthorize("@ss.hasPermi('system:post:export')")
|
||||||
@GetMapping("/export")
|
@PostMapping("/export")
|
||||||
public AjaxResult export(SysPost post)
|
public void export(HttpServletResponse response, SysPost post)
|
||||||
{
|
{
|
||||||
List<SysPost> list = postService.selectPostList(post);
|
List<SysPost> list = postService.selectPostList(post);
|
||||||
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
|
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
|
||||||
return util.exportExcel(list, "岗位数据");
|
util.exportExcel(response, list, "岗位数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -60,6 +60,9 @@ public class SysProfileController extends BaseController
|
|||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult updateProfile(@RequestBody SysUser user)
|
public AjaxResult updateProfile(@RequestBody SysUser user)
|
||||||
{
|
{
|
||||||
|
LoginUser loginUser = getLoginUser();
|
||||||
|
SysUser sysUser = loginUser.getUser();
|
||||||
|
user.setUserName(sysUser.getUserName());
|
||||||
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
||||||
{
|
{
|
||||||
@ -70,8 +73,6 @@ public class SysProfileController extends BaseController
|
|||||||
{
|
{
|
||||||
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||||
}
|
}
|
||||||
LoginUser loginUser = getLoginUser();
|
|
||||||
SysUser sysUser = loginUser.getUser();
|
|
||||||
user.setUserId(sysUser.getUserId());
|
user.setUserId(sysUser.getUserId());
|
||||||
user.setPassword(null);
|
user.setPassword(null);
|
||||||
if (userService.updateUserProfile(user) > 0)
|
if (userService.updateUserProfile(user) > 0)
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.domain.model.RegisterBody;
|
import com.ruoyi.common.core.domain.model.RegisterBody;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.framework.web.service.SysRegisterService;
|
import com.ruoyi.framework.web.service.SysRegisterService;
|
||||||
import com.ruoyi.system.service.ISysConfigService;
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -61,12 +62,12 @@ public class SysRoleController extends BaseController
|
|||||||
|
|
||||||
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
||||||
@PreAuthorize("@ss.hasPermi('system:role:export')")
|
@PreAuthorize("@ss.hasPermi('system:role:export')")
|
||||||
@GetMapping("/export")
|
@PostMapping("/export")
|
||||||
public AjaxResult export(SysRole role)
|
public void export(HttpServletResponse response, SysRole role)
|
||||||
{
|
{
|
||||||
List<SysRole> list = roleService.selectRoleList(role);
|
List<SysRole> list = roleService.selectRoleList(role);
|
||||||
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
|
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
|
||||||
return util.exportExcel(list, "角色数据");
|
util.exportExcel(response, list, "角色数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.ruoyi.web.controller.system;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@ -62,12 +63,12 @@ public class SysUserController extends BaseController
|
|||||||
|
|
||||||
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
||||||
@PreAuthorize("@ss.hasPermi('system:user:export')")
|
@PreAuthorize("@ss.hasPermi('system:user:export')")
|
||||||
@GetMapping("/export")
|
@PostMapping("/export")
|
||||||
public AjaxResult export(SysUser user)
|
public void export(HttpServletResponse response, SysUser user)
|
||||||
{
|
{
|
||||||
List<SysUser> list = userService.selectUserList(user);
|
List<SysUser> list = userService.selectUserList(user);
|
||||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||||
return util.exportExcel(list, "用户数据");
|
util.exportExcel(response, list, "用户数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
||||||
@ -82,11 +83,11 @@ public class SysUserController extends BaseController
|
|||||||
return AjaxResult.success(message);
|
return AjaxResult.success(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/importTemplate")
|
@PostMapping("/importTemplate")
|
||||||
public AjaxResult importTemplate()
|
public void importTemplate(HttpServletResponse response)
|
||||||
{
|
{
|
||||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||||
return util.importTemplateExcel("用户数据");
|
util.importTemplateExcel(response, "用户数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -47,7 +47,7 @@ public class TestController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("获取用户详细")
|
@ApiOperation("获取用户详细")
|
||||||
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
|
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
|
||||||
@GetMapping("/{userId}")
|
@GetMapping("/{userId}")
|
||||||
public AjaxResult getUser(@PathVariable Integer userId)
|
public AjaxResult getUser(@PathVariable Integer userId)
|
||||||
{
|
{
|
||||||
@ -63,10 +63,10 @@ public class TestController extends BaseController
|
|||||||
|
|
||||||
@ApiOperation("新增用户")
|
@ApiOperation("新增用户")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer"),
|
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class),
|
||||||
@ApiImplicitParam(name = "username", value = "用户名称", dataType = "String"),
|
@ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class),
|
||||||
@ApiImplicitParam(name = "password", value = "用户密码", dataType = "String"),
|
@ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class),
|
||||||
@ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String")
|
@ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class)
|
||||||
})
|
})
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
public AjaxResult save(UserEntity user)
|
public AjaxResult save(UserEntity user)
|
||||||
@ -95,7 +95,7 @@ public class TestController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("删除用户信息")
|
@ApiOperation("删除用户信息")
|
||||||
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
|
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
|
||||||
@DeleteMapping("/{userId}")
|
@DeleteMapping("/{userId}")
|
||||||
public AjaxResult delete(@PathVariable Integer userId)
|
public AjaxResult delete(@PathVariable Integer userId)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,7 @@ ruoyi:
|
|||||||
# 名称
|
# 名称
|
||||||
name: RuoYi
|
name: RuoYi
|
||||||
# 版本
|
# 版本
|
||||||
version: 3.7.0
|
version: 3.8.0
|
||||||
# 版权年份
|
# 版权年份
|
||||||
copyrightYear: 2021
|
copyrightYear: 2021
|
||||||
# 实例演示开关
|
# 实例演示开关
|
||||||
|
|||||||
@ -3,13 +3,18 @@
|
|||||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<!-- 全局参数 -->
|
||||||
<settings>
|
<settings>
|
||||||
<setting name="cacheEnabled" value="true" /> <!-- 全局映射器启用缓存 -->
|
<!-- 使全局的映射器启用或禁用缓存 -->
|
||||||
<setting name="useGeneratedKeys" value="true" /> <!-- 允许 JDBC 支持自动生成主键 -->
|
<setting name="cacheEnabled" value="true" />
|
||||||
<setting name="defaultExecutorType" value="REUSE" /> <!-- 配置默认的执行器 -->
|
<!-- 允许JDBC 支持自动生成主键 -->
|
||||||
<setting name="logImpl" value="SLF4J" /> <!-- 指定 MyBatis 所用日志的具体实现 -->
|
<setting name="useGeneratedKeys" value="true" />
|
||||||
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> 驼峰式命名 -->
|
<!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
|
||||||
|
<setting name="defaultExecutorType" value="SIMPLE" />
|
||||||
|
<!-- 指定 MyBatis 所用日志的具体实现 -->
|
||||||
|
<setting name="logImpl" value="SLF4J" />
|
||||||
|
<!-- 使用驼峰命名法转换字段 -->
|
||||||
|
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
|
||||||
</settings>
|
</settings>
|
||||||
|
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>3.7.0</version>
|
<version>3.8.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
@ -43,8 +43,8 @@
|
|||||||
|
|
||||||
<!-- 自定义验证注解 -->
|
<!-- 自定义验证注解 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.validation</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>validation-api</artifactId>
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--常用工具类 -->
|
<!--常用工具类 -->
|
||||||
@ -95,6 +95,12 @@
|
|||||||
<artifactId>jjwt</artifactId>
|
<artifactId>jjwt</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Jaxb -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- redis 缓存操作 -->
|
<!-- redis 缓存操作 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import java.lang.annotation.Retention;
|
|||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelHandlerAdapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义导出Excel数据注解
|
* 自定义导出Excel数据注解
|
||||||
@ -108,7 +109,17 @@ public @interface Excel
|
|||||||
/**
|
/**
|
||||||
* 导出字段对齐方式(0:默认;1:靠左;2:居中;3:靠右)
|
* 导出字段对齐方式(0:默认;1:靠左;2:居中;3:靠右)
|
||||||
*/
|
*/
|
||||||
Align align() default Align.AUTO;
|
public Align align() default Align.AUTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义数据处理器
|
||||||
|
*/
|
||||||
|
public Class<?> handler() default ExcelHandlerAdapter.class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义数据处理器参数
|
||||||
|
*/
|
||||||
|
public String[] args() default {};
|
||||||
|
|
||||||
public enum Align
|
public enum Align
|
||||||
{
|
{
|
||||||
|
|||||||
@ -38,4 +38,9 @@ public @interface Log
|
|||||||
* 是否保存请求的参数
|
* 是否保存请求的参数
|
||||||
*/
|
*/
|
||||||
public boolean isSaveRequestData() default true;
|
public boolean isSaveRequestData() default true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否保存响应的参数
|
||||||
|
*/
|
||||||
|
public boolean isSaveResponseData() default true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,5 +19,13 @@ import java.lang.annotation.Target;
|
|||||||
@Documented
|
@Documented
|
||||||
public @interface RepeatSubmit
|
public @interface RepeatSubmit
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* 间隔时间(ms),小于此时间视为重复提交
|
||||||
|
*/
|
||||||
|
public int interval() default 5000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提示消息
|
||||||
|
*/
|
||||||
|
public String message() default "不允许重复提交,请稍候再试";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,6 +30,9 @@ public class RuoYiConfig
|
|||||||
/** 获取地址开关 */
|
/** 获取地址开关 */
|
||||||
private static boolean addressEnabled;
|
private static boolean addressEnabled;
|
||||||
|
|
||||||
|
/** 验证码类型 */
|
||||||
|
private static String captchaType;
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return name;
|
return name;
|
||||||
@ -90,6 +93,14 @@ public class RuoYiConfig
|
|||||||
RuoYiConfig.addressEnabled = addressEnabled;
|
RuoYiConfig.addressEnabled = addressEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getCaptchaType() {
|
||||||
|
return captchaType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCaptchaType(String captchaType) {
|
||||||
|
RuoYiConfig.captchaType = captchaType;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取导入上传路径
|
* 获取导入上传路径
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -148,4 +148,10 @@ public class Constants
|
|||||||
* LDAP 远程方法调用
|
* LDAP 远程方法调用
|
||||||
*/
|
*/
|
||||||
public static final String LOOKUP_LDAP = "ldap://";
|
public static final String LOOKUP_LDAP = "ldap://";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时任务违规的字符
|
||||||
|
*/
|
||||||
|
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
|
||||||
|
"org.springframework.jndi" };
|
||||||
}
|
}
|
||||||
@ -145,4 +145,18 @@ public class AjaxResult extends HashMap<String, Object>
|
|||||||
{
|
{
|
||||||
return new AjaxResult(code, msg, null);
|
return new AjaxResult(code, msg, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 方便链式调用
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param value 值
|
||||||
|
* @return 数据对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult put(String key, Object value)
|
||||||
|
{
|
||||||
|
super.put(key, value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import java.util.Collection;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.springframework.security.core.GrantedAuthority;
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
import org.springframework.security.core.userdetails.UserDetails;
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -119,7 +119,7 @@ public class LoginUser implements UserDetails
|
|||||||
this.permissions = permissions;
|
this.permissions = permissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonIgnore
|
@JSONField(serialize = false)
|
||||||
@Override
|
@Override
|
||||||
public String getPassword()
|
public String getPassword()
|
||||||
{
|
{
|
||||||
@ -135,7 +135,7 @@ public class LoginUser implements UserDetails
|
|||||||
/**
|
/**
|
||||||
* 账户是否未过期,过期无法验证
|
* 账户是否未过期,过期无法验证
|
||||||
*/
|
*/
|
||||||
@JsonIgnore
|
@JSONField(serialize = false)
|
||||||
@Override
|
@Override
|
||||||
public boolean isAccountNonExpired()
|
public boolean isAccountNonExpired()
|
||||||
{
|
{
|
||||||
@ -147,7 +147,7 @@ public class LoginUser implements UserDetails
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@JsonIgnore
|
@JSONField(serialize = false)
|
||||||
@Override
|
@Override
|
||||||
public boolean isAccountNonLocked()
|
public boolean isAccountNonLocked()
|
||||||
{
|
{
|
||||||
@ -159,7 +159,7 @@ public class LoginUser implements UserDetails
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@JsonIgnore
|
@JSONField(serialize = false)
|
||||||
@Override
|
@Override
|
||||||
public boolean isCredentialsNonExpired()
|
public boolean isCredentialsNonExpired()
|
||||||
{
|
{
|
||||||
@ -171,7 +171,7 @@ public class LoginUser implements UserDetails
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@JsonIgnore
|
@JSONField(serialize = false)
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnabled()
|
public boolean isEnabled()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -209,6 +209,18 @@ public class RedisCache
|
|||||||
return opsForHash.get(key, hKey);
|
return opsForHash.get(key, hKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除Hash中的数据
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* @param mapkey
|
||||||
|
*/
|
||||||
|
public void delCacheMapValue(final String key, final String hkey)
|
||||||
|
{
|
||||||
|
HashOperations hashOperations = redisTemplate.opsForHash();
|
||||||
|
hashOperations.delete(key, hkey);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取多个Hash中的数据
|
* 获取多个Hash中的数据
|
||||||
*
|
*
|
||||||
|
|||||||
@ -36,7 +36,7 @@ public class Threads
|
|||||||
* 停止线程池
|
* 停止线程池
|
||||||
* 先使用shutdown, 停止接收新任务并尝试完成所有已存在任务.
|
* 先使用shutdown, 停止接收新任务并尝试完成所有已存在任务.
|
||||||
* 如果超时, 则调用shutdownNow, 取消在workQueue中Pending的任务,并中断所有阻塞函数.
|
* 如果超时, 则调用shutdownNow, 取消在workQueue中Pending的任务,并中断所有阻塞函数.
|
||||||
* 如果仍人超時,則強制退出.
|
* 如果仍然超時,則強制退出.
|
||||||
* 另对在shutdown时线程本身被调用中断做了处理.
|
* 另对在shutdown时线程本身被调用中断做了处理.
|
||||||
*/
|
*/
|
||||||
public static void shutdownAndAwaitTermination(ExecutorService pool)
|
public static void shutdownAndAwaitTermination(ExecutorService pool)
|
||||||
|
|||||||
@ -210,7 +210,10 @@ public class FileUtils
|
|||||||
.append("utf-8''")
|
.append("utf-8''")
|
||||||
.append(percentEncodedFileName);
|
.append(percentEncodedFileName);
|
||||||
|
|
||||||
|
response.addHeader("Access-Control-Allow-Origin", "*");
|
||||||
|
response.addHeader("Access-Control-Expose-Headers", "Content-Disposition,download-filename");
|
||||||
response.setHeader("Content-disposition", contentDispositionValue.toString());
|
response.setHeader("Content-disposition", contentDispositionValue.toString());
|
||||||
|
response.setHeader("download-filename", percentEncodedFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -69,26 +69,37 @@ public class EscapeUtil
|
|||||||
*/
|
*/
|
||||||
private static String encode(String text)
|
private static String encode(String text)
|
||||||
{
|
{
|
||||||
int len;
|
if (StringUtils.isEmpty(text))
|
||||||
if ((text == null) || ((len = text.length()) == 0))
|
|
||||||
{
|
{
|
||||||
return StringUtils.EMPTY;
|
return StringUtils.EMPTY;
|
||||||
}
|
}
|
||||||
StringBuilder buffer = new StringBuilder(len + (len >> 2));
|
|
||||||
|
final StringBuilder tmp = new StringBuilder(text.length() * 6);
|
||||||
char c;
|
char c;
|
||||||
for (int i = 0; i < len; i++)
|
for (int i = 0; i < text.length(); i++)
|
||||||
{
|
{
|
||||||
c = text.charAt(i);
|
c = text.charAt(i);
|
||||||
if (c < 64)
|
if (c < 256)
|
||||||
{
|
{
|
||||||
buffer.append(TEXT[c]);
|
tmp.append("%");
|
||||||
|
if (c < 16)
|
||||||
|
{
|
||||||
|
tmp.append("0");
|
||||||
|
}
|
||||||
|
tmp.append(Integer.toString(c, 16));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buffer.append(c);
|
tmp.append("%u");
|
||||||
|
if (c <= 0xfff)
|
||||||
|
{
|
||||||
|
// issue#I49JU8@Gitee
|
||||||
|
tmp.append("0");
|
||||||
|
}
|
||||||
|
tmp.append(Integer.toString(c, 16));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return buffer.toString();
|
return tmp.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -145,11 +156,12 @@ public class EscapeUtil
|
|||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{
|
{
|
||||||
String html = "<script>alert(1);</script>";
|
String html = "<script>alert(1);</script>";
|
||||||
|
String escape = EscapeUtil.escape(html);
|
||||||
// String html = "<scr<script>ipt>alert(\"XSS\")</scr<script>ipt>";
|
// String html = "<scr<script>ipt>alert(\"XSS\")</scr<script>ipt>";
|
||||||
// String html = "<123";
|
// String html = "<123";
|
||||||
// String html = "123>";
|
// String html = "123>";
|
||||||
System.out.println(EscapeUtil.clean(html));
|
System.out.println("clean: " + EscapeUtil.clean(html));
|
||||||
System.out.println(EscapeUtil.escape(html));
|
System.out.println("escape: " + escape);
|
||||||
System.out.println(EscapeUtil.unescape(html));
|
System.out.println("unescape: " + EscapeUtil.unescape(escape));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -332,7 +332,7 @@ public final class HTMLFilter
|
|||||||
final String name = m.group(1).toLowerCase();
|
final String name = m.group(1).toLowerCase();
|
||||||
if (allowed(name))
|
if (allowed(name))
|
||||||
{
|
{
|
||||||
if (false == inArray(name, vSelfClosingTags))
|
if (!inArray(name, vSelfClosingTags))
|
||||||
{
|
{
|
||||||
if (vTagCounts.containsKey(name))
|
if (vTagCounts.containsKey(name))
|
||||||
{
|
{
|
||||||
@ -387,7 +387,7 @@ public final class HTMLFilter
|
|||||||
{
|
{
|
||||||
paramValue = processParamProtocol(paramValue);
|
paramValue = processParamProtocol(paramValue);
|
||||||
}
|
}
|
||||||
params.append(' ').append(paramName).append("=\"").append(paramValue).append("\"");
|
params.append(' ').append(paramName).append("=\\\"").append(paramValue).append("\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import javax.net.ssl.X509TrustManager;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.constant.Constants;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用http发送方法
|
* 通用http发送方法
|
||||||
@ -29,6 +30,17 @@ public class HttpUtils
|
|||||||
{
|
{
|
||||||
private static final Logger log = LoggerFactory.getLogger(HttpUtils.class);
|
private static final Logger log = LoggerFactory.getLogger(HttpUtils.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向指定 URL 发送GET方法的请求
|
||||||
|
*
|
||||||
|
* @param url 发送请求的 URL
|
||||||
|
* @return 所代表远程资源的响应结果
|
||||||
|
*/
|
||||||
|
public static String sendGet(String url)
|
||||||
|
{
|
||||||
|
return sendGet(url, StringUtils.EMPTY);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 向指定 URL 发送GET方法的请求
|
* 向指定 URL 发送GET方法的请求
|
||||||
*
|
*
|
||||||
@ -55,7 +67,7 @@ public class HttpUtils
|
|||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
String urlNameString = url + "?" + param;
|
String urlNameString = StringUtils.isNotBlank(param) ? url + "?" + param : url;
|
||||||
log.info("sendGet - {}", urlNameString);
|
log.info("sendGet - {}", urlNameString);
|
||||||
URL realUrl = new URL(urlNameString);
|
URL realUrl = new URL(urlNameString);
|
||||||
URLConnection connection = realUrl.openConnection();
|
URLConnection connection = realUrl.openConnection();
|
||||||
|
|||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.ruoyi.common.utils.poi;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Excel数据格式处理适配器
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public interface ExcelHandlerAdapter
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 格式化
|
||||||
|
*
|
||||||
|
* @param value 单元格数据值
|
||||||
|
* @param args excel注解args参数组
|
||||||
|
*
|
||||||
|
* @return 处理后的值
|
||||||
|
*/
|
||||||
|
Object format(Object value, String[] args);
|
||||||
|
}
|
||||||
@ -6,6 +6,7 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -46,6 +47,7 @@ import org.apache.poi.ss.usermodel.Sheet;
|
|||||||
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
||||||
|
import org.apache.poi.ss.util.CellRangeAddress;
|
||||||
import org.apache.poi.ss.util.CellRangeAddressList;
|
import org.apache.poi.ss.util.CellRangeAddressList;
|
||||||
import org.apache.poi.util.IOUtils;
|
import org.apache.poi.util.IOUtils;
|
||||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||||
@ -124,6 +126,16 @@ public class ExcelUtil<T>
|
|||||||
*/
|
*/
|
||||||
private List<Object[]> fields;
|
private List<Object[]> fields;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前行号
|
||||||
|
*/
|
||||||
|
private int rownum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最大高度
|
* 最大高度
|
||||||
*/
|
*/
|
||||||
@ -149,7 +161,7 @@ public class ExcelUtil<T>
|
|||||||
this.clazz = clazz;
|
this.clazz = clazz;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(List<T> list, String sheetName, Type type)
|
public void init(List<T> list, String sheetName, String title, Type type)
|
||||||
{
|
{
|
||||||
if (list == null)
|
if (list == null)
|
||||||
{
|
{
|
||||||
@ -158,8 +170,27 @@ public class ExcelUtil<T>
|
|||||||
this.list = list;
|
this.list = list;
|
||||||
this.sheetName = sheetName;
|
this.sheetName = sheetName;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
this.title = title;
|
||||||
createExcelField();
|
createExcelField();
|
||||||
createWorkbook();
|
createWorkbook();
|
||||||
|
createTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建excel第一行标题
|
||||||
|
*/
|
||||||
|
public void createTitle()
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotEmpty(title))
|
||||||
|
{
|
||||||
|
Row titleRow = sheet.createRow(rownum == 0 ? rownum++ : 0);
|
||||||
|
titleRow.setHeightInPoints(30);
|
||||||
|
Cell titleCell = titleRow.createCell(0);
|
||||||
|
titleCell.setCellStyle(styles.get("title"));
|
||||||
|
titleCell.setCellValue(title);
|
||||||
|
sheet.addMergedRegion(new CellRangeAddress(titleRow.getRowNum(), titleRow.getRowNum(), titleRow.getRowNum(),
|
||||||
|
this.fields.size() - 1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -170,17 +201,30 @@ public class ExcelUtil<T>
|
|||||||
*/
|
*/
|
||||||
public List<T> importExcel(InputStream is) throws Exception
|
public List<T> importExcel(InputStream is) throws Exception
|
||||||
{
|
{
|
||||||
return importExcel(StringUtils.EMPTY, is);
|
return importExcel(is, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对excel表单默认第一个索引名转换成list
|
||||||
|
*
|
||||||
|
* @param is 输入流
|
||||||
|
* @param titleNum 标题占用行数
|
||||||
|
* @return 转换后集合
|
||||||
|
*/
|
||||||
|
public List<T> importExcel(InputStream is, int titleNum) throws Exception
|
||||||
|
{
|
||||||
|
return importExcel(StringUtils.EMPTY, is, titleNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对excel表单指定表格索引名转换成list
|
* 对excel表单指定表格索引名转换成list
|
||||||
*
|
*
|
||||||
* @param sheetName 表格索引名
|
* @param sheetName 表格索引名
|
||||||
|
* @param titleNum 标题占用行数
|
||||||
* @param is 输入流
|
* @param is 输入流
|
||||||
* @return 转换后集合
|
* @return 转换后集合
|
||||||
*/
|
*/
|
||||||
public List<T> importExcel(String sheetName, InputStream is) throws Exception
|
public List<T> importExcel(String sheetName, InputStream is, int titleNum) throws Exception
|
||||||
{
|
{
|
||||||
this.type = Type.IMPORT;
|
this.type = Type.IMPORT;
|
||||||
this.wb = WorkbookFactory.create(is);
|
this.wb = WorkbookFactory.create(is);
|
||||||
@ -209,7 +253,7 @@ public class ExcelUtil<T>
|
|||||||
// 定义一个map用于存放excel列的序号和field.
|
// 定义一个map用于存放excel列的序号和field.
|
||||||
Map<String, Integer> cellMap = new HashMap<String, Integer>();
|
Map<String, Integer> cellMap = new HashMap<String, Integer>();
|
||||||
// 获取表头
|
// 获取表头
|
||||||
Row heard = sheet.getRow(0);
|
Row heard = sheet.getRow(titleNum);
|
||||||
for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++)
|
for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++)
|
||||||
{
|
{
|
||||||
Cell cell = heard.getCell(i);
|
Cell cell = heard.getCell(i);
|
||||||
@ -224,25 +268,18 @@ public class ExcelUtil<T>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 有数据时才处理 得到类的所有field.
|
// 有数据时才处理 得到类的所有field.
|
||||||
Field[] allFields = clazz.getDeclaredFields();
|
List<Object[]> fields = this.getFields();
|
||||||
// 定义一个map用于存放列的序号和field.
|
Map<Integer, Object[]> fieldsMap = new HashMap<Integer, Object[]>();
|
||||||
Map<Integer, Field> fieldsMap = new HashMap<Integer, Field>();
|
for (Object[] objects : fields)
|
||||||
for (int col = 0; col < allFields.length; col++)
|
|
||||||
{
|
{
|
||||||
Field field = allFields[col];
|
Excel attr = (Excel) objects[1];
|
||||||
Excel attr = field.getAnnotation(Excel.class);
|
|
||||||
if (attr != null && (attr.type() == Type.ALL || attr.type() == type))
|
|
||||||
{
|
|
||||||
// 设置类的私有字段属性可访问.
|
|
||||||
field.setAccessible(true);
|
|
||||||
Integer column = cellMap.get(attr.name());
|
Integer column = cellMap.get(attr.name());
|
||||||
if (column != null)
|
if (column != null)
|
||||||
{
|
{
|
||||||
fieldsMap.put(column, field);
|
fieldsMap.put(column, objects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
for (int i = titleNum + 1; i <= rows; i++)
|
||||||
for (int i = 1; i <= rows; i++)
|
|
||||||
{
|
{
|
||||||
// 从第2行开始取数据,默认第一行是表头.
|
// 从第2行开始取数据,默认第一行是表头.
|
||||||
Row row = sheet.getRow(i);
|
Row row = sheet.getRow(i);
|
||||||
@ -252,14 +289,15 @@ public class ExcelUtil<T>
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
T entity = null;
|
T entity = null;
|
||||||
for (Map.Entry<Integer, Field> entry : fieldsMap.entrySet())
|
for (Map.Entry<Integer, Object[]> entry : fieldsMap.entrySet())
|
||||||
{
|
{
|
||||||
Object val = this.getCellValue(row, entry.getKey());
|
Object val = this.getCellValue(row, entry.getKey());
|
||||||
|
|
||||||
// 如果不存在实例则新建.
|
// 如果不存在实例则新建.
|
||||||
entity = (entity == null ? clazz.newInstance() : entity);
|
entity = (entity == null ? clazz.newInstance() : entity);
|
||||||
// 从map中得到对应列的field.
|
// 从map中得到对应列的field.
|
||||||
Field field = fieldsMap.get(entry.getKey());
|
Field field = (Field) entry.getValue()[0];
|
||||||
|
Excel attr = (Excel) entry.getValue()[1];
|
||||||
// 取得类型,并根据对象类型设置值.
|
// 取得类型,并根据对象类型设置值.
|
||||||
Class<?> fieldType = field.getType();
|
Class<?> fieldType = field.getType();
|
||||||
if (String.class == fieldType)
|
if (String.class == fieldType)
|
||||||
@ -319,7 +357,6 @@ public class ExcelUtil<T>
|
|||||||
}
|
}
|
||||||
if (StringUtils.isNotNull(fieldType))
|
if (StringUtils.isNotNull(fieldType))
|
||||||
{
|
{
|
||||||
Excel attr = field.getAnnotation(Excel.class);
|
|
||||||
String propertyName = field.getName();
|
String propertyName = field.getName();
|
||||||
if (StringUtils.isNotEmpty(attr.targetAttr()))
|
if (StringUtils.isNotEmpty(attr.targetAttr()))
|
||||||
{
|
{
|
||||||
@ -333,6 +370,10 @@ public class ExcelUtil<T>
|
|||||||
{
|
{
|
||||||
val = reverseDictByExp(Convert.toStr(val), attr.dictType(), attr.separator());
|
val = reverseDictByExp(Convert.toStr(val), attr.dictType(), attr.separator());
|
||||||
}
|
}
|
||||||
|
else if (!attr.handler().equals(ExcelHandlerAdapter.class))
|
||||||
|
{
|
||||||
|
val = dataFormatHandlerAdapter(val, attr);
|
||||||
|
}
|
||||||
else if (ColumnType.IMAGE == attr.cellType() && StringUtils.isNotEmpty(pictures))
|
else if (ColumnType.IMAGE == attr.cellType() && StringUtils.isNotEmpty(pictures))
|
||||||
{
|
{
|
||||||
PictureData image = pictures.get(row.getRowNum() + "_" + entry.getKey());
|
PictureData image = pictures.get(row.getRowNum() + "_" + entry.getKey());
|
||||||
@ -340,9 +381,12 @@ public class ExcelUtil<T>
|
|||||||
{
|
{
|
||||||
val = "";
|
val = "";
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
byte[] data = image.getData();
|
byte[] data = image.getData();
|
||||||
val = FileUtils.writeImportBytes(data);
|
val = FileUtils.writeImportBytes(data);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ReflectUtils.invokeSetter(entity, propertyName, val);
|
ReflectUtils.invokeSetter(entity, propertyName, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -361,7 +405,20 @@ public class ExcelUtil<T>
|
|||||||
*/
|
*/
|
||||||
public AjaxResult exportExcel(List<T> list, String sheetName)
|
public AjaxResult exportExcel(List<T> list, String sheetName)
|
||||||
{
|
{
|
||||||
this.init(list, sheetName, Type.EXPORT);
|
return exportExcel(list, sheetName, StringUtils.EMPTY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对list数据源将其里面的数据导入到excel表单
|
||||||
|
*
|
||||||
|
* @param list 导出数据集合
|
||||||
|
* @param sheetName 工作表的名称
|
||||||
|
* @param title 标题
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public AjaxResult exportExcel(List<T> list, String sheetName, String title)
|
||||||
|
{
|
||||||
|
this.init(list, sheetName, title, Type.EXPORT);
|
||||||
return exportExcel();
|
return exportExcel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,12 +431,27 @@ public class ExcelUtil<T>
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void exportExcel(HttpServletResponse response, List<T> list, String sheetName) throws IOException
|
public void exportExcel(HttpServletResponse response, List<T> list, String sheetName)
|
||||||
|
{
|
||||||
|
exportExcel(response, list, sheetName, StringUtils.EMPTY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对list数据源将其里面的数据导入到excel表单
|
||||||
|
*
|
||||||
|
* @param response 返回数据
|
||||||
|
* @param list 导出数据集合
|
||||||
|
* @param sheetName 工作表的名称
|
||||||
|
* @param title 标题
|
||||||
|
* @return 结果
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public void exportExcel(HttpServletResponse response, List<T> list, String sheetName, String title)
|
||||||
{
|
{
|
||||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
response.setCharacterEncoding("utf-8");
|
response.setCharacterEncoding("utf-8");
|
||||||
this.init(list, sheetName, Type.EXPORT);
|
this.init(list, sheetName, title, Type.EXPORT);
|
||||||
exportExcel(response.getOutputStream());
|
exportExcel(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -390,7 +462,19 @@ public class ExcelUtil<T>
|
|||||||
*/
|
*/
|
||||||
public AjaxResult importTemplateExcel(String sheetName)
|
public AjaxResult importTemplateExcel(String sheetName)
|
||||||
{
|
{
|
||||||
this.init(null, sheetName, Type.IMPORT);
|
return importTemplateExcel(sheetName, StringUtils.EMPTY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对list数据源将其里面的数据导入到excel表单
|
||||||
|
*
|
||||||
|
* @param sheetName 工作表的名称
|
||||||
|
* @param title 标题
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public AjaxResult importTemplateExcel(String sheetName, String title)
|
||||||
|
{
|
||||||
|
this.init(null, sheetName, title, Type.IMPORT);
|
||||||
return exportExcel();
|
return exportExcel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,12 +484,24 @@ public class ExcelUtil<T>
|
|||||||
* @param sheetName 工作表的名称
|
* @param sheetName 工作表的名称
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public void importTemplateExcel(HttpServletResponse response, String sheetName) throws IOException
|
public void importTemplateExcel(HttpServletResponse response, String sheetName)
|
||||||
|
{
|
||||||
|
importTemplateExcel(response, sheetName, StringUtils.EMPTY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对list数据源将其里面的数据导入到excel表单
|
||||||
|
*
|
||||||
|
* @param sheetName 工作表的名称
|
||||||
|
* @param title 标题
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public void importTemplateExcel(HttpServletResponse response, String sheetName, String title)
|
||||||
{
|
{
|
||||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
response.setCharacterEncoding("utf-8");
|
response.setCharacterEncoding("utf-8");
|
||||||
this.init(null, sheetName, Type.IMPORT);
|
this.init(null, sheetName, title, Type.IMPORT);
|
||||||
exportExcel(response.getOutputStream());
|
exportExcel(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -413,12 +509,12 @@ public class ExcelUtil<T>
|
|||||||
*
|
*
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public void exportExcel(OutputStream out)
|
public void exportExcel(HttpServletResponse response)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
writeSheet();
|
writeSheet();
|
||||||
wb.write(out);
|
wb.write(response.getOutputStream());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -427,7 +523,6 @@ public class ExcelUtil<T>
|
|||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
IOUtils.closeQuietly(wb);
|
IOUtils.closeQuietly(wb);
|
||||||
IOUtils.closeQuietly(out);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,13 +560,13 @@ public class ExcelUtil<T>
|
|||||||
public void writeSheet()
|
public void writeSheet()
|
||||||
{
|
{
|
||||||
// 取出一共有多少个sheet.
|
// 取出一共有多少个sheet.
|
||||||
double sheetNo = Math.ceil(list.size() / sheetSize);
|
int sheetNo = Math.max(1, (int) Math.ceil(list.size() * 1.0 / sheetSize));
|
||||||
for (int index = 0; index <= sheetNo; index++)
|
for (int index = 0; index < sheetNo; index++)
|
||||||
{
|
{
|
||||||
createSheet(sheetNo, index);
|
createSheet(sheetNo, index);
|
||||||
|
|
||||||
// 产生一行
|
// 产生一行
|
||||||
Row row = sheet.createRow(0);
|
Row row = sheet.createRow(rownum);
|
||||||
int column = 0;
|
int column = 0;
|
||||||
// 写入各个字段的列头名称
|
// 写入各个字段的列头名称
|
||||||
for (Object[] os : fields)
|
for (Object[] os : fields)
|
||||||
@ -499,7 +594,7 @@ public class ExcelUtil<T>
|
|||||||
int endNo = Math.min(startNo + sheetSize, list.size());
|
int endNo = Math.min(startNo + sheetSize, list.size());
|
||||||
for (int i = startNo; i < endNo; i++)
|
for (int i = startNo; i < endNo; i++)
|
||||||
{
|
{
|
||||||
row = sheet.createRow(i + 1 - startNo);
|
row = sheet.createRow(i + 1 + rownum - startNo);
|
||||||
// 得到导出对象.
|
// 得到导出对象.
|
||||||
T vo = (T) list.get(i);
|
T vo = (T) list.get(i);
|
||||||
int column = 0;
|
int column = 0;
|
||||||
@ -507,8 +602,6 @@ public class ExcelUtil<T>
|
|||||||
{
|
{
|
||||||
Field field = (Field) os[0];
|
Field field = (Field) os[0];
|
||||||
Excel excel = (Excel) os[1];
|
Excel excel = (Excel) os[1];
|
||||||
// 设置实体类私有属性可访问
|
|
||||||
field.setAccessible(true);
|
|
||||||
this.addCell(excel, row, vo, field, column++);
|
this.addCell(excel, row, vo, field, column++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -527,6 +620,16 @@ public class ExcelUtil<T>
|
|||||||
CellStyle style = wb.createCellStyle();
|
CellStyle style = wb.createCellStyle();
|
||||||
style.setAlignment(HorizontalAlignment.CENTER);
|
style.setAlignment(HorizontalAlignment.CENTER);
|
||||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||||
|
Font titleFont = wb.createFont();
|
||||||
|
titleFont.setFontName("Arial");
|
||||||
|
titleFont.setFontHeightInPoints((short) 16);
|
||||||
|
titleFont.setBold(true);
|
||||||
|
style.setFont(titleFont);
|
||||||
|
styles.put("title", style);
|
||||||
|
|
||||||
|
style = wb.createCellStyle();
|
||||||
|
style.setAlignment(HorizontalAlignment.CENTER);
|
||||||
|
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||||
style.setBorderRight(BorderStyle.THIN);
|
style.setBorderRight(BorderStyle.THIN);
|
||||||
style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
|
style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
|
||||||
style.setBorderLeft(BorderStyle.THIN);
|
style.setBorderLeft(BorderStyle.THIN);
|
||||||
@ -726,6 +829,10 @@ public class ExcelUtil<T>
|
|||||||
{
|
{
|
||||||
cell.setCellValue((((BigDecimal) value).setScale(attr.scale(), attr.roundingMode())).toString());
|
cell.setCellValue((((BigDecimal) value).setScale(attr.scale(), attr.roundingMode())).toString());
|
||||||
}
|
}
|
||||||
|
else if (!attr.handler().equals(ExcelHandlerAdapter.class))
|
||||||
|
{
|
||||||
|
cell.setCellValue(dataFormatHandlerAdapter(value, attr));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 设置列类型
|
// 设置列类型
|
||||||
@ -898,6 +1005,28 @@ public class ExcelUtil<T>
|
|||||||
return DictUtils.getDictValue(dictType, dictLabel, separator);
|
return DictUtils.getDictValue(dictType, dictLabel, separator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据处理器
|
||||||
|
*
|
||||||
|
* @param value 数据值
|
||||||
|
* @param excel 数据注解
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String dataFormatHandlerAdapter(Object value, Excel excel)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Object instance = excel.handler().newInstance();
|
||||||
|
Method formatMethod = excel.handler().getMethod("format", new Class[] { Object.class, String[].class });
|
||||||
|
value = formatMethod.invoke(instance, value, excel.args());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.error("不能格式化数据 " + excel.handler(), e.getMessage());
|
||||||
|
}
|
||||||
|
return Convert.toStr(value);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 合计统计信息
|
* 合计统计信息
|
||||||
*/
|
*/
|
||||||
@ -1025,7 +1154,17 @@ public class ExcelUtil<T>
|
|||||||
*/
|
*/
|
||||||
private void createExcelField()
|
private void createExcelField()
|
||||||
{
|
{
|
||||||
this.fields = new ArrayList<Object[]>();
|
this.fields = getFields();
|
||||||
|
this.fields = this.fields.stream().sorted(Comparator.comparing(objects -> ((Excel) objects[1]).sort())).collect(Collectors.toList());
|
||||||
|
this.maxHeight = getRowHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字段注解信息
|
||||||
|
*/
|
||||||
|
public List<Object[]> getFields()
|
||||||
|
{
|
||||||
|
List<Object[]> fields = new ArrayList<Object[]>();
|
||||||
List<Field> tempFields = new ArrayList<>();
|
List<Field> tempFields = new ArrayList<>();
|
||||||
tempFields.addAll(Arrays.asList(clazz.getSuperclass().getDeclaredFields()));
|
tempFields.addAll(Arrays.asList(clazz.getSuperclass().getDeclaredFields()));
|
||||||
tempFields.addAll(Arrays.asList(clazz.getDeclaredFields()));
|
tempFields.addAll(Arrays.asList(clazz.getDeclaredFields()));
|
||||||
@ -1034,7 +1173,12 @@ public class ExcelUtil<T>
|
|||||||
// 单注解
|
// 单注解
|
||||||
if (field.isAnnotationPresent(Excel.class))
|
if (field.isAnnotationPresent(Excel.class))
|
||||||
{
|
{
|
||||||
putToField(field, field.getAnnotation(Excel.class));
|
Excel attr = field.getAnnotation(Excel.class);
|
||||||
|
if (attr != null && (attr.type() == Type.ALL || attr.type() == type))
|
||||||
|
{
|
||||||
|
field.setAccessible(true);
|
||||||
|
fields.add(new Object[] { field, attr });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 多注解
|
// 多注解
|
||||||
@ -1042,14 +1186,17 @@ public class ExcelUtil<T>
|
|||||||
{
|
{
|
||||||
Excels attrs = field.getAnnotation(Excels.class);
|
Excels attrs = field.getAnnotation(Excels.class);
|
||||||
Excel[] excels = attrs.value();
|
Excel[] excels = attrs.value();
|
||||||
for (Excel excel : excels)
|
for (Excel attr : excels)
|
||||||
{
|
{
|
||||||
putToField(field, excel);
|
if (attr != null && (attr.type() == Type.ALL || attr.type() == type))
|
||||||
|
{
|
||||||
|
field.setAccessible(true);
|
||||||
|
fields.add(new Object[] { field, attr });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.fields = this.fields.stream().sorted(Comparator.comparing(objects -> ((Excel) objects[1]).sort())).collect(Collectors.toList());
|
}
|
||||||
this.maxHeight = getRowHeight();
|
return fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1066,23 +1213,15 @@ public class ExcelUtil<T>
|
|||||||
return (short) (maxHeight * 20);
|
return (short) (maxHeight * 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 放到字段集合中
|
|
||||||
*/
|
|
||||||
private void putToField(Field field, Excel attr)
|
|
||||||
{
|
|
||||||
if (attr != null && (attr.type() == Type.ALL || attr.type() == type))
|
|
||||||
{
|
|
||||||
this.fields.add(new Object[] { field, attr });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建一个工作簿
|
* 创建一个工作簿
|
||||||
*/
|
*/
|
||||||
public void createWorkbook()
|
public void createWorkbook()
|
||||||
{
|
{
|
||||||
this.wb = new SXSSFWorkbook(500);
|
this.wb = new SXSSFWorkbook(500);
|
||||||
|
this.sheet = wb.createSheet();
|
||||||
|
wb.setSheetName(0, sheetName);
|
||||||
|
this.styles = createStyles(wb);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1091,17 +1230,13 @@ public class ExcelUtil<T>
|
|||||||
* @param sheetNo sheet数量
|
* @param sheetNo sheet数量
|
||||||
* @param index 序号
|
* @param index 序号
|
||||||
*/
|
*/
|
||||||
public void createSheet(double sheetNo, int index)
|
public void createSheet(int sheetNo, int index)
|
||||||
|
{
|
||||||
|
// 设置工作表的名称.
|
||||||
|
if (sheetNo > 1 && index > 0)
|
||||||
{
|
{
|
||||||
this.sheet = wb.createSheet();
|
this.sheet = wb.createSheet();
|
||||||
this.styles = createStyles(wb);
|
this.createTitle();
|
||||||
// 设置工作表的名称.
|
|
||||||
if (sheetNo == 0)
|
|
||||||
{
|
|
||||||
wb.setSheetName(index, sheetName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wb.setSheetName(index, sheetName + index);
|
wb.setSheetName(index, sheetName + index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -343,25 +343,25 @@ public final class UUID implements java.io.Serializable, Comparable<UUID>
|
|||||||
final StringBuilder builder = new StringBuilder(isSimple ? 32 : 36);
|
final StringBuilder builder = new StringBuilder(isSimple ? 32 : 36);
|
||||||
// time_low
|
// time_low
|
||||||
builder.append(digits(mostSigBits >> 32, 8));
|
builder.append(digits(mostSigBits >> 32, 8));
|
||||||
if (false == isSimple)
|
if (!isSimple)
|
||||||
{
|
{
|
||||||
builder.append('-');
|
builder.append('-');
|
||||||
}
|
}
|
||||||
// time_mid
|
// time_mid
|
||||||
builder.append(digits(mostSigBits >> 16, 4));
|
builder.append(digits(mostSigBits >> 16, 4));
|
||||||
if (false == isSimple)
|
if (!isSimple)
|
||||||
{
|
{
|
||||||
builder.append('-');
|
builder.append('-');
|
||||||
}
|
}
|
||||||
// time_high_and_version
|
// time_high_and_version
|
||||||
builder.append(digits(mostSigBits, 4));
|
builder.append(digits(mostSigBits, 4));
|
||||||
if (false == isSimple)
|
if (!isSimple)
|
||||||
{
|
{
|
||||||
builder.append('-');
|
builder.append('-');
|
||||||
}
|
}
|
||||||
// variant_and_sequence
|
// variant_and_sequence
|
||||||
builder.append(digits(leastSigBits >> 48, 4));
|
builder.append(digits(leastSigBits >> 48, 4));
|
||||||
if (false == isSimple)
|
if (!isSimple)
|
||||||
{
|
{
|
||||||
builder.append('-');
|
builder.append('-');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>3.7.0</version>
|
<version>3.8.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,8 @@
|
|||||||
package com.ruoyi.framework.aspectj;
|
package com.ruoyi.framework.aspectj;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import org.aspectj.lang.JoinPoint;
|
import org.aspectj.lang.JoinPoint;
|
||||||
import org.aspectj.lang.Signature;
|
|
||||||
import org.aspectj.lang.annotation.Aspect;
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
import org.aspectj.lang.annotation.Before;
|
import org.aspectj.lang.annotation.Before;
|
||||||
import org.aspectj.lang.annotation.Pointcut;
|
|
||||||
import org.aspectj.lang.reflect.MethodSignature;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import com.ruoyi.common.annotation.DataScope;
|
import com.ruoyi.common.annotation.DataScope;
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
@ -55,27 +51,15 @@ public class DataScopeAspect
|
|||||||
*/
|
*/
|
||||||
public static final String DATA_SCOPE = "dataScope";
|
public static final String DATA_SCOPE = "dataScope";
|
||||||
|
|
||||||
// 配置织入点
|
@Before("@annotation(controllerDataScope)")
|
||||||
@Pointcut("@annotation(com.ruoyi.common.annotation.DataScope)")
|
public void doBefore(JoinPoint point, DataScope controllerDataScope) throws Throwable
|
||||||
public void dataScopePointCut()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before("dataScopePointCut()")
|
|
||||||
public void doBefore(JoinPoint point) throws Throwable
|
|
||||||
{
|
{
|
||||||
clearDataScope(point);
|
clearDataScope(point);
|
||||||
handleDataScope(point);
|
handleDataScope(point, controllerDataScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handleDataScope(final JoinPoint joinPoint)
|
protected void handleDataScope(final JoinPoint joinPoint, DataScope controllerDataScope)
|
||||||
{
|
{
|
||||||
// 获得注解
|
|
||||||
DataScope controllerDataScope = getAnnotationLog(joinPoint);
|
|
||||||
if (controllerDataScope == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 获取当前的用户
|
// 获取当前的用户
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
if (StringUtils.isNotNull(loginUser))
|
if (StringUtils.isNotNull(loginUser))
|
||||||
@ -150,22 +134,6 @@ public class DataScopeAspect
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否存在注解,如果存在就获取
|
|
||||||
*/
|
|
||||||
private DataScope getAnnotationLog(JoinPoint joinPoint)
|
|
||||||
{
|
|
||||||
Signature signature = joinPoint.getSignature();
|
|
||||||
MethodSignature methodSignature = (MethodSignature) signature;
|
|
||||||
Method method = methodSignature.getMethod();
|
|
||||||
|
|
||||||
if (method != null)
|
|
||||||
{
|
|
||||||
return method.getAnnotation(DataScope.class);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼接权限sql前先清空params.dataScope参数防止注入
|
* 拼接权限sql前先清空params.dataScope参数防止注入
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,18 +1,13 @@
|
|||||||
package com.ruoyi.framework.aspectj;
|
package com.ruoyi.framework.aspectj;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.aspectj.lang.JoinPoint;
|
import org.aspectj.lang.JoinPoint;
|
||||||
import org.aspectj.lang.Signature;
|
|
||||||
import org.aspectj.lang.annotation.AfterReturning;
|
import org.aspectj.lang.annotation.AfterReturning;
|
||||||
import org.aspectj.lang.annotation.AfterThrowing;
|
import org.aspectj.lang.annotation.AfterThrowing;
|
||||||
import org.aspectj.lang.annotation.Aspect;
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
import org.aspectj.lang.annotation.Pointcut;
|
|
||||||
import org.aspectj.lang.reflect.MethodSignature;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@ -43,21 +38,15 @@ public class LogAspect
|
|||||||
{
|
{
|
||||||
private static final Logger log = LoggerFactory.getLogger(LogAspect.class);
|
private static final Logger log = LoggerFactory.getLogger(LogAspect.class);
|
||||||
|
|
||||||
// 配置织入点
|
|
||||||
@Pointcut("@annotation(com.ruoyi.common.annotation.Log)")
|
|
||||||
public void logPointCut()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理完请求后执行
|
* 处理完请求后执行
|
||||||
*
|
*
|
||||||
* @param joinPoint 切点
|
* @param joinPoint 切点
|
||||||
*/
|
*/
|
||||||
@AfterReturning(pointcut = "logPointCut()", returning = "jsonResult")
|
@AfterReturning(pointcut = "@annotation(controllerLog)", returning = "jsonResult")
|
||||||
public void doAfterReturning(JoinPoint joinPoint, Object jsonResult)
|
public void doAfterReturning(JoinPoint joinPoint, Log controllerLog, Object jsonResult)
|
||||||
{
|
{
|
||||||
handleLog(joinPoint, null, jsonResult);
|
handleLog(joinPoint, controllerLog, null, jsonResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -66,22 +55,16 @@ public class LogAspect
|
|||||||
* @param joinPoint 切点
|
* @param joinPoint 切点
|
||||||
* @param e 异常
|
* @param e 异常
|
||||||
*/
|
*/
|
||||||
@AfterThrowing(value = "logPointCut()", throwing = "e")
|
@AfterThrowing(value = "@annotation(controllerLog)", throwing = "e")
|
||||||
public void doAfterThrowing(JoinPoint joinPoint, Exception e)
|
public void doAfterThrowing(JoinPoint joinPoint, Log controllerLog, Exception e)
|
||||||
{
|
{
|
||||||
handleLog(joinPoint, e, null);
|
handleLog(joinPoint, controllerLog, e, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handleLog(final JoinPoint joinPoint, final Exception e, Object jsonResult)
|
protected void handleLog(final JoinPoint joinPoint, Log controllerLog, final Exception e, Object jsonResult)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 获得注解
|
|
||||||
Log controllerLog = getAnnotationLog(joinPoint);
|
|
||||||
if (controllerLog == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取当前的用户
|
// 获取当前的用户
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
@ -92,9 +75,6 @@ public class LogAspect
|
|||||||
// 请求的地址
|
// 请求的地址
|
||||||
String ip = IpUtils.getIpAddr(ServletUtils.getRequest());
|
String ip = IpUtils.getIpAddr(ServletUtils.getRequest());
|
||||||
operLog.setOperIp(ip);
|
operLog.setOperIp(ip);
|
||||||
// 返回参数
|
|
||||||
operLog.setJsonResult(JSON.toJSONString(jsonResult));
|
|
||||||
|
|
||||||
operLog.setOperUrl(ServletUtils.getRequest().getRequestURI());
|
operLog.setOperUrl(ServletUtils.getRequest().getRequestURI());
|
||||||
if (loginUser != null)
|
if (loginUser != null)
|
||||||
{
|
{
|
||||||
@ -113,7 +93,7 @@ public class LogAspect
|
|||||||
// 设置请求方式
|
// 设置请求方式
|
||||||
operLog.setRequestMethod(ServletUtils.getRequest().getMethod());
|
operLog.setRequestMethod(ServletUtils.getRequest().getMethod());
|
||||||
// 处理设置注解上的参数
|
// 处理设置注解上的参数
|
||||||
getControllerMethodDescription(joinPoint, controllerLog, operLog);
|
getControllerMethodDescription(joinPoint, controllerLog, operLog, jsonResult);
|
||||||
// 保存数据库
|
// 保存数据库
|
||||||
AsyncManager.me().execute(AsyncFactory.recordOper(operLog));
|
AsyncManager.me().execute(AsyncFactory.recordOper(operLog));
|
||||||
}
|
}
|
||||||
@ -133,7 +113,7 @@ public class LogAspect
|
|||||||
* @param operLog 操作日志
|
* @param operLog 操作日志
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public void getControllerMethodDescription(JoinPoint joinPoint, Log log, SysOperLog operLog) throws Exception
|
public void getControllerMethodDescription(JoinPoint joinPoint, Log log, SysOperLog operLog, Object jsonResult) throws Exception
|
||||||
{
|
{
|
||||||
// 设置action动作
|
// 设置action动作
|
||||||
operLog.setBusinessType(log.businessType().ordinal());
|
operLog.setBusinessType(log.businessType().ordinal());
|
||||||
@ -147,6 +127,11 @@ public class LogAspect
|
|||||||
// 获取参数的信息,传入到数据库中。
|
// 获取参数的信息,传入到数据库中。
|
||||||
setRequestValue(joinPoint, operLog);
|
setRequestValue(joinPoint, operLog);
|
||||||
}
|
}
|
||||||
|
// 是否需要保存response,参数和值
|
||||||
|
if (log.isSaveResponseData() && StringUtils.isNotNull(jsonResult))
|
||||||
|
{
|
||||||
|
operLog.setJsonResult(StringUtils.substring(JSON.toJSONString(jsonResult), 0, 2000));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -170,22 +155,6 @@ public class LogAspect
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否存在注解,如果存在就获取
|
|
||||||
*/
|
|
||||||
private Log getAnnotationLog(JoinPoint joinPoint) throws Exception
|
|
||||||
{
|
|
||||||
Signature signature = joinPoint.getSignature();
|
|
||||||
MethodSignature methodSignature = (MethodSignature) signature;
|
|
||||||
Method method = methodSignature.getMethod();
|
|
||||||
|
|
||||||
if (method != null)
|
|
||||||
{
|
|
||||||
return method.getAnnotation(Log.class);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 参数拼装
|
* 参数拼装
|
||||||
*/
|
*/
|
||||||
@ -194,13 +163,19 @@ public class LogAspect
|
|||||||
String params = "";
|
String params = "";
|
||||||
if (paramsArray != null && paramsArray.length > 0)
|
if (paramsArray != null && paramsArray.length > 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < paramsArray.length; i++)
|
for (Object o : paramsArray)
|
||||||
{
|
{
|
||||||
if (StringUtils.isNotNull(paramsArray[i]) && !isFilterObject(paramsArray[i]))
|
if (StringUtils.isNotNull(o) && !isFilterObject(o))
|
||||||
{
|
{
|
||||||
Object jsonObj = JSON.toJSON(paramsArray[i]);
|
try
|
||||||
|
{
|
||||||
|
Object jsonObj = JSON.toJSON(o);
|
||||||
params += jsonObj.toString() + " ";
|
params += jsonObj.toString() + " ";
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return params.trim();
|
return params.trim();
|
||||||
@ -223,17 +198,17 @@ public class LogAspect
|
|||||||
else if (Collection.class.isAssignableFrom(clazz))
|
else if (Collection.class.isAssignableFrom(clazz))
|
||||||
{
|
{
|
||||||
Collection collection = (Collection) o;
|
Collection collection = (Collection) o;
|
||||||
for (Iterator iter = collection.iterator(); iter.hasNext();)
|
for (Object value : collection)
|
||||||
{
|
{
|
||||||
return iter.next() instanceof MultipartFile;
|
return value instanceof MultipartFile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Map.class.isAssignableFrom(clazz))
|
else if (Map.class.isAssignableFrom(clazz))
|
||||||
{
|
{
|
||||||
Map map = (Map) o;
|
Map map = (Map) o;
|
||||||
for (Iterator iter = map.entrySet().iterator(); iter.hasNext();)
|
for (Object value : map.entrySet())
|
||||||
{
|
{
|
||||||
Map.Entry entry = (Map.Entry) iter.next();
|
Map.Entry entry = (Map.Entry) value;
|
||||||
return entry.getValue() instanceof MultipartFile;
|
return entry.getValue() instanceof MultipartFile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,10 +4,8 @@ import java.lang.reflect.Method;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.aspectj.lang.JoinPoint;
|
import org.aspectj.lang.JoinPoint;
|
||||||
import org.aspectj.lang.Signature;
|
|
||||||
import org.aspectj.lang.annotation.Aspect;
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
import org.aspectj.lang.annotation.Before;
|
import org.aspectj.lang.annotation.Before;
|
||||||
import org.aspectj.lang.annotation.Pointcut;
|
|
||||||
import org.aspectj.lang.reflect.MethodSignature;
|
import org.aspectj.lang.reflect.MethodSignature;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -49,16 +47,9 @@ public class RateLimiterAspect
|
|||||||
this.limitScript = limitScript;
|
this.limitScript = limitScript;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 配置织入点
|
@Before("@annotation(rateLimiter)")
|
||||||
@Pointcut("@annotation(com.ruoyi.common.annotation.RateLimiter)")
|
public void doBefore(JoinPoint point, RateLimiter rateLimiter) throws Throwable
|
||||||
public void rateLimiterPointCut()
|
|
||||||
{
|
{
|
||||||
}
|
|
||||||
|
|
||||||
@Before("rateLimiterPointCut()")
|
|
||||||
public void doBefore(JoinPoint point) throws Throwable
|
|
||||||
{
|
|
||||||
RateLimiter rateLimiter = getAnnotationRateLimiter(point);
|
|
||||||
String key = rateLimiter.key();
|
String key = rateLimiter.key();
|
||||||
int time = rateLimiter.time();
|
int time = rateLimiter.time();
|
||||||
int count = rateLimiter.count();
|
int count = rateLimiter.count();
|
||||||
@ -70,7 +61,7 @@ public class RateLimiterAspect
|
|||||||
Long number = redisTemplate.execute(limitScript, keys, count, time);
|
Long number = redisTemplate.execute(limitScript, keys, count, time);
|
||||||
if (StringUtils.isNull(number) || number.intValue() > count)
|
if (StringUtils.isNull(number) || number.intValue() > count)
|
||||||
{
|
{
|
||||||
throw new ServiceException("访问过于频繁,请稍后再试");
|
throw new ServiceException("访问过于频繁,请稍候再试");
|
||||||
}
|
}
|
||||||
log.info("限制请求'{}',当前请求'{}',缓存key'{}'", count, number.intValue(), key);
|
log.info("限制请求'{}',当前请求'{}',缓存key'{}'", count, number.intValue(), key);
|
||||||
}
|
}
|
||||||
@ -80,37 +71,21 @@ public class RateLimiterAspect
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new RuntimeException("服务器限流异常,请稍后再试");
|
throw new RuntimeException("服务器限流异常,请稍候再试");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否存在注解,如果存在就获取
|
|
||||||
*/
|
|
||||||
private RateLimiter getAnnotationRateLimiter(JoinPoint joinPoint)
|
|
||||||
{
|
|
||||||
Signature signature = joinPoint.getSignature();
|
|
||||||
MethodSignature methodSignature = (MethodSignature) signature;
|
|
||||||
Method method = methodSignature.getMethod();
|
|
||||||
|
|
||||||
if (method != null)
|
|
||||||
{
|
|
||||||
return method.getAnnotation(RateLimiter.class);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCombineKey(RateLimiter rateLimiter, JoinPoint point)
|
public String getCombineKey(RateLimiter rateLimiter, JoinPoint point)
|
||||||
{
|
{
|
||||||
StringBuffer stringBuffer = new StringBuffer(rateLimiter.key());
|
StringBuffer stringBuffer = new StringBuffer(rateLimiter.key());
|
||||||
if (rateLimiter.limitType() == LimitType.IP)
|
if (rateLimiter.limitType() == LimitType.IP)
|
||||||
{
|
{
|
||||||
stringBuffer.append(IpUtils.getIpAddr(ServletUtils.getRequest()));
|
stringBuffer.append(IpUtils.getIpAddr(ServletUtils.getRequest())).append("-");
|
||||||
}
|
}
|
||||||
MethodSignature signature = (MethodSignature) point.getSignature();
|
MethodSignature signature = (MethodSignature) point.getSignature();
|
||||||
Method method = signature.getMethod();
|
Method method = signature.getMethod();
|
||||||
Class<?> targetClass = method.getDeclaringClass();
|
Class<?> targetClass = method.getDeclaringClass();
|
||||||
stringBuffer.append("-").append(targetClass.getName()).append("- ").append(method.getName());
|
stringBuffer.append(targetClass.getName()).append("-").append(method.getName());
|
||||||
return stringBuffer.toString();
|
return stringBuffer.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,6 @@ import com.ruoyi.common.utils.StringUtils;
|
|||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnProperty(value = "xss.enabled", havingValue = "true")
|
|
||||||
public class FilterConfig
|
public class FilterConfig
|
||||||
{
|
{
|
||||||
@Value("${xss.excludes}")
|
@Value("${xss.excludes}")
|
||||||
@ -29,6 +28,7 @@ public class FilterConfig
|
|||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
@Bean
|
@Bean
|
||||||
|
@ConditionalOnProperty(value = "xss.enabled", havingValue = "true")
|
||||||
public FilterRegistrationBean xssFilterRegistration()
|
public FilterRegistrationBean xssFilterRegistration()
|
||||||
{
|
{
|
||||||
FilterRegistrationBean registration = new FilterRegistrationBean();
|
FilterRegistrationBean registration = new FilterRegistrationBean();
|
||||||
|
|||||||
@ -68,12 +68,12 @@ public class RedisConfig extends CachingConfigurerSupport
|
|||||||
"local time = tonumber(ARGV[2])\n" +
|
"local time = tonumber(ARGV[2])\n" +
|
||||||
"local current = redis.call('get', key);\n" +
|
"local current = redis.call('get', key);\n" +
|
||||||
"if current and tonumber(current) > count then\n" +
|
"if current and tonumber(current) > count then\n" +
|
||||||
" return current;\n" +
|
" return tonumber(current);\n" +
|
||||||
"end\n" +
|
"end\n" +
|
||||||
"current = redis.call('incr', key)\n" +
|
"current = redis.call('incr', key)\n" +
|
||||||
"if tonumber(current) == 1 then\n" +
|
"if tonumber(current) == 1 then\n" +
|
||||||
" redis.call('expire', key, time)\n" +
|
" redis.call('expire', key, time)\n" +
|
||||||
"end\n" +
|
"end\n" +
|
||||||
"return current;";
|
"return tonumber(current);";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,10 +28,12 @@ public class ResourcesConfig implements WebMvcConfigurer
|
|||||||
public void addResourceHandlers(ResourceHandlerRegistry registry)
|
public void addResourceHandlers(ResourceHandlerRegistry registry)
|
||||||
{
|
{
|
||||||
/** 本地文件上传路径 */
|
/** 本地文件上传路径 */
|
||||||
registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**").addResourceLocations("file:" + RuoYiConfig.getProfile() + "/");
|
registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**")
|
||||||
|
.addResourceLocations("file:" + RuoYiConfig.getProfile() + "/");
|
||||||
|
|
||||||
/** swagger配置 */
|
/** swagger配置 */
|
||||||
registry.addResourceHandler("/swagger-ui/**").addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/");
|
registry.addResourceHandler("/swagger-ui/**")
|
||||||
|
.addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,17 +51,20 @@ public class ResourcesConfig implements WebMvcConfigurer
|
|||||||
@Bean
|
@Bean
|
||||||
public CorsFilter corsFilter()
|
public CorsFilter corsFilter()
|
||||||
{
|
{
|
||||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
|
||||||
CorsConfiguration config = new CorsConfiguration();
|
CorsConfiguration config = new CorsConfiguration();
|
||||||
config.setAllowCredentials(true);
|
config.setAllowCredentials(true);
|
||||||
// 设置访问源地址
|
// 设置访问源地址
|
||||||
config.addAllowedOrigin("*");
|
config.addAllowedOriginPattern("*");
|
||||||
// 设置访问源请求头
|
// 设置访问源请求头
|
||||||
config.addAllowedHeader("*");
|
config.addAllowedHeader("*");
|
||||||
// 设置访问源请求方法
|
// 设置访问源请求方法
|
||||||
config.addAllowedMethod("*");
|
config.addAllowedMethod("*");
|
||||||
// 对接口配置跨域设置
|
// 有效期 1800秒
|
||||||
|
config.setMaxAge(1800L);
|
||||||
|
// 添加映射路径,拦截一切请求
|
||||||
|
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||||
source.registerCorsConfiguration("/**", config);
|
source.registerCorsConfiguration("/**", config);
|
||||||
|
// 返回新的CorsFilter
|
||||||
return new CorsFilter(source);
|
return new CorsFilter(source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,8 +107,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
|
|||||||
"/**/*.js",
|
"/**/*.js",
|
||||||
"/profile/**"
|
"/profile/**"
|
||||||
).permitAll()
|
).permitAll()
|
||||||
.antMatchers("/common/download**").anonymous()
|
|
||||||
.antMatchers("/common/download/resource**").anonymous()
|
|
||||||
.antMatchers("/swagger-ui.html").anonymous()
|
.antMatchers("/swagger-ui.html").anonymous()
|
||||||
.antMatchers("/swagger-resources/**").anonymous()
|
.antMatchers("/swagger-resources/**").anonymous()
|
||||||
.antMatchers("/webjars/**").anonymous()
|
.antMatchers("/webjars/**").anonymous()
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.method.HandlerMethod;
|
import org.springframework.web.method.HandlerMethod;
|
||||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
@ -17,7 +17,7 @@ import com.ruoyi.common.utils.ServletUtils;
|
|||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public abstract class RepeatSubmitInterceptor extends HandlerInterceptorAdapter
|
public abstract class RepeatSubmitInterceptor implements HandlerInterceptor
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception
|
||||||
@ -29,9 +29,9 @@ public abstract class RepeatSubmitInterceptor extends HandlerInterceptorAdapter
|
|||||||
RepeatSubmit annotation = method.getAnnotation(RepeatSubmit.class);
|
RepeatSubmit annotation = method.getAnnotation(RepeatSubmit.class);
|
||||||
if (annotation != null)
|
if (annotation != null)
|
||||||
{
|
{
|
||||||
if (this.isRepeatSubmit(request))
|
if (this.isRepeatSubmit(request, annotation))
|
||||||
{
|
{
|
||||||
AjaxResult ajaxResult = AjaxResult.error("不允许重复提交,请稍后再试");
|
AjaxResult ajaxResult = AjaxResult.error(annotation.message());
|
||||||
ServletUtils.renderString(response, JSONObject.toJSONString(ajaxResult));
|
ServletUtils.renderString(response, JSONObject.toJSONString(ajaxResult));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -40,7 +40,7 @@ public abstract class RepeatSubmitInterceptor extends HandlerInterceptorAdapter
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return super.preHandle(request, response, handler);
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,5 +51,5 @@ public abstract class RepeatSubmitInterceptor extends HandlerInterceptorAdapter
|
|||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public abstract boolean isRepeatSubmit(HttpServletRequest request);
|
public abstract boolean isRepeatSubmit(HttpServletRequest request, RepeatSubmit annotation);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||||
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.constant.Constants;
|
||||||
import com.ruoyi.common.core.redis.RedisCache;
|
import com.ruoyi.common.core.redis.RedisCache;
|
||||||
import com.ruoyi.common.filter.RepeatedlyRequestWrapper;
|
import com.ruoyi.common.filter.RepeatedlyRequestWrapper;
|
||||||
@ -35,21 +36,9 @@ public class SameUrlDataInterceptor extends RepeatSubmitInterceptor
|
|||||||
@Autowired
|
@Autowired
|
||||||
private RedisCache redisCache;
|
private RedisCache redisCache;
|
||||||
|
|
||||||
/**
|
|
||||||
* 间隔时间,单位:秒 默认10秒
|
|
||||||
*
|
|
||||||
* 两次相同参数的请求,如果间隔时间大于该参数,系统不会认定为重复提交的数据
|
|
||||||
*/
|
|
||||||
private int intervalTime = 10;
|
|
||||||
|
|
||||||
public void setIntervalTime(int intervalTime)
|
|
||||||
{
|
|
||||||
this.intervalTime = intervalTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public boolean isRepeatSubmit(HttpServletRequest request)
|
public boolean isRepeatSubmit(HttpServletRequest request, RepeatSubmit annotation)
|
||||||
{
|
{
|
||||||
String nowParams = "";
|
String nowParams = "";
|
||||||
if (request instanceof RepeatedlyRequestWrapper)
|
if (request instanceof RepeatedlyRequestWrapper)
|
||||||
@ -87,7 +76,7 @@ public class SameUrlDataInterceptor extends RepeatSubmitInterceptor
|
|||||||
if (sessionMap.containsKey(url))
|
if (sessionMap.containsKey(url))
|
||||||
{
|
{
|
||||||
Map<String, Object> preDataMap = (Map<String, Object>) sessionMap.get(url);
|
Map<String, Object> preDataMap = (Map<String, Object>) sessionMap.get(url);
|
||||||
if (compareParams(nowDataMap, preDataMap) && compareTime(nowDataMap, preDataMap))
|
if (compareParams(nowDataMap, preDataMap) && compareTime(nowDataMap, preDataMap, annotation.interval()))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -95,7 +84,7 @@ public class SameUrlDataInterceptor extends RepeatSubmitInterceptor
|
|||||||
}
|
}
|
||||||
Map<String, Object> cacheMap = new HashMap<String, Object>();
|
Map<String, Object> cacheMap = new HashMap<String, Object>();
|
||||||
cacheMap.put(url, nowDataMap);
|
cacheMap.put(url, nowDataMap);
|
||||||
redisCache.setCacheObject(cacheRepeatKey, cacheMap, intervalTime, TimeUnit.SECONDS);
|
redisCache.setCacheObject(cacheRepeatKey, cacheMap, annotation.interval(), TimeUnit.MILLISECONDS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,11 +101,11 @@ public class SameUrlDataInterceptor extends RepeatSubmitInterceptor
|
|||||||
/**
|
/**
|
||||||
* 判断两次间隔时间
|
* 判断两次间隔时间
|
||||||
*/
|
*/
|
||||||
private boolean compareTime(Map<String, Object> nowMap, Map<String, Object> preMap)
|
private boolean compareTime(Map<String, Object> nowMap, Map<String, Object> preMap, int interval)
|
||||||
{
|
{
|
||||||
long time1 = (Long) nowMap.get(REPEAT_TIME);
|
long time1 = (Long) nowMap.get(REPEAT_TIME);
|
||||||
long time2 = (Long) preMap.get(REPEAT_TIME);
|
long time2 = (Long) preMap.get(REPEAT_TIME);
|
||||||
if ((time1 - time2) < (this.intervalTime * 1000))
|
if ((time1 - time2) < interval)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -87,7 +87,7 @@ public class SysLoginService
|
|||||||
}
|
}
|
||||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
|
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
|
||||||
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
|
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
|
||||||
recordLoginInfo(loginUser.getUser());
|
recordLoginInfo(loginUser.getUserId());
|
||||||
// 生成token
|
// 生成token
|
||||||
return tokenService.createToken(loginUser);
|
return tokenService.createToken(loginUser);
|
||||||
}
|
}
|
||||||
@ -119,11 +119,15 @@ public class SysLoginService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 记录登录信息
|
* 记录登录信息
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
*/
|
*/
|
||||||
public void recordLoginInfo(SysUser user)
|
public void recordLoginInfo(Long userId)
|
||||||
{
|
{
|
||||||
user.setLoginIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
|
SysUser sysUser = new SysUser();
|
||||||
user.setLoginDate(DateUtils.getNowDate());
|
sysUser.setUserId(userId);
|
||||||
userService.updateUserProfile(user);
|
sysUser.setLoginIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
|
||||||
|
sysUser.setLoginDate(DateUtils.getNowDate());
|
||||||
|
userService.updateUserProfile(sysUser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package com.ruoyi.framework.web.service;
|
|||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.constant.Constants;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
@ -12,6 +11,7 @@ import com.ruoyi.common.exception.user.CaptchaException;
|
|||||||
import com.ruoyi.common.exception.user.CaptchaExpireException;
|
import com.ruoyi.common.exception.user.CaptchaExpireException;
|
||||||
import com.ruoyi.common.utils.MessageUtils;
|
import com.ruoyi.common.utils.MessageUtils;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.framework.manager.AsyncManager;
|
import com.ruoyi.framework.manager.AsyncManager;
|
||||||
import com.ruoyi.framework.manager.factory.AsyncFactory;
|
import com.ruoyi.framework.manager.factory.AsyncFactory;
|
||||||
import com.ruoyi.system.service.ISysConfigService;
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>3.7.0</version>
|
<version>3.8.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
@ -20,7 +20,7 @@
|
|||||||
<!--velocity代码生成使用模板 -->
|
<!--velocity代码生成使用模板 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.velocity</groupId>
|
<groupId>org.apache.velocity</groupId>
|
||||||
<artifactId>velocity</artifactId>
|
<artifactId>velocity-engine-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- collections工具类 -->
|
<!-- collections工具类 -->
|
||||||
|
|||||||
@ -20,10 +20,9 @@ public class VelocityInitializer
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 加载classpath目录下的vm文件
|
// 加载classpath目录下的vm文件
|
||||||
p.setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
|
p.setProperty("resource.loader.file.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
|
||||||
// 定义字符集
|
// 定义字符集
|
||||||
p.setProperty(Velocity.INPUT_ENCODING, Constants.UTF8);
|
p.setProperty(Velocity.INPUT_ENCODING, Constants.UTF8);
|
||||||
p.setProperty(Velocity.OUTPUT_ENCODING, Constants.UTF8);
|
|
||||||
// 初始化Velocity引擎,指定配置Properties
|
// 初始化Velocity引擎,指定配置Properties
|
||||||
Velocity.init(p);
|
Velocity.init(p);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,6 +58,7 @@ public class VelocityUtils
|
|||||||
velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
|
velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
|
||||||
velocityContext.put("columns", genTable.getColumns());
|
velocityContext.put("columns", genTable.getColumns());
|
||||||
velocityContext.put("table", genTable);
|
velocityContext.put("table", genTable);
|
||||||
|
velocityContext.put("dicts", getDicts(genTable));
|
||||||
setMenuVelocityContext(velocityContext, genTable);
|
setMenuVelocityContext(velocityContext, genTable);
|
||||||
if (GenConstants.TPL_TREE.equals(tplCategory))
|
if (GenConstants.TPL_TREE.equals(tplCategory))
|
||||||
{
|
{
|
||||||
@ -260,6 +261,28 @@ public class VelocityUtils
|
|||||||
return importList;
|
return importList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据列类型获取字典组
|
||||||
|
*
|
||||||
|
* @param genTable 业务表对象
|
||||||
|
* @return 返回字典组
|
||||||
|
*/
|
||||||
|
public static String getDicts(GenTable genTable)
|
||||||
|
{
|
||||||
|
List<GenTableColumn> columns = genTable.getColumns();
|
||||||
|
List<String> dicts = new ArrayList<String>();
|
||||||
|
for (GenTableColumn column : columns)
|
||||||
|
{
|
||||||
|
if (!column.isSuperColumn() && StringUtils.isNotEmpty(column.getDictType()) && StringUtils.equalsAny(
|
||||||
|
column.getHtmlType(),
|
||||||
|
new String[] { GenConstants.HTML_SELECT, GenConstants.HTML_RADIO, GenConstants.HTML_CHECKBOX }))
|
||||||
|
{
|
||||||
|
dicts.add("'" + column.getDictType() + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return StringUtils.join(dicts, ", ");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取权限前缀
|
* 获取权限前缀
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package ${packageName}.controller;
|
package ${packageName}.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@ -61,12 +62,12 @@ public class ${ClassName}Controller extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
|
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
|
||||||
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
|
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
|
||||||
@GetMapping("/export")
|
@PostMapping("/export")
|
||||||
public AjaxResult export(${ClassName} ${className})
|
public void export(HttpServletResponse response, ${ClassName} ${className})
|
||||||
{
|
{
|
||||||
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
|
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
|
||||||
ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class);
|
ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class);
|
||||||
return util.exportExcel(list, "${functionName}数据");
|
util.exportExcel(response, list, "${functionName}数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -69,7 +69,7 @@ public interface ${ClassName}Mapper
|
|||||||
* @param ${pkColumn.javaField}s 需要删除的数据主键集合
|
* @param ${pkColumn.javaField}s 需要删除的数据主键集合
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int delete${subClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
public int delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量新增${subTable.functionName}
|
* 批量新增${subTable.functionName}
|
||||||
|
|||||||
@ -129,6 +129,9 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
|||||||
* @param ${pkColumn.javaField} ${functionName}主键
|
* @param ${pkColumn.javaField} ${functionName}主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
#if($table.sub)
|
||||||
|
@Transactional
|
||||||
|
#end
|
||||||
@Override
|
@Override
|
||||||
public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField})
|
public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField})
|
||||||
{
|
{
|
||||||
|
|||||||
@ -42,12 +42,3 @@ export function del${BusinessName}(${pkColumn.javaField}) {
|
|||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出${functionName}
|
|
||||||
export function export${BusinessName}(query) {
|
|
||||||
return request({
|
|
||||||
url: '/${moduleName}/${businessName}/export',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@ -25,10 +25,10 @@
|
|||||||
<el-form-item label="${comment}" prop="${column.javaField}">
|
<el-form-item label="${comment}" prop="${column.javaField}">
|
||||||
<el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small">
|
<el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in ${column.javaField}Options"
|
v-for="dict in dict.type.${dictType}"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
:value="dict.dictValue"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -108,7 +108,11 @@
|
|||||||
#elseif($column.list && "" != $column.dictType)
|
#elseif($column.list && "" != $column.dictType)
|
||||||
<el-table-column label="${comment}" align="center" prop="${javaField}">
|
<el-table-column label="${comment}" align="center" prop="${javaField}">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<dict-tag :options="${javaField}Options" :value="scope.row.${javaField}"/>
|
#if($column.htmlType == "checkbox")
|
||||||
|
<dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/>
|
||||||
|
#else
|
||||||
|
<dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField}"/>
|
||||||
|
#end
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
#elseif($column.list && "" != $javaField)
|
#elseif($column.list && "" != $javaField)
|
||||||
@ -184,10 +188,10 @@
|
|||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in ${field}Options"
|
v-for="dict in dict.type.${dictType}"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
#if($column.javaType == "Integer" || $column.javaType == "Long"):value="parseInt(dict.dictValue)"#else:value="dict.dictValue"#end
|
#if($column.javaType == "Integer" || $column.javaType == "Long"):value="parseInt(dict.value)"#else:value="dict.value"#end
|
||||||
|
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
@ -202,10 +206,10 @@
|
|||||||
<el-form-item label="${comment}">
|
<el-form-item label="${comment}">
|
||||||
<el-checkbox-group v-model="form.${field}">
|
<el-checkbox-group v-model="form.${field}">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-for="dict in ${field}Options"
|
v-for="dict in dict.type.${dictType}"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictValue">
|
:label="dict.value">
|
||||||
{{dict.dictLabel}}
|
{{dict.label}}
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -219,11 +223,11 @@
|
|||||||
<el-form-item label="${comment}">
|
<el-form-item label="${comment}">
|
||||||
<el-radio-group v-model="form.${field}">
|
<el-radio-group v-model="form.${field}">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in ${field}Options"
|
v-for="dict in dict.type.${dictType}"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
#if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.dictValue)"#else:label="dict.dictValue"#end
|
#if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.value)"#else:label="dict.value"#end
|
||||||
|
|
||||||
>{{dict.dictLabel}}</el-radio>
|
>{{dict.label}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
#elseif($column.htmlType == "radio" && $dictType)
|
#elseif($column.htmlType == "radio" && $dictType)
|
||||||
@ -259,12 +263,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName}, export${BusinessName} } from "@/api/${moduleName}/${businessName}";
|
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}";
|
||||||
import Treeselect from "@riophae/vue-treeselect";
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "${BusinessName}",
|
name: "${BusinessName}",
|
||||||
|
#if(${dicts} != '')
|
||||||
|
dicts: [${dicts}],
|
||||||
|
#end
|
||||||
components: {
|
components: {
|
||||||
Treeselect
|
Treeselect
|
||||||
},
|
},
|
||||||
@ -283,16 +290,7 @@ export default {
|
|||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
open: false,
|
open: false,
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
#if($parentheseIndex != -1)
|
|
||||||
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
|
||||||
#else
|
|
||||||
#set($comment=$column.columnComment)
|
|
||||||
#end
|
|
||||||
#if(${column.dictType} != '')
|
|
||||||
// $comment字典
|
|
||||||
${column.javaField}Options: [],
|
|
||||||
#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
|
||||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
// $comment时间范围
|
// $comment时间范围
|
||||||
daterange${AttrName}: [],
|
daterange${AttrName}: [],
|
||||||
@ -302,8 +300,7 @@ export default {
|
|||||||
queryParams: {
|
queryParams: {
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if($column.query)
|
#if($column.query)
|
||||||
$column.javaField: null#if($velocityCount != $columns.size()),#end
|
$column.javaField: null#if($foreach.count != $columns.size()),#end
|
||||||
|
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
},
|
},
|
||||||
@ -321,8 +318,7 @@ export default {
|
|||||||
#end
|
#end
|
||||||
$column.javaField: [
|
$column.javaField: [
|
||||||
{ required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select")"change"#else"blur"#end }
|
{ required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select")"change"#else"blur"#end }
|
||||||
]#if($velocityCount != $columns.size()),#end
|
]#if($foreach.count != $columns.size()),#end
|
||||||
|
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
@ -330,13 +326,6 @@ export default {
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
#foreach ($column in $columns)
|
|
||||||
#if(${column.dictType} != '')
|
|
||||||
this.getDicts("${column.dictType}").then(response => {
|
|
||||||
this.${column.javaField}Options = response.data;
|
|
||||||
});
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询${functionName}列表 */
|
/** 查询${functionName}列表 */
|
||||||
@ -392,14 +381,12 @@ export default {
|
|||||||
this.form = {
|
this.form = {
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if($column.htmlType == "radio")
|
#if($column.htmlType == "radio")
|
||||||
$column.javaField: #if($column.javaType == "Integer" || $column.javaType == "Long")0#else"0"#end#if($velocityCount != $columns.size()),#end
|
$column.javaField: #if($column.javaType == "Integer" || $column.javaType == "Long")0#else"0"#end#if($foreach.count != $columns.size()),#end
|
||||||
|
|
||||||
#elseif($column.htmlType == "checkbox")
|
#elseif($column.htmlType == "checkbox")
|
||||||
$column.javaField: []#if($velocityCount != $columns.size()),#end
|
$column.javaField: []#if($foreach.count != $columns.size()),#end
|
||||||
|
|
||||||
#else
|
#else
|
||||||
$column.javaField: null#if($velocityCount != $columns.size()),#end
|
$column.javaField: null#if($foreach.count != $columns.size()),#end
|
||||||
|
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
};
|
};
|
||||||
@ -461,13 +448,13 @@ export default {
|
|||||||
#end
|
#end
|
||||||
if (this.form.${pkColumn.javaField} != null) {
|
if (this.form.${pkColumn.javaField} != null) {
|
||||||
update${BusinessName}(this.form).then(response => {
|
update${BusinessName}(this.form).then(response => {
|
||||||
this.msgSuccess("修改成功");
|
this.#[[$modal]]#.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
add${BusinessName}(this.form).then(response => {
|
add${BusinessName}(this.form).then(response => {
|
||||||
this.msgSuccess("新增成功");
|
this.#[[$modal]]#.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
@ -477,15 +464,11 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
this.$confirm('是否确认删除${functionName}编号为"' + row.${pkColumn.javaField} + '"的数据项?', "警告", {
|
this.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + row.${pkColumn.javaField} + '"的数据项?').then(function() {
|
||||||
confirmButtonText: "确定",
|
|
||||||
cancelButtonText: "取消",
|
|
||||||
type: "warning"
|
|
||||||
}).then(function() {
|
|
||||||
return del${BusinessName}(row.${pkColumn.javaField});
|
return del${BusinessName}(row.${pkColumn.javaField});
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.msgSuccess("删除成功");
|
this.#[[$modal]]#.msgSuccess("删除成功");
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,10 +25,10 @@
|
|||||||
<el-form-item label="${comment}" prop="${column.javaField}">
|
<el-form-item label="${comment}" prop="${column.javaField}">
|
||||||
<el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small">
|
<el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in ${column.javaField}Options"
|
v-for="dict in dict.type.${dictType}"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
:value="dict.dictValue"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -108,7 +108,6 @@
|
|||||||
plain
|
plain
|
||||||
icon="el-icon-download"
|
icon="el-icon-download"
|
||||||
size="mini"
|
size="mini"
|
||||||
:loading="exportLoading"
|
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
v-hasPermi="['${moduleName}:${businessName}:export']"
|
v-hasPermi="['${moduleName}:${businessName}:export']"
|
||||||
>导出</el-button>
|
>导出</el-button>
|
||||||
@ -137,7 +136,11 @@
|
|||||||
#elseif($column.list && "" != $column.dictType)
|
#elseif($column.list && "" != $column.dictType)
|
||||||
<el-table-column label="${comment}" align="center" prop="${javaField}">
|
<el-table-column label="${comment}" align="center" prop="${javaField}">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<dict-tag :options="${javaField}Options" :value="scope.row.${javaField}"/>
|
#if($column.htmlType == "checkbox")
|
||||||
|
<dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/>
|
||||||
|
#else
|
||||||
|
<dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField}"/>
|
||||||
|
#end
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
#elseif($column.list && "" != $javaField)
|
#elseif($column.list && "" != $javaField)
|
||||||
@ -206,10 +209,10 @@
|
|||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in ${field}Options"
|
v-for="dict in dict.type.${dictType}"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
#if($column.javaType == "Integer" || $column.javaType == "Long"):value="parseInt(dict.dictValue)"#else:value="dict.dictValue"#end
|
#if($column.javaType == "Integer" || $column.javaType == "Long"):value="parseInt(dict.value)"#else:value="dict.value"#end
|
||||||
|
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
@ -224,10 +227,10 @@
|
|||||||
<el-form-item label="${comment}">
|
<el-form-item label="${comment}">
|
||||||
<el-checkbox-group v-model="form.${field}">
|
<el-checkbox-group v-model="form.${field}">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-for="dict in ${field}Options"
|
v-for="dict in dict.type.${dictType}"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictValue">
|
:label="dict.value">
|
||||||
{{dict.dictLabel}}
|
{{dict.label}}
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -241,11 +244,11 @@
|
|||||||
<el-form-item label="${comment}">
|
<el-form-item label="${comment}">
|
||||||
<el-radio-group v-model="form.${field}">
|
<el-radio-group v-model="form.${field}">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in ${field}Options"
|
v-for="dict in dict.type.${dictType}"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
#if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.dictValue)"#else:label="dict.dictValue"#end
|
#if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.value)"#else:label="dict.value"#end
|
||||||
|
|
||||||
>{{dict.dictLabel}}</el-radio>
|
>{{dict.label}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
#elseif($column.htmlType == "radio" && $dictType)
|
#elseif($column.htmlType == "radio" && $dictType)
|
||||||
@ -313,16 +316,17 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName}, export${BusinessName} } from "@/api/${moduleName}/${businessName}";
|
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "${BusinessName}",
|
name: "${BusinessName}",
|
||||||
|
#if(${dicts} != '')
|
||||||
|
dicts: [${dicts}],
|
||||||
|
#end
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: true,
|
||||||
// 导出遮罩层
|
|
||||||
exportLoading: false,
|
|
||||||
// 选中数组
|
// 选中数组
|
||||||
ids: [],
|
ids: [],
|
||||||
#if($table.sub)
|
#if($table.sub)
|
||||||
@ -348,16 +352,7 @@ export default {
|
|||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
open: false,
|
open: false,
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
#if($parentheseIndex != -1)
|
|
||||||
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
|
||||||
#else
|
|
||||||
#set($comment=$column.columnComment)
|
|
||||||
#end
|
|
||||||
#if(${column.dictType} != '')
|
|
||||||
// $comment字典
|
|
||||||
${column.javaField}Options: [],
|
|
||||||
#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
|
||||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
// $comment时间范围
|
// $comment时间范围
|
||||||
daterange${AttrName}: [],
|
daterange${AttrName}: [],
|
||||||
@ -369,8 +364,7 @@ export default {
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if($column.query)
|
#if($column.query)
|
||||||
$column.javaField: null#if($velocityCount != $columns.size()),#end
|
$column.javaField: null#if($foreach.count != $columns.size()),#end
|
||||||
|
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
},
|
},
|
||||||
@ -388,8 +382,7 @@ export default {
|
|||||||
#end
|
#end
|
||||||
$column.javaField: [
|
$column.javaField: [
|
||||||
{ required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select")"change"#else"blur"#end }
|
{ required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select")"change"#else"blur"#end }
|
||||||
]#if($velocityCount != $columns.size()),#end
|
]#if($foreach.count != $columns.size()),#end
|
||||||
|
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
@ -397,13 +390,6 @@ export default {
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
#foreach ($column in $columns)
|
|
||||||
#if(${column.dictType} != '')
|
|
||||||
this.getDicts("${column.dictType}").then(response => {
|
|
||||||
this.${column.javaField}Options = response.data;
|
|
||||||
});
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询${functionName}列表 */
|
/** 查询${functionName}列表 */
|
||||||
@ -440,14 +426,11 @@ export default {
|
|||||||
this.form = {
|
this.form = {
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if($column.htmlType == "radio")
|
#if($column.htmlType == "radio")
|
||||||
$column.javaField: #if($column.javaType == "Integer" || $column.javaType == "Long")0#else"0"#end#if($velocityCount != $columns.size()),#end
|
$column.javaField: #if($column.javaType == "Integer" || $column.javaType == "Long")0#else"0"#end#if($foreach.count != $columns.size()),#end
|
||||||
|
|
||||||
#elseif($column.htmlType == "checkbox")
|
#elseif($column.htmlType == "checkbox")
|
||||||
$column.javaField: []#if($velocityCount != $columns.size()),#end
|
$column.javaField: []#if($foreach.count != $columns.size()),#end
|
||||||
|
|
||||||
#else
|
#else
|
||||||
$column.javaField: null#if($velocityCount != $columns.size()),#end
|
$column.javaField: null#if($foreach.count != $columns.size()),#end
|
||||||
|
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
};
|
};
|
||||||
@ -516,13 +499,13 @@ export default {
|
|||||||
#end
|
#end
|
||||||
if (this.form.${pkColumn.javaField} != null) {
|
if (this.form.${pkColumn.javaField} != null) {
|
||||||
update${BusinessName}(this.form).then(response => {
|
update${BusinessName}(this.form).then(response => {
|
||||||
this.msgSuccess("修改成功");
|
this.#[[$modal]]#.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
add${BusinessName}(this.form).then(response => {
|
add${BusinessName}(this.form).then(response => {
|
||||||
this.msgSuccess("新增成功");
|
this.#[[$modal]]#.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
@ -533,15 +516,11 @@ export default {
|
|||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const ${pkColumn.javaField}s = row.${pkColumn.javaField} || this.ids;
|
const ${pkColumn.javaField}s = row.${pkColumn.javaField} || this.ids;
|
||||||
this.$confirm('是否确认删除${functionName}编号为"' + ${pkColumn.javaField}s + '"的数据项?', "警告", {
|
this.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + ${pkColumn.javaField}s + '"的数据项?').then(function() {
|
||||||
confirmButtonText: "确定",
|
|
||||||
cancelButtonText: "取消",
|
|
||||||
type: "warning"
|
|
||||||
}).then(function() {
|
|
||||||
return del${BusinessName}(${pkColumn.javaField}s);
|
return del${BusinessName}(${pkColumn.javaField}s);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.msgSuccess("删除成功");
|
this.#[[$modal]]#.msgSuccess("删除成功");
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
},
|
},
|
||||||
#if($table.sub)
|
#if($table.sub)
|
||||||
@ -563,7 +542,7 @@ export default {
|
|||||||
/** ${subTable.functionName}删除按钮操作 */
|
/** ${subTable.functionName}删除按钮操作 */
|
||||||
handleDelete${subClassName}() {
|
handleDelete${subClassName}() {
|
||||||
if (this.checked${subClassName}.length == 0) {
|
if (this.checked${subClassName}.length == 0) {
|
||||||
this.msgError("请先选择要删除的${subTable.functionName}数据");
|
this.#[[$modal]]#.msgError("请先选择要删除的${subTable.functionName}数据");
|
||||||
} else {
|
} else {
|
||||||
const ${subclassName}List = this.${subclassName}List;
|
const ${subclassName}List = this.${subclassName}List;
|
||||||
const checked${subClassName} = this.checked${subClassName};
|
const checked${subClassName} = this.checked${subClassName};
|
||||||
@ -579,18 +558,9 @@ export default {
|
|||||||
#end
|
#end
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
const queryParams = this.queryParams;
|
this.download('${moduleName}/${businessName}/export', {
|
||||||
this.$confirm('是否确认导出所有${functionName}数据项?', "警告", {
|
...this.queryParams
|
||||||
confirmButtonText: "确定",
|
}, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`)
|
||||||
cancelButtonText: "取消",
|
|
||||||
type: "warning"
|
|
||||||
}).then(() => {
|
|
||||||
this.exportLoading = true;
|
|
||||||
return export${BusinessName}(queryParams);
|
|
||||||
}).then(response => {
|
|
||||||
this.download(response.msg);
|
|
||||||
this.exportLoading = false;
|
|
||||||
}).catch(() => {});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -23,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
#end
|
#end
|
||||||
|
|
||||||
<sql id="select${ClassName}Vo">
|
<sql id="select${ClassName}Vo">
|
||||||
select#foreach($column in $columns) $column.columnName#if($velocityCount != $columns.size()),#end#end from ${tableName}
|
select#foreach($column in $columns) $column.columnName#if($foreach.count != $columns.size()),#end#end from ${tableName}
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="select${ClassName}List" parameterType="${ClassName}" resultMap="${ClassName}Result">
|
<select id="select${ClassName}List" parameterType="${ClassName}" resultMap="${ClassName}Result">
|
||||||
@ -63,8 +63,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<include refid="select${ClassName}Vo"/>
|
<include refid="select${ClassName}Vo"/>
|
||||||
where ${pkColumn.columnName} = #{${pkColumn.javaField}}
|
where ${pkColumn.columnName} = #{${pkColumn.javaField}}
|
||||||
#elseif($table.sub)
|
#elseif($table.sub)
|
||||||
select#foreach($column in $columns) a.$column.columnName#if($velocityCount != $columns.size()),#end#end,
|
select#foreach($column in $columns) a.$column.columnName#if($foreach.count != $columns.size()),#end#end,
|
||||||
#foreach($column in $subTable.columns) b.$column.columnName as sub_$column.columnName#if($velocityCount != $subTable.columns.size()),#end#end
|
#foreach($column in $subTable.columns) b.$column.columnName as sub_$column.columnName#if($foreach.count != $subTable.columns.size()),#end#end
|
||||||
|
|
||||||
from ${tableName} a
|
from ${tableName} a
|
||||||
left join ${subTableName} b on b.${subTableFkName} = a.${pkColumn.columnName}
|
left join ${subTableName} b on b.${subTableFkName} = a.${pkColumn.columnName}
|
||||||
@ -126,9 +126,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<insert id="batch${subClassName}">
|
<insert id="batch${subClassName}">
|
||||||
insert into ${subTableName}(#foreach($column in $subTable.columns) $column.columnName#if($velocityCount != $subTable.columns.size()),#end#end) values
|
insert into ${subTableName}(#foreach($column in $subTable.columns) $column.columnName#if($foreach.count != $subTable.columns.size()),#end#end) values
|
||||||
<foreach item="item" index="index" collection="list" separator=",">
|
<foreach item="item" index="index" collection="list" separator=",">
|
||||||
(#foreach($column in $subTable.columns) #{item.$column.javaField}#if($velocityCount != $subTable.columns.size()),#end#end)
|
(#foreach($column in $subTable.columns) #{item.$column.javaField}#if($foreach.count != $subTable.columns.size()),#end#end)
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
#end
|
#end
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>3.7.0</version>
|
<version>3.8.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import javax.sql.DataSource;
|
|||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定时任务配置
|
* 定时任务配置(单机部署建议删除此类和qrtz数据库表,默认走内存会最高效)
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.ruoyi.quartz.controller;
|
package com.ruoyi.quartz.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.quartz.SchedulerException;
|
import org.quartz.SchedulerException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@ -54,12 +55,12 @@ public class SysJobController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('monitor:job:export')")
|
@PreAuthorize("@ss.hasPermi('monitor:job:export')")
|
||||||
@Log(title = "定时任务", businessType = BusinessType.EXPORT)
|
@Log(title = "定时任务", businessType = BusinessType.EXPORT)
|
||||||
@GetMapping("/export")
|
@PostMapping("/export")
|
||||||
public AjaxResult export(SysJob sysJob)
|
public void export(HttpServletResponse response, SysJob sysJob)
|
||||||
{
|
{
|
||||||
List<SysJob> list = jobService.selectJobList(sysJob);
|
List<SysJob> list = jobService.selectJobList(sysJob);
|
||||||
ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class);
|
ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class);
|
||||||
return util.exportExcel(list, "定时任务");
|
util.exportExcel(response, list, "定时任务");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -96,6 +97,10 @@ public class SysJobController extends BaseController
|
|||||||
{
|
{
|
||||||
return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)//'调用");
|
return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)//'调用");
|
||||||
}
|
}
|
||||||
|
else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR))
|
||||||
|
{
|
||||||
|
return error("新增任务'" + job.getJobName() + "'失败,目标字符串存在违规");
|
||||||
|
}
|
||||||
job.setCreateBy(getUsername());
|
job.setCreateBy(getUsername());
|
||||||
return toAjax(jobService.insertJob(job));
|
return toAjax(jobService.insertJob(job));
|
||||||
}
|
}
|
||||||
@ -124,6 +129,10 @@ public class SysJobController extends BaseController
|
|||||||
{
|
{
|
||||||
return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)//'调用");
|
return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)//'调用");
|
||||||
}
|
}
|
||||||
|
else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR))
|
||||||
|
{
|
||||||
|
return error("修改任务'" + job.getJobName() + "'失败,目标字符串存在违规");
|
||||||
|
}
|
||||||
job.setUpdateBy(getUsername());
|
job.setUpdateBy(getUsername());
|
||||||
return toAjax(jobService.updateJob(job));
|
return toAjax(jobService.updateJob(job));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
package com.ruoyi.quartz.controller;
|
package com.ruoyi.quartz.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
@ -46,12 +48,12 @@ public class SysJobLogController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('monitor:job:export')")
|
@PreAuthorize("@ss.hasPermi('monitor:job:export')")
|
||||||
@Log(title = "任务调度日志", businessType = BusinessType.EXPORT)
|
@Log(title = "任务调度日志", businessType = BusinessType.EXPORT)
|
||||||
@GetMapping("/export")
|
@PostMapping("/export")
|
||||||
public AjaxResult export(SysJobLog sysJobLog)
|
public void export(HttpServletResponse response, SysJobLog sysJobLog)
|
||||||
{
|
{
|
||||||
List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog);
|
List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog);
|
||||||
ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class);
|
ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class);
|
||||||
return util.exportExcel(list, "调度日志");
|
util.exportExcel(response, list, "调度日志");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -110,7 +110,7 @@ public class JobInvokeUtil
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String[] methodParams = methodStr.split(",");
|
String[] methodParams = methodStr.split(",(?=(?:[^\']*\"[^\']*\')*[^\']*$)");
|
||||||
List<Object[]> classs = new LinkedList<>();
|
List<Object[]> classs = new LinkedList<>();
|
||||||
for (int i = 0; i < methodParams.length; i++)
|
for (int i = 0; i < methodParams.length; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>3.7.0</version>
|
<version>3.8.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ public interface SysRoleMapper
|
|||||||
* @param userId 用户ID
|
* @param userId 用户ID
|
||||||
* @return 选中角色ID列表
|
* @return 选中角色ID列表
|
||||||
*/
|
*/
|
||||||
public List<Integer> selectRoleListByUserId(Long userId);
|
public List<Long> selectRoleListByUserId(Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过角色ID查询角色
|
* 通过角色ID查询角色
|
||||||
|
|||||||
@ -49,7 +49,7 @@ public interface ISysRoleService
|
|||||||
* @param userId 用户ID
|
* @param userId 用户ID
|
||||||
* @return 选中角色ID列表
|
* @return 选中角色ID列表
|
||||||
*/
|
*/
|
||||||
public List<Integer> selectRoleListByUserId(Long userId);
|
public List<Long> selectRoleListByUserId(Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过角色ID查询角色
|
* 通过角色ID查询角色
|
||||||
|
|||||||
@ -140,7 +140,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||||||
public boolean hasChildByDeptId(Long deptId)
|
public boolean hasChildByDeptId(Long deptId)
|
||||||
{
|
{
|
||||||
int result = deptMapper.hasChildByDeptId(deptId);
|
int result = deptMapper.hasChildByDeptId(deptId);
|
||||||
return result > 0 ? true : false;
|
return result > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -153,7 +153,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||||||
public boolean checkDeptExistUser(Long deptId)
|
public boolean checkDeptExistUser(Long deptId)
|
||||||
{
|
{
|
||||||
int result = deptMapper.checkDeptExistUser(deptId);
|
int result = deptMapper.checkDeptExistUser(deptId);
|
||||||
return result > 0 ? true : false;
|
return result > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -325,6 +325,6 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||||||
*/
|
*/
|
||||||
private boolean hasChild(List<SysDept> list, SysDept t)
|
private boolean hasChild(List<SysDept> list, SysDept t)
|
||||||
{
|
{
|
||||||
return getChildList(list, t).size() > 0 ? true : false;
|
return getChildList(list, t).size() > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -169,6 +169,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|||||||
children.setComponent(menu.getComponent());
|
children.setComponent(menu.getComponent());
|
||||||
children.setName(StringUtils.capitalize(menu.getPath()));
|
children.setName(StringUtils.capitalize(menu.getPath()));
|
||||||
children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
|
children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
|
||||||
|
children.setQuery(menu.getQuery());
|
||||||
childrenList.add(children);
|
childrenList.add(children);
|
||||||
router.setChildren(childrenList);
|
router.setChildren(childrenList);
|
||||||
}
|
}
|
||||||
@ -178,7 +179,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|||||||
router.setPath("/inner");
|
router.setPath("/inner");
|
||||||
List<RouterVo> childrenList = new ArrayList<RouterVo>();
|
List<RouterVo> childrenList = new ArrayList<RouterVo>();
|
||||||
RouterVo children = new RouterVo();
|
RouterVo children = new RouterVo();
|
||||||
String routerPath = StringUtils.replaceEach(menu.getPath(), new String[] { Constants.HTTP, Constants.HTTPS }, new String[] { "", "" });
|
String routerPath = innerLinkReplaceEach(menu.getPath());
|
||||||
children.setPath(routerPath);
|
children.setPath(routerPath);
|
||||||
children.setComponent(UserConstants.INNER_LINK);
|
children.setComponent(UserConstants.INNER_LINK);
|
||||||
children.setName(StringUtils.capitalize(routerPath));
|
children.setName(StringUtils.capitalize(routerPath));
|
||||||
@ -357,7 +358,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|||||||
// 内链打开外网方式
|
// 内链打开外网方式
|
||||||
if (menu.getParentId().intValue() != 0 && isInnerLink(menu))
|
if (menu.getParentId().intValue() != 0 && isInnerLink(menu))
|
||||||
{
|
{
|
||||||
routerPath = StringUtils.replaceEach(routerPath, new String[] { Constants.HTTP, Constants.HTTPS }, new String[] { "", "" });
|
routerPath = innerLinkReplaceEach(routerPath);
|
||||||
}
|
}
|
||||||
// 非外链并且是一级目录(类型为目录)
|
// 非外链并且是一级目录(类型为目录)
|
||||||
if (0 == menu.getParentId().intValue() && UserConstants.TYPE_DIR.equals(menu.getMenuType())
|
if (0 == menu.getParentId().intValue() && UserConstants.TYPE_DIR.equals(menu.getMenuType())
|
||||||
@ -499,4 +500,15 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|||||||
{
|
{
|
||||||
return getChildList(list, t).size() > 0 ? true : false;
|
return getChildList(list, t).size() > 0 ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内链域名特殊字符替换
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String innerLinkReplaceEach(String path)
|
||||||
|
{
|
||||||
|
return StringUtils.replaceEach(path, new String[] { Constants.HTTP, Constants.HTTPS },
|
||||||
|
new String[] { "", "" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -122,7 +122,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|||||||
* @return 选中角色ID列表
|
* @return 选中角色ID列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Integer> selectRoleListByUserId(Long userId)
|
public List<Long> selectRoleListByUserId(Long userId)
|
||||||
{
|
{
|
||||||
return roleMapper.selectRoleListByUserId(userId);
|
return roleMapper.selectRoleListByUserId(userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -179,7 +179,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验用户名称是否唯一
|
* 校验手机号码是否唯一
|
||||||
*
|
*
|
||||||
* @param user 用户信息
|
* @param user 用户信息
|
||||||
* @return
|
* @return
|
||||||
|
|||||||
@ -65,7 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<include refid="selectRoleVo"/>
|
<include refid="selectRoleVo"/>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectRoleListByUserId" parameterType="Long" resultType="Integer">
|
<select id="selectRoleListByUserId" parameterType="Long" resultType="Long">
|
||||||
select r.role_id
|
select r.role_id
|
||||||
from sys_role r
|
from sys_role r
|
||||||
left join sys_user_role ur on ur.role_id = r.role_id
|
left join sys_user_role ur on ur.role_id = r.role_id
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ruoyi",
|
"name": "ruoyi",
|
||||||
"version": "3.7.0",
|
"version": "3.8.0",
|
||||||
"description": "若依管理系统",
|
"description": "若依管理系统",
|
||||||
"author": "若依",
|
"author": "若依",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -37,17 +37,17 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@riophae/vue-treeselect": "0.4.0",
|
"@riophae/vue-treeselect": "0.4.0",
|
||||||
"axios": "0.21.0",
|
"axios": "0.24.0",
|
||||||
"clipboard": "2.0.6",
|
"clipboard": "2.0.6",
|
||||||
"core-js": "3.8.1",
|
"core-js": "3.19.1",
|
||||||
"echarts": "4.9.0",
|
"echarts": "4.9.0",
|
||||||
"element-ui": "2.15.5",
|
"element-ui": "2.15.6",
|
||||||
"file-saver": "2.0.4",
|
"file-saver": "2.0.5",
|
||||||
"fuse.js": "6.4.3",
|
"fuse.js": "6.4.3",
|
||||||
"highlight.js": "9.18.5",
|
"highlight.js": "9.18.5",
|
||||||
"js-beautify": "1.13.0",
|
"js-beautify": "1.13.0",
|
||||||
"js-cookie": "2.2.1",
|
"js-cookie": "3.0.1",
|
||||||
"jsencrypt": "3.0.0-rc.1",
|
"jsencrypt": "3.2.1",
|
||||||
"nprogress": "0.2.0",
|
"nprogress": "0.2.0",
|
||||||
"quill": "1.3.7",
|
"quill": "1.3.7",
|
||||||
"screenfull": "5.0.2",
|
"screenfull": "5.0.2",
|
||||||
@ -55,7 +55,7 @@
|
|||||||
"vue": "2.6.12",
|
"vue": "2.6.12",
|
||||||
"vue-count-to": "1.0.13",
|
"vue-count-to": "1.0.13",
|
||||||
"vue-cropper": "0.5.5",
|
"vue-cropper": "0.5.5",
|
||||||
"vue-meta": "^2.4.0",
|
"vue-meta": "2.4.0",
|
||||||
"vue-router": "3.4.9",
|
"vue-router": "3.4.9",
|
||||||
"vuedraggable": "2.24.3",
|
"vuedraggable": "2.24.3",
|
||||||
"vuex": "3.6.0"
|
"vuex": "3.6.0"
|
||||||
@ -71,8 +71,8 @@
|
|||||||
"eslint-plugin-vue": "7.2.0",
|
"eslint-plugin-vue": "7.2.0",
|
||||||
"lint-staged": "10.5.3",
|
"lint-staged": "10.5.3",
|
||||||
"runjs": "4.4.2",
|
"runjs": "4.4.2",
|
||||||
"sass": "1.32.0",
|
"sass": "1.32.13",
|
||||||
"sass-loader": "10.1.0",
|
"sass-loader": "10.1.1",
|
||||||
"script-ext-html-webpack-plugin": "2.1.5",
|
"script-ext-html-webpack-plugin": "2.1.5",
|
||||||
"svg-sprite-loader": "5.1.1",
|
"svg-sprite-loader": "5.1.1",
|
||||||
"vue-template-compiler": "2.6.12"
|
"vue-template-compiler": "2.6.12"
|
||||||
|
|||||||
@ -10,6 +10,9 @@ export function login(username, password, code, uuid) {
|
|||||||
}
|
}
|
||||||
return request({
|
return request({
|
||||||
url: '/login',
|
url: '/login',
|
||||||
|
headers: {
|
||||||
|
isToken: false
|
||||||
|
},
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
@ -47,6 +50,9 @@ export function logout() {
|
|||||||
export function getCodeImg() {
|
export function getCodeImg() {
|
||||||
return request({
|
return request({
|
||||||
url: '/captchaImage',
|
url: '/captchaImage',
|
||||||
|
headers: {
|
||||||
|
isToken: false
|
||||||
|
},
|
||||||
method: 'get',
|
method: 'get',
|
||||||
timeout: 20000
|
timeout: 20000
|
||||||
})
|
})
|
||||||
|
|||||||
@ -43,15 +43,6 @@ export function delJob(jobId) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出定时任务调度
|
|
||||||
export function exportJob(query) {
|
|
||||||
return request({
|
|
||||||
url: '/monitor/job/export',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 任务状态修改
|
// 任务状态修改
|
||||||
export function changeJobStatus(jobId, status) {
|
export function changeJobStatus(jobId, status) {
|
||||||
const data = {
|
const data = {
|
||||||
|
|||||||
@ -24,12 +24,3 @@ export function cleanJobLog() {
|
|||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出调度日志
|
|
||||||
export function exportJobLog(query) {
|
|
||||||
return request({
|
|
||||||
url: '/monitor/jobLog/export',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@ -24,12 +24,3 @@ export function cleanLogininfor() {
|
|||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出登录日志
|
|
||||||
export function exportLogininfor(query) {
|
|
||||||
return request({
|
|
||||||
url: '/monitor/logininfor/export',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@ -24,12 +24,3 @@ export function cleanOperlog() {
|
|||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出操作日志
|
|
||||||
export function exportOperlog(query) {
|
|
||||||
return request({
|
|
||||||
url: '/monitor/operlog/export',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
// 查询服务器详细
|
// 获取服务信息
|
||||||
export function getServer() {
|
export function getServer() {
|
||||||
return request({
|
return request({
|
||||||
url: '/monitor/server',
|
url: '/monitor/server',
|
||||||
|
|||||||
@ -58,12 +58,3 @@ export function refreshCache() {
|
|||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出参数
|
|
||||||
export function exportConfig(query) {
|
|
||||||
return request({
|
|
||||||
url: '/system/config/export',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@ -50,12 +50,3 @@ export function delData(dictCode) {
|
|||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出字典数据
|
|
||||||
export function exportData(query) {
|
|
||||||
return request({
|
|
||||||
url: '/system/dict/data/export',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@ -51,15 +51,6 @@ export function refreshCache() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出字典类型
|
|
||||||
export function exportType(query) {
|
|
||||||
return request({
|
|
||||||
url: '/system/dict/type/export',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取字典选择框列表
|
// 获取字典选择框列表
|
||||||
export function optionselect() {
|
export function optionselect() {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@ -42,12 +42,3 @@ export function delPost(postId) {
|
|||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出岗位
|
|
||||||
export function exportPost(query) {
|
|
||||||
return request({
|
|
||||||
url: '/system/post/export',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@ -65,15 +65,6 @@ export function delRole(roleId) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出角色
|
|
||||||
export function exportRole(query) {
|
|
||||||
return request({
|
|
||||||
url: '/system/role/export',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询角色已授权用户列表
|
// 查询角色已授权用户列表
|
||||||
export function allocatedUserList(query) {
|
export function allocatedUserList(query) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@ -44,15 +44,6 @@ export function delUser(userId) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出用户
|
|
||||||
export function exportUser(query) {
|
|
||||||
return request({
|
|
||||||
url: '/system/user/export',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 用户密码重置
|
// 用户密码重置
|
||||||
export function resetUserPwd(userId, password) {
|
export function resetUserPwd(userId, password) {
|
||||||
const data = {
|
const data = {
|
||||||
@ -118,14 +109,6 @@ export function uploadAvatar(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 下载用户导入模板
|
|
||||||
export function importTemplate() {
|
|
||||||
return request({
|
|
||||||
url: '/system/user/importTemplate',
|
|
||||||
method: 'get'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询授权角色
|
// 查询授权角色
|
||||||
export function getAuthRole(userId) {
|
export function getAuthRole(userId) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<el-form size="small">
|
<el-form size="small">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="1">
|
<el-radio v-model='radioValue' :label="1">
|
||||||
日,允许的通配符[, - * / L M]
|
日,允许的通配符[, - * ? / L W]
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@ -15,23 +15,23 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="3">
|
<el-radio v-model='radioValue' :label="3">
|
||||||
周期从
|
周期从
|
||||||
<el-input-number v-model='cycle01' :min="0" :max="31" /> -
|
<el-input-number v-model='cycle01' :min="1" :max="30" /> -
|
||||||
<el-input-number v-model='cycle02' :min="0" :max="31" /> 日
|
<el-input-number v-model='cycle02' :min="cycle01 ? cycle01 + 1 : 2" :max="31" /> 日
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="4">
|
<el-radio v-model='radioValue' :label="4">
|
||||||
从
|
从
|
||||||
<el-input-number v-model='average01' :min="0" :max="31" /> 号开始,每
|
<el-input-number v-model='average01' :min="1" :max="30" /> 号开始,每
|
||||||
<el-input-number v-model='average02' :min="0" :max="31" /> 日执行一次
|
<el-input-number v-model='average02' :min="1" :max="31 - average01 || 1" /> 日执行一次
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="5">
|
<el-radio v-model='radioValue' :label="5">
|
||||||
每月
|
每月
|
||||||
<el-input-number v-model='workday' :min="0" :max="31" /> 号最近的那个工作日
|
<el-input-number v-model='workday' :min="1" :max="31" /> 号最近的那个工作日
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@ -72,31 +72,22 @@ export default {
|
|||||||
// 单选按钮值变化时
|
// 单选按钮值变化时
|
||||||
radioChange() {
|
radioChange() {
|
||||||
('day rachange');
|
('day rachange');
|
||||||
if (this.radioValue === 1) {
|
if (this.radioValue !== 2 && this.cron.week !== '?') {
|
||||||
this.$emit('update', 'day', '*', 'day');
|
this.$emit('update', 'week', '?', 'day')
|
||||||
this.$emit('update', 'week', '?', 'day');
|
|
||||||
this.$emit('update', 'month', '*', 'day');
|
|
||||||
} else {
|
|
||||||
if (this.cron.hour === '*') {
|
|
||||||
this.$emit('update', 'hour', '0', 'day');
|
|
||||||
}
|
|
||||||
if (this.cron.min === '*') {
|
|
||||||
this.$emit('update', 'min', '0', 'day');
|
|
||||||
}
|
|
||||||
if (this.cron.second === '*') {
|
|
||||||
this.$emit('update', 'second', '0', 'day');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (this.radioValue) {
|
switch (this.radioValue) {
|
||||||
|
case 1:
|
||||||
|
this.$emit('update', 'day', '*');
|
||||||
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.$emit('update', 'day', '?');
|
this.$emit('update', 'day', '?');
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
this.$emit('update', 'day', this.cycle01 + '-' + this.cycle02);
|
this.$emit('update', 'day', this.cycleTotal);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
this.$emit('update', 'day', this.average01 + '/' + this.average02);
|
this.$emit('update', 'day', this.averageTotal);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
this.$emit('update', 'day', this.workday + 'W');
|
this.$emit('update', 'day', this.workday + 'W');
|
||||||
@ -125,7 +116,7 @@ export default {
|
|||||||
// 最近工作日值变化时
|
// 最近工作日值变化时
|
||||||
workdayChange() {
|
workdayChange() {
|
||||||
if (this.radioValue == '5') {
|
if (this.radioValue == '5') {
|
||||||
this.$emit('update', 'day', this.workday + 'W');
|
this.$emit('update', 'day', this.workdayCheck + 'W');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// checkbox值变化时
|
// checkbox值变化时
|
||||||
@ -133,19 +124,10 @@ export default {
|
|||||||
if (this.radioValue == '7') {
|
if (this.radioValue == '7') {
|
||||||
this.$emit('update', 'day', this.checkboxString);
|
this.$emit('update', 'day', this.checkboxString);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
// 父组件传递的week发生变化触发
|
|
||||||
weekChange() {
|
|
||||||
//判断week值与day不能同时为“?”
|
|
||||||
if (this.cron.week == '?' && this.radioValue == '2') {
|
|
||||||
this.radioValue = '1';
|
|
||||||
} else if (this.cron.week !== '?' && this.radioValue != '2') {
|
|
||||||
this.radioValue = '2';
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
|
||||||
watch: {
|
watch: {
|
||||||
"radioValue": "radioChange",
|
'radioValue': 'radioChange',
|
||||||
'cycleTotal': 'cycleChange',
|
'cycleTotal': 'cycleChange',
|
||||||
'averageTotal': 'averageChange',
|
'averageTotal': 'averageChange',
|
||||||
'workdayCheck': 'workdayChange',
|
'workdayCheck': 'workdayChange',
|
||||||
@ -154,20 +136,20 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
// 计算两个周期值
|
// 计算两个周期值
|
||||||
cycleTotal: function () {
|
cycleTotal: function () {
|
||||||
this.cycle01 = this.checkNum(this.cycle01, 1, 31)
|
const cycle01 = this.checkNum(this.cycle01, 1, 30)
|
||||||
this.cycle02 = this.checkNum(this.cycle02, 1, 31)
|
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 2, 31, 31)
|
||||||
return this.cycle01 + '-' + this.cycle02;
|
return cycle01 + '-' + cycle02;
|
||||||
},
|
},
|
||||||
// 计算平均用到的值
|
// 计算平均用到的值
|
||||||
averageTotal: function () {
|
averageTotal: function () {
|
||||||
this.average01 = this.checkNum(this.average01, 1, 31)
|
const average01 = this.checkNum(this.average01, 1, 30)
|
||||||
this.average02 = this.checkNum(this.average02, 1, 31)
|
const average02 = this.checkNum(this.average02, 1, 31 - average01 || 0)
|
||||||
return this.average01 + '/' + this.average02;
|
return average01 + '/' + average02;
|
||||||
},
|
},
|
||||||
// 计算工作日格式
|
// 计算工作日格式
|
||||||
workdayCheck: function () {
|
workdayCheck: function () {
|
||||||
this.workday = this.checkNum(this.workday, 1, 31)
|
const workday = this.checkNum(this.workday, 1, 31)
|
||||||
return this.workday;
|
return workday;
|
||||||
},
|
},
|
||||||
// 计算勾选的checkbox值合集
|
// 计算勾选的checkbox值合集
|
||||||
checkboxString: function () {
|
checkboxString: function () {
|
||||||
|
|||||||
@ -9,16 +9,16 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="2">
|
<el-radio v-model='radioValue' :label="2">
|
||||||
周期从
|
周期从
|
||||||
<el-input-number v-model='cycle01' :min="0" :max="60" /> -
|
<el-input-number v-model='cycle01' :min="0" :max="22" /> -
|
||||||
<el-input-number v-model='cycle02' :min="0" :max="60" /> 小时
|
<el-input-number v-model='cycle02' :min="cycle01 ? cycle01 + 1 : 1" :max="23" /> 小时
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="3">
|
<el-radio v-model='radioValue' :label="3">
|
||||||
从
|
从
|
||||||
<el-input-number v-model='average01' :min="0" :max="60" /> 小时开始,每
|
<el-input-number v-model='average01' :min="0" :max="22" /> 小时开始,每
|
||||||
<el-input-number v-model='average02' :min="0" :max="60" /> 小时执行一次
|
<el-input-number v-model='average02' :min="1" :max="23 - average01 || 0" /> 小时执行一次
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@ -51,23 +51,15 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
// 单选按钮值变化时
|
// 单选按钮值变化时
|
||||||
radioChange() {
|
radioChange() {
|
||||||
if (this.radioValue === 1) {
|
|
||||||
this.$emit('update', 'hour', '*', 'hour');
|
|
||||||
this.$emit('update', 'day', '*', 'hour');
|
|
||||||
} else {
|
|
||||||
if (this.cron.min === '*') {
|
|
||||||
this.$emit('update', 'min', '0', 'hour');
|
|
||||||
}
|
|
||||||
if (this.cron.second === '*') {
|
|
||||||
this.$emit('update', 'second', '0', 'hour');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch (this.radioValue) {
|
switch (this.radioValue) {
|
||||||
|
case 1:
|
||||||
|
this.$emit('update', 'hour', '*')
|
||||||
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.$emit('update', 'hour', this.cycle01 + '-' + this.cycle02);
|
this.$emit('update', 'hour', this.cycleTotal);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
this.$emit('update', 'hour', this.average01 + '/' + this.average02);
|
this.$emit('update', 'hour', this.averageTotal);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
this.$emit('update', 'hour', this.checkboxString);
|
this.$emit('update', 'hour', this.checkboxString);
|
||||||
@ -94,7 +86,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
"radioValue": "radioChange",
|
'radioValue': 'radioChange',
|
||||||
'cycleTotal': 'cycleChange',
|
'cycleTotal': 'cycleChange',
|
||||||
'averageTotal': 'averageChange',
|
'averageTotal': 'averageChange',
|
||||||
'checkboxString': 'checkboxChange'
|
'checkboxString': 'checkboxChange'
|
||||||
@ -102,15 +94,15 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
// 计算两个周期值
|
// 计算两个周期值
|
||||||
cycleTotal: function () {
|
cycleTotal: function () {
|
||||||
this.cycle01 = this.checkNum(this.cycle01, 0, 23)
|
const cycle01 = this.checkNum(this.cycle01, 0, 22)
|
||||||
this.cycle02 = this.checkNum(this.cycle02, 0, 23)
|
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 23)
|
||||||
return this.cycle01 + '-' + this.cycle02;
|
return cycle01 + '-' + cycle02;
|
||||||
},
|
},
|
||||||
// 计算平均用到的值
|
// 计算平均用到的值
|
||||||
averageTotal: function () {
|
averageTotal: function () {
|
||||||
this.average01 = this.checkNum(this.average01, 0, 23)
|
const average01 = this.checkNum(this.average01, 0, 22)
|
||||||
this.average02 = this.checkNum(this.average02, 1, 23)
|
const average02 = this.checkNum(this.average02, 1, 23 - average01 || 0)
|
||||||
return this.average01 + '/' + this.average02;
|
return average01 + '/' + average02;
|
||||||
},
|
},
|
||||||
// 计算勾选的checkbox值合集
|
// 计算勾选的checkbox值合集
|
||||||
checkboxString: function () {
|
checkboxString: function () {
|
||||||
|
|||||||
@ -2,7 +2,12 @@
|
|||||||
<div>
|
<div>
|
||||||
<el-tabs type="border-card">
|
<el-tabs type="border-card">
|
||||||
<el-tab-pane label="秒" v-if="shouldHide('second')">
|
<el-tab-pane label="秒" v-if="shouldHide('second')">
|
||||||
<CrontabSecond @update="updateCrontabValue" :check="checkNumber" ref="cronsecond" />
|
<CrontabSecond
|
||||||
|
@update="updateCrontabValue"
|
||||||
|
:check="checkNumber"
|
||||||
|
:cron="crontabValueObj"
|
||||||
|
ref="cronsecond"
|
||||||
|
/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
||||||
<el-tab-pane label="分钟" v-if="shouldHide('min')">
|
<el-tab-pane label="分钟" v-if="shouldHide('min')">
|
||||||
|
|||||||
@ -9,16 +9,16 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="2">
|
<el-radio v-model='radioValue' :label="2">
|
||||||
周期从
|
周期从
|
||||||
<el-input-number v-model='cycle01' :min="0" :max="60" /> -
|
<el-input-number v-model='cycle01' :min="0" :max="58" /> -
|
||||||
<el-input-number v-model='cycle02' :min="0" :max="60" /> 分钟
|
<el-input-number v-model='cycle02' :min="cycle01 ? cycle01 + 1 : 1" :max="59" /> 分钟
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="3">
|
<el-radio v-model='radioValue' :label="3">
|
||||||
从
|
从
|
||||||
<el-input-number v-model='average01' :min="0" :max="60" /> 分钟开始,每
|
<el-input-number v-model='average01' :min="0" :max="58" /> 分钟开始,每
|
||||||
<el-input-number v-model='average02' :min="0" :max="60" /> 分钟执行一次
|
<el-input-number v-model='average02' :min="1" :max="59 - average01 || 0" /> 分钟执行一次
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@ -52,19 +52,15 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
// 单选按钮值变化时
|
// 单选按钮值变化时
|
||||||
radioChange() {
|
radioChange() {
|
||||||
if (this.radioValue !== 1 && this.cron.second === '*') {
|
|
||||||
this.$emit('update', 'second', '0', 'min');
|
|
||||||
}
|
|
||||||
switch (this.radioValue) {
|
switch (this.radioValue) {
|
||||||
case 1:
|
case 1:
|
||||||
this.$emit('update', 'min', '*', 'min');
|
this.$emit('update', 'min', '*', 'min');
|
||||||
this.$emit('update', 'hour', '*', 'min');
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.$emit('update', 'min', this.cycle01 + '-' + this.cycle02, 'min');
|
this.$emit('update', 'min', this.cycleTotal, 'min');
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
this.$emit('update', 'min', this.average01 + '/' + this.average02, 'min');
|
this.$emit('update', 'min', this.averageTotal, 'min');
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
this.$emit('update', 'min', this.checkboxString, 'min');
|
this.$emit('update', 'min', this.checkboxString, 'min');
|
||||||
@ -92,7 +88,7 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
"radioValue": "radioChange",
|
'radioValue': 'radioChange',
|
||||||
'cycleTotal': 'cycleChange',
|
'cycleTotal': 'cycleChange',
|
||||||
'averageTotal': 'averageChange',
|
'averageTotal': 'averageChange',
|
||||||
'checkboxString': 'checkboxChange',
|
'checkboxString': 'checkboxChange',
|
||||||
@ -100,15 +96,15 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
// 计算两个周期值
|
// 计算两个周期值
|
||||||
cycleTotal: function () {
|
cycleTotal: function () {
|
||||||
this.cycle01 = this.checkNum(this.cycle01, 0, 59)
|
const cycle01 = this.checkNum(this.cycle01, 0, 58)
|
||||||
this.cycle02 = this.checkNum(this.cycle02, 0, 59)
|
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 59)
|
||||||
return this.cycle01 + '-' + this.cycle02;
|
return cycle01 + '-' + cycle02;
|
||||||
},
|
},
|
||||||
// 计算平均用到的值
|
// 计算平均用到的值
|
||||||
averageTotal: function () {
|
averageTotal: function () {
|
||||||
this.average01 = this.checkNum(this.average01, 0, 59)
|
const average01 = this.checkNum(this.average01, 0, 58)
|
||||||
this.average02 = this.checkNum(this.average02, 1, 59)
|
const average02 = this.checkNum(this.average02, 1, 59 - average01 || 0)
|
||||||
return this.average01 + '/' + this.average02;
|
return average01 + '/' + average02;
|
||||||
},
|
},
|
||||||
// 计算勾选的checkbox值合集
|
// 计算勾选的checkbox值合集
|
||||||
checkboxString: function () {
|
checkboxString: function () {
|
||||||
|
|||||||
@ -9,16 +9,16 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="2">
|
<el-radio v-model='radioValue' :label="2">
|
||||||
周期从
|
周期从
|
||||||
<el-input-number v-model='cycle01' :min="1" :max="12" /> -
|
<el-input-number v-model='cycle01' :min="1" :max="11" /> -
|
||||||
<el-input-number v-model='cycle02' :min="1" :max="12" /> 月
|
<el-input-number v-model='cycle02' :min="cycle01 ? cycle01 + 1 : 2" :max="12" /> 月
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="3">
|
<el-radio v-model='radioValue' :label="3">
|
||||||
从
|
从
|
||||||
<el-input-number v-model='average01' :min="1" :max="12" /> 月开始,每
|
<el-input-number v-model='average01' :min="1" :max="11" /> 月开始,每
|
||||||
<el-input-number v-model='average02' :min="1" :max="12" /> 月月执行一次
|
<el-input-number v-model='average02' :min="1" :max="12 - average01 || 0" /> 月月执行一次
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@ -51,29 +51,15 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
// 单选按钮值变化时
|
// 单选按钮值变化时
|
||||||
radioChange() {
|
radioChange() {
|
||||||
if (this.radioValue === 1) {
|
|
||||||
this.$emit('update', 'month', '*');
|
|
||||||
this.$emit('update', 'year', '*');
|
|
||||||
} else {
|
|
||||||
if (this.cron.day === '*') {
|
|
||||||
this.$emit('update', 'day', '0', 'month');
|
|
||||||
}
|
|
||||||
if (this.cron.hour === '*') {
|
|
||||||
this.$emit('update', 'hour', '0', 'month');
|
|
||||||
}
|
|
||||||
if (this.cron.min === '*') {
|
|
||||||
this.$emit('update', 'min', '0', 'month');
|
|
||||||
}
|
|
||||||
if (this.cron.second === '*') {
|
|
||||||
this.$emit('update', 'second', '0', 'month');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch (this.radioValue) {
|
switch (this.radioValue) {
|
||||||
|
case 1:
|
||||||
|
this.$emit('update', 'month', '*');
|
||||||
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.$emit('update', 'month', this.cycle01 + '-' + this.cycle02);
|
this.$emit('update', 'month', this.cycleTotal);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
this.$emit('update', 'month', this.average01 + '/' + this.average02);
|
this.$emit('update', 'month', this.averageTotal);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
this.$emit('update', 'month', this.checkboxString);
|
this.$emit('update', 'month', this.checkboxString);
|
||||||
@ -100,7 +86,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
"radioValue": "radioChange",
|
'radioValue': 'radioChange',
|
||||||
'cycleTotal': 'cycleChange',
|
'cycleTotal': 'cycleChange',
|
||||||
'averageTotal': 'averageChange',
|
'averageTotal': 'averageChange',
|
||||||
'checkboxString': 'checkboxChange'
|
'checkboxString': 'checkboxChange'
|
||||||
@ -108,15 +94,15 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
// 计算两个周期值
|
// 计算两个周期值
|
||||||
cycleTotal: function () {
|
cycleTotal: function () {
|
||||||
this.cycle01 = this.checkNum(this.cycle01, 1, 12)
|
const cycle01 = this.checkNum(this.cycle01, 1, 11)
|
||||||
this.cycle02 = this.checkNum(this.cycle02, 1, 12)
|
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 2, 12)
|
||||||
return this.cycle01 + '-' + this.cycle02;
|
return cycle01 + '-' + cycle02;
|
||||||
},
|
},
|
||||||
// 计算平均用到的值
|
// 计算平均用到的值
|
||||||
averageTotal: function () {
|
averageTotal: function () {
|
||||||
this.average01 = this.checkNum(this.average01, 1, 12)
|
const average01 = this.checkNum(this.average01, 1, 11)
|
||||||
this.average02 = this.checkNum(this.average02, 1, 12)
|
const average02 = this.checkNum(this.average02, 1, 12 - average01 || 0)
|
||||||
return this.average01 + '/' + this.average02;
|
return average01 + '/' + average02;
|
||||||
},
|
},
|
||||||
// 计算勾选的checkbox值合集
|
// 计算勾选的checkbox值合集
|
||||||
checkboxString: function () {
|
checkboxString: function () {
|
||||||
|
|||||||
@ -179,7 +179,7 @@ export default {
|
|||||||
// 获取达到条件的日期是星期X
|
// 获取达到条件的日期是星期X
|
||||||
let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week');
|
let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week');
|
||||||
// 当星期日时
|
// 当星期日时
|
||||||
if (thisWeek == 0) {
|
if (thisWeek == 1) {
|
||||||
// 先找下一个日,并判断是否为月底
|
// 先找下一个日,并判断是否为月底
|
||||||
DD++;
|
DD++;
|
||||||
thisDD = DD < 10 ? '0' + DD : DD;
|
thisDD = DD < 10 ? '0' + DD : DD;
|
||||||
@ -187,7 +187,7 @@ export default {
|
|||||||
if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
|
if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
|
||||||
DD -= 3;
|
DD -= 3;
|
||||||
}
|
}
|
||||||
} else if (thisWeek == 6) {
|
} else if (thisWeek == 7) {
|
||||||
// 当星期6时只需判断不是1号就可进行操作
|
// 当星期6时只需判断不是1号就可进行操作
|
||||||
if (this.dayRuleSup !== 1) {
|
if (this.dayRuleSup !== 1) {
|
||||||
DD--;
|
DD--;
|
||||||
@ -200,7 +200,7 @@ export default {
|
|||||||
// 获取当前日期是属于星期几
|
// 获取当前日期是属于星期几
|
||||||
let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week');
|
let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week');
|
||||||
// 校验当前星期是否在星期池(dayRuleSup)中
|
// 校验当前星期是否在星期池(dayRuleSup)中
|
||||||
if (Array.indexOf(this.dayRuleSup, thisWeek) < 0) {
|
if (this.dayRuleSup.indexOf(thisWeek) < 0) {
|
||||||
// 如果到达最大值时
|
// 如果到达最大值时
|
||||||
if (Di == DDate.length - 1) {
|
if (Di == DDate.length - 1) {
|
||||||
resetDay();
|
resetDay();
|
||||||
@ -385,7 +385,7 @@ export default {
|
|||||||
} else if (rule.indexOf('#') >= 0) {
|
} else if (rule.indexOf('#') >= 0) {
|
||||||
this.dayRule = 'assWeek';
|
this.dayRule = 'assWeek';
|
||||||
let matchRule = rule.match(/[0-9]{1}/g);
|
let matchRule = rule.match(/[0-9]{1}/g);
|
||||||
this.dayRuleSup = [Number(matchRule[0]), Number(matchRule[1])];
|
this.dayRuleSup = [Number(matchRule[1]), Number(matchRule[0])];
|
||||||
this.dateArr[3] = [1];
|
this.dateArr[3] = [1];
|
||||||
if (this.dayRuleSup[1] == 7) {
|
if (this.dayRuleSup[1] == 7) {
|
||||||
this.dayRuleSup[1] = 0;
|
this.dayRuleSup[1] = 0;
|
||||||
@ -401,14 +401,6 @@ export default {
|
|||||||
this.dayRule = 'weekDay';
|
this.dayRule = 'weekDay';
|
||||||
this.dayRuleSup = this.getAssignArr(rule)
|
this.dayRuleSup = this.getAssignArr(rule)
|
||||||
}
|
}
|
||||||
// 如果weekDay时将7调整为0【week值0即是星期日】
|
|
||||||
if (this.dayRule == 'weekDay') {
|
|
||||||
for (let i = 0; i < this.dayRuleSup.length; i++) {
|
|
||||||
if (this.dayRuleSup[i] == 7) {
|
|
||||||
this.dayRuleSup[i] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 获取"日"数组-少量为日期规则
|
// 获取"日"数组-少量为日期规则
|
||||||
@ -543,14 +535,15 @@ export default {
|
|||||||
if (type == undefined) {
|
if (type == undefined) {
|
||||||
return Y + '-' + (M < 10 ? '0' + M : M) + '-' + (D < 10 ? '0' + D : D) + ' ' + (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m) + ':' + (s < 10 ? '0' + s : s);
|
return Y + '-' + (M < 10 ? '0' + M : M) + '-' + (D < 10 ? '0' + D : D) + ' ' + (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m) + ':' + (s < 10 ? '0' + s : s);
|
||||||
} else if (type == 'week') {
|
} else if (type == 'week') {
|
||||||
return week;
|
// 在quartz中 1为星期日
|
||||||
|
return week + 1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 检查日期是否存在
|
// 检查日期是否存在
|
||||||
checkDate(value) {
|
checkDate(value) {
|
||||||
let time = new Date(value);
|
let time = new Date(value);
|
||||||
let format = this.formatDate(time)
|
let format = this.formatDate(time)
|
||||||
return value == format ? true : false;
|
return value === format;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|||||||
@ -9,16 +9,16 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="2">
|
<el-radio v-model='radioValue' :label="2">
|
||||||
周期从
|
周期从
|
||||||
<el-input-number v-model='cycle01' :min="0" :max="60" /> -
|
<el-input-number v-model='cycle01' :min="0" :max="58" /> -
|
||||||
<el-input-number v-model='cycle02' :min="0" :max="60" /> 秒
|
<el-input-number v-model='cycle02' :min="cycle01 ? cycle01 + 1 : 1" :max="59" /> 秒
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="3">
|
<el-radio v-model='radioValue' :label="3">
|
||||||
从
|
从
|
||||||
<el-input-number v-model='average01' :min="0" :max="60" /> 秒开始,每
|
<el-input-number v-model='average01' :min="0" :max="58" /> 秒开始,每
|
||||||
<el-input-number v-model='average02' :min="0" :max="60" /> 秒执行一次
|
<el-input-number v-model='average02' :min="1" :max="59 - average01 || 0" /> 秒执行一次
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@ -54,13 +54,12 @@ export default {
|
|||||||
switch (this.radioValue) {
|
switch (this.radioValue) {
|
||||||
case 1:
|
case 1:
|
||||||
this.$emit('update', 'second', '*', 'second');
|
this.$emit('update', 'second', '*', 'second');
|
||||||
this.$emit('update', 'min', '*', 'second');
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.$emit('update', 'second', this.cycle01 + '-' + this.cycle02);
|
this.$emit('update', 'second', this.cycleTotal);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
this.$emit('update', 'second', this.average01 + '/' + this.average02);
|
this.$emit('update', 'second', this.averageTotal);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
this.$emit('update', 'second', this.checkboxString);
|
this.$emit('update', 'second', this.checkboxString);
|
||||||
@ -84,25 +83,10 @@ export default {
|
|||||||
if (this.radioValue == '4') {
|
if (this.radioValue == '4') {
|
||||||
this.$emit('update', 'second', this.checkboxString);
|
this.$emit('update', 'second', this.checkboxString);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
othChange() {
|
|
||||||
// 反解析
|
|
||||||
let ins = this.cron.second
|
|
||||||
('反解析 second', ins);
|
|
||||||
if (ins === '*') {
|
|
||||||
this.radioValue = 1;
|
|
||||||
} else if (ins.indexOf('-') > -1) {
|
|
||||||
this.radioValue = 2
|
|
||||||
} else if (ins.indexOf('/') > -1) {
|
|
||||||
this.radioValue = 3
|
|
||||||
} else {
|
|
||||||
this.radioValue = 4
|
|
||||||
this.checkboxList = ins.split(',')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
"radioValue": "radioChange",
|
'radioValue': 'radioChange',
|
||||||
'cycleTotal': 'cycleChange',
|
'cycleTotal': 'cycleChange',
|
||||||
'averageTotal': 'averageChange',
|
'averageTotal': 'averageChange',
|
||||||
'checkboxString': 'checkboxChange',
|
'checkboxString': 'checkboxChange',
|
||||||
@ -113,15 +97,15 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
// 计算两个周期值
|
// 计算两个周期值
|
||||||
cycleTotal: function () {
|
cycleTotal: function () {
|
||||||
this.cycle01 = this.checkNum(this.cycle01, 0, 59)
|
const cycle01 = this.checkNum(this.cycle01, 0, 58)
|
||||||
this.cycle02 = this.checkNum(this.cycle02, 0, 59)
|
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 59)
|
||||||
return this.cycle01 + '-' + this.cycle02;
|
return cycle01 + '-' + cycle02;
|
||||||
},
|
},
|
||||||
// 计算平均用到的值
|
// 计算平均用到的值
|
||||||
averageTotal: function () {
|
averageTotal: function () {
|
||||||
this.average01 = this.checkNum(this.average01, 0, 59)
|
const average01 = this.checkNum(this.average01, 0, 58)
|
||||||
this.average02 = this.checkNum(this.average02, 1, 59)
|
const average02 = this.checkNum(this.average02, 1, 59 - average01 || 0)
|
||||||
return this.average01 + '/' + this.average02;
|
return average01 + '/' + average02;
|
||||||
},
|
},
|
||||||
// 计算勾选的checkbox值合集
|
// 计算勾选的checkbox值合集
|
||||||
checkboxString: function () {
|
checkboxString: function () {
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<el-form size='small'>
|
<el-form size='small'>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="1">
|
<el-radio v-model='radioValue' :label="1">
|
||||||
周,允许的通配符[, - * / L #]
|
周,允许的通配符[, - * ? / L #]
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@ -15,8 +15,25 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="3">
|
<el-radio v-model='radioValue' :label="3">
|
||||||
周期从星期
|
周期从星期
|
||||||
<el-input-number v-model='cycle01' :min="1" :max="7" /> -
|
<el-select clearable v-model="cycle01">
|
||||||
<el-input-number v-model='cycle02' :min="1" :max="7" />
|
<el-option
|
||||||
|
v-for="(item,index) of weekList"
|
||||||
|
:key="index"
|
||||||
|
:label="item.value"
|
||||||
|
:value="item.key"
|
||||||
|
:disabled="item.key === 1"
|
||||||
|
>{{item.value}}</el-option>
|
||||||
|
</el-select>
|
||||||
|
-
|
||||||
|
<el-select clearable v-model="cycle02">
|
||||||
|
<el-option
|
||||||
|
v-for="(item,index) of weekList"
|
||||||
|
:key="index"
|
||||||
|
:label="item.value"
|
||||||
|
:value="item.key"
|
||||||
|
:disabled="item.key < cycle01 && item.key !== 1"
|
||||||
|
>{{item.value}}</el-option>
|
||||||
|
</el-select>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@ -24,14 +41,18 @@
|
|||||||
<el-radio v-model='radioValue' :label="4">
|
<el-radio v-model='radioValue' :label="4">
|
||||||
第
|
第
|
||||||
<el-input-number v-model='average01' :min="1" :max="4" /> 周的星期
|
<el-input-number v-model='average01' :min="1" :max="4" /> 周的星期
|
||||||
<el-input-number v-model='average02' :min="1" :max="7" />
|
<el-select clearable v-model="average02">
|
||||||
|
<el-option v-for="(item,index) of weekList" :key="index" :label="item.value" :value="item.key">{{item.value}}</el-option>
|
||||||
|
</el-select>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="5">
|
<el-radio v-model='radioValue' :label="5">
|
||||||
本月最后一个星期
|
本月最后一个星期
|
||||||
<el-input-number v-model='weekday' :min="1" :max="7" />
|
<el-select clearable v-model="weekday">
|
||||||
|
<el-option v-for="(item,index) of weekList" :key="index" :label="item.value" :value="item.key">{{item.value}}</el-option>
|
||||||
|
</el-select>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@ -39,7 +60,7 @@
|
|||||||
<el-radio v-model='radioValue' :label="6">
|
<el-radio v-model='radioValue' :label="6">
|
||||||
指定
|
指定
|
||||||
<el-select clearable v-model="checkboxList" placeholder="可多选" multiple style="width:100%">
|
<el-select clearable v-model="checkboxList" placeholder="可多选" multiple style="width:100%">
|
||||||
<el-option v-for="(item,index) of weekList" :key="index" :value="index+1">{{item}}</el-option>
|
<el-option v-for="(item,index) of weekList" :key="index" :label="item.value" :value="item.key">{{item.value}}</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -52,13 +73,42 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
radioValue: 2,
|
radioValue: 2,
|
||||||
weekday: 1,
|
weekday: 2,
|
||||||
cycle01: 1,
|
cycle01: 2,
|
||||||
cycle02: 2,
|
cycle02: 3,
|
||||||
average01: 1,
|
average01: 1,
|
||||||
average02: 1,
|
average02: 2,
|
||||||
checkboxList: [],
|
checkboxList: [],
|
||||||
weekList: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
|
weekList: [
|
||||||
|
{
|
||||||
|
key: 2,
|
||||||
|
value: '星期一'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 3,
|
||||||
|
value: '星期二'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 4,
|
||||||
|
value: '星期三'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 5,
|
||||||
|
value: '星期四'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 6,
|
||||||
|
value: '星期五'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 7,
|
||||||
|
value: '星期六'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 1,
|
||||||
|
value: '星期日'
|
||||||
|
}
|
||||||
|
],
|
||||||
checkNum: this.$options.propsData.check
|
checkNum: this.$options.propsData.check
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -67,45 +117,30 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
// 单选按钮值变化时
|
// 单选按钮值变化时
|
||||||
radioChange() {
|
radioChange() {
|
||||||
if (this.radioValue === 1) {
|
if (this.radioValue !== 2 && this.cron.day !== '?') {
|
||||||
this.$emit('update', 'week', '*');
|
this.$emit('update', 'day', '?', 'week');
|
||||||
this.$emit('update', 'year', '*');
|
|
||||||
} else {
|
|
||||||
if (this.cron.month === '*') {
|
|
||||||
this.$emit('update', 'month', '0', 'week');
|
|
||||||
}
|
|
||||||
if (this.cron.day === '*') {
|
|
||||||
this.$emit('update', 'day', '0', 'week');
|
|
||||||
}
|
|
||||||
if (this.cron.hour === '*') {
|
|
||||||
this.$emit('update', 'hour', '0', 'week');
|
|
||||||
}
|
|
||||||
if (this.cron.min === '*') {
|
|
||||||
this.$emit('update', 'min', '0', 'week');
|
|
||||||
}
|
|
||||||
if (this.cron.second === '*') {
|
|
||||||
this.$emit('update', 'second', '0', 'week');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
switch (this.radioValue) {
|
switch (this.radioValue) {
|
||||||
|
case 1:
|
||||||
|
this.$emit('update', 'week', '*');
|
||||||
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.$emit('update', 'week', '?');
|
this.$emit('update', 'week', '?');
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
this.$emit('update', 'week', this.cycle01 + '-' + this.cycle02);
|
this.$emit('update', 'week', this.cycleTotal);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
this.$emit('update', 'week', this.average01 + '#' + this.average02);
|
this.$emit('update', 'week', this.averageTotal);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
this.$emit('update', 'week', this.weekday + 'L');
|
this.$emit('update', 'week', this.weekdayCheck + 'L');
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
this.$emit('update', 'week', this.checkboxString);
|
this.$emit('update', 'week', this.checkboxString);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 根据互斥事件,更改radio的值
|
|
||||||
|
|
||||||
// 周期两个值变化时
|
// 周期两个值变化时
|
||||||
cycleChange() {
|
cycleChange() {
|
||||||
@ -133,7 +168,7 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
"radioValue": "radioChange",
|
'radioValue': 'radioChange',
|
||||||
'cycleTotal': 'cycleChange',
|
'cycleTotal': 'cycleChange',
|
||||||
'averageTotal': 'averageChange',
|
'averageTotal': 'averageChange',
|
||||||
'weekdayCheck': 'weekdayChange',
|
'weekdayCheck': 'weekdayChange',
|
||||||
@ -150,7 +185,7 @@ export default {
|
|||||||
averageTotal: function () {
|
averageTotal: function () {
|
||||||
this.average01 = this.checkNum(this.average01, 1, 4)
|
this.average01 = this.checkNum(this.average01, 1, 4)
|
||||||
this.average02 = this.checkNum(this.average02, 1, 7)
|
this.average02 = this.checkNum(this.average02, 1, 7)
|
||||||
return this.average01 + '#' + this.average02;
|
return this.average02 + '#' + this.average01;
|
||||||
},
|
},
|
||||||
// 最近的工作日(格式)
|
// 最近的工作日(格式)
|
||||||
weekdayCheck: function () {
|
weekdayCheck: function () {
|
||||||
|
|||||||
@ -15,16 +15,16 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio :label="3" v-model='radioValue'>
|
<el-radio :label="3" v-model='radioValue'>
|
||||||
周期从
|
周期从
|
||||||
<el-input-number v-model='cycle01' :min='fullYear' /> -
|
<el-input-number v-model='cycle01' :min='fullYear' :max="2098" /> -
|
||||||
<el-input-number v-model='cycle02' :min='fullYear' />
|
<el-input-number v-model='cycle02' :min="cycle01 ? cycle01 + 1 : fullYear + 1" :max="2099" />
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio :label="4" v-model='radioValue'>
|
<el-radio :label="4" v-model='radioValue'>
|
||||||
从
|
从
|
||||||
<el-input-number v-model='average01' :min='fullYear' /> 年开始,每
|
<el-input-number v-model='average01' :min='fullYear' :max="2098"/> 年开始,每
|
||||||
<el-input-number v-model='average02' :min='fullYear' /> 年执行一次
|
<el-input-number v-model='average02' :min="1" :max="2099 - average01 || fullYear" /> 年执行一次
|
||||||
</el-radio>
|
</el-radio>
|
||||||
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -59,21 +59,6 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
// 单选按钮值变化时
|
// 单选按钮值变化时
|
||||||
radioChange() {
|
radioChange() {
|
||||||
if (this.cron.month === '*') {
|
|
||||||
this.$emit('update', 'month', '0', 'year');
|
|
||||||
}
|
|
||||||
if (this.cron.day === '*') {
|
|
||||||
this.$emit('update', 'day', '0', 'year');
|
|
||||||
}
|
|
||||||
if (this.cron.hour === '*') {
|
|
||||||
this.$emit('update', 'hour', '0', 'year');
|
|
||||||
}
|
|
||||||
if (this.cron.min === '*') {
|
|
||||||
this.$emit('update', 'min', '0', 'year');
|
|
||||||
}
|
|
||||||
if (this.cron.second === '*') {
|
|
||||||
this.$emit('update', 'second', '0', 'year');
|
|
||||||
}
|
|
||||||
switch (this.radioValue) {
|
switch (this.radioValue) {
|
||||||
case 1:
|
case 1:
|
||||||
this.$emit('update', 'year', '');
|
this.$emit('update', 'year', '');
|
||||||
@ -82,10 +67,10 @@ export default {
|
|||||||
this.$emit('update', 'year', '*');
|
this.$emit('update', 'year', '*');
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
this.$emit('update', 'year', this.cycle01 + '-' + this.cycle02);
|
this.$emit('update', 'year', this.cycleTotal);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
this.$emit('update', 'year', this.average01 + '/' + this.average02);
|
this.$emit('update', 'year', this.averageTotal);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
this.$emit('update', 'year', this.checkboxString);
|
this.$emit('update', 'year', this.checkboxString);
|
||||||
@ -112,7 +97,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
"radioValue": "radioChange",
|
'radioValue': 'radioChange',
|
||||||
'cycleTotal': 'cycleChange',
|
'cycleTotal': 'cycleChange',
|
||||||
'averageTotal': 'averageChange',
|
'averageTotal': 'averageChange',
|
||||||
'checkboxString': 'checkboxChange'
|
'checkboxString': 'checkboxChange'
|
||||||
@ -120,15 +105,15 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
// 计算两个周期值
|
// 计算两个周期值
|
||||||
cycleTotal: function () {
|
cycleTotal: function () {
|
||||||
this.cycle01 = this.checkNum(this.cycle01, this.fullYear, this.fullYear + 100)
|
const cycle01 = this.checkNum(this.cycle01, this.fullYear, 2098)
|
||||||
this.cycle02 = this.checkNum(this.cycle02, this.fullYear + 1, this.fullYear + 101)
|
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : this.fullYear + 1, 2099)
|
||||||
return this.cycle01 + '-' + this.cycle02;
|
return cycle01 + '-' + cycle02;
|
||||||
},
|
},
|
||||||
// 计算平均用到的值
|
// 计算平均用到的值
|
||||||
averageTotal: function () {
|
averageTotal: function () {
|
||||||
this.average01 = this.checkNum(this.average01, this.fullYear, this.fullYear + 100)
|
const average01 = this.checkNum(this.average01, this.fullYear, 2098)
|
||||||
this.average02 = this.checkNum(this.average02, 1, 10)
|
const average02 = this.checkNum(this.average02, 1, 2099 - average01 || this.fullYear)
|
||||||
return this.average01 + '/' + this.average02;
|
return average01 + '/' + average02;
|
||||||
},
|
},
|
||||||
// 计算勾选的checkbox值合集
|
// 计算勾选的checkbox值合集
|
||||||
checkboxString: function () {
|
checkboxString: function () {
|
||||||
@ -139,6 +124,8 @@ export default {
|
|||||||
mounted: function () {
|
mounted: function () {
|
||||||
// 仅获取当前年份
|
// 仅获取当前年份
|
||||||
this.fullYear = Number(new Date().getFullYear());
|
this.fullYear = Number(new Date().getFullYear());
|
||||||
|
this.cycle01 = this.fullYear
|
||||||
|
this.average01 = this.fullYear
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
21
ruoyi-ui/src/components/DictData/index.js
Normal file
21
ruoyi-ui/src/components/DictData/index.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import Vue from 'vue'
|
||||||
|
import DataDict from '@/utils/dict'
|
||||||
|
import { getDicts as getDicts } from '@/api/system/dict/data'
|
||||||
|
|
||||||
|
function install() {
|
||||||
|
Vue.use(DataDict, {
|
||||||
|
metas: {
|
||||||
|
'*': {
|
||||||
|
labelField: 'dictLabel',
|
||||||
|
valueField: 'dictValue',
|
||||||
|
request(dictMeta) {
|
||||||
|
return getDicts(dictMeta.type).then(res => res.data)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
install,
|
||||||
|
}
|
||||||
@ -1,22 +1,23 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<template v-for="(item, index) in options">
|
<template v-for="(item, index) in options">
|
||||||
<template v-if="values.includes(item.dictValue)">
|
<template v-if="values.includes(item.value)">
|
||||||
<span
|
<span
|
||||||
v-if="item.listClass == 'default' || item.listClass == ''"
|
v-if="item.raw.listClass == 'default' || item.raw.listClass == ''"
|
||||||
:key="item.dictValue"
|
:key="item.value"
|
||||||
:index="index"
|
:index="index"
|
||||||
:class="item.cssClass"
|
:class="item.raw.cssClass"
|
||||||
>{{ item.dictLabel }}</span
|
>{{ item.label }}</span
|
||||||
>
|
>
|
||||||
<el-tag
|
<el-tag
|
||||||
v-else
|
v-else
|
||||||
:key="item.dictValue"
|
:disable-transitions="true"
|
||||||
|
:key="item.value"
|
||||||
:index="index"
|
:index="index"
|
||||||
:type="item.listClass == 'primary' ? '' : item.listClass"
|
:type="item.raw.listClass == 'primary' ? '' : item.raw.listClass"
|
||||||
:class="item.cssClass"
|
:class="item.raw.cssClass"
|
||||||
>
|
>
|
||||||
{{ item.dictLabel }}
|
{{ item.label }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@ -62,7 +62,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 右侧列表元素变化
|
// 右侧列表元素变化
|
||||||
dataChange(data) {
|
dataChange(data) {
|
||||||
for (var item in this.columns) {
|
for (let item in this.columns) {
|
||||||
const key = this.columns[item].key;
|
const key = this.columns[item].key;
|
||||||
this.columns[item].visible = !data.includes(key);
|
this.columns[item].visible = !data.includes(key);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,8 +5,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown-item v-for="item of sizeOptions" :key="item.value" :disabled="size===item.value" :command="item.value">
|
<el-dropdown-item v-for="item of sizeOptions" :key="item.value" :disabled="size===item.value" :command="item.value">
|
||||||
{{
|
{{ item.label }}
|
||||||
item.label }}
|
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
|
|||||||
@ -162,14 +162,8 @@ export default {
|
|||||||
this.sideTheme = val;
|
this.sideTheme = val;
|
||||||
},
|
},
|
||||||
saveSetting() {
|
saveSetting() {
|
||||||
const loading = this.$loading({
|
this.$modal.loading("正在保存到本地,请稍候...");
|
||||||
lock: true,
|
this.$cache.local.set(
|
||||||
fullscreen: false,
|
|
||||||
text: "正在保存到本地,请稍后...",
|
|
||||||
spinner: "el-icon-loading",
|
|
||||||
background: "rgba(0, 0, 0, 0.7)"
|
|
||||||
});
|
|
||||||
localStorage.setItem(
|
|
||||||
"layout-setting",
|
"layout-setting",
|
||||||
`{
|
`{
|
||||||
"topNav":${this.topNav},
|
"topNav":${this.topNav},
|
||||||
@ -181,17 +175,11 @@ export default {
|
|||||||
"theme":"${this.theme}"
|
"theme":"${this.theme}"
|
||||||
}`
|
}`
|
||||||
);
|
);
|
||||||
setTimeout(loading.close(), 1000)
|
setTimeout(this.$modal.closeLoading(), 1000)
|
||||||
},
|
},
|
||||||
resetSetting() {
|
resetSetting() {
|
||||||
this.$loading({
|
this.$modal.loading("正在清除设置缓存并刷新,请稍候...");
|
||||||
lock: true,
|
this.$cache.local.remove("layout-setting")
|
||||||
fullscreen: false,
|
|
||||||
text: "正在清除设置缓存并刷新,请稍后...",
|
|
||||||
spinner: "el-icon-loading",
|
|
||||||
background: "rgba(0, 0, 0, 0.7)"
|
|
||||||
});
|
|
||||||
localStorage.removeItem("layout-setting")
|
|
||||||
setTimeout("window.location.reload()", 1000)
|
setTimeout("window.location.reload()", 1000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -152,31 +152,24 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
refreshSelectedTag(view) {
|
refreshSelectedTag(view) {
|
||||||
this.$store.dispatch('tagsView/delCachedView', view).then(() => {
|
this.$tab.refreshPage(view);
|
||||||
const { fullPath } = view
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.$router.replace({
|
|
||||||
path: '/redirect' + fullPath
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
closeSelectedTag(view) {
|
closeSelectedTag(view) {
|
||||||
this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => {
|
this.$tab.closePage(view).then(({ visitedViews }) => {
|
||||||
if (this.isActive(view)) {
|
if (this.isActive(view)) {
|
||||||
this.toLastView(visitedViews, view)
|
this.toLastView(visitedViews, view)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
closeRightTags() {
|
closeRightTags() {
|
||||||
this.$store.dispatch('tagsView/delRightTags', this.selectedTag).then(visitedViews => {
|
this.$tab.closeRightPage(this.selectedTag).then(visitedViews => {
|
||||||
if (!visitedViews.find(i => i.fullPath === this.$route.fullPath)) {
|
if (!visitedViews.find(i => i.fullPath === this.$route.fullPath)) {
|
||||||
this.toLastView(visitedViews)
|
this.toLastView(visitedViews)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
closeLeftTags() {
|
closeLeftTags() {
|
||||||
this.$store.dispatch('tagsView/delLeftTags', this.selectedTag).then(visitedViews => {
|
this.$tab.closeLeftPage(this.selectedTag).then(visitedViews => {
|
||||||
if (!visitedViews.find(i => i.fullPath === this.$route.fullPath)) {
|
if (!visitedViews.find(i => i.fullPath === this.$route.fullPath)) {
|
||||||
this.toLastView(visitedViews)
|
this.toLastView(visitedViews)
|
||||||
}
|
}
|
||||||
@ -184,12 +177,12 @@ export default {
|
|||||||
},
|
},
|
||||||
closeOthersTags() {
|
closeOthersTags() {
|
||||||
this.$router.push(this.selectedTag).catch(()=>{});
|
this.$router.push(this.selectedTag).catch(()=>{});
|
||||||
this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => {
|
this.$tab.closeOtherPage(this.selectedTag).then(() => {
|
||||||
this.moveToCurrentTag()
|
this.moveToCurrentTag()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
closeAllTags(view) {
|
closeAllTags(view) {
|
||||||
this.$store.dispatch('tagsView/delAllViews').then(({ visitedViews }) => {
|
this.$tab.closeAllPage().then(({ visitedViews }) => {
|
||||||
if (this.affixTags.some(tag => tag.path === this.$route.path)) {
|
if (this.affixTags.some(tag => tag.path === this.$route.path)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -98,7 +98,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.hideSidebar .fixed-header {
|
.hideSidebar .fixed-header {
|
||||||
width: calc(100% - 54px)
|
width: calc(100% - 54px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.mobile .fixed-header {
|
.mobile .fixed-header {
|
||||||
|
|||||||
@ -11,12 +11,15 @@ import App from './App'
|
|||||||
import store from './store'
|
import store from './store'
|
||||||
import router from './router'
|
import router from './router'
|
||||||
import directive from './directive' // directive
|
import directive from './directive' // directive
|
||||||
|
import plugins from './plugins' // plugins
|
||||||
|
import { download } from '@/utils/request'
|
||||||
|
|
||||||
import './assets/icons' // icon
|
import './assets/icons' // icon
|
||||||
import './permission' // permission control
|
import './permission' // permission control
|
||||||
import { getDicts } from "@/api/system/dict/data";
|
import { getDicts } from "@/api/system/dict/data";
|
||||||
import { getConfigKey } from "@/api/system/config";
|
import { getConfigKey } from "@/api/system/config";
|
||||||
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree } from "@/utils/ruoyi";
|
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
|
||||||
|
// 分页组件
|
||||||
import Pagination from "@/components/Pagination";
|
import Pagination from "@/components/Pagination";
|
||||||
// 自定义表格工具组件
|
// 自定义表格工具组件
|
||||||
import RightToolbar from "@/components/RightToolbar"
|
import RightToolbar from "@/components/RightToolbar"
|
||||||
@ -30,6 +33,8 @@ import ImageUpload from "@/components/ImageUpload"
|
|||||||
import DictTag from '@/components/DictTag'
|
import DictTag from '@/components/DictTag'
|
||||||
// 头部标签组件
|
// 头部标签组件
|
||||||
import VueMeta from 'vue-meta'
|
import VueMeta from 'vue-meta'
|
||||||
|
// 字典数据组件
|
||||||
|
import DictData from '@/components/DictData'
|
||||||
|
|
||||||
// 全局方法挂载
|
// 全局方法挂载
|
||||||
Vue.prototype.getDicts = getDicts
|
Vue.prototype.getDicts = getDicts
|
||||||
@ -42,18 +47,6 @@ Vue.prototype.selectDictLabels = selectDictLabels
|
|||||||
Vue.prototype.download = download
|
Vue.prototype.download = download
|
||||||
Vue.prototype.handleTree = handleTree
|
Vue.prototype.handleTree = handleTree
|
||||||
|
|
||||||
Vue.prototype.msgSuccess = function (msg) {
|
|
||||||
this.$message({ showClose: true, message: msg, type: "success" });
|
|
||||||
}
|
|
||||||
|
|
||||||
Vue.prototype.msgError = function (msg) {
|
|
||||||
this.$message({ showClose: true, message: msg, type: "error" });
|
|
||||||
}
|
|
||||||
|
|
||||||
Vue.prototype.msgInfo = function (msg) {
|
|
||||||
this.$message.info(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 全局组件挂载
|
// 全局组件挂载
|
||||||
Vue.component('DictTag', DictTag)
|
Vue.component('DictTag', DictTag)
|
||||||
Vue.component('Pagination', Pagination)
|
Vue.component('Pagination', Pagination)
|
||||||
@ -63,7 +56,9 @@ Vue.component('FileUpload', FileUpload)
|
|||||||
Vue.component('ImageUpload', ImageUpload)
|
Vue.component('ImageUpload', ImageUpload)
|
||||||
|
|
||||||
Vue.use(directive)
|
Vue.use(directive)
|
||||||
|
Vue.use(plugins)
|
||||||
Vue.use(VueMeta)
|
Vue.use(VueMeta)
|
||||||
|
DictData.install()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If you don't want to use mock-server
|
* If you don't want to use mock-server
|
||||||
|
|||||||
60
ruoyi-ui/src/plugins/auth.js
Normal file
60
ruoyi-ui/src/plugins/auth.js
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
import store from '@/store'
|
||||||
|
|
||||||
|
function authPermission(permission) {
|
||||||
|
const all_permission = "*:*:*";
|
||||||
|
const permissions = store.getters && store.getters.permissions
|
||||||
|
if (permission && permission.length > 0) {
|
||||||
|
return permissions.some(v => {
|
||||||
|
return all_permission === v || v === permission
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function authRole(role) {
|
||||||
|
const super_admin = "admin";
|
||||||
|
const roles = store.getters && store.getters.roles
|
||||||
|
if (role && role.length > 0) {
|
||||||
|
return roles.some(v => {
|
||||||
|
return super_admin === v || v === role
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
// 验证用户是否具备某权限
|
||||||
|
hasPermi(permission) {
|
||||||
|
return authPermission(permission);
|
||||||
|
},
|
||||||
|
// 验证用户是否含有指定权限,只需包含其中一个
|
||||||
|
hasPermiOr(permissions) {
|
||||||
|
return permissions.some(item => {
|
||||||
|
return authPermission(item)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 验证用户是否含有指定权限,必须全部拥有
|
||||||
|
hasPermiAnd(permissions) {
|
||||||
|
return permissions.every(item => {
|
||||||
|
return authPermission(item)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 验证用户是否具备某角色
|
||||||
|
hasRole(role) {
|
||||||
|
return authRole(role);
|
||||||
|
},
|
||||||
|
// 验证用户是否含有指定角色,只需包含其中一个
|
||||||
|
hasRoleOr(roles) {
|
||||||
|
return roles.some(item => {
|
||||||
|
return authRole(item)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 验证用户是否含有指定角色,必须全部拥有
|
||||||
|
hasRoleAnd(roles) {
|
||||||
|
return roles.every(item => {
|
||||||
|
return authRole(item)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user