提交 361083c7 authored 作者: renjianyu's avatar renjianyu

--no commit message

上级 631aaec0
package com.zrqx.core.enums;
import com.zrqx.core.constant.book.ValidateMessage;
import com.zrqx.core.exception.BusinessValidateException;
public enum BooleanStatusEnum {
/** 是 */
YES("1","是"),
/** 否 */
NO("0","否");
private final String code;
private final String name;
private BooleanStatusEnum(String code, String name) {
this.code = code;
this.name = name;
}
/**
* 判断名称是否有效
* @param name
* @return
* @author lpf
* @date: 2018年6月11日 下午6:30:16
*/
public static boolean isExist(String code) {
BooleanStatusEnum[] enums = BooleanStatusEnum.values();
for (BooleanStatusEnum BooleanStatusEnum : enums) {
if (BooleanStatusEnum.code.equals(code)) {
return true;
}
}
throw new BusinessValidateException(ValidateMessage.STATUS_EXCEPTION);
}
/**
* 根据code 获取名字
* @Title getName
* @param code
* @return String
* @author Conan
* @date 2018年6月19日 上午11:28:16
*/
public static String getName(String code) {
BooleanStatusEnum[] enums = BooleanStatusEnum.values();
for (BooleanStatusEnum BooleanStatusEnum : enums) {
if (BooleanStatusEnum.code.equals(code)) {
return BooleanStatusEnum.name;
}
}
return null;
}
/**
* 根据名字 获取code
* @Title getCode
* @param name
* @return String
* @author Conan
* @date 2018年7月9日 下午2:52:30
*/
public static String getCode(String name) {
BooleanStatusEnum[] enums = BooleanStatusEnum.values();
for (BooleanStatusEnum BooleanStatusEnum : enums) {
if (BooleanStatusEnum.name.equals(name)) {
return BooleanStatusEnum.code;
}
}
throw new BusinessValidateException(ValidateMessage.STATUS_EXCEPTION);
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
}
package com.zrqx.core.enums;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
/**
* 商品分类枚举
* @author lpf
* @date 2018年7月11日上午10:48:39
*/
public enum GoodsTypeEnum {
/** 纸质书 */
PBOOK("0", "纸质书"),
/** 电子书 */
EBOOK("1", "电子书"),
/** 套餐 */
PACKAGE("2","套餐"),
/** 课程 */
COURSE("3","课程"),
/** 试题 */
QUESTION("4","试题");
private final String code;
private final String name;
private GoodsTypeEnum(String code,String name){
this.code=code;
this.name=name;
}
/**
* 获取需要收取邮费的商品类型
* @return
* @author ydm
* @date: 2018年8月24日 下午2:33:23
*/
public static List<Integer> getNeedCarriage(){
List<Integer> list = new ArrayList<>();
list.add(Integer.valueOf(PBOOK.code));
list.add(Integer.valueOf(PACKAGE.code));
return list;
}
/**
* 获取需要拆分商品的商品类型
* @return
* @author ydm
* @date: 2018年10月22日 下午2:24:19
*/
public static List<Integer> getNeedUnZipCarriage(){
List<Integer> list = new ArrayList<>();
list.add(Integer.valueOf(PACKAGE.code));
return list;
}
public static GoodsTypeEnum valueOfCode(String code) {
if (StringUtils.isBlank(code)) {
throw new IllegalArgumentException("GoodsType Status " + code + " is blank");
}
for (GoodsTypeEnum mt : values()) {
if (mt.getCode().equals(code)) {
return mt;
}
}
throw new IllegalArgumentException("GoodsType Status " + code + " is not exist");
}
/**
* 通过ID获取中文名称
* @param code
* @return
*/
public static String getName(String code) {
if (StringUtils.isBlank(code)) {
return null;
}
for (GoodsTypeEnum mt : values()) {
if (mt.getCode().equals(code)) {
return mt.getName();
}
}
return null;
}
/**
* 获取所有的枚举,以MAP返回
* @return
*/
public static HashMap<String,String> getAllEnumMap() {
HashMap<String,String> map = new HashMap<String,String>();
for (GoodsTypeEnum mt : values()) {
map.put(mt.getCode(), mt.getName());
}
return map;
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
}
package com.zrqx.core.enums;
import com.zrqx.core.util.qiyu.ListTypeImpl;
import com.zrqx.core.util.qiyu.ObjectTypeImpl;
import com.zrqx.core.util.qiyu.ProperyTypeInterface;
import com.zrqx.core.util.qiyu.SimpleTypeImpl;
public enum ProperyTypeEnum {
/** 基本类型 */
SIMPLE(SimpleTypeImpl.getInstance()),
/** list 泛型为非基本类型 */
LIST(ListTypeImpl.getInstance()),
/** 对象类型 */
OBJECT(ObjectTypeImpl.getInstance());
private ProperyTypeInterface interfaces;
private ProperyTypeEnum(ProperyTypeInterface interfaces){
this.interfaces = interfaces;
}
public ProperyTypeInterface getInterfaces() {
return interfaces;
}
}
package com.zrqx.core.enums;
/**
*
* ClassName: StatusEnum
* @Description: TODO
* @author lizhuo
* @date 2019年1月29日
*/
public enum ResourceStatusEnum {
ENTRY(0,"录入中"),
TOBEAUDITED(1,"待审核"),
INAUDIT(2,"审核中"),
AUDITPASS(3,"审核通过"),
AUDITFAILED(4,"审核未通过");
//状态码
private final int value;
private final String value_zh;
private ResourceStatusEnum(int value, String value_zh) {
this.value = value;
this.value_zh = value_zh;
}
public int getValue() {
return value;
}
public String getValue_zh() {
return value_zh;
}
}
package com.zrqx.core.enums;
import java.util.HashMap;
import org.apache.commons.lang3.StringUtils;
/**
* 来源<br>
* pc | wap | app
* @author lpf
* @date 2018年7月9日下午4:23:25
*/
public enum SourceEnum {
/** pc */
PC("0","PC"),
/** wap */
WAP("1","WAP"),
/** app */
APP("2","APP");
private final String code;
private final String name;
private SourceEnum(String code,String name){
this.code=code;
this.name=name;
}
public static SourceEnum valueOfCode(String code) {
if (StringUtils.isBlank(code)) {
throw new IllegalArgumentException("Source Status " + code + " is blank");
}
for (SourceEnum mt : values()) {
if (mt.getCode().equals(code)) {
return mt;
}
}
throw new IllegalArgumentException("Source Status " + code + " is not exist");
}
/**
* 通过ID获取中文名称
* @param code
* @return
*/
public static String getName(String code) {
if (StringUtils.isBlank(code)) {
return null;
}
for (SourceEnum mt : values()) {
if (mt.getCode().equals(code)) {
return mt.getName();
}
}
return null;
}
/**
* 获取所有的枚举,以MAP返回
* @return
*/
public static HashMap<String,String> getAllEnumMap() {
HashMap<String,String> map = new HashMap<String,String>();
for (SourceEnum mt : values()) {
map.put(mt.getCode(), mt.getName());
}
return map;
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
}
package com.zrqx.core.enums;
/**
*
* @ClassName StatusEnum
* @Description: 共享状态枚举
* @author lpf
* @date 2018年5月9日上午9:46:35
*
*/
public enum StatusEnum {
/** 启用 */
ENABLE(1,"启用"),
/** 禁用 */
DISABLE(0,"禁用");
//状态码
private final int value;
// test submit
// test submit
// test co 1
// test conflict 1
private final String value_zh;
private StatusEnum(int value, String value_zh) {
this.value = value;
this.value_zh = value_zh;
}
public int getValue() {
return value;
}
public String getValue_zh() {
return value_zh;
}
}
package com.zrqx.core.enums;
import java.util.concurrent.TimeUnit;
public enum TimeUnitEnum {
// 微秒 一百万分之一秒(就是毫秒/1000)
微秒(TimeUnit.MICROSECONDS),
// 毫秒 千分之一秒
毫秒(TimeUnit.MILLISECONDS),
// 毫微秒 十亿分之一秒(就是微秒/1000)
毫微秒(TimeUnit.NANOSECONDS),
// 秒
(TimeUnit.SECONDS),
// 分钟
分钟(TimeUnit.MINUTES),
// 小时
小时(TimeUnit.HOURS),
// 天
(TimeUnit.DAYS);
private final TimeUnit value;
private TimeUnitEnum(TimeUnit value) {
this.value = value;
}
public static void main(String[] args) {
System.out.println(分钟.value);
System.out.println(TimeUnitEnum.getValue("小时"));
}
public static TimeUnit getValue(String name) {
if (name == null) {
throw new IllegalArgumentException("TimeUnitEnum name is not null");
}
for (TimeUnitEnum mt : values()) {
if (mt.name().equals(name)) {
return mt.value;
}
}
return .value;
}
}
package com.zrqx.core.enums.resource;
import java.util.HashMap;
/**
* 资源库数据状态
* @author cxc
* @date 2018年7月13日下午9:26:42
*/
public enum EbookStatusEnum {
/** 录入中 */
_0(0, "录入中"),
/** 待审核*/
_1(1, "待审核"),
/** 审核中 */
_2(2, "审核中"),
/** 审核未通过*/
_3(3, "审核通过"),
/** 审核未通过 */
_4(4, "审核未通过");
private final Integer code;
private final String name;
private EbookStatusEnum(Integer code,String name){
this.code=code;
this.name=name;
}
public static EbookStatusEnum valueOfCode(Integer code) {
if (code == null) {
throw new IllegalArgumentException("Book Status " + code + " is blank");
}
for (EbookStatusEnum mt : values()) {
if (mt.getCode().equals(code)) {
return mt;
}
}
throw new IllegalArgumentException("Book Status " + code + " is not exist");
}
/**
* 通过ID获取中文名称
* @param code
* @return
*/
public static String getName(Integer code) {
if (code == null) {
return null;
}
for (EbookStatusEnum mt : values()) {
if (mt.getCode().equals(code)) {
return mt.getName();
}
}
return null;
}
/**
* 通过ID获取中文名称
* @param code
* @return
*/
public static boolean isExists (Integer code) {
if (code == null) {
return false;
}
for (EbookStatusEnum mt : values()) {
if (mt.getCode().equals(code)) {
return true;
}
}
return false;
}
/**
* 获取所有的枚举,以MAP返回
* @return
*/
public static HashMap<Integer,String> getAllEnumMap() {
HashMap<Integer,String> map = new HashMap<Integer,String>();
for (EbookStatusEnum mt : values()) {
map.put(mt.getCode(), mt.getName());
}
return map;
}
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
}
package com.zrqx.core.enums.resource;
import java.util.HashMap;
import org.apache.commons.lang3.StringUtils;
/**
* 资源库数据状态
* @author cxc
* @date 2018年7月13日下午9:26:42
*/
public enum LibraryStatusEnum {
/** 已录入 */
STATUS_0("0", "已录入"),
/** 已上架*/
STATUS_1("1", "已上架"),
/** 未上架 */
STATUS_2("2", "未上架");
private final String code;
private final String name;
private LibraryStatusEnum(String code,String name){
this.code=code;
this.name=name;
}
public static LibraryStatusEnum valueOfCode(String code) {
if (StringUtils.isBlank(code)) {
throw new IllegalArgumentException("Library Status " + code + " is blank");
}
for (LibraryStatusEnum mt : values()) {
if (mt.getCode().equals(code)) {
return mt;
}
}
throw new IllegalArgumentException("Library Status " + code + " is not exist");
}
/**
* 通过ID获取中文名称
* @param code
* @return
*/
public static String getName(String code) {
if (StringUtils.isBlank(code)) {
return null;
}
for (LibraryStatusEnum mt : values()) {
if (mt.getCode().equals(code)) {
return mt.getName();
}
}
return null;
}
/**
* 获取所有的枚举,以MAP返回
* @return
*/
public static HashMap<String,String> getAllEnumMap() {
HashMap<String,String> map = new HashMap<String,String>();
for (LibraryStatusEnum mt : values()) {
map.put(mt.getCode(), mt.getName());
}
return map;
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
}
package com.zrqx.core.enums.resource.questionlibrary;
import java.util.HashMap;
import org.apache.commons.lang3.StringUtils;
/**
* 学习答题枚举
* @author ydm
*
*/
public enum FunctionTypeEnum {
STUDY(1,"学习"),
EXAM(2,"答题");
private final Integer code;
private final String name;
private FunctionTypeEnum(Integer code,String name){
this.code=code;
this.name=name;
}
public static FunctionTypeEnum valueOfCode(Integer code) {
if (code == null) {
throw new IllegalArgumentException("Question Type " + code + " is blank");
}
for (FunctionTypeEnum mt : values()) {
if (mt.getCode().equals(code)) {
return mt;
}
}
throw new IllegalArgumentException("Question Type " + code + " is not exist");
}
/**
* 通过ID获取中文名称
* @param code
* @return
*/
public static String getName(Integer code) {
if (code == null) {
return null;
}
for (FunctionTypeEnum mt : values()) {
if (mt.getCode().equals(code)) {
return mt.getName();
}
}
return null;
}
/**
* 通过中文名称获取ID
* @param code
* @return
*/
public static Integer getCode(String name) {
if (StringUtils.isBlank(name)) {
return null;
}
for (FunctionTypeEnum mt : values()) {
if (mt.getName().equals(name)) {
return mt.getCode();
}
}
return null;
}
/**
* 通过ID获取中文名称
* @param code
* @return
*/
public static boolean isExists (Integer code) {
if (code == null) {
return false;
}
for (FunctionTypeEnum mt : values()) {
if (mt.getCode().equals(code)) {
return true;
}
}
return false;
}
/**
* 获取所有的枚举,以MAP返回
* @return
*/
public static HashMap<Integer,String> getAllEnumMap() {
HashMap<Integer,String> map = new HashMap<Integer,String>();
for (FunctionTypeEnum mt : values()) {
map.put(mt.getCode(), mt.getName());
}
return map;
}
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
}
package com.zrqx.core.enums.resource.questionlibrary;
import java.util.HashMap;
import org.apache.commons.lang3.StringUtils;
/**
* 用户年龄段
* @author ydm
* @date 2019年3月17日下午9:26:42
*/
public enum MemberAgeAreaEnum {
AGE_1(1,"25岁以下"),
AGE_2(2,"26-35"),
AGE_3(3,"36-45"),
AGE_4(4,"46-60");
private final Integer code;
private final String name;
private MemberAgeAreaEnum(Integer code,String name){
this.code=code;
this.name=name;
}
public static MemberAgeAreaEnum valueOfCode(Integer code) {
if (code == null) {
throw new IllegalArgumentException("MemberAgeArea " + code + " is blank");
}
for (MemberAgeAreaEnum mt : values()) {
if (mt.getCode().equals(code)) {
return mt;
}
}
throw new IllegalArgumentException("MemberAgeArea " + code + " is not exist");
}
/**
* 通过ID获取中文名称
* @param code
* @return
*/
public static String getName(Integer code) {
if (code == null) {
return null;
}
for (MemberAgeAreaEnum mt : values()) {
if (mt.getCode().equals(code)) {
return mt.getName();
}
}
return null;
}
/**
* 通过中文名称获取ID
* @param code
* @return
*/
public static Integer getCode(String name) {
if (StringUtils.isBlank(name)) {
return null;
}
for (MemberAgeAreaEnum mt : values()) {
if (mt.getName().equals(name)) {
return mt.getCode();
}
}
return null;
}
/**
* 通过ID获取中文名称
* @param code
* @return
*/
public static boolean isExists (Integer code) {
if (code == null) {
return false;
}
for (MemberAgeAreaEnum mt : values()) {
if (mt.getCode().equals(code)) {
return true;
}
}
return false;
}
/**
* 获取所有的枚举,以MAP返回
* @return
*/
public static HashMap<Integer,String> getAllEnumMap() {
HashMap<Integer,String> map = new HashMap<Integer,String>();
for (MemberAgeAreaEnum mt : values()) {
map.put(mt.getCode(), mt.getName());
}
return map;
}
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
}
package com.zrqx.core.enums.resource.questionlibrary;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
/**
* 试题类型
* @author ydm
* @date 2019年3月17日下午9:26:42
*/
public enum QuestionTypeEnum {
TYPE_1(1,"单选"),
TYPE_2(2,"多选"),
TYPE_3(3,"判断"),
TYPE_4(4,"填空"),
TYPE_5(5,"简答"),
TYPE_6(6,"案例");
private final Integer code;
private final String name;
private QuestionTypeEnum(Integer code,String name){
this.code=code;
this.name=name;
}
/**
* 获取测试需要的试题类型
* @return
*/
public static List<QuestionTypeEnum> getExamType(){
List<QuestionTypeEnum> list = new ArrayList<QuestionTypeEnum>();
list.add(TYPE_1);
list.add(TYPE_2);
list.add(TYPE_3);
list.add(TYPE_4);
return list;
}
public static QuestionTypeEnum valueOfCode(Integer code) {
if (code == null) {
throw new IllegalArgumentException("Question Type " + code + " is blank");
}
for (QuestionTypeEnum mt : values()) {
if (mt.getCode().equals(code)) {
return mt;
}
}
throw new IllegalArgumentException("Question Type " + code + " is not exist");
}
/**
* 通过ID获取中文名称
* @param code
* @return
*/
public static String getName(Integer code) {
if (code == null) {
return null;
}
for (QuestionTypeEnum mt : values()) {
if (mt.getCode().equals(code)) {
return mt.getName();
}
}
return null;
}
/**
* 通过中文名称获取ID
* @param code
* @return
*/
public static Integer getCode(String name) {
if (StringUtils.isBlank(name)) {
return null;
}
for (QuestionTypeEnum mt : values()) {
if (mt.getName().equals(name)) {
return mt.getCode();
}
}
return null;
}
/**
* 通过ID获取中文名称
* @param code
* @return
*/
public static boolean isExists (Integer code) {
if (code == null) {
return false;
}
for (QuestionTypeEnum mt : values()) {
if (mt.getCode().equals(code)) {
return true;
}
}
return false;
}
/**
* 获取所有的枚举,以MAP返回
* @return
*/
public static HashMap<Integer,String> getAllEnumMap() {
HashMap<Integer,String> map = new HashMap<Integer,String>();
for (QuestionTypeEnum mt : values()) {
map.put(mt.getCode(), mt.getName());
}
return map;
}
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
}
package com.zrqx.core.enums.sysuser.collection;
/**
* 收藏或取消收藏状态
* @author lw
* @date 2018年8月27日下午3:54:33
*/
public enum CollectionUpdateStatusEnum {
// 收藏
COLLECTON(1,"收藏"),
// 删除收藏
DEL_COLLECTION(0,"删除收藏");
private final Integer code;
private final String name;
private CollectionUpdateStatusEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
}
/**
* @author niguanghui
* @date 2018年12月5日 上午11:55:11
*/
package com.zrqx.core.enums.sysuser.correction;
import java.util.HashMap;
import org.apache.commons.lang3.StringUtils;
/**
* 纠错管理
*
* @author niguanghui
* @date 2018年12月5日上午11:55:11
*/
public enum CorrectionEnum {
// 未审核
NOT_REVIEW(0, "未审核"),
// 已审核
YES_REVIEW(1, "已审核"),
// 已修改
YES_REVISED(2, "已修改");
private final Integer code;
private final String name;
private CorrectionEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
/**
* 通过ID获取中文名称
*
* @param code
* @return
*/
public static String getName(String code) {
if (StringUtils.isBlank(code)) {
return null;
}
for (CorrectionEnum mt : values()) {
if (mt.getCode().equals(code)) {
return mt.getName();
}
}
return null;
}
/**
* 获取所有的枚举,以MAP返回
*
* @return
*/
public static HashMap<Integer, String> getAllEnumMap() {
HashMap<Integer, String> map = new HashMap<Integer, String>();
for (CorrectionEnum mt : values()) {
map.put(mt.getCode(), mt.getName());
}
return map;
}
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
}
package com.zrqx.core.enums.sysuser.dictionary;
/**
* 数据字典code
* @author pc
*
*/
public enum DictonaryCodeEnum {
/**
* 系统安全配置
*/
SYSTEMSAFTY("SYSTEMSAFTY","系统安全") ,
/**
* 网站基础参数配置
*/
SITE("SITE","网站基础参数") ,
/**
* 会员参数配置
*/
MEMBER("MEMBER","会员参数") ,
/**
* 邮件参数配置
*/
EMAIL("EMAIL","邮件参数") ,
/**
* 短信参数配置
*/
SHORTMESSAGE("SHORTMESSAGE","短信参数") ,
/**
* 会员签到参数
*/
MEMBERSIGNED("MEMBERSIGNED","会员签到参数") ;
private final String code;
private final String description;
private DictonaryCodeEnum(String code, String description) {
this.code = code;
this.description = description;
}
public String getCode() {
return code;
}
public String getDescription() {
return description;
}
}
package com.zrqx.core.enums.sysuser.member;
import java.util.HashMap;
import java.util.Map;
import com.zrqx.core.exception.BaseException;
/**
* 个人会员
* 启用、禁用
* @author lw
* @date 2018年7月25日下午5:27:39
*/
public enum MemberStatusEnum {
/** 启用 */
ENABLE("1","启用"),
/** 禁用 */
DISABLE("0","禁用");
private final String code;
private final String name;
public static String getName(String code){
Map<String, String> map = new HashMap<String, String>();
map.put(ENABLE.getCode(), ENABLE.getName());
map.put(DISABLE.getCode(), DISABLE.getName());
return map.get(code);
}
private MemberStatusEnum(String code, String name) {
this.code = code;
this.name = name;
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
}
package com.zrqx.core.enums.sysuser.member;
/**
* 充值类型
* @author pc
*
*/
public enum RechargeType {
/**
* 积分
*/
SCORE(0,"积分"),
/**
* 成长值
*/
GROWTHVALUE(1,"成长值");
private final Integer value;
private final String description;
private RechargeType(Integer value, String description) {
this.value = value;
this.description = description;
}
public Integer getValue() {
return value;
}
public String getDescription() {
return description;
}
}
package com.zrqx.core.enums.sysuser.member;
/**
* 充值类型
* @author pc
*
*/
public enum RechargeTypeInfo {
/**
* 减少
*/
SUB(0,"减少"),
/**
* 增加
*/
ADD(1,"增加");
private final Integer value;
private final String description;
private RechargeTypeInfo(Integer value, String description) {
this.value = value;
this.description = description;
}
public Integer getValue() {
return value;
}
public String getDescription() {
return description;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论