zjh
2025-05-30 1356787741a823dde5ed40bb19dece59dd979511
ltkj-framework/src/main/java/com/ltkj/framework/web/service/SysLoginService.java
@@ -40,6 +40,7 @@
import com.ltkj.framework.manager.AsyncManager;
import com.ltkj.framework.manager.factory.AsyncFactory;
import com.ltkj.framework.security.context.AuthenticationContextHolder;
import org.springframework.util.DigestUtils;
import java.util.Date;
import java.util.HashMap;
@@ -230,7 +231,7 @@
     * @param password 密码
     * @return 结果
     */
    public String Cuslogin(String username, String password, Boolean type,String code,String uuid) {
    public String Cuslogin(String username,String sfzh, String password, Boolean type,String code,String uuid) {
        String aSwitch = configService.selectConfigByKey("captcha_switch");
        if(null !=aSwitch && aSwitch.equalsIgnoreCase("Y")){
@@ -250,7 +251,7 @@
        }
        LoginUser loginUser = loadCusByCusname(username, password);
        LoginUser loginUser = loadCusByCusname(username,sfzh, password);
        if (loginUser == null) {
            return "用户名或密码错误";
        }
@@ -272,19 +273,24 @@
        return tokenService.createToken(loginUser);
    }
    public LoginUser loadCusByCusname(String username, String password) {
    public LoginUser loadCusByCusname(String username,String sfzh, String password) {
        LambdaQueryWrapper<TjCustomer> wq = new LambdaQueryWrapper<>();
        wq.eq(TjCustomer::getCusPhone, username);
        wq.eq(TjCustomer::getCusIdcard, sfzh);
        List<TjCustomer> customerList = customerService.list(wq);
        if (null == customerList || customerList.size() == 0) {
        if (null == customerList || customerList.isEmpty()) {
            //throw new ServiceException("登录用户:" + username + " 不存在");
            throw new ServiceException("账号或密码错误,请检查!");
        }
        for (TjCustomer tjCustomer : customerList) {
            try {
                password = RsaUtils.decryptByPrivateKey(password);
                boolean b = SecurityUtils.matchesPassword(password, tjCustomer.getCusPassword());
                if (b) {
//                password = RsaUtils.decryptByPrivateKey(password);
//                boolean b = SecurityUtils.matchesPassword(password, tjCustomer.getCusPassword());
//                if (b) {
//                    return createLoginCus(tjCustomer);
//                }
                password = DigestUtils.md5DigestAsHex(password.getBytes());
                if (password.equals(tjCustomer.getCusPassword())){
                    return createLoginCus(tjCustomer);
                }
            } catch (Exception e) {