|
@@ -255,43 +255,46 @@ public class TFivesRegionController extends BaseController {
|
|
|
}
|
|
|
|
|
|
for (int i = 0; i < urls.size(); i++) {
|
|
|
- String url = urls.get(i);
|
|
|
- ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
|
|
|
- BufferedImage bufferImg = ImageIO.read(new File(RuoYiConfig.getProfile() + url.replaceFirst("/profile", "")));
|
|
|
- ImageIO.write(bufferImg, "jpg", byteArrayOut);
|
|
|
- int h = 0;
|
|
|
- int l = 0;
|
|
|
- int endh = 0;
|
|
|
- int endl = 0;
|
|
|
- if (urls.size() == 1) {
|
|
|
- endl = 5;
|
|
|
- endh = 10;
|
|
|
- }
|
|
|
- if (i == 0) {
|
|
|
- if (urls.size() == 2) {
|
|
|
+ try {
|
|
|
+ String url = urls.get(i);
|
|
|
+ ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
|
|
|
+ BufferedImage bufferImg = ImageIO.read(new File(RuoYiConfig.getProfile() + url.replaceFirst("/profile", "")));
|
|
|
+ ImageIO.write(bufferImg, "jpg", byteArrayOut);
|
|
|
+ int h = 0;
|
|
|
+ int l = 0;
|
|
|
+ int endh = 0;
|
|
|
+ int endl = 0;
|
|
|
+ if (urls.size() == 1) {
|
|
|
endl = 5;
|
|
|
+ endh = 10;
|
|
|
}
|
|
|
- } else if (i == 1) {
|
|
|
- if (urls.size() == 2) {
|
|
|
+ if (i == 0) {
|
|
|
+ if (urls.size() == 2) {
|
|
|
+ endl = 5;
|
|
|
+ }
|
|
|
+ } else if (i == 1) {
|
|
|
+ if (urls.size() == 2) {
|
|
|
+ h = 12;
|
|
|
+ endh = 10;
|
|
|
+ } else {
|
|
|
+ l = 5;
|
|
|
+ }
|
|
|
+ endl = 5;
|
|
|
+ } else if (i == 2) {
|
|
|
h = 12;
|
|
|
endh = 10;
|
|
|
- } else {
|
|
|
+ } else if (i == 3) {
|
|
|
l = 5;
|
|
|
+ endl = 5;
|
|
|
+ h = 12;
|
|
|
+ endh = 10;
|
|
|
}
|
|
|
- endl = 5;
|
|
|
- } else if (i == 2) {
|
|
|
- h = 12;
|
|
|
- endh = 10;
|
|
|
- } else if (i == 3) {
|
|
|
- l = 5;
|
|
|
- endl = 5;
|
|
|
- h = 12;
|
|
|
- endh = 10;
|
|
|
+ XSSFClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, 6 + l, 2 + h, 11 + endl, 14 + endh);
|
|
|
+ // 插入图片
|
|
|
+ patriarch.createPicture(anchor, wb.addPicture(byteArrayOut.toByteArray(), XSSFWorkbook.PICTURE_TYPE_JPEG));
|
|
|
+ byteArrayOut.close();
|
|
|
+ } catch (Exception e) {
|
|
|
}
|
|
|
- XSSFClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, 6 + l, 2 + h, 11 + endl, 14 + endh);
|
|
|
- // 插入图片
|
|
|
- patriarch.createPicture(anchor, wb.addPicture(byteArrayOut.toByteArray(), XSSFWorkbook.PICTURE_TYPE_JPEG));
|
|
|
- byteArrayOut.close();
|
|
|
}
|
|
|
}
|
|
|
List<String> urls = new ArrayList<>();
|
|
@@ -311,34 +314,38 @@ public class TFivesRegionController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
for (int i = 0; i < urls.size(); i++) {
|
|
|
- String url = urls.get(i);
|
|
|
- ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
|
|
|
- BufferedImage bufferImg = ImageIO.read(new File(RuoYiConfig.getProfile() + url.replaceFirst("/profile", "")));
|
|
|
- ImageIO.write(bufferImg, "jpg", byteArrayOut);
|
|
|
- int h = 0;
|
|
|
- int l = 0;
|
|
|
- int endh = 0;
|
|
|
- int endl = 0;
|
|
|
- if (urls.size() == 1) {
|
|
|
- endl = 1;
|
|
|
- endh = 2;
|
|
|
- }
|
|
|
- if (i == 1) {
|
|
|
- l = 1;
|
|
|
- endl = 1;
|
|
|
- } else if (i == 2) {
|
|
|
- h = 2;
|
|
|
- endh = 2;
|
|
|
- } else if (i == 3) {
|
|
|
- l = 1;
|
|
|
- endl = 1;
|
|
|
- h = 2;
|
|
|
- endh = 2;
|
|
|
+ try {
|
|
|
+ String url = urls.get(i);
|
|
|
+ ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
|
|
|
+ BufferedImage bufferImg = ImageIO.read(new File(RuoYiConfig.getProfile() + url.replaceFirst("/profile", "")));
|
|
|
+ ImageIO.write(bufferImg, "jpg", byteArrayOut);
|
|
|
+ int h = 0;
|
|
|
+ int l = 0;
|
|
|
+ int endh = 0;
|
|
|
+ int endl = 0;
|
|
|
+ if (urls.size() == 1) {
|
|
|
+ endl = 1;
|
|
|
+ endh = 2;
|
|
|
+ }
|
|
|
+ if (i == 1) {
|
|
|
+ l = 1;
|
|
|
+ endl = 1;
|
|
|
+ } else if (i == 2) {
|
|
|
+ h = 2;
|
|
|
+ endh = 2;
|
|
|
+ } else if (i == 3) {
|
|
|
+ l = 1;
|
|
|
+ endl = 1;
|
|
|
+ h = 2;
|
|
|
+ endh = 2;
|
|
|
+ }
|
|
|
+ XSSFClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, 0 + l, 14 + h, 1 + endl, 16 + endh);
|
|
|
+ // 插入图片
|
|
|
+ patriarch.createPicture(anchor, wb.addPicture(byteArrayOut.toByteArray(), XSSFWorkbook.PICTURE_TYPE_JPEG));
|
|
|
+ byteArrayOut.close();
|
|
|
+ } catch (Exception e) {
|
|
|
+ continue;
|
|
|
}
|
|
|
- XSSFClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, 0 + l, 14 + h, 1 + endl, 16 + endh);
|
|
|
- // 插入图片
|
|
|
- patriarch.createPicture(anchor, wb.addPicture(byteArrayOut.toByteArray(), XSSFWorkbook.PICTURE_TYPE_JPEG));
|
|
|
- byteArrayOut.close();
|
|
|
}
|
|
|
String fileName = DateUtils.dateTimeNow() + "_" + tFivesRegion.getPersonLiable() + ".xlsx";
|
|
|
wb.write(Files.newOutputStream(Paths.get(filePath + "/" + fileName)));
|