自测问题修改
This commit is contained in:
parent
ed1564e307
commit
d48af7fd7d
|
|
@ -238,6 +238,7 @@ public class ImportExcelUtils {
|
|||
* @throws IOException
|
||||
*/
|
||||
public static Map<String, PictureData> getPicturesXlsx(XSSFSheet sheet, String className) throws IOException {
|
||||
List<String> keyNameList = new ArrayList<>();
|
||||
Map<String, PictureData> map = new HashMap<>(16);
|
||||
List<POIXMLDocumentPart> list = sheet.getRelations();
|
||||
for (POIXMLDocumentPart part : list) {
|
||||
|
|
@ -267,12 +268,17 @@ public class ImportExcelUtils {
|
|||
keyName = "";
|
||||
}
|
||||
map.put(keyName, picture.getPictureData());
|
||||
keyNameList.add(keyName);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("模版中包含非图片(jpeg、jpg、png)的文件,请仔细检查");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Set<String> setList = new HashSet<>(keyNameList);
|
||||
if(setList.size()!=keyNameList.size()){
|
||||
throw new RuntimeException("模版中人脸照片单元格存在多张图片,请仔细检查");
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
|
@ -284,6 +290,7 @@ public class ImportExcelUtils {
|
|||
* @throws IOException
|
||||
*/
|
||||
public static Map<String, PictureData> getPicturesXls(HSSFSheet sheet, String className) throws IOException {
|
||||
List<String> keyNameList = new ArrayList<>();
|
||||
int i = 0;
|
||||
Map<String, PictureData> map = new HashMap<String, PictureData>(16);
|
||||
if (sheet.getDrawingPatriarch() != null) {
|
||||
|
|
@ -307,10 +314,15 @@ public class ImportExcelUtils {
|
|||
keyName = "file" + "_" + cAnchor.getRow1() + "_1";
|
||||
}
|
||||
map.put(keyName, picture.getPictureData());
|
||||
keyNameList.add(keyName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Set<String> setList = new HashSet<>(keyNameList);
|
||||
if(setList.size()!=keyNameList.size()){
|
||||
throw new RuntimeException("模版中人脸照片单元格存在多张图片,请仔细检查");
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue