no message

main
이범준 9 months ago
parent ff4acb043c
commit 69e189f834

@ -217,26 +217,28 @@ public class CmmnUtil {
/**
* .
* @param staticResourcePath
* @param staticResourcePath , replace
* @return
*/
public static String copyStaticResource(String staticResourcePath) {
public static String copyStaticResource(String staticResourcePath, boolean replace) {
try {
String folderPath = FilenameUtils.getFullPathNoEndSeparator(staticResourcePath);
String storageRoot = "files";
ClassPathResource cps = new ClassPathResource(staticResourcePath);
String fileName = cps.getFilename();
File newFile = new File(storageRoot + "/" + folderPath + "/" + fileName);
if(replace && newFile.exists()) {
return storageRoot + "/" + folderPath + "/" + fileName;
}
File folder = new File(storageRoot + "/" + folderPath);
if(!folder.exists()) {
folder.mkdirs();
}
ClassPathResource cps = new ClassPathResource(staticResourcePath);
String fileName = cps.getFilename();
InputStream is = cps.getInputStream();
File newFile = new File(storageRoot + "/" + folderPath + "/" + fileName);
Files.copy(is, newFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
return storageRoot + "/" + folderPath + "/" + fileName;

@ -473,7 +473,7 @@ public class IntegrationSearchServiceBean extends AbstractServiceBean implements
}
if(!imagePath.startsWith("files")) {
imagePath = CmmnUtil.copyStaticResource(imagePath);
imagePath = CmmnUtil.copyStaticResource(imagePath, false);
}
File imageFile = new File(imagePath);
@ -537,7 +537,7 @@ public class IntegrationSearchServiceBean extends AbstractServiceBean implements
}
if(!imagePaths.get(i).startsWith("files")) {
imagePaths.set(i, CmmnUtil.copyStaticResource(imagePaths.get(i)));
imagePaths.set(i, CmmnUtil.copyStaticResource(imagePaths.get(i), false));
}
String imagePath = imagePaths.get(i);
@ -661,7 +661,7 @@ public class IntegrationSearchServiceBean extends AbstractServiceBean implements
}
if(!orgnFilePath.startsWith("files")) {
orgnFilePath = CmmnUtil.copyStaticResource(orgnFilePath);;
orgnFilePath = CmmnUtil.copyStaticResource(orgnFilePath, false);
}
File orgnFile = new File(orgnFilePath);

Loading…
Cancel
Save