增加userId登录
This commit is contained in:
parent
78b4a7d14e
commit
ca4fa4e66c
@ -92,6 +92,18 @@ public class LoginController {
|
||||
return Result.success(resultMap);
|
||||
}
|
||||
|
||||
@OperLog(operModul = "用户登录", operType = "用户id登录", operDesc = "用户id登录")
|
||||
@ApiOperation(value = "用户id登录", notes = "用户id登录", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "userId", required = true, value = "用户id", paramType = "body"),
|
||||
@ApiImplicitParam(name = "projectSn", required = false, value = "新用户账号类型需要传此参数", paramType = "body"),
|
||||
})
|
||||
@PostMapping(value = "/userId/login")
|
||||
public Result<Map<String, Object>> userIdLogin(@RequestBody Map<String, Object> map) {
|
||||
Map<String, Object> resultMap = systemUserService.userIdLogin(map);
|
||||
return Result.success(resultMap);
|
||||
}
|
||||
|
||||
@OperLog(operModul = "人员/设备登录", operType = "人员/设备登录", operDesc = "人员/设备登录")
|
||||
@ApiOperation(value = "人员/设备登录", notes = "人员/设备登录", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
|
||||
@ -78,6 +78,13 @@ public interface ISystemUserService extends IService<SystemUser> {
|
||||
|
||||
Map<String, Object> md5Login(Map<String, Object> map);
|
||||
|
||||
/**
|
||||
* 用户id登录
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> userIdLogin(Map<String, Object> map);
|
||||
|
||||
void xzUpdatePw(SystemUser systemUser);
|
||||
|
||||
List<SystemUser> getTenantListBySn(Map<String, Object> map);
|
||||
|
||||
@ -1541,6 +1541,21 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> userIdLogin(Map<String, Object> map) {
|
||||
try {
|
||||
SystemUser systemUser = systemUserMapper.selectById(MapUtils.getString(map, "userId"));
|
||||
if (systemUser == null || systemUser.getUserId() == null) {
|
||||
throw new OpenAlertException("账号不存在");
|
||||
}
|
||||
authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(systemUser.getAccount(), systemUser.getShowPassword()));
|
||||
return doLogin(map, systemUser);
|
||||
} catch (AuthenticationException e) {
|
||||
log.error("error:", e);
|
||||
throw new CustomException("Invalid username/password supplied", HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void xzUpdatePw(SystemUser systemUser) {
|
||||
Integer isCheckCode = systemUser.getIsCheckCode();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user