package com.doumee.core.utils; import org.apache.commons.collections4.CollectionUtils; import java.math.BigDecimal; import java.net.URLDecoder; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Constants { public static final String[] ALL_SPELL_LIST_FIRST = new String[]{"A", "B", "C", "D", "E", "F", "G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"}; public static final int ZERO = 0 ; public static final int ONE = 1 ; public static final int TWO = 2 ; /** * mq tag */ public interface MQ_TAG{ String order = "order"; String activity = "activity"; } public interface MQ_KEY{ String activity_looknum = "looknum"; String activity_signup = "signup"; } public static final String SUCCESS_STR = "SUCCESS" ; //开门时间有效期(分钟) public static final String QR_OPENBOOK_VALIDTIME="QR_OPENBOOK_VALIDTIME"; public static final String QR_OPENROOM_VALIDTIME="QR_OPENROOM_VALIDTIME"; public static final String ADVANCE_IN="ADVANCE_IN"; public static final String ACCESS_ID="ACCESS_ID"; public static final String BUCKETNAME = "BUCKETNAME"; public static final String OSS = "OSS"; public static final String COFFEE_ARTICLE = "COFFEE_ARTICLE"; public static final String ACCESS_KEY = "ACCESS_KEY"; public static final String ENDPOINT = "ENDPOINT"; public static final String RESOURCE_PATH = "RESOURCE_PATH"; //发送会议开始 定时提前多少分钟发送 public static final String NOTICE_TIME = "NOTICE_TIME"; public static final String INITIAL_PASSWORD = "INITIAL_PASSWORD"; public static final String ACCESS_TOKEN = "ACCESS_TOKEN"; public static final String INITIAL_ROLE = "INITIAL_ROLE"; public static final String PLAT_ADDR="PLAT_ADDR"; public static final String ADDR_PHONE="ADDR_PHONE"; public static final String ADDR_NAME="ADDR_NAME"; public static final String ADDR_INFO="ADDR_INFO"; public static final String SYSTEM ="SYSTEM"; public static final String DEFAULT_PASSWORD = "DEFAULT_PASSWORD" ; public static final String CREATION_ROLE = "CREATION_ROLE"; public static final String ORG_ROLE = "ORG_ROLE"; public static final String USER_AGREEMENT = "USER_AGREEMENT"; public static final String ABOUT_USER = "ABOUT_USER"; public static final String RECHARGE_MONEY = "RECHARGE_MONEY"; public static final String PLATFORM_ADDRESS = "PLATFORM_ADDRESS"; public static final String PROJECT_HEAD_IMG = "PROJECT_HEAD_IMG"; public static final String COFFEE_BEAN_TASK ="COFFEE_BEAN_TASK"; public static final String SIGN_BOARD="SIGN_BOARD";//每日签到 public static final String SHARE_INFO="SHARE_INFO";//分享资讯 public static final String SHARE_INVITE_BILL="SHARE_INVITE_BILL";//分享邀请海报 public static final String INVITE_USER_LOGIN="INVITE_USER_LOGIN";///邀请新用户注册 public static final String POST_COMMENTS="POST_COMMENTS";//发布评论 public static final String COFFEE_MAP_CONSUME="COFFEE_MAP_CONSUME";//咖啡地图消费 // 服务项目 public static final String PROJECTS = "PROJECTS"; //用户头像 public static final String SYSUSER = "SYSUSER"; public static final String ROOT_PATH="ROOT_PATH";//本地文件上传地址配置 public static final String FILE_DIR="FILE_DIR";//本地文件访问地址配置 public interface RedisKeys { public static final String GOODSORDER_KEY = "ordercode_"; public static final String ACTIVITY_SIGN_KEY = "actcode_"; public static final String AFTERSALE_KEY = "salecode_"; } /** * 企业数据来源 0平台注册 1后台导入 */ public interface ORIGIN{ public static final int platformRegister = 0; public static final int backstageImport = 1; } public static BigDecimal formatBigdecimal(BigDecimal d) { if (d == null) { d = new BigDecimal(0.0); } //保留两位小数且四舍五入 // d = d.setScale(2, BigDecimal.ROUND_HALF_UP); return d; } public static BigDecimal formatBigdecimal4Float(BigDecimal d) { if (d == null) { d = new BigDecimal(0.0); } //保留两位小数且四舍五入 d = d.setScale(4, BigDecimal.ROUND_HALF_UP); return d; } public static boolean equalsObject(Object a, Object b) { if (a == null && b == null) { return true; } if (a != null){ return a.equals(b); } return false; } public static boolean equalsInteger(Integer a, Integer b) { if (formatIntegerNum(a) == formatIntegerNum(b)) { return true; } return false; } public static int formatIntegerNum(Integer d) { if (d == null) { d = 0; } return d.intValue(); } public static long formatLongNum(Long d) { if (d == null) { d = 0L; } return d.longValue(); } public interface UserRelObjType{ int objTypeRoom = 0; int objTypeBook = 1; } public interface RoomRecordObjType{ int objTypeRoom = 0;//管理员开门 int objTypeBook_in = 1;//参会人员开门 int objTypeBook_out = 2;//访客开门 } public static void main(String[] args) { String t = URLDecoder.decode("https://lsqw.gtja.com/qwcos/v-index.html#/loginforProperty?corpId=ww4b7aefafeb430e4b&corpId=ww4b7aefafeb430e4b&agentId=1000005&agentId=1000005&fromRoute=&userCode=013561&userCode=&userId=zz&userId=&encryptUserCode=&custQwId=wmIUuSDgAAR8MhtVY8w90EyKltvoK5fA&custCode=&openId=op1wZwD1dKuBQywmWWS5957zUOJI&name=%E8%B9%84%E8%B9%84&headUrl=http%3A%2F%2Fwx.qlogo.cn%2Fmmhead%2FQ3auHgzwzM4QlibSOAvYcvRMdsoyF3Ua7duLOYSJfB3dsGsYxIYonBw%2F0&dbHeadUrl=https%3A%2F%2Ftgf.gtja.com%2Ff%2F%2Fqwoms%2F2022512%2Fqwoms_1652332606613_8.jpg"); System.out.println(t); } /** * 用户类型 */ public enum UserType { SYSTEM(0, "系统用户", "管理员",Arrays.asList(0)), ORG(1, "机构", "机构",Arrays.asList(1)), CREATION(2, "创作中心", "创作中心",Arrays.asList(2)) ; // 成员变量 private String name; private int key; private List historyStatus; private String noteinfo;// 描述 // 构造方法 UserType(int key, String name, String noteinfo,List historyStatus) { this.name = name; this.key = key; this.noteinfo = noteinfo; this.historyStatus=historyStatus; } // 普通方法 public static String getName(int index) { for (UserType c : UserType.values()) { if (c.getKey() == index) { return c.name; } } return null; } // 普通方法 public static String getInfo(int index) { for (UserType c : UserType.values()) { if (c.getKey() == index) { return c.noteinfo; } } return null; } // 普通方法 public static List getHistoryStatus(int index) { for (UserType c : UserType.values()) { if (c.getKey() == index) { return c.historyStatus; } } return null; } // get set 方法 public String getName() { return name; } public void setName(String name) { this.name = name; } public int getKey() { return key; } public List getHistoryStatus() { return historyStatus; } public void setKey(int key) { this.key = key; } public String getNoteinfo() { return noteinfo; } } /** * 数据状态枚举 * */ public enum Status { /** 用户启用禁用枚举值*/ ENABLE(0,"正常"), DISABLE(1,"禁用"); private Integer value; private String des; Status(Integer value, String des) { this.value = value; this.des = des; } public Integer getValue() { return value; } public void setValue(Integer value) { this.value = value; } public String getDes() { return des; } public void setDes(String des) { this.des = des; } } /** * 关联对象类型 0活动轮播图 1活动详情图 2门店评价3订单评价 4平台商品轮播 5探店多图 6店铺新鲜事多图 7商家图片多图 */ public enum MultiFile{ ACTIVITY_ROTATION(0, "活动轮播图", "活动轮播图"), ACTIVITY_DETAIL(1, "活动详情图", "活动详情图"), SHOP_APPRAISE(2, "门店评价", "门店评价"), ORDER_APPRAISE(3, "订单评价", "订单评价"), PLATFORM_GOOD_ROTATION(4, "平台商品轮播", "平台商品轮播"), TANDIAN_PICTURE(5, "探店多图", "探店多图"), SHOP_HOT_PICTURE(6, "店铺新鲜事多图", "店铺新鲜事多图"), SHOP_PICTURE(7, "商家图片多图", "商家图片多图"), AFTERSALE_APPLY(8, "申请售后补充说明附件", "申请售后补充说明附件"), AFTERSALE_KD(9, "申请售后邮寄说明附件", "申请售后邮寄说明附件"), ; // 成员变量 private String name; private int key; private String noteinfo;// 描述 // 构造方法 MultiFile(int key, String name, String noteinfo) { this.name = name; this.key = key; this.noteinfo = noteinfo; } // 普通方法 public static String getName(int index) { for (MultiFile c : MultiFile.values()) { if (c.getKey() == index) { return c.name; } } return null; } // 普通方法 public static String getInfo(int index) { for (MultiFile c : MultiFile.values()) { if (c.getKey() == index) { return c.noteinfo; } } return null; } // get set 方法 public String getName() { return name; } public void setName(String name) { this.name = name; } public int getKey() { return key; } public void setKey(int key) { this.key = key; } public String getNoteinfo() { return noteinfo; } } /** * 订单管理 * 状态 0申请中 1已支付 2已取消 */ public enum ActivitySignupStatus{ APPLY_ING(0, "申请中", "申请中"), PAY_DONE(1, "已支付", "已支付"), CANCEL(2, "已取消", "已取消"), ; // 成员变量 private String name; private int key; private String noteinfo;// 描述 // 构造方法 ActivitySignupStatus(int key, String name, String noteinfo) { this.name = name; this.key = key; this.noteinfo = noteinfo; } // 普通方法 public static String getName(int index) { for (ActivitySignupStatus c : ActivitySignupStatus.values()) { if (c.getKey() == index) { return c.name; } } return null; } // 普通方法 public static String getInfo(int index) { for (ActivitySignupStatus c : ActivitySignupStatus.values()) { if (c.getKey() == index) { return c.noteinfo; } } return null; } // get set 方法 public String getName() { return name; } public void setName(String name) { this.name = name; } public int getKey() { return key; } public void setKey(int key) { this.key = key; } public String getNoteinfo() { return noteinfo; } } /** * 售后状态 * 状态 0待处理 1待邮寄 2已寄出 3商家已退款 4商家已发货5售后已完成6商家拒绝 7已取消 */ public enum AftersaleStatus{ APPLY_ING(0, "待处理", "待处理"), WAIT_SEND(1, "待邮寄", "待邮寄"), SENDED(2, "客户已寄出", "客户已寄出"), REFUND(3, "已退款", "已退款"), SHOP_SENDED(4, "平台已发货", "平台已发货"), DONE(5, "售后已完成", "售后已完成"), SHOP_REFUSE(6, "已拒绝", "平台拒绝"), CANCEL(7, "已取消", "客户取消售后"), ; // 成员变量 private String name; private int key; private String noteinfo;// 描述 // 构造方法 AftersaleStatus(int key, String name, String noteinfo) { this.name = name; this.key = key; this.noteinfo = noteinfo; } // 普通方法 public static String getName(int index) { for (AftersaleStatus c : AftersaleStatus.values()) { if (c.getKey() == index) { return c.name; } } return null; } // 普通方法 public static String getInfo(int index) { for (AftersaleStatus c : AftersaleStatus.values()) { if (c.getKey() == index) { return c.noteinfo; } } return null; } // get set 方法 public String getName() { return name; } public void setName(String name) { this.name = name; } public int getKey() { return key; } public void setKey(int key) { this.key = key; } public String getNoteinfo() { return noteinfo; } } /** * 售后类型 * 售后类型 0退款 1退货退款 2换货 */ public enum AftersaleType{ TK(0, "退款", "退款"), THTK(1, "退货退款", "退货退款"), HH(2, "换货", "换货"), ; // 成员变量 private String name; private int key; private String noteinfo;// 描述 // 构造方法 AftersaleType(int key, String name, String noteinfo) { this.name = name; this.key = key; this.noteinfo = noteinfo; } // 普通方法 public static String getName(int index) { for (AftersaleType c : AftersaleType.values()) { if (c.getKey() == index) { return c.name; } } return null; } // 普通方法 public static String getInfo(int index) { for (AftersaleType c : AftersaleType.values()) { if (c.getKey() == index) { return c.noteinfo; } } return null; } // get set 方法 public String getName() { return name; } public void setName(String name) { this.name = name; } public int getKey() { return key; } public void setKey(int key) { this.key = key; } public String getNoteinfo() { return noteinfo; } } /** * 订单管理 * 状态 0待支付 1待发货 2待收货 3交易完成 4已关闭 5部分发货 */ public enum OrderStatus{ WAIT_PAY(0, "待支付", "待支付"), PAY_DONE(1, "待发货", "已支付代发货"), WAIT_RECEIVE(2, "待收货", "已发货待收货"), DONE(3, "交易完成", "交易完成"), CLOSE(4, "已关闭", "已关闭"), PART_DONE(5, "部分发货", "部分发货"), ; // 成员变量 private String name; private int key; private String noteinfo;// 描述 // 构造方法 OrderStatus(int key, String name, String noteinfo) { this.name = name; this.key = key; this.noteinfo = noteinfo; } // 普通方法 public static String getName(int index) { for (OrderStatus c : OrderStatus.values()) { if (c.getKey() == index) { return c.name; } } return null; } // 普通方法 public static String getInfo(int index) { for (OrderStatus c : OrderStatus.values()) { if (c.getKey() == index) { return c.noteinfo; } } return null; } // get set 方法 public String getName() { return name; } public void setName(String name) { this.name = name; } public int getKey() { return key; } public void setKey(int key) { this.key = key; } public String getNoteinfo() { return noteinfo; } } /** * 订单类型 * 订单类型 0平台商城 1咖豆商城 2咖啡计划编码 */ public enum OrderType{ ADMINPLAT(0, "平台商城 ", "平台商城 "), KADOUPLAT(1, "咖豆商城", "咖豆商城"), COFFERPLAN(2, "2咖啡计划编码", "2咖啡计划编码") ; // 成员变量 private String name; private int key; private String noteinfo;// 描述 // 构造方法 OrderType(int key, String name, String noteinfo) { this.name = name; this.key = key; this.noteinfo = noteinfo; } // 普通方法 public static String getName(int index) { for (OrderType c : OrderType.values()) { if (c.getKey() == index) { return c.name; } } return null; } // 普通方法 public static String getInfo(int index) { for (OrderType c : OrderType.values()) { if (c.getKey() == index) { return c.noteinfo; } } return null; } // get set 方法 public String getName() { return name; } public void setName(String name) { this.name = name; } public int getKey() { return key; } public void setKey(int key) { this.key = key; } public String getNoteinfo() { return noteinfo; } } public enum ShareType{ // 0活动1探店2咨询3店铺 4商品5分享邀请海报 SHARE_ACTIVITY_ACTIVITY(0,"活动","活动"), SHARE_ACTIVITY_VISITSHOP(1,"探店","咨询"), SHARE_ACTIVITY_NEW(2,"咨询","咨询"), SHARE_SHOP(3,"店铺","店铺" ), SHARE_GOODS(4,"商品","商品"), SHARE_POSTER(5,"分享邀请海报","分享邀请海报") ; private Integer key; private String name; private String des; ShareType(Integer key, String name, String des) { this.key = key; this.name = name; this.des = des; } public Integer getKey() { return key; } public void setKey(Integer key) { this.key = key; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDes() { return des; } public void setDes(String des) { this.des = des; } } /** * 咖豆任务 */ public enum CoffeeBeanTask{ SIGN_BOARD(1,"SIGN_BOARD","每日签到"), SHARE_INFO(6,"SHARE_INFO","分享资讯"), SHARE_INVITE_BILL(2,"SHARE_INVITE_BILL","分享邀请海报"), INVITE_USER_LOGIN(3,"INVITE_USER_LOGIN","邀请新用户注册"), EXCHANGE_GOODS(4,"INVITE_USER_LOGIN","兑换商品"), EXCHANGE_COUPON(5,"INVITE_USER_LOGIN","兑换优惠券"), POST_COMMENTS(7,"POST_COMMENTS","发布评论"), COFFEE_MAP_CONSUME(8,"COFFEE_MAP_CONSUME","咖啡地图消费"), ; // 0平台注册 1签到 2分享邀请 3邀请新用户 4兑换商品 5兑换优惠券 // 成员变量 private Integer key; private String name; private String des;// 描述 CoffeeBeanTask(Integer key, String name, String des) { this.key = key; this.name = name; this.des = des; } public Integer getKey() { return key; } public void setKey(Integer key) { this.key = key; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDes() { return des; } public void setDes(String des) { this.des = des; } } public enum NoticeType{ // 0订单通知 1系统消息 2互动消息 3优惠券提醒 4官方客服 5活动推荐 6我的关注 NOTICE_ORDER(0,"0订单通知","0订单通知"), NOTICE_SYSTEM(1,"1系统消息","1系统消息"), NOTICE_INTERACTION(2,"互动消息","互动消息"), NOTICE_MEMBER_COUPON(3,"优惠券提醒","优惠券提醒"), NOTICE_ACTIVITY(5,"活动推荐","活动推荐"), NOTICE_MEMBER_FOLLOW(6,"我的关注","我的关注") ; private Integer key; private String type; private String content; NoticeType(Integer key, String type, String content) { this.key = key; this.type = type; this.content = content; } } /** * 积分类型 */ public enum IntegralObjType { REGISTER(0, "平台注册", "平台注册",0), SIGNIN(1, "签到", "签到",0), SHARE(2, "分享邀请", "分享邀请",0), INVITENEWUSER(3, "邀请新用户", "邀请新用户",0), EXCHANGEGOODS(4, "兑换商品", "兑换商品",1), EXCHANGECOUPON(5, "兑换优惠券", "兑换优惠券",1), SHARE_INFO(6,"分享资讯","分享资讯",0), POST_COMMENTS(7,"发布评论","发布评论",0), COFFEE_MAP_CONSUME(8,"咖啡地图消费","咖啡地图消费",0), SHOP_ORDER(9,"余额抵扣商品","余额抵扣商品",1), AFTERSALE_BACK(10,"售后退款","售后退款",1), EXCHANGE_CARD(11,"卡充值","卡充值",0), SYSTEM_RECHARGE(12,"平台充值","平台充值",0), SYSTEM_DEDUCT(13,"平台扣款","平台扣款",0), SHOP_ORDER_CANCEL(14,"余额抵扣商品退还","余额抵扣商品退还",0) ; // 成员变量 private String name; private int key; private String noteinfo;// 描述 private Integer addTitle; // 0 = 新增;1 = 不新增 // 构造方法 IntegralObjType(int key, String name, String noteinfo ,Integer addTitle) { this.name = name; this.key = key; this.noteinfo = noteinfo; this.addTitle = addTitle; } // 普通方法 public static String getName(int index) { for (IntegralObjType c : IntegralObjType.values()) { if (c.getKey() == index) { return c.name; } } return null; } // 普通方法 public static String getInfo(int index) { for (IntegralObjType c : IntegralObjType.values()) { if (c.getKey() == index) { return c.noteinfo; } } return null; } // get set 方法 public String getName() { return name; } public void setName(String name) { this.name = name; } public int getKey() { return key; } public void setKey(int key) { this.key = key; } public String getNoteinfo() { return noteinfo; } public int getAddTitle() { return this.addTitle; } public void setAddTitle(Integer addTitle) { this.addTitle = addTitle; } } /** * 标签类型 */ public enum LabelsType { GOODSTYPE(0, "商品分类", "商品分类"), GOODSBRAND(1, "商品品牌", "商品品牌"), BUSNESSLABEL(2, "商家标签", "商家标签"), EXPRESSDELIVERY(3, "快递", "快递"), RETURNOPTIONS(4, "退货选项", "退货选项"), EXCHANGEOPTIONS(5, "换货选项", "换货选项"), REFUNDOPTIONS(6, "退款选项", "退款选项"), CANCELORDEROPTIONS(7, "取消订单选项", "取消订单选项"), COFFERBEANTYPE(8, "咖啡百科分类", "咖啡百科分类"), INFOTYPE(9, "咨询分类", "咨询分类"), ACTIVITYMATCHTYPE(10, "活动赛事分类", "活动赛事分类"), DARENTANDIANTYPE(11, "达人探店分类", "达人探店分类"), HOMEZHUANQU(12, "首页专区", "首页专区"), ; // 成员变量 private String name; private int key; private String noteinfo;// 描述 // 构造方法 LabelsType(int key, String name, String noteinfo) { this.name = name; this.key = key; this.noteinfo = noteinfo; } // 普通方法 public static String getName(int index) { for (LabelsType c : LabelsType.values()) { if (c.getKey() == index) { return c.name; } } return null; } // 普通方法 public static String getInfo(int index) { for (LabelsType c : LabelsType.values()) { if (c.getKey() == index) { return c.noteinfo; } } return null; } // get set 方法 public String getName() { return name; } public void setName(String name) { this.name = name; } public int getKey() { return key; } public void setKey(int key) { this.key = key; } public String getNoteinfo() { return noteinfo; } } /** * 活动类型 */ public enum ActivityType { SHOPACTIVITY(0, "商家活动", "商家活动"), PLATACTIVITY(1, "平台活动", "平台活动"), TANDIAN(2, "探店", "探店"), CONSULT(3, "资讯", "资讯"), ; // 成员变量 private String name; private int key; private String noteinfo;// 描述 // 构造方法 ActivityType(int key, String name, String noteinfo) { this.name = name; this.key = key; this.noteinfo = noteinfo; } // 普通方法 public static String getName(int index) { for (ActivityType c : ActivityType.values()) { if (c.getKey() == index) { return c.name; } } return null; } // 普通方法 public static String getInfo(int index) { for (ActivityType c : ActivityType.values()) { if (c.getKey() == index) { return c.noteinfo; } } return null; } // get set 方法 public String getName() { return name; } public void setName(String name) { this.name = name; } public int getKey() { return key; } public void setKey(int key) { this.key = key; } public String getNoteinfo() { return noteinfo; } } }