feat: bug-558 登录售后服务系统PC客户端,或APP端。优先取代理商账号,以代理商账号为准。没有代理商账号,再取管理端内部账号
This commit is contained in:
parent
da854f9c38
commit
c83cebf5f6
|
|
@ -14,6 +14,8 @@ import com.nflg.mobilebroken.common.util.*;
|
||||||
import com.nflg.mobilebroken.repository.entity.AdminUser;
|
import com.nflg.mobilebroken.repository.entity.AdminUser;
|
||||||
import com.nflg.mobilebroken.repository.entity.AppUser;
|
import com.nflg.mobilebroken.repository.entity.AppUser;
|
||||||
import com.nflg.mobilebroken.repository.service.*;
|
import com.nflg.mobilebroken.repository.service.*;
|
||||||
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
@ -48,6 +50,7 @@ public class AppController extends ControllerBase {
|
||||||
@Resource
|
@Resource
|
||||||
private IAdminUserRoleMapService adminUserRoleMapService;
|
private IAdminUserRoleMapService adminUserRoleMapService;
|
||||||
|
|
||||||
|
private static final PasswordEncoder PASSWORDENCODER = new BCryptPasswordEncoder();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户端登录
|
* 用户端登录
|
||||||
|
|
@ -59,6 +62,8 @@ public class AppController extends ControllerBase {
|
||||||
public ApiResult<AppLoginVO> login(String userName, String password) {
|
public ApiResult<AppLoginVO> login(String userName, String password) {
|
||||||
AppUser user = appUserService.getUser(userName, password);
|
AppUser user = appUserService.getUser(userName, password);
|
||||||
if (Objects.nonNull(user)) {
|
if (Objects.nonNull(user)) {
|
||||||
|
VUtils.trueThrowBusinessError(!PASSWORDENCODER.matches(password, user.getPassword()))
|
||||||
|
.throwMessage(dictionaryItemTranslateService.getValueByCode(Constant.DICTIONARY_SYSTEMERROR, Constant.DICTIONARY_ITEM_INCORRECTUSERNAMEORPASSWORD, MultilingualUtil.getLanguage()));
|
||||||
VUtils.trueThrow(Objects.equals(user.getState(), UserState.Disabled.getState()))
|
VUtils.trueThrow(Objects.equals(user.getState(), UserState.Disabled.getState()))
|
||||||
.throwMessage(STATE.PassportErr, dictionaryItemTranslateService.getValueByCode(Constant.DICTIONARY_SYSTEMERROR, Constant.DICTIONARY_ITEM_ACCOUNT_DISABLED, user.getLanguageCode()));
|
.throwMessage(STATE.PassportErr, dictionaryItemTranslateService.getValueByCode(Constant.DICTIONARY_SYSTEMERROR, Constant.DICTIONARY_ITEM_ACCOUNT_DISABLED, user.getLanguageCode()));
|
||||||
VUtils.trueThrow(Objects.equals(user.getState(), UserState.ToBeActivated.getState()))
|
VUtils.trueThrow(Objects.equals(user.getState(), UserState.ToBeActivated.getState()))
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,10 @@ import com.nflg.mobilebroken.common.exception.NflgException;
|
||||||
import com.nflg.mobilebroken.common.pojo.PageData;
|
import com.nflg.mobilebroken.common.pojo.PageData;
|
||||||
import com.nflg.mobilebroken.common.pojo.request.*;
|
import com.nflg.mobilebroken.common.pojo.request.*;
|
||||||
import com.nflg.mobilebroken.common.pojo.vo.*;
|
import com.nflg.mobilebroken.common.pojo.vo.*;
|
||||||
import com.nflg.mobilebroken.common.util.*;
|
import com.nflg.mobilebroken.common.util.AdminUserUtil;
|
||||||
|
import com.nflg.mobilebroken.common.util.AppUserUtil;
|
||||||
|
import com.nflg.mobilebroken.common.util.PageUtil;
|
||||||
|
import com.nflg.mobilebroken.common.util.VUtils;
|
||||||
import com.nflg.mobilebroken.repository.entity.*;
|
import com.nflg.mobilebroken.repository.entity.*;
|
||||||
import com.nflg.mobilebroken.repository.mapper.AppUserMapper;
|
import com.nflg.mobilebroken.repository.mapper.AppUserMapper;
|
||||||
import com.nflg.mobilebroken.repository.service.*;
|
import com.nflg.mobilebroken.repository.service.*;
|
||||||
|
|
@ -75,8 +78,6 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
|
||||||
.eq(AppUser::getIsDel, false)
|
.eq(AppUser::getIsDel, false)
|
||||||
.eq(AppUser::getLoginName, userName)
|
.eq(AppUser::getLoginName, userName)
|
||||||
.one();
|
.one();
|
||||||
VUtils.trueThrowBusinessError(Objects.isNull(user) || !PASSWORDENCODER.matches(password, user.getPassword()))
|
|
||||||
.throwMessage(dictionaryItemTranslateService.getValueByCode(Constant.DICTIONARY_SYSTEMERROR, Constant.DICTIONARY_ITEM_INCORRECTUSERNAMEORPASSWORD, MultilingualUtil.getLanguage()));
|
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue