package com.bonus.sharedstation.auth.service;

import com.bonus.sharedstation.auth.entity.GreenUserInfoDo;
import com.bonus.sharedstation.auth.mapper.GreenUserMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * FileName: GreenUserServiceImpl
 *
 * @author tqzhang
 * Date: 2025/2/19 上午11:01
 * Description:
 */
@Service
@Slf4j
public class GreenUserServiceImpl implements GreenUserService  {

    @Resource
    private GreenUserMapper greenUserMapper;

    @Override
    public GreenUserInfoDo getUserByMobile(String userId) {
        GreenUserInfoDo userInfoDo = greenUserMapper.getUserByMobile(userId);
        if(null == userInfoDo) {
            return new GreenUserInfoDo();
        }

        /*try {
            if (null != userInfoDo.getIdCard() && !"".equals(userInfoDo.getIdCard())) {
                String idCard;
                idCard = AesEncryptUtil.desEncrypt(userInfoDo.getIdCard().trim());
                if (idCard != null && !"".equals(idCard)) {
                    userInfoDo.setIdCard(idCard.trim());
                } else {
                    userInfoDo.setIdCard(null);
                }
            }
            if (null != userInfoDo.getMobile() && !"".equals(userInfoDo.getMobile())) {
                String mobile;
                mobile = AesEncryptUtil.desEncrypt(userInfoDo.getMobile().trim());
                if (mobile != null && !"".equals(mobile)) {
                    userInfoDo.setIdCard(mobile.trim());
                } else {
                    userInfoDo.setIdCard(null);
                }
            }
        } catch (Exception e) {
            log.error("身份证解密失败：{}", e.getMessage());
            e.printStackTrace();
        }*/
        return userInfoDo;
    }
}
