package com.tax.user.constants;

import com.alibaba.fastjson.JSON;
import com.tax.user.model.SysClientUser;
import com.yxcheng.token.common.cache.RedisService;
import com.yxcheng.token.constants.RedisContants;
import com.yxcheng.token.utils.SpringUtil;

public class UserContants {

    private static RedisService redisService = SpringUtil.getBean(RedisService.class);
    /**
     * 01、异步采集认证
     * 02、实时采集认证
     * 03、查验
     * 04、签名
     * 05、token服务
     */
    public static String ASYN_COLLECT_CERTIFIED = "01";
    public static String SYN_COLLECT_CERTIFIED = "02";
    public static String CHECK = "03";
    public static String SIGN = "04";
    public static String TOKEN_SERVICE = "05";


    public static String APPLY_STATUS_OFF = "0";
    public static String APPLY_STATUS_ON = "1";


    public static String USER_TAX_STATUS_NORMAL = "0";
    public static String USER_TAX_STATUS_BLOCK = "1";
    public static String USER_TAX_STATUS_CHECKING = "2";

    public static SysClientUser getUserByNameInCache(String userName) {
        if(redisService.exists(RedisContants.CHECK_FULLINFO + userName)) {
            return JSON.parseObject(redisService.get(RedisContants.CHECK_FULLINFO + userName),  SysClientUser.class);
        }
        return null;
    }
}
