From bfb6f13b3b2777d70786fc284b313ba655623328 Mon Sep 17 00:00:00 2001 From: wangxy <1481820854@qq.com> Date: Wed, 21 May 2025 08:59:49 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/更新记录 | 2 +- .../com/archive/common/convert/ZHConvert.java | 354 ++--- .../common/exception/UtilException.java | 52 +- .../common/exception/user/UserException.java | 36 +- .../user/UserNotExistsException.java | 32 +- .../user/UserPasswordNotMatchException.java | 32 +- .../UserPasswordRetryLimitCountException.java | 32 +- ...UserPasswordRetryLimitExceedException.java | 32 +- .../common/utils/uuid/UUID$Holder.java | 52 +- .../com/archive/common/utils/uuid/UUID.java | 968 +++++++------- .../com/archive/common/xss/XssFilter.java | 186 +-- .../xss/XssHttpServletRequestWrapper.java | 78 +- .../framework/shiro/realm/UserRealm.java | 316 ++--- .../archive/framework/web/domain/Ztree.java | 208 +-- .../controller/UserOnlineController.java | 176 +-- .../monitor/online/domain/UserOnline.java | 380 +++--- .../online/service/UserOnlineServiceImpl.java | 302 ++--- .../project/system/user/domain/UserPost.java | 90 +- .../project/system/user/domain/UserRole.java | 92 +- .../system/user/domain/UserStatus.java | 62 +- .../system/user/service/UserServiceImpl.java | 1190 ++++++++--------- .../tool/gen/util/VelocityInitializer.java | 70 +- .../project/tool/gen/util/VelocityUtils.java | 736 +++++----- .../project/tool/swagger/UserEntity.java | 350 ++--- .../static/plugins/pdfjs/web/viewer.js | 78 +- 25 files changed, 2953 insertions(+), 2953 deletions(-) diff --git a/sql/更新记录 b/sql/更新记录 index 7854801..2312b7f 100644 --- a/sql/更新记录 +++ b/sql/更新记录 @@ -22,7 +22,7 @@ 调整文件汇总 调整版本:v4.7.1 更新日志:http://doc.ruoyi.vip/ruoyi/document/gxrz.html#v4-7-1 src/main/java/com/ruoyi/framework/config/ScheduleConfig.java -src/main/resources/mybatis/**/**.xml +src/main/resources/mybatis**.xml src/main/resources/templates/system/user/user.html src/main/resources/application-druid.yml src/main/resources/application.yml diff --git a/src/main/java/com/archive/common/convert/ZHConvert.java b/src/main/java/com/archive/common/convert/ZHConvert.java index 56263e3..d448f1a 100644 --- a/src/main/java/com/archive/common/convert/ZHConvert.java +++ b/src/main/java/com/archive/common/convert/ZHConvert.java @@ -1,187 +1,187 @@ -/* */ package com.archive.common.convert; + package com.archive.common.convert; -/* */ -/* */ import java.io.BufferedReader; -/* */ import java.io.FileNotFoundException; -/* */ import java.io.IOException; -/* */ import java.io.InputStream; -/* */ import java.io.InputStreamReader; -/* */ import java.util.HashMap; -/* */ import java.util.HashSet; -/* */ import java.util.Iterator; -/* */ import java.util.Map; -/* */ import java.util.Properties; -/* */ import java.util.Set; -/* */ import net.sourceforge.pinyin4j.PinyinHelper; -/* */ import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType; -/* */ import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat; -/* */ import net.sourceforge.pinyin4j.format.HanyuPinyinToneType; -/* */ import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType; -/* */ import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public class ZHConvert -/* */ { -/* 27 */ private Properties charMap = new Properties(); -/* 28 */ private Set conflictingSets = new HashSet<>(); -/* */ public static final int TRADITIONAL = 0; -/* */ public static final int SIMPLIFIED = 1; -/* */ private static final int NUM_OF_CONVERTERS = 2; -/* 32 */ private static final com.archive.common.convert.ZHConvert[] converters = new com.archive.common.convert.ZHConvert[2]; -/* 33 */ private static final String[] propertyFiles = new String[2]; -/* */ static { -/* 35 */ propertyFiles[0] = "zh2Hant.properties"; -/* 36 */ propertyFiles[1] = "zh2Hans.properties"; -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public static com.archive.common.convert.ZHConvert getInstance(int converterType) { -/* 45 */ if (converterType >= 0 && converterType < 2) { -/* 46 */ if (converters[converterType] == null) { -/* 47 */ synchronized (com.archive.common.convert.ZHConvert.class) { -/* 48 */ if (converters[converterType] == null) { -/* 49 */ converters[converterType] = new com.archive.common.convert.ZHConvert(propertyFiles[converterType]); -/* */ } -/* */ } -/* */ } -/* 53 */ return converters[converterType]; -/* */ } -/* 55 */ return null; -/* */ } -/* */ -/* */ -/* */ public static String convert(String text, int converterType) { -/* 60 */ com.archive.common.convert.ZHConvert instance = getInstance(converterType); -/* 61 */ return instance.convert(text); -/* */ } -/* */ -/* */ -/* */ private ZHConvert(String propertyFile) { -/* 66 */ InputStream is = null; -/* 67 */ is = getClass().getResourceAsStream(propertyFile); -/* */ -/* 69 */ if (is != null) { -/* 70 */ BufferedReader reader = null; -/* */ -/* 72 */ try { reader = new BufferedReader(new InputStreamReader(is)); -/* 73 */ this.charMap.load(reader); } -/* 74 */ catch (FileNotFoundException fileNotFoundException) -/* */ -/* */ { -/* */ try { -/* */ -/* */ -/* 80 */ if (reader != null) -/* 81 */ { + + import java.io.BufferedReader; + import java.io.FileNotFoundException; + import java.io.IOException; + import java.io.InputStream; + import java.io.InputStreamReader; + import java.util.HashMap; + import java.util.HashSet; + import java.util.Iterator; + import java.util.Map; + import java.util.Properties; + import java.util.Set; + import net.sourceforge.pinyin4j.PinyinHelper; + import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType; + import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat; + import net.sourceforge.pinyin4j.format.HanyuPinyinToneType; + import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType; + import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; + + + + + + public class ZHConvert + { + private Properties charMap = new Properties(); + private Set conflictingSets = new HashSet<>(); + public static final int TRADITIONAL = 0; + public static final int SIMPLIFIED = 1; + private static final int NUM_OF_CONVERTERS = 2; + private static final com.archive.common.convert.ZHConvert[] converters = new com.archive.common.convert.ZHConvert[2]; + private static final String[] propertyFiles = new String[2]; + static { + propertyFiles[0] = "zh2Hant.properties"; + propertyFiles[1] = "zh2Hans.properties"; + } + + + + + + + public static com.archive.common.convert.ZHConvert getInstance(int converterType) { + if (converterType >= 0 && converterType < 2) { + if (converters[converterType] == null) { + synchronized (com.archive.common.convert.ZHConvert.class) { + if (converters[converterType] == null) { + converters[converterType] = new com.archive.common.convert.ZHConvert(propertyFiles[converterType]); + } + } + } + return converters[converterType]; + } + return null; + } + + + public static String convert(String text, int converterType) { + com.archive.common.convert.ZHConvert instance = getInstance(converterType); + return instance.convert(text); + } + + + private ZHConvert(String propertyFile) { + InputStream is = null; + is = getClass().getResourceAsStream(propertyFile); + + if (is != null) { + BufferedReader reader = null; + + try { reader = new BufferedReader(new InputStreamReader(is)); + this.charMap.load(reader); } + catch (FileNotFoundException fileNotFoundException) + + { + try { + + + if (reader != null) + { reader.close(); } -/* 82 */ if (is != null) -/* 83 */ { + if (is != null) + { is.close(); } -/* 84 */ } catch (IOException iOException) {} } catch (IOException e) { e.printStackTrace(); } finally { try { if (reader != null) reader.close(); if (is != null) is.close(); } catch (IOException iOException) {} } -/* */ -/* */ } -/* */ -/* 88 */ initializeHelper(); -/* */ } -/* */ -/* */ -/* */ private void initializeHelper() { -/* 93 */ -/* */ } -/* */ -/* */ public String convert(String in) { -/* 120 */ StringBuilder outString = new StringBuilder(); -/* 121 */ StringBuilder stackString = new StringBuilder(); -/* 122 */ for (int i = 0; i < in.length(); i++) { -/* 123 */ char c = in.charAt(i); -/* 124 */ String key = "" + c; -/* 125 */ stackString.append(key); -/* 126 */ if (!this.conflictingSets.contains(stackString.toString())) -/* 127 */ { + } catch (IOException iOException) {} } catch (IOException e) { e.printStackTrace(); } finally { try { if (reader != null) reader.close(); if (is != null) is.close(); } catch (IOException iOException) {} } + + } + + initializeHelper(); + } + + + private void initializeHelper() { + + } + + public String convert(String in) { + StringBuilder outString = new StringBuilder(); + StringBuilder stackString = new StringBuilder(); + for (int i = 0; i < in.length(); i++) { + char c = in.charAt(i); + String key = "" + c; + stackString.append(key); + if (!this.conflictingSets.contains(stackString.toString())) + { if (this.charMap.containsKey(stackString.toString())) { - /* 128 */ outString.append(this.charMap.get(stackString.toString())); - /* 129 */ stackString.setLength(0); - /* */ } else { - /* 131 */ CharSequence sequence = stackString.subSequence(0, stackString.length() - 1); - /* 132 */ stackString.delete(0, stackString.length() - 1); - /* 133 */ flushStack(outString, new StringBuilder(sequence)); - /* */ } + outString.append(this.charMap.get(stackString.toString())); + stackString.setLength(0); + } else { + CharSequence sequence = stackString.subSequence(0, stackString.length() - 1); + stackString.delete(0, stackString.length() - 1); + flushStack(outString, new StringBuilder(sequence)); + } } -/* */ } -/* 136 */ flushStack(outString, stackString); -/* 137 */ return outString.toString(); -/* */ } -/* */ -/* */ private void flushStack(StringBuilder outString, StringBuilder stackString) { -/* 141 */ while (stackString.length() > 0) { -/* 142 */ if (this.charMap.containsKey(stackString.toString())) { -/* 143 */ outString.append(this.charMap.get(stackString.toString())); -/* 144 */ stackString.setLength(0); continue; -/* */ } -/* 146 */ outString.append("" + stackString.charAt(0)); -/* 147 */ stackString.delete(0, 1); -/* */ } -/* */ } -/* */ -/* */ String parseOneChar(String c) { -/* 152 */ if (this.charMap.containsKey(c)) { -/* 153 */ return (String)this.charMap.get(c); -/* */ } -/* */ -/* 156 */ return c; -/* */ } -/* */ -/* */ -/* */ public static String getPingYin(String src) { -/* 161 */ char[] t1 = src.toCharArray(); -/* 162 */ String[] t2 = new String[t1.length]; -/* */ -/* 164 */ HanyuPinyinOutputFormat t3 = new HanyuPinyinOutputFormat(); -/* 165 */ t3.setCaseType(HanyuPinyinCaseType.LOWERCASE); -/* 166 */ t3.setToneType(HanyuPinyinToneType.WITHOUT_TONE); -/* 167 */ t3.setVCharType(HanyuPinyinVCharType.WITH_U_UNICODE); -/* */ -/* 169 */ String t4 = ""; -/* 170 */ int t0 = t1.length; -/* */ try { -/* 172 */ for (int i = 0; i < t0; i++) { -/* */ -/* 174 */ if (Character.toString(t1[i]).matches("[\\u4E00-\\u9FA5]+")) { -/* 175 */ t2 = PinyinHelper.toHanyuPinyinStringArray(t1[i], t3); -/* 176 */ if (t2 != null && t2.length > 0 && t2[0] != null) { -/* 177 */ t4 = t4 + t2[0]; -/* */ } -/* */ } else { -/* */ -/* 181 */ t4 = t4 + Character.toString(t1[i]); -/* */ } -/* */ } -/* 184 */ return t4; -/* 185 */ } catch (BadHanyuPinyinOutputFormatCombination e1) { -/* 186 */ System.out.println("拼音转换失败(src):" + e1.getMessage()); -/* */ -/* 188 */ return t4; -/* */ } -/* */ } -/* */ -/* */ public static void main(String[] args) { -/* 193 */ String allValueSimplified = convert("1111", 1); -/* */ -/* 195 */ String allValueTraditional = convert("1111", 0); -/* */ -/* */ -/* 198 */ String allValuePinyin = getPingYin("11111111"); -/* */ } -/* */ } + } + flushStack(outString, stackString); + return outString.toString(); + } + + private void flushStack(StringBuilder outString, StringBuilder stackString) { + while (stackString.length() > 0) { + if (this.charMap.containsKey(stackString.toString())) { + outString.append(this.charMap.get(stackString.toString())); + stackString.setLength(0); continue; + } + outString.append("" + stackString.charAt(0)); + stackString.delete(0, 1); + } + } + + String parseOneChar(String c) { + if (this.charMap.containsKey(c)) { + return (String)this.charMap.get(c); + } + + return c; + } + + + public static String getPingYin(String src) { + char[] t1 = src.toCharArray(); + String[] t2 = new String[t1.length]; + + HanyuPinyinOutputFormat t3 = new HanyuPinyinOutputFormat(); + t3.setCaseType(HanyuPinyinCaseType.LOWERCASE); + t3.setToneType(HanyuPinyinToneType.WITHOUT_TONE); + t3.setVCharType(HanyuPinyinVCharType.WITH_U_UNICODE); + + String t4 = ""; + int t0 = t1.length; + try { + for (int i = 0; i < t0; i++) { + + if (Character.toString(t1[i]).matches("[\\u4E00-\\u9FA5]+")) { + t2 = PinyinHelper.toHanyuPinyinStringArray(t1[i], t3); + if (t2 != null && t2.length > 0 && t2[0] != null) { + t4 = t4 + t2[0]; + } + } else { + + t4 = t4 + Character.toString(t1[i]); + } + } + return t4; + } catch (BadHanyuPinyinOutputFormatCombination e1) { + System.out.println("拼音转换失败(src):" + e1.getMessage()); + + return t4; + } + } + + public static void main(String[] args) { + String allValueSimplified = convert("1111", 1); + + String allValueTraditional = convert("1111", 0); + + + String allValuePinyin = getPingYin("11111111"); + } + } /* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\convert\ZHConvert.class diff --git a/src/main/java/com/archive/common/exception/UtilException.java b/src/main/java/com/archive/common/exception/UtilException.java index dfdf471..71427c8 100644 --- a/src/main/java/com/archive/common/exception/UtilException.java +++ b/src/main/java/com/archive/common/exception/UtilException.java @@ -1,29 +1,29 @@ -/* */ package com.archive.common.exception; -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public class UtilException -/* */ extends RuntimeException -/* */ { -/* */ private static final long serialVersionUID = 8247610319171014183L; -/* */ -/* */ public UtilException(Throwable e) { -/* 14 */ super(e.getMessage(), e); -/* */ } -/* */ -/* */ -/* */ public UtilException(String message) { -/* 19 */ super(message); -/* */ } -/* */ -/* */ -/* */ public UtilException(String message, Throwable throwable) { -/* 24 */ super(message, throwable); -/* */ } -/* */ } + package com.archive.common.exception; + + + + + + + public class UtilException + extends RuntimeException + { + private static final long serialVersionUID = 8247610319171014183L; + + public UtilException(Throwable e) { + super(e.getMessage(), e); + } + + + public UtilException(String message) { + super(message); + } + + + public UtilException(String message, Throwable throwable) { + super(message, throwable); + } + } /* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exception\UtilException.class diff --git a/src/main/java/com/archive/common/exception/user/UserException.java b/src/main/java/com/archive/common/exception/user/UserException.java index 4d88985..1d53e3d 100644 --- a/src/main/java/com/archive/common/exception/user/UserException.java +++ b/src/main/java/com/archive/common/exception/user/UserException.java @@ -1,21 +1,21 @@ -/* */ package com.archive.common.exception.user; -/* */ -/* */ import com.archive.common.exception.base.BaseException; -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public class UserException -/* */ extends BaseException -/* */ { -/* */ private static final long serialVersionUID = 1L; -/* */ -/* */ public UserException(String code, Object[] args) { -/* 16 */ super("user", code, args, null); -/* */ } -/* */ } + package com.archive.common.exception.user; + + import com.archive.common.exception.base.BaseException; + + + + + + + public class UserException + extends BaseException + { + private static final long serialVersionUID = 1L; + + public UserException(String code, Object[] args) { + super("user", code, args, null); + } + } /* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exceptio\\user\UserException.class diff --git a/src/main/java/com/archive/common/exception/user/UserNotExistsException.java b/src/main/java/com/archive/common/exception/user/UserNotExistsException.java index f211512..04d9a79 100644 --- a/src/main/java/com/archive/common/exception/user/UserNotExistsException.java +++ b/src/main/java/com/archive/common/exception/user/UserNotExistsException.java @@ -1,19 +1,19 @@ -/* */ package com.archive.common.exception.user; -/* */ -/* */ import com.archive.common.exception.user.UserException; -/* */ -/* */ -/* */ -/* */ -/* */ public class UserNotExistsException -/* */ extends UserException -/* */ { -/* */ private static final long serialVersionUID = 1L; -/* */ -/* */ public UserNotExistsException() { -/* 14 */ super("user.not.exists", null); -/* */ } -/* */ } + package com.archive.common.exception.user; + + import com.archive.common.exception.user.UserException; + + + + + public class UserNotExistsException + extends UserException + { + private static final long serialVersionUID = 1L; + + public UserNotExistsException() { + super("user.not.exists", null); + } + } /* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exceptio\\user\UserNotExistsException.class diff --git a/src/main/java/com/archive/common/exception/user/UserPasswordNotMatchException.java b/src/main/java/com/archive/common/exception/user/UserPasswordNotMatchException.java index f0427ba..3b6ede9 100644 --- a/src/main/java/com/archive/common/exception/user/UserPasswordNotMatchException.java +++ b/src/main/java/com/archive/common/exception/user/UserPasswordNotMatchException.java @@ -1,19 +1,19 @@ -/* */ package com.archive.common.exception.user; -/* */ -/* */ import com.archive.common.exception.user.UserException; -/* */ -/* */ -/* */ -/* */ -/* */ public class UserPasswordNotMatchException -/* */ extends UserException -/* */ { -/* */ private static final long serialVersionUID = 1L; -/* */ -/* */ public UserPasswordNotMatchException() { -/* 14 */ super("user.password.not.match", null); -/* */ } -/* */ } + package com.archive.common.exception.user; + + import com.archive.common.exception.user.UserException; + + + + + public class UserPasswordNotMatchException + extends UserException + { + private static final long serialVersionUID = 1L; + + public UserPasswordNotMatchException() { + super("user.password.not.match", null); + } + } /* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exceptio\\user\UserPasswordNotMatchException.class diff --git a/src/main/java/com/archive/common/exception/user/UserPasswordRetryLimitCountException.java b/src/main/java/com/archive/common/exception/user/UserPasswordRetryLimitCountException.java index 2f6e7ad..d80cc82 100644 --- a/src/main/java/com/archive/common/exception/user/UserPasswordRetryLimitCountException.java +++ b/src/main/java/com/archive/common/exception/user/UserPasswordRetryLimitCountException.java @@ -1,19 +1,19 @@ -/* */ package com.archive.common.exception.user; -/* */ -/* */ import com.archive.common.exception.user.UserException; -/* */ -/* */ -/* */ -/* */ -/* */ public class UserPasswordRetryLimitCountException -/* */ extends UserException -/* */ { -/* */ private static final long serialVersionUID = 1L; -/* */ -/* */ public UserPasswordRetryLimitCountException(int retryLimitCount) { -/* 14 */ super("user.password.retry.limit.count", new Object[] { Integer.valueOf(retryLimitCount) }); -/* */ } -/* */ } + package com.archive.common.exception.user; + + import com.archive.common.exception.user.UserException; + + + + + public class UserPasswordRetryLimitCountException + extends UserException + { + private static final long serialVersionUID = 1L; + + public UserPasswordRetryLimitCountException(int retryLimitCount) { + super("user.password.retry.limit.count", new Object[] { Integer.valueOf(retryLimitCount) }); + } + } /* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exceptio\\user\UserPasswordRetryLimitCountException.class diff --git a/src/main/java/com/archive/common/exception/user/UserPasswordRetryLimitExceedException.java b/src/main/java/com/archive/common/exception/user/UserPasswordRetryLimitExceedException.java index fb43936..8578a4f 100644 --- a/src/main/java/com/archive/common/exception/user/UserPasswordRetryLimitExceedException.java +++ b/src/main/java/com/archive/common/exception/user/UserPasswordRetryLimitExceedException.java @@ -1,19 +1,19 @@ -/* */ package com.archive.common.exception.user; -/* */ -/* */ import com.archive.common.exception.user.UserException; -/* */ -/* */ -/* */ -/* */ -/* */ public class UserPasswordRetryLimitExceedException -/* */ extends UserException -/* */ { -/* */ private static final long serialVersionUID = 1L; -/* */ -/* */ public UserPasswordRetryLimitExceedException(int retryLimitCount) { -/* 14 */ super("user.password.retry.limit.exceed", new Object[] { Integer.valueOf(retryLimitCount) }); -/* */ } -/* */ } + package com.archive.common.exception.user; + + import com.archive.common.exception.user.UserException; + + + + + public class UserPasswordRetryLimitExceedException + extends UserException + { + private static final long serialVersionUID = 1L; + + public UserPasswordRetryLimitExceedException(int retryLimitCount) { + super("user.password.retry.limit.exceed", new Object[] { Integer.valueOf(retryLimitCount) }); + } + } /* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exceptio\\user\UserPasswordRetryLimitExceedException.class diff --git a/src/main/java/com/archive/common/utils/uuid/UUID$Holder.java b/src/main/java/com/archive/common/utils/uuid/UUID$Holder.java index ccb6278..836edcd 100644 --- a/src/main/java/com/archive/common/utils/uuid/UUID$Holder.java +++ b/src/main/java/com/archive/common/utils/uuid/UUID$Holder.java @@ -1,31 +1,31 @@ -/* */ package com.archive.common.utils.uuid + package com.archive.common.utils.uuid ; -/* */ -/* */ import com.archive.common.utils.uuid.UUID; -/* */ import java.security.SecureRandom; -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ class Holder -/* */ { -/* 25 */ static final SecureRandom numberGenerator = UUID.getSecureRandom(); -/* */ } + + import com.archive.common.utils.uuid.UUID; + import java.security.SecureRandom; + + + + + + + + + + + + + + + + + + + class Holder + { + static final SecureRandom numberGenerator = UUID.getSecureRandom(); + } /* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\util\\uuid\UUID$Holder.class diff --git a/src/main/java/com/archive/common/utils/uuid/UUID.java b/src/main/java/com/archive/common/utils/uuid/UUID.java index 66a5423..2cb9375 100644 --- a/src/main/java/com/archive/common/utils/uuid/UUID.java +++ b/src/main/java/com/archive/common/utils/uuid/UUID.java @@ -1,487 +1,487 @@ -/* */ package com.archive.common.utils.uuid; -/* */ -/* */ import com.archive.common.exception.UtilException; -/* */ import com.archive.common.utils.uuid.UUID; -/* */ import java.io.Serializable; -/* */ import java.security.MessageDigest; -/* */ import java.security.NoSuchAlgorithmException; -/* */ import java.security.SecureRandom; -/* */ import java.util.Random; -/* */ import java.util.concurrent.ThreadLocalRandom; -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public final class UUID -/* */ implements Serializable, Comparable -/* */ { -/* */ private static final long serialVersionUID = -1185015143654744140L; -/* */ private final long mostSigBits; -/* */ private final long leastSigBits; -/* */ -/* */ private UUID(byte[] data) { -/* 41 */ long msb = 0L; -/* 42 */ long lsb = 0L; -/* 43 */ assert data.length == 16 : "data must be 16 bytes in length"; int i; -/* 44 */ for (i = 0; i < 8; i++) -/* */ { -/* 46 */ msb = msb << 8L | (data[i] & 0xFF); -/* */ } -/* 48 */ for (i = 8; i < 16; i++) -/* */ { -/* 50 */ lsb = lsb << 8L | (data[i] & 0xFF); -/* */ } -/* 52 */ this.mostSigBits = msb; -/* 53 */ this.leastSigBits = lsb; -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public UUID(long mostSigBits, long leastSigBits) { -/* 64 */ this.mostSigBits = mostSigBits; -/* 65 */ this.leastSigBits = leastSigBits; -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public static UUID fastUUID() { -/* 75 */ return randomUUID(false); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public static UUID randomUUID() { -/* 85 */ return randomUUID(true); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public static UUID randomUUID(boolean isSecure) { -/* 96 */ Random ng = isSecure ? Holder.numberGenerator : getRandom(); -/* */ -/* 98 */ byte[] randomBytes = new byte[16]; -/* 99 */ ng.nextBytes(randomBytes); -/* 100 */ randomBytes[6] = (byte)(randomBytes[6] & 0xF); -/* 101 */ randomBytes[6] = (byte)(randomBytes[6] | 0x40); -/* 102 */ randomBytes[8] = (byte)(randomBytes[8] & 0x3F); -/* 103 */ randomBytes[8] = (byte)(randomBytes[8] | 0x80); -/* 104 */ return new UUID(randomBytes); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public static UUID nameUUIDFromBytes(byte[] name) { -/* */ MessageDigest md; -/* */ try { -/* 119 */ md = MessageDigest.getInstance("MD5"); -/* */ } -/* 121 */ catch (NoSuchAlgorithmException nsae) { -/* */ -/* 123 */ throw new InternalError("MD5 not supported"); -/* */ } -/* 125 */ byte[] md5Bytes = md.digest(name); -/* 126 */ md5Bytes[6] = (byte)(md5Bytes[6] & 0xF); -/* 127 */ md5Bytes[6] = (byte)(md5Bytes[6] | 0x30); -/* 128 */ md5Bytes[8] = (byte)(md5Bytes[8] & 0x3F); -/* 129 */ md5Bytes[8] = (byte)(md5Bytes[8] | 0x80); -/* 130 */ return new UUID(md5Bytes); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public static UUID fromString(String name) { -/* 143 */ String[] components = name.split("-"); -/* 144 */ if (components.length != 5) -/* */ { -/* 146 */ throw new IllegalArgumentException("Invalid UUID string: " + name); -/* */ } -/* 148 */ for (int i = 0; i < 5; i++) -/* */ { -/* 150 */ components[i] = "0x" + components[i]; -/* */ } -/* */ -/* 153 */ long mostSigBits = Long.decode(components[0]).longValue(); -/* 154 */ mostSigBits <<= 16L; -/* 155 */ mostSigBits |= Long.decode(components[1]).longValue(); -/* 156 */ mostSigBits <<= 16L; -/* 157 */ mostSigBits |= Long.decode(components[2]).longValue(); -/* */ -/* 159 */ long leastSigBits = Long.decode(components[3]).longValue(); -/* 160 */ leastSigBits <<= 48L; -/* 161 */ leastSigBits |= Long.decode(components[4]).longValue(); -/* */ -/* 163 */ return new UUID(mostSigBits, leastSigBits); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public long getLeastSignificantBits() { -/* 173 */ return this.leastSigBits; -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public long getMostSignificantBits() { -/* 183 */ return this.mostSigBits; -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public int version() { -/* 202 */ return (int)(this.mostSigBits >> 12L & 0xFL); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public int variant() { -/* 225 */ return (int)(this.leastSigBits >>> (int)(64L - (this.leastSigBits >>> 62L)) & this.leastSigBits >> 63L); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public long timestamp() throws UnsupportedOperationException { -/* 243 */ checkTimeBase(); -/* 244 */ return (this.mostSigBits & 0xFFFL) << 48L | (this.mostSigBits >> 16L & 0xFFFFL) << 32L | this.mostSigBits >>> 32L; -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public int clockSequence() throws UnsupportedOperationException { -/* 264 */ checkTimeBase(); -/* 265 */ return (int)((this.leastSigBits & 0x3FFF000000000000L) >>> 48L); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public long node() throws UnsupportedOperationException { -/* 283 */ checkTimeBase(); -/* 284 */ return this.leastSigBits & 0xFFFFFFFFFFFFL; -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public String toString() { -/* 314 */ return toString(false); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public String toString(boolean isSimple) { -/* 343 */ StringBuilder builder = new StringBuilder(isSimple ? 32 : 36); -/* */ -/* 345 */ builder.append(digits(this.mostSigBits >> 32L, 8)); -/* 346 */ if (false == isSimple) -/* */ { -/* 348 */ builder.append('-'); -/* */ } -/* */ -/* 351 */ builder.append(digits(this.mostSigBits >> 16L, 4)); -/* 352 */ if (false == isSimple) -/* */ { -/* 354 */ builder.append('-'); -/* */ } -/* */ -/* 357 */ builder.append(digits(this.mostSigBits, 4)); -/* 358 */ if (false == isSimple) -/* */ { -/* 360 */ builder.append('-'); -/* */ } -/* */ -/* 363 */ builder.append(digits(this.leastSigBits >> 48L, 4)); -/* 364 */ if (false == isSimple) -/* */ { -/* 366 */ builder.append('-'); -/* */ } -/* */ -/* 369 */ builder.append(digits(this.leastSigBits, 12)); -/* */ -/* 371 */ return builder.toString(); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public int hashCode() { -/* 382 */ long hilo = this.mostSigBits ^ this.leastSigBits; -/* 383 */ return (int)(hilo >> 32L) ^ (int)hilo; -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public boolean equals(Object obj) { -/* 398 */ if (null == obj || obj.getClass() != UUID.class) -/* */ { -/* 400 */ return false; -/* */ } -/* 402 */ UUID id = (UUID)obj; -/* 403 */ return (this.mostSigBits == id.mostSigBits && this.leastSigBits == id.leastSigBits); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public int compareTo(UUID val) { -/* 424 */ return (this.mostSigBits < val.mostSigBits) ? -1 : ((this.mostSigBits > val.mostSigBits) ? 1 : ((this.leastSigBits < val.leastSigBits) ? -1 : ((this.leastSigBits > val.leastSigBits) ? 1 : 0))); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ private static String digits(long val, int digits) { -/* 442 */ long hi = 1L << digits * 4; -/* 443 */ return Long.toHexString(hi | val & hi - 1L).substring(1); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ private void checkTimeBase() { -/* 451 */ if (version() != 1) -/* */ { -/* 453 */ throw new UnsupportedOperationException("Not a time-based UUID"); -/* */ } -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public static SecureRandom getSecureRandom() { -/* */ try { -/* 466 */ return SecureRandom.getInstance("SHA1PRNG"); -/* */ } -/* 468 */ catch (NoSuchAlgorithmException e) { -/* */ -/* 470 */ throw new UtilException(e); -/* */ } -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public static ThreadLocalRandom getRandom() { -/* 482 */ return ThreadLocalRandom.current(); -/* */ } -/* */ } + package com.archive.common.utils.uuid; + + import com.archive.common.exception.UtilException; + import com.archive.common.utils.uuid.UUID; + import java.io.Serializable; + import java.security.MessageDigest; + import java.security.NoSuchAlgorithmException; + import java.security.SecureRandom; + import java.util.Random; + import java.util.concurrent.ThreadLocalRandom; + + + + + + + + + + + + + + + + + + + + + + + public final class UUID + implements Serializable, Comparable + { + private static final long serialVersionUID = -1185015143654744140L; + private final long mostSigBits; + private final long leastSigBits; + + private UUID(byte[] data) { + long msb = 0L; + long lsb = 0L; + assert data.length == 16 : "data must be 16 bytes in length"; int i; + for (i = 0; i < 8; i++) + { + msb = msb << 8L | (data[i] & 0xFF); + } + for (i = 8; i < 16; i++) + { + lsb = lsb << 8L | (data[i] & 0xFF); + } + this.mostSigBits = msb; + this.leastSigBits = lsb; + } + + + + + + + + + public UUID(long mostSigBits, long leastSigBits) { + this.mostSigBits = mostSigBits; + this.leastSigBits = leastSigBits; + } + + + + + + + + public static UUID fastUUID() { + return randomUUID(false); + } + + + + + + + + public static UUID randomUUID() { + return randomUUID(true); + } + + + + + + + + + public static UUID randomUUID(boolean isSecure) { + Random ng = isSecure ? Holder.numberGenerator : getRandom(); + + byte[] randomBytes = new byte[16]; + ng.nextBytes(randomBytes); + randomBytes[6] = (byte)(randomBytes[6] & 0xF); + randomBytes[6] = (byte)(randomBytes[6] | 0x40); + randomBytes[8] = (byte)(randomBytes[8] & 0x3F); + randomBytes[8] = (byte)(randomBytes[8] | 0x80); + return new UUID(randomBytes); + } + + + + + + + + + + + public static UUID nameUUIDFromBytes(byte[] name) { + MessageDigest md; + try { + md = MessageDigest.getInstance("MD5"); + } + catch (NoSuchAlgorithmException nsae) { + + throw new InternalError("MD5 not supported"); + } + byte[] md5Bytes = md.digest(name); + md5Bytes[6] = (byte)(md5Bytes[6] & 0xF); + md5Bytes[6] = (byte)(md5Bytes[6] | 0x30); + md5Bytes[8] = (byte)(md5Bytes[8] & 0x3F); + md5Bytes[8] = (byte)(md5Bytes[8] | 0x80); + return new UUID(md5Bytes); + } + + + + + + + + + + + public static UUID fromString(String name) { + String[] components = name.split("-"); + if (components.length != 5) + { + throw new IllegalArgumentException("Invalid UUID string: " + name); + } + for (int i = 0; i < 5; i++) + { + components[i] = "0x" + components[i]; + } + + long mostSigBits = Long.decode(components[0]).longValue(); + mostSigBits <<= 16L; + mostSigBits |= Long.decode(components[1]).longValue(); + mostSigBits <<= 16L; + mostSigBits |= Long.decode(components[2]).longValue(); + + long leastSigBits = Long.decode(components[3]).longValue(); + leastSigBits <<= 48L; + leastSigBits |= Long.decode(components[4]).longValue(); + + return new UUID(mostSigBits, leastSigBits); + } + + + + + + + + public long getLeastSignificantBits() { + return this.leastSigBits; + } + + + + + + + + public long getMostSignificantBits() { + return this.mostSigBits; + } + + + + + + + + + + + + + + + + + public int version() { + return (int)(this.mostSigBits >> 12L & 0xFL); + } + + + + + + + + + + + + + + + + + + + + + public int variant() { + return (int)(this.leastSigBits >>> (int)(64L - (this.leastSigBits >>> 62L)) & this.leastSigBits >> 63L); + } + + + + + + + + + + + + + + + + public long timestamp() throws UnsupportedOperationException { + checkTimeBase(); + return (this.mostSigBits & 0xFFFL) << 48L | (this.mostSigBits >> 16L & 0xFFFFL) << 32L | this.mostSigBits >>> 32L; + } + + + + + + + + + + + + + + + + + + public int clockSequence() throws UnsupportedOperationException { + checkTimeBase(); + return (int)((this.leastSigBits & 0x3FFF000000000000L) >>> 48L); + } + + + + + + + + + + + + + + + + public long node() throws UnsupportedOperationException { + checkTimeBase(); + return this.leastSigBits & 0xFFFFFFFFFFFFL; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + public String toString() { + return toString(false); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + public String toString(boolean isSimple) { + StringBuilder builder = new StringBuilder(isSimple ? 32 : 36); + + builder.append(digits(this.mostSigBits >> 32L, 8)); + if (false == isSimple) + { + builder.append('-'); + } + + builder.append(digits(this.mostSigBits >> 16L, 4)); + if (false == isSimple) + { + builder.append('-'); + } + + builder.append(digits(this.mostSigBits, 4)); + if (false == isSimple) + { + builder.append('-'); + } + + builder.append(digits(this.leastSigBits >> 48L, 4)); + if (false == isSimple) + { + builder.append('-'); + } + + builder.append(digits(this.leastSigBits, 12)); + + return builder.toString(); + } + + + + + + + + + public int hashCode() { + long hilo = this.mostSigBits ^ this.leastSigBits; + return (int)(hilo >> 32L) ^ (int)hilo; + } + + + + + + + + + + + + + public boolean equals(Object obj) { + if (null == obj || obj.getClass() != UUID.class) + { + return false; + } + UUID id = (UUID)obj; + return (this.mostSigBits == id.mostSigBits && this.leastSigBits == id.leastSigBits); + } + + + + + + + + + + + + + + + + + + + public int compareTo(UUID val) { + return (this.mostSigBits < val.mostSigBits) ? -1 : ((this.mostSigBits > val.mostSigBits) ? 1 : ((this.leastSigBits < val.leastSigBits) ? -1 : ((this.leastSigBits > val.leastSigBits) ? 1 : 0))); + } + + + + + + + + + + + + + + + + private static String digits(long val, int digits) { + long hi = 1L << digits * 4; + return Long.toHexString(hi | val & hi - 1L).substring(1); + } + + + + + + private void checkTimeBase() { + if (version() != 1) + { + throw new UnsupportedOperationException("Not a time-based UUID"); + } + } + + + + + + + + + public static SecureRandom getSecureRandom() { + try { + return SecureRandom.getInstance("SHA1PRNG"); + } + catch (NoSuchAlgorithmException e) { + + throw new UtilException(e); + } + } + + + + + + + + + public static ThreadLocalRandom getRandom() { + return ThreadLocalRandom.current(); + } + } /* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\util\\uuid\UUID.class diff --git a/src/main/java/com/archive/common/xss/XssFilter.java b/src/main/java/com/archive/common/xss/XssFilter.java index d309ff5..686608a 100644 --- a/src/main/java/com/archive/common/xss/XssFilter.java +++ b/src/main/java/com/archive/common/xss/XssFilter.java @@ -1,98 +1,98 @@ -/* */ package com.archive.common.xss + package com.archive.common.xss ; -/* */ -/* */ import com.archive.common.utils.StringUtils; -/* */ import com.archive.common.xss.XssHttpServletRequestWrapper; -/* */ import java.io.IOException; -/* */ import java.util.ArrayList; -/* */ import java.util.List; -/* */ import java.util.regex.Matcher; -/* */ import java.util.regex.Pattern; -/* */ import javax.servlet.Filter; -/* */ import javax.servlet.FilterChain; -/* */ import javax.servlet.FilterConfig; -/* */ import javax.servlet.ServletException; -/* */ import javax.servlet.ServletRequest; -/* */ import javax.servlet.ServletResponse; -/* */ import javax.servlet.http.HttpServletRequest; -/* */ import javax.servlet.http.HttpServletResponse; -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public class XssFilter -/* */ implements Filter -/* */ { -/* 28 */ public List excludes = new ArrayList<>(); -/* */ -/* */ -/* */ -/* */ public boolean enabled = false; -/* */ -/* */ -/* */ -/* */ -/* */ public void init(FilterConfig filterConfig) throws ServletException { -/* 38 */ String tempExcludes = filterConfig.getInitParameter("excludes"); -/* 39 */ String tempEnabled = filterConfig.getInitParameter("enabled"); -/* 40 */ if (StringUtils.isNotEmpty(tempExcludes)) { -/* */ -/* 42 */ String[] url = tempExcludes.split(","); -/* 43 */ for (int i = 0; url != null && i < url.length; i++) -/* */ { -/* 45 */ this.excludes.add(url[i]); -/* */ } -/* */ } -/* 48 */ if (StringUtils.isNotEmpty(tempEnabled)) -/* */ { -/* 50 */ this.enabled = Boolean.valueOf(tempEnabled).booleanValue(); -/* */ } -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { -/* 58 */ HttpServletRequest req = (HttpServletRequest)request; -/* 59 */ HttpServletResponse resp = (HttpServletResponse)response; -/* 60 */ if (handleExcludeURL(req, resp)) { -/* */ -/* 62 */ chain.doFilter(request, response); -/* */ return; -/* */ } -/* 65 */ XssHttpServletRequestWrapper xssRequest = new XssHttpServletRequestWrapper((HttpServletRequest)request); -/* 66 */ chain.doFilter((ServletRequest)xssRequest, response); -/* */ } -/* */ -/* */ -/* */ private boolean handleExcludeURL(HttpServletRequest request, HttpServletResponse response) { -/* 71 */ if (!this.enabled) -/* */ { -/* 73 */ return true; -/* */ } -/* 75 */ if (this.excludes == null || this.excludes.isEmpty()) -/* */ { -/* 77 */ return false; -/* */ } -/* 79 */ String url = request.getServletPath(); -/* 80 */ for (String pattern : this.excludes) { -/* */ -/* 82 */ Pattern p = Pattern.compile("^" + pattern); -/* 83 */ Matcher m = p.matcher(url); -/* 84 */ if (m.find()) -/* */ { -/* 86 */ return true; -/* */ } -/* */ } -/* 89 */ return false; -/* */ } -/* */ -/* */ public void destroy() {} -/* */ } + + import com.archive.common.utils.StringUtils; + import com.archive.common.xss.XssHttpServletRequestWrapper; + import java.io.IOException; + import java.util.ArrayList; + import java.util.List; + import java.util.regex.Matcher; + import java.util.regex.Pattern; + import javax.servlet.Filter; + import javax.servlet.FilterChain; + import javax.servlet.FilterConfig; + import javax.servlet.ServletException; + import javax.servlet.ServletRequest; + import javax.servlet.ServletResponse; + import javax.servlet.http.HttpServletRequest; + import javax.servlet.http.HttpServletResponse; + + + + + + + + public class XssFilter + implements Filter + { + public List excludes = new ArrayList<>(); + + + + public boolean enabled = false; + + + + + public void init(FilterConfig filterConfig) throws ServletException { + String tempExcludes = filterConfig.getInitParameter("excludes"); + String tempEnabled = filterConfig.getInitParameter("enabled"); + if (StringUtils.isNotEmpty(tempExcludes)) { + + String[] url = tempExcludes.split(","); + for (int i = 0; url != null && i < url.length; i++) + { + this.excludes.add(url[i]); + } + } + if (StringUtils.isNotEmpty(tempEnabled)) + { + this.enabled = Boolean.valueOf(tempEnabled).booleanValue(); + } + } + + + + + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { + HttpServletRequest req = (HttpServletRequest)request; + HttpServletResponse resp = (HttpServletResponse)response; + if (handleExcludeURL(req, resp)) { + + chain.doFilter(request, response); + return; + } + XssHttpServletRequestWrapper xssRequest = new XssHttpServletRequestWrapper((HttpServletRequest)request); + chain.doFilter((ServletRequest)xssRequest, response); + } + + + private boolean handleExcludeURL(HttpServletRequest request, HttpServletResponse response) { + if (!this.enabled) + { + return true; + } + if (this.excludes == null || this.excludes.isEmpty()) + { + return false; + } + String url = request.getServletPath(); + for (String pattern : this.excludes) { + + Pattern p = Pattern.compile("^" + pattern); + Matcher m = p.matcher(url); + if (m.find()) + { + return true; + } + } + return false; + } + + public void destroy() {} + } /* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\xss\XssFilter.class diff --git a/src/main/java/com/archive/common/xss/XssHttpServletRequestWrapper.java b/src/main/java/com/archive/common/xss/XssHttpServletRequestWrapper.java index 48e9025..1007c3d 100644 --- a/src/main/java/com/archive/common/xss/XssHttpServletRequestWrapper.java +++ b/src/main/java/com/archive/common/xss/XssHttpServletRequestWrapper.java @@ -1,43 +1,43 @@ -/* */ package com.archive.common.xss + package com.archive.common.xss ; -/* */ -/* */ import com.archive.common.utils.html.EscapeUtil; -/* */ import javax.servlet.http.HttpServletRequest; -/* */ import javax.servlet.http.HttpServletRequestWrapper; -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public class XssHttpServletRequestWrapper -/* */ extends HttpServletRequestWrapper -/* */ { -/* */ public XssHttpServletRequestWrapper(HttpServletRequest request) { -/* 19 */ super(request); -/* */ } -/* */ -/* */ -/* */ -/* */ public String[] getParameterValues(String name) { -/* 25 */ String[] values = super.getParameterValues(name); -/* 26 */ if (values != null) { -/* */ -/* 28 */ int length = values.length; -/* 29 */ String[] escapseValues = new String[length]; -/* 30 */ for (int i = 0; i < length; i++) -/* */ { -/* */ -/* 33 */ escapseValues[i] = EscapeUtil.clean(values[i]).trim(); -/* */ } -/* 35 */ return escapseValues; -/* */ } -/* 37 */ return super.getParameterValues(name); -/* */ } -/* */ } + + import com.archive.common.utils.html.EscapeUtil; + import javax.servlet.http.HttpServletRequest; + import javax.servlet.http.HttpServletRequestWrapper; + + + + + + + + + + public class XssHttpServletRequestWrapper + extends HttpServletRequestWrapper + { + public XssHttpServletRequestWrapper(HttpServletRequest request) { + super(request); + } + + + + public String[] getParameterValues(String name) { + String[] values = super.getParameterValues(name); + if (values != null) { + + int length = values.length; + String[] escapseValues = new String[length]; + for (int i = 0; i < length; i++) + { + + escapseValues[i] = EscapeUtil.clean(values[i]).trim(); + } + return escapseValues; + } + return super.getParameterValues(name); + } + } /* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\xss\XssHttpServletRequestWrapper.class diff --git a/src/main/java/com/archive/framework/shiro/realm/UserRealm.java b/src/main/java/com/archive/framework/shiro/realm/UserRealm.java index db40c19..6600d3a 100644 --- a/src/main/java/com/archive/framework/shiro/realm/UserRealm.java +++ b/src/main/java/com/archive/framework/shiro/realm/UserRealm.java @@ -1,163 +1,163 @@ -/* */ package com.archive.framework.shiro.realm + package com.archive.framework.shiro.realm ; -/* */ -/* */ import com.archive.common.exception.user.CaptchaException; -/* */ import com.archive.common.exception.user.RoleBlockedException; -/* */ import com.archive.common.exception.user.UserBlockedException; -/* */ import com.archive.common.exception.user.UserNotExistsException; -/* */ import com.archive.common.exception.user.UserPasswordNotMatchException; -/* */ import com.archive.common.exception.user.UserPasswordRetryLimitExceedException; -/* */ import com.archive.common.utils.security.ShiroUtils; -/* */ import com.archive.framework.shiro.service.LoginService; -/* */ import com.archive.project.system.menu.service.IMenuService; -/* */ import com.archive.project.system.role.service.IRoleService; -/* */ import com.archive.project.system.user.domain.User; -/* */ import java.util.HashSet; -/* */ import java.util.Set; -/* */ import org.apache.shiro.authc.AuthenticationException; -/* */ import org.apache.shiro.authc.AuthenticationInfo; -/* */ import org.apache.shiro.authc.AuthenticationToken; -/* */ import org.apache.shiro.authc.ExcessiveAttemptsException; -/* */ import org.apache.shiro.authc.IncorrectCredentialsException; -/* */ import org.apache.shiro.authc.LockedAccountException; -/* */ import org.apache.shiro.authc.SimpleAuthenticationInfo; -/* */ import org.apache.shiro.authc.UnknownAccountException; -/* */ import org.apache.shiro.authc.UsernamePasswordToken; -/* */ import org.apache.shiro.authz.AuthorizationInfo; -/* */ import org.apache.shiro.authz.SimpleAuthorizationInfo; -/* */ import org.apache.shiro.cache.Cache; -/* */ import org.apache.shiro.realm.AuthorizingRealm; -/* */ import org.apache.shiro.subject.PrincipalCollection; -/* */ import org.apache.shiro.subject.SimplePrincipalCollection; -/* */ import org.slf4j.Logger; -/* */ import org.slf4j.LoggerFactory; -/* */ import org.springframework.beans.factory.annotation.Autowired; -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public class UserRealm -/* */ extends AuthorizingRealm -/* */ { -/* 42 */ private static final Logger log = LoggerFactory.getLogger(com.archive.framework.shiro.realm.UserRealm.class); -/* */ -/* */ -/* */ @Autowired -/* */ private IMenuService menuService; -/* */ -/* */ -/* */ @Autowired -/* */ private IRoleService roleService; -/* */ -/* */ -/* */ @Autowired -/* */ private LoginService loginService; -/* */ -/* */ -/* */ -/* */ protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection arg0) { -/* 59 */ User user = ShiroUtils.getSysUser(); -/* */ -/* 61 */ Set roles = new HashSet<>(); -/* */ -/* 63 */ Set menus = new HashSet<>(); -/* 64 */ SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); -/* */ -/* 66 */ if (user.isAdmin()) { -/* */ -/* 68 */ info.addRole("admin"); -/* 69 */ info.addStringPermission("*:*:*"); -/* */ } -/* */ else { -/* */ -/* 73 */ roles = this.roleService.selectRoleKeys(user.getUserId()); -/* 74 */ menus = this.menuService.selectPermsByUserId(user.getUserId()); -/* */ -/* 76 */ info.setRoles(roles); -/* */ -/* 78 */ info.setStringPermissions(menus); -/* */ } -/* 80 */ return (AuthorizationInfo)info; -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { -/* 89 */ UsernamePasswordToken upToken = (UsernamePasswordToken)token; -/* 90 */ String username = upToken.getUsername(); -/* 91 */ String password = ""; -/* 92 */ if (upToken.getPassword() != null) -/* */ { -/* 94 */ password = new String(upToken.getPassword()); -/* */ } -/* */ -/* 97 */ User user = null; -/* */ -/* */ try { -/* 100 */ user = this.loginService.login(username, password); -/* */ } -/* 102 */ catch (CaptchaException e) { -/* */ -/* 104 */ throw new AuthenticationException(e.getMessage(), e); -/* */ } -/* 106 */ catch (UserNotExistsException e) { -/* */ -/* 108 */ throw new UnknownAccountException(e.getMessage(), e); -/* */ } -/* 110 */ catch (UserPasswordNotMatchException e) { -/* */ -/* 112 */ throw new IncorrectCredentialsException(e.getMessage(), e); -/* */ } -/* 114 */ catch (UserPasswordRetryLimitExceedException e) { -/* */ -/* 116 */ throw new ExcessiveAttemptsException(e.getMessage(), e); -/* */ } -/* 118 */ catch (UserBlockedException e) { -/* */ -/* 120 */ throw new LockedAccountException(e.getMessage(), e); -/* */ } -/* 122 */ catch (RoleBlockedException e) { -/* */ -/* 124 */ throw new LockedAccountException(e.getMessage(), e); -/* */ } -/* 126 */ catch (Exception e) { -/* */ -/* 128 */ log.info("对用户[" + username + "]进行登录验证..验证未通过{}", e.getMessage()); -/* 129 */ throw new AuthenticationException(e.getMessage(), e); -/* */ } -/* 131 */ SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(user, password, getName()); -/* 132 */ return (AuthenticationInfo)info; -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public void clearCachedAuthorizationInfo(Object principal) { -/* 140 */ SimplePrincipalCollection principals = new SimplePrincipalCollection(principal, getName()); -/* 141 */ clearCachedAuthorizationInfo((PrincipalCollection)principals); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public void clearAllCachedAuthorizationInfo() { -/* 149 */ Cache cache = getAuthorizationCache(); -/* 150 */ if (cache != null) -/* */ { -/* 152 */ for (Object key : cache.keys()) -/* */ { -/* 154 */ cache.remove(key); -/* */ } -/* */ } -/* */ } -/* */ } + + import com.archive.common.exception.user.CaptchaException; + import com.archive.common.exception.user.RoleBlockedException; + import com.archive.common.exception.user.UserBlockedException; + import com.archive.common.exception.user.UserNotExistsException; + import com.archive.common.exception.user.UserPasswordNotMatchException; + import com.archive.common.exception.user.UserPasswordRetryLimitExceedException; + import com.archive.common.utils.security.ShiroUtils; + import com.archive.framework.shiro.service.LoginService; + import com.archive.project.system.menu.service.IMenuService; + import com.archive.project.system.role.service.IRoleService; + import com.archive.project.system.user.domain.User; + import java.util.HashSet; + import java.util.Set; + import org.apache.shiro.authc.AuthenticationException; + import org.apache.shiro.authc.AuthenticationInfo; + import org.apache.shiro.authc.AuthenticationToken; + import org.apache.shiro.authc.ExcessiveAttemptsException; + import org.apache.shiro.authc.IncorrectCredentialsException; + import org.apache.shiro.authc.LockedAccountException; + import org.apache.shiro.authc.SimpleAuthenticationInfo; + import org.apache.shiro.authc.UnknownAccountException; + import org.apache.shiro.authc.UsernamePasswordToken; + import org.apache.shiro.authz.AuthorizationInfo; + import org.apache.shiro.authz.SimpleAuthorizationInfo; + import org.apache.shiro.cache.Cache; + import org.apache.shiro.realm.AuthorizingRealm; + import org.apache.shiro.subject.PrincipalCollection; + import org.apache.shiro.subject.SimplePrincipalCollection; + import org.slf4j.Logger; + import org.slf4j.LoggerFactory; + import org.springframework.beans.factory.annotation.Autowired; + + + + + + public class UserRealm + extends AuthorizingRealm + { + private static final Logger log = LoggerFactory.getLogger(com.archive.framework.shiro.realm.UserRealm.class); + + + @Autowired + private IMenuService menuService; + + + @Autowired + private IRoleService roleService; + + + @Autowired + private LoginService loginService; + + + + protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection arg0) { + User user = ShiroUtils.getSysUser(); + + Set roles = new HashSet<>(); + + Set menus = new HashSet<>(); + SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); + + if (user.isAdmin()) { + + info.addRole("admin"); + info.addStringPermission("*:*:*"); + } + else { + + roles = this.roleService.selectRoleKeys(user.getUserId()); + menus = this.menuService.selectPermsByUserId(user.getUserId()); + + info.setRoles(roles); + + info.setStringPermissions(menus); + } + return (AuthorizationInfo)info; + } + + + + + + + protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { + UsernamePasswordToken upToken = (UsernamePasswordToken)token; + String username = upToken.getUsername(); + String password = ""; + if (upToken.getPassword() != null) + { + password = new String(upToken.getPassword()); + } + + User user = null; + + try { + user = this.loginService.login(username, password); + } + catch (CaptchaException e) { + + throw new AuthenticationException(e.getMessage(), e); + } + catch (UserNotExistsException e) { + + throw new UnknownAccountException(e.getMessage(), e); + } + catch (UserPasswordNotMatchException e) { + + throw new IncorrectCredentialsException(e.getMessage(), e); + } + catch (UserPasswordRetryLimitExceedException e) { + + throw new ExcessiveAttemptsException(e.getMessage(), e); + } + catch (UserBlockedException e) { + + throw new LockedAccountException(e.getMessage(), e); + } + catch (RoleBlockedException e) { + + throw new LockedAccountException(e.getMessage(), e); + } + catch (Exception e) { + + log.info("对用户[" + username + "]进行登录验证..验证未通过{}", e.getMessage()); + throw new AuthenticationException(e.getMessage(), e); + } + SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(user, password, getName()); + return (AuthenticationInfo)info; + } + + + + + + public void clearCachedAuthorizationInfo(Object principal) { + SimplePrincipalCollection principals = new SimplePrincipalCollection(principal, getName()); + clearCachedAuthorizationInfo((PrincipalCollection)principals); + } + + + + + + public void clearAllCachedAuthorizationInfo() { + Cache cache = getAuthorizationCache(); + if (cache != null) + { + for (Object key : cache.keys()) + { + cache.remove(key); + } + } + } + } /* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\framework\shiro\realm\UserRealm.class diff --git a/src/main/java/com/archive/framework/web/domain/Ztree.java b/src/main/java/com/archive/framework/web/domain/Ztree.java index 752b671..6ab9870 100644 --- a/src/main/java/com/archive/framework/web/domain/Ztree.java +++ b/src/main/java/com/archive/framework/web/domain/Ztree.java @@ -1,109 +1,109 @@ -/* */ package com.archive.framework.web.domain + package com.archive.framework.web.domain ; -/* */ -/* */ import java.io.Serializable; -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public class Ztree -/* */ implements Serializable -/* */ { -/* */ private static final long serialVersionUID = 1L; -/* */ private Long id; -/* */ private Long pId; -/* */ private String name; -/* */ private String title; -/* */ private boolean checked = false; -/* */ private boolean open = false; -/* */ private boolean nocheck = false; -/* */ -/* */ public Long getId() { -/* 37 */ return this.id; -/* */ } -/* */ -/* */ -/* */ public void setId(Long id) { -/* 42 */ this.id = id; -/* */ } -/* */ -/* */ -/* */ public Long getpId() { -/* 47 */ return this.pId; -/* */ } -/* */ -/* */ -/* */ public void setpId(Long pId) { -/* 52 */ this.pId = pId; -/* */ } -/* */ -/* */ -/* */ public String getName() { -/* 57 */ return this.name; -/* */ } -/* */ -/* */ -/* */ public void setName(String name) { -/* 62 */ this.name = name; -/* */ } -/* */ -/* */ -/* */ public String getTitle() { -/* 67 */ return this.title; -/* */ } -/* */ -/* */ -/* */ public void setTitle(String title) { -/* 72 */ this.title = title; -/* */ } -/* */ -/* */ -/* */ public boolean isChecked() { -/* 77 */ return this.checked; -/* */ } -/* */ -/* */ -/* */ public void setChecked(boolean checked) { -/* 82 */ this.checked = checked; -/* */ } -/* */ -/* */ -/* */ public boolean isOpen() { -/* 87 */ return this.open; -/* */ } -/* */ -/* */ -/* */ public void setOpen(boolean open) { -/* 92 */ this.open = open; -/* */ } -/* */ -/* */ -/* */ public boolean isNocheck() { -/* 97 */ return this.nocheck; -/* */ } -/* */ -/* */ -/* */ public void setNocheck(boolean nocheck) { -/* 102 */ this.nocheck = nocheck; -/* */ } -/* */ } + + import java.io.Serializable; + + + + + + + + + + + + + + + + + + + + + public class Ztree + implements Serializable + { + private static final long serialVersionUID = 1L; + private Long id; + private Long pId; + private String name; + private String title; + private boolean checked = false; + private boolean open = false; + private boolean nocheck = false; + + public Long getId() { + return this.id; + } + + + public void setId(Long id) { + this.id = id; + } + + + public Long getpId() { + return this.pId; + } + + + public void setpId(Long pId) { + this.pId = pId; + } + + + public String getName() { + return this.name; + } + + + public void setName(String name) { + this.name = name; + } + + + public String getTitle() { + return this.title; + } + + + public void setTitle(String title) { + this.title = title; + } + + + public boolean isChecked() { + return this.checked; + } + + + public void setChecked(boolean checked) { + this.checked = checked; + } + + + public boolean isOpen() { + return this.open; + } + + + public void setOpen(boolean open) { + this.open = open; + } + + + public boolean isNocheck() { + return this.nocheck; + } + + + public void setNocheck(boolean nocheck) { + this.nocheck = nocheck; + } + } /* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\framework\web\domain\Ztree.class diff --git a/src/main/java/com/archive/project/monitor/online/controller/UserOnlineController.java b/src/main/java/com/archive/project/monitor/online/controller/UserOnlineController.java index ee805d1..e7ca99e 100644 --- a/src/main/java/com/archive/project/monitor/online/controller/UserOnlineController.java +++ b/src/main/java/com/archive/project/monitor/online/controller/UserOnlineController.java @@ -1,94 +1,94 @@ -/* */ package com.archive.project.monitor.online.controller + package com.archive.project.monitor.online.controller ; -/* */ -/* */ import com.archive.common.utils.security.ShiroUtils; -/* */ import com.archive.common.utils.text.Convert; -/* */ import com.archive.framework.aspectj.lang.annotation.Log; -/* */ import com.archive.framework.aspectj.lang.enums.BusinessType; -/* */ import com.archive.framework.shiro.session.OnlineSessionDAO; -/* */ import com.archive.framework.web.controller.BaseController; -/* */ import com.archive.framework.web.domain.AjaxResult; -/* */ import com.archive.framework.web.page.TableDataInfo; -/* */ import com.archive.project.monitor.online.domain.OnlineSession; -/* */ import com.archive.project.monitor.online.domain.OnlineStatus; + + import com.archive.common.utils.security.ShiroUtils; + import com.archive.common.utils.text.Convert; + import com.archive.framework.aspectj.lang.annotation.Log; + import com.archive.framework.aspectj.lang.enums.BusinessType; + import com.archive.framework.shiro.session.OnlineSessionDAO; + import com.archive.framework.web.controller.BaseController; + import com.archive.framework.web.domain.AjaxResult; + import com.archive.framework.web.page.TableDataInfo; + import com.archive.project.monitor.online.domain.OnlineSession; + import com.archive.project.monitor.online.domain.OnlineStatus; import com.archive.project.monitor.online.domain.UserOnline; -/* */ import com.archive.project.monitor.online.service.IUserOnlineService; -/* */ import java.util.List; -/* */ import org.apache.shiro.authz.annotation.Logical; -/* */ import org.apache.shiro.authz.annotation.RequiresPermissions; -/* */ import org.apache.shiro.session.Session; -/* */ import org.springframework.beans.factory.annotation.Autowired; -/* */ import org.springframework.stereotype.Controller; -/* */ import org.springframework.web.bind.annotation.GetMapping; -/* */ import org.springframework.web.bind.annotation.PostMapping; -/* */ import org.springframework.web.bind.annotation.RequestMapping; -/* */ import org.springframework.web.bind.annotation.ResponseBody; -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ @Controller -/* */ @RequestMapping({"/monitor/online"}) -/* */ public class UserOnlineController -/* */ extends BaseController -/* */ { -/* 34 */ private String prefix = "monitor/online"; -/* */ -/* */ @Autowired -/* */ private IUserOnlineService userOnlineService; -/* */ -/* */ @Autowired -/* */ private OnlineSessionDAO onlineSessionDAO; -/* */ -/* */ -/* */ @RequiresPermissions({"monitor:online:view"}) -/* */ @GetMapping -/* */ public String online() { -/* 46 */ return this.prefix + "/online"; -/* */ } -/* */ -/* */ -/* */ @RequiresPermissions({"monitor:online:list"}) -/* */ @PostMapping({"/list"}) -/* */ @ResponseBody -/* */ public TableDataInfo list(UserOnline userOnline) { -/* 54 */ startPage(); -/* 55 */ List list = this.userOnlineService.selectUserOnlineList(userOnline); -/* 56 */ return getDataTable(list); -/* */ } -/* */ -/* */ -/* */ @RequiresPermissions(value = {"monitor:online:batchForceLogout", "monitor:online:forceLogout"}, logical = Logical.OR) -/* */ @Log(title = "在线用户", businessType = BusinessType.FORCE) -/* */ @PostMapping({"/batchForceLogout"}) -/* */ @ResponseBody -/* */ public AjaxResult batchForceLogout(String ids) { -/* 65 */ for (String sessionId : Convert.toStrArray(ids)) { -/* */ -/* 67 */ UserOnline online = this.userOnlineService.selectOnlineById(sessionId); -/* 68 */ if (online == null) -/* */ { -/* 70 */ return error("用户已下线"); -/* */ } -/* 72 */ OnlineSession onlineSession = (OnlineSession)this.onlineSessionDAO.readSession(online.getSessionId()); -/* 73 */ if (onlineSession == null) -/* */ { -/* 75 */ return error("用户已下线"); -/* */ } -/* 77 */ if (sessionId.equals(ShiroUtils.getSessionId())) -/* */ { -/* 79 */ return error("当前登录用户无法强退"); -/* */ } -/* 81 */ this.onlineSessionDAO.delete((Session)onlineSession); -/* 82 */ online.setStatus(OnlineStatus.off_line); -/* 83 */ this.userOnlineService.saveOnline(online); -/* 84 */ this.userOnlineService.removeUserCache(online.getLoginName(), sessionId); -/* */ } -/* 86 */ return success(); -/* */ } -/* */ } + import com.archive.project.monitor.online.service.IUserOnlineService; + import java.util.List; + import org.apache.shiro.authz.annotation.Logical; + import org.apache.shiro.authz.annotation.RequiresPermissions; + import org.apache.shiro.session.Session; + import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.stereotype.Controller; + import org.springframework.web.bind.annotation.GetMapping; + import org.springframework.web.bind.annotation.PostMapping; + import org.springframework.web.bind.annotation.RequestMapping; + import org.springframework.web.bind.annotation.ResponseBody; + + + + + + @Controller + @RequestMapping({"/monitor/online"}) + public class UserOnlineController + extends BaseController + { + private String prefix = "monitor/online"; + + @Autowired + private IUserOnlineService userOnlineService; + + @Autowired + private OnlineSessionDAO onlineSessionDAO; + + + @RequiresPermissions({"monitor:online:view"}) + @GetMapping + public String online() { + return this.prefix + "/online"; + } + + + @RequiresPermissions({"monitor:online:list"}) + @PostMapping({"/list"}) + @ResponseBody + public TableDataInfo list(UserOnline userOnline) { + startPage(); + List list = this.userOnlineService.selectUserOnlineList(userOnline); + return getDataTable(list); + } + + + @RequiresPermissions(value = {"monitor:online:batchForceLogout", "monitor:online:forceLogout"}, logical = Logical.OR) + @Log(title = "在线用户", businessType = BusinessType.FORCE) + @PostMapping({"/batchForceLogout"}) + @ResponseBody + public AjaxResult batchForceLogout(String ids) { + for (String sessionId : Convert.toStrArray(ids)) { + + UserOnline online = this.userOnlineService.selectOnlineById(sessionId); + if (online == null) + { + return error("用户已下线"); + } + OnlineSession onlineSession = (OnlineSession)this.onlineSessionDAO.readSession(online.getSessionId()); + if (onlineSession == null) + { + return error("用户已下线"); + } + if (sessionId.equals(ShiroUtils.getSessionId())) + { + return error("当前登录用户无法强退"); + } + this.onlineSessionDAO.delete((Session)onlineSession); + online.setStatus(OnlineStatus.off_line); + this.userOnlineService.saveOnline(online); + this.userOnlineService.removeUserCache(online.getLoginName(), sessionId); + } + return success(); + } + } /* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\project\monitor\online\controller\UserOnlineController.class diff --git a/src/main/java/com/archive/project/monitor/online/domain/UserOnline.java b/src/main/java/com/archive/project/monitor/online/domain/UserOnline.java index ad63da6..3947719 100644 --- a/src/main/java/com/archive/project/monitor/online/domain/UserOnline.java +++ b/src/main/java/com/archive/project/monitor/online/domain/UserOnline.java @@ -1,195 +1,195 @@ -/* */ package com.archive.project.monitor.online.domain + package com.archive.project.monitor.online.domain ; -/* */ -/* */ import com.archive.framework.web.domain.BaseEntity; -/* */ import com.archive.project.monitor.online.domain.OnlineSession; -/* */ import java.util.Date; -/* */ import org.apache.commons.lang3.builder.ToStringBuilder; -/* */ import org.apache.commons.lang3.builder.ToStringStyle; -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public class UserOnline -/* */ extends BaseEntity -/* */ { -/* */ private static final long serialVersionUID = 1L; -/* */ private String sessionId; -/* */ private String deptName; -/* */ private String loginName; -/* */ private String ipaddr; -/* */ private String loginLocation; -/* */ private String browser; -/* */ private String os; -/* */ private Date startTimestamp; -/* */ private Date lastAccessTime; -/* */ private Long expireTime; -/* 49 */ private OnlineStatus status = OnlineStatus.on_line; -/* */ -/* */ -/* */ private OnlineSession session; -/* */ -/* */ -/* */ public String getSessionId() { -/* 56 */ return this.sessionId; -/* */ } -/* */ -/* */ -/* */ public void setSessionId(String sessionId) { -/* 61 */ this.sessionId = sessionId; -/* */ } -/* */ -/* */ -/* */ public String getDeptName() { -/* 66 */ return this.deptName; -/* */ } -/* */ -/* */ -/* */ public void setDeptName(String deptName) { -/* 71 */ this.deptName = deptName; -/* */ } -/* */ -/* */ -/* */ public String getLoginName() { -/* 76 */ return this.loginName; -/* */ } -/* */ -/* */ -/* */ public void setLoginName(String loginName) { -/* 81 */ this.loginName = loginName; -/* */ } -/* */ -/* */ -/* */ public String getIpaddr() { -/* 86 */ return this.ipaddr; -/* */ } -/* */ -/* */ -/* */ public void setIpaddr(String ipaddr) { -/* 91 */ this.ipaddr = ipaddr; -/* */ } -/* */ -/* */ -/* */ public String getLoginLocation() { -/* 96 */ return this.loginLocation; -/* */ } -/* */ -/* */ -/* */ public void setLoginLocation(String loginLocation) { -/* 101 */ this.loginLocation = loginLocation; -/* */ } -/* */ -/* */ -/* */ public String getBrowser() { -/* 106 */ return this.browser; -/* */ } -/* */ -/* */ -/* */ public void setBrowser(String browser) { -/* 111 */ this.browser = browser; -/* */ } -/* */ -/* */ -/* */ public String getOs() { -/* 116 */ return this.os; -/* */ } -/* */ -/* */ -/* */ public void setOs(String os) { -/* 121 */ this.os = os; -/* */ } -/* */ -/* */ -/* */ public Date getStartTimestamp() { -/* 126 */ return this.startTimestamp; -/* */ } -/* */ -/* */ -/* */ public void setStartTimestamp(Date startTimestamp) { -/* 131 */ this.startTimestamp = startTimestamp; -/* */ } -/* */ -/* */ -/* */ public Date getLastAccessTime() { -/* 136 */ return this.lastAccessTime; -/* */ } -/* */ -/* */ -/* */ public void setLastAccessTime(Date lastAccessTime) { -/* 141 */ this.lastAccessTime = lastAccessTime; -/* */ } -/* */ -/* */ -/* */ public Long getExpireTime() { -/* 146 */ return this.expireTime; -/* */ } -/* */ -/* */ -/* */ public void setExpireTime(Long expireTime) { -/* 151 */ this.expireTime = expireTime; -/* */ } -/* */ -/* */ -/* */ public OnlineStatus getStatus() { -/* 156 */ return this.status; -/* */ } -/* */ -/* */ -/* */ public void setStatus(OnlineStatus status) { -/* 161 */ this.status = status; -/* */ } -/* */ -/* */ -/* */ public OnlineSession getSession() { -/* 166 */ return this.session; -/* */ } -/* */ -/* */ -/* */ public void setSession(OnlineSession session) { -/* 171 */ this.session = session; -/* */ } -/* */ -/* */ @Override -/* */ public String toString() { -/* 176 */ return (new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)) -/* 177 */ .append("sessionId", getSessionId()) -/* 178 */ .append("loginName", getLoginName()) -/* 179 */ .append("deptName", getDeptName()) -/* 180 */ .append("ipaddr", getIpaddr()) -/* 181 */ .append("loginLocation", getLoginLocation()) -/* 182 */ .append("browser", getBrowser()) -/* 183 */ .append("os", getOs()) -/* 184 */ .append("status", getStatus()) -/* 185 */ .append("startTimestamp", getStartTimestamp()) -/* 186 */ .append("lastAccessTime", getLastAccessTime()) -/* 187 */ .append("expireTime", getExpireTime()) -/* 188 */ .toString(); -/* */ } -/* */ } + + import com.archive.framework.web.domain.BaseEntity; + import com.archive.project.monitor.online.domain.OnlineSession; + import java.util.Date; + import org.apache.commons.lang3.builder.ToStringBuilder; + import org.apache.commons.lang3.builder.ToStringStyle; + + + + + + + + + + + + + + + + + + + + + + + + + + + + public class UserOnline + extends BaseEntity + { + private static final long serialVersionUID = 1L; + private String sessionId; + private String deptName; + private String loginName; + private String ipaddr; + private String loginLocation; + private String browser; + private String os; + private Date startTimestamp; + private Date lastAccessTime; + private Long expireTime; + private OnlineStatus status = OnlineStatus.on_line; + + + private OnlineSession session; + + + public String getSessionId() { + return this.sessionId; + } + + + public void setSessionId(String sessionId) { + this.sessionId = sessionId; + } + + + public String getDeptName() { + return this.deptName; + } + + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + + public String getLoginName() { + return this.loginName; + } + + + public void setLoginName(String loginName) { + this.loginName = loginName; + } + + + public String getIpaddr() { + return this.ipaddr; + } + + + public void setIpaddr(String ipaddr) { + this.ipaddr = ipaddr; + } + + + public String getLoginLocation() { + return this.loginLocation; + } + + + public void setLoginLocation(String loginLocation) { + this.loginLocation = loginLocation; + } + + + public String getBrowser() { + return this.browser; + } + + + public void setBrowser(String browser) { + this.browser = browser; + } + + + public String getOs() { + return this.os; + } + + + public void setOs(String os) { + this.os = os; + } + + + public Date getStartTimestamp() { + return this.startTimestamp; + } + + + public void setStartTimestamp(Date startTimestamp) { + this.startTimestamp = startTimestamp; + } + + + public Date getLastAccessTime() { + return this.lastAccessTime; + } + + + public void setLastAccessTime(Date lastAccessTime) { + this.lastAccessTime = lastAccessTime; + } + + + public Long getExpireTime() { + return this.expireTime; + } + + + public void setExpireTime(Long expireTime) { + this.expireTime = expireTime; + } + + + public OnlineStatus getStatus() { + return this.status; + } + + + public void setStatus(OnlineStatus status) { + this.status = status; + } + + + public OnlineSession getSession() { + return this.session; + } + + + public void setSession(OnlineSession session) { + this.session = session; + } + + @Override + public String toString() { + return (new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)) + .append("sessionId", getSessionId()) + .append("loginName", getLoginName()) + .append("deptName", getDeptName()) + .append("ipaddr", getIpaddr()) + .append("loginLocation", getLoginLocation()) + .append("browser", getBrowser()) + .append("os", getOs()) + .append("status", getStatus()) + .append("startTimestamp", getStartTimestamp()) + .append("lastAccessTime", getLastAccessTime()) + .append("expireTime", getExpireTime()) + .toString(); + } + } /* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\project\monitor\online\domain\UserOnline.class diff --git a/src/main/java/com/archive/project/monitor/online/service/UserOnlineServiceImpl.java b/src/main/java/com/archive/project/monitor/online/service/UserOnlineServiceImpl.java index 8de3420..667b3da 100644 --- a/src/main/java/com/archive/project/monitor/online/service/UserOnlineServiceImpl.java +++ b/src/main/java/com/archive/project/monitor/online/service/UserOnlineServiceImpl.java @@ -1,156 +1,156 @@ -/* */ package com.archive.project.monitor.online.service + package com.archive.project.monitor.online.service ; -/* */ -/* */ import com.archive.common.utils.DateUtils; -/* */ import com.archive.common.utils.StringUtils; -/* */ import com.archive.framework.shiro.session.OnlineSessionDAO; -/* */ import com.archive.project.monitor.online.domain.UserOnline; -/* */ import com.archive.project.monitor.online.mapper.UserOnlineMapper; -/* */ import com.archive.project.monitor.online.service.IUserOnlineService; -/* */ import java.io.Serializable; -/* */ import java.util.Date; -/* */ import java.util.Deque; -/* */ import java.util.List; -/* */ import org.apache.shiro.cache.Cache; -/* */ import org.apache.shiro.cache.ehcache.EhCacheManager; -/* */ import org.apache.shiro.session.Session; -/* */ import org.springframework.beans.factory.annotation.Autowired; -/* */ import org.springframework.stereotype.Service; -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ @Service -/* */ public class UserOnlineServiceImpl -/* */ implements IUserOnlineService -/* */ { -/* */ @Autowired -/* */ private UserOnlineMapper userOnlineDao; -/* */ @Autowired -/* */ private OnlineSessionDAO onlineSessionDAO; -/* */ @Autowired -/* */ private EhCacheManager ehCacheManager; -/* */ -/* */ public UserOnline selectOnlineById(String sessionId) { -/* 45 */ return this.userOnlineDao.selectOnlineById(sessionId); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public void deleteOnlineById(String sessionId) { -/* 57 */ UserOnline userOnline = selectOnlineById(sessionId); -/* 58 */ if (StringUtils.isNotNull(userOnline)) -/* */ { -/* 60 */ this.userOnlineDao.deleteOnlineById(sessionId); -/* */ } -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public void batchDeleteOnline(List sessions) { -/* 73 */ for (String sessionId : sessions) { -/* */ -/* 75 */ UserOnline userOnline = selectOnlineById(sessionId); -/* 76 */ if (StringUtils.isNotNull(userOnline)) -/* */ { -/* 78 */ this.userOnlineDao.deleteOnlineById(sessionId); -/* */ } -/* */ } -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public void saveOnline(UserOnline online) { -/* 91 */ this.userOnlineDao.saveOnline(online); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public List selectUserOnlineList(UserOnline userOnline) { -/* 102 */ return this.userOnlineDao.selectUserOnlineList(userOnline); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public void forceLogout(String sessionId) { -/* 113 */ Session session = this.onlineSessionDAO.readSession(sessionId); -/* 114 */ if (session == null) { -/* */ return; -/* */ } -/* */ -/* 118 */ session.setTimeout(1000L); -/* 119 */ this.userOnlineDao.deleteOnlineById(sessionId); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public void removeUserCache(String loginName, String sessionId) { -/* 131 */ Cache> cache = this.ehCacheManager.getCache("sys-userCache"); -/* 132 */ Deque deque = (Deque)cache.get(loginName); -/* 133 */ if (StringUtils.isEmpty(deque) || deque.size() == 0) { -/* */ return; -/* */ } -/* */ -/* 137 */ deque.remove(sessionId); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public List selectOnlineByExpired(Date expiredDate) { -/* 148 */ String lastAccessTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, expiredDate); -/* 149 */ return this.userOnlineDao.selectOnlineByExpired(lastAccessTime); -/* */ } -/* */ } + + import com.archive.common.utils.DateUtils; + import com.archive.common.utils.StringUtils; + import com.archive.framework.shiro.session.OnlineSessionDAO; + import com.archive.project.monitor.online.domain.UserOnline; + import com.archive.project.monitor.online.mapper.UserOnlineMapper; + import com.archive.project.monitor.online.service.IUserOnlineService; + import java.io.Serializable; + import java.util.Date; + import java.util.Deque; + import java.util.List; + import org.apache.shiro.cache.Cache; + import org.apache.shiro.cache.ehcache.EhCacheManager; + import org.apache.shiro.session.Session; + import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.stereotype.Service; + + + + + + + + + + + + + + + + @Service + public class UserOnlineServiceImpl + implements IUserOnlineService + { + @Autowired + private UserOnlineMapper userOnlineDao; + @Autowired + private OnlineSessionDAO onlineSessionDAO; + @Autowired + private EhCacheManager ehCacheManager; + + public UserOnline selectOnlineById(String sessionId) { + return this.userOnlineDao.selectOnlineById(sessionId); + } + + + + + + + + + + public void deleteOnlineById(String sessionId) { + UserOnline userOnline = selectOnlineById(sessionId); + if (StringUtils.isNotNull(userOnline)) + { + this.userOnlineDao.deleteOnlineById(sessionId); + } + } + + + + + + + + + + public void batchDeleteOnline(List sessions) { + for (String sessionId : sessions) { + + UserOnline userOnline = selectOnlineById(sessionId); + if (StringUtils.isNotNull(userOnline)) + { + this.userOnlineDao.deleteOnlineById(sessionId); + } + } + } + + + + + + + + + public void saveOnline(UserOnline online) { + this.userOnlineDao.saveOnline(online); + } + + + + + + + + + public List selectUserOnlineList(UserOnline userOnline) { + return this.userOnlineDao.selectUserOnlineList(userOnline); + } + + + + + + + + + public void forceLogout(String sessionId) { + Session session = this.onlineSessionDAO.readSession(sessionId); + if (session == null) { + return; + } + + session.setTimeout(1000L); + this.userOnlineDao.deleteOnlineById(sessionId); + } + + + + + + + + + + public void removeUserCache(String loginName, String sessionId) { + Cache> cache = this.ehCacheManager.getCache("sys-userCache"); + Deque deque = (Deque)cache.get(loginName); + if (StringUtils.isEmpty(deque) || deque.size() == 0) { + return; + } + + deque.remove(sessionId); + } + + + + + + + + + public List selectOnlineByExpired(Date expiredDate) { + String lastAccessTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, expiredDate); + return this.userOnlineDao.selectOnlineByExpired(lastAccessTime); + } + } /* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\project\monitor\online\service\UserOnlineServiceImpl.class diff --git a/src/main/java/com/archive/project/system/user/domain/UserPost.java b/src/main/java/com/archive/project/system/user/domain/UserPost.java index 895e9f2..25adc52 100644 --- a/src/main/java/com/archive/project/system/user/domain/UserPost.java +++ b/src/main/java/com/archive/project/system/user/domain/UserPost.java @@ -1,49 +1,49 @@ -/* */ package com.archive.project.system.user.domain + package com.archive.project.system.user.domain ; -/* */ -/* */ import org.apache.commons.lang3.builder.ToStringBuilder; -/* */ import org.apache.commons.lang3.builder.ToStringStyle; -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public class UserPost -/* */ { -/* */ private Long userId; -/* */ private Long postId; -/* */ -/* */ public Long getUserId() { -/* 20 */ return this.userId; -/* */ } -/* */ -/* */ -/* */ public void setUserId(Long userId) { -/* 25 */ this.userId = userId; -/* */ } -/* */ -/* */ -/* */ public Long getPostId() { -/* 30 */ return this.postId; -/* */ } -/* */ -/* */ -/* */ public void setPostId(Long postId) { -/* 35 */ this.postId = postId; -/* */ } -/* */ -/* */ -/* */ public String toString() { -/* 40 */ return (new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)) -/* 41 */ .append("userId", getUserId()) -/* 42 */ .append("postId", getPostId()) -/* 43 */ .toString(); -/* */ } -/* */ } + + import org.apache.commons.lang3.builder.ToStringBuilder; + import org.apache.commons.lang3.builder.ToStringStyle; + + + + + + + + + + public class UserPost + { + private Long userId; + private Long postId; + + public Long getUserId() { + return this.userId; + } + + + public void setUserId(Long userId) { + this.userId = userId; + } + + + public Long getPostId() { + return this.postId; + } + + + public void setPostId(Long postId) { + this.postId = postId; + } + + + public String toString() { + return (new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)) + .append("userId", getUserId()) + .append("postId", getPostId()) + .toString(); + } + } /* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\project\syste\\user\domain\UserPost.class diff --git a/src/main/java/com/archive/project/system/user/domain/UserRole.java b/src/main/java/com/archive/project/system/user/domain/UserRole.java index f83a050..c013c9e 100644 --- a/src/main/java/com/archive/project/system/user/domain/UserRole.java +++ b/src/main/java/com/archive/project/system/user/domain/UserRole.java @@ -1,51 +1,51 @@ -/* */ package com.archive.project.system.user.domain + package com.archive.project.system.user.domain ; -/* */ -/* */ import org.apache.commons.lang3.builder.ToStringBuilder; -/* */ import org.apache.commons.lang3.builder.ToStringStyle; -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public class UserRole -/* */ { -/* */ private Long userId; -/* */ private Long roleId; -/* */ -/* */ public Long getUserId() { -/* 21 */ return this.userId; -/* */ } -/* */ -/* */ -/* */ public void setUserId(Long userId) { -/* 26 */ this.userId = userId; -/* */ } -/* */ -/* */ -/* */ public Long getRoleId() { -/* 31 */ return this.roleId; -/* */ } -/* */ -/* */ -/* */ public void setRoleId(Long roleId) { -/* 36 */ this.roleId = roleId; -/* */ } -/* */ -/* */ -/* */ public String toString() { -/* 41 */ return (new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)) -/* 42 */ .append("userId", getUserId()) -/* 43 */ .append("roleId", getRoleId()) -/* 44 */ .toString(); -/* */ } -/* */ } + + import org.apache.commons.lang3.builder.ToStringBuilder; + import org.apache.commons.lang3.builder.ToStringStyle; + + + + + + + + + + + public class UserRole + { + private Long userId; + private Long roleId; + + public Long getUserId() { + return this.userId; + } + + + public void setUserId(Long userId) { + this.userId = userId; + } + + + public Long getRoleId() { + return this.roleId; + } + + + public void setRoleId(Long roleId) { + this.roleId = roleId; + } + + + public String toString() { + return (new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)) + .append("userId", getUserId()) + .append("roleId", getRoleId()) + .toString(); + } + } /* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\project\syste\\user\domain\UserRole.class diff --git a/src/main/java/com/archive/project/system/user/domain/UserStatus.java b/src/main/java/com/archive/project/system/user/domain/UserStatus.java index 9caa68d..86151ae 100644 --- a/src/main/java/com/archive/project/system/user/domain/UserStatus.java +++ b/src/main/java/com/archive/project/system/user/domain/UserStatus.java @@ -1,34 +1,34 @@ -/* */ package com.archive.project.system.user.domain; -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public enum UserStatus -/* */ { -/* 11 */ OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除"); -/* */ -/* */ private final String info; -/* */ -/* */ private final String code; -/* */ -/* */ UserStatus(String code, String info) { -/* 18 */ this.code = code; -/* 19 */ this.info = info; -/* */ } -/* */ -/* */ -/* */ public String getCode() { -/* 24 */ return this.code; -/* */ } -/* */ -/* */ -/* */ public String getInfo() { -/* 29 */ return this.info; -/* */ } -/* */ } + package com.archive.project.system.user.domain; + + + + + + + + public enum UserStatus + { + OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除"); + + private final String info; + + private final String code; + + UserStatus(String code, String info) { + this.code = code; + this.info = info; + } + + + public String getCode() { + return this.code; + } + + + public String getInfo() { + return this.info; + } + } /* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\project\syste\\user\domain\UserStatus.class diff --git a/src/main/java/com/archive/project/system/user/service/UserServiceImpl.java b/src/main/java/com/archive/project/system/user/service/UserServiceImpl.java index b7fca15..6d9cdde 100644 --- a/src/main/java/com/archive/project/system/user/service/UserServiceImpl.java +++ b/src/main/java/com/archive/project/system/user/service/UserServiceImpl.java @@ -1,600 +1,600 @@ -/* */ package com.archive.project.system.user.service + package com.archive.project.system.user.service ; -/* */ -/* */ import com.archive.common.exception.BusinessException; -/* */ import com.archive.common.utils.StringUtils; -/* */ import com.archive.common.utils.security.ShiroUtils; -/* */ import com.archive.common.utils.text.Convert; -/* */ import com.archive.framework.aspectj.lang.annotation.DataScope; -/* */ import com.archive.framework.config.ArchiveConfig; -/* */ import com.archive.framework.shiro.service.PasswordService; -/* */ import com.archive.project.system.config.service.IConfigService; -/* */ import com.archive.project.system.post.domain.Post; -/* */ import com.archive.project.system.post.mapper.PostMapper; -/* */ import com.archive.project.system.role.domain.Role; -/* */ import com.archive.project.system.role.mapper.RoleMapper; -/* */ import com.archive.project.system.user.domain.User; -/* */ import com.archive.project.system.user.domain.UserPost; -/* */ import com.archive.project.system.user.domain.UserRole; -/* */ import com.archive.project.system.user.mapper.UserMapper; -/* */ import com.archive.project.system.user.mapper.UserPostMapper; -/* */ import com.archive.project.system.user.mapper.UserRoleMapper; -/* */ import com.archive.project.system.user.service.IUserService; -/* */ import java.util.ArrayList; -/* */ import java.util.List; -/* */ import org.slf4j.Logger; -/* */ import org.slf4j.LoggerFactory; -/* */ import org.springframework.beans.factory.annotation.Autowired; -/* */ import org.springframework.stereotype.Service; -/* */ import org.springframework.transaction.annotation.Transactional; -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ @Service -/* */ public class UserServiceImpl -/* */ implements IUserService -/* */ { -/* 40 */ private static final Logger log = LoggerFactory.getLogger(com.archive.project.system.user.service.UserServiceImpl.class); -/* */ -/* */ -/* */ @Autowired -/* */ private UserMapper userMapper; -/* */ -/* */ -/* */ @Autowired -/* */ private RoleMapper roleMapper; -/* */ -/* */ -/* */ @Autowired -/* */ private PostMapper postMapper; -/* */ -/* */ -/* */ @Autowired -/* */ private UserPostMapper userPostMapper; -/* */ -/* */ -/* */ @Autowired -/* */ private UserRoleMapper userRoleMapper; -/* */ -/* */ -/* */ @Autowired -/* */ private IConfigService configService; -/* */ -/* */ -/* */ @Autowired -/* */ private PasswordService passwordService; -/* */ -/* */ -/* */ @Autowired -/* */ private ArchiveConfig archiveConfig; -/* */ -/* */ -/* */ @DataScope(deptAlias = "d", userAlias = "u") -/* */ public List selectUserList(User user) { -/* 77 */ if ("mysql".equals(this.archiveConfig.getDatabaseType())) { -/* 78 */ return this.userMapper.selectUserList(user); -/* */ } -/* 80 */ if ("sqlite".equals(this.archiveConfig.getDatabaseType())) { -/* 81 */ return this.userMapper.selectUserListSqlite(user); -/* */ } -/* 83 */ return this.userMapper.selectUserList(user); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ @DataScope(deptAlias = "d", userAlias = "u") -/* */ public List selectAllocatedList(User user) { -/* 98 */ if ("mysql".equals(this.archiveConfig.getDatabaseType())) { -/* 99 */ return this.userMapper.selectAllocatedList(user); -/* */ } -/* 101 */ if ("sqlite".equals(this.archiveConfig.getDatabaseType())) { -/* 102 */ return this.userMapper.selectAllocatedListSqlite(user); -/* */ } -/* 104 */ return this.userMapper.selectAllocatedList(user); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ @DataScope(deptAlias = "d", userAlias = "u") -/* */ public List selectUnallocatedList(User user) { -/* 119 */ if ("mysql".equals(this.archiveConfig.getDatabaseType())) { -/* 120 */ return this.userMapper.selectUnallocatedList(user); -/* */ } -/* 122 */ if ("sqlite".equals(this.archiveConfig.getDatabaseType())) { -/* 123 */ return this.userMapper.selectUnallocatedListSqlite(user); -/* */ } -/* 125 */ return this.userMapper.selectUnallocatedList(user); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public User selectUserByLoginName(String userName) { -/* 139 */ return this.userMapper.selectUserByLoginName(userName); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public User selectUserByPhoneNumber(String phoneNumber) { -/* 151 */ return this.userMapper.selectUserByPhoneNumber(phoneNumber); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public User selectUserByEmail(String email) { -/* 163 */ return this.userMapper.selectUserByEmail(email); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public User selectUserById(Long userId) { -/* 175 */ return this.userMapper.selectUserById(userId); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public List selectUserRoleByUserId(Long userId) { -/* 187 */ return this.userRoleMapper.selectUserRoleByUserId(userId); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ @Transactional -/* */ public int deleteUserById(Long userId) { -/* 201 */ this.userRoleMapper.deleteUserRoleByUserId(userId); -/* */ -/* 203 */ this.userPostMapper.deleteUserPostByUserId(userId); -/* 204 */ return this.userMapper.deleteUserById(userId); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ @Transactional -/* */ public int deleteUserByIds(String ids) { -/* 217 */ Long[] userIds = Convert.toLongArray(ids); -/* 218 */ for (Long userId : userIds) -/* */ { -/* 220 */ checkUserAllowed(new User(userId)); -/* */ } -/* */ -/* 223 */ this.userRoleMapper.deleteUserRole(userIds); -/* */ -/* 225 */ this.userPostMapper.deleteUserPost(userIds); -/* 226 */ return this.userMapper.deleteUserByIds(userIds); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ @Transactional -/* */ public int insertUser(User user) { -/* 239 */ user.randomSalt(); -/* 240 */ user.setPassword(this.passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt())); -/* 241 */ user.setCreateBy(ShiroUtils.getLoginName()); -/* */ -/* 243 */ int rows = 0; -/* 244 */ if ("mysql".equals(this.archiveConfig.getDatabaseType())) { -/* 245 */ rows = this.userMapper.insertUser(user); -/* */ } -/* 247 */ else if ("sqlite".equals(this.archiveConfig.getDatabaseType())) { -/* 248 */ rows = this.userMapper.insertUserSqlite(user); -/* */ } else { -/* 250 */ rows = this.userMapper.insertUser(user); -/* */ } -/* */ -/* */ -/* 254 */ insertUserPost(user); -/* */ -/* 256 */ insertUserRole(user.getUserId(), user.getRoleIds()); -/* 257 */ return rows; -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public boolean registerUser(User user) { -/* 269 */ user.setUserType("01"); -/* 270 */ user.randomSalt(); -/* 271 */ user.setPassword(this.passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt())); -/* 272 */ return (this.userMapper.insertUser(user) > 0); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ @Transactional -/* */ public int updateUser(User user) { -/* 285 */ Long userId = user.getUserId(); -/* 286 */ user.setUpdateBy(ShiroUtils.getLoginName()); -/* */ -/* 288 */ this.userRoleMapper.deleteUserRoleByUserId(userId); -/* */ -/* 290 */ insertUserRole(user.getUserId(), user.getRoleIds()); -/* */ -/* 292 */ this.userPostMapper.deleteUserPostByUserId(userId); -/* */ -/* 294 */ insertUserPost(user); -/* 295 */ if ("mysql".equals(this.archiveConfig.getDatabaseType())) { -/* 296 */ return this.userMapper.updateUser(user); -/* */ } -/* 298 */ if ("sqlite".equals(this.archiveConfig.getDatabaseType())) { -/* 299 */ return this.userMapper.updateUserSqlite(user); -/* */ } -/* 301 */ return this.userMapper.updateUser(user); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public int updateUserInfo(User user) { -/* 313 */ if ("mysql".equals(this.archiveConfig.getDatabaseType())) { -/* 314 */ return this.userMapper.updateUser(user); -/* */ } -/* 316 */ if ("sqlite".equals(this.archiveConfig.getDatabaseType())) { -/* 317 */ return this.userMapper.updateUserSqlite(user); -/* */ } -/* 319 */ return this.userMapper.updateUser(user); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public void insertUserAuth(Long userId, Long[] roleIds) { -/* 331 */ this.userRoleMapper.deleteUserRoleByUserId(userId); -/* 332 */ insertUserRole(userId, roleIds); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public int resetUserPwd(User user) { -/* 344 */ user.randomSalt(); -/* 345 */ user.setPassword(this.passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt())); -/* 346 */ return updateUserInfo(user); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public void insertUserRole(Long userId, Long[] roleIds) { -/* 356 */ if (StringUtils.isNotNull(roleIds)) { -/* */ -/* */ -/* 359 */ List list = new ArrayList<>(); -/* 360 */ for (Long roleId : roleIds) { -/* */ -/* 362 */ UserRole ur = new UserRole(); -/* 363 */ ur.setUserId(userId); -/* 364 */ ur.setRoleId(roleId); -/* 365 */ list.add(ur); -/* */ } -/* 367 */ if (list.size() > 0) -/* */ { -/* 369 */ this.userRoleMapper.batchUserRole(list); -/* */ } -/* */ } -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public void insertUserPost(User user) { -/* 381 */ Long[] posts = user.getPostIds(); -/* 382 */ if (StringUtils.isNotNull(posts)) { -/* */ -/* */ -/* 385 */ List list = new ArrayList<>(); -/* 386 */ for (Long postId : user.getPostIds()) { -/* */ -/* 388 */ UserPost up = new UserPost(); -/* 389 */ up.setUserId(user.getUserId()); -/* 390 */ up.setPostId(postId); -/* 391 */ list.add(up); -/* */ } -/* 393 */ if (list.size() > 0) -/* */ { -/* 395 */ this.userPostMapper.batchUserPost(list); -/* */ } -/* */ } -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public String checkLoginNameUnique(String loginName) { -/* 409 */ int count = this.userMapper.checkLoginNameUnique(loginName); -/* 410 */ if (count > 0) -/* */ { -/* 412 */ return "1"; -/* */ } -/* 414 */ return "0"; -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public String checkPhoneUnique(User user) { -/* 426 */ Long userId = Long.valueOf(StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId().longValue()); -/* 427 */ User info = this.userMapper.checkPhoneUnique(user.getPhonenumber()); -/* 428 */ if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) -/* */ { -/* 430 */ return "1"; -/* */ } -/* 432 */ return "0"; -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public String checkEmailUnique(User user) { -/* 444 */ Long userId = Long.valueOf(StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId().longValue()); -/* 445 */ User info = this.userMapper.checkEmailUnique(user.getEmail()); -/* 446 */ if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) -/* */ { -/* 448 */ return "1"; -/* */ } -/* 450 */ return "0"; -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public void checkUserAllowed(User user) { -/* 461 */ if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) -/* */ { -/* 463 */ throw new BusinessException("不允许操作超级管理员用户"); -/* */ } -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public String selectUserRoleGroup(Long userId) { -/* 476 */ List list = this.roleMapper.selectRolesByUserId(userId); -/* 477 */ StringBuffer idsStr = new StringBuffer(); -/* 478 */ for (Role role : list) -/* */ { -/* 480 */ idsStr.append(role.getRoleName()).append(","); -/* */ } -/* 482 */ if (StringUtils.isNotEmpty(idsStr.toString())) -/* */ { -/* 484 */ return idsStr.substring(0, idsStr.length() - 1); -/* */ } -/* 486 */ return idsStr.toString(); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public String selectUserPostGroup(Long userId) { -/* 498 */ List list = this.postMapper.selectPostsByUserId(userId); -/* 499 */ StringBuffer idsStr = new StringBuffer(); -/* 500 */ for (Post post : list) -/* */ { -/* 502 */ idsStr.append(post.getPostName()).append(","); -/* */ } -/* 504 */ if (StringUtils.isNotEmpty(idsStr.toString())) -/* */ { -/* 506 */ return idsStr.substring(0, idsStr.length() - 1); -/* */ } -/* 508 */ return idsStr.toString(); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public String importUser(List userList, Boolean isUpdateSupport) { -/* 521 */ if (StringUtils.isNull(userList) || userList.size() == 0) -/* */ { -/* 523 */ throw new BusinessException("导入用户数据不能为空!"); -/* */ } -/* 525 */ int successNum = 0; -/* 526 */ int failureNum = 0; -/* 527 */ StringBuilder successMsg = new StringBuilder(); -/* 528 */ StringBuilder failureMsg = new StringBuilder(); -/* 529 */ String operName = ShiroUtils.getLoginName(); -/* 530 */ String password = this.configService.selectConfigByKey("sys.user.initPassword"); -/* 531 */ for (User user : userList) { -/* */ -/* */ -/* */ try { -/* */ -/* 536 */ User u = this.userMapper.selectUserByLoginName(user.getLoginName()); -/* 537 */ if (StringUtils.isNull(u)) { -/* */ -/* 539 */ user.setPassword(password); -/* 540 */ user.setCreateBy(operName); -/* 541 */ insertUser(user); -/* 542 */ successNum++; -/* 543 */ successMsg.append("
" + successNum + "、账号 " + user.getLoginName() + " 导入成功"); continue; -/* */ } -/* 545 */ if (isUpdateSupport.booleanValue()) { -/* */ -/* 547 */ user.setUpdateBy(operName); -/* 548 */ updateUser(user); -/* 549 */ successNum++; -/* 550 */ successMsg.append("
" + successNum + "、账号 " + user.getLoginName() + " 更新成功"); -/* */ -/* */ continue; -/* */ } -/* 554 */ failureNum++; -/* 555 */ failureMsg.append("
" + failureNum + "、账号 " + user.getLoginName() + " 已存在"); -/* */ -/* */ } -/* 558 */ catch (Exception e) { -/* */ -/* 560 */ failureNum++; -/* 561 */ String msg = "
" + failureNum + "、账号 " + user.getLoginName() + " 导入失败:"; -/* 562 */ failureMsg.append(msg + e.getMessage()); -/* 563 */ log.error(msg, e); -/* */ } -/* */ } -/* 566 */ if (failureNum > 0) { -/* */ -/* 568 */ failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); -/* 569 */ throw new BusinessException(failureMsg.toString()); -/* */ } -/* */ -/* */ -/* 573 */ successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); -/* */ -/* 575 */ return successMsg.toString(); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public int changeStatus(User user) { -/* 587 */ if ("mysql".equals(this.archiveConfig.getDatabaseType())) { -/* 588 */ return this.userMapper.updateUser(user); -/* */ } -/* 590 */ if ("sqlite".equals(this.archiveConfig.getDatabaseType())) { -/* 591 */ return this.userMapper.updateUserSqlite(user); -/* */ } -/* 593 */ return this.userMapper.updateUser(user); -/* */ } -/* */ } + + import com.archive.common.exception.BusinessException; + import com.archive.common.utils.StringUtils; + import com.archive.common.utils.security.ShiroUtils; + import com.archive.common.utils.text.Convert; + import com.archive.framework.aspectj.lang.annotation.DataScope; + import com.archive.framework.config.ArchiveConfig; + import com.archive.framework.shiro.service.PasswordService; + import com.archive.project.system.config.service.IConfigService; + import com.archive.project.system.post.domain.Post; + import com.archive.project.system.post.mapper.PostMapper; + import com.archive.project.system.role.domain.Role; + import com.archive.project.system.role.mapper.RoleMapper; + import com.archive.project.system.user.domain.User; + import com.archive.project.system.user.domain.UserPost; + import com.archive.project.system.user.domain.UserRole; + import com.archive.project.system.user.mapper.UserMapper; + import com.archive.project.system.user.mapper.UserPostMapper; + import com.archive.project.system.user.mapper.UserRoleMapper; + import com.archive.project.system.user.service.IUserService; + import java.util.ArrayList; + import java.util.List; + import org.slf4j.Logger; + import org.slf4j.LoggerFactory; + import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.stereotype.Service; + import org.springframework.transaction.annotation.Transactional; + + + + + + + + @Service + public class UserServiceImpl + implements IUserService + { + private static final Logger log = LoggerFactory.getLogger(com.archive.project.system.user.service.UserServiceImpl.class); + + + @Autowired + private UserMapper userMapper; + + + @Autowired + private RoleMapper roleMapper; + + + @Autowired + private PostMapper postMapper; + + + @Autowired + private UserPostMapper userPostMapper; + + + @Autowired + private UserRoleMapper userRoleMapper; + + + @Autowired + private IConfigService configService; + + + @Autowired + private PasswordService passwordService; + + + @Autowired + private ArchiveConfig archiveConfig; + + + @DataScope(deptAlias = "d", userAlias = "u") + public List selectUserList(User user) { + if ("mysql".equals(this.archiveConfig.getDatabaseType())) { + return this.userMapper.selectUserList(user); + } + if ("sqlite".equals(this.archiveConfig.getDatabaseType())) { + return this.userMapper.selectUserListSqlite(user); + } + return this.userMapper.selectUserList(user); + } + + + + + + + + + + + + @DataScope(deptAlias = "d", userAlias = "u") + public List selectAllocatedList(User user) { + if ("mysql".equals(this.archiveConfig.getDatabaseType())) { + return this.userMapper.selectAllocatedList(user); + } + if ("sqlite".equals(this.archiveConfig.getDatabaseType())) { + return this.userMapper.selectAllocatedListSqlite(user); + } + return this.userMapper.selectAllocatedList(user); + } + + + + + + + + + + + + @DataScope(deptAlias = "d", userAlias = "u") + public List selectUnallocatedList(User user) { + if ("mysql".equals(this.archiveConfig.getDatabaseType())) { + return this.userMapper.selectUnallocatedList(user); + } + if ("sqlite".equals(this.archiveConfig.getDatabaseType())) { + return this.userMapper.selectUnallocatedListSqlite(user); + } + return this.userMapper.selectUnallocatedList(user); + } + + + + + + + + + + + + public User selectUserByLoginName(String userName) { + return this.userMapper.selectUserByLoginName(userName); + } + + + + + + + + + + public User selectUserByPhoneNumber(String phoneNumber) { + return this.userMapper.selectUserByPhoneNumber(phoneNumber); + } + + + + + + + + + + public User selectUserByEmail(String email) { + return this.userMapper.selectUserByEmail(email); + } + + + + + + + + + + public User selectUserById(Long userId) { + return this.userMapper.selectUserById(userId); + } + + + + + + + + + + public List selectUserRoleByUserId(Long userId) { + return this.userRoleMapper.selectUserRoleByUserId(userId); + } + + + + + + + + + + + @Transactional + public int deleteUserById(Long userId) { + this.userRoleMapper.deleteUserRoleByUserId(userId); + + this.userPostMapper.deleteUserPostByUserId(userId); + return this.userMapper.deleteUserById(userId); + } + + + + + + + + + + @Transactional + public int deleteUserByIds(String ids) { + Long[] userIds = Convert.toLongArray(ids); + for (Long userId : userIds) + { + checkUserAllowed(new User(userId)); + } + + this.userRoleMapper.deleteUserRole(userIds); + + this.userPostMapper.deleteUserPost(userIds); + return this.userMapper.deleteUserByIds(userIds); + } + + + + + + + + + + @Transactional + public int insertUser(User user) { + user.randomSalt(); + user.setPassword(this.passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt())); + user.setCreateBy(ShiroUtils.getLoginName()); + + int rows = 0; + if ("mysql".equals(this.archiveConfig.getDatabaseType())) { + rows = this.userMapper.insertUser(user); + } + else if ("sqlite".equals(this.archiveConfig.getDatabaseType())) { + rows = this.userMapper.insertUserSqlite(user); + } else { + rows = this.userMapper.insertUser(user); + } + + + insertUserPost(user); + + insertUserRole(user.getUserId(), user.getRoleIds()); + return rows; + } + + + + + + + + + + public boolean registerUser(User user) { + user.setUserType("01"); + user.randomSalt(); + user.setPassword(this.passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt())); + return (this.userMapper.insertUser(user) > 0); + } + + + + + + + + + + @Transactional + public int updateUser(User user) { + Long userId = user.getUserId(); + user.setUpdateBy(ShiroUtils.getLoginName()); + + this.userRoleMapper.deleteUserRoleByUserId(userId); + + insertUserRole(user.getUserId(), user.getRoleIds()); + + this.userPostMapper.deleteUserPostByUserId(userId); + + insertUserPost(user); + if ("mysql".equals(this.archiveConfig.getDatabaseType())) { + return this.userMapper.updateUser(user); + } + if ("sqlite".equals(this.archiveConfig.getDatabaseType())) { + return this.userMapper.updateUserSqlite(user); + } + return this.userMapper.updateUser(user); + } + + + + + + + + + + public int updateUserInfo(User user) { + if ("mysql".equals(this.archiveConfig.getDatabaseType())) { + return this.userMapper.updateUser(user); + } + if ("sqlite".equals(this.archiveConfig.getDatabaseType())) { + return this.userMapper.updateUserSqlite(user); + } + return this.userMapper.updateUser(user); + } + + + + + + + + + + public void insertUserAuth(Long userId, Long[] roleIds) { + this.userRoleMapper.deleteUserRoleByUserId(userId); + insertUserRole(userId, roleIds); + } + + + + + + + + + + public int resetUserPwd(User user) { + user.randomSalt(); + user.setPassword(this.passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt())); + return updateUserInfo(user); + } + + + + + + + + public void insertUserRole(Long userId, Long[] roleIds) { + if (StringUtils.isNotNull(roleIds)) { + + + List list = new ArrayList<>(); + for (Long roleId : roleIds) { + + UserRole ur = new UserRole(); + ur.setUserId(userId); + ur.setRoleId(roleId); + list.add(ur); + } + if (list.size() > 0) + { + this.userRoleMapper.batchUserRole(list); + } + } + } + + + + + + + + public void insertUserPost(User user) { + Long[] posts = user.getPostIds(); + if (StringUtils.isNotNull(posts)) { + + + List list = new ArrayList<>(); + for (Long postId : user.getPostIds()) { + + UserPost up = new UserPost(); + up.setUserId(user.getUserId()); + up.setPostId(postId); + list.add(up); + } + if (list.size() > 0) + { + this.userPostMapper.batchUserPost(list); + } + } + } + + + + + + + + + + public String checkLoginNameUnique(String loginName) { + int count = this.userMapper.checkLoginNameUnique(loginName); + if (count > 0) + { + return "1"; + } + return "0"; + } + + + + + + + + + + public String checkPhoneUnique(User user) { + Long userId = Long.valueOf(StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId().longValue()); + User info = this.userMapper.checkPhoneUnique(user.getPhonenumber()); + if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) + { + return "1"; + } + return "0"; + } + + + + + + + + + + public String checkEmailUnique(User user) { + Long userId = Long.valueOf(StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId().longValue()); + User info = this.userMapper.checkEmailUnique(user.getEmail()); + if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) + { + return "1"; + } + return "0"; + } + + + + + + + + + public void checkUserAllowed(User user) { + if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) + { + throw new BusinessException("不允许操作超级管理员用户"); + } + } + + + + + + + + + + public String selectUserRoleGroup(Long userId) { + List list = this.roleMapper.selectRolesByUserId(userId); + StringBuffer idsStr = new StringBuffer(); + for (Role role : list) + { + idsStr.append(role.getRoleName()).append(","); + } + if (StringUtils.isNotEmpty(idsStr.toString())) + { + return idsStr.substring(0, idsStr.length() - 1); + } + return idsStr.toString(); + } + + + + + + + + + + public String selectUserPostGroup(Long userId) { + List list = this.postMapper.selectPostsByUserId(userId); + StringBuffer idsStr = new StringBuffer(); + for (Post post : list) + { + idsStr.append(post.getPostName()).append(","); + } + if (StringUtils.isNotEmpty(idsStr.toString())) + { + return idsStr.substring(0, idsStr.length() - 1); + } + return idsStr.toString(); + } + + + + + + + + + + + public String importUser(List userList, Boolean isUpdateSupport) { + if (StringUtils.isNull(userList) || userList.size() == 0) + { + throw new BusinessException("导入用户数据不能为空!"); + } + int successNum = 0; + int failureNum = 0; + StringBuilder successMsg = new StringBuilder(); + StringBuilder failureMsg = new StringBuilder(); + String operName = ShiroUtils.getLoginName(); + String password = this.configService.selectConfigByKey("sys.user.initPassword"); + for (User user : userList) { + + + try { + + User u = this.userMapper.selectUserByLoginName(user.getLoginName()); + if (StringUtils.isNull(u)) { + + user.setPassword(password); + user.setCreateBy(operName); + insertUser(user); + successNum++; + successMsg.append("
" + successNum + "、账号 " + user.getLoginName() + " 导入成功"); continue; + } + if (isUpdateSupport.booleanValue()) { + + user.setUpdateBy(operName); + updateUser(user); + successNum++; + successMsg.append("
" + successNum + "、账号 " + user.getLoginName() + " 更新成功"); + + continue; + } + failureNum++; + failureMsg.append("
" + failureNum + "、账号 " + user.getLoginName() + " 已存在"); + + } + catch (Exception e) { + + failureNum++; + String msg = "
" + failureNum + "、账号 " + user.getLoginName() + " 导入失败:"; + failureMsg.append(msg + e.getMessage()); + log.error(msg, e); + } + } + if (failureNum > 0) { + + failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); + throw new BusinessException(failureMsg.toString()); + } + + + successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); + + return successMsg.toString(); + } + + + + + + + + + + public int changeStatus(User user) { + if ("mysql".equals(this.archiveConfig.getDatabaseType())) { + return this.userMapper.updateUser(user); + } + if ("sqlite".equals(this.archiveConfig.getDatabaseType())) { + return this.userMapper.updateUserSqlite(user); + } + return this.userMapper.updateUser(user); + } + } /* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\project\syste\\user\service\UserServiceImpl.class diff --git a/src/main/java/com/archive/project/tool/gen/util/VelocityInitializer.java b/src/main/java/com/archive/project/tool/gen/util/VelocityInitializer.java index ee00c3d..073273c 100644 --- a/src/main/java/com/archive/project/tool/gen/util/VelocityInitializer.java +++ b/src/main/java/com/archive/project/tool/gen/util/VelocityInitializer.java @@ -1,40 +1,40 @@ -/* */ package com.archive.project.tool.gen.util + package com.archive.project.tool.gen.util ; -/* */ -/* */ import java.util.Properties; -/* */ import org.apache.velocity.app.Velocity; -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public class VelocityInitializer -/* */ { -/* */ public static void initVelocity() { -/* 19 */ Properties p = new Properties(); -/* */ -/* */ -/* */ try { -/* 23 */ p.setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); -/* */ -/* 25 */ p.setProperty("ISO-8859-1", "UTF-8"); -/* 26 */ p.setProperty("output.encoding", "UTF-8"); -/* */ -/* 28 */ Velocity.init(p); -/* */ } -/* 30 */ catch (Exception e) { -/* */ -/* 32 */ throw new RuntimeException(e); -/* */ } -/* */ } -/* */ } + + import java.util.Properties; + import org.apache.velocity.app.Velocity; + + + + + + + + + + + + public class VelocityInitializer + { + public static void initVelocity() { + Properties p = new Properties(); + + + try { + p.setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); + + p.setProperty("ISO-8859-1", "UTF-8"); + p.setProperty("output.encoding", "UTF-8"); + + Velocity.init(p); + } + catch (Exception e) { + + throw new RuntimeException(e); + } + } + } /* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\project\tool\ge\\util\VelocityInitializer.class diff --git a/src/main/java/com/archive/project/tool/gen/util/VelocityUtils.java b/src/main/java/com/archive/project/tool/gen/util/VelocityUtils.java index 00ba964..09f286f 100644 --- a/src/main/java/com/archive/project/tool/gen/util/VelocityUtils.java +++ b/src/main/java/com/archive/project/tool/gen/util/VelocityUtils.java @@ -1,373 +1,373 @@ -/* */ package com.archive.project.tool.gen.util + package com.archive.project.tool.gen.util ; -/* */ -/* */ import com.alibaba.fastjson.JSONObject; -/* */ import com.archive.common.utils.DateUtils; -/* */ import com.archive.common.utils.StringUtils; -/* */ import com.archive.project.tool.gen.domain.GenTable; -/* */ import com.archive.project.tool.gen.domain.GenTableColumn; -/* */ import java.util.ArrayList; -/* */ import java.util.HashSet; -/* */ import java.util.List; -/* */ import java.util.Map; -/* */ import org.apache.velocity.VelocityContext; -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public class VelocityUtils -/* */ { -/* */ private static final String PROJECT_PATH = "main/java"; -/* */ private static final String MYBATIS_PATH = "main/resources/mybatis"; -/* */ private static final String TEMPLATES_PATH = "main/resources/templates"; -/* */ private static final String DEFAULT_PARENT_MENU_ID = "3"; -/* */ -/* */ public static VelocityContext prepareContext(GenTable genTable) { -/* 35 */ String moduleName = genTable.getModuleName(); -/* 36 */ String businessName = genTable.getBusinessName(); -/* 37 */ String packageName = genTable.getPackageName(); -/* 38 */ String tplCategory = genTable.getTplCategory(); -/* 39 */ String functionName = genTable.getFunctionName(); -/* */ -/* 41 */ VelocityContext velocityContext = new VelocityContext(); -/* 42 */ velocityContext.put("tplCategory", genTable.getTplCategory()); -/* 43 */ velocityContext.put("tableName", genTable.getTableName()); -/* 44 */ velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "【请填写功能名称】"); -/* 45 */ velocityContext.put("ClassName", genTable.getClassName()); -/* 46 */ velocityContext.put("className", StringUtils.uncapitalize(genTable.getClassName())); -/* 47 */ velocityContext.put("moduleName", genTable.getModuleName()); -/* 48 */ velocityContext.put("businessName", genTable.getBusinessName()); -/* 49 */ velocityContext.put("basePackage", getPackagePrefix(packageName)); -/* 50 */ velocityContext.put("packageName", packageName); -/* 51 */ velocityContext.put("author", genTable.getFunctionAuthor()); -/* 52 */ velocityContext.put("datetime", DateUtils.getDate()); -/* 53 */ velocityContext.put("pkColumn", genTable.getPkColumn()); -/* 54 */ velocityContext.put("importList", getImportList(genTable)); -/* 55 */ velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName)); -/* 56 */ velocityContext.put("columns", genTable.getColumns()); -/* 57 */ velocityContext.put("table", genTable); -/* 58 */ setMenuVelocityContext(velocityContext, genTable); -/* 59 */ if ("tree".equals(tplCategory)) -/* */ { -/* 61 */ setTreeVelocityContext(velocityContext, genTable); -/* */ } -/* 63 */ if ("sub".equals(tplCategory)) -/* */ { -/* 65 */ setSubVelocityContext(velocityContext, genTable); -/* */ } -/* 67 */ return velocityContext; -/* */ } -/* */ -/* */ -/* */ public static void setMenuVelocityContext(VelocityContext context, GenTable genTable) { -/* 72 */ String options = genTable.getOptions(); -/* 73 */ JSONObject paramsObj = JSONObject.parseObject(options); -/* 74 */ String parentMenuId = getParentMenuId(paramsObj); -/* 75 */ context.put("parentMenuId", parentMenuId); -/* */ } -/* */ -/* */ -/* */ public static void setTreeVelocityContext(VelocityContext context, GenTable genTable) { -/* 80 */ String options = genTable.getOptions(); -/* 81 */ JSONObject paramsObj = JSONObject.parseObject(options); -/* 82 */ String treeCode = getTreecode(paramsObj); -/* 83 */ String treeParentCode = getTreeParentCode(paramsObj); -/* 84 */ String treeName = getTreeName(paramsObj); -/* */ -/* 86 */ context.put("treeCode", treeCode); -/* 87 */ context.put("treeParentCode", treeParentCode); -/* 88 */ context.put("treeName", treeName); -/* 89 */ context.put("expandColumn", Integer.valueOf(getExpandColumn(genTable))); -/* 90 */ if (paramsObj.containsKey("treeParentCode")) -/* */ { -/* 92 */ context.put("tree_parent_code", paramsObj.getString("treeParentCode")); -/* */ } -/* 94 */ if (paramsObj.containsKey("treeName")) -/* */ { -/* 96 */ context.put("tree_name", paramsObj.getString("treeName")); -/* */ } -/* */ } -/* */ -/* */ -/* */ public static void setSubVelocityContext(VelocityContext context, GenTable genTable) { -/* 102 */ GenTable subTable = genTable.getSubTable(); -/* 103 */ String subTableName = genTable.getSubTableName(); -/* 104 */ String subTableFkName = genTable.getSubTableFkName(); -/* 105 */ String subClassName = genTable.getSubTable().getClassName(); -/* 106 */ String subTableFkClassName = StringUtils.convertToCamelCase(subTableFkName); -/* */ -/* 108 */ context.put("subTable", subTable); -/* 109 */ context.put("subTableName", subTableName); -/* 110 */ context.put("subTableFkName", subTableFkName); -/* 111 */ context.put("subTableFkClassName", subTableFkClassName); -/* 112 */ context.put("subTableFkclassName", StringUtils.uncapitalize(subTableFkClassName)); -/* 113 */ context.put("subClassName", subClassName); -/* 114 */ context.put("subclassName", StringUtils.uncapitalize(subClassName)); -/* 115 */ context.put("subImportList", getImportList(genTable.getSubTable())); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public static List getTemplateList(String tplCategory) { -/* 125 */ List templates = new ArrayList<>(); -/* 126 */ templates.add("vm/java/domain.java.vm"); -/* 127 */ templates.add("vm/java/mapper.java.vm"); -/* 128 */ templates.add("vm/java/service.java.vm"); -/* 129 */ templates.add("vm/java/serviceImpl.java.vm"); -/* 130 */ templates.add("vm/java/controller.java.vm"); -/* 131 */ templates.add("vm/xml/mapper.xml.vm"); -/* 132 */ if ("crud".equals(tplCategory)) { -/* */ -/* 134 */ templates.add("vm/html/list.html.vm"); -/* */ } -/* 136 */ else if ("tree".equals(tplCategory)) { -/* */ -/* 138 */ templates.add("vm/html/tree.html.vm"); -/* 139 */ templates.add("vm/html/list-tree.html.vm"); -/* */ } -/* 141 */ else if ("sub".equals(tplCategory)) { -/* */ -/* 143 */ templates.add("vm/html/list.html.vm"); -/* 144 */ templates.add("vm/java/sub-domain.java.vm"); -/* */ } -/* 146 */ templates.add("vm/html/add.html.vm"); -/* 147 */ templates.add("vm/html/edit.html.vm"); -/* 148 */ templates.add("vm/sql/sql.vm"); -/* 149 */ return templates; -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public static String getFileName(String template, GenTable genTable) { -/* 158 */ String fileName = ""; -/* */ -/* 160 */ String packageName = genTable.getPackageName(); -/* */ -/* 162 */ String moduleName = genTable.getModuleName(); -/* */ -/* 164 */ String className = genTable.getClassName(); -/* */ -/* 166 */ String businessName = genTable.getBusinessName(); -/* */ -/* 168 */ String javaPath = "main/java/" + StringUtils.replace(packageName, ".", "/"); -/* 169 */ String mybatisPath = "main/resources/mybatis/" + moduleName; -/* 170 */ String htmlPath = "main/resources/templates/" + moduleName + "/" + businessName; -/* */ -/* 172 */ if (template.contains("domain.java.vm")) -/* */ { -/* 174 */ fileName = StringUtils.format("{}/{}/domain/{}.java", new Object[] { javaPath, businessName, className }); -/* */ } -/* 176 */ if (template.contains("sub-domain.java.vm") && StringUtils.equals("sub", genTable.getTplCategory())) { -/* */ -/* 178 */ fileName = StringUtils.format("{}/{}/domain/{}.java", new Object[] { javaPath, businessName, genTable.getSubTable().getClassName() }); -/* */ } -/* 180 */ else if (template.contains("mapper.java.vm")) { -/* */ -/* 182 */ fileName = StringUtils.format("{}/{}/mapper/{}Mapper.java", new Object[] { javaPath, businessName, className }); -/* */ } -/* 184 */ else if (template.contains("service.java.vm")) { -/* */ -/* 186 */ fileName = StringUtils.format("{}/{}/service/I{}Service.java", new Object[] { javaPath, businessName, className }); -/* */ } -/* 188 */ else if (template.contains("serviceImpl.java.vm")) { -/* */ -/* 190 */ fileName = StringUtils.format("{}/{}/service/impl/{}ServiceImpl.java", new Object[] { javaPath, businessName, className }); -/* */ } -/* 192 */ else if (template.contains("controller.java.vm")) { -/* */ -/* 194 */ fileName = StringUtils.format("{}/{}/controller/{}Controller.java", new Object[] { javaPath, businessName, className }); -/* */ } -/* 196 */ else if (template.contains("mapper.xml.vm")) { -/* */ -/* 198 */ fileName = StringUtils.format("{}/{}Mapper.xml", new Object[] { mybatisPath, className }); -/* */ } -/* 200 */ else if (template.contains("list.html.vm")) { -/* */ -/* 202 */ fileName = StringUtils.format("{}/{}.html", new Object[] { htmlPath, businessName }); -/* */ } -/* 204 */ else if (template.contains("list-tree.html.vm")) { -/* */ -/* 206 */ fileName = StringUtils.format("{}/{}.html", new Object[] { htmlPath, businessName }); -/* */ } -/* 208 */ else if (template.contains("tree.html.vm")) { -/* */ -/* 210 */ fileName = StringUtils.format("{}/tree.html", new Object[] { htmlPath }); -/* */ } -/* 212 */ else if (template.contains("add.html.vm")) { -/* */ -/* 214 */ fileName = StringUtils.format("{}/add.html", new Object[] { htmlPath }); -/* */ } -/* 216 */ else if (template.contains("edit.html.vm")) { -/* */ -/* 218 */ fileName = StringUtils.format("{}/edit.html", new Object[] { htmlPath }); -/* */ } -/* 220 */ else if (template.contains("sql.vm")) { -/* */ -/* 222 */ fileName = businessName + "Menu.sql"; -/* */ } -/* 224 */ return fileName; -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public static String getPackagePrefix(String packageName) { -/* 235 */ int lastIndex = packageName.lastIndexOf("."); -/* 236 */ String basePackage = StringUtils.substring(packageName, 0, lastIndex); -/* 237 */ return basePackage; -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public static HashSet getImportList(GenTable genTable) { -/* 248 */ List columns = genTable.getColumns(); -/* 249 */ GenTable subGenTable = genTable.getSubTable(); -/* 250 */ HashSet importList = new HashSet<>(); -/* 251 */ if (StringUtils.isNotNull(subGenTable)) -/* */ { -/* 253 */ importList.add("java.util.List"); -/* */ } -/* 255 */ for (GenTableColumn column : columns) { -/* */ -/* 257 */ if (!column.isSuperColumn() && "Date".equals(column.getJavaType())) { -/* */ -/* 259 */ importList.add("java.util.Date"); -/* 260 */ importList.add("com.fasterxml.jackson.annotation.JsonFormat"); continue; -/* */ } -/* 262 */ if (!column.isSuperColumn() && "BigDecimal".equals(column.getJavaType())) -/* */ { -/* 264 */ importList.add("java.math.BigDecimal"); -/* */ } -/* */ } -/* 267 */ return importList; -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public static String getPermissionPrefix(String moduleName, String businessName) { -/* 279 */ return StringUtils.format("{}:{}", new Object[] { moduleName, businessName }); -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public static String getParentMenuId(JSONObject paramsObj) { -/* 290 */ if (StringUtils.isNotEmpty((Map)paramsObj) && paramsObj.containsKey("parentMenuId")) -/* */ { -/* 292 */ return paramsObj.getString("parentMenuId"); -/* */ } -/* 294 */ return "3"; -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public static String getTreecode(JSONObject paramsObj) { -/* 305 */ if (paramsObj.containsKey("treeCode")) -/* */ { -/* 307 */ return StringUtils.toCamelCase(paramsObj.getString("treeCode")); -/* */ } -/* 309 */ return ""; -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public static String getTreeParentCode(JSONObject paramsObj) { -/* 320 */ if (paramsObj.containsKey("treeParentCode")) -/* */ { -/* 322 */ return StringUtils.toCamelCase(paramsObj.getString("treeParentCode")); -/* */ } -/* 324 */ return ""; -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public static String getTreeName(JSONObject paramsObj) { -/* 335 */ if (paramsObj.containsKey("treeName")) -/* */ { -/* 337 */ return StringUtils.toCamelCase(paramsObj.getString("treeName")); -/* */ } -/* 339 */ return ""; -/* */ } -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ public static int getExpandColumn(GenTable genTable) { -/* 350 */ String options = genTable.getOptions(); -/* 351 */ JSONObject paramsObj = JSONObject.parseObject(options); -/* 352 */ String treeName = paramsObj.getString("treeName"); -/* 353 */ int num = 0; -/* 354 */ for (GenTableColumn column : genTable.getColumns()) { -/* */ -/* 356 */ if (column.isList()) { -/* */ -/* 358 */ num++; -/* 359 */ String columnName = column.getColumnName(); -/* 360 */ if (columnName.equals(treeName)) { -/* */ break; -/* */ } -/* */ } -/* */ } -/* */ -/* 366 */ return num; -/* */ } -/* */ } + + import com.alibaba.fastjson.JSONObject; + import com.archive.common.utils.DateUtils; + import com.archive.common.utils.StringUtils; + import com.archive.project.tool.gen.domain.GenTable; + import com.archive.project.tool.gen.domain.GenTableColumn; + import java.util.ArrayList; + import java.util.HashSet; + import java.util.List; + import java.util.Map; + import org.apache.velocity.VelocityContext; + + + + + + + + + + + + + + + public class VelocityUtils + { + private static final String PROJECT_PATH = "main/java"; + private static final String MYBATIS_PATH = "main/resources/mybatis"; + private static final String TEMPLATES_PATH = "main/resources/templates"; + private static final String DEFAULT_PARENT_MENU_ID = "3"; + + public static VelocityContext prepareContext(GenTable genTable) { + String moduleName = genTable.getModuleName(); + String businessName = genTable.getBusinessName(); + String packageName = genTable.getPackageName(); + String tplCategory = genTable.getTplCategory(); + String functionName = genTable.getFunctionName(); + + VelocityContext velocityContext = new VelocityContext(); + velocityContext.put("tplCategory", genTable.getTplCategory()); + velocityContext.put("tableName", genTable.getTableName()); + velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "【请填写功能名称】"); + velocityContext.put("ClassName", genTable.getClassName()); + velocityContext.put("className", StringUtils.uncapitalize(genTable.getClassName())); + velocityContext.put("moduleName", genTable.getModuleName()); + velocityContext.put("businessName", genTable.getBusinessName()); + velocityContext.put("basePackage", getPackagePrefix(packageName)); + velocityContext.put("packageName", packageName); + velocityContext.put("author", genTable.getFunctionAuthor()); + velocityContext.put("datetime", DateUtils.getDate()); + velocityContext.put("pkColumn", genTable.getPkColumn()); + velocityContext.put("importList", getImportList(genTable)); + velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName)); + velocityContext.put("columns", genTable.getColumns()); + velocityContext.put("table", genTable); + setMenuVelocityContext(velocityContext, genTable); + if ("tree".equals(tplCategory)) + { + setTreeVelocityContext(velocityContext, genTable); + } + if ("sub".equals(tplCategory)) + { + setSubVelocityContext(velocityContext, genTable); + } + return velocityContext; + } + + + public static void setMenuVelocityContext(VelocityContext context, GenTable genTable) { + String options = genTable.getOptions(); + JSONObject paramsObj = JSONObject.parseObject(options); + String parentMenuId = getParentMenuId(paramsObj); + context.put("parentMenuId", parentMenuId); + } + + + public static void setTreeVelocityContext(VelocityContext context, GenTable genTable) { + String options = genTable.getOptions(); + JSONObject paramsObj = JSONObject.parseObject(options); + String treeCode = getTreecode(paramsObj); + String treeParentCode = getTreeParentCode(paramsObj); + String treeName = getTreeName(paramsObj); + + context.put("treeCode", treeCode); + context.put("treeParentCode", treeParentCode); + context.put("treeName", treeName); + context.put("expandColumn", Integer.valueOf(getExpandColumn(genTable))); + if (paramsObj.containsKey("treeParentCode")) + { + context.put("tree_parent_code", paramsObj.getString("treeParentCode")); + } + if (paramsObj.containsKey("treeName")) + { + context.put("tree_name", paramsObj.getString("treeName")); + } + } + + + public static void setSubVelocityContext(VelocityContext context, GenTable genTable) { + GenTable subTable = genTable.getSubTable(); + String subTableName = genTable.getSubTableName(); + String subTableFkName = genTable.getSubTableFkName(); + String subClassName = genTable.getSubTable().getClassName(); + String subTableFkClassName = StringUtils.convertToCamelCase(subTableFkName); + + context.put("subTable", subTable); + context.put("subTableName", subTableName); + context.put("subTableFkName", subTableFkName); + context.put("subTableFkClassName", subTableFkClassName); + context.put("subTableFkclassName", StringUtils.uncapitalize(subTableFkClassName)); + context.put("subClassName", subClassName); + context.put("subclassName", StringUtils.uncapitalize(subClassName)); + context.put("subImportList", getImportList(genTable.getSubTable())); + } + + + + + + + + public static List getTemplateList(String tplCategory) { + List templates = new ArrayList<>(); + templates.add("vm/java/domain.java.vm"); + templates.add("vm/java/mapper.java.vm"); + templates.add("vm/java/service.java.vm"); + templates.add("vm/java/serviceImpl.java.vm"); + templates.add("vm/java/controller.java.vm"); + templates.add("vm/xml/mapper.xml.vm"); + if ("crud".equals(tplCategory)) { + + templates.add("vm/html/list.html.vm"); + } + else if ("tree".equals(tplCategory)) { + + templates.add("vm/html/tree.html.vm"); + templates.add("vm/html/list-tree.html.vm"); + } + else if ("sub".equals(tplCategory)) { + + templates.add("vm/html/list.html.vm"); + templates.add("vm/java/sub-domain.java.vm"); + } + templates.add("vm/html/add.html.vm"); + templates.add("vm/html/edit.html.vm"); + templates.add("vm/sql/sql.vm"); + return templates; + } + + + + + + + public static String getFileName(String template, GenTable genTable) { + String fileName = ""; + + String packageName = genTable.getPackageName(); + + String moduleName = genTable.getModuleName(); + + String className = genTable.getClassName(); + + String businessName = genTable.getBusinessName(); + + String javaPath = "main/java/" + StringUtils.replace(packageName, ".", "/"); + String mybatisPath = "main/resources/mybatis/" + moduleName; + String htmlPath = "main/resources/templates/" + moduleName + "/" + businessName; + + if (template.contains("domain.java.vm")) + { + fileName = StringUtils.format("{}/{}/domain/{}.java", new Object[] { javaPath, businessName, className }); + } + if (template.contains("sub-domain.java.vm") && StringUtils.equals("sub", genTable.getTplCategory())) { + + fileName = StringUtils.format("{}/{}/domain/{}.java", new Object[] { javaPath, businessName, genTable.getSubTable().getClassName() }); + } + else if (template.contains("mapper.java.vm")) { + + fileName = StringUtils.format("{}/{}/mapper/{}Mapper.java", new Object[] { javaPath, businessName, className }); + } + else if (template.contains("service.java.vm")) { + + fileName = StringUtils.format("{}/{}/service/I{}Service.java", new Object[] { javaPath, businessName, className }); + } + else if (template.contains("serviceImpl.java.vm")) { + + fileName = StringUtils.format("{}/{}/service/impl/{}ServiceImpl.java", new Object[] { javaPath, businessName, className }); + } + else if (template.contains("controller.java.vm")) { + + fileName = StringUtils.format("{}/{}/controller/{}Controller.java", new Object[] { javaPath, businessName, className }); + } + else if (template.contains("mapper.xml.vm")) { + + fileName = StringUtils.format("{}/{}Mapper.xml", new Object[] { mybatisPath, className }); + } + else if (template.contains("list.html.vm")) { + + fileName = StringUtils.format("{}/{}.html", new Object[] { htmlPath, businessName }); + } + else if (template.contains("list-tree.html.vm")) { + + fileName = StringUtils.format("{}/{}.html", new Object[] { htmlPath, businessName }); + } + else if (template.contains("tree.html.vm")) { + + fileName = StringUtils.format("{}/tree.html", new Object[] { htmlPath }); + } + else if (template.contains("add.html.vm")) { + + fileName = StringUtils.format("{}/add.html", new Object[] { htmlPath }); + } + else if (template.contains("edit.html.vm")) { + + fileName = StringUtils.format("{}/edit.html", new Object[] { htmlPath }); + } + else if (template.contains("sql.vm")) { + + fileName = businessName + "Menu.sql"; + } + return fileName; + } + + + + + + + + + public static String getPackagePrefix(String packageName) { + int lastIndex = packageName.lastIndexOf("."); + String basePackage = StringUtils.substring(packageName, 0, lastIndex); + return basePackage; + } + + + + + + + + + public static HashSet getImportList(GenTable genTable) { + List columns = genTable.getColumns(); + GenTable subGenTable = genTable.getSubTable(); + HashSet importList = new HashSet<>(); + if (StringUtils.isNotNull(subGenTable)) + { + importList.add("java.util.List"); + } + for (GenTableColumn column : columns) { + + if (!column.isSuperColumn() && "Date".equals(column.getJavaType())) { + + importList.add("java.util.Date"); + importList.add("com.fasterxml.jackson.annotation.JsonFormat"); continue; + } + if (!column.isSuperColumn() && "BigDecimal".equals(column.getJavaType())) + { + importList.add("java.math.BigDecimal"); + } + } + return importList; + } + + + + + + + + + + public static String getPermissionPrefix(String moduleName, String businessName) { + return StringUtils.format("{}:{}", new Object[] { moduleName, businessName }); + } + + + + + + + + + public static String getParentMenuId(JSONObject paramsObj) { + if (StringUtils.isNotEmpty((Map)paramsObj) && paramsObj.containsKey("parentMenuId")) + { + return paramsObj.getString("parentMenuId"); + } + return "3"; + } + + + + + + + + + public static String getTreecode(JSONObject paramsObj) { + if (paramsObj.containsKey("treeCode")) + { + return StringUtils.toCamelCase(paramsObj.getString("treeCode")); + } + return ""; + } + + + + + + + + + public static String getTreeParentCode(JSONObject paramsObj) { + if (paramsObj.containsKey("treeParentCode")) + { + return StringUtils.toCamelCase(paramsObj.getString("treeParentCode")); + } + return ""; + } + + + + + + + + + public static String getTreeName(JSONObject paramsObj) { + if (paramsObj.containsKey("treeName")) + { + return StringUtils.toCamelCase(paramsObj.getString("treeName")); + } + return ""; + } + + + + + + + + + public static int getExpandColumn(GenTable genTable) { + String options = genTable.getOptions(); + JSONObject paramsObj = JSONObject.parseObject(options); + String treeName = paramsObj.getString("treeName"); + int num = 0; + for (GenTableColumn column : genTable.getColumns()) { + + if (column.isList()) { + + num++; + String columnName = column.getColumnName(); + if (columnName.equals(treeName)) { + break; + } + } + } + + return num; + } + } /* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\project\tool\ge\\util\VelocityUtils.class diff --git a/src/main/java/com/archive/project/tool/swagger/UserEntity.java b/src/main/java/com/archive/project/tool/swagger/UserEntity.java index 01f85fd..0fd9db2 100644 --- a/src/main/java/com/archive/project/tool/swagger/UserEntity.java +++ b/src/main/java/com/archive/project/tool/swagger/UserEntity.java @@ -1,180 +1,180 @@ -/* */ package com.archive.project.tool.swagger + package com.archive.project.tool.swagger ; -/* */ -/* */ import io.swagger.annotations.ApiModel; -/* */ import io.swagger.annotations.ApiModelProperty; -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ @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) { -/* 130 */ this.userId = userId; -/* 131 */ this.username = username; -/* 132 */ this.password = password; -/* 133 */ this.mobile = mobile; -/* */ } -/* */ -/* */ -/* */ public Integer getUserId() { -/* 138 */ return this.userId; -/* */ } -/* */ -/* */ -/* */ public void setUserId(Integer userId) { -/* 143 */ this.userId = userId; -/* */ } -/* */ -/* */ -/* */ public String getUsername() { -/* 148 */ return this.username; -/* */ } -/* */ -/* */ -/* */ public void setUsername(String username) { -/* 153 */ this.username = username; -/* */ } -/* */ -/* */ -/* */ public String getPassword() { -/* 158 */ return this.password; -/* */ } -/* */ -/* */ -/* */ public void setPassword(String password) { -/* 163 */ this.password = password; -/* */ } -/* */ -/* */ -/* */ public String getMobile() { -/* 168 */ return this.mobile; -/* */ } -/* */ -/* */ -/* */ public void setMobile(String mobile) { -/* 173 */ this.mobile = mobile; -/* */ } -/* */ } + + import io.swagger.annotations.ApiModel; + import io.swagger.annotations.ApiModelProperty; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @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 this.userId; + } + + + public void setUserId(Integer userId) { + this.userId = userId; + } + + + public String getUsername() { + return this.username; + } + + + public void setUsername(String username) { + this.username = username; + } + + + public String getPassword() { + return this.password; + } + + + public void setPassword(String password) { + this.password = password; + } + + + public String getMobile() { + return this.mobile; + } + + + public void setMobile(String mobile) { + this.mobile = mobile; + } + } /* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\project\tool\swagger\UserEntity.class diff --git a/src/main/resources/static/plugins/pdfjs/web/viewer.js b/src/main/resources/static/plugins/pdfjs/web/viewer.js index be2313a..3ab0071 100644 --- a/src/main/resources/static/plugins/pdfjs/web/viewer.js +++ b/src/main/resources/static/plugins/pdfjs/web/viewer.js @@ -107,7 +107,7 @@ /******/ }) /************************************************************************/ /******/ ([ -/* 0 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -277,7 +277,7 @@ if (document.readyState === "interactive" || document.readyState === "complete") } /***/ }), -/* 1 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -2773,7 +2773,7 @@ const PDFPrintServiceFactory = { exports.PDFPrintServiceFactory = PDFPrintServiceFactory; /***/ }), -/* 2 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3508,7 +3508,7 @@ function moveToEndOfArray(arr, condition) { } /***/ }), -/* 3 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3765,7 +3765,7 @@ class AppOptions { exports.AppOptions = AppOptions; /***/ }), -/* 4 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3801,7 +3801,7 @@ const viewerCompatibilityParams = Object.freeze(compatibilityParams); exports.viewerCompatibilityParams = viewerCompatibilityParams; /***/ }), -/* 5 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3818,7 +3818,7 @@ if (typeof window !== "undefined" && window["pdfjs/build/pdf"]) { module.exports = pdfjsLib; /***/ }), -/* 6 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3942,7 +3942,7 @@ class PDFCursorTools { exports.PDFCursorTools = PDFCursorTools; /***/ }), -/* 7 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4107,7 +4107,7 @@ function isLeftMouseReleased(event) { } /***/ }), -/* 8 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4243,7 +4243,7 @@ class PDFRenderingQueue { exports.PDFRenderingQueue = PDFRenderingQueue; /***/ }), -/* 9 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4625,7 +4625,7 @@ class PDFSidebar { exports.PDFSidebar = PDFSidebar; /***/ }), -/* 10 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4736,7 +4736,7 @@ class OverlayManager { exports.OverlayManager = OverlayManager; /***/ }), -/* 11 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4815,7 +4815,7 @@ class PasswordPrompt { exports.PasswordPrompt = PasswordPrompt; /***/ }), -/* 12 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4971,7 +4971,7 @@ class PDFAttachmentViewer { exports.PDFAttachmentViewer = PDFAttachmentViewer; /***/ }), -/* 13 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5266,7 +5266,7 @@ class PDFDocumentProperties { exports.PDFDocumentProperties = PDFDocumentProperties; /***/ }), -/* 14 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5477,7 +5477,7 @@ class PDFFindBar { exports.PDFFindBar = PDFFindBar; /***/ }), -/* 15 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6158,7 +6158,7 @@ class PDFFindController { exports.PDFFindController = PDFFindController; /***/ }), -/* 16 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6254,7 +6254,7 @@ function getCharacterType(charCode) { } /***/ }), -/* 17 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6842,7 +6842,7 @@ function isDestArraysEqual(firstDest, secondDest) { } /***/ }), -/* 18 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -7281,7 +7281,7 @@ class SimpleLinkService { exports.SimpleLinkService = SimpleLinkService; /***/ }), -/* 19 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -7481,7 +7481,7 @@ class PDFOutlineViewer { exports.PDFOutlineViewer = PDFOutlineViewer; /***/ }), -/* 20 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -7890,7 +7890,7 @@ class PDFPresentationMode { exports.PDFPresentationMode = PDFPresentationMode; /***/ }), -/* 21 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -8039,7 +8039,7 @@ class PDFSidebarResizer { exports.PDFSidebarResizer = PDFSidebarResizer; /***/ }), -/* 22 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -8296,7 +8296,7 @@ class PDFThumbnailViewer { exports.PDFThumbnailViewer = PDFThumbnailViewer; /***/ }), -/* 23 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -8706,7 +8706,7 @@ class PDFThumbnailView { exports.PDFThumbnailView = PDFThumbnailView; /***/ }), -/* 24 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -8793,7 +8793,7 @@ class PDFViewer extends _base_viewer.BaseViewer { exports.PDFViewer = PDFViewer; /***/ }), -/* 25 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -9913,7 +9913,7 @@ class BaseViewer { exports.BaseViewer = BaseViewer; /***/ }), -/* 26 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -10024,7 +10024,7 @@ class DefaultAnnotationLayerFactory { exports.DefaultAnnotationLayerFactory = DefaultAnnotationLayerFactory; /***/ }), -/* 27 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -10622,7 +10622,7 @@ class PDFPageView { exports.PDFPageView = PDFPageView; /***/ }), -/* 28 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -11006,7 +11006,7 @@ class DefaultTextLayerFactory { exports.DefaultTextLayerFactory = DefaultTextLayerFactory; /***/ }), -/* 29 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -11324,7 +11324,7 @@ class SecondaryToolbar { exports.SecondaryToolbar = SecondaryToolbar; /***/ }), -/* 30 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -11446,7 +11446,7 @@ class PDFSinglePageViewer extends _base_viewer.BaseViewer { exports.PDFSinglePageViewer = PDFSinglePageViewer; /***/ }), -/* 31 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -11716,7 +11716,7 @@ class Toolbar { exports.Toolbar = Toolbar; /***/ }), -/* 32 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -11812,7 +11812,7 @@ class ViewHistory { exports.ViewHistory = ViewHistory; /***/ }), -/* 33 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -11866,7 +11866,7 @@ class GenericExternalServices extends _app.DefaultExternalServices { _app.PDFViewerApplication.externalServices = GenericExternalServices; /***/ }), -/* 34 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12016,7 +12016,7 @@ class BasePreferences { exports.BasePreferences = BasePreferences; /***/ }), -/* 35 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12103,7 +12103,7 @@ class DownloadManager { exports.DownloadManager = DownloadManager; /***/ }), -/* 36 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12153,7 +12153,7 @@ class GenericL10n { exports.GenericL10n = GenericL10n; /***/ }), -/* 37 */ + /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12976,7 +12976,7 @@ document.webL10n = function (window, document, undefined) { }(window, document); /***/ }), -/* 38 */ + /***/ (function(module, exports, __webpack_require__) { "use strict";