jiangping
2024-01-05 cb6874174975a370cb60f1557704c9d49a05f9e6
server/dmvisit_service/src/main/java/com/doumee/core/utils/Constants.java
@@ -1,12 +1,21 @@
package com.doumee.core.utils;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import org.apache.commons.lang3.StringUtils;
import java.io.IOException;
import java.math.BigDecimal;
import java.net.URLDecoder;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import  java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Constants {
@@ -21,6 +30,7 @@
    public static final String HK_HTTPS ="HK_HTTPS" ;
    public static final String HK_PUSH_URL = "HK_PUSH_URL";
    public static final String HK_ROOTORG_CODE ="HK_ROOTORG_CODE" ;
    public static final String HK_ROOTORG_NAME ="HK_ROOTORG_NAME" ;
    //被拜访人信息校验方式(0手机号单独校验 1手机号和姓名组合校验)
    public static final String BEVISITED_USER_VALID = "BEVISITED_USER_VALID";
@@ -31,7 +41,52 @@
    public static final String MDJ_LW_REQUIRED = "MDJ_LW_REQUIRED";
    public static final String MDJ_VISIT_REQUIRED = "MDJ_VISIT_REQUIRED";
    public static final String EDS_PWD ="!@#$%^&QWERTY" ;
    public static final String ROOT_PATH = "";
    public static final String FILE_DIR = "";
    // 访客来访配置
    public static final String VISIT_CONFIG = "VISIT_CONFIG";
    public static final String MEMBER_IMG = "MEMBER_IMG";
    // 劳务来访配置
    public static final String LABOR_CONFIG = "LABOR_CONFIG";
    public static final String VISIT_EVENT_IMG = "VISIT_EVENT_IMG";
    public static final String CAR_EVENT_IMG = "CAR_EVENT_IMG";
    public static final String DEVICE_EVENT_IMG = "DEVICE_EVENT_IMG";
    public static final String FTP ="FTP" ;
    public static final String FTP_HOST ="FTP_HOST" ;
    public static final String FTP_PORT ="FTP_PORT" ;
    public static final String FTP_USERNAME ="FTP_USERNAME" ;
    public static final String FTP_PWD ="FTP_PWD" ;
    public static final String FTP_RESOURCE_PATH ="FTP_RESOURCE_PATH" ;
    public static final String ERP_ORGLIST_URL ="ERP_ORGLIST_URL" ;
    public static final String ERP_USERLIST_URL ="ERP_USERLIST_URL" ;
    public static final String ERP_APPROVE_URL ="ERP_APPROVE_URL" ;
    public static final String ERP_USERSTATUS_RL ="ERP_USERSTATUS_RL" ;
    public static final String ERP ="ERP" ;
    public static final Integer THREE =3 ;
    public static final Integer FOUR =4 ;
    public static final String ORG_USER_ORIGIN = "ORG_USER_ORIGIN";
    public static  boolean DEALING_HK_SYNCPRIVILEGE= false;
    public static  boolean DEALING_HK_SYNCDEVICE = false;
    public static  boolean DEALING_HK_SYNCPARK = false;
    public static  boolean DEALING_HK_IMG = false;
    public static  boolean DEALING_HK_ORG = false;
    public static  boolean DEALING_HK_USER = false;
    public static  boolean DEALING_HK_VISIT = false;
    public static  boolean DEALING_HK_EMPOWER = false;
    public static  boolean DEALING_HK_EMPOWER_DETAIL = false;
    public static  boolean DEALING_HK_EMPOWER_RESULT = false;
    public static  boolean DEALING_HK_PARKBOOK = false;
    // ERP接口配置
    public static final String ERP_CONFIG = "ERP_CONFIG";
    // ERP ACCESS_KEY
    public static final String ERP_ACCESS_KEY = "ERP_ACCESS_KEY";
    // ERP ACCESS_SECRET
    public static final String ERP_ACCESS_SECRET = "ERP_ACCESS_SECRET";
    // 内部人员冻结配置时间
    public static final String TIMEOUT_FREEZE = "TIMEOUT_FREEZE";
    // FTP文件服务器资源访问地址
    public static  Date  getBirthdyByCardNo(String idCard){
    if(idCard ==null || idCard.length()<14){
@@ -43,10 +98,33 @@
    try {
        birthday = dateFormat.parse(birthdayString);
    } catch (Exception e) {
        throw new RuntimeException(e);
//        throw new RuntimeException(e);
    }
    return  birthday;
}
    public static  Integer   getSexByCardNo(String idCard){
        if(idCard ==null || idCard.length()<17){
            return null;
        }
        String str = idCard.substring(16, 17); // 截取身份证号的前六位数字作为出生日期
        try {
            Integer num  = Integer.parseInt(str);
            return  (num % 2 !=0) ? 1:2 ;
        } catch (Exception e) {
        }
        return  null;
    }
    /**
     *   判断是否为有效车牌号
     */
    public static boolean checkCarNo(String str) {
        String patt="^[京津沪冀晋辽吉黑苏浙皖闽赣鲁豫鄂湘粤桂琼川黔云渝藏陕陇青宁新闽粤晋琼使领A_Z]{1}[A_Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$";
        Pattern r = Pattern.compile(patt);
        Matcher matcher = r.matcher(str);
        return matcher.find();
    }
    public static  String  getTuominStr(String s){
        if(StringUtils.isEmpty(s)){
            return "";
@@ -87,6 +165,26 @@
         int fk = 1;//普通访客
         int nb = 2;//内部访客
    }
    public interface VisitStatus{
        //审核状态 0待审核 1已提交ERP审批  2审核通过 3审核不通过 4取消 5下发成功 6下发失败 7已签离
         int waitCheck = 0;
         int submitCheck = 1;
         int pass = 2;
         int noPass = 3;
         int cancel = 4;
         int xfSuccess = 5;
         int xfFail = 6;
         int signout = 7;
    }
    public interface EmpowerStatus{
        //一卡通授权下发状态 0待下发 1已下发 2下发成功   3已取消 4下发失败 5任务下载已结束
         int wait = 0;
         int ing = 1;
         int pass = 2;
         int cancel = 3;
         int fail = 4;
         int downloaded = 5;
    }
    public interface DOOR_ROLE_TYPE{
         int lw = 0;
         int fk = 1;
@@ -98,7 +196,6 @@
    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";
@@ -110,6 +207,8 @@
    public static final String COFFEE_BEAN_TASK ="COFFEE_BEAN_TASK";
    public static final String HOME_IMAGE ="HOME_IMAGE";
@@ -117,6 +216,8 @@
    public static final String WX_PLATFORM_ACCESS_TOKEN = "WX_PLATFORM_ACCESS_TOKEN";
    public static final String WX_PLATFORM_APPID = "WX_PLATFORM_APPID";
    public static final String WX_PLATFORM_SECRET = "WX_PLATFORM_SECRET";
    public static final String WX_PLATFORM_AUDIT_VISIT = "WX_PLATFORM_AUDIT_VISIT";
    public static final String WX_PLATFORM_PREFIX = "WX_PLATFORM_PREFIX";
@@ -124,6 +225,11 @@
    public interface RedisKeys {
        public static final String ERP_TOKEN ="ERP_TOKEN";
        public static final long EXPIRE_TIME = 7200;
        public static final String INTERNAL_TOKEN ="INTERNAL_TOKEN";
        public static final String GOODSORDER_KEY = "ordercode_";
        public static final String ACTIVITY_SIGN_KEY = "actcode_";
        public static final String AFTERSALE_KEY = "salecode_";
@@ -179,104 +285,29 @@
        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 interface  memberType{
    int visitor = 0;//普通访客
    int lw_visitor = 1;//劳务访客
    int lw_visitor = 0;//劳务访客
    int visitor = 1;//普通访客
    int internal = 2;//内部人员
}
public interface  approveStatus{
    int wait = 0;//待审批
    int auditIng = 1;//审批中
    int pass = 2;//审批通过
    int unPass = 3;//审批未通过
    int otherDeal = 4;//他人已处理
}
    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<Integer> historyStatus;
        private String noteinfo;// 描述
        // 构造方法
        UserType(int key, String name, String noteinfo,List<Integer> 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<Integer> 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<Integer> getHistoryStatus() {
            return historyStatus;
        }
        public void setKey(int key) {
            this.key = key;
        }
        public String getNoteinfo() {
            return noteinfo;
        }
    }
    /**
     * 数据状态枚举
@@ -286,7 +317,17 @@
        /** 用户启用禁用枚举值*/
        ENABLE(0,"正常"),
        DISABLE(1,"禁用");
        DISABLE(1,"禁用"),
        FREEZE(2,"拉黑/冻结"),
        /** 用户类型 **/
        LW_FK(0,"劳务访客"),
        PT_FK(1,"普通访客"),
        NB_FK(2,"内部人员"),
        /** 进场类型 **/
        OUT(0,"出"),
        IN(1,"进");
        private  Integer value;
        private  String des;
@@ -314,517 +355,26 @@
        }
    }
    /**
     * 关联对象类型 0活动轮播图 1活动详情图 2门店评价3订单评价 4平台商品轮播 5探店多图 6店铺新鲜事多图 7商家图片多图
     * 对象驼峰属性转下划线
     * @param object
     * @return
     * @throws JsonProcessingException
     */
    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;
        }
    public static String toUnderlineJSONString(Object object) throws JsonProcessingException {
        ObjectMapper mapper = new ObjectMapper();
        mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
        mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
        String reqJson = mapper.writeValueAsString(object);
        return reqJson;
    }
    /**
     * 订单管理
     * 状态 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;
        }
    public static <T> T toSnakeObject(String json, Class<T> clazz) throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
        T reqJson =  mapper.readValue(json, clazz);
        return reqJson;
    }
    /**
     * 售后状态
     * 状态 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我的关注
}