| | |
| | | ArrayList<ImageData> imageDataList = new ArrayList<>(); |
| | | if (StringUtils.isNotBlank(a.getReportMaterials())) { |
| | | String[] urls = a.getReportMaterials().split(","); |
| | | for (int i = 0; i < urls.length; i++) { |
| | | if (urls.length==1){ |
| | | int width=600; |
| | | try { |
| | | ImageData imageData = new ImageData(); |
| | | imageData.setImage(IoUtils.toByteArray(new URL(minIOService.getPreviewFileUrl(urls[i])).openConnection().getInputStream())); |
| | | imageData.setLeft(width/ urls.length*i); |
| | | imageData.setRight(width-width/ urls.length*(i+1)); |
| | | imageData.setImage(IoUtils.toByteArray(new URL(minIOService.getPreviewFileUrl(urls[0])).openConnection().getInputStream())); |
| | | imageData.setRight(width/2); |
| | | imageDataList.add(imageData); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }else { |
| | | for (int i = 0; i < urls.length; i++) { |
| | | int width = 600; |
| | | try { |
| | | ImageData imageData = new ImageData(); |
| | | imageData.setImage(IoUtils.toByteArray(new URL(minIOService.getPreviewFileUrl(urls[i])).openConnection().getInputStream())); |
| | | imageData.setLeft(width / urls.length * i); |
| | | imageData.setRight(width - width / urls.length * (i + 1)); |
| | | imageDataList.add(imageData); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | objectWriteCellData.setImageDataList(imageDataList); |