update 聊天室遗漏队列添加,dgb系列幸运值全网报块数问题
This commit is contained in:
@@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
@@ -49,6 +50,19 @@ public class TokenController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 后台管理系统登录
|
||||
* @param loginManageBody
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("managerLogin")
|
||||
@ApiOperation(value = "后台管理系统登录")
|
||||
public R<Map<String,Object>> managerLogin(@RequestBody @Valid LoginManageBody loginManageBody)
|
||||
{
|
||||
return sysLoginService.managerLogin(loginManageBody);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("registerCode")
|
||||
public R<?> emailCode(@Validated @RequestBody GetEmailCodeEntity entity)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,11 @@ import com.m2pool.system.api.model.LoginUser;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
@@ -232,6 +236,86 @@ public class SysLoginService {
|
||||
return R.success(tokenService.createToken(userInfo));
|
||||
}
|
||||
|
||||
|
||||
public R<Map<String,Object>> managerLogin(LoginManageBody loginManageBody){
|
||||
//邮箱
|
||||
String email = loginManageBody.getUserName();
|
||||
|
||||
//String password= loginBody.getPassword();
|
||||
String password="";
|
||||
|
||||
try {
|
||||
password = RsaUtils.decryptByPrivateKey(loginManageBody.getPassword());
|
||||
password = StringUtils.clean(password);
|
||||
}catch (Exception e){
|
||||
return R.fail(401,"加密密码传参有误");
|
||||
}
|
||||
// 用户名或密码为空 错误
|
||||
if (StringUtils.isAnyBlank(email, password))
|
||||
{
|
||||
recordLogininfor(email, Constants.LOGIN_FAIL, "邮箱/密码必须填写");
|
||||
throw new ServiceException("邮箱/密码必须填写");
|
||||
}
|
||||
if(!StringUtils.isBlank(email)){
|
||||
if(!email.matches(EMAIL_REGEX)){
|
||||
throw new ServiceException("邮箱格式错误");
|
||||
}
|
||||
}else {
|
||||
throw new ServiceException("邮箱为必填项");
|
||||
}
|
||||
|
||||
// 密码如果不在指定范围内 错误
|
||||
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|
||||
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH)
|
||||
{
|
||||
recordLogininfor(email, Constants.LOGIN_FAIL, "用户密码不在指定范围");
|
||||
throw new ServiceException("用户密码不在指定范围");
|
||||
}
|
||||
// 查询用户信息
|
||||
R<LoginUser> userResult = remoteUserService.getUserInfo(email, SecurityConstants.INNER);
|
||||
|
||||
if (R.FAIL == userResult.getCode())
|
||||
{
|
||||
throw new ServiceException(userResult.getMsg());
|
||||
}
|
||||
|
||||
if (StringUtils.isNull(userResult.getData()))
|
||||
{
|
||||
recordLogininfor(email, Constants.LOGIN_FAIL, "登录用户不存在");
|
||||
throw new ServiceException("登录用户:" + email + " 不存在");
|
||||
}
|
||||
LoginUser userInfo = userResult.getData();
|
||||
SysUser user = userResult.getData().getSysUser();
|
||||
Set<String> roles = userInfo.getRoles();
|
||||
|
||||
|
||||
|
||||
if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
|
||||
{
|
||||
recordLogininfor(email, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
|
||||
throw new ServiceException("对不起,您的账号:" + email + " 已被删除");
|
||||
}
|
||||
if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
|
||||
{
|
||||
recordLogininfor(email, Constants.LOGIN_FAIL, "用户已停用,请联系管理员");
|
||||
throw new ServiceException("对不起,您的账号:" + email + " 已停用");
|
||||
}
|
||||
|
||||
if(!SecurityUtils.matchesPassword(password, user.getPassword())){
|
||||
throw new ServiceException("密码错误,请重新输入");
|
||||
}
|
||||
|
||||
//必须是管理员才能登录
|
||||
if(!roles.contains("3")){
|
||||
recordLogininfor(email, Constants.LOGIN_FAIL, "对不起,您的账号没有权限不能登录后台管理");
|
||||
throw new ServiceException("对不起,您的账号:" + email + " 没有权限不能登录后台管理");
|
||||
}
|
||||
|
||||
recordLogininfor(email, Constants.LOGIN_SUCCESS, "后台管理系统用户登录成功");
|
||||
|
||||
return R.success(tokenService.createToken(userInfo));
|
||||
}
|
||||
|
||||
public void logout(String loginName)
|
||||
{
|
||||
recordLogininfor(loginName, Constants.LOGOUT, "退出成功");
|
||||
|
||||
Reference in New Issue
Block a user