bug
This commit is contained in:
parent
b9e9256cf6
commit
9df392e6a0
@ -91,10 +91,11 @@ public class BackendLoginController extends BaseController {
|
||||
@Resource
|
||||
private LJDutyMapper ljDutyMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 后台登录
|
||||
* */
|
||||
@ApiOperation(value = "后台登录")
|
||||
@ApiOperation(value = "油站登录")
|
||||
@RequestMapping(value="/doLogin", method = RequestMethod.POST)
|
||||
@OperationServiceLog(description = "登录后台系统")
|
||||
public ResponseObject doLogin(HttpServletRequest request, @RequestBody LoginRequest loginRequest) {
|
||||
@ -104,6 +105,66 @@ public class BackendLoginController extends BaseController {
|
||||
String captchaCode = loginRequest.getCaptchaCode();
|
||||
String uuid = loginRequest.getUuid();
|
||||
|
||||
LambdaQueryWrapper<TAccount> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(TAccount::getAccountName, accountName);
|
||||
TAccount one = accountService.getOne(queryWrapper);
|
||||
if (ObjectUtils.isNotEmpty(one) && one.getOwnerId().toString().equals("2") ||one.getOwnerId().toString().equals("1") ){
|
||||
return getFailureResult(201,"请登录终台端!");
|
||||
}
|
||||
|
||||
|
||||
Boolean captchaVerify = captchaService.checkCodeByUuid(captchaCode, uuid);
|
||||
if (!captchaVerify) {
|
||||
return getFailureResult(201,"图形验证码有误");
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(accountName)|| StringUtil.isEmpty(password) || StringUtil.isEmpty(captchaCode)) {
|
||||
return getFailureResult(Constants.HTTP_RESPONSE_CODE_PARAM_ERROR);
|
||||
} else {
|
||||
AccountInfo accountInfo = accountService.getAccountByName(loginRequest.getUsername());
|
||||
if (accountInfo == null) {
|
||||
return getFailureResult(Constants.HTTP_RESPONSE_CODE_USER_LOGIN_ERROR);
|
||||
}
|
||||
TAccount tAccount = accountService.getAccountInfoById(accountInfo.getId());
|
||||
String myPassword = tAccount.getPassword();
|
||||
String inputPassword = accountService.getEntryptPassword(password, tAccount.getSalt());
|
||||
if (!myPassword.equals(inputPassword) || !tAccount.getAccountStatus().toString().equals("1")) {
|
||||
return getFailureResult(201, "账号或密码有误");
|
||||
}
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
UsernamePasswordToken info = new UsernamePasswordToken(accountInfo.getAccountName(), tAccount.getPassword());
|
||||
subject.login(info);
|
||||
String token = TokenUtil.generateToken(userAgent, accountInfo.getId());
|
||||
accountInfo.setToken(token);
|
||||
TokenUtil.saveAccountToken(accountInfo);
|
||||
LoginResponse response = new LoginResponse();
|
||||
response.setLogin(true);
|
||||
response.setToken(token);
|
||||
response.setTokenCreatedTime(new Date());
|
||||
return getSuccessResult(response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 后台登录
|
||||
* */
|
||||
@ApiOperation(value = "终台登录")
|
||||
@RequestMapping(value="/doLogins", method = RequestMethod.POST)
|
||||
@OperationServiceLog(description = "登录后台系统")
|
||||
public ResponseObject doLogins(HttpServletRequest request, @RequestBody LoginRequest loginRequest) {
|
||||
String userAgent = request.getHeader("user-agent");
|
||||
String accountName = loginRequest.getUsername();
|
||||
String password = loginRequest.getPassword();
|
||||
String captchaCode = loginRequest.getCaptchaCode();
|
||||
String uuid = loginRequest.getUuid();
|
||||
|
||||
LambdaQueryWrapper<TAccount> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(TAccount::getAccountName, accountName);
|
||||
TAccount one = accountService.getOne(queryWrapper);
|
||||
if (ObjectUtils.isNotEmpty(one) && one.getOwnerId().toString().equals("3")){
|
||||
return getFailureResult(201,"请登录油站端!");
|
||||
}
|
||||
|
||||
//不知道是哪个平台过来的请求
|
||||
/*LambdaQueryWrapper<TAccount> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(TAccount::getAccountName, accountName);
|
||||
|
Loading…
Reference in New Issue
Block a user