|
|
@@ -1,6 +1,5 @@
|
|
|
package com.style24.admin.biz.web;
|
|
|
|
|
|
-import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.util.Collection;
|
|
|
import java.util.List;
|
|
|
@@ -31,13 +30,12 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import com.gagaframework.web.parameter.GagaMap;
|
|
|
import com.gagaframework.web.util.GagaFileUploadUtil;
|
|
|
import com.gagaframework.web.util.GagaFileUtil;
|
|
|
-import com.gagaframework.web.util.GagaFtpUtil;
|
|
|
import com.gagaframework.web.util.GagaUploadedFileInfo;
|
|
|
|
|
|
/**
|
|
|
* 공통 Controller
|
|
|
*
|
|
|
- * @author renderer
|
|
|
+ * @author gagamel
|
|
|
* @since 2020. 10. 22
|
|
|
*/
|
|
|
@Controller
|
|
|
@@ -45,14 +43,12 @@ import com.gagaframework.web.util.GagaUploadedFileInfo;
|
|
|
@Slf4j
|
|
|
public class TsaCommonController extends TsaBaseController {
|
|
|
|
|
|
-
|
|
|
@Autowired
|
|
|
private Environment env;
|
|
|
|
|
|
@Autowired
|
|
|
private TsaCommonService commonService;
|
|
|
|
|
|
-
|
|
|
@Value("${upload.default.target.path}")
|
|
|
private String uploadTargetPath;
|
|
|
|
|
|
@@ -104,17 +100,17 @@ public class TsaCommonController extends TsaBaseController {
|
|
|
GagaFileUploadUtil fuUtil = new GagaFileUploadUtil(targetPath, Long.parseLong(env.getProperty("upload." + policy + ".max.size")), env.getProperty("upload." + policy + ".allow.extension"), env.getProperty("upload." + policy + ".view"));
|
|
|
|
|
|
GagaUploadedFileInfo ufInfo = fuUtil.uploadFile(file);
|
|
|
- if (!"excel".equals(policy)) {
|
|
|
- // 운영서버에서만 FTP로 파일 업로드
|
|
|
- String profiles = env.getProperty("spring.profiles.active").toLowerCase();
|
|
|
- if ("run".equals(profiles) || "locp".equals(profiles)) {
|
|
|
- GagaFtpUtil ftpUtil = new GagaFtpUtil(env.getProperty("speedy.ftp.host"), env.getProperty("speedy.ftp.port"), env.getProperty("speedy.ftp.username"), env.getProperty("speedy.ftp.pwd"));
|
|
|
-
|
|
|
- File srcFile = new File(GagaFileUtil.getConcatenationPath(targetPath, ufInfo.getNewFileName()));
|
|
|
- ftpUtil.upload(srcFile, "/" + subDir);
|
|
|
- ftpUtil.close();
|
|
|
- }
|
|
|
- }
|
|
|
+// if (!"excel".equals(policy)) {
|
|
|
+// // 운영서버에서만 FTP로 파일 업로드
|
|
|
+// String profiles = env.getProperty("spring.profiles.active").toLowerCase();
|
|
|
+// if ("run".equals(profiles) || "locp".equals(profiles)) {
|
|
|
+// GagaFtpUtil ftpUtil = new GagaFtpUtil(env.getProperty("speedy.ftp.host"), env.getProperty("speedy.ftp.port"), env.getProperty("speedy.ftp.username"), env.getProperty("speedy.ftp.pwd"));
|
|
|
+//
|
|
|
+// File srcFile = new File(GagaFileUtil.getConcatenationPath(targetPath, ufInfo.getNewFileName()));
|
|
|
+// ftpUtil.upload(srcFile, "/" + subDir);
|
|
|
+// ftpUtil.close();
|
|
|
+// }
|
|
|
+// }
|
|
|
return ufInfo;
|
|
|
}
|
|
|
|
|
|
@@ -135,14 +131,14 @@ public class TsaCommonController extends TsaBaseController {
|
|
|
|
|
|
GagaFileUtil.deleteFile(GagaFileUtil.getConcatenationPath(targetPath, fileNm));
|
|
|
|
|
|
- // 운영서버이면 FTP 파일 삭제
|
|
|
- String profiles = env.getProperty("spring.profiles.active").toLowerCase();
|
|
|
- if ("run".equals(profiles) || "locp".equals(profiles)) {
|
|
|
- GagaFtpUtil ftpUtil = new GagaFtpUtil(env.getProperty("speedy.ftp.host"), env.getProperty("speedy.ftp.port"), env.getProperty("speedy.ftp.username"), env.getProperty("speedy.ftp.pwd"));
|
|
|
- log.debug("targetPath : " + targetPath);
|
|
|
- ftpUtil.delete("/" + subDir, fileNm);
|
|
|
- ftpUtil.close();
|
|
|
- }
|
|
|
+// // 운영서버이면 FTP 파일 삭제
|
|
|
+// String profiles = env.getProperty("spring.profiles.active").toLowerCase();
|
|
|
+// if ("run".equals(profiles) || "locp".equals(profiles)) {
|
|
|
+// GagaFtpUtil ftpUtil = new GagaFtpUtil(env.getProperty("speedy.ftp.host"), env.getProperty("speedy.ftp.port"), env.getProperty("speedy.ftp.username"), env.getProperty("speedy.ftp.pwd"));
|
|
|
+// log.debug("targetPath : " + targetPath);
|
|
|
+// ftpUtil.delete("/" + subDir, fileNm);
|
|
|
+// ftpUtil.close();
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -164,20 +160,20 @@ public class TsaCommonController extends TsaBaseController {
|
|
|
Collection<GagaUploadedFileInfo> ufList = fuUtil.uploadFiles(files);
|
|
|
log.debug("ufList: {}", ufList);
|
|
|
|
|
|
- // 운영서버에서만 FTP로 파일 업로드
|
|
|
- String profiles = env.getProperty("spring.profiles.active").toLowerCase();
|
|
|
- if ("run".equals(profiles) || "locp".equals(profiles)) {
|
|
|
- if (ufList != null && !ufList.isEmpty()) {
|
|
|
- GagaFtpUtil ftpUtil = new GagaFtpUtil(env.getProperty("speedy.ftp.host"), env.getProperty("speedy.ftp.port"), env.getProperty("speedy.ftp.username"), env.getProperty("speedy.ftp.pwd"));
|
|
|
-
|
|
|
- for (GagaUploadedFileInfo ufInfo : ufList) {
|
|
|
- File srcFile = new File(GagaFileUtil.getConcatenationPath(targetPath, ufInfo.getNewFileName()));
|
|
|
- ftpUtil.upload(srcFile, "/" + subDir);
|
|
|
- }
|
|
|
-
|
|
|
- ftpUtil.close();
|
|
|
- }
|
|
|
- }
|
|
|
+// // 운영서버에서만 FTP로 파일 업로드
|
|
|
+// String profiles = env.getProperty("spring.profiles.active").toLowerCase();
|
|
|
+// if ("run".equals(profiles) || "locp".equals(profiles)) {
|
|
|
+// if (ufList != null && !ufList.isEmpty()) {
|
|
|
+// GagaFtpUtil ftpUtil = new GagaFtpUtil(env.getProperty("speedy.ftp.host"), env.getProperty("speedy.ftp.port"), env.getProperty("speedy.ftp.username"), env.getProperty("speedy.ftp.pwd"));
|
|
|
+//
|
|
|
+// for (GagaUploadedFileInfo ufInfo : ufList) {
|
|
|
+// File srcFile = new File(GagaFileUtil.getConcatenationPath(targetPath, ufInfo.getNewFileName()));
|
|
|
+// ftpUtil.upload(srcFile, "/" + subDir);
|
|
|
+// }
|
|
|
+//
|
|
|
+// ftpUtil.close();
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
return ufList;
|
|
|
}
|
|
|
@@ -218,4 +214,5 @@ public class TsaCommonController extends TsaBaseController {
|
|
|
public String getSampleFileSystemFilename(@PathVariable("sampleFileId") String sampleFileId) {
|
|
|
return commonService.getSampleFileSystemFilename(sampleFileId);
|
|
|
}
|
|
|
+
|
|
|
}
|