|
@@ -507,9 +507,13 @@ public class PersonService {
|
|
|
//保存的文件名
|
|
|
String saveFileName = DateUtils.getCurrYyyyMMddHHmmssDate() + "_" + UUID.randomUUID().toString() + "." + picData.suggestFileExtension();
|
|
|
logger.info("saveFileName== " + saveFileName);
|
|
|
- String savePath = idenRoot + "data/final/person/image/" + idenCommunity.getCode() + "/" + saveFileName;
|
|
|
+ String saveDir = idenRoot + "data/final/person/image/" + idenCommunity.getCode();
|
|
|
+ File saveDirFile = new File(saveDir);
|
|
|
+ if(!saveDirFile.exists()){
|
|
|
+ saveDirFile.mkdirs();
|
|
|
+ }
|
|
|
// 保存图片
|
|
|
- savePic(picData,savePath);
|
|
|
+ savePic(picData,saveDir,saveFileName);
|
|
|
personVO.setImage(fileUrl + "person/image/" + idenCommunity.getCode() +"/" + saveFileName);
|
|
|
}
|
|
|
|
|
@@ -565,9 +569,9 @@ public class PersonService {
|
|
|
return personIdList;
|
|
|
}
|
|
|
|
|
|
- private void savePic( PictureData picData,String savePath) throws Exception {
|
|
|
+ private void savePic( PictureData picData,String saveDir,String saveFileName) throws Exception {
|
|
|
byte[] data = picData.getData();
|
|
|
- FileOutputStream out = new FileOutputStream(savePath);
|
|
|
+ FileOutputStream out = new FileOutputStream(saveDir + "/" + saveFileName );
|
|
|
out.write(data);
|
|
|
out.close();
|
|
|
}
|