package com.jpsoft.shinestar.modules.common.service.impl;

import com.jpsoft.shinestar.modules.common.service.IRedisService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

@Service(value="redisService")
public class RedisServiceImpl extends IRedisService<Object> {
    private static final String REDIS_KEY = "JP_HOUSEPROPERTY_REDIS_KEY";
    private static final String REDIS_KEY1 = "VERIFYCODE_REDIS_KEY";
    private static final String REDIS_KEY2 = "APITOKEN_REDIS_KEY";
    private static final String REDIS_KEY3 = "ACCESSTOKEN_REDIS_KEY";
    private static final String REDIS_KEY4 = "PERSONINFO_REDIS_KEY";


    @SuppressWarnings("static-access")
	@Override
    protected String getRedisKey(String jpKey) {
        if (jpKey.equals("code")){
            return REDIS_KEY1;
        }
        if (jpKey.equals("apiToken")){
            return REDIS_KEY2;
        }
        if (jpKey.equals("accessToken")){
            return REDIS_KEY3;
        }
        if (jpKey.equals("personInfo")){
            return REDIS_KEY4;
        }
        if (StringUtils.isBlank(jpKey)){
            return REDIS_KEY;
        }
        return REDIS_KEY;

    }
}
