|
@@ -1,21 +1,30 @@
|
|
|
/**
|
|
|
* Copyright (c) 2016-2019 人人开源 All rights reserved.
|
|
|
- *
|
|
|
+ * <p>
|
|
|
* https://www.renren.io
|
|
|
- *
|
|
|
+ * <p>
|
|
|
* 版权所有,侵权必究!
|
|
|
*/
|
|
|
|
|
|
package io.renren.common.utils;
|
|
|
|
|
|
+import io.renren.common.validator.group.AliyunGroup;
|
|
|
+import io.renren.common.validator.group.QcloudGroup;
|
|
|
+import io.renren.common.validator.group.QiniuGroup;
|
|
|
+
|
|
|
+import java.util.Optional;
|
|
|
+import java.util.stream.Stream;
|
|
|
+
|
|
|
/**
|
|
|
* 常量
|
|
|
*
|
|
|
* @author Mark sunlightcs@gmail.com
|
|
|
*/
|
|
|
public class Constant {
|
|
|
- /** 超级管理员ID */
|
|
|
- public static final int SUPER_ADMIN = 1;
|
|
|
+ /**
|
|
|
+ * 超级管理员ID
|
|
|
+ */
|
|
|
+ public static final int SUPER_ADMIN = 1;
|
|
|
/**
|
|
|
* 当前页码
|
|
|
*/
|
|
@@ -33,21 +42,22 @@ public class Constant {
|
|
|
*/
|
|
|
public static final String ORDER = "order";
|
|
|
/**
|
|
|
- * 升序
|
|
|
+ * 升序
|
|
|
*/
|
|
|
public static final String ASC = "asc";
|
|
|
- /**
|
|
|
- * 菜单类型
|
|
|
- *
|
|
|
- * @author chenshun
|
|
|
- * @email sunlightcs@gmail.com
|
|
|
- * @date 2016年11月15日 下午1:24:29
|
|
|
- */
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 菜单类型
|
|
|
+ *
|
|
|
+ * @author chenshun
|
|
|
+ * @email sunlightcs@gmail.com
|
|
|
+ * @date 2016年11月15日 下午1:24:29
|
|
|
+ */
|
|
|
public enum MenuType {
|
|
|
/**
|
|
|
* 目录
|
|
|
*/
|
|
|
- CATALOG(0),
|
|
|
+ CATALOG(0),
|
|
|
/**
|
|
|
* 菜单
|
|
|
*/
|
|
@@ -67,10 +77,10 @@ public class Constant {
|
|
|
return value;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 定时任务状态
|
|
|
- *
|
|
|
+ *
|
|
|
* @author chenshun
|
|
|
* @email sunlightcs@gmail.com
|
|
|
* @date 2016年12月3日 上午12:07:22
|
|
@@ -79,18 +89,18 @@ public class Constant {
|
|
|
/**
|
|
|
* 正常
|
|
|
*/
|
|
|
- NORMAL(0),
|
|
|
+ NORMAL(0),
|
|
|
/**
|
|
|
* 暂停
|
|
|
*/
|
|
|
- PAUSE(1);
|
|
|
+ PAUSE(1);
|
|
|
|
|
|
private int value;
|
|
|
|
|
|
ScheduleStatus(int value) {
|
|
|
this.value = value;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public int getValue() {
|
|
|
return value;
|
|
|
}
|
|
@@ -103,25 +113,40 @@ public class Constant {
|
|
|
/**
|
|
|
* 七牛云
|
|
|
*/
|
|
|
- QINIU(1),
|
|
|
+ QINIU(1, QiniuGroup.class),
|
|
|
/**
|
|
|
* 阿里云
|
|
|
*/
|
|
|
- ALIYUN(2),
|
|
|
+ ALIYUN(2, AliyunGroup.class),
|
|
|
/**
|
|
|
* 腾讯云
|
|
|
*/
|
|
|
- QCLOUD(3);
|
|
|
+ QCLOUD(3, QcloudGroup.class);
|
|
|
|
|
|
private int value;
|
|
|
|
|
|
- CloudService(int value) {
|
|
|
+ private Class<?> validatorGroupClass;
|
|
|
+
|
|
|
+ CloudService(int value, Class<?> validatorGroupClass) {
|
|
|
this.value = value;
|
|
|
+ this.validatorGroupClass = validatorGroupClass;
|
|
|
}
|
|
|
|
|
|
public int getValue() {
|
|
|
return value;
|
|
|
}
|
|
|
+
|
|
|
+ public Class<?> getValidatorGroupClass() {
|
|
|
+ return this.validatorGroupClass;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static CloudService getByValue(Integer value) {
|
|
|
+ Optional<CloudService> first = Stream.of(CloudService.values()).filter(cs -> value.equals(cs.value)).findFirst();
|
|
|
+ if (!first.isPresent()) {
|
|
|
+ throw new IllegalArgumentException("非法的枚举值:" + value);
|
|
|
+ }
|
|
|
+ return first.get();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|