package com.jpsoft.shinestar.modules.common.utils;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

@Slf4j
public class IdCardUtils {
    public static String decrypt(String idCard){
        String data = idCard;

        if (StringUtils.isNotBlank(idCard) && idCard.length() > 18) {
            try {
                data = AESUtil.decrypt(idCard, AESUtil.MYSQL_ENC_KEY);
            } catch (Exception ex) {
               log.error(ex.getMessage(),ex);
            }
        }

        return data;
    }

    public static String encrypt(String idCard) {
        String result = idCard;


        //身份证加密
       /* try {
            if(StringUtils.isNotBlank(idCard) && idCard.length()<=18){
                result = AESUtil.encrypt(idCard.trim(), AESUtil.MYSQL_ENC_KEY);
            }
        } catch (Exception ex) {
            log.error(ex.getMessage(),ex);
        }*/

        return result;
    }
}
