/**
* @see UserWebService#getUser()
*/
public GetUserResult getUser(Long id) {
GetUserResult result = new GetUserResult();
//校验请求参数
try {
Assert.notNull(id, "id参数为空");
} catch (IllegalArgumentException e) {
logger.error(e.getMessage());
return result.buildResult(WSResult.PARAMETER_ERROR, e.getMessage());
}
//获取用户
try {
User entity = accountManager.getInitedUser(id);
UserDTO dto = dozer.map(entity, UserDTO.class);
result.setUser(dto);
return result;
} catch (ObjectNotFoundException e) {
String message = "用户不存在(id:" + id + ")";
logger.error(message, e);
return result.buildResult(WSResult.PARAMETER_ERROR, message);
} catch (RuntimeException e) {
logger.error(e.getMessage(), e);
return result.buildDefaultErrorResult();
}
}