From 31db658929768474275accfb73bc5ad76b2cb4d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Sat, 15 May 2021 11:32:05 +0800 Subject: [PATCH 01/42] =?UTF-8?q?update=20=E5=A2=9E=E5=BC=BA=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E5=B7=A5=E5=85=B7=E5=85=BC=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/common/utils/PageUtils.java | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/PageUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/PageUtils.java index e484f6dd..cf3f886d 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/PageUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/PageUtils.java @@ -37,9 +37,25 @@ public class PageUtils { */ public static final String IS_ASC = "isAsc"; + /** + * 当前记录起始索引 默认值 + */ + public static final int DEFAULT_PAGE_NUM = 1; + + /** + * 每页显示记录数 默认值 + */ + public static final int DEFAULT_PAGE_SIZE = 10; + + /** + * 构建 plus 分页对象 + * @param domain 实体 + * @param vo 实体 + * @return 分页对象 + */ public static PagePlus buildPagePlus() { - Integer pageNum = ServletUtils.getParameterToInt(PAGE_NUM); - Integer pageSize = ServletUtils.getParameterToInt(PAGE_SIZE); + Integer pageNum = ServletUtils.getParameterToInt(PAGE_NUM, DEFAULT_PAGE_NUM); + Integer pageSize = ServletUtils.getParameterToInt(PAGE_SIZE, DEFAULT_PAGE_SIZE); String orderByColumn = ServletUtils.getParameter(ORDER_BY_COLUMN); String isAsc = ServletUtils.getParameter(IS_ASC); PagePlus page = new PagePlus<>(pageNum, pageSize); @@ -54,9 +70,14 @@ public class PageUtils { return page; } + /** + * 构建 MP 普通分页对象 + * @param domain 实体 + * @return 分页对象 + */ public static Page buildPage() { - Integer pageNum = ServletUtils.getParameterToInt(PAGE_NUM); - Integer pageSize = ServletUtils.getParameterToInt(PAGE_SIZE); + Integer pageNum = ServletUtils.getParameterToInt(PAGE_NUM, DEFAULT_PAGE_NUM); + Integer pageSize = ServletUtils.getParameterToInt(PAGE_SIZE, DEFAULT_PAGE_SIZE); String orderByColumn = ServletUtils.getParameter(ORDER_BY_COLUMN); String isAsc = ServletUtils.getParameter(IS_ASC); Page page = new Page<>(pageNum, pageSize); From b5064021e61195ed70223612b1afbe71f9ab0a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Sat, 15 May 2021 14:23:43 +0800 Subject: [PATCH 02/42] =?UTF-8?q?remove=20=E7=A7=BB=E9=99=A4ruoyi=E8=87=AA?= =?UTF-8?q?=E5=B8=A6=E6=9C=8D=E5=8A=A1=E7=9B=91=E6=8E=A7(Admin=E5=B7=B2?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E5=8C=85=E5=90=AB)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/monitor/ServerController.java | 27 --- .../ruoyi/framework/web/domain/Server.java | 157 ------------- .../framework/web/domain/server/Cpu.java | 88 -------- .../framework/web/domain/server/Jvm.java | 112 ---------- .../framework/web/domain/server/Mem.java | 61 ----- .../framework/web/domain/server/Sys.java | 84 ------- .../framework/web/domain/server/SysFile.java | 114 ---------- ruoyi-ui/src/views/monitor/server/index.vue | 210 ------------------ sql/ry_20210210.sql | 2 +- 9 files changed, 1 insertion(+), 854 deletions(-) delete mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java delete mode 100644 ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/Server.java delete mode 100644 ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Cpu.java delete mode 100644 ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Jvm.java delete mode 100644 ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Mem.java delete mode 100644 ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Sys.java delete mode 100644 ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/SysFile.java delete mode 100644 ruoyi-ui/src/views/monitor/server/index.vue diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java deleted file mode 100644 index cc805ad8..00000000 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.ruoyi.web.controller.monitor; - -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.framework.web.domain.Server; - -/** - * 服务器监控 - * - * @author ruoyi - */ -@RestController -@RequestMapping("/monitor/server") -public class ServerController -{ - @PreAuthorize("@ss.hasPermi('monitor:server:list')") - @GetMapping() - public AjaxResult getInfo() throws Exception - { - Server server = new Server(); - server.copyTo(); - return AjaxResult.success(server); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/Server.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/Server.java deleted file mode 100644 index 341d0b36..00000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/Server.java +++ /dev/null @@ -1,157 +0,0 @@ -package com.ruoyi.framework.web.domain; - -import cn.hutool.core.util.NumberUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.system.*; -import cn.hutool.system.oshi.CpuInfo; -import cn.hutool.system.oshi.OshiUtil; -import com.ruoyi.framework.web.domain.server.*; -import lombok.Data; -import oshi.hardware.GlobalMemory; -import oshi.software.os.FileSystem; -import oshi.software.os.OSFileStore; -import oshi.software.os.OperatingSystem; - -import java.util.LinkedList; -import java.util.List; - -/** - * 服务器相关信息 - * - * @author ruoyi - */ -@Data -public class Server { - private static final int OSHI_WAIT_SECOND = 1000; - - /** - * CPU相关信息 - */ - private Cpu cpu = new Cpu(); - - /** - * 內存相关信息 - */ - private Mem mem = new Mem(); - - /** - * JVM相关信息 - */ - private Jvm jvm = new Jvm(); - - /** - * 服务器相关信息 - */ - private Sys sys = new Sys(); - - /** - * 磁盘相关信息 - */ - private List sysFiles = new LinkedList(); - - - public void copyTo() { - setCpuInfo(); - setMemInfo(); - setSysInfo(); - setJvmInfo(); - setSysFiles(); - } - - /** - * 设置CPU信息 - */ - private void setCpuInfo() { - CpuInfo cpuInfo = OshiUtil.getCpuInfo(OSHI_WAIT_SECOND); - cpu.setCpuNum(cpuInfo.getCpuNum()); - cpu.setTotal(cpuInfo.getToTal()); - cpu.setSys(cpuInfo.getSys()); - cpu.setUsed(cpuInfo.getUsed()); - cpu.setWait(cpuInfo.getWait()); - cpu.setFree(cpuInfo.getFree()); - } - - /** - * 设置内存信息 - */ - private void setMemInfo() { - GlobalMemory memory = OshiUtil.getMemory(); - mem.setTotal(memory.getTotal()); - mem.setUsed(memory.getTotal() - memory.getAvailable()); - mem.setFree(memory.getAvailable()); - } - - /** - * 设置服务器信息 - */ - private void setSysInfo() { - HostInfo hostInfo = SystemUtil.getHostInfo(); - OsInfo osInfo = SystemUtil.getOsInfo(); - UserInfo userInfo = SystemUtil.getUserInfo(); - sys.setComputerName(hostInfo.getName()); - sys.setComputerIp(hostInfo.getAddress()); - sys.setOsName(osInfo.getName()); - sys.setOsArch(osInfo.getArch()); - sys.setUserDir(userInfo.getCurrentDir()); - } - - /** - * 设置Java虚拟机 - */ - private void setJvmInfo() { - JavaInfo javaInfo = SystemUtil.getJavaInfo(); - RuntimeInfo runtimeInfo = SystemUtil.getRuntimeInfo(); - JavaRuntimeInfo javaRuntimeInfo = SystemUtil.getJavaRuntimeInfo(); - jvm.setTotal(runtimeInfo.getTotalMemory()); - jvm.setMax(runtimeInfo.getMaxMemory()); - jvm.setFree(runtimeInfo.getFreeMemory()); - jvm.setVersion(javaInfo.getVersion()); - jvm.setHome(javaRuntimeInfo.getHomeDir()); - } - - /** - * 设置磁盘信息 - */ - private void setSysFiles() { - OperatingSystem os = OshiUtil.getOs(); - FileSystem fileSystem = os.getFileSystem(); - List fsArray = fileSystem.getFileStores(); - for (OSFileStore fs : fsArray) { - long free = fs.getUsableSpace(); - long total = fs.getTotalSpace(); - long used = total - free; - SysFile sysFile = new SysFile(); - sysFile.setDirName(fs.getMount()); - sysFile.setSysTypeName(fs.getType()); - sysFile.setTypeName(fs.getName()); - sysFile.setTotal(convertFileSize(total)); - sysFile.setFree(convertFileSize(free)); - sysFile.setUsed(convertFileSize(used)); - sysFile.setUsage(NumberUtil.mul(NumberUtil.div(used, total, 4), 100)); - sysFiles.add(sysFile); - } - } - - /** - * 字节转换 - * - * @param size 字节大小 - * @return 转换后值 - */ - public String convertFileSize(long size) { - long kb = 1024; - long mb = kb * 1024; - long gb = mb * 1024; - if (size >= gb) { - return String.format("%.1f GB", (float) size / gb); - } else if (size >= mb) { - float f = (float) size / mb; - return String.format(f > 100 ? "%.0f MB" : "%.1f MB", f); - } else if (size >= kb) { - float f = (float) size / kb; - return String.format(f > 100 ? "%.0f KB" : "%.1f KB", f); - } else { - return String.format("%d B", size); - } - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Cpu.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Cpu.java deleted file mode 100644 index 4295f6ee..00000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Cpu.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.ruoyi.framework.web.domain.server; - -import cn.hutool.core.util.NumberUtil; - -/** - * CPU相关信息 - * - * @author ruoyi - */ -public class Cpu { - /** - * 核心数 - */ - private int cpuNum; - - /** - * CPU总的使用率 - */ - private double total; - - /** - * CPU系统使用率 - */ - private double sys; - - /** - * CPU用户使用率 - */ - private double used; - - /** - * CPU当前等待率 - */ - private double wait; - - /** - * CPU当前空闲率 - */ - private double free; - - public int getCpuNum() { - return cpuNum; - } - - public void setCpuNum(int cpuNum) { - this.cpuNum = cpuNum; - } - - public double getTotal() { - return NumberUtil.round(NumberUtil.mul(total, 100), 2).doubleValue(); - } - - public void setTotal(double total) { - this.total = total; - } - - public double getSys() { - return NumberUtil.round(NumberUtil.mul(sys / total, 100), 2).doubleValue(); - } - - public void setSys(double sys) { - this.sys = sys; - } - - public double getUsed() { - return NumberUtil.round(NumberUtil.mul(used / total, 100), 2).doubleValue(); - } - - public void setUsed(double used) { - this.used = used; - } - - public double getWait() { - return NumberUtil.round(NumberUtil.mul(wait / total, 100), 2).doubleValue(); - } - - public void setWait(double wait) { - this.wait = wait; - } - - public double getFree() { - return NumberUtil.round(NumberUtil.mul(free / total, 100), 2).doubleValue(); - } - - public void setFree(double free) { - this.free = free; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Jvm.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Jvm.java deleted file mode 100644 index 4b70cbb8..00000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Jvm.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.ruoyi.framework.web.domain.server; - -import java.lang.management.ManagementFactory; -import java.util.Date; - -import cn.hutool.core.date.BetweenFormatter; -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.NumberUtil; -import com.ruoyi.common.utils.DateUtils; - -/** - * JVM相关信息 - * - * @author ruoyi - */ -public class Jvm { - /** - * 当前JVM占用的内存总数(M) - */ - private double total; - - /** - * JVM最大可用内存总数(M) - */ - private double max; - - /** - * JVM空闲内存(M) - */ - private double free; - - /** - * JDK版本 - */ - private String version; - - /** - * JDK路径 - */ - private String home; - - public double getTotal() { - return NumberUtil.div(total, (1024 * 1024), 2); - } - - public void setTotal(double total) { - this.total = total; - } - - public double getMax() { - return NumberUtil.div(max, (1024 * 1024), 2); - } - - public void setMax(double max) { - this.max = max; - } - - public double getFree() { - return NumberUtil.div(free, (1024 * 1024), 2); - } - - public void setFree(double free) { - this.free = free; - } - - public double getUsed() { - return NumberUtil.div(total - free, (1024 * 1024), 2); - } - - public double getUsage() { - return NumberUtil.mul(NumberUtil.div(total - free, total, 4), 100); - } - - /** - * 获取JDK名称 - */ - public String getName() { - return ManagementFactory.getRuntimeMXBean().getVmName(); - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getHome() { - return home; - } - - public void setHome(String home) { - this.home = home; - } - - /** - * JDK启动时间 - */ - public String getStartTime() - { - return DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.getServerStartDate()); - } - - /** - * JDK运行时间 - */ - public String getRunTime() - { - return DateUtils.getDatePoor(DateUtils.getNowDate(), DateUtils.getServerStartDate()); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Mem.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Mem.java deleted file mode 100644 index 757ff571..00000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Mem.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.ruoyi.framework.web.domain.server; - -import cn.hutool.core.util.NumberUtil; - -/** - * 內存相关信息 - * - * @author ruoyi - */ -public class Mem -{ - /** - * 内存总量 - */ - private double total; - - /** - * 已用内存 - */ - private double used; - - /** - * 剩余内存 - */ - private double free; - - public double getTotal() - { - return NumberUtil.div(total, (1024 * 1024 * 1024), 2); - } - - public void setTotal(long total) - { - this.total = total; - } - - public double getUsed() - { - return NumberUtil.div(used, (1024 * 1024 * 1024), 2); - } - - public void setUsed(long used) - { - this.used = used; - } - - public double getFree() - { - return NumberUtil.div(free, (1024 * 1024 * 1024), 2); - } - - public void setFree(long free) - { - this.free = free; - } - - public double getUsage() - { - return NumberUtil.mul(NumberUtil.div(used, total, 4), 100); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Sys.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Sys.java deleted file mode 100644 index 45d64d9c..00000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Sys.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.ruoyi.framework.web.domain.server; - -/** - * 系统相关信息 - * - * @author ruoyi - */ -public class Sys -{ - /** - * 服务器名称 - */ - private String computerName; - - /** - * 服务器Ip - */ - private String computerIp; - - /** - * 项目路径 - */ - private String userDir; - - /** - * 操作系统 - */ - private String osName; - - /** - * 系统架构 - */ - private String osArch; - - public String getComputerName() - { - return computerName; - } - - public void setComputerName(String computerName) - { - this.computerName = computerName; - } - - public String getComputerIp() - { - return computerIp; - } - - public void setComputerIp(String computerIp) - { - this.computerIp = computerIp; - } - - public String getUserDir() - { - return userDir; - } - - public void setUserDir(String userDir) - { - this.userDir = userDir; - } - - public String getOsName() - { - return osName; - } - - public void setOsName(String osName) - { - this.osName = osName; - } - - public String getOsArch() - { - return osArch; - } - - public void setOsArch(String osArch) - { - this.osArch = osArch; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/SysFile.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/SysFile.java deleted file mode 100644 index 1320cde6..00000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/SysFile.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.ruoyi.framework.web.domain.server; - -/** - * 系统文件相关信息 - * - * @author ruoyi - */ -public class SysFile -{ - /** - * 盘符路径 - */ - private String dirName; - - /** - * 盘符类型 - */ - private String sysTypeName; - - /** - * 文件类型 - */ - private String typeName; - - /** - * 总大小 - */ - private String total; - - /** - * 剩余大小 - */ - private String free; - - /** - * 已经使用量 - */ - private String used; - - /** - * 资源的使用率 - */ - private double usage; - - public String getDirName() - { - return dirName; - } - - public void setDirName(String dirName) - { - this.dirName = dirName; - } - - public String getSysTypeName() - { - return sysTypeName; - } - - public void setSysTypeName(String sysTypeName) - { - this.sysTypeName = sysTypeName; - } - - public String getTypeName() - { - return typeName; - } - - public void setTypeName(String typeName) - { - this.typeName = typeName; - } - - public String getTotal() - { - return total; - } - - public void setTotal(String total) - { - this.total = total; - } - - public String getFree() - { - return free; - } - - public void setFree(String free) - { - this.free = free; - } - - public String getUsed() - { - return used; - } - - public void setUsed(String used) - { - this.used = used; - } - - public double getUsage() - { - return usage; - } - - public void setUsage(double usage) - { - this.usage = usage; - } -} diff --git a/ruoyi-ui/src/views/monitor/server/index.vue b/ruoyi-ui/src/views/monitor/server/index.vue deleted file mode 100644 index 8ba30823..00000000 --- a/ruoyi-ui/src/views/monitor/server/index.vue +++ /dev/null @@ -1,210 +0,0 @@ - - - \ No newline at end of file diff --git a/sql/ry_20210210.sql b/sql/ry_20210210.sql index 8b721ab2..1d8ec367 100644 --- a/sql/ry_20210210.sql +++ b/sql/ry_20210210.sql @@ -173,7 +173,7 @@ insert into sys_menu values('108', '日志管理', '1', '9', 'log', '' insert into sys_menu values('109', '在线用户', '2', '1', 'online', 'monitor/online/index', 1, 0, 'C', '0', '0', 'monitor:online:list', 'online', 'admin', sysdate(), '', null, '在线用户菜单'); insert into sys_menu values('110', '定时任务', '2', '2', 'job', 'monitor/job/index', 1, 0, 'C', '0', '0', 'monitor:job:list', 'job', 'admin', sysdate(), '', null, '定时任务菜单'); insert into sys_menu values('111', '数据监控', '2', '3', 'druid', 'monitor/druid/index', 1, 0, 'C', '0', '0', 'monitor:druid:list', 'druid', 'admin', sysdate(), '', null, '数据监控菜单'); -insert into sys_menu values('112', '服务监控', '2', '4', 'server', 'monitor/server/index', 1, 0, 'C', '0', '0', 'monitor:server:list', 'server', 'admin', sysdate(), '', null, '服务监控菜单'); +# insert into sys_menu values('112', '服务监控', '2', '4', 'server', 'monitor/server/index', 1, 0, 'C', '0', '0', 'monitor:server:list', 'server', 'admin', sysdate(), '', null, '服务监控菜单'); insert into sys_menu values('113', '缓存监控', '2', '5', 'cache', 'monitor/cache/index', 1, 0, 'C', '0', '0', 'monitor:cache:list', 'redis', 'admin', sysdate(), '', null, '缓存监控菜单'); insert into sys_menu values('114', '表单构建', '3', '1', 'build', 'tool/build/index', 1, 0, 'C', '0', '0', 'tool:build:list', 'build', 'admin', sysdate(), '', null, '表单构建菜单'); insert into sys_menu values('115', '代码生成', '3', '2', 'gen', 'tool/gen/index', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', 'admin', sysdate(), '', null, '代码生成菜单'); From 9d94d0fce93f501c563286e49640fc978207c2f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Sat, 15 May 2021 14:25:07 +0800 Subject: [PATCH 03/42] =?UTF-8?q?remove=20=E7=A7=BB=E9=99=A4ruoyi=E8=87=AA?= =?UTF-8?q?=E5=B8=A6=E6=9C=8D=E5=8A=A1=E7=9B=91=E6=8E=A7(Admin=E5=B7=B2?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E5=8C=85=E5=90=AB)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 21 --------------------- ruoyi-framework/pom.xml | 6 ------ 2 files changed, 27 deletions(-) diff --git a/pom.xml b/pom.xml index 3e1b8d6d..03e1b0af 100644 --- a/pom.xml +++ b/pom.xml @@ -22,8 +22,6 @@ 1.2.4 2.0.8 1.2.75 - 5.6.0 - 5.7.0 4.1.2 1.7 0.9.1 @@ -54,25 +52,6 @@ ${druid.version} - - - com.github.oshi - oshi-core - ${oshi.version} - - - - net.java.dev.jna - jna - ${jna.version} - - - - net.java.dev.jna - jna-platform - ${jna.version} - - com.github.xiaoymin knife4j-spring-boot-starter diff --git a/ruoyi-framework/pom.xml b/ruoyi-framework/pom.xml index e51b27f6..3e18105d 100644 --- a/ruoyi-framework/pom.xml +++ b/ruoyi-framework/pom.xml @@ -61,12 +61,6 @@ druid-spring-boot-starter - - - com.github.oshi - oshi-core - - com.ruoyi From ee064fa84c453602c99c092c9abfc700c2b29004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Sat, 15 May 2021 14:25:48 +0800 Subject: [PATCH 04/42] =?UTF-8?q?update=20swagger=E5=8D=87=E7=BA=A73.0.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 15 +- ruoyi-admin/pom.xml | 5 - .../web/controller/tool/TestController.java | 166 ------------------ .../ruoyi/web/core/config/SwaggerConfig.java | 23 +-- ruoyi-common/pom.xml | 10 ++ ruoyi-demo/pom.xml | 5 - 6 files changed, 33 insertions(+), 191 deletions(-) delete mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java diff --git a/pom.xml b/pom.xml index 03e1b0af..edd86213 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,8 @@ 1.8 3.1.1 1.2.4 - 2.0.8 + 3.0.2 + 1.5.22 1.2.75 4.1.2 1.7 @@ -56,6 +57,18 @@ com.github.xiaoymin knife4j-spring-boot-starter ${knife4j.version} + + + swagger-annotations + io.swagger + + + + + + io.swagger + swagger-annotations + ${swagger-annotations.version} diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index 23fd60c0..e51c7dab 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -24,11 +24,6 @@ true - - com.github.xiaoymin - knife4j-spring-boot-starter - - mysql diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java deleted file mode 100644 index 3c5bf7c0..00000000 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java +++ /dev/null @@ -1,166 +0,0 @@ -package com.ruoyi.web.controller.tool; - -import cn.hutool.core.lang.Validator; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import io.swagger.annotations.*; -import org.springframework.web.bind.annotation.*; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -/** - * swagger 用户测试方法 - * - * @author ruoyi - */ -@Api("用户信息管理") -@RestController -@RequestMapping("/test/user") -public class TestController extends BaseController -{ - private final static Map users = new LinkedHashMap(); - { - users.put(1, new UserEntity(1, "admin", "admin123", "15888888888")); - users.put(2, new UserEntity(2, "ry", "admin123", "15666666666")); - } - - @ApiOperation("获取用户列表") - @GetMapping("/list") - public AjaxResult userList() - { - List userList = new ArrayList(users.values()); - return AjaxResult.success(userList); - } - - @ApiOperation("获取用户详细") - @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path") - @GetMapping("/{userId}") - public AjaxResult getUser(@PathVariable Integer userId) - { - if (!users.isEmpty() && users.containsKey(userId)) - { - return AjaxResult.success(users.get(userId)); - } - else - { - return AjaxResult.error("用户不存在"); - } - } - - @ApiOperation("新增用户") - @ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity") - @PostMapping("/save") - public AjaxResult save(UserEntity user) - { - if (Validator.isNull(user) || Validator.isNull(user.getUserId())) - { - return AjaxResult.error("用户ID不能为空"); - } - return AjaxResult.success(users.put(user.getUserId(), user)); - } - - @ApiOperation("更新用户") - @ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity") - @PutMapping("/update") - public AjaxResult update(UserEntity user) - { - if (Validator.isNull(user) || Validator.isNull(user.getUserId())) - { - return AjaxResult.error("用户ID不能为空"); - } - if (users.isEmpty() || !users.containsKey(user.getUserId())) - { - return AjaxResult.error("用户不存在"); - } - users.remove(user.getUserId()); - return AjaxResult.success(users.put(user.getUserId(), user)); - } - - @ApiOperation("删除用户信息") - @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path") - @DeleteMapping("/{userId}") - public AjaxResult delete(@PathVariable Integer userId) - { - if (!users.isEmpty() && users.containsKey(userId)) - { - users.remove(userId); - return AjaxResult.success(); - } - else - { - return AjaxResult.error("用户不存在"); - } - } -} - -@ApiModel("用户实体") -class UserEntity -{ - @ApiModelProperty("用户ID") - private Integer userId; - - @ApiModelProperty("用户名称") - private String username; - - @ApiModelProperty("用户密码") - private String password; - - @ApiModelProperty("用户手机") - private String mobile; - - public UserEntity() - { - - } - - public UserEntity(Integer userId, String username, String password, String mobile) - { - this.userId = userId; - this.username = username; - this.password = password; - this.mobile = mobile; - } - - public Integer getUserId() - { - return userId; - } - - public void setUserId(Integer userId) - { - this.userId = userId; - } - - public String getUsername() - { - return username; - } - - public void setUsername(String username) - { - this.username = username; - } - - public String getPassword() - { - return password; - } - - public void setPassword(String password) - { - this.password = password; - } - - public String getMobile() - { - return mobile; - } - - public void setMobile(String mobile) - { - this.mobile = mobile; - } -} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java index 8a1b74be..39c7786e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java @@ -5,6 +5,8 @@ import com.ruoyi.common.config.RuoYiConfig; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; @@ -14,7 +16,7 @@ import springfox.documentation.service.*; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spi.service.contexts.SecurityContext; import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc; +import springfox.documentation.swagger2.annotations.EnableSwagger2; import java.util.ArrayList; import java.util.List; @@ -25,8 +27,10 @@ import java.util.List; * @author Lion Li */ @Configuration -@EnableSwagger2WebMvc +@EnableSwagger2 @EnableKnife4j +@ConditionalOnClass({Docket.class, ApiInfoBuilder.class}) +@ConditionalOnProperty(prefix = "swagger", value = "enable", matchIfMissing = true) public class SwaggerConfig { /** * 系统基础配置 @@ -34,12 +38,6 @@ public class SwaggerConfig { @Autowired private RuoYiConfig ruoyiConfig; - /** - * 是否开启swagger - */ - @Value("${swagger.enabled}") - private boolean enabled; - /** * 设置请求的统一前缀 */ @@ -70,8 +68,6 @@ public class SwaggerConfig { @Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) - // 是否启用Swagger - .enable(enabled) // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息) .apiInfo(apiInfo()) // 设置哪些接口暴露给Swagger展示 @@ -85,15 +81,14 @@ public class SwaggerConfig { .build() /* 设置安全模式,swagger可以设置访问token */ .securitySchemes(securitySchemes()) - .securityContexts(securityContexts()) - .pathMapping(pathMapping); + .securityContexts(securityContexts()); } /** * 安全模式,这里指定token通过Authorization头请求头传递 */ - private List securitySchemes() { - List apiKeyList = new ArrayList(); + private List securitySchemes() { + List apiKeyList = new ArrayList(); apiKeyList.add(new ApiKey("Authorization", "Authorization", "header")); return apiKeyList; } diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index a18e8013..9ba4b2a3 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -131,6 +131,16 @@ spring-boot-admin-starter-client + + com.github.xiaoymin + knife4j-spring-boot-starter + + + + io.swagger + swagger-annotations + + \ No newline at end of file diff --git a/ruoyi-demo/pom.xml b/ruoyi-demo/pom.xml index 9789455e..49049244 100644 --- a/ruoyi-demo/pom.xml +++ b/ruoyi-demo/pom.xml @@ -23,11 +23,6 @@ ruoyi-common - - com.github.xiaoymin - knife4j-spring-boot-starter - - \ No newline at end of file From 69b9a4db2b76d201f92c2f98114fd13cf6ef4e71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Sat, 15 May 2021 14:27:29 +0800 Subject: [PATCH 05/42] =?UTF-8?q?update=20=E9=80=9A=E7=94=A8Service?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=20=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89vo=E8=BD=AC=E6=8D=A2=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/common/core/page/IServicePlus.java | 114 +++++++++++++++++- .../com/ruoyi/common/core/page/PagePlus.java | 93 ++++++++------ 2 files changed, 164 insertions(+), 43 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/IServicePlus.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/IServicePlus.java index 864a38e8..aeaee0b5 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/IServicePlus.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/IServicePlus.java @@ -9,6 +9,7 @@ import java.io.Serializable; import java.util.Collection; import java.util.List; import java.util.Map; +import java.util.function.Function; import java.util.stream.Collectors; /** @@ -30,6 +31,18 @@ public interface IServicePlus extends IService { return BeanUtil.toBean(t, kClass); } + /** + * 根据 ID 查询 + * + * @param id 主键ID + * @param convertor 转换函数 + * @param vo类型 + */ + default K getVoById(Serializable id, Function convertor) { + T t = getBaseMapper().selectById(id); + return convertor.apply(t); + } + /** * 查询(根据ID 批量查询) * @@ -46,6 +59,21 @@ public interface IServicePlus extends IService { .collect(Collectors.toList()); } + /** + * 查询(根据ID 批量查询) + * + * @param convertor 转换函数 + * @param idList 主键ID列表 + */ + default List listVoByIds(Collection idList, + Function, List> convertor) { + List list = getBaseMapper().selectBatchIds(idList); + if (list == null) { + return null; + } + return convertor.apply(list); + } + /** * 查询(根据 columnMap 条件) * @@ -62,6 +90,21 @@ public interface IServicePlus extends IService { .collect(Collectors.toList()); } + /** + * 查询(根据 columnMap 条件) + * + * @param convertor 转换函数 + * @param columnMap 表字段 map 对象 + */ + default List listVoByMap(Map columnMap, + Function, List> convertor) { + List list = getBaseMapper().selectByMap(columnMap); + if (list == null) { + return null; + } + return convertor.apply(list); + } + /** * 根据 Wrapper,查询一条记录
*

结果集,如果是多个会抛出异常,随机取一条加上限制条件 wrapper.last("LIMIT 1")

@@ -73,6 +116,17 @@ public interface IServicePlus extends IService { return BeanUtil.toBean(getOne(queryWrapper, true), kClass); } + /** + * 根据 Wrapper,查询一条记录
+ *

结果集,如果是多个会抛出异常,随机取一条加上限制条件 wrapper.last("LIMIT 1")

+ * + * @param convertor 转换函数 + * @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper} + */ + default K getVoOne(Wrapper queryWrapper, Function convertor) { + return convertor.apply(getOne(queryWrapper, true)); + } + /** * 查询列表 * @@ -89,6 +143,20 @@ public interface IServicePlus extends IService { .collect(Collectors.toList()); } + /** + * 查询列表 + * + * @param convertor 转换函数 + * @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper} + */ + default List listVo(Wrapper queryWrapper, Function, List> convertor) { + List list = getBaseMapper().selectList(queryWrapper); + if (list == null) { + return null; + } + return convertor.apply(list); + } + /** * 查询所有 * @@ -99,28 +167,64 @@ public interface IServicePlus extends IService { return listVo(Wrappers.emptyWrapper(), kClass); } + /** + * 查询所有 + * + * @param convertor 转换函数 + * @see Wrappers#emptyWrapper() + */ + default List listVo(Function, List> convertor) { + return listVo(Wrappers.emptyWrapper(), convertor); + } + /** * 翻页查询 * * @param page 翻页对象 * @param queryWrapper 实体对象封装操作类 - * @param kClass vo类型 + * @param kClass vo类型 */ default PagePlus pageVo(PagePlus page, Wrapper queryWrapper, Class kClass) { - PagePlus e = getBaseMapper().selectPage(page, queryWrapper); - page.recordsToVo(kClass); - return page; + PagePlus result = getBaseMapper().selectPage(page, queryWrapper); + List volist = result.getRecords().stream() + .map(any -> BeanUtil.toBean(any, kClass)) + .collect(Collectors.toList()); + result.setRecordsVo(volist); + return result; + } + + /** + * 翻页查询 + * + * @param page 翻页对象 + * @param queryWrapper 实体对象封装操作类 + * @param convertor 转换函数 + */ + default PagePlus pageVo(PagePlus page, Wrapper queryWrapper, + Function, List> convertor) { + PagePlus result = getBaseMapper().selectPage(page, queryWrapper); + return result.setRecordsVo(convertor.apply(result.getRecords())); } /** * 无条件翻页查询 * - * @param page 翻页对象 + * @param page 翻页对象 * @param kClass vo类型 */ default PagePlus pageVo(PagePlus page, Class kClass) { return pageVo(page, Wrappers.emptyWrapper(), kClass); } + /** + * 无条件翻页查询 + * + * @param page 翻页对象 + * @param convertor 转换函数 + */ + default PagePlus pageVo(PagePlus page, Function, List> convertor) { + return pageVo(page, Wrappers.emptyWrapper(), convertor); + } + } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java index 7200fc51..889d549f 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java @@ -1,6 +1,5 @@ package com.ruoyi.common.core.page; -import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.OrderItem; import lombok.Data; @@ -10,34 +9,67 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.stream.Collectors; @Data @Accessors(chain = true) public class PagePlus implements IPage { - protected List records; - protected List recordsVo; - protected long total; - protected long size; - protected long current; - protected List orders; - protected boolean optimizeCountSql; - protected boolean isSearchCount; - protected boolean hitCount; - protected String countId; - protected Long maxLimit; + /** + * domain实体列表 + */ + private List records = Collections.emptyList(); + + /** + * vo实体列表 + */ + private List recordsVo = Collections.emptyList(); + + /** + * 总数 + */ + private long total = 0L; + + /** + * 页长度 + */ + private long size = 10L; + + /** + * 当前页 + */ + private long current = 1L; + + /** + * 排序字段信息 + */ + private List orders = new ArrayList<>(); + + /** + * 自动优化 COUNT SQL + */ + private boolean optimizeCountSql = true; + + /** + * 是否进行 count 查询 + */ + private boolean isSearchCount = true; + + /** + * 是否命中count缓存 + */ + private boolean hitCount = false; + + /** + * countId + */ + private String countId; + + /** + * 最大limit + */ + private Long maxLimit; public PagePlus() { - this.records = Collections.emptyList(); - this.recordsVo = Collections.emptyList(); - this.total = 0L; - this.size = 10L; - this.current = 1L; - this.orders = new ArrayList(); - this.optimizeCountSql = true; - this.isSearchCount = true; - this.hitCount = false; } public PagePlus(long current, long size) { @@ -53,18 +85,9 @@ public class PagePlus implements IPage { } public PagePlus(long current, long size, long total, boolean isSearchCount) { - this.records = Collections.emptyList(); - this.total = 0L; - this.size = 10L; - this.current = 1L; - this.orders = new ArrayList(); - this.optimizeCountSql = true; - this.isSearchCount = true; - this.hitCount = false; if (current > 1L) { this.current = current; } - this.size = size; this.total = total; this.isSearchCount = isSearchCount; @@ -78,12 +101,6 @@ public class PagePlus implements IPage { return this.current < this.getPages(); } - public void recordsToVo(Class kClass) { - this.recordsVo = this.records.stream() - .map(any -> BeanUtil.toBean(any, kClass)) - .collect(Collectors.toList()); - } - @Override public String countId() { return this.getCountId(); @@ -116,7 +133,7 @@ public class PagePlus implements IPage { @Override public boolean isSearchCount() { - return this.total < 0L ? false : this.isSearchCount; + return this.total >= 0L && this.isSearchCount; } public PagePlus setSearchCount(boolean isSearchCount) { From b885e1eeff6b9efde7fd4bfdb3ae11edc88c41b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Sat, 15 May 2021 14:33:53 +0800 Subject: [PATCH 06/42] =?UTF-8?q?=E5=8F=91=E5=B8=83=20v2.1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- pom.xml | 2 +- ruoyi-ui/package.json | 2 +- ruoyi-ui/src/views/index.vue | 10 +++++++++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 277f48de..a98bde53 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ * 升级 swagger 为 knife4j * 集成 Hutool 5.X 并重写RuoYi部分功能 * 集成 Feign 接口化管理 Http 请求(如三方请求 支付,短信,推送等) -* 集成 spring-boot-admin 全方位监控 +* 移除 自带服务监控 改为 spring-boot-admin 全方位监控 * 增加 demo 模块示例(给不会增加模块的小伙伴做参考) ### 代码改动 diff --git a/pom.xml b/pom.xml index edd86213..62930f9f 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ RuoYi-Vue-Plus后台管理系统 - 2.0.0 + 2.1.0 2.3.10.RELEASE UTF-8 UTF-8 diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index 313d7211..0ac7e155 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -1,6 +1,6 @@ { "name": "ruoyi-vue-plus", - "version": "2.0.0", + "version": "2.1.0", "description": "RuoYi-Vue-Plus后台管理系统", "author": "LionLi", "license": "MIT", diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index 84921bce..9cee59a1 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -80,6 +80,14 @@ 更新日志 + +
    +
  1. update swagger升级3.0.2
  2. +
  3. update 增强分页工具兼容性
  4. +
  5. update 通用Service接口 增加自定义vo转换函数
  6. +
  7. remove 移除ruoyi自带服务监控(Admin已全部包含)
  8. +
+
  1. springboot 升级 2.3.10 依赖全面升级适配
  2. @@ -140,7 +148,7 @@ export default { data() { return { // 版本号 - version: "2.0.0", + version: "2.1.0", }; }, methods: { From b366f8b05393dbb947dd46a2d35e923b94c05541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Sat, 15 May 2021 14:55:21 +0800 Subject: [PATCH 07/42] =?UTF-8?q?update=20=E4=BF=AE=E6=AD=A3=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E8=AF=B4=E6=98=8E=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/views/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index 9cee59a1..0b00abde 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -82,7 +82,7 @@
      -
    1. update swagger升级3.0.2
    2. +
    3. update knife4j升级3.0.2
    4. update 增强分页工具兼容性
    5. update 通用Service接口 增加自定义vo转换函数
    6. remove 移除ruoyi自带服务监控(Admin已全部包含)
    7. From 87164d574efbc5bc89f13575cbbafb43d7aedb61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Sun, 16 May 2021 09:25:19 +0800 Subject: [PATCH 08/42] =?UTF-8?q?update=20=E5=88=A0=E9=99=A4=E8=BF=87?= =?UTF-8?q?=E6=9C=9F=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ruoyi/common/core/page/PagePlus.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java index 889d549f..2bffe305 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java @@ -93,14 +93,6 @@ public class PagePlus implements IPage { this.isSearchCount = isSearchCount; } - public boolean hasPrevious() { - return this.current > 1L; - } - - public boolean hasNext() { - return this.current < this.getPages(); - } - @Override public String countId() { return this.getCountId(); From 5bc6057050fc1a8f6b06972fe4fa6887fa0eb423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Sun, 16 May 2021 10:29:13 +0800 Subject: [PATCH 09/42] =?UTF-8?q?fix=20maven=20install=20=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 5 ----- ruoyi-common/pom.xml | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 62930f9f..60932af9 100644 --- a/pom.xml +++ b/pom.xml @@ -138,11 +138,6 @@ ${spring-boot-admin.version} - - org.springframework.boot - spring-boot-starter-actuator - - com.ruoyi diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 9ba4b2a3..2391586b 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -141,6 +141,11 @@ swagger-annotations + + org.springframework.boot + spring-boot-starter-actuator + + \ No newline at end of file From 89fa1dff09d953649fbf778a2b9c10a9d9e60040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Sun, 16 May 2021 10:42:47 +0800 Subject: [PATCH 10/42] =?UTF-8?q?update=20admin=20=E5=AE=9E=E6=97=B6?= =?UTF-8?q?=E7=9B=91=E6=8E=A7=E6=97=A5=E5=BF=97=20=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E4=BF=9D=E7=95=99=E4=B8=80=E5=A4=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-admin/src/main/resources/logback.xml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ruoyi-admin/src/main/resources/logback.xml b/ruoyi-admin/src/main/resources/logback.xml index d407df43..c939785e 100644 --- a/ruoyi-admin/src/main/resources/logback.xml +++ b/ruoyi-admin/src/main/resources/logback.xml @@ -14,8 +14,14 @@ - + ${log.path}/sys-console.log + + + ${log.path}/sys-console.%d{yyyy-MM-dd}.log + + 1 + ${log.pattern} utf-8 From 2ebcffb22ef17421b322e58a0f2b96388a4d83cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Mon, 17 May 2021 13:39:59 +0800 Subject: [PATCH 11/42] =?UTF-8?q?update=20=E9=85=8D=E7=BD=AE=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E6=8F=90=E5=8F=96=E4=B8=BA=20properties=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/common/CaptchaController.java | 29 +++---- .../src/main/resources/application.yml | 12 ++- ruoyi-common/pom.xml | 5 ++ .../ruoyi/framework/config/FilterConfig.java | 33 +++----- .../framework}/config/SwaggerConfig.java | 8 +- .../framework/config/ThreadPoolConfig.java | 55 +++++-------- .../config/properties/CaptchaProperties.java | 24 ++++++ .../config/properties/DruidProperties.java | 64 +++++---------- .../config/properties/SwaggerProperties.java | 36 ++++++++ .../properties/ThreadPoolProperties.java | 47 +++++++++++ .../config/properties/TokenProperties.java | 26 ++++++ .../config/properties/XssProperties.java | 32 ++++++++ .../framework/web/service/TokenService.java | 82 +++++++------------ 13 files changed, 270 insertions(+), 183 deletions(-) rename {ruoyi-admin/src/main/java/com/ruoyi/web/core => ruoyi-framework/src/main/java/com/ruoyi/framework}/config/SwaggerConfig.java (96%) create mode 100644 ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/CaptchaProperties.java create mode 100644 ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java create mode 100644 ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/ThreadPoolProperties.java create mode 100644 ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/TokenProperties.java create mode 100644 ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/XssProperties.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java index 48e4e4ec..c01cc4ed 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java @@ -13,8 +13,8 @@ import cn.hutool.core.util.StrUtil; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.framework.config.properties.CaptchaProperties; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @@ -42,18 +42,8 @@ public class CaptchaController { @Autowired private RedisCache redisCache; - // 验证码类型 - @Value("${captcha.captchaType}") - private String captchaType; - // 验证码类别 - @Value("${captcha.captchaCategory}") - private String captchaCategory; - // 数字验证码位数 - @Value("${captcha.captchaNumberLength}") - private int numberLength; - // 字符验证码长度 - @Value("${captcha.captchaCharLength}") - private int charLength; + @Autowired + private CaptchaProperties captchaProperties; /** * 生成验证码 @@ -67,17 +57,17 @@ public class CaptchaController { // 生成验证码 CodeGenerator codeGenerator; AbstractCaptcha captcha; - switch (captchaType) { + switch (captchaProperties.getType()) { case "math": - codeGenerator = new MathGenerator(numberLength); + codeGenerator = new MathGenerator(captchaProperties.getNumberLength()); break; case "char": - codeGenerator = new RandomGenerator(charLength); + codeGenerator = new RandomGenerator(captchaProperties.getCharLength()); break; default: throw new IllegalArgumentException("验证码类型异常"); } - switch (captchaCategory) { + switch (captchaProperties.getCategory()) { case "line": captcha = lineCaptcha; break; @@ -92,9 +82,9 @@ public class CaptchaController { } captcha.setGenerator(codeGenerator); captcha.createCode(); - if ("math".equals(captchaType)) { + if ("math".equals(captchaProperties.getType())) { code = getCodeResult(captcha.getCode()); - } else if ("char".equals(captchaType)) { + } else if ("char".equals(captchaProperties.getType())) { code = captcha.getCode(); } redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); @@ -105,6 +95,7 @@ public class CaptchaController { } private String getCodeResult(String capStr) { + int numberLength = captchaProperties.getNumberLength(); int a = Convert.toInt(StrUtil.sub(capStr, 0, numberLength).trim()); char operator = capStr.charAt(numberLength); int b = Convert.toInt(StrUtil.sub(capStr, numberLength + 1, numberLength + 1 + numberLength).trim()); diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 4f6d8766..d0728723 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -15,13 +15,13 @@ ruoyi: captcha: # 验证码类型 math 数组计算 char 字符验证 - captchaType: math + type: math # line 线段干扰 circle 圆圈干扰 shear 扭曲干扰 - captchaCategory: circle + category: circle # 数字验证码位数 - captchaNumberLength: 1 + numberLength: 1 # 字符验证码长度 - captchaCharLength: 4 + charLength: 4 # 开发环境配置 server: @@ -187,8 +187,6 @@ mybatis-plus: swagger: # 是否开启swagger enabled: true - # 请求前缀 - pathMapping: /dev-api # 标题 title: '标题:RuoYi-Vue-Plus后台管理系统_接口文档' # 描述 @@ -206,7 +204,7 @@ xss: urlPatterns: /system/*,/monitor/*,/tool/* # 全局线程池相关配置 -threadPoolConfig: +thread-pool: # 是否开启线程池 enabled: false # 核心线程池大小 diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 2391586b..4e990764 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -145,6 +145,11 @@ org.springframework.boot spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-configuration-processor + diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FilterConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FilterConfig.java index 4626aa1c..73f7f936 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FilterConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FilterConfig.java @@ -3,7 +3,8 @@ package com.ruoyi.framework.config; import cn.hutool.core.util.StrUtil; import com.ruoyi.common.filter.RepeatableFilter; import com.ruoyi.common.filter.XssFilter; -import org.springframework.beans.factory.annotation.Value; +import com.ruoyi.framework.config.properties.XssProperties; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -15,41 +16,33 @@ import java.util.Map; /** * Filter配置 * - * @author ruoyi + * @author Lion Li */ @Configuration -public class FilterConfig -{ - @Value("${xss.enabled}") - private String enabled; +public class FilterConfig { - @Value("${xss.excludes}") - private String excludes; + @Autowired + private XssProperties xssProperties; - @Value("${xss.urlPatterns}") - private String urlPatterns; - - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) @Bean - public FilterRegistrationBean xssFilterRegistration() - { + public FilterRegistrationBean xssFilterRegistration() { FilterRegistrationBean registration = new FilterRegistrationBean(); registration.setDispatcherTypes(DispatcherType.REQUEST); registration.setFilter(new XssFilter()); - registration.addUrlPatterns(StrUtil.split(urlPatterns, ",")); + registration.addUrlPatterns(StrUtil.split(xssProperties.getUrlPatterns(), ",")); registration.setName("xssFilter"); registration.setOrder(FilterRegistrationBean.HIGHEST_PRECEDENCE); Map initParameters = new HashMap(); - initParameters.put("excludes", excludes); - initParameters.put("enabled", enabled); + initParameters.put("excludes", xssProperties.getExcludes()); + initParameters.put("enabled", xssProperties.getEnabled()); registration.setInitParameters(initParameters); return registration; } - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) @Bean - public FilterRegistrationBean someFilterRegistration() - { + public FilterRegistrationBean someFilterRegistration() { FilterRegistrationBean registration = new FilterRegistrationBean(); registration.setFilter(new RepeatableFilter()); registration.addUrlPatterns("/*"); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java similarity index 96% rename from ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java rename to ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java index 39c7786e..8b43f172 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java @@ -1,4 +1,4 @@ -package com.ruoyi.web.core.config; +package com.ruoyi.framework.config; import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; import com.ruoyi.common.config.RuoYiConfig; @@ -38,12 +38,6 @@ public class SwaggerConfig { @Autowired private RuoYiConfig ruoyiConfig; - /** - * 设置请求的统一前缀 - */ - @Value("${swagger.pathMapping}") - private String pathMapping; - /** * 标题 */ diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java index 30d5ef91..10483832 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java @@ -1,8 +1,9 @@ package com.ruoyi.framework.config; import com.ruoyi.common.utils.Threads; +import com.ruoyi.framework.config.properties.ThreadPoolProperties; import org.apache.commons.lang3.concurrent.BasicThreadFactory; -import org.springframework.beans.factory.annotation.Value; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -21,43 +22,31 @@ import java.util.concurrent.ThreadPoolExecutor; @Configuration public class ThreadPoolConfig { - // 核心线程池大小 - @Value("${threadPoolConfig.corePoolSize}") - private int corePoolSize; - - // 最大可创建的线程数 - @Value("${threadPoolConfig.maxPoolSize}") - private int maxPoolSize; - - // 队列最大长度 - @Value("${threadPoolConfig.queueCapacity}") - private int queueCapacity; - - // 线程池维护线程所允许的空闲时间 - @Value("${threadPoolConfig.keepAliveSeconds}") - private int keepAliveSeconds; - - // 线程池对拒绝任务(无线程可用)的处理策略 - @Value("${threadPoolConfig.rejectedExecutionHandler}") - private String rejectedExecutionHandler; + @Autowired + private ThreadPoolProperties threadPoolProperties; @Bean(name = "threadPoolTaskExecutor") @ConditionalOnProperty(prefix = "threadPoolTaskExecutor", name = "enabled", havingValue = "true") public ThreadPoolTaskExecutor threadPoolTaskExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); - executor.setMaxPoolSize(maxPoolSize); - executor.setCorePoolSize(corePoolSize); - executor.setQueueCapacity(queueCapacity); - executor.setKeepAliveSeconds(keepAliveSeconds); + executor.setMaxPoolSize(threadPoolProperties.getMaxPoolSize()); + executor.setCorePoolSize(threadPoolProperties.getCorePoolSize()); + executor.setQueueCapacity(threadPoolProperties.getQueueCapacity()); + executor.setKeepAliveSeconds(threadPoolProperties.getKeepAliveSeconds()); RejectedExecutionHandler handler; - if (rejectedExecutionHandler.equals("CallerRunsPolicy")) { - handler = new ThreadPoolExecutor.CallerRunsPolicy(); - } else if (rejectedExecutionHandler.equals("DiscardOldestPolicy")) { - handler = new ThreadPoolExecutor.DiscardOldestPolicy(); - } else if (rejectedExecutionHandler.equals("DiscardPolicy")) { - handler = new ThreadPoolExecutor.DiscardPolicy(); - } else { - handler = new ThreadPoolExecutor.AbortPolicy(); + switch (threadPoolProperties.getRejectedExecutionHandler()) { + case "CallerRunsPolicy": + handler = new ThreadPoolExecutor.CallerRunsPolicy(); + break; + case "DiscardOldestPolicy": + handler = new ThreadPoolExecutor.DiscardOldestPolicy(); + break; + case "DiscardPolicy": + handler = new ThreadPoolExecutor.DiscardPolicy(); + break; + default: + handler = new ThreadPoolExecutor.AbortPolicy(); + break; } executor.setRejectedExecutionHandler(handler); return executor; @@ -68,7 +57,7 @@ public class ThreadPoolConfig { */ @Bean(name = "scheduledExecutorService") protected ScheduledExecutorService scheduledExecutorService() { - return new ScheduledThreadPoolExecutor(corePoolSize, + return new ScheduledThreadPoolExecutor(threadPoolProperties.getCorePoolSize(), new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build()) { @Override protected void afterExecute(Runnable r, Throwable t) { diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/CaptchaProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/CaptchaProperties.java new file mode 100644 index 00000000..24356bca --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/CaptchaProperties.java @@ -0,0 +1,24 @@ +package com.ruoyi.framework.config.properties; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * 验证码 配置属性 + * + * @author Lion Li + */ +@Data +@Component +@ConfigurationProperties(prefix = "captcha") +public class CaptchaProperties { + // 验证码类型 + private String type; + // 验证码类别 + private String category; + // 数字验证码位数 + private Integer numberLength; + // 字符验证码长度 + private Integer charLength; +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/DruidProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/DruidProperties.java index 84f7e009..03ddc2c5 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/DruidProperties.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/DruidProperties.java @@ -1,76 +1,54 @@ package com.ruoyi.framework.config.properties; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Configuration; import com.alibaba.druid.pool.DruidDataSource; +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; /** * druid 配置属性 - * - * @author ruoyi + * + * @author Lion Li */ +@Data @Configuration -public class DruidProperties -{ - @Value("${spring.datasource.druid.initialSize}") +@ConfigurationProperties(prefix = "spring.datasource.druid") +public class DruidProperties { + + /** 初始连接数 */ private int initialSize; - - @Value("${spring.datasource.druid.minIdle}") + /** 最小连接池数量 */ private int minIdle; - - @Value("${spring.datasource.druid.maxActive}") + /** 最大连接池数量 */ private int maxActive; - - @Value("${spring.datasource.druid.maxWait}") + /** 配置获取连接等待超时的时间 */ private int maxWait; - - @Value("${spring.datasource.druid.timeBetweenEvictionRunsMillis}") + /** 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 */ private int timeBetweenEvictionRunsMillis; - - @Value("${spring.datasource.druid.minEvictableIdleTimeMillis}") + /** 配置一个连接在池中最小生存的时间,单位是毫秒 */ private int minEvictableIdleTimeMillis; - - @Value("${spring.datasource.druid.maxEvictableIdleTimeMillis}") + /** 配置一个连接在池中最大生存的时间,单位是毫秒 */ private int maxEvictableIdleTimeMillis; - - @Value("${spring.datasource.druid.validationQuery}") + /** 配置检测连接是否有效 */ private String validationQuery; - - @Value("${spring.datasource.druid.testWhileIdle}") + /** 初始连接数 */ private boolean testWhileIdle; - - @Value("${spring.datasource.druid.testOnBorrow}") + /** 初始连接数 */ private boolean testOnBorrow; - - @Value("${spring.datasource.druid.testOnReturn}") + /** 初始连接数 */ private boolean testOnReturn; - public DruidDataSource dataSource(DruidDataSource datasource) - { - /** 配置初始化大小、最小、最大 */ + public DruidDataSource dataSource(DruidDataSource datasource) { datasource.setInitialSize(initialSize); datasource.setMaxActive(maxActive); datasource.setMinIdle(minIdle); - - /** 配置获取连接等待超时的时间 */ datasource.setMaxWait(maxWait); - - /** 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 */ datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); - - /** 配置一个连接在池中最小、最大生存的时间,单位是毫秒 */ datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis); datasource.setMaxEvictableIdleTimeMillis(maxEvictableIdleTimeMillis); - - /** - * 用来检测连接是否有效的sql,要求是一个查询语句,常用select 'x'。如果validationQuery为null,testOnBorrow、testOnReturn、testWhileIdle都不会起作用。 - */ datasource.setValidationQuery(validationQuery); - /** 建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。 */ datasource.setTestWhileIdle(testWhileIdle); - /** 申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 */ datasource.setTestOnBorrow(testOnBorrow); - /** 归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 */ datasource.setTestOnReturn(testOnReturn); return datasource; } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java new file mode 100644 index 00000000..4a37fbc6 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java @@ -0,0 +1,36 @@ +package com.ruoyi.framework.config.properties; + +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * 验证码 配置属性 + * + * @author Lion Li + */ +@Data +@Component +@ConfigurationProperties(prefix = "swagger") +public class SwaggerProperties { + + /** + * 验证码类型 + */ + private Boolean enabled; + /** + * 验证码类别 + */ + private String title; + /** + * 数字验证码位数 + */ + private String description; + /** + * 字符验证码长度 + */ + private String version; + +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/ThreadPoolProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/ThreadPoolProperties.java new file mode 100644 index 00000000..68cb0933 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/ThreadPoolProperties.java @@ -0,0 +1,47 @@ +package com.ruoyi.framework.config.properties; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * 验证码 配置属性 + * + * @author Lion Li + */ +@Data +@Component +@ConfigurationProperties(prefix = "thread-pool") +public class ThreadPoolProperties { + + /** + * 是否开启线程池 + */ + private boolean enabled; + + /** + * 核心线程池大小 + */ + private int corePoolSize; + + /** + * 最大可创建的线程数 + */ + private int maxPoolSize; + + /** + * 队列最大长度 + */ + private int queueCapacity; + + /** + * 线程池维护线程所允许的空闲时间 + */ + private int keepAliveSeconds; + + /** + * 线程池对拒绝任务(无线程可用)的处理策略 + */ + private String rejectedExecutionHandler; + +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/TokenProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/TokenProperties.java new file mode 100644 index 00000000..d582e540 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/TokenProperties.java @@ -0,0 +1,26 @@ +package com.ruoyi.framework.config.properties; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@Data +@Component +@ConfigurationProperties(prefix = "token") +public class TokenProperties { + + /** + * 令牌自定义标识 + */ + private String header; + + /** + * 令牌秘钥 + */ + private String secret; + + /** + * 令牌有效期(默认30分钟) + */ + private int expireTime; +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/XssProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/XssProperties.java new file mode 100644 index 00000000..35ae2e4f --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/XssProperties.java @@ -0,0 +1,32 @@ +package com.ruoyi.framework.config.properties; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * 验证码 配置属性 + * + * @author Lion Li + */ +@Data +@Component +@ConfigurationProperties(prefix = "xss") +public class XssProperties { + + /** + * 过滤开关 + */ + private String enabled; + + /** + * 排除链接(多个用逗号分隔) + */ + private String excludes; + + /** + * 匹配链接 + */ + private String urlPatterns; + +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java index c55078de..0db777bc 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java @@ -10,11 +10,11 @@ import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.ip.AddressUtils; import com.ruoyi.common.utils.ip.IpUtils; +import com.ruoyi.framework.config.properties.TokenProperties; import io.jsonwebtoken.Claims; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletRequest; @@ -25,22 +25,10 @@ import java.util.concurrent.TimeUnit; /** * token验证处理 * - * @author ruoyi + * @author Lion Li */ @Component -public class TokenService -{ - // 令牌自定义标识 - @Value("${token.header}") - private String header; - - // 令牌秘钥 - @Value("${token.secret}") - private String secret; - - // 令牌有效期(默认30分钟) - @Value("${token.expireTime}") - private int expireTime; +public class TokenService { protected static final long MILLIS_SECOND = 1000; @@ -51,17 +39,18 @@ public class TokenService @Autowired private RedisCache redisCache; + @Autowired + private TokenProperties tokenProperties; + /** * 获取用户身份信息 * * @return 用户信息 */ - public LoginUser getLoginUser(HttpServletRequest request) - { + public LoginUser getLoginUser(HttpServletRequest request) { // 获取请求携带的令牌 String token = getToken(request); - if (Validator.isNotEmpty(token)) - { + if (Validator.isNotEmpty(token)) { Claims claims = parseToken(token); // 解析对应的权限以及用户信息 String uuid = (String) claims.get(Constants.LOGIN_USER_KEY); @@ -75,10 +64,8 @@ public class TokenService /** * 设置用户身份信息 */ - public void setLoginUser(LoginUser loginUser) - { - if (Validator.isNotNull(loginUser) && Validator.isNotEmpty(loginUser.getToken())) - { + public void setLoginUser(LoginUser loginUser) { + if (Validator.isNotNull(loginUser) && Validator.isNotEmpty(loginUser.getToken())) { refreshToken(loginUser); } } @@ -86,10 +73,8 @@ public class TokenService /** * 删除用户身份信息 */ - public void delLoginUser(String token) - { - if (Validator.isNotEmpty(token)) - { + public void delLoginUser(String token) { + if (Validator.isNotEmpty(token)) { String userKey = getTokenKey(token); redisCache.deleteObject(userKey); } @@ -101,8 +86,7 @@ public class TokenService * @param loginUser 用户信息 * @return 令牌 */ - public String createToken(LoginUser loginUser) - { + public String createToken(LoginUser loginUser) { String token = IdUtil.fastUUID(); loginUser.setToken(token); setUserAgent(loginUser); @@ -119,12 +103,10 @@ public class TokenService * @param loginUser * @return 令牌 */ - public void verifyToken(LoginUser loginUser) - { + public void verifyToken(LoginUser loginUser) { long expireTime = loginUser.getExpireTime(); long currentTime = System.currentTimeMillis(); - if (expireTime - currentTime <= MILLIS_MINUTE_TEN) - { + if (expireTime - currentTime <= MILLIS_MINUTE_TEN) { refreshToken(loginUser); } } @@ -134,13 +116,12 @@ public class TokenService * * @param loginUser 登录信息 */ - public void refreshToken(LoginUser loginUser) - { + public void refreshToken(LoginUser loginUser) { loginUser.setLoginTime(System.currentTimeMillis()); - loginUser.setExpireTime(loginUser.getLoginTime() + expireTime * MILLIS_MINUTE); + loginUser.setExpireTime(loginUser.getLoginTime() + tokenProperties.getExpireTime() * MILLIS_MINUTE); // 根据uuid将loginUser缓存 String userKey = getTokenKey(loginUser.getToken()); - redisCache.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES); + redisCache.setCacheObject(userKey, loginUser, tokenProperties.getExpireTime(), TimeUnit.MINUTES); } /** @@ -148,8 +129,7 @@ public class TokenService * * @param loginUser 登录信息 */ - public void setUserAgent(LoginUser loginUser) - { + public void setUserAgent(LoginUser loginUser) { UserAgent userAgent = UserAgentUtil.parse(ServletUtils.getRequest().getHeader("User-Agent")); String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); loginUser.setIpaddr(ip); @@ -164,11 +144,10 @@ public class TokenService * @param claims 数据声明 * @return 令牌 */ - private String createToken(Map claims) - { + private String createToken(Map claims) { String token = Jwts.builder() .setClaims(claims) - .signWith(SignatureAlgorithm.HS512, secret).compact(); + .signWith(SignatureAlgorithm.HS512, tokenProperties.getSecret()).compact(); return token; } @@ -178,10 +157,9 @@ public class TokenService * @param token 令牌 * @return 数据声明 */ - private Claims parseToken(String token) - { + private Claims parseToken(String token) { return Jwts.parser() - .setSigningKey(secret) + .setSigningKey(tokenProperties.getSecret()) .parseClaimsJws(token) .getBody(); } @@ -192,8 +170,7 @@ public class TokenService * @param token 令牌 * @return 用户名 */ - public String getUsernameFromToken(String token) - { + public String getUsernameFromToken(String token) { Claims claims = parseToken(token); return claims.getSubject(); } @@ -204,18 +181,15 @@ public class TokenService * @param request * @return token */ - private String getToken(HttpServletRequest request) - { - String token = request.getHeader(header); - if (Validator.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX)) - { + private String getToken(HttpServletRequest request) { + String token = request.getHeader(tokenProperties.getHeader()); + if (Validator.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX)) { token = token.replace(Constants.TOKEN_PREFIX, ""); } return token; } - private String getTokenKey(String uuid) - { + private String getTokenKey(String uuid) { return Constants.LOGIN_TOKEN_KEY + uuid; } } From b43170326290e271ad1a57a0912203c3115321bb Mon Sep 17 00:00:00 2001 From: RuoYi Date: Mon, 17 May 2021 15:37:58 +0800 Subject: [PATCH 12/42] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E4=B9=8B=E5=90=8E=E6=B7=BB=E5=8A=A0=E9=81=AE?= =?UTF-8?q?=E7=BD=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/views/monitor/job/index.vue | 7 ++++++- ruoyi-ui/src/views/monitor/job/log.vue | 7 ++++++- ruoyi-ui/src/views/monitor/logininfor/index.vue | 7 ++++++- ruoyi-ui/src/views/monitor/operlog/index.vue | 7 ++++++- ruoyi-ui/src/views/system/config/index.vue | 7 ++++++- ruoyi-ui/src/views/system/dict/data.vue | 7 ++++++- ruoyi-ui/src/views/system/dict/index.vue | 7 ++++++- ruoyi-ui/src/views/system/post/index.vue | 7 ++++++- ruoyi-ui/src/views/system/role/index.vue | 7 ++++++- ruoyi-ui/src/views/system/user/index.vue | 7 ++++++- 10 files changed, 60 insertions(+), 10 deletions(-) diff --git a/ruoyi-ui/src/views/monitor/job/index.vue b/ruoyi-ui/src/views/monitor/job/index.vue index 101c041d..30115e33 100644 --- a/ruoyi-ui/src/views/monitor/job/index.vue +++ b/ruoyi-ui/src/views/monitor/job/index.vue @@ -75,6 +75,7 @@ plain icon="el-icon-download" size="mini" + :loading="exportLoading" @click="handleExport" v-hasPermi="['monitor:job:export']" >导出 @@ -274,6 +275,8 @@ export default { return { // 遮罩层 loading: true, + // 导出遮罩层 + exportLoading: false, // 选中数组 ids: [], // 非单个禁用 @@ -477,10 +480,12 @@ export default { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" - }).then(function() { + }).then(() => { + this.exportLoading = true; return exportJob(queryParams); }).then(response => { this.download(response.msg); + this.exportLoading = false; }) } } diff --git a/ruoyi-ui/src/views/monitor/job/log.vue b/ruoyi-ui/src/views/monitor/job/log.vue index e34b6355..121dde82 100644 --- a/ruoyi-ui/src/views/monitor/job/log.vue +++ b/ruoyi-ui/src/views/monitor/job/log.vue @@ -89,6 +89,7 @@ plain icon="el-icon-download" size="mini" + :loading="exportLoading" @click="handleExport" v-hasPermi="['monitor:job:export']" >导出 @@ -175,6 +176,8 @@ export default { return { // 遮罩层 loading: true, + // 导出遮罩层 + exportLoading: false, // 选中数组 ids: [], // 非多个禁用 @@ -288,10 +291,12 @@ export default { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" - }).then(function() { + }).then(() => { + this.exportLoading = true; return exportJobLog(queryParams); }).then(response => { this.download(response.msg); + this.exportLoading = false; }) } } diff --git a/ruoyi-ui/src/views/monitor/logininfor/index.vue b/ruoyi-ui/src/views/monitor/logininfor/index.vue index c9ffcea5..4ac9a78d 100644 --- a/ruoyi-ui/src/views/monitor/logininfor/index.vue +++ b/ruoyi-ui/src/views/monitor/logininfor/index.vue @@ -83,6 +83,7 @@ plain icon="el-icon-download" size="mini" + :loading="exportLoading" @click="handleExport" v-hasPermi="['monitor:logininfor:export']" >导出 @@ -126,6 +127,8 @@ export default { return { // 遮罩层 loading: true, + // 导出遮罩层 + exportLoading: false, // 选中数组 ids: [], // 非多个禁用 @@ -221,10 +224,12 @@ export default { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" - }).then(function() { + }).then(() => { + this.exportLoading = true; return exportLogininfor(queryParams); }).then(response => { this.download(response.msg); + this.exportLoading = false; }) } } diff --git a/ruoyi-ui/src/views/monitor/operlog/index.vue b/ruoyi-ui/src/views/monitor/operlog/index.vue index 28f1877b..d1505c66 100644 --- a/ruoyi-ui/src/views/monitor/operlog/index.vue +++ b/ruoyi-ui/src/views/monitor/operlog/index.vue @@ -99,6 +99,7 @@ plain icon="el-icon-download" size="mini" + :loading="exportLoading" @click="handleExport" v-hasPermi="['monitor:operlog:export']" >导出 @@ -195,6 +196,8 @@ export default { return { // 遮罩层 loading: true, + // 导出遮罩层 + exportLoading: false, // 选中数组 ids: [], // 非多个禁用 @@ -309,10 +312,12 @@ export default { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" - }).then(function() { + }).then(() => { + this.exportLoading = true; return exportOperlog(queryParams); }).then(response => { this.download(response.msg); + this.exportLoading = false; }) } } diff --git a/ruoyi-ui/src/views/system/config/index.vue b/ruoyi-ui/src/views/system/config/index.vue index c5b0f59a..aff5089e 100644 --- a/ruoyi-ui/src/views/system/config/index.vue +++ b/ruoyi-ui/src/views/system/config/index.vue @@ -88,6 +88,7 @@ plain icon="el-icon-download" size="mini" + :loading="exportLoading" @click="handleExport" v-hasPermi="['system:config:export']" >导出 @@ -188,6 +189,8 @@ export default { return { // 遮罩层 loading: true, + // 导出遮罩层 + exportLoading: false, // 选中数组 ids: [], // 非单个禁用 @@ -344,10 +347,12 @@ export default { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" - }).then(function() { + }).then(() => { + this.exportLoading = true; return exportConfig(queryParams); }).then(response => { this.download(response.msg); + this.exportLoading = false; }) }, /** 清理缓存按钮操作 */ diff --git a/ruoyi-ui/src/views/system/dict/data.vue b/ruoyi-ui/src/views/system/dict/data.vue index 70da3d53..720ed7e7 100644 --- a/ruoyi-ui/src/views/system/dict/data.vue +++ b/ruoyi-ui/src/views/system/dict/data.vue @@ -75,6 +75,7 @@ plain icon="el-icon-download" size="mini" + :loading="exportLoading" @click="handleExport" v-hasPermi="['system:dict:export']" >导出 @@ -169,6 +170,8 @@ export default { return { // 遮罩层 loading: true, + // 导出遮罩层 + exportLoading: false, // 选中数组 ids: [], // 非单个禁用 @@ -343,10 +346,12 @@ export default { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" - }).then(function() { + }).then(() => { + this.exportLoading = true; return exportData(queryParams); }).then(response => { this.download(response.msg); + this.exportLoading = false; }) } } diff --git a/ruoyi-ui/src/views/system/dict/index.vue b/ruoyi-ui/src/views/system/dict/index.vue index 16fe9121..d7318fdb 100644 --- a/ruoyi-ui/src/views/system/dict/index.vue +++ b/ruoyi-ui/src/views/system/dict/index.vue @@ -94,6 +94,7 @@ plain icon="el-icon-download" size="mini" + :loading="exportLoading" @click="handleExport" v-hasPermi="['system:dict:export']" >导出 @@ -196,6 +197,8 @@ export default { return { // 遮罩层 loading: true, + // 导出遮罩层 + exportLoading: false, // 选中数组 ids: [], // 非单个禁用 @@ -348,10 +351,12 @@ export default { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" - }).then(function() { + }).then(() => { + this.exportLoading = true; return exportType(queryParams); }).then(response => { this.download(response.msg); + this.exportLoading = false; }) }, /** 清理缓存按钮操作 */ diff --git a/ruoyi-ui/src/views/system/post/index.vue b/ruoyi-ui/src/views/system/post/index.vue index 5fa17a72..ce48b03b 100644 --- a/ruoyi-ui/src/views/system/post/index.vue +++ b/ruoyi-ui/src/views/system/post/index.vue @@ -74,6 +74,7 @@ plain icon="el-icon-download" size="mini" + :loading="exportLoading" @click="handleExport" v-hasPermi="['system:post:export']" >导出 @@ -163,6 +164,8 @@ export default { return { // 遮罩层 loading: true, + // 导出遮罩层 + exportLoading: false, // 选中数组 ids: [], // 非单个禁用 @@ -315,10 +318,12 @@ export default { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" - }).then(function() { + }).then(() => { + this.exportLoading = true; return exportPost(queryParams); }).then(response => { this.download(response.msg); + this.exportLoading = false; }) } } diff --git a/ruoyi-ui/src/views/system/role/index.vue b/ruoyi-ui/src/views/system/role/index.vue index a2ecf0b7..4892615c 100644 --- a/ruoyi-ui/src/views/system/role/index.vue +++ b/ruoyi-ui/src/views/system/role/index.vue @@ -94,6 +94,7 @@ plain icon="el-icon-download" size="mini" + :loading="exportLoading" @click="handleExport" v-hasPermi="['system:role:export']" >导出 @@ -258,6 +259,8 @@ export default { return { // 遮罩层 loading: true, + // 导出遮罩层 + exportLoading: false, // 选中数组 ids: [], // 非单个禁用 @@ -599,10 +602,12 @@ export default { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" - }).then(function() { + }).then(() => { + this.exportLoading = true; return exportRole(queryParams); }).then(response => { this.download(response.msg); + this.exportLoading = false; }) } } diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue index afd64ada..2e55120c 100644 --- a/ruoyi-ui/src/views/system/user/index.vue +++ b/ruoyi-ui/src/views/system/user/index.vue @@ -131,6 +131,7 @@ plain icon="el-icon-download" size="mini" + :loading="exportLoading" @click="handleExport" v-hasPermi="['system:user:export']" >导出 @@ -356,6 +357,8 @@ export default { return { // 遮罩层 loading: true, + // 导出遮罩层 + exportLoading: false, // 选中数组 ids: [], // 非单个禁用 @@ -637,10 +640,12 @@ export default { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" - }).then(function() { + }).then(() => { + this.exportLoading = true; return exportUser(queryParams); }).then(response => { this.download(response.msg); + this.exportLoading = false; }) }, /** 导入按钮操作 */ From c4eb641d9c2facb880895b1fa7937415829735b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Mon, 17 May 2021 16:36:07 +0800 Subject: [PATCH 13/42] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8Dswagger=E5=BC=80?= =?UTF-8?q?=E5=85=B3=E6=97=A0=E6=B3=95=E6=8E=A7=E5=88=B6=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 21 +++ .../src/main/resources/application.yml | 7 +- .../ruoyi/framework/config/SwaggerConfig.java | 169 ++++++++---------- .../config/properties/SwaggerProperties.java | 25 ++- 4 files changed, 124 insertions(+), 98 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..8cfd3709 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,21 @@ +# http://editorconfig.org +root = true + +# 空格替代Tab缩进在各种编辑工具下效果一致 +[*] +indent_style = space +indent_size = 4 +charset = utf-8 +end_of_line = lf +trim_trailing_whitespace = true +insert_final_newline = true + +[*.java] +indent_style = tab + +[*.{json,yml}] +indent_size = 2 + +[*.md] +insert_final_newline = false +trim_trailing_whitespace = false diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index d0728723..b034d99f 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -193,6 +193,11 @@ swagger: description: '描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...' # 版本 version: '版本号: ${ruoyi-vue-plus.version}' + # 作者信息 + contact: + name: Lion Li + email: crazylionli@163.com + url: https://gitee.com/JavaLionLi/RuoYi-Vue-Plus # 防止XSS攻击 xss: @@ -295,4 +300,4 @@ management: include: '*' endpoint: logfile: - external-file: ./logs/sys-console.log \ No newline at end of file + external-file: ./logs/sys-console.log diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java index 8b43f172..92e39760 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java @@ -1,12 +1,9 @@ package com.ruoyi.framework.config; import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; -import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.framework.config.properties.SwaggerProperties; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; @@ -29,103 +26,83 @@ import java.util.List; @Configuration @EnableSwagger2 @EnableKnife4j -@ConditionalOnClass({Docket.class, ApiInfoBuilder.class}) -@ConditionalOnProperty(prefix = "swagger", value = "enable", matchIfMissing = true) public class SwaggerConfig { - /** - * 系统基础配置 - */ - @Autowired - private RuoYiConfig ruoyiConfig; - /** - * 标题 - */ - @Value("${swagger.title}") - private String title; + @Autowired + private SwaggerProperties swaggerProperties; - /** - * 描述 - */ - @Value("${swagger.description}") - private String description; + /** + * 创建API + */ + @Bean + public Docket createRestApi() { + return new Docket(DocumentationType.SWAGGER_2) + .enable(swaggerProperties.getEnabled()) + // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息) + .apiInfo(apiInfo()) + // 设置哪些接口暴露给Swagger展示 + .select() + // 扫描所有有注解的api,用这种方式更灵活 + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + // 扫描指定包中的swagger注解 + // .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger")) + // 扫描所有 .apis(RequestHandlerSelectors.any()) + .paths(PathSelectors.any()) + .build() + /* 设置安全模式,swagger可以设置访问token */ + .securitySchemes(securitySchemes()) + .securityContexts(securityContexts()); + } - /** - * 版本 - */ - @Value("${swagger.version}") - private String version; + /** + * 安全模式,这里指定token通过Authorization头请求头传递 + */ + private List securitySchemes() { + List apiKeyList = new ArrayList(); + apiKeyList.add(new ApiKey("Authorization", "Authorization", "header")); + return apiKeyList; + } - /** - * 创建API - */ - @Bean - public Docket createRestApi() { - return new Docket(DocumentationType.SWAGGER_2) - // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息) - .apiInfo(apiInfo()) - // 设置哪些接口暴露给Swagger展示 - .select() - // 扫描所有有注解的api,用这种方式更灵活 - .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) - // 扫描指定包中的swagger注解 - // .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger")) - // 扫描所有 .apis(RequestHandlerSelectors.any()) - .paths(PathSelectors.any()) - .build() - /* 设置安全模式,swagger可以设置访问token */ - .securitySchemes(securitySchemes()) - .securityContexts(securityContexts()); - } + /** + * 安全上下文 + */ + private List securityContexts() { + List securityContexts = new ArrayList<>(); + securityContexts.add( + SecurityContext.builder() + .securityReferences(defaultAuth()) + .forPaths(PathSelectors.regex("^(?!auth).*$")) + .build()); + return securityContexts; + } - /** - * 安全模式,这里指定token通过Authorization头请求头传递 - */ - private List securitySchemes() { - List apiKeyList = new ArrayList(); - apiKeyList.add(new ApiKey("Authorization", "Authorization", "header")); - return apiKeyList; - } + /** + * 默认的安全上引用 + */ + private List defaultAuth() { + AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); + AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; + authorizationScopes[0] = authorizationScope; + List securityReferences = new ArrayList<>(); + securityReferences.add(new SecurityReference("Authorization", authorizationScopes)); + return securityReferences; + } - /** - * 安全上下文 - */ - private List securityContexts() { - List securityContexts = new ArrayList<>(); - securityContexts.add( - SecurityContext.builder() - .securityReferences(defaultAuth()) - .forPaths(PathSelectors.regex("^(?!auth).*$")) - .build()); - return securityContexts; - } - - /** - * 默认的安全上引用 - */ - private List defaultAuth() { - AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); - AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; - authorizationScopes[0] = authorizationScope; - List securityReferences = new ArrayList<>(); - securityReferences.add(new SecurityReference("Authorization", authorizationScopes)); - return securityReferences; - } - - /** - * 添加摘要信息 - */ - private ApiInfo apiInfo() { - // 用ApiInfoBuilder进行定制 - return new ApiInfoBuilder() - // 设置标题 - .title(title) - // 描述 - .description(description) - // 作者信息 - .contact(new Contact(ruoyiConfig.getName(), null, null)) - // 版本 - .version(version) - .build(); - } + /** + * 添加摘要信息 + */ + private ApiInfo apiInfo() { + // 用ApiInfoBuilder进行定制 + SwaggerProperties.Contact contact = swaggerProperties.getContact(); + return new ApiInfoBuilder() + // 设置标题 + .title(swaggerProperties.getTitle()) + // 描述 + .description(swaggerProperties.getDescription()) + // 作者信息 + .contact(new Contact(contact.getName(), contact.getUrl(), contact.getEmail())) + // 版本 + .version(swaggerProperties.getVersion()) + .build(); + } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java index 4a37fbc6..4db6e588 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java @@ -2,7 +2,6 @@ package com.ruoyi.framework.config.properties; import lombok.Data; import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; @@ -33,4 +32,28 @@ public class SwaggerProperties { */ private String version; + /** + * 联系方式 + */ + private Contact contact; + + @Data + @NoArgsConstructor + public static class Contact{ + + /** + * 联系人 + **/ + private String name; + /** + * 联系人url + **/ + private String url; + /** + * 联系人email + **/ + private String email; + + } + } From d0a4d6b111918909c6ea8285154c023a3c50fdba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=AB=8B=E4=BC=9F?= <15046664475@139.com> Date: Tue, 18 May 2021 10:21:48 +0800 Subject: [PATCH 14/42] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/vm/java/mapper.java.vm | 182 +++++++++--------- 1 file changed, 91 insertions(+), 91 deletions(-) diff --git a/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm b/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm index 4c02b0f4..28a25672 100644 --- a/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm @@ -1,91 +1,91 @@ -package ${packageName}.mapper; - -import java.util.List; -import ${packageName}.domain.${ClassName}; -#if($table.sub) -import ${packageName}.domain.${subClassName}; -#end - -/** - * ${functionName}Mapper接口 - * - * @author ${author} - * @date ${datetime} - */ -public interface ${ClassName}Mapper -{ - /** - * 查询${functionName} - * - * @param ${pkColumn.javaField} ${functionName}ID - * @return ${functionName} - */ - public ${ClassName} select${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField}); - - /** - * 查询${functionName}列表 - * - * @param ${className} ${functionName} - * @return ${functionName}集合 - */ - public List<${ClassName}> select${ClassName}List(${ClassName} ${className}); - - /** - * 新增${functionName} - * - * @param ${className} ${functionName} - * @return 结果 - */ - public int insert${ClassName}(${ClassName} ${className}); - - /** - * 修改${functionName} - * - * @param ${className} ${functionName} - * @return 结果 - */ - public int update${ClassName}(${ClassName} ${className}); - - /** - * 删除${functionName} - * - * @param ${pkColumn.javaField} ${functionName}ID - * @return 结果 - */ - public int delete${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField}); - - /** - * 批量删除${functionName} - * - * @param ${pkColumn.javaField}s 需要删除的数据ID - * @return 结果 - */ - public int delete${ClassName}ByIds(${pkColumn.javaType}[] ${pkColumn.javaField}s); -#if($table.sub) - - /** - * 批量删除${subTable.functionName} - * - * @param customerIds 需要删除的数据ID - * @return 结果 - */ - public int delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaType}[] ${pkColumn.javaField}s); - - /** - * 批量新增${subTable.functionName} - * - * @param ${subclassName}List ${subTable.functionName}列表 - * @return 结果 - */ - public int batch${subClassName}(List<${subClassName}> ${subclassName}List); - - - /** - * 通过${functionName}ID删除${subTable.functionName}信息 - * - * @param roleId 角色ID - * @return 结果 - */ - public int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField}); -#end -} +package ${packageName}.mapper; + +import java.util.List; +import ${packageName}.domain.${ClassName}; +#if($table.sub) +import ${packageName}.domain.${subClassName}; +#end + +/** + * ${functionName}Mapper接口 + * + * @author ${author} + * @date ${datetime} + */ +public interface ${ClassName}Mapper +{ + /** + * 查询${functionName} + * + * @param ${pkColumn.javaField} ${functionName}ID + * @return ${functionName} + */ + public ${ClassName} select${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField}); + + /** + * 查询${functionName}列表 + * + * @param ${className} ${functionName} + * @return ${functionName}集合 + */ + public List<${ClassName}> select${ClassName}List(${ClassName} ${className}); + + /** + * 新增${functionName} + * + * @param ${className} ${functionName} + * @return 结果 + */ + public int insert${ClassName}(${ClassName} ${className}); + + /** + * 修改${functionName} + * + * @param ${className} ${functionName} + * @return 结果 + */ + public int update${ClassName}(${ClassName} ${className}); + + /** + * 删除${functionName} + * + * @param ${pkColumn.javaField} ${functionName}ID + * @return 结果 + */ + public int delete${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField}); + + /** + * 批量删除${functionName} + * + * @param ${pkColumn.javaField}s 需要删除的数据ID + * @return 结果 + */ + public int delete${ClassName}ByIds(${pkColumn.javaType}[] ${pkColumn.javaField}s); +#if($table.sub) + + /** + * 批量删除${subTable.functionName} + * + * @param customerIds 需要删除的数据ID + * @return 结果 + */ + public int delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaType}[] ${pkColumn.javaField}s); + + /** + * 批量新增${subTable.functionName} + * + * @param ${subclassName}List ${subTable.functionName}列表 + * @return 结果 + */ + public int batch${subClassName}(List<${subClassName}> ${subclassName}List); + + + /** + * 通过${functionName}ID删除${subTable.functionName}信息 + * + * @param ${pkColumn.javaField} ${functionName}ID + * @return 结果 + */ + public int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField}); +#end +} From 72de8f57a7db4485495b684413fadde6ae71d04e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Tue, 18 May 2021 11:37:24 +0800 Subject: [PATCH 15/42] =?UTF-8?q?=E5=8F=91=E5=B8=83=20v2.1.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 30 +++++++++++++++--------------- ruoyi-ui/package.json | 2 +- ruoyi-ui/src/views/index.vue | 9 +++++++++ 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/pom.xml b/pom.xml index 60932af9..1ba56af3 100644 --- a/pom.xml +++ b/pom.xml @@ -2,8 +2,8 @@ - 4.0.0 - + 4.0.0 + com.ruoyi ruoyi-vue-plus ${ruoyi-vue-plus.version} @@ -11,9 +11,9 @@ RuoYi-Vue-Plus https://gitee.com/JavaLionLi/RuoYi-Vue-Plus RuoYi-Vue-Plus后台管理系统 - + - 2.1.0 + 2.1.1 2.3.10.RELEASE UTF-8 UTF-8 @@ -32,11 +32,11 @@ 11.0 2.3.1 - + - + org.springframework.boot @@ -45,7 +45,7 @@ pom import - + com.alibaba @@ -70,14 +70,14 @@ swagger-annotations ${swagger-annotations.version} - + org.apache.poi poi-ooxml ${poi.version} - + org.apache.velocity @@ -91,7 +91,7 @@ fastjson ${fastjson.version} - + io.jsonwebtoken @@ -144,28 +144,28 @@ ruoyi-quartz ${ruoyi-vue-plus.version} - + com.ruoyi ruoyi-generator ${ruoyi-vue-plus.version} - + com.ruoyi ruoyi-framework ${ruoyi-vue-plus.version} - + com.ruoyi ruoyi-system ${ruoyi-vue-plus.version} - + com.ruoyi @@ -269,4 +269,4 @@ - \ No newline at end of file + diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index 0ac7e155..458a8752 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -1,6 +1,6 @@ { "name": "ruoyi-vue-plus", - "version": "2.1.0", + "version": "2.1.1", "description": "RuoYi-Vue-Plus后台管理系统", "author": "LionLi", "license": "MIT", diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index 0b00abde..25cfa664 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -80,6 +80,15 @@ 更新日志 + +
        +
      1. update 配置统一提取为 properties 配置类
      2. +
      3. update 分页工具 删除过期方法
      4. +
      5. update admin 实时监控日志 改为保留一天
      6. +
      7. fix 修复swagger开关无法控制关闭问题
      8. +
      9. fix maven install 异常
      10. +
      +
      1. update knife4j升级3.0.2
      2. From db18050b869f71efe35dc4cea36ed485d78f17f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Wed, 19 May 2021 22:57:34 +0800 Subject: [PATCH 16/42] =?UTF-8?q?update=20=E9=AA=8C=E8=AF=81=E7=A0=81?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=9B=B4=E6=96=B0=E4=B8=BA=E6=97=A0=E7=AC=A6?= =?UTF-8?q?=E5=8F=B7=E6=95=B4=E6=95=B0=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/common/CaptchaController.java | 4 +- .../captcha/UnsignedMathGenerator.java | 85 +++++++++++++++++++ 2 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 ruoyi-framework/src/main/java/com/ruoyi/framework/captcha/UnsignedMathGenerator.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java index c01cc4ed..28be0fec 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java @@ -5,7 +5,6 @@ import cn.hutool.captcha.CircleCaptcha; import cn.hutool.captcha.LineCaptcha; import cn.hutool.captcha.ShearCaptcha; import cn.hutool.captcha.generator.CodeGenerator; -import cn.hutool.captcha.generator.MathGenerator; import cn.hutool.captcha.generator.RandomGenerator; import cn.hutool.core.convert.Convert; import cn.hutool.core.util.IdUtil; @@ -13,6 +12,7 @@ import cn.hutool.core.util.StrUtil; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.framework.captcha.UnsignedMathGenerator; import com.ruoyi.framework.config.properties.CaptchaProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -59,7 +59,7 @@ public class CaptchaController { AbstractCaptcha captcha; switch (captchaProperties.getType()) { case "math": - codeGenerator = new MathGenerator(captchaProperties.getNumberLength()); + codeGenerator = new UnsignedMathGenerator(captchaProperties.getNumberLength()); break; case "char": codeGenerator = new RandomGenerator(captchaProperties.getCharLength()); diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/captcha/UnsignedMathGenerator.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/captcha/UnsignedMathGenerator.java new file mode 100644 index 00000000..b4f8bfc1 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/captcha/UnsignedMathGenerator.java @@ -0,0 +1,85 @@ +package com.ruoyi.framework.captcha; + +import cn.hutool.captcha.generator.CodeGenerator; +import cn.hutool.core.math.Calculator; +import cn.hutool.core.util.CharUtil; +import cn.hutool.core.util.RandomUtil; +import cn.hutool.core.util.StrUtil; + +/** + * 无符号计算生成器 + * + * @author Lion Li + */ +public class UnsignedMathGenerator implements CodeGenerator { + + private static final long serialVersionUID = -5514819971774091076L; + + private static final String operators = "+-*"; + + /** + * 参与计算数字最大长度 + */ + private final int numberLength; + + /** + * 构造 + */ + public UnsignedMathGenerator() { + this(2); + } + + /** + * 构造 + * + * @param numberLength 参与计算最大数字位数 + */ + public UnsignedMathGenerator(int numberLength) { + this.numberLength = numberLength; + } + + @Override + public String generate() { + final int limit = getLimit(); + int min = RandomUtil.randomInt(limit); + int max = RandomUtil.randomInt(min, limit); + String number1 = Integer.toString(max); + String number2 = Integer.toString(min); + number1 = StrUtil.padAfter(number1, this.numberLength, CharUtil.SPACE); + number2 = StrUtil.padAfter(number2, this.numberLength, CharUtil.SPACE); + + return number1 + RandomUtil.randomChar(operators) + number2 + '='; + } + + @Override + public boolean verify(String code, String userInputCode) { + int result; + try { + result = Integer.parseInt(userInputCode); + } catch (NumberFormatException e) { + // 用户输入非数字 + return false; + } + + final int calculateResult = (int) Calculator.conversion(code); + return result == calculateResult; + } + + /** + * 获取验证码长度 + * + * @return 验证码长度 + */ + public int getLength() { + return this.numberLength * 2 + 2; + } + + /** + * 根据长度获取参与计算数字最大值 + * + * @return 最大值 + */ + private int getLimit() { + return Integer.parseInt("1" + StrUtil.repeat('0', this.numberLength)); + } +} From 7076deb2b6da9ab0a8b599c61150ec2bd5a926f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 20 May 2021 13:23:12 +0800 Subject: [PATCH 17/42] =?UTF-8?q?update=20=E8=AF=B7=E6=B1=82=E5=93=8D?= =?UTF-8?q?=E5=BA=94=E5=AF=B9=E8=B1=A1=20=E4=B8=8E=20=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=20=E7=BB=93=E6=9E=84=E4=BF=AE=E6=94=B9=20?= =?UTF-8?q?=E9=80=82=E9=85=8D=E6=8E=A5=E5=8F=A3=E6=96=87=E6=A1=A3=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/common/CaptchaController.java | 6 +- .../controller/common/CommonController.java | 10 +- .../controller/system/SysDeptController.java | 8 +- .../controller/system/SysLoginController.java | 18 +- .../controller/system/SysMenuController.java | 10 +- .../system/SysProfileController.java | 13 +- .../controller/system/SysUserController.java | 10 +- .../ruoyi/common/core/domain/AjaxResult.java | 249 ++++++------ .../ruoyi/common/core/page/TableDataInfo.java | 61 +-- ruoyi-ui/src/components/FileUpload/index.vue | 358 +++++++++--------- ruoyi-ui/src/components/ImageUpload/index.vue | 200 +++++----- ruoyi-ui/src/store/modules/user.js | 12 +- ruoyi-ui/src/views/login.vue | 4 +- ruoyi-ui/src/views/system/role/index.vue | 10 +- ruoyi-ui/src/views/system/user/index.vue | 14 +- .../src/views/system/user/profile/index.vue | 6 +- .../views/system/user/profile/userAvatar.vue | 2 +- 17 files changed, 496 insertions(+), 495 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java index 28be0fec..09886560 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java @@ -19,6 +19,8 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; import java.util.concurrent.TimeUnit; /** @@ -88,10 +90,10 @@ public class CaptchaController { code = captcha.getCode(); } redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); - AjaxResult ajax = AjaxResult.success(); + Map ajax = new HashMap<>(); ajax.put("uuid", uuid); ajax.put("img", captcha.getImageBase64()); - return ajax; + return AjaxResult.success(ajax); } private String getCodeResult(String capStr) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java index c69cdf2a..7418a2cd 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java @@ -18,10 +18,12 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.util.HashMap; +import java.util.Map; /** * 通用请求处理 - * + * * @author ruoyi */ @RestController @@ -34,7 +36,7 @@ public class CommonController /** * 通用下载请求 - * + * * @param fileName 文件名称 * @param delete 是否删除 */ @@ -77,10 +79,10 @@ public class CommonController // 上传并返回新文件名称 String fileName = FileUploadUtils.upload(filePath, file); String url = serverConfig.getUrl() + fileName; - AjaxResult ajax = AjaxResult.success(); + Map ajax = new HashMap<>(); ajax.put("fileName", fileName); ajax.put("url", url); - return ajax; + return AjaxResult.success(ajax); } catch (Exception e) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java index 719012b8..c3fdf83f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java @@ -15,12 +15,14 @@ import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; /** * 部门信息 - * + * * @author ruoyi */ @RestController @@ -89,10 +91,10 @@ public class SysDeptController extends BaseController public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId) { List depts = deptService.selectDeptList(new SysDept()); - AjaxResult ajax = AjaxResult.success(); + Map ajax = new HashMap<>(); ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); ajax.put("depts", deptService.buildDeptTreeSelect(depts)); - return ajax; + return AjaxResult.success(ajax); } /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java index b2df9550..b2b9efb3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java @@ -17,12 +17,14 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Set; /** * 登录验证 - * + * * @author ruoyi */ @RestController @@ -42,24 +44,24 @@ public class SysLoginController /** * 登录方法 - * + * * @param loginBody 登录信息 * @return 结果 */ @PostMapping("/login") public AjaxResult login(@RequestBody LoginBody loginBody) { - AjaxResult ajax = AjaxResult.success(); + Map ajax = new HashMap<>(); // 生成令牌 String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), loginBody.getUuid()); ajax.put(Constants.TOKEN, token); - return ajax; + return AjaxResult.success(ajax); } /** * 获取用户信息 - * + * * @return 用户信息 */ @GetMapping("getInfo") @@ -71,16 +73,16 @@ public class SysLoginController Set roles = permissionService.getRolePermission(user); // 权限集合 Set permissions = permissionService.getMenuPermission(user); - AjaxResult ajax = AjaxResult.success(); + Map ajax = new HashMap<>(); ajax.put("user", user); ajax.put("roles", roles); ajax.put("permissions", permissions); - return ajax; + return AjaxResult.success(ajax); } /** * 获取路由信息 - * + * * @return 路由信息 */ @GetMapping("getRouters") diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java index 547368bf..00f14642 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java @@ -18,11 +18,13 @@ import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 菜单信息 - * + * * @author ruoyi */ @RestController @@ -78,10 +80,10 @@ public class SysMenuController extends BaseController { LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); List menus = menuService.selectMenuList(loginUser.getUser().getUserId()); - AjaxResult ajax = AjaxResult.success(); + Map ajax = new HashMap<>(); ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); ajax.put("menus", menuService.buildMenuTreeSelect(menus)); - return ajax; + return AjaxResult.success(ajax); } /** @@ -148,4 +150,4 @@ public class SysMenuController extends BaseController } return toAjax(menuService.deleteMenuById(menuId)); } -} \ No newline at end of file +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java index 7c65a9b0..31ca6dda 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java @@ -19,10 +19,12 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; +import java.util.HashMap; +import java.util.Map; /** * 个人信息 业务处理 - * + * * @author ruoyi */ @RestController @@ -43,10 +45,11 @@ public class SysProfileController extends BaseController { LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); SysUser user = loginUser.getUser(); - AjaxResult ajax = AjaxResult.success(user); + Map ajax = new HashMap<>(); + ajax.put("user", user); ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername())); ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername())); - return ajax; + return AjaxResult.success(ajax); } /** @@ -121,12 +124,12 @@ public class SysProfileController extends BaseController String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file); if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) { - AjaxResult ajax = AjaxResult.success(); + Map ajax = new HashMap<>(); ajax.put("imgUrl", avatar); // 更新缓存用户头像 loginUser.getUser().setAvatar(avatar); tokenService.setLoginUser(loginUser); - return ajax; + return AjaxResult.success(ajax); } } return AjaxResult.error("上传图片异常,请联系管理员"); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java index 7e743999..079c15ac 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java @@ -23,12 +23,14 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; /** * 用户信息 - * + * * @author ruoyi */ @RestController @@ -94,17 +96,17 @@ public class SysUserController extends BaseController @GetMapping(value = { "/", "/{userId}" }) public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) { - AjaxResult ajax = AjaxResult.success(); + Map ajax = new HashMap<>(); List roles = roleService.selectRoleAll(); ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); ajax.put("posts", postService.selectPostAll()); if (Validator.isNotNull(userId)) { - ajax.put(AjaxResult.DATA_TAG, userService.selectUserById(userId)); + ajax.put("user", userService.selectUserById(userId)); ajax.put("postIds", postService.selectPostListByUserId(userId)); ajax.put("roleIds", roleService.selectRoleListByUserId(userId)); } - return ajax; + return AjaxResult.success(ajax); } /** diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java index a7d2297b..7c388c5e 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java @@ -1,161 +1,134 @@ package com.ruoyi.common.core.domain; -import cn.hutool.core.lang.Validator; import cn.hutool.http.HttpStatus; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; import lombok.Data; - -import java.util.HashMap; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; /** * 操作消息提醒 - * - * @author ruoyi + * + * @author Lion Li */ -public class AjaxResult extends HashMap -{ - private static final long serialVersionUID = 1L; +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ApiModel("请求响应对象") +public class AjaxResult { - /** 状态码 */ - public static final String CODE_TAG = "code"; + private static final long serialVersionUID = 1L; - /** 返回内容 */ - public static final String MSG_TAG = "msg"; + /** + * 状态码 + */ + @ApiModelProperty("消息状态码") + private int code; - /** 数据对象 */ - public static final String DATA_TAG = "data"; + /** + * 返回内容 + */ + @ApiModelProperty("消息内容") + private String msg; - public Integer getCode(){ - return (Integer) super.get(CODE_TAG); - } + /** + * 数据对象 + */ + @ApiModelProperty("数据对象") + private T data; - public String getMsg(){ - return (String) super.get(MSG_TAG); - } - public T getData(){ - return (T) super.get(DATA_TAG); - } + /** + * 初始化一个新创建的 AjaxResult 对象 + * + * @param code 状态码 + * @param msg 返回内容 + */ + public AjaxResult(int code, String msg) { + this.code = code; + this.msg = msg; + } - /** - * 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。 - */ - public AjaxResult() - { - } + /** + * 返回成功消息 + * + * @return 成功消息 + */ + public static AjaxResult success() { + return AjaxResult.success("操作成功"); + } - /** - * 初始化一个新创建的 AjaxResult 对象 - * - * @param code 状态码 - * @param msg 返回内容 - */ - public AjaxResult(int code, String msg) - { - super.put(CODE_TAG, code); - super.put(MSG_TAG, msg); - } + /** + * 返回成功数据 + * + * @return 成功消息 + */ + public static AjaxResult success(T data) { + return AjaxResult.success("操作成功", data); + } - /** - * 初始化一个新创建的 AjaxResult 对象 - * - * @param code 状态码 - * @param msg 返回内容 - * @param data 数据对象 - */ - public AjaxResult(int code, String msg, T data) - { - super.put(CODE_TAG, code); - super.put(MSG_TAG, msg); - if (Validator.isNotNull(data)) - { - super.put(DATA_TAG, data); - } - } + /** + * 返回成功消息 + * + * @param msg 返回内容 + * @return 成功消息 + */ + public static AjaxResult success(String msg) { + return AjaxResult.success(msg, null); + } - /** - * 返回成功消息 - * - * @return 成功消息 - */ - public static AjaxResult success() - { - return AjaxResult.success("操作成功"); - } + /** + * 返回成功消息 + * + * @param msg 返回内容 + * @param data 数据对象 + * @return 成功消息 + */ + public static AjaxResult success(String msg, T data) { + return new AjaxResult<>(HttpStatus.HTTP_OK, msg, data); + } - /** - * 返回成功数据 - * - * @return 成功消息 - */ - public static AjaxResult success(T data) - { - return AjaxResult.success("操作成功", data); - } + /** + * 返回错误消息 + * + * @return + */ + public static AjaxResult error() { + return AjaxResult.error("操作失败"); + } - /** - * 返回成功消息 - * - * @param msg 返回内容 - * @return 成功消息 - */ - public static AjaxResult success(String msg) - { - return AjaxResult.success(msg, null); - } + /** + * 返回错误消息 + * + * @param msg 返回内容 + * @return 警告消息 + */ + public static AjaxResult error(String msg) { + return AjaxResult.error(msg, null); + } - /** - * 返回成功消息 - * - * @param msg 返回内容 - * @param data 数据对象 - * @return 成功消息 - */ - public static AjaxResult success(String msg, T data) - { - return new AjaxResult(HttpStatus.HTTP_OK, msg, data); - } + /** + * 返回错误消息 + * + * @param msg 返回内容 + * @param data 数据对象 + * @return 警告消息 + */ + public static AjaxResult error(String msg, T data) { + return new AjaxResult<>(HttpStatus.HTTP_INTERNAL_ERROR, msg, data); + } - /** - * 返回错误消息 - * - * @return - */ - public static AjaxResult error() - { - return AjaxResult.error("操作失败"); - } + /** + * 返回错误消息 + * + * @param code 状态码 + * @param msg 返回内容 + * @return 警告消息 + */ + public static AjaxResult error(int code, String msg) { + return new AjaxResult<>(code, msg, null); + } - /** - * 返回错误消息 - * - * @param msg 返回内容 - * @return 警告消息 - */ - public static AjaxResult error(String msg) - { - return AjaxResult.error(msg, null); - } - - /** - * 返回错误消息 - * - * @param msg 返回内容 - * @param data 数据对象 - * @return 警告消息 - */ - public static AjaxResult error(String msg, T data) - { - return new AjaxResult(HttpStatus.HTTP_INTERNAL_ERROR, msg, data); - } - - /** - * 返回错误消息 - * - * @param code 状态码 - * @param msg 返回内容 - * @return 警告消息 - */ - public static AjaxResult error(int code, String msg) - { - return new AjaxResult(code, msg, null); - } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java index 4e71fc15..81c596b4 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java @@ -1,5 +1,7 @@ package com.ruoyi.common.core.page; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.NoArgsConstructor; import lombok.experimental.Accessors; @@ -9,39 +11,50 @@ import java.util.List; /** * 表格分页数据对象 - * - * @author ruoyi + * + * @author Lion Li */ @Data @NoArgsConstructor @Accessors(chain = true) -public class TableDataInfo implements Serializable -{ - private static final long serialVersionUID = 1L; +@ApiModel("分页响应对象") +public class TableDataInfo implements Serializable { + private static final long serialVersionUID = 1L; - /** 总记录数 */ - private long total; + /** + * 总记录数 + */ + @ApiModelProperty("总记录数") + private long total; - /** 列表数据 */ - private List rows; + /** + * 列表数据 + */ + @ApiModelProperty("列表数据") + private List rows; - /** 消息状态码 */ - private int code; + /** + * 消息状态码 + */ + @ApiModelProperty("消息状态码") + private int code; - /** 消息内容 */ - private String msg; + /** + * 消息内容 + */ + @ApiModelProperty("消息内容") + private String msg; - /** - * 分页 - * - * @param list 列表数据 - * @param total 总记录数 - */ - public TableDataInfo(List list, long total) - { - this.rows = list; - this.total = total; - } + /** + * 分页 + * + * @param list 列表数据 + * @param total 总记录数 + */ + public TableDataInfo(List list, long total) { + this.rows = list; + this.total = total; + } } diff --git a/ruoyi-ui/src/components/FileUpload/index.vue b/ruoyi-ui/src/components/FileUpload/index.vue index d19a0122..81e2b3a9 100644 --- a/ruoyi-ui/src/components/FileUpload/index.vue +++ b/ruoyi-ui/src/components/FileUpload/index.vue @@ -1,179 +1,179 @@ - - - - - \ No newline at end of file + + + + + diff --git a/ruoyi-ui/src/components/ImageUpload/index.vue b/ruoyi-ui/src/components/ImageUpload/index.vue index ce540eb8..17d30d84 100644 --- a/ruoyi-ui/src/components/ImageUpload/index.vue +++ b/ruoyi-ui/src/components/ImageUpload/index.vue @@ -1,100 +1,100 @@ - - - - - \ No newline at end of file + + + + + diff --git a/ruoyi-ui/src/store/modules/user.js b/ruoyi-ui/src/store/modules/user.js index 0e451572..c6624e3a 100644 --- a/ruoyi-ui/src/store/modules/user.js +++ b/ruoyi-ui/src/store/modules/user.js @@ -37,8 +37,8 @@ const user = { const uuid = userInfo.uuid return new Promise((resolve, reject) => { login(username, password, code, uuid).then(res => { - setToken(res.token) - commit('SET_TOKEN', res.token) + setToken(res.data.token) + commit('SET_TOKEN', res.data.token) resolve() }).catch(error => { reject(error) @@ -50,11 +50,11 @@ const user = { GetInfo({ commit, state }) { return new Promise((resolve, reject) => { getInfo().then(res => { - const user = res.user + const user = res.data.user const avatar = user.avatar == "" ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar; - if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组 - commit('SET_ROLES', res.roles) - commit('SET_PERMISSIONS', res.permissions) + if (res.data.roles && res.data.roles.length > 0) { // 验证返回的roles是否是一个非空数组 + commit('SET_ROLES', res.data.roles) + commit('SET_PERMISSIONS', res.data.permissions) } else { commit('SET_ROLES', ['ROLE_DEFAULT']) } diff --git a/ruoyi-ui/src/views/login.vue b/ruoyi-ui/src/views/login.vue index 147117f9..d68f614d 100644 --- a/ruoyi-ui/src/views/login.vue +++ b/ruoyi-ui/src/views/login.vue @@ -99,8 +99,8 @@ export default { methods: { getCode() { getCodeImg().then(res => { - this.codeUrl = "data:image/gif;base64," + res.img; - this.loginForm.uuid = res.uuid; + this.codeUrl = "data:image/gif;base64," + res.data.img; + this.loginForm.uuid = res.data.uuid; }); }, getCookie() { diff --git a/ruoyi-ui/src/views/system/role/index.vue b/ruoyi-ui/src/views/system/role/index.vue index 3cb6df90..84ba9812 100644 --- a/ruoyi-ui/src/views/system/role/index.vue +++ b/ruoyi-ui/src/views/system/role/index.vue @@ -390,14 +390,14 @@ export default { /** 根据角色ID查询菜单树结构 */ getRoleMenuTreeselect(roleId) { return roleMenuTreeselect(roleId).then(response => { - this.menuOptions = response.menus; + this.menuOptions = response.data.menus; return response; }); }, /** 根据角色ID查询部门树结构 */ getRoleDeptTreeselect(roleId) { return roleDeptTreeselect(roleId).then(response => { - this.deptOptions = response.depts; + this.deptOptions = response.data.depts; return response; }); }, @@ -513,7 +513,7 @@ export default { this.open = true; this.$nextTick(() => { roleMenu.then(res => { - let checkedKeys = res.checkedKeys + let checkedKeys = res.data.checkedKeys checkedKeys.forEach((v) => { this.$nextTick(()=>{ this.$refs.menu.setChecked(v, true ,false); @@ -539,7 +539,7 @@ export default { this.openDataScope = true; this.$nextTick(() => { roleDeptTreeselect.then(res => { - this.$refs.dept.setCheckedKeys(res.checkedKeys); + this.$refs.dept.setCheckedKeys(res.data.checkedKeys); }); }); this.title = "分配数据权限"; @@ -607,4 +607,4 @@ export default { } } }; - \ No newline at end of file + diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue index 1a06eb30..ce1d6212 100644 --- a/ruoyi-ui/src/views/system/user/index.vue +++ b/ruoyi-ui/src/views/system/user/index.vue @@ -562,8 +562,8 @@ export default { this.reset(); this.getTreeselect(); getUser().then(response => { - this.postOptions = response.posts; - this.roleOptions = response.roles; + this.postOptions = response.data.posts; + this.roleOptions = response.data.roles; this.open = true; this.title = "添加用户"; this.form.password = this.initPassword; @@ -575,11 +575,11 @@ export default { this.getTreeselect(); const userId = row.userId || this.ids; getUser(userId).then(response => { - this.form = response.data; - this.postOptions = response.posts; - this.roleOptions = response.roles; - this.form.postIds = response.postIds; - this.form.roleIds = response.roleIds; + this.form = response.data.user; + this.postOptions = response.data.posts; + this.roleOptions = response.data.roles; + this.form.postIds = response.data.postIds; + this.form.roleIds = response.data.roleIds; this.open = true; this.title = "修改用户"; this.form.password = ""; diff --git a/ruoyi-ui/src/views/system/user/profile/index.vue b/ruoyi-ui/src/views/system/user/profile/index.vue index 8993cab7..7a3e295b 100644 --- a/ruoyi-ui/src/views/system/user/profile/index.vue +++ b/ruoyi-ui/src/views/system/user/profile/index.vue @@ -81,9 +81,9 @@ export default { methods: { getUser() { getUserProfile().then(response => { - this.user = response.data; - this.roleGroup = response.roleGroup; - this.postGroup = response.postGroup; + this.user = response.data.user; + this.roleGroup = response.data.roleGroup; + this.postGroup = response.data.postGroup; }); } } diff --git a/ruoyi-ui/src/views/system/user/profile/userAvatar.vue b/ruoyi-ui/src/views/system/user/profile/userAvatar.vue index 266183e6..6ed6314b 100644 --- a/ruoyi-ui/src/views/system/user/profile/userAvatar.vue +++ b/ruoyi-ui/src/views/system/user/profile/userAvatar.vue @@ -126,7 +126,7 @@ export default { formData.append("avatarfile", data); uploadAvatar(formData).then(response => { this.open = false; - this.options.img = process.env.VUE_APP_BASE_API + response.imgUrl; + this.options.img = process.env.VUE_APP_BASE_API + response.data.imgUrl; store.commit('SET_AVATAR', this.options.img); this.msgSuccess("修改成功"); this.visible = false; From 3d25dfbebecab7ebe4b116f0d4759767e27b842c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 20 May 2021 17:00:18 +0800 Subject: [PATCH 18/42] =?UTF-8?q?update=20=E5=A2=9E=E5=8A=A0=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E5=89=8D=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-admin/src/main/resources/application.yml | 2 ++ .../main/java/com/ruoyi/framework/config/SwaggerConfig.java | 3 ++- .../ruoyi/framework/config/properties/SwaggerProperties.java | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index b034d99f..535da0a9 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -187,6 +187,8 @@ mybatis-plus: swagger: # 是否开启swagger enabled: true + # 请求前缀 + pathMapping: /dev-api # 标题 title: '标题:RuoYi-Vue-Plus后台管理系统_接口文档' # 描述 diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java index 92e39760..1a92ca08 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java @@ -51,7 +51,8 @@ public class SwaggerConfig { .build() /* 设置安全模式,swagger可以设置访问token */ .securitySchemes(securitySchemes()) - .securityContexts(securityContexts()); + .securityContexts(securityContexts()) + .pathMapping(swaggerProperties.getPathMapping()); } /** diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java index 4db6e588..f99c3da1 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java @@ -19,6 +19,10 @@ public class SwaggerProperties { * 验证码类型 */ private Boolean enabled; + /** + * 设置请求的统一前缀 + */ + private String pathMapping; /** * 验证码类别 */ From 97a237bbdc97b6ccf7be9011be6f9992eadb9462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Fri, 21 May 2021 11:50:47 +0800 Subject: [PATCH 19/42] =?UTF-8?q?update=20springboot=20=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=202.3.11=20update=20mybatis-plus=20=E5=8D=87=E7=BA=A7=203.4.3?= =?UTF-8?q?=20=E5=88=86=E9=A1=B5Plus=E5=AF=B9=E8=B1=A1=E9=80=82=E9=85=8D?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 +-- .../com/ruoyi/common/core/page/PagePlus.java | 28 +++++++++++++------ 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index 1ba56af3..c8b41b20 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ 2.1.1 - 2.3.10.RELEASE + 2.3.11.RELEASE UTF-8 UTF-8 1.8 @@ -26,7 +26,7 @@ 4.1.2 1.7 0.9.1 - 3.4.2 + 3.4.3 5.5.8 2.2.6.RELEASE 11.0 diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java index 2bffe305..812a683d 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java @@ -123,15 +123,27 @@ public class PagePlus implements IPage { return this.optimizeCountSql; } - @Override - public boolean isSearchCount() { - return this.total >= 0L && this.isSearchCount; - } + @Override + public long getPages() { + // 解决 github issues/3208 + return IPage.super.getPages(); + } - public PagePlus setSearchCount(boolean isSearchCount) { - this.isSearchCount = isSearchCount; - return this; - } + public static PagePlus of(long current, long size) { + return of(current, size, 0); + } + + public static PagePlus of(long current, long size, long total) { + return of(current, size, total, true); + } + + public static PagePlus of(long current, long size, boolean searchCount) { + return of(current, size, 0, searchCount); + } + + public static PagePlus of(long current, long size, long total, boolean searchCount) { + return new PagePlus<>(current, size, total, searchCount); + } } From b2914cbcb19c2b7d181e8f9618ca9385d577a980 Mon Sep 17 00:00:00 2001 From: lyqwer <5224232+lyqwer@user.noreply.gitee.com> Date: Fri, 21 May 2021 17:24:48 +0800 Subject: [PATCH 20/42] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E5=90=8D=E5=8D=95=E8=AF=8D=E6=8B=BC=E5=86=99=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ruoyi/common/utils/ExceptionUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java index 4ca52838..f35aa046 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java @@ -22,7 +22,7 @@ public class ExceptionUtil return str; } - public static String getRootErrorMseeage(Exception e) + public static String getRootErrorMessage(Exception e) { Throwable root = ExceptionUtils.getRootCause(e); root = (root == null ? e : root); From dc7eeaa45d37ef89705005094ec250c7c91e465a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Fri, 21 May 2021 17:57:13 +0800 Subject: [PATCH 21/42] =?UTF-8?q?=E5=8F=91=E5=B8=83=202.1.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- ruoyi-ui/package.json | 2 +- ruoyi-ui/src/views/index.vue | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index c8b41b20..ef4b26af 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ RuoYi-Vue-Plus后台管理系统 - 2.1.1 + 2.1.2 2.3.11.RELEASE UTF-8 UTF-8 diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index 458a8752..fb9064f9 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -1,6 +1,6 @@ { "name": "ruoyi-vue-plus", - "version": "2.1.1", + "version": "2.1.2", "description": "RuoYi-Vue-Plus后台管理系统", "author": "LionLi", "license": "MIT", diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index 25cfa664..4ced4c26 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -80,6 +80,15 @@ 更新日志 + +
          +
        1. update springboot 升级 2.3.11
        2. +
        3. update mybatis-plus 升级 3.4.3 分页Plus对象适配更新
        4. +
        5. update 验证码生成更新为无符号整数计算
        6. +
        7. update 请求响应对象 与 分页对象 结构修改 适配接口文档配置
        8. +
        9. update swagger增加请求前缀
        10. +
        +
        1. update 配置统一提取为 properties 配置类
        2. From 9651a7d7fc670f28ef0eb8773cdbb169adce0be4 Mon Sep 17 00:00:00 2001 From: xivLi <13191800224@163.com> Date: Sat, 22 May 2021 15:52:19 +0800 Subject: [PATCH 22/42] =?UTF-8?q?=E5=88=A0=E5=8E=BButils.uuid=E4=B8=8B=20I?= =?UTF-8?q?dUtils=E7=B1=BB=E4=B8=AD=20=E5=A4=9A=E4=BD=99=E7=9A=84import(?= =?UTF-8?q?=E5=90=8C=E5=8C=85=E4=B8=8B=E7=9A=84UUID=E7=B1=BB)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/common/utils/uuid/IdUtils.java | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/IdUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/IdUtils.java index eb78f6fe..6f9577ff 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/IdUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/IdUtils.java @@ -1,21 +1,17 @@ package com.ruoyi.common.utils.uuid; -import com.ruoyi.common.utils.uuid.UUID; - /** * ID生成器工具类 * * @author ruoyi */ -public class IdUtils -{ +public class IdUtils { /** * 获取随机UUID * * @return 随机UUID */ - public static String randomUUID() - { + public static String randomUUID() { return UUID.randomUUID().toString(); } @@ -24,8 +20,7 @@ public class IdUtils * * @return 简化的UUID,去掉了横线 */ - public static String simpleUUID() - { + public static String simpleUUID() { return UUID.randomUUID().toString(true); } @@ -34,8 +29,7 @@ public class IdUtils * * @return 随机UUID */ - public static String fastUUID() - { + public static String fastUUID() { return UUID.fastUUID().toString(); } @@ -44,8 +38,7 @@ public class IdUtils * * @return 简化的UUID,去掉了横线 */ - public static String fastSimpleUUID() - { + public static String fastSimpleUUID() { return UUID.fastUUID().toString(true); } } From f3e5d908d61f8f6946d099c474d3bb21b413e4c9 Mon Sep 17 00:00:00 2001 From: xivLi <13191800224@163.com> Date: Sat, 22 May 2021 16:05:12 +0800 Subject: [PATCH 23/42] =?UTF-8?q?quartz=E6=A8=A1=E5=9D=97=E4=B8=8B=20domai?= =?UTF-8?q?n=E5=8C=85=E4=B8=AD=E7=9A=84=20SysJob=E7=B1=BB=E4=B8=8D?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E5=AE=9E=E7=8E=B0Serializable=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/quartz/domain/SysJob.java | 80 ++++++------------- 1 file changed, 26 insertions(+), 54 deletions(-) diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java index e9b80711..9fca0c73 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java @@ -1,6 +1,5 @@ package com.ruoyi.quartz.domain; -import java.io.Serializable; import java.util.Date; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; @@ -19,8 +18,7 @@ import com.ruoyi.quartz.util.CronUtils; * * @author ruoyi */ -public class SysJob extends BaseEntity implements Serializable -{ +public class SysJob extends BaseEntity { private static final long serialVersionUID = 1L; /** 任务ID */ @@ -55,118 +53,92 @@ public class SysJob extends BaseEntity implements Serializable @Excel(name = "任务状态", readConverterExp = "0=正常,1=暂停") private String status; - public Long getJobId() - { + public Long getJobId() { return jobId; } - public void setJobId(Long jobId) - { + public void setJobId(Long jobId) { this.jobId = jobId; } @NotBlank(message = "任务名称不能为空") @Size(min = 0, max = 64, message = "任务名称不能超过64个字符") - public String getJobName() - { + public String getJobName() { return jobName; } - public void setJobName(String jobName) - { + public void setJobName(String jobName) { this.jobName = jobName; } - public String getJobGroup() - { + public String getJobGroup() { return jobGroup; } - public void setJobGroup(String jobGroup) - { + public void setJobGroup(String jobGroup) { this.jobGroup = jobGroup; } @NotBlank(message = "调用目标字符串不能为空") @Size(min = 0, max = 500, message = "调用目标字符串长度不能超过500个字符") - public String getInvokeTarget() - { + public String getInvokeTarget() { return invokeTarget; } - public void setInvokeTarget(String invokeTarget) - { + public void setInvokeTarget(String invokeTarget) { this.invokeTarget = invokeTarget; } @NotBlank(message = "Cron执行表达式不能为空") @Size(min = 0, max = 255, message = "Cron执行表达式不能超过255个字符") - public String getCronExpression() - { + public String getCronExpression() { return cronExpression; } - public void setCronExpression(String cronExpression) - { + public void setCronExpression(String cronExpression) { this.cronExpression = cronExpression; } @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - public Date getNextValidTime() - { - if (StringUtils.isNotEmpty(cronExpression)) - { + public Date getNextValidTime() { + if (StringUtils.isNotEmpty(cronExpression)) { return CronUtils.getNextExecution(cronExpression); } return null; } - public String getMisfirePolicy() - { + public String getMisfirePolicy() { return misfirePolicy; } - public void setMisfirePolicy(String misfirePolicy) - { + public void setMisfirePolicy(String misfirePolicy) { this.misfirePolicy = misfirePolicy; } - public String getConcurrent() - { + public String getConcurrent() { return concurrent; } - public void setConcurrent(String concurrent) - { + public void setConcurrent(String concurrent) { this.concurrent = concurrent; } - public String getStatus() - { + public String getStatus() { return status; } - public void setStatus(String status) - { + public void setStatus(String status) { this.status = status; } @Override public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("jobId", getJobId()) - .append("jobName", getJobName()) - .append("jobGroup", getJobGroup()) - .append("cronExpression", getCronExpression()) - .append("nextValidTime", getNextValidTime()) - .append("misfirePolicy", getMisfirePolicy()) - .append("concurrent", getConcurrent()) - .append("status", getStatus()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("remark", getRemark()) - .toString(); + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("jobId", getJobId()) + .append("jobName", getJobName()).append("jobGroup", getJobGroup()) + .append("cronExpression", getCronExpression()).append("nextValidTime", getNextValidTime()) + .append("misfirePolicy", getMisfirePolicy()).append("concurrent", getConcurrent()) + .append("status", getStatus()).append("createBy", getCreateBy()).append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()).append("updateTime", getUpdateTime()).append("remark", getRemark()) + .toString(); } } From 798ffd9065d72d76bb48a69ae91e81a19be8f22e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E6=9D=B0?= <693337446@qq.com> Date: Sat, 22 May 2021 23:29:15 +0800 Subject: [PATCH 24/42] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=94=9F=E6=88=90=E5=99=A8=E4=B8=AD=E8=A1=A8=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=8F=96=E6=B6=88=E5=BF=85=E5=A1=AB=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/generator/service/GenTableServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java index e71e8896..f156e4f5 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java @@ -143,6 +143,7 @@ public class GenTableServiceImpl extends ServiceImpl i .set(cenTableColumn.getIsEdit() == null, GenTableColumn::getIsEdit, null) .set(cenTableColumn.getIsList() == null, GenTableColumn::getIsList, null) .set(cenTableColumn.getIsQuery() == null, GenTableColumn::getIsQuery, null) + .set(cenTableColumn.getIsRequired() == null, GenTableColumn::getIsRequired, null) .eq(GenTableColumn::getColumnId,cenTableColumn.getColumnId())); } } @@ -458,4 +459,4 @@ public class GenTableServiceImpl extends ServiceImpl i } return genPath + File.separator + VelocityUtils.getFileName(template, table); } -} \ No newline at end of file +} From 69dd3ab639593b08592066e8e6a9523b2098516c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E6=9D=B0?= <693337446@qq.com> Date: Sat, 22 May 2021 23:30:11 +0800 Subject: [PATCH 25/42] =?UTF-8?q?update=20=E4=BF=AE=E6=94=B9bo=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=BF=85=E5=A1=AB=E5=86=8D=E5=8A=A0=E8=BD=BD=E5=BF=85=E5=A1=AB?= =?UTF-8?q?=E6=B3=A8=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-generator/src/main/resources/vm/java/addBo.java.vm | 2 ++ ruoyi-generator/src/main/resources/vm/java/editBo.java.vm | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ruoyi-generator/src/main/resources/vm/java/addBo.java.vm b/ruoyi-generator/src/main/resources/vm/java/addBo.java.vm index 41fa0e95..98a14970 100644 --- a/ruoyi-generator/src/main/resources/vm/java/addBo.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/addBo.java.vm @@ -29,10 +29,12 @@ public class ${ClassName}AddBo { #if($column.javaType == 'Date') @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") #end +#if($column.isRequired==1) #if($column.javaType == 'String') @NotBlank(message = "$column.columnComment不能为空") #else @NotNull(message = "$column.columnComment不能为空") +#end #end private $column.javaType $column.javaField; #end diff --git a/ruoyi-generator/src/main/resources/vm/java/editBo.java.vm b/ruoyi-generator/src/main/resources/vm/java/editBo.java.vm index 3f3d9885..60b7e34c 100644 --- a/ruoyi-generator/src/main/resources/vm/java/editBo.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/editBo.java.vm @@ -29,10 +29,12 @@ public class ${ClassName}EditBo { #if($column.javaType == 'Date') @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") #end +#if($column.isRequired==1) #if($column.javaType == 'String') @NotBlank(message = "$column.columnComment不能为空") #else @NotNull(message = "$column.columnComment不能为空") +#end #end private $column.javaType $column.javaField; #end From 7b94ae3a9a5ecec4858749681a087e3d15a856f1 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sun, 23 May 2021 19:20:36 +0800 Subject: [PATCH 26/42] =?UTF-8?q?xss=E6=A0=A1=E9=AA=8Cjson=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/common/filter/XssHttpServletRequestWrapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java b/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java index 6794394c..c0ab6e5f 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java @@ -99,6 +99,6 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper public boolean isJsonRequest() { String header = super.getHeader(HttpHeaders.CONTENT_TYPE); - return MediaType.APPLICATION_JSON_VALUE.equalsIgnoreCase(header); + return StringUtils.startsWithIgnoreCase(header, MediaType.APPLICATION_JSON_VALUE); } } \ No newline at end of file From 77ebca264ae7a9124ed31ce34539533776802032 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sun, 23 May 2021 19:22:30 +0800 Subject: [PATCH 27/42] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E5=BD=A2=E5=8F=82=E6=9C=AA=E4=BC=A0=E5=80=BC=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ruoyi/framework/aspectj/LogAspect.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java index 41e734fd..18500abe 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java @@ -197,7 +197,7 @@ public class LogAspect { for (int i = 0; i < paramsArray.length; i++) { - if (!isFilterObject(paramsArray[i])) + if (StringUtils.isNotNull(paramsArray[i]) && !isFilterObject(paramsArray[i])) { Object jsonObj = JSON.toJSON(paramsArray[i]); params += jsonObj.toString() + " "; From 56a943bf48e204f24d0e1bbbf2cb7e82f3eb2662 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Mon, 24 May 2021 11:24:54 +0800 Subject: [PATCH 28/42] =?UTF-8?q?=E5=8D=87=E7=BA=A7druid=E5=88=B0=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E7=89=88=E6=9C=ACv1.2.6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- ruoyi-generator/src/main/resources/vm/java/mapper.java.vm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 53467b25..935ff97f 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ UTF-8 1.8 3.1.1 - 1.2.4 + 1.2.6 1.21 2.9.2 2.3.2 diff --git a/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm b/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm index 28a25672..282d9ea8 100644 --- a/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm @@ -83,7 +83,7 @@ public interface ${ClassName}Mapper /** * 通过${functionName}ID删除${subTable.functionName}信息 * - * @param ${pkColumn.javaField} ${functionName}ID + * @param ${pkColumn.javaField} ${functionName}ID * @return 结果 */ public int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField}); From 2adac4a899bc1f7cb6df8117becadd434caa7f6c Mon Sep 17 00:00:00 2001 From: RuoYi Date: Mon, 24 May 2021 11:25:17 +0800 Subject: [PATCH 29/42] =?UTF-8?q?=E5=8D=87=E7=BA=A7fastjson=E5=88=B0?= =?UTF-8?q?=E6=9C=80=E6=96=B0=E7=89=881.2.76?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 935ff97f..a3b0b1b6 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ 2.3.2 2.1.4 1.3.0 - 1.2.75 + 1.2.76 5.6.0 5.7.0 2.5 From 7e79c4f249b6da5b0176c1d23c4e8d513f063bdd Mon Sep 17 00:00:00 2001 From: RuoYi Date: Mon, 24 May 2021 11:34:03 +0800 Subject: [PATCH 30/42] =?UTF-8?q?=E7=94=9F=E6=88=90vue=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=8C=89=E9=92=AE=E7=82=B9=E5=87=BB=E5=90=8E?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=81=AE=E7=BD=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/common/utils/uuid/IdUtils.java | 15 ++-- .../src/main/resources/vm/vue/index.vue.vm | 7 +- .../java/com/ruoyi/quartz/domain/SysJob.java | 79 +++++++++++++------ 3 files changed, 69 insertions(+), 32 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/IdUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/IdUtils.java index 6f9577ff..0256511f 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/IdUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/IdUtils.java @@ -5,13 +5,15 @@ package com.ruoyi.common.utils.uuid; * * @author ruoyi */ -public class IdUtils { +public class IdUtils +{ /** * 获取随机UUID * * @return 随机UUID */ - public static String randomUUID() { + public static String randomUUID() + { return UUID.randomUUID().toString(); } @@ -20,7 +22,8 @@ public class IdUtils { * * @return 简化的UUID,去掉了横线 */ - public static String simpleUUID() { + public static String simpleUUID() + { return UUID.randomUUID().toString(true); } @@ -29,7 +32,8 @@ public class IdUtils { * * @return 随机UUID */ - public static String fastUUID() { + public static String fastUUID() + { return UUID.fastUUID().toString(); } @@ -38,7 +42,8 @@ public class IdUtils { * * @return 简化的UUID,去掉了横线 */ - public static String fastSimpleUUID() { + public static String fastSimpleUUID() + { return UUID.fastUUID().toString(true); } } diff --git a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm index cbf3e649..501f2f63 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm @@ -108,6 +108,7 @@ plain icon="el-icon-download" size="mini" + :loading="exportLoading" @click="handleExport" v-hasPermi="['${moduleName}:${businessName}:export']" >导出 @@ -354,6 +355,8 @@ export default { return { // 遮罩层 loading: true, + // 导出遮罩层 + exportLoading: false, // 选中数组 ids: [], #if($table.sub) @@ -630,10 +633,12 @@ export default { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" - }).then(function() { + }).then(() => { + this.exportLoading = true; return export${BusinessName}(queryParams); }).then(response => { this.download(response.msg); + this.exportLoading = false; }) } } diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java index 9fca0c73..4776e5fe 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java @@ -18,7 +18,8 @@ import com.ruoyi.quartz.util.CronUtils; * * @author ruoyi */ -public class SysJob extends BaseEntity { +public class SysJob extends BaseEntity +{ private static final long serialVersionUID = 1L; /** 任务ID */ @@ -53,92 +54,118 @@ public class SysJob extends BaseEntity { @Excel(name = "任务状态", readConverterExp = "0=正常,1=暂停") private String status; - public Long getJobId() { + public Long getJobId() + { return jobId; } - public void setJobId(Long jobId) { + public void setJobId(Long jobId) + { this.jobId = jobId; } @NotBlank(message = "任务名称不能为空") @Size(min = 0, max = 64, message = "任务名称不能超过64个字符") - public String getJobName() { + public String getJobName() + { return jobName; } - public void setJobName(String jobName) { + public void setJobName(String jobName) + { this.jobName = jobName; } - public String getJobGroup() { + public String getJobGroup() + { return jobGroup; } - public void setJobGroup(String jobGroup) { + public void setJobGroup(String jobGroup) + { this.jobGroup = jobGroup; } @NotBlank(message = "调用目标字符串不能为空") @Size(min = 0, max = 500, message = "调用目标字符串长度不能超过500个字符") - public String getInvokeTarget() { + public String getInvokeTarget() + { return invokeTarget; } - public void setInvokeTarget(String invokeTarget) { + public void setInvokeTarget(String invokeTarget) + { this.invokeTarget = invokeTarget; } @NotBlank(message = "Cron执行表达式不能为空") @Size(min = 0, max = 255, message = "Cron执行表达式不能超过255个字符") - public String getCronExpression() { + public String getCronExpression() + { return cronExpression; } - public void setCronExpression(String cronExpression) { + public void setCronExpression(String cronExpression) + { this.cronExpression = cronExpression; } @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - public Date getNextValidTime() { - if (StringUtils.isNotEmpty(cronExpression)) { + public Date getNextValidTime() + { + if (StringUtils.isNotEmpty(cronExpression)) + { return CronUtils.getNextExecution(cronExpression); } return null; } - public String getMisfirePolicy() { + public String getMisfirePolicy() + { return misfirePolicy; } - public void setMisfirePolicy(String misfirePolicy) { + public void setMisfirePolicy(String misfirePolicy) + { this.misfirePolicy = misfirePolicy; } - public String getConcurrent() { + public String getConcurrent() + { return concurrent; } - public void setConcurrent(String concurrent) { + public void setConcurrent(String concurrent) + { this.concurrent = concurrent; } - public String getStatus() { + public String getStatus() + { return status; } - public void setStatus(String status) { + public void setStatus(String status) + { this.status = status; } @Override public String toString() { - return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("jobId", getJobId()) - .append("jobName", getJobName()).append("jobGroup", getJobGroup()) - .append("cronExpression", getCronExpression()).append("nextValidTime", getNextValidTime()) - .append("misfirePolicy", getMisfirePolicy()).append("concurrent", getConcurrent()) - .append("status", getStatus()).append("createBy", getCreateBy()).append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()).append("updateTime", getUpdateTime()).append("remark", getRemark()) - .toString(); + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("jobId", getJobId()) + .append("jobName", getJobName()) + .append("jobGroup", getJobGroup()) + .append("cronExpression", getCronExpression()) + .append("nextValidTime", getNextValidTime()) + .append("misfirePolicy", getMisfirePolicy()) + .append("concurrent", getConcurrent()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); } } From 883cff5de9db3fcd8a119ca5afdded14783698b3 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Mon, 24 May 2021 14:15:41 +0800 Subject: [PATCH 31/42] =?UTF-8?q?=E6=96=B0=E5=A2=9EIE=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E5=99=A8=E7=89=88=E6=9C=AC=E8=BF=87=E4=BD=8E=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/public/html/ie.html | 46 ++++++++++++++++++++++++++++++++++++ ruoyi-ui/public/index.html | 1 + 2 files changed, 47 insertions(+) create mode 100644 ruoyi-ui/public/html/ie.html diff --git a/ruoyi-ui/public/html/ie.html b/ruoyi-ui/public/html/ie.html new file mode 100644 index 00000000..390ce8ab --- /dev/null +++ b/ruoyi-ui/public/html/ie.html @@ -0,0 +1,46 @@ + + + + + + 请升级您的浏览器 + + + + + + +

          请升级您的浏览器,以便我们更好的为您提供服务!

          +

          您正在使用 Internet Explorer 的早期版本(IE11以下版本或使用该内核的浏览器)。这意味着在升级浏览器前,您将无法访问此网站。

          +
          +

          请注意:微软公司对Windows XP 及 Internet Explorer 早期版本的支持已经结束

          +

          自 2016 年 1 月 12 日起,Microsoft 不再为 IE 11 以下版本提供相应支持和更新。没有关键的浏览器安全更新,您的电脑可能易受有害病毒、间谍软件和其他恶意软件的攻击,它们可以窃取或损害您的业务数据和信息。请参阅 微软对 Internet Explorer 早期版本的支持将于 2016 年 1 月 12 日结束的说明

          +
          +

          您可以选择更先进的浏览器

          +

          推荐使用以下浏览器的最新版本。如果您的电脑已有以下浏览器的最新版本则直接使用该浏览器访问即可。

          + +
          + + \ No newline at end of file diff --git a/ruoyi-ui/public/index.html b/ruoyi-ui/public/index.html index 525e2acd..4e740010 100644 --- a/ruoyi-ui/public/index.html +++ b/ruoyi-ui/public/index.html @@ -7,6 +7,7 @@ <%= webpackConfig.name %> +