|
|
@@ -3,6 +3,7 @@ package com.style24.core.biz.service;
|
|
|
import java.io.File;
|
|
|
import java.util.Collection;
|
|
|
|
|
|
+import com.style24.persistence.domain.LookbookBanner;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.core.env.Environment;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -61,6 +62,37 @@ public class TscLookbookService {
|
|
|
}
|
|
|
|
|
|
lookbookDao.saveLookbook(lookbook);
|
|
|
+
|
|
|
+ int ind = 1;
|
|
|
+ for(LookbookBanner bannerInfo : lookbook.getBannerList()){
|
|
|
+ if(bannerInfo.getSysFileNm() != null && !"".equals(bannerInfo.getSysFileNm())){
|
|
|
+ String imgInd = String.valueOf(ind);
|
|
|
+ if (ind < 10) {
|
|
|
+ imgInd = "0" + imgInd;
|
|
|
+ }
|
|
|
+ String bannerUploadPath = env.getProperty("upload.default.target.path");
|
|
|
+ bannerUploadPath = bannerUploadPath + "/display/";
|
|
|
+ String yearMonth = GagaDateUtil.getToday().substring(0, 6);
|
|
|
+ bannerUploadPath = GagaFileUtil.getConcatenationPath(bannerUploadPath, "lookbook/banner");
|
|
|
+ File newFile = new File(GagaFileUtil.getConcatenationPath(bannerUploadPath, bannerInfo.getSysFileNm()));
|
|
|
+ bannerUploadPath = GagaFileUtil.getConcatenationPath(bannerUploadPath, yearMonth);
|
|
|
+ String newFilename = "BANNER_" + GagaDateUtil.getTodayDateTime() + "_" + imgInd + "." + StringUtils.getFilenameExtension(bannerInfo.getSysFileNm());
|
|
|
+ File uniqueFile = GagaFileUtil.getUniqueFile(new File(GagaFileUtil.getConcatenationPath(bannerUploadPath, newFilename)));
|
|
|
+ // Rename a file
|
|
|
+ File path = new File(bannerUploadPath);
|
|
|
+ if (!path.exists()) {
|
|
|
+ path.mkdir();
|
|
|
+ }
|
|
|
+ newFile.renameTo(uniqueFile);
|
|
|
+ bannerInfo.setOrgFileNm("/lookbook/banner/" + yearMonth + "/" + newFilename);
|
|
|
+ bannerInfo.setSysFileNm("/lookbook/banner/" + yearMonth + "/" + newFilename);
|
|
|
+ }
|
|
|
+ ind++;
|
|
|
+ bannerInfo.setLookbookSq(lookbook.getLookbookSq());
|
|
|
+ bannerInfo.setRegNo(lookbook.getRegNo());
|
|
|
+ bannerInfo.setUpdNo(lookbook.getUpdNo());
|
|
|
+ lookbookDao.saveLookbookBanner(bannerInfo);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|