From d996830162f75680be35cddea3c117543f955e3f Mon Sep 17 00:00:00 2001 From: huangxin Date: Wed, 22 Apr 2020 09:33:21 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E8=A7=A3=E5=86=B3=E9=83=A8?= =?UTF-8?q?=E5=88=86=20CheckStyle=20=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/dispose/common/ConstValue.java | 21 +++++++++++-------- .../impl/UserAccountCacheManagerImpl.java | 4 +++- .../pojo/vo/common/DisposeCapacity.java | 2 ++ 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/dispose/common/ConstValue.java b/src/main/java/com/dispose/common/ConstValue.java index 6b385c3b..de53093d 100644 --- a/src/main/java/com/dispose/common/ConstValue.java +++ b/src/main/java/com/dispose/common/ConstValue.java @@ -80,14 +80,17 @@ public class ConstValue { */ public enum DisposeDeviceType { /** - * Dptech umc dispose device type. + * The Dptech umc. */ DPTECH_UMC(0, "迪普UMC管理平台"), /** - * Haohan platform dispose device type. + * The Haohan platform. */ HAOHAN_PLATFORM(1, "浩瀚处置设备"), + /** + * Virtual dispose dispose device type. + */ VIRTUAL_DISPOSE(999, "虚拟处置设备"); private final int code; @@ -120,7 +123,7 @@ public class ConstValue { /** * The type User account status. */ - public class UserAccountStatus { + public static class UserAccountStatus { /** * The constant NORMAL. */ @@ -136,19 +139,19 @@ public class ConstValue { */ public enum DeviceCapacity { /** - * Cleanup device capacity. + * The Cleanup. */ CLEANUP(0, "清洗能力"), /** - * Hidepend device capacity. + * The Hidepend. */ HIDEPEND(1, "高防能力"), /** - * Blackhool device capacity. + * The Blackhool. */ BLACKHOOL(2, "黑洞能力"), /** - * Detecive device capacity. + * The Detecive. */ DETECIVE(3, "检测能力"); @@ -184,11 +187,11 @@ public class ConstValue { */ public enum IPAddrType { /** - * Ipv 4 type ip addr type. + * The Ipv 4 type. */ IPV4_TYPE, /** - * Ipv 6 type ip addr type. + * The Ipv 6 type. */ IPV6_TYPE; diff --git a/src/main/java/com/dispose/manager/impl/UserAccountCacheManagerImpl.java b/src/main/java/com/dispose/manager/impl/UserAccountCacheManagerImpl.java index c6f59dd6..c2df07d2 100644 --- a/src/main/java/com/dispose/manager/impl/UserAccountCacheManagerImpl.java +++ b/src/main/java/com/dispose/manager/impl/UserAccountCacheManagerImpl.java @@ -30,6 +30,8 @@ public class UserAccountCacheManagerImpl implements UserAccountCacheManager { @Resource private ObjectMapper objectMapper; + private static final Random randomGen = new Random(System.currentTimeMillis()); + private final ConcurrentHashMap userAccountCache = new ConcurrentHashMap<>(); /** @@ -253,7 +255,7 @@ public class UserAccountCacheManagerImpl implements UserAccountCacheManager { MessageDigest messageDigest = MessageDigest.getInstance("SHA-256"); // 此处的sha代表sha1 String tokenKey = username + - Convert.toStr(new Random(System.currentTimeMillis()).nextInt()) + + Convert.toStr(randomGen.nextInt()) + Convert.toStr(System.currentTimeMillis()); // 调用digest方法,进行加密操作 byte[] cipherBytes = messageDigest.digest(tokenKey.getBytes()); diff --git a/src/main/java/com/dispose/pojo/vo/common/DisposeCapacity.java b/src/main/java/com/dispose/pojo/vo/common/DisposeCapacity.java index af2281fd..910a88c2 100644 --- a/src/main/java/com/dispose/pojo/vo/common/DisposeCapacity.java +++ b/src/main/java/com/dispose/pojo/vo/common/DisposeCapacity.java @@ -4,12 +4,14 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonView; import lombok.AllArgsConstructor; import lombok.Builder; +import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; /** * The type Dispose capacity. */ +@Getter @Setter @Builder @NoArgsConstructor