This commit is contained in:
wangzhijiang
2024-03-21 15:37:49 +08:00
parent 7f3e750265
commit 3ed114cc4f
2 changed files with 5 additions and 27 deletions
@@ -1480,8 +1480,11 @@ public class FileSpiltService {
HttpResponse res = client.execute(post);
String results = EntityUtils.toString(res.getEntity());
if (StringUtils.isNotEmpty(results) && !StringUtils.equals(results,"非法请求!") && !StringUtils.equals(results,"非法参数!")) {
result = new File(results);
if (StringUtils.isNotEmpty(results)) {
boolean errorFlag = (StringUtils.equals(results,"非法请求!") || StringUtils.equals(results,"非法参数!") || StringUtils.equals(results,"转换失败!"));
if (!errorFlag) {
result = new File(results);
}
}
} catch (Exception e) {
e.printStackTrace();
@@ -606,31 +606,6 @@ public class POIReadExcelToHtml {
return sheetIndexPicMap;
}
public static void printImg(List<Map<String, PictureData>> sheetList) throws IOException {
for (Map<String, PictureData> map : sheetList) {
printImg(map);
}
}
public static void printImg(Map<String, PictureData> map) throws IOException {
Object key[] = map.keySet().toArray();
for (int i = 0; i < map.size(); i++) {
// 获取图片流
PictureData pic = map.get(key[i]);
// 获取图片索引
String picName = key[i].toString();
// 获取图片格式
String ext = pic.suggestFileExtension();
byte[] data = pic.getData();
FileOutputStream out = new FileOutputStream("D:\\pic" + picName + "." + ext);
out.write(data);
out.flush();
out.close();
}
}
private static int[] getColsOfTable(Sheet sheet) {
int[] data = {0, 0};
for (int i = sheet.getFirstRowNum(); i < sheet.getLastRowNum(); i++) {