From 8d43111bd0e598bc0b2014cbfa69a32e74959dff Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Wed, 15 Dec 2021 19:24:05 +0800
Subject: [PATCH] ftp sql 同步封装

---
 src/main/java/org/springblade/modules/accreditation/controller/AccreditationRecordsController.java |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/springblade/modules/accreditation/controller/AccreditationRecordsController.java b/src/main/java/org/springblade/modules/accreditation/controller/AccreditationRecordsController.java
index 811945a..3eb7b09 100644
--- a/src/main/java/org/springblade/modules/accreditation/controller/AccreditationRecordsController.java
+++ b/src/main/java/org/springblade/modules/accreditation/controller/AccreditationRecordsController.java
@@ -338,14 +338,19 @@
 		if (list.size()<=7){
 			HSSFRow row = sheet.createRow(0);
 			row.setHeight((short) 1980);
+
 			HSSFRow row1 = sheet.createRow(1);
 			row1.setHeight((short) 300);
+
 			for (int i = 0; i < list.size(); i++) {
 				ExportSecurityPaperExcelVO checkWorkVo = list.get(i);
 				row1.createCell(i).setCellValue(checkWorkVo.getName());
 				//如果头像有
 				if (null != list.get(i).getAvatar() && list.get(i).getAvatar() != "") {
 					if (list.get(i).getAvatar().contains("http:")) {
+						//获取图片格式
+						int lastIndexOf = list.get(i).getAvatar().lastIndexOf(".");
+						String pictureType = list.get(i).getAvatar().substring(lastIndexOf + 1);
 						//画图的顶级管理器,一个sheet只能获取一个(一定要注意这点)
 						BufferedImage bufferImg = null;
 						//先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray
@@ -356,7 +361,7 @@
 							e.printStackTrace();
 						}
 						try {
-							ImageIO.write(bufferImg, "jpg", byteArrayOut);
+							ImageIO.write(bufferImg, pictureType, byteArrayOut);
 						} catch (IOException e) {
 							e.printStackTrace();
 						}
@@ -429,6 +434,9 @@
 			//如果头像有
 			if (null != list.get(i).getAvatar() && list.get(i).getAvatar() != "") {
 				if (list.get(i).getAvatar().contains("http:")) {
+					//获取图片格式
+					int lastIndexOf = list.get(i).getAvatar().lastIndexOf(".");
+					String pictureType = list.get(i).getAvatar().substring(lastIndexOf + 1);
 					//画图的顶级管理器,一个sheet只能获取一个(一定要注意这点)
 					BufferedImage bufferImg = null;
 					//先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray
@@ -439,7 +447,7 @@
 						e.printStackTrace();
 					}
 					try {
-						ImageIO.write(bufferImg, "jpg", byteArrayOut);
+						ImageIO.write(bufferImg, pictureType, byteArrayOut);
 					} catch (IOException e) {
 						e.printStackTrace();
 					}

--
Gitblit v1.9.3