|
|
@@ -0,0 +1,185 @@
|
|
|
+package com.style24.admin.biz.service;
|
|
|
+
|
|
|
+import java.util.Collection;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import com.gagaframework.excel.GagaExcelUtil;
|
|
|
+import com.gagaframework.excel.env.GagaExcelConstants;
|
|
|
+import com.gagaframework.web.parameter.GagaMap;
|
|
|
+import com.style24.admin.biz.dao.TsaShoplinkerDao;
|
|
|
+import com.style24.admin.support.env.TsaConstants;
|
|
|
+import com.style24.core.support.message.TscMessageByLocale;
|
|
|
+import com.style24.persistence.domain.ShoplinkerInvoice;
|
|
|
+import com.style24.persistence.domain.ShoplinkerOrder;
|
|
|
+import com.style24.persistence.domain.ShoplinkerSearch;
|
|
|
+
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 영업망관리 샵링커 Service
|
|
|
+ *
|
|
|
+ * @author gagamel
|
|
|
+ * @since 2020. 11. 4
|
|
|
+ */
|
|
|
+@Service
|
|
|
+@Slf4j
|
|
|
+@SuppressWarnings("deprecation")
|
|
|
+public class TsaShoplinkerService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TscMessageByLocale message;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TsaShoplinkerDao shoplinkerDao;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 상품등록-상품 목록 엑셀다운로드
|
|
|
+ *
|
|
|
+ * @param shoplinkerSearch
|
|
|
+ * @param excelFilenameWithPath - 경로를 포함한 엑셀파일명
|
|
|
+ * @return
|
|
|
+ * @author jmh
|
|
|
+ * @since 2021. 06. 29
|
|
|
+ */
|
|
|
+ public void getGoodsSendExcelList(ShoplinkerSearch shoplinkerSearch, String excelFilenameWithPath) {
|
|
|
+
|
|
|
+ // 헤더 title 설정
|
|
|
+ String[] listTitles = {"샵링커상품코드", "API구분", "IF결과", "IF결과메세지", "자사상품코드", "자사옵션코드", "등록자", "전송일자"};
|
|
|
+
|
|
|
+ // DB 처리 시 사용되는 파라미터명(셀명) 설정
|
|
|
+ String[] cellNames = {"API_PRODUCT_ID", "API_TYPE", "API_RESULT", "API_MESSAGE", "GOODS_CD", "OPT_CD", "REG_NM", "REG_DT"};
|
|
|
+
|
|
|
+ String[] cellTypes = {
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name(),
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_LEFT.name(),
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name(),
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name()};
|
|
|
+
|
|
|
+ Collection<GagaMap> dataList = shoplinkerDao.getGoodsSendExcelList(shoplinkerSearch);
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ GagaExcelUtil.createExcel(excelFilenameWithPath, dataList, "샵링커 상품 정보", listTitles, cellNames, cellTypes, TsaConstants.EXCEL_FOOTER_TITLE);
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new IllegalStateException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 재고전송-목록 엑셀다운로드
|
|
|
+ *
|
|
|
+ * @param shoplinkerSearch
|
|
|
+ * @param excelFilenameWithPath - 경로를 포함한 엑셀파일명
|
|
|
+ * @return
|
|
|
+ * @author jmh
|
|
|
+ * @since 2021. 06. 29
|
|
|
+ */
|
|
|
+ public void getStockExcelList(ShoplinkerSearch shoplinkerSearch, String excelFilenameWithPath) {
|
|
|
+
|
|
|
+ // 헤더 title 설정
|
|
|
+ String[] listTitles = {"IF결과", "IF결과메세지", "상품코드", "상품명", "옵션코드", "옵션1", "옵션2", "재고", "전송일자"};
|
|
|
+
|
|
|
+ // DB 처리 시 사용되는 파라미터명(셀명) 설정
|
|
|
+ String[] cellNames = {"API_RESULT", "API_MESSAGE", "GOODS_CD", "GOODS_NM", "OPT_CD", "OPT_CD1", "OPT_CD2", "QUANTITY", "REG_DT"};
|
|
|
+
|
|
|
+ String[] cellTypes = {
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_LEFT.name(),
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name(),
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name(),
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_LEFT.name(),
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name()};
|
|
|
+
|
|
|
+ Collection<GagaMap> dataList = shoplinkerDao.getStockExcelList(shoplinkerSearch);
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ GagaExcelUtil.createExcel(excelFilenameWithPath, dataList, "샵링커 재고 정보", listTitles, cellNames, cellTypes, TsaConstants.EXCEL_FOOTER_TITLE);
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new IllegalStateException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 주문수집-목록 엑셀다운로드
|
|
|
+ *
|
|
|
+ * @param shoplinkerSearch
|
|
|
+ * @param excelFilenameWithPath - 경로를 포함한 엑셀파일명
|
|
|
+ * @return
|
|
|
+ * @author jmh
|
|
|
+ * @since 2021. 06. 29
|
|
|
+ */
|
|
|
+ public void getOrderExcelList(ShoplinkerOrder shoplinkerOrder, String excelFilenameWithPath) {
|
|
|
+
|
|
|
+ // 헤더 title 설정
|
|
|
+ String[] listTitles = { "제휴몰주문등록상태", "실패사유", "업로드실패사유", "스타일24 주문번호", "샵링커 주문번호", "쇼핑몰 주문번호", "쇼핑몰 명", "배송상태[발주확인]"
|
|
|
+ ,"주문 상품번호", "샵링커 상품번호", "자사 상품코드", "상품명", "주문수량", "주문금액", "판매단가", "공급가", "옵션명", "주문수집일자", "제휴몰등록일"};
|
|
|
+
|
|
|
+ // DB 처리 시 사용되는 파라미터명(셀명) 설정
|
|
|
+ String[] cellNames = {"UPLOAD_STAT", "UPLOAD_FAIL_CD", "UPLOAD_FAIL_REASON", "ORD_NO", "SHOPLINKER_ORDER_ID", "EXTMALL_ORDER_ID", "MALL_NAME", "BAESONG_STATUS"
|
|
|
+ , "ORDER_PRODUCT_ID", "SHOPLINKER_PRODUCT_ID", "PARTNER_PRODUCT_ID", "PRODUCT_NAME", "QUANTITY", "ORDER_PRICE", "SALE_PRICE", "SUPPLY_PRICE", "SKU", "ORDER_REG_DATE", "EXTMALL_REG_DT"};
|
|
|
+
|
|
|
+ String[] cellTypes = {
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_LEFT.name(),
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name(),
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name(),
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_LEFT.name(),
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_LEFT.name(),
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name(),
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name(),
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_LEFT.name(),
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_LEFT.name(),
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name()};
|
|
|
+
|
|
|
+ Collection<GagaMap> dataList = shoplinkerDao.getOrderExcelList(shoplinkerOrder);
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ GagaExcelUtil.createExcel(excelFilenameWithPath, dataList, "샵링커 주문 정보", listTitles, cellNames, cellTypes, TsaConstants.EXCEL_FOOTER_TITLE);
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new IllegalStateException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 송장전송-목록 엑셀다운로드
|
|
|
+ *
|
|
|
+ * @param shoplinkerSearch
|
|
|
+ * @param excelFilenameWithPath - 경로를 포함한 엑셀파일명
|
|
|
+ * @return
|
|
|
+ * @author jmh
|
|
|
+ * @since 2021. 06. 29
|
|
|
+ */
|
|
|
+ public void getInvoiceExcelList(ShoplinkerInvoice shoplinkerInvoice, String excelFilenameWithPath) {
|
|
|
+
|
|
|
+ // 헤더 title 설정
|
|
|
+ String[] listTitles = {"IF결과", "IF결과메세지", "샵링커 주문번호", "쇼핑몰 주문번호", "스타일24 주문번호", "주문상세번호", "배송업체", "송장번호", "전송일시"};
|
|
|
+
|
|
|
+ // DB 처리 시 사용되는 파라미터명(셀명) 설정
|
|
|
+ String[] cellNames = {"API_RESULT", "API_MESSAGE", "AGENT_ORDER_ID", "EXTMALL_ORDER_ID", "ORD_NO", "ORD_DTL_NO", "SHIP_COMP_NM", "DELIVERY_INVOICE", "REG_DT"};
|
|
|
+
|
|
|
+ String[] cellTypes = {
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_LEFT.name(),
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name(),
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name(),
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_LEFT.name(),
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name()};
|
|
|
+
|
|
|
+ Collection<GagaMap> dataList = shoplinkerDao.getInvoiceExcelList(shoplinkerInvoice);
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ GagaExcelUtil.createExcel(excelFilenameWithPath, dataList, "샵링커 송장 정보", listTitles, cellNames, cellTypes, TsaConstants.EXCEL_FOOTER_TITLE);
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new IllegalStateException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|