Procházet zdrojové kódy

엑셀조회 개발중

eskim před 5 roky
rodič
revize
dea14ae439

+ 44 - 0
style24.admin/src/main/java/com/style24/admin/biz/dao/TsaCommonDao.java

@@ -0,0 +1,44 @@
+package com.style24.admin.biz.dao;
+
+import com.style24.core.support.annotation.ShopDs;
+import com.style24.persistence.domain.SearchData;
+
+/**
+ * 공용 Dao
+ *
+ * @author eskim
+ * @since 2020. 10. 22
+ */
+@ShopDs
+public interface TsaCommonDao {
+
+	/**
+	 * 엑셀조회를 위한 SEARCH 테이블 삭제
+	 *
+	 * @param searchData
+	 * @author eskim
+	 * @since 2020. 10. 22
+	 */
+	void deleteExceluploadSearCh(SearchData searchData);
+
+	/**
+	 * 엑셀조회를 위한 SEARCH 테이블 생성
+	 *
+	 * @param searchData
+	 * @author eskim
+	 * @since 2020. 10. 22
+	 */
+	void createExceluploadSearch(SearchData searchData);
+
+	/**
+	 * 엑셀조회를 위한 SEARCH 테이블 생성 - dummy 컬럼 포함
+	 *
+	 * @param searchData
+	 * @author eskim
+	 * @since 2020. 10. 22
+	 */
+	void createExceluploadSearchByAll(SearchData searchData);
+
+
+
+}

+ 61 - 0
style24.admin/src/main/java/com/style24/admin/biz/service/TsaCommonService.java

@@ -0,0 +1,61 @@
+package com.style24.admin.biz.service;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.style24.admin.biz.dao.TsaCommonDao;
+import com.style24.persistence.domain.SearchData;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 공용 Service
+ *
+ * @author eskim
+ * @since 2020. 10. 20
+ */
+@Service
+@Slf4j
+public class TsaCommonService {
+
+	@Autowired
+	private TsaCommonDao commonDao;
+
+	/**
+	 * 엑셀조회를 위한 SEARCH 테이블 삭제
+	 *
+	 * @param searchData
+	 * @return
+	 * @author eskim
+	 * @since 2020. 10. 22
+	 */
+	public void deleteExceluploadSearCh(SearchData searchData) {
+		commonDao.deleteExceluploadSearCh(searchData);
+	}
+
+	/**
+	 * 엑셀조회를 위한 SEARCH 테이블 생성
+	 *
+	 * @param searchData
+	 * @return
+	 * @author eskim
+	 * @since 2020. 10. 22
+	 */
+	public void createExceluploadSearch(SearchData searchData) {
+		commonDao.createExceluploadSearch(searchData);
+	}
+
+	/**
+	 * 엑셀조회를 위한 SEARCH 테이블 생성 - dummy 컬럼 포함
+	 *
+	 * @param searchData
+	 * @return
+	 * @author eskim
+	 * @since 2020. 10. 22
+	 */
+	public void createExceluploadSearchByAll(SearchData searchData) {
+		commonDao.createExceluploadSearchByAll(searchData);
+	}
+
+
+}

+ 76 - 5
style24.admin/src/main/java/com/style24/admin/biz/service/TsaGoodsService.java

@@ -1,5 +1,6 @@
 package com.style24.admin.biz.service;
 
+import java.io.IOException;
 import java.util.Collection;
 
 import org.springframework.beans.factory.annotation.Autowired;
@@ -20,12 +21,14 @@ import com.style24.persistence.domain.GoodsNotiInfo;
 import com.style24.persistence.domain.GoodsSearch;
 import com.style24.persistence.domain.Itemkind;
 import com.style24.persistence.domain.NotiInfo;
+import com.style24.persistence.domain.SearchData;
 
 import lombok.extern.slf4j.Slf4j;
 
 import com.gagaframework.excel.GagaExcelUtil;
 import com.gagaframework.excel.env.GagaExcelConstants;
 import com.gagaframework.web.parameter.GagaMap;
+import com.gagaframework.web.util.GagaFileUtil;
 import com.gagaframework.web.util.GagaStringUtil;
 
 /**
@@ -50,6 +53,9 @@ public class TsaGoodsService {
 	@Autowired
 	private TsaBusinessService businessService;
 
+	@Autowired
+	private TsaCommonService commonService;
+
 	/**
 	 * 품목 목록
 	 * @param itemkind
@@ -237,10 +243,10 @@ public class TsaGoodsService {
 					} else {
 
 						if (!StringUtils.isEmpty(gagaMap.get("IMG_PATH6"))) {
-							gagaMap.set("IMG_PATH1", targetPath + gagaMap.get("IMG_PATH6").toString().replace("/1000/", "/100/"));
+							gagaMap.set("IMG_PATH1", targetPath + gagaMap.get("IMG_PATH6").toString());
 
 						} else {
-							gagaMap.set("IMG_PATH1", targetPath + gagaMap.get("IMG_PATH1").toString().replace("/1000/", "/100/"));
+							gagaMap.set("IMG_PATH1", targetPath + gagaMap.get("IMG_PATH1").toString());
 						}
 					}
 				}
@@ -417,7 +423,7 @@ public class TsaGoodsService {
 						float pntPrate = 0;
 						float pntMrate = 0;
 						for (Brand tmpBrand : brandList) {
-							if ("10".equals(goods.getFormalGb())) {
+							if ("G009_10".equals(goods.getFormalGb())) {
 								pntPrate = tmpBrand.getPntPrate10();
 								pntMrate = tmpBrand.getPntMrate10();
 							} else {
@@ -433,7 +439,7 @@ public class TsaGoodsService {
 					Goods originGoods = goodsDao.getGoods(goods);
 
 					// 승인일
-					if (!goods.getGoodsStat().equals(originGoods.getGoodsStat()) && "90".equals(goods.getGoodsStat())) {
+					if (!goods.getGoodsStat().equals(originGoods.getGoodsStat()) && "G008_90".equals(goods.getGoodsStat())) {
 						goods.setChGoodsStatYn("Y");
 					}
 				}
@@ -458,7 +464,7 @@ public class TsaGoodsService {
 					float pntPrate = 0;
 					float pntMrate = 0;
 					for (Brand tmpBrand : brandList) {
-						if ("10".equals(goods.getFormalGb())) {
+						if ("G009_10".equals(goods.getFormalGb())) {
 							pntPrate = tmpBrand.getPntPrate10();
 							pntMrate = tmpBrand.getPntMrate10();
 						} else {
@@ -473,7 +479,72 @@ public class TsaGoodsService {
 			// 상품정보 변경
 			goodsDao.updateGoodsState(goods);
 		}
+	}
+
+	/**
+	 * 상품목록 엑셀조회용 상품 저장
+	 *
+	 * @param procJob : goodsExcelUpload
+	 * @param goodsList
+	 * @return
+	 * @author eskim
+	 * @since 2020. 10. 22
+	 */
+	@Transactional("shopTxnManager")
+	public void saveExceluploadGoodsList(Collection<Goods> goodsList, String excelFilename) {
+
+		String targetPath = GagaFileUtil.getConcatenationPath(env.getProperty("upload.excel.target.path"), "excel");
+		if (goodsList == null || goodsList.isEmpty()) {
+			this.deleteExceluploadFile(targetPath, excelFilename);
+			throw new IllegalStateException(message.getMessage("FAIL_1001"));
+		}
 
+		int index = 0;
+		String goodsCdFlag = "";
+		String goodsNumFlag = "";
+		for (Goods goods : goodsList) {
+
+			if (!StringUtils.isEmpty(goods.getGoodsCd())) {
+				goodsCdFlag = "Y";
+			}
+			if (!StringUtils.isEmpty(goods.getGoodsNum())) {
+				goodsNumFlag = "Y";
+			}
+
+			if (!StringUtils.isEmpty(goodsCdFlag) && !StringUtils.isEmpty(goodsNumFlag)) {
+				throw new IllegalStateException("상품코드와 품번코드 중 한 개의 셀에만 값을 입력해서 조회하세요.");
+			}
+
+			SearchData searchData = new SearchData();
+			searchData.setRegNo(goods.getRegNo());
+			searchData.setSearchCd(goods.getGoodsCd());
+			searchData.setDispOrd(index);
+			searchData.setDummy1(goods.getGoodsNum());
+			searchData.setDummy2("Y".equals(goodsCdFlag) ? "goodsCd" : "goodsNum");
+			if (index == 0) {
+				commonService.deleteExceluploadSearCh(searchData);
+			}
+
+			commonService.createExceluploadSearchByAll(searchData);
+			index++;
+		}
+	}
+
+	/**
+	 * 파일 삭제
+	 *
+	 * @param targetPath
+	 * @param excelFilename
+	 * @author eskim
+	 * @since 2020. 10. 22
+	 */
+	private void deleteExceluploadFile(String targetPath, String excelFilename) {
+		// 파일 삭제
+		try {
+			GagaFileUtil.deleteFile(GagaFileUtil.getConcatenationPath(targetPath, excelFilename));
+		} catch (IOException e) {
+			// Nothing Do
+		}
 	}
 
 }

+ 202 - 0
style24.admin/src/main/java/com/style24/admin/biz/web/TsaCommonController.java

@@ -0,0 +1,202 @@
+package com.style24.admin.biz.web;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.env.Environment;
+import org.springframework.core.io.InputStreamResource;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Controller;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.style24.admin.support.controller.TsaBaseController;
+
+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
+ * @since 2020. 10. 22
+ */
+@Controller
+@RequestMapping("/common")
+@Slf4j
+public class TsaCommonController extends TsaBaseController {
+
+
+	@Autowired
+	private Environment env;
+
+	@Value("${upload.default.target.path}")
+	private String uploadTargetPath;
+
+	/**
+	 * Download a file
+	 *
+	 * @param request - HttpServletRequest
+	 * @param downloadFile - 다운로드할 파일
+	 * @return
+	 * @throws IOException
+	 * @author gagamel
+	 * @since 2019. 12. 6
+	 */
+	@GetMapping("/file/download")
+	@ResponseBody
+	public ResponseEntity<InputStreamResource> downloadFile(HttpServletRequest request, @RequestParam("downloadFile") String downloadFile) throws IOException {
+		String fileName = StringUtils.replace(downloadFile, "../", "");
+		log.debug("fileName: {}", fileName);
+
+		String downloadPath = env.getProperty("download.path");
+		log.debug("downLoadPath :{}", downloadPath);
+
+		String fileNameWithPath = GagaFileUtil.getConcatenationPath(downloadPath, fileName);
+		log.debug("fileNameWithPath: {}", fileNameWithPath);
+
+		return GagaFileUtil.writeFile(request, fileNameWithPath);
+	}
+
+	/**
+	 * Upload a file
+	 *
+	 * @param subDir - 업로드 하위 디렉토리
+	 * @param policy - 업로드 정책
+	 * @param file - MultipartFile
+	 * @return 업로드한 파일의 정보
+	 * @throws IOException
+	 * @author gagamel
+	 * @since 2019. 12. 6
+	 */
+	@PostMapping("/file/upload")
+	@ResponseBody
+	public GagaUploadedFileInfo uploadFile(@RequestParam(value = "subDir") String subDir, @RequestParam(value = "policy", required = false) String policy, MultipartFile file) throws IOException {
+		if (StringUtils.isEmpty(policy)) {
+			policy = "default";
+		}
+
+		String targetPath = GagaFileUtil.getConcatenationPath(env.getProperty("upload." + policy + ".target.path"), subDir);
+
+		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();
+			}
+		}
+		return ufInfo;
+	}
+
+	/**
+	 * Delete a file
+	 *
+	 * @param subDir - 업로드 하위 디렉토리
+	 * @param fileNm - 파일명
+	 * @return
+	 * @throws IOException
+	 * @author sasa004
+	 * @since 2020. 04. 06
+	 */
+	@PostMapping("/file/delete")
+	@ResponseBody
+	public void deleteFile(@RequestParam(value = "subDir") String subDir, @RequestParam(value = "fileNm", required = false) String fileNm) throws IOException {
+		String targetPath = GagaFileUtil.getConcatenationPath(env.getProperty("upload.default.target.path"), subDir);
+
+		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();
+		}
+	}
+
+	/**
+	 * Upload files
+	 *
+	 * @param subDir - 업로드 하위 디렉토리
+	 * @param files - MultipartFile List
+	 * @return 업로드한 파일의 정보
+	 * @throws IOException
+	 * @author gagamel
+	 * @since 2019. 12. 6
+	 */
+	@PostMapping("/files/upload")
+	@ResponseBody
+	public Collection<GagaUploadedFileInfo> uploadFiles(@RequestParam(value = "subDir") String subDir, List<MultipartFile> files) throws IOException {
+		String targetPath = GagaFileUtil.getConcatenationPath(env.getProperty("upload.default.target.path"), subDir);
+		GagaFileUploadUtil fuUtil = new GagaFileUploadUtil(targetPath);
+
+		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();
+			}
+		}
+
+		return ufList;
+	}
+
+	/**
+	 * 엑셀 업로드 팝업
+	 *
+	 * @param procJob - 업무명
+	 * @param callBackFun - 콜백함수
+	 * @return
+	 * @author eskim
+	 * @since 2019. 12. 6
+	 */
+	@GetMapping("/excel/upload/popup/form")
+	public ModelAndView excelUploadPopupForm(@RequestParam(value = "procJob") String procJob, @RequestParam(value = "callBackFun", required = false) String callBackFun) {
+		ModelAndView mav = new ModelAndView();
+
+		GagaMap params = new GagaMap();
+		params.setString("procJob", procJob);
+		params.setString("callBackFun", callBackFun);
+
+		mav.addObject("params", params);
+
+		mav.setViewName("common/ExcelUploadPopupForm");
+
+		return mav;
+	}
+}

+ 48 - 5
style24.admin/src/main/java/com/style24/admin/biz/web/TsaGoodsController.java

@@ -1,5 +1,6 @@
 package com.style24.admin.biz.web;
 
+import java.util.ArrayList;
 import java.util.Collection;
 
 import javax.servlet.http.HttpServletRequest;
@@ -17,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.style24.admin.biz.service.TsaGoodsService;
 import com.style24.admin.biz.service.TsaRendererService;
 import com.style24.admin.support.controller.TsaBaseController;
@@ -31,6 +33,7 @@ import com.style24.persistence.domain.NotiInfo;
 
 import lombok.extern.slf4j.Slf4j;
 
+import com.gagaframework.excel.GagaExcelUtil;
 import com.gagaframework.web.parameter.GagaMap;
 import com.gagaframework.web.rest.server.GagaResponse;
 import com.gagaframework.web.rest.server.GagaResponseStatus;
@@ -384,7 +387,7 @@ public class TsaGoodsController extends TsaBaseController {
 	@PostMapping("/state/update")
 	@ResponseBody
 	public GagaMap updateGoodsState(@RequestBody Goods goods) {
-
+		log.info("updateGoodsState goods={}", goods);
 		GagaMap result = new GagaMap();
 		result.set("status", GagaResponseStatus.SUCCESS.getCode()); // 200
 		result.set("procJob", goods.getProcJob());
@@ -393,14 +396,14 @@ public class TsaGoodsController extends TsaBaseController {
 		String returnGoods = "";
 		String resultFlag = "SUCC";
 
-		if (!"0000".equals(TsaSession.getInfo().getRoleCd()) && !"A000".equals(TsaSession.getInfo().getRoleCd())
-			&& !"A001".equals(TsaSession.getInfo().getRoleCd()) && !"A100".equals(TsaSession.getInfo().getRoleCd())
-			&& !"A101".equals(TsaSession.getInfo().getRoleCd())) {
+		if (!"G001_0000".equals(TsaSession.getInfo().getRoleCd()) && !"G001_A000".equals(TsaSession.getInfo().getRoleCd())
+			&& !"G001_A001".equals(TsaSession.getInfo().getRoleCd()) && !"G001_A100".equals(TsaSession.getInfo().getRoleCd())
+			&& !"G001_A101".equals(TsaSession.getInfo().getRoleCd())) {
 			throw new IllegalStateException("권한이 없습니다.");
 		}
 
 		// 상품 상태 변경일 경우 체크
-		if ("goodsStat".equals(goods.getProcJob()) && ("40".equals(goods.getGoodsStat()) || "90".equals(goods.getGoodsStat()))) {
+		if ("goodsStat".equals(goods.getProcJob()) && ("G008_40".equals(goods.getGoodsStat()) || "G008_90".equals(goods.getGoodsStat()))) {
 
 			// 이미지
 			Collection<Goods> goodsList = goodsService.getGoodsImgsYn(goods);
@@ -467,6 +470,46 @@ public class TsaGoodsController extends TsaBaseController {
 		return result;
 	}
 
+	/**
+	 * 엑셀조회용 상품 저장- 상품목록용
+	 *
+	 * @param goods
+	 * @return
+	 * @throws Exception
+	 * @author eskim
+	 * @since 2020. 10. 20
+	 */
+	@PostMapping("/search/goodslist/excelupload/save")
+	@ResponseBody
+	public GagaResponse saveExceluploadGoodsList(@RequestBody Goods goods) throws Exception {
+
+		int cnt = 0;
+		ObjectMapper mapper = new ObjectMapper();
+
+		String targetPath = GagaFileUtil.getConcatenationPath(env.getProperty("upload.excel.target.path"), "excel");
+
+		// DB 처리 시 사용되는 파라미터명(셀명) 설정
+		String[] cellName = {"goodsCd", "goodsNum"};
+
+		Collection<GagaMap> ecxelGoodsList = GagaExcelUtil.getList(GagaFileUtil.getConcatenationPath(targetPath, goods.getExcelFileNm()), 0, cellName, 0);
+
+		Collection<Goods> goodsList = new ArrayList<>();
+		for (GagaMap map : ecxelGoodsList) {
+			Goods tmpGoods = mapper.convertValue(map, Goods.class);
+			tmpGoods.setRegNo(TsaSession.getInfo().getUserNo());
+			tmpGoods.setProcJob(goods.getProcJob());
+			goodsList.add(tmpGoods);
+			cnt++;
+		}
+
+		goodsService.saveExceluploadGoodsList(goodsList, goods.getExcelFileNm());
+
+		// 파일 삭제
+		GagaFileUtil.deleteFile(GagaFileUtil.getConcatenationPath(targetPath, goods.getExcelFileNm()));
+
+		return super.ok("");
+	}
+
 	/**
 	 * 상품 대량 등록 화면
 	 *

+ 5 - 5
style24.admin/src/main/java/com/style24/persistence/domain/Goods.java

@@ -91,15 +91,15 @@ public class Goods extends TscBaseDomain {
 	private String imgType;
 	private String imgPath1;
 	private String imgPath6;
-//
-//	private String niClsfNm;
+	private String niClsfNm;
+	private String goodsTypeNm;
 //
 //	private String goodsRegMsg;
 	private String procJob;
-//	private String excelFileNm;
+	private String excelFileNm;
 //	private String searchGb;
-//
-//	private String blankFlag;
+
+	private String blankFlag;
 //
 //	private Integer sizeCurrStockQty;
 //	private Integer sizeBaseStockQty;

+ 24 - 0
style24.admin/src/main/java/com/style24/persistence/domain/SearchData.java

@@ -0,0 +1,24 @@
+package com.style24.persistence.domain;
+
+import com.style24.persistence.TscBaseDomain;
+
+import lombok.Data;
+
+/**
+ * 엑셀조회를 위한 SEARCH_DATA Domain
+ *
+ * @author eskim
+ * @since 2020. 10. 22
+ */
+@SuppressWarnings("serial")
+@Data
+public class SearchData extends TscBaseDomain {
+
+	private String searchCd;
+	private int dispOrd;
+	private String procJob;
+	private String dummy1;
+	private String dummy2;
+	private String dummy3;
+
+}

+ 2 - 1
style24.admin/src/main/java/com/style24/persistence/mybatis/shop/TsaBusiness.xml

@@ -485,6 +485,7 @@
 		     , A.PNT_PRATE20                        /*포인트적립율(PC)*/
 		     , A.PNT_MRATE20                        /*포인트적립율(모바일)*/
 		     , A.DISP_ORD
+		     , A.SELF_YN
 		FROM TB_BRAND A
 		INNER JOIN TB_SUPPLY_COMPANY B ON A.SUPPLY_COMP_CD = B.SUPPLY_COMP_CD
 		LEFT OUTER JOIN TB_DELIVERY_LOC C ON A.DELV_LOC_CD = C.DELV_LOC_CD
@@ -508,7 +509,7 @@
 		<if test='useYn != null and useYn != ""'>
 		AND    A.USE_YN = #{useYn}
 		</if>
-		ORDER BY B.SELF_YN DESC, A.SUPPLY_COMP_CD, A.DISP_ORD
+		ORDER BY A.SELF_YN DESC, A.SUPPLY_COMP_CD, A.DISP_ORD
 	</select>
 	
 </mapper>

+ 58 - 0
style24.admin/src/main/java/com/style24/persistence/mybatis/shop/TsaCommon.xml

@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.style24.admin.biz.dao.TsaCommonDao">
+
+	<!-- 엑셀조회를 위한 SEARCH 테이블 삭제  -->
+	<delete id="deleteExceluploadSearCh" parameterType="SearchData">
+		/* TsaCommon.deleteExceluploadSearCh */
+		DELETE
+		FROM   TB_SEARCH_DATA
+		WHERE  REG_ID = #{regId}
+	</delete>
+
+	<!-- 엑셀조회를 위한 SEARCH 테이블  생성 -->
+	<insert id="createExceluploadSearch" parameterType="SearchData">
+		/* TsaCommon.createExceluploadSearch */
+		INSERT INTO TB_SEARCH_DATA (
+		        REG_NO
+		      , SEARCH_CD
+		      , DISP_ORD
+		 )
+		 SELECT #{regNo}
+		      , #{searchCd}
+		      , (SELECT COUNT(*) + 100
+		         FROM   TB_SEARCH_DATA
+		         WHERE  REG_NO = #{regNo})
+		 FROM   DUAL
+		 WHERE  (SELECT COUNT(*) FROM TB_SEARCH_DATA WHERE SEARCH_CD = #{searchCd} AND REG_NO = #{regNo}) = 0
+	</insert>
+	
+	<!-- 엑셀조회를 위한 SEARCH 테이블  생성 - dummy 컬럼 포함 -->
+	<insert id="createExceluploadSearchByAll" parameterType="SearchData">
+		/* TsaCommon.createExceluploadSearchByAll */
+		INSERT INTO TB_SEARCH_DATA (
+		        REG_NO
+		      , SEARCH_CD
+		      , DISP_ORD
+		      , DUMMY1
+		      , DUMMY2
+		      , DUMMY3
+		 )
+		 SELECT #{regNo}
+		      , #{searchCd}
+		      , (SELECT COUNT(*) + 100
+		         FROM   TB_SEARCH_DATA
+		         WHERE  REG_NO = #{regNo})
+		      , #{dummy1}
+		      , #{dummy2}
+		      , #{dummy3}
+		 FROM   DUAL
+		 WHERE  (SELECT COUNT(*) FROM TB_SEARCH_DATA
+		         WHERE SEARCH_CD = #{searchCd}
+		         AND DUMMY1 = #{dummy1}
+		         AND DUMMY2 = #{dummy2}
+		         AND DUMMY3 = #{dummy3}
+		         AND REG_NO = #{regNo}) = 0
+	</insert>
+	
+</mapper>

+ 44 - 19
style24.admin/src/main/java/com/style24/persistence/mybatis/shop/TsaGoods.xml

@@ -690,6 +690,7 @@
 		     , G.SEX_GB
 		     , G.GOODS_NUM
 		     , G.COLOR_CD
+		     , G.GOODS_TYPE
 		     , G.LIST_PRICE
 		     , G.CURR_PRICE
 		     , G.CURR_BPRICE
@@ -697,13 +698,15 @@
 		     , G.DC_RATE
 		     , G.GOODS_STAT
 		     , G.SELF_GOODS_YN
-		     , (SELECT COLOR_GRP_FILE 
-		        FROM TB_COLOR 
-		        WHERE SUPPLY_COMP_CD = G.SUPPLY_COMP_CD
-		        AND BRAND_CD = G.BRAND_CD
-		        AND COLOR_CD = G.COLOR_CD) AS COLOR_GRP_FILE
+		     , G.DISP_YN
+		     , G.GOODS_GB
+		     , G.DISTRIBUTION_GB
+		     /*, (SELECT COLOR_GRP_FILE 
+		        FROM TB_COLOR TC 
+		        WHERE TC.COLOR_CD = G.COLOR_CD) AS COLOR_GRP_FILE */
 		     , G.SUPPLY_COMP_CD
 		     , G.SUPPLY_GOODS_CD
+		     , G.AGE_GRP_CD
 		     , G.DELV_FEE
 		     , G.MIN_ORD_AMT
 		     , G.PNT_PRATE
@@ -715,14 +718,14 @@
 		     , G.PRE_MPNT_USABLE_YN
 		     , G.MIN_ORD_QTY
 		     , G.MAX_ORD_QTY
+		     , G.DAY_MAX_ORD_QTY
 		     , G.ERP_STOCK_LINK_YN
 		     , G.ERP_PRICE_LINK_YN
 		     , G.MAKE_NM
 		     , G.MAKE_YMD
-		     , G.BUYING_TYPE
-		     , G.SELF_MALL_YN
+		     , G.TAX_GB
 		     , G.GOODS_TYPE
-		     , (SELECT CD_NM FROM TB_COMMON_CODE WHERE CD_GB='G066' AND CD = G.GOODS_TYPE) AS GOODS_TYPE_NM
+		     , FN_GET_CODE_NM('G056', G.GOODS_TYPE) AS GOODS_TYPE_NM
 		     , DATE_FORMAT(G.FRST_CFRM_DT, '%Y%m%d%H%i%S') AS FRST_CFRM_DT
 		     , (SELECT I.NI_CLSF_CD FROM TB_ITEMKIND I WHERE I.ITEMKIND_CD = G.ITEMKIND_CD) AS NI_CLSF_CD
 		     , GI.IMG_TYPE
@@ -738,10 +741,10 @@
 		          , TB_COMMON_CODE B 
 		       WHERE A.ITEMKIND_CD = G.ITEMKIND_CD 
 		       AND A.NI_CLSF_CD = B.CD 
-		       AND B.CD_GB='G004') AS  NI_CLSF_NM
+		       AND B.CD_GB = 'G004') AS  NI_CLSF_NM
 		FROM TB_GOODS G
 		INNER JOIN TB_BRAND B ON G.BRAND_CD = B.BRAND_CD
-		OUTER JOIN TB_GOODS_IMG GI ON G.GOODS_CD = GI.GOODS_CD
+		LEFT OUTER JOIN TB_GOODS_IMG GI ON G.GOODS_CD = GI.GOODS_CD
 		WHERE 1 = 1 
 		<choose>
 		<when test="goodsCd != null and goodsCd != ''">
@@ -914,21 +917,15 @@
 		<if test="erpPriceLinkYn != null and erpPriceLinkYn != ''" >
 		    , ERP_PRICE_LINK_YN = #{erpPriceLinkYn}
 		</if>
-		<if test="erpInfoLinkYn != null and erpInfoLinkYn != ''" >
-		    , ERP_INFO_LINK_YN = #{erpInfoLinkYn}
-		</if>
-		<if test="erpTagPriceLinkYn != null and erpTagPriceLinkYn != ''" >
-		    , ERP_TAG_PRICE_LINK_YN = #{erpTagPriceLinkYn}
-		</if>
 		<if test="formalGb != null and formalGb != ''" >
 		    , FORMAL_GB = #{formalGb}
 		    , PNT_PRATE = IFNULL(#{pntPrate}, PNT_PRATE)
 		    , PNT_MRATE = IFNULL(#{pntMrate}, PNT_MRATE)
 		</if>
-		<if test="(formalGb == null or formalGb == '') and pntPrate != null" >
+		<if test='procJob == "pntPrate" and pntPrate != null' >
 		    , PNT_PRATE = #{pntPrate}
 		</if>
-		<if test="(formalGb == null or formalGb == '') and pntMrate != null" >
+		<if test='procJob == "pntMrate"  and pntMrate != null' >
 		    , PNT_MRATE = #{pntMrate}
 		</if>
 		<if test="returnableYn != null and returnableYn != ''" >
@@ -943,7 +940,7 @@
 		<if test="preMpntUsableYn != null and preMpntUsableYn != ''" >
 		    , PRE_MPNT_USABLE_YN = #{preMpntUsableYn}
 		</if>
-		<if test="minOrdAmt != null and minOrdAmt != ''" >
+		<if test='procJob == "minOrdAmt"  and minOrdAmt != null and minOrdAmt != ""' >
 		    , MIN_ORD_AMT = #{minOrdAmt}
 		</if>
 		<if test='blankFlag != null and blankFlag == "Y"'>
@@ -964,4 +961,32 @@
 		WHERE GOODS_CD = #{goodsCd}
 	</update>
 	
+	<!-- 상품 이미지 필수  항목 입력 여부  조회 -->
+	<select id="getGoodsImgsYn" parameterType="Goods" resultType="Goods">
+		/* TsaGoods.getGoodsImgsYn */
+		SELECT A.GOODS_CD
+		     , A.SUPPLY_COMP_CD
+		     , (SELECT I.NI_CLSF_CD FROM TB_ITEMKIND I WHERE I.ITEMKIND_CD = A.ITEMKIND_CD) AS NI_CLSF_CD
+		     , CASE WHEN B.IMG_PATH1 IS NULL THEN
+		            'N'
+		       ELSE
+		            'Y'
+		       END AS GOODS_IMAGE_YN
+		FROM TB_GOODS A
+		LEFT OUTER JOIN TB_GOODS_IMG B ON A.GOODS_CD = B.GOODS_CD
+		WHERE 1 = 1
+		<choose>
+		<when test="goodsCd != null and goodsCd != ''">
+		AND A.GOODS_CD  = #{goodsCd}
+		</when>
+		<otherwise>
+		AND A.GOODS_CD IN
+		    <foreach collection="arrGoodsCd" item="item" index="index"  open="(" close=")" separator=",">
+		#{item}
+		    </foreach>
+		</otherwise>
+		</choose>
+	</select>
+	
+	
 </mapper>

+ 102 - 0
style24.admin/src/main/webapp/WEB-INF/views/common/ExcelUploadPopupForm.html

@@ -0,0 +1,102 @@
+<!DOCTYPE html>
+<html lang="ko"
+	xmlns:th="http://www.thymeleaf.org">
+<!--
+ *******************************************************************************
+ * @source  : ExcelUploadPopupForm.html
+ * @desc    : 엑셀 업로드 팝업 Page
+ *============================================================================
+ * Pastelmall
+ * Copyright(C) 2019 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2020.10.22   eskim       최초 작성
+ *******************************************************************************
+ -->	
+	<ul class="popup modal"  data-width="600">
+		<li class="mdPopTitle">
+			<strong>엑셀업로드</strong>
+			<button type="button" class="close" onclick="uifnPopClose('popupExcelUpload')"><i class="fa fa-times"></i></button>
+		</li>
+		<li class="mdPopContent">
+		<form id="excelPopupForm" name="excelPopupForm"  action="">
+		<input type="hidden" name="procJob" id="procJob" th:value="${params.procJob}"/>
+		<input type="hidden" name="callBackFun" id="callBackFun" th:value="${params.callBackFun}"/>
+			<table class="frmStyle">
+			<colgroup>
+				<col style="width:20%;"/>
+				<col/>
+				<col style="width:20%;"/>
+			</colgroup>
+			<tbody>
+				<tr>
+					<th>파일</th>
+					<td><div class="uFile w300">
+							<input id="excelFile" name="excelFile" type="file" class="uFileInput"/>
+							<label for="excelFile" class="uFileLabel">파일선택</label>
+							<input type="hidden" name="OrgFileNm"/>
+							<input type="hidden" name="NewFileNm"/>
+						</div>
+					</td>
+				</tr>
+			</tbody>
+			</table>
+			<div class="tabBtnArea aR">
+				<button type="button" class="btn btn-success btn-lg" id="btnExcelUploadSave">저장</button>
+			</div>
+		</form>	
+		</li>
+	</ul>
+<script th:inline="javascript">
+/*<![CDATA[*/
+	
+	//첨부파일 등록
+	$('#excelPopupForm input[name=excelFile]').on('change', function() {
+		var file = this.files[0];
+	
+		if (typeof(file) == 'undefined'){
+			return;
+		}
+		
+		gagajf.ajaxFileUpload('/common/file/upload?subDir=/excel'
+				, file
+				, function(result) {
+					$('#excelPopupForm input[name=OrgFileNm]').val(result.newFileName);
+					$('#excelPopupForm input[name=NewFileNm]').val(result.newFileName);
+				}
+				, 'excel'
+		);
+	});
+	
+	//저장
+	$('#btnExcelUploadSave').on('click', function (){
+		
+		if(gagajf.isNull($("#excelPopupForm input[name=OrgFileNm]").val())){
+			mcxDialog.alert("파일을 첨부해 주세요.");
+			$("#excelPopupForm input[name=excelFile]").focus();
+			return false;
+		}
+		
+		var callback = $('#excelPopupForm input[name=callBackFun]').val();
+		if( typeof callback != 'undefined' && callback){
+			var data = {procJob : $('#excelPopupForm input[name=procJob]').val()
+						, callBackFun : $('#excelPopupForm input[name=callBackFun]').val()
+						, excelFileNm : $('#excelPopupForm input[name=NewFileNm]').val()
+						};
+			var jsonData = JSON.stringify(data);
+			if (typeof callback == 'function') {
+				callback(jsonData);
+			}else{
+				if( callback ) {
+					if( callback.indexOf("(") == -1 ) eval( callback +"(" + jsonData+")");
+					else eval( callback(jsonData) );
+				}
+			}
+			uifnPopClose('popupExcelUpload');
+		}
+	});	
+	
+/*]]>*/
+</script>
+</html>