From 7c394a46ace0326b9f8ba7f691140d2bc6262d76 Mon Sep 17 00:00:00 2001 From: 1332987 <13329870472@163.com> Date: Wed, 20 Apr 2022 11:40:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0TODO=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E7=BA=A6=E6=89=AB=E6=8F=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/core/utils/html/EscapeUtil.java | 10 +++---- .../common/core/utils/html/HtmlFilter.java | 24 ++++++++-------- .../common/core/utils/poi/ExcelUtil.java | 2 +- .../ruoyi/common/core/utils/sign/Base64.java | 16 +++++------ .../ruoyi/common/core/utils/uuid/UUID.java | 28 +++++++++---------- .../gateway/service/ValidateCodeService.java | 6 ++++ .../com/ruoyi/job/service/ISysJobService.java | 14 ++++++---- 7 files changed, 54 insertions(+), 46 deletions(-) diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/html/EscapeUtil.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/html/EscapeUtil.java index e8b7357f..65c8ba11 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/html/EscapeUtil.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/html/EscapeUtil.java @@ -21,11 +21,11 @@ public class EscapeUtil } // special HTML characters - TEXT['\''] = "'".toCharArray(); // 单引号 - TEXT['"'] = """.toCharArray(); // 双引号 - TEXT['&'] = "&".toCharArray(); // &符 - TEXT['<'] = "<".toCharArray(); // 小于号 - TEXT['>'] = ">".toCharArray(); // 大于号 + TEXT['\''] = "'".toCharArray(); + TEXT['"'] = """.toCharArray(); + TEXT['&'] = "&".toCharArray(); + TEXT['<'] = "<".toCharArray(); + TEXT['>'] = ">".toCharArray(); } /** diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/html/HtmlFilter.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/html/HtmlFilter.java index a79a7512..9ed5f388 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/html/HtmlFilter.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/html/HtmlFilter.java @@ -121,7 +121,7 @@ public final class HtmlFilter { vSelfClosingTags = new String[]{"img"}; vNeedClosingTags = new String[]{"a", "b", "strong", "i", "em"}; vDisallowed = new String[]{}; - vAllowedProtocols = new String[]{"http", "mailto", "https"}; // no ftp. + vAllowedProtocols = new String[]{"http", "mailto", "https"}; vProtocolAtts = new String[]{"src", "href"}; vRemoveBlanks = new String[]{"a", "b", "strong", "i", "em"}; vAllowedEntities = new String[]{"amp", "gt", "lt", "quot"}; @@ -221,7 +221,7 @@ public final class HtmlFilter { final Matcher m = P_COMMENTS.matcher(s); final StringBuffer buf = new StringBuffer(); if (m.find()) { - final String match = m.group(1); // (.*?) + final String match = m.group(1); m.appendReplacement(buf, Matcher.quoteReplacement("")); } m.appendTail(buf); @@ -329,12 +329,12 @@ public final class HtmlFilter { final List paramNames = new ArrayList<>(); final List paramValues = new ArrayList<>(); while (m2.find()) { - paramNames.add(m2.group(1)); // ([a-z0-9]+) - paramValues.add(m2.group(3)); // (.*?) + paramNames.add(m2.group(1)); + paramValues.add(m2.group(3)); } while (m3.find()) { - paramNames.add(m3.group(1)); // ([a-z0-9]+) - paramValues.add(m3.group(3)); // ([^\"\\s']+) + paramNames.add(m3.group(1)); + paramValues.add(m3.group(3)); } String paramName, paramValue; for (int ii = 0; ii < paramNames.size(); ii++) { @@ -434,8 +434,8 @@ public final class HtmlFilter { // validate entities throughout the string Matcher m = P_VALID_ENTITIES.matcher(s); while (m.find()) { - final String one = m.group(1); // ([^&;]*) - final String two = m.group(2); // (?=(;|&|$)) + final String one = m.group(1); + final String two = m.group(2); m.appendReplacement(buf, Matcher.quoteReplacement(checkEntity(one, two))); } m.appendTail(buf); @@ -448,10 +448,10 @@ public final class HtmlFilter { StringBuffer buf = new StringBuffer(); Matcher m = P_VALID_QUOTES.matcher(s); while (m.find()) { - final String one = m.group(1); // (>|^) - final String two = m.group(2); // ([^<]+?) - final String three = m.group(3); // (<|$) - // 不替换双引号为",防止json格式无效 regexReplace(P_QUOTE, """, two) + final String one = m.group(1); + final String two = m.group(2); + final String three = m.group(3); + /*不替换双引号为",防止json格式无效 regexReplace(P_QUOTE, """, two)*/ m.appendReplacement(buf, Matcher.quoteReplacement(one + two + three)); } m.appendTail(buf); diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/poi/ExcelUtil.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/poi/ExcelUtil.java index 461c4f6f..a5f5e29d 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/poi/ExcelUtil.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/poi/ExcelUtil.java @@ -908,7 +908,7 @@ public class ExcelUtil { if (cell.getCellType() == CellType.NUMERIC || cell.getCellType() == CellType.FORMULA) { val = cell.getNumericCellValue(); if (DateUtil.isCellDateFormatted(cell)) { - val = DateUtil.getJavaDate((Double) val); // POI Excel 日期格式转换 + val = DateUtil.getJavaDate((Double) val); } else { if ((Double) val % 1 != 0) { val = new BigDecimal(val.toString()); diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/sign/Base64.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/sign/Base64.java index e22079ff..48fbe7a6 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/sign/Base64.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/sign/Base64.java @@ -145,9 +145,9 @@ public final class Base64 { return null; } char[] base64Data = encoded.toCharArray(); - int len = removeWhiteSpace(base64Data);// 删除空格 + int len = removeWhiteSpace(base64Data); if (len % FOURBYTE != 0) { - return null;// sho应该能被四整除 + return null; } int numberQuadruple = (len / FOURBYTE); if (numberQuadruple == 0) { @@ -164,7 +164,7 @@ public final class Base64 { if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++])) || !isData((d3 = base64Data[dataIndex++])) || !isData((d4 = base64Data[dataIndex++]))) { return null; - } // if found "no data" just return null + } b1 = BASE_64_ALPHABET[d1]; b2 = BASE_64_ALPHABET[d2]; b3 = BASE_64_ALPHABET[d3]; @@ -174,16 +174,15 @@ public final class Base64 { decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); } if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) { - return null;// if found "no data" just return null + return null; } b1 = BASE_64_ALPHABET[d1]; b2 = BASE_64_ALPHABET[d2]; d3 = base64Data[dataIndex++]; d4 = base64Data[dataIndex++]; - if (!isData((d3)) || !isData((d4))) {// Check if they are PAD characters + if (!isData((d3)) || !isData((d4))) { if (isPad(d3) && isPad(d4)) { - if ((b2 & 0xf) != 0)// last 4 bits should be zero - { + if ((b2 & 0xf) != 0) { return null; } byte[] tmp = new byte[i * 3 + 1]; @@ -192,8 +191,7 @@ public final class Base64 { return tmp; } else if (!isPad(d3) && isPad(d4)) { b3 = BASE_64_ALPHABET[d3]; - if ((b3 & 0x3) != 0)// last 2 bits should be zero - { + if ((b3 & 0x3) != 0) { return null; } byte[] tmp = new byte[i * 3 + 2]; diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/uuid/UUID.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/uuid/UUID.java index 06a2c9b4..70df239d 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/uuid/UUID.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/uuid/UUID.java @@ -98,10 +98,10 @@ public final class UUID implements java.io.Serializable, Comparable byte[] randomBytes = new byte[16]; ng.nextBytes(randomBytes); - randomBytes[6] &= 0x0f; /* clear version */ - randomBytes[6] |= 0x40; /* set to version 4 */ - randomBytes[8] &= 0x3f; /* clear variant */ - randomBytes[8] |= 0x80; /* set to IETF variant */ + randomBytes[6] &= 0x0f; + randomBytes[6] |= 0x40; + randomBytes[8] &= 0x3f; + randomBytes[8] |= 0x80; return new UUID(randomBytes); } @@ -124,10 +124,10 @@ public final class UUID implements java.io.Serializable, Comparable throw new InternalError("MD5 not supported"); } byte[] md5Bytes = md.digest(name); - md5Bytes[6] &= 0x0f; /* clear version */ - md5Bytes[6] |= 0x30; /* set to version 3 */ - md5Bytes[8] &= 0x3f; /* clear variant */ - md5Bytes[8] |= 0x80; /* set to IETF variant */ + md5Bytes[6] &= 0x0f; + md5Bytes[6] |= 0x30; + md5Bytes[8] &= 0x3f; + md5Bytes[8] |= 0x80; return new UUID(md5Bytes); } @@ -245,8 +245,8 @@ public final class UUID implements java.io.Serializable, Comparable public long timestamp() throws UnsupportedOperationException { checkTimeBase(); - return (mostSigBits & 0x0FFFL) << 48// - | ((mostSigBits >> 16) & 0x0FFFFL) << 32// + return (mostSigBits & 0x0FFFL) << 48 + | ((mostSigBits >> 16) & 0x0FFFFL) << 32 | mostSigBits >>> 32; } @@ -425,10 +425,10 @@ public final class UUID implements java.io.Serializable, Comparable { // The ordering is intentionally set up so that the UUIDs // can simply be numerically compared as two numbers - return (this.mostSigBits < val.mostSigBits ? -1 : // - (this.mostSigBits > val.mostSigBits ? 1 : // - (this.leastSigBits < val.leastSigBits ? -1 : // - (this.leastSigBits > val.leastSigBits ? 1 : // + return (this.mostSigBits < val.mostSigBits ? -1 : + (this.mostSigBits > val.mostSigBits ? 1 : + (this.leastSigBits < val.leastSigBits ? -1 : + (this.leastSigBits > val.leastSigBits ? 1 : 0)))); } diff --git a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/service/ValidateCodeService.java b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/service/ValidateCodeService.java index 615fb07b..650be4a1 100644 --- a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/service/ValidateCodeService.java +++ b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/service/ValidateCodeService.java @@ -13,11 +13,17 @@ public interface ValidateCodeService { /** * 生成验证码 + * @return AjaxResult + * @throws IOException / + * @throws CaptchaException / */ public AjaxResult createCaptcha() throws IOException, CaptchaException; /** * 校验验证码 + * @param key 键 + * @param value 值 + * @throws CaptchaException / */ public void checkCaptcha(String key, String value) throws CaptchaException; } diff --git a/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/service/ISysJobService.java b/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/service/ISysJobService.java index e8a93768..ea7bbbb1 100644 --- a/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/service/ISysJobService.java +++ b/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/service/ISysJobService.java @@ -56,42 +56,46 @@ public interface ISysJobService public int deleteJob(SysJob job) throws SchedulerException; /** + * * 批量删除调度信息 - * + * * @param jobIds 需要删除的任务ID * @return 结果 + * @throws SchedulerException / */ public void deleteJobByIds(Long[] jobIds) throws SchedulerException; /** * 任务调度状态修改 - * * @param job 调度信息 * @return 结果 + * @throws SchedulerException / */ public int changeStatus(SysJob job) throws SchedulerException; /** * 立即运行任务 - * * @param job 调度信息 * @return 结果 + * @throws SchedulerException / */ public void run(SysJob job) throws SchedulerException; /** * 新增任务 - * * @param job 调度信息 * @return 结果 + * @throws SchedulerException / + * @throws TaskException / */ public int insertJob(SysJob job) throws SchedulerException, TaskException; /** * 更新任务 - * * @param job 调度信息 * @return 结果 + * @throws SchedulerException / + * @throws TaskException / */ public int updateJob(SysJob job) throws SchedulerException, TaskException;