public Optional<GetCategoryResponseDto> GetCategory(AppUser foundUser) throws Exception {
Optional<GetCategoryResponseDto> optional;
JSONParser parser = new JSONParser();
org.json.simple.JSONObject json;
//fix for lazy user details not loaded
if (foundUser.getAppUserDetail() == null) {
foundUser = appUserService.findByID(foundUser.getId()).orElseThrow(() -> new ModelNotFoundException("Invalid user"));
}
LOGGER.debug("foundUser {} ", gson.toJson(foundUser.getAppUserDetail().getPhoneNumber()));
String output = getCategoryServiceController.myGetCategory();
LOGGER.debug("output {} ", output);
json = (JSONObject) parser.parse(output);
ObjectMapper mapper = new ObjectMapper();
GetCategoryResponseDto dto = new GetCategoryResponseDto();
dto = mapper.readValue((DataInput) json, GetCategoryResponseDto.class);
return Optional.of(dto);
这就是更新后的代码,仍然是这一行“ GetCategoryResponseDto dto = mapper.readValue(json, GetCategoryResponseDto.class);” 仍然导致语法错误
湖上湖
相关分类