| | |
| | | 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; |
| | |
| | | * @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")){ |
| | |
| | | } |
| | | |
| | | |
| | | LoginUser loginUser = loadCusByCusname(username, password); |
| | | LoginUser loginUser = loadCusByCusname(username,sfzh, password); |
| | | if (loginUser == null) { |
| | | return "用户名或密码错误"; |
| | | return null; |
| | | } |
| | | // 限制账户不允许多终端登录 |
| | | if (!soloLogin) { |
| | |
| | | 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) { |