ソースを参照

엑셀 건수 체크

eskim 5 年 前
コミット
bdb7aa6c98

+ 7 - 0
src/main/java/com/style24/scm/biz/service/TssGoodsService.java

@@ -89,6 +89,8 @@ public class TssGoodsService {
 	private static final String UPDATE_NO_PATTERN = "X";
 
 	private static final String SELF_GOOODS_AFTER = "STY";
+	
+	private static final int EXCEL_ROW_COUNT = 1000;
 
 	/**
 	 * 상품 목록 건수
@@ -482,6 +484,11 @@ public class TssGoodsService {
 			throw new IllegalStateException(message.getMessage("FAIL_1001"));
 		}
 
+		//건수
+		if (goodsList != null && goodsList.size() > EXCEL_ROW_COUNT) {
+			throw new IllegalStateException("엑셀 파일의 건수를 " +EXCEL_ROW_COUNT + "건 이하로 사용하세요.");
+		}
+
 		int index = 0;
 		String goodsCdFlag = "";
 		String goodsNumFlag = "";

+ 7 - 0
src/main/java/com/style24/scm/biz/service/TssStockService.java

@@ -49,6 +49,8 @@ public class TssStockService {
 
 	@Autowired
 	private TssGoodsService goodsService;
+	
+	private static final int EXCEL_ROW_COUNT = 1000;
 
 	/**
 	 * 상품 사이즈별 재고 현황 목록 건수
@@ -128,6 +130,11 @@ public class TssStockService {
 			this.deleteExceluploadFile(targetPath, excelFilename);
 			throw new IllegalStateException(message.getMessage("FAIL_1001"));
 		}
+		
+		//건수
+		if (goodsSizeList != null && goodsSizeList.size() > EXCEL_ROW_COUNT) {
+			throw new IllegalStateException("엑셀 파일의 건수를 " +EXCEL_ROW_COUNT + "건 이하로 사용하세요.");
+		}
 
 		// 입력값 확인
 		String goodsSizeSoldoutCheck = getGoodsSizeSoldoutCheck(goodsSizeList);

+ 22 - 0
src/main/java/com/style24/scm/biz/web/TssGoodsController.java

@@ -81,6 +81,8 @@ public class TssGoodsController extends TssBaseController {
 	@Autowired
 	private TssCommonService commonService;
 
+	private static final int EXCEL_ROW_COUNT = 1000;
+	
 	/**
 	 * 상품목록 화면
 	 *
@@ -327,6 +329,11 @@ public class TssGoodsController extends TssBaseController {
 
 		Collection<GagaMap> ecxelGoodsList = GagaExcelUtil.getList(GagaFileUtil.getConcatenationPath(targetPath, goods.getExcelFileNm()), 0, cellName, 0);
 
+		//건수
+		if (ecxelGoodsList != null && ecxelGoodsList.size() > EXCEL_ROW_COUNT) {
+			throw new IllegalStateException("엑셀 파일의 건수를 " +EXCEL_ROW_COUNT + "건 이하로 사용하세요.");
+		}
+		
 		Collection<Goods> goodsList = new ArrayList<>();
 		for (GagaMap map : ecxelGoodsList) {
 			Goods tmpGoods = mapper.convertValue(map, Goods.class);
@@ -825,6 +832,11 @@ public class TssGoodsController extends TssBaseController {
 
 			ecxelGoodsList = GagaExcelUtil.getList(GagaFileUtil.getConcatenationPath(targetPath, goodsMass.getExcelFileNm()), 0, goodsNames, 0);
 
+			//건수
+			if (ecxelGoodsList != null && ecxelGoodsList.size() > EXCEL_ROW_COUNT) {
+				throw new IllegalStateException("엑셀 파일의 건수를 " +EXCEL_ROW_COUNT + "건 이하로 사용하세요.");
+			}
+			
 			for (GagaMap gagaMap : ecxelGoodsList) {
 				goodsService.createExceluploadSelfGoods(gagaMap, goodsMass.getProcJob());
 			}
@@ -842,6 +854,11 @@ public class TssGoodsController extends TssBaseController {
 
 			ecxelGoodsList = GagaExcelUtil.getList(GagaFileUtil.getConcatenationPath(targetPath, goodsMass.getExcelFileNm()), 0, goodsNames, 0);
 
+			//건수
+			if (ecxelGoodsList != null && ecxelGoodsList.size() > EXCEL_ROW_COUNT) {
+				throw new IllegalStateException("엑셀 파일의 건수를 " +EXCEL_ROW_COUNT + "건 이하로 사용하세요.");
+			}
+			
 			// 사용자의 관리 브랜드 조회
 			Collection<CommonCode> mdBrandList = rendererService.getAuthBrandList(TssSession.getInfo().getUserNo());
 
@@ -900,6 +917,11 @@ public class TssGoodsController extends TssBaseController {
 			throw new IllegalStateException("권한이 없습니다.");
 		}
 
+		//건수
+		if (ecxelGoodsList != null && ecxelGoodsList.size() > EXCEL_ROW_COUNT) {
+			throw new IllegalStateException("엑셀 파일의 건수를 " +EXCEL_ROW_COUNT + "건 이하로 사용하세요.");
+		}
+		
 		for (GagaMap gagaMap : ecxelGoodsList) {
 			goodsService.updateMassExceluploadGoods(gagaMap, goodsMass.getProcJob());
 		}

+ 8 - 2
src/main/java/com/style24/scm/biz/web/TssStockController.java

@@ -5,7 +5,6 @@ import java.util.Collection;
 
 import javax.servlet.http.HttpServletRequest;
 
-import com.style24.persistence.TscPageRequest;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.env.Environment;
 import org.springframework.core.io.InputStreamResource;
@@ -20,7 +19,7 @@ import org.springframework.web.servlet.ModelAndView;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.style24.core.support.message.TscMessageByLocale;
-
+import com.style24.persistence.TscPageRequest;
 import com.style24.persistence.domain.Color;
 import com.style24.persistence.domain.Goods;
 import com.style24.persistence.domain.GoodsSearch;
@@ -60,6 +59,8 @@ public class TssStockController extends TssBaseController {
 
 	@Autowired
 	private TssRendererService rendererService;
+	
+	private static final int EXCEL_ROW_COUNT = 1000;
 
 	/**
 	 * 사이즈별재고현황 화면
@@ -185,6 +186,11 @@ public class TssStockController extends TssBaseController {
 
 		Collection<GagaMap> ecxelGoodsList = GagaExcelUtil.getList(GagaFileUtil.getConcatenationPath(targetPath, goods.getExcelFileNm()), 0, cellName, 0);
 
+		//건수
+		if (ecxelGoodsList != null && ecxelGoodsList.size() > EXCEL_ROW_COUNT) {
+			throw new IllegalStateException("엑셀 파일의 건수를 " +EXCEL_ROW_COUNT + "건 이하로 사용하세요.");
+		}
+		
 		Collection<Option> goodsSizeList = new ArrayList<>();
 		for (GagaMap map : ecxelGoodsList) {
 			Option tmpGoods = mapper.convertValue(map, Option.class);