/** * gen images * * @param id * @throws Exception */ public void genImages(Model model) throws Exception { List<String> imgs = new ArrayList<>(); for (String img : model.getImages()) { imgs.add(imageService.getUrl(img).thumbnail(100, 100, "outbound").getUrl(model.getName())); } model.setImages(imgs); }
/** * Lấy thông tin chi tiết model theo id * * @param modelId * @return */ @RequestMapping(value = "/getmodel", method = RequestMethod.GET) @ResponseBody public Response get(@RequestParam(value = "id", defaultValue = "") String id) throws Exception { Model model = modelService.getModel(id); if (model == null) { throw new Exception("Model không tồn tại"); } List<String> images = model.getImages(); List<String> imgs = new ArrayList<>(); for (String img : images) { imgs.add(imageService.getUrl(img).thumbnail(100, 100, "outbound").getUrl(model.getName())); } model.setImages(imgs); model.setProperties(modelService.getProperties(model.getId())); ModelSeo modelSeo = modelService.getModelSeo(id); if (modelSeo != null) { model.setModelSeo(modelSeo); } return new Response(true, "Thông tin chi tiết model", model); }