package com.winsun.user;

import com.winsun.auth.core.common.model.ResponseData;
import com.winsun.auth.model.user.User;
import com.winsun.base.AppApplicationBaseIT;
import com.winsun.item.modular.system.dao.UserMapper;
import com.winsun.item.util.LoginUtils;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 用户测试
 * @author Liph
 * @datetime 2020-01-20/1/9 09:43
 */
@Slf4j
public class UserTestHelper extends AppApplicationBaseIT {

    @Autowired
    private UserMapper mapper;

    @Test
    public void decryptPwd() {
        final String account = "18028801118";
        User user = mapper.getByAccount(account);
        if(user == null) {
            throw new NullPointerException("解密用户信息失败，用户不存在");
        }
        log.info(user.getPassword());
        // 证明MD5无法解密
        ResponseData<String> pwdDecrypt = LoginUtils.pwdDecrypt(user.getPassword());
        log.info("{}", pwdDecrypt.getData());
    }
}
