use of org.mx.comps.jwt.AuthenticateAround in project main by JohnPeng739.
the class UserManageResource method saveUser.
@Path("users/{userId}")
@PUT
@AuthenticateAround(returnValueClass = DataVO.class)
public DataVO<UserVO> saveUser(@QueryParam("userCode") String userCode, @PathParam("userId") String userId, UserInfoVO userInfoVO) {
sessionDataStore.setCurrentUserCode(userCode);
try {
userInfoVO.setId(userId);
User user = userManageService.saveUser(userInfoVO.getUserInfo());
UserVO userVO = UserVO.transform(user);
sessionDataStore.removeCurrentUserCode();
return new DataVO<>(userVO);
} catch (UserInterfaceException ex) {
return new DataVO<>(ex);
} catch (Exception ex) {
if (logger.isErrorEnabled()) {
logger.error("Save user fail.", ex);
}
return new DataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
}
}
use of org.mx.comps.jwt.AuthenticateAround in project main by JohnPeng739.
the class UserManageResource method getUser.
@Path("users/{id}")
@GET
@AuthenticateAround(returnValueClass = DataVO.class)
public DataVO<UserVO> getUser(@PathParam("id") String id) {
try {
User user = accessor.getById(id, User.class);
UserVO userVO = UserVO.transform(user);
return new DataVO<>(userVO);
} catch (UserInterfaceException ex) {
return new DataVO<>(ex);
} catch (Exception ex) {
if (logger.isErrorEnabled()) {
logger.error("Get user fail.", ex);
}
return new DataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
}
}
Aggregations