|
|
@@ -0,0 +1,1233 @@
|
|
|
+package com.style24.admin.biz.service;
|
|
|
+
|
|
|
+import java.io.File;
|
|
|
+import java.io.IOException;
|
|
|
+import java.net.URLEncoder;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Collection;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.core.env.Environment;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import com.gagaframework.excel.GagaExcelUtil;
|
|
|
+import com.gagaframework.excel.env.GagaExcelConstants;
|
|
|
+import com.gagaframework.shoplinker.GagaShoplinkertUtil;
|
|
|
+import com.gagaframework.shoplinker.env.GagaShoplinkerConstants;
|
|
|
+import com.gagaframework.web.parameter.GagaMap;
|
|
|
+import com.gagaframework.web.util.GagaDateUtil;
|
|
|
+import com.gagaframework.web.util.GagaFileUtil;
|
|
|
+import com.style24.admin.biz.dao.TsaShoplinkerDao;
|
|
|
+import com.style24.admin.support.env.TsaConstants;
|
|
|
+import com.style24.core.biz.dao.TscShoplinkerDao;
|
|
|
+import com.style24.core.support.message.TscMessageByLocale;
|
|
|
+import com.style24.persistence.domain.ExtmallOrder;
|
|
|
+import com.style24.persistence.domain.ShoplinkerGoods;
|
|
|
+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 Environment env;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TscMessageByLocale message;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TsaShoplinkerDao admShoplinkerDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TscShoplinkerDao tscShoplinkerDao;
|
|
|
+
|
|
|
+ private String fileAddNm; // 유저번호_년월일시분초
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 샵링커 상품등록
|
|
|
+ *
|
|
|
+ * @param shoplinkerGoods
|
|
|
+ * @return
|
|
|
+ * @author jmh
|
|
|
+ * @since 2021. 5. 20
|
|
|
+ */
|
|
|
+ public GagaMap createShoplinkerXml(Collection<GagaMap> ecxelGoodsList, ShoplinkerGoods shoplinkerGoods)throws IOException {
|
|
|
+ // 파일명 추가 네이밍 규칙
|
|
|
+ fileAddNm = shoplinkerGoods.getRegNo() +"_"+ GagaDateUtil.getTodayDateTime();
|
|
|
+
|
|
|
+ GagaMap rtnMap = new GagaMap();
|
|
|
+ int optionAll=0, optionSucc=0;
|
|
|
+ int excelCnt= ecxelGoodsList.size();
|
|
|
+ int tProdSucc = 0, productSucc=0, goodsNotiSucc=0, certSucc=0, imageSucc=0;
|
|
|
+
|
|
|
+ for (GagaMap gagaMap : ecxelGoodsList) {
|
|
|
+ if( !"".equals(gagaMap.getString("goodsCd").trim())) {
|
|
|
+ shoplinkerGoods.setGoodsCd(gagaMap.getString("goodsCd"));
|
|
|
+
|
|
|
+ // 1. 단품생성
|
|
|
+ rtnMap = createOptionRegisterXml(shoplinkerGoods);
|
|
|
+ optionAll += rtnMap.getInt("allCnt");
|
|
|
+ optionSucc += rtnMap.getInt("succCnt");
|
|
|
+
|
|
|
+ // 2. 상품생성
|
|
|
+ tProdSucc = createGoodsRegisterXml(shoplinkerGoods);
|
|
|
+ productSucc += tProdSucc;
|
|
|
+
|
|
|
+ // 3. 고시정보(품목정보)
|
|
|
+ goodsNotiSucc += createGoodsNotiRegisterXml(shoplinkerGoods);
|
|
|
+
|
|
|
+ // 4. 인증정보
|
|
|
+ certSucc += createCertRegisterXml(shoplinkerGoods);
|
|
|
+
|
|
|
+ // 5. 상품이미지정보
|
|
|
+ imageSucc += createImageRegisterXml(shoplinkerGoods);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ rtnMap = new GagaMap();
|
|
|
+ rtnMap.setInt("excelCnt", excelCnt);
|
|
|
+ rtnMap.setInt("optionAll", optionAll);
|
|
|
+ rtnMap.setInt("optionSucc", optionSucc);
|
|
|
+ rtnMap.setInt("productSucc", productSucc);
|
|
|
+ rtnMap.setInt("goodsNotiSucc", goodsNotiSucc);
|
|
|
+ rtnMap.setInt("certSucc", certSucc);
|
|
|
+ rtnMap.setInt("imageSucc", imageSucc);
|
|
|
+
|
|
|
+ return rtnMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 샵링커 상품등록 - 1. 단품생성
|
|
|
+ *
|
|
|
+ * @param shoplinkerGoods
|
|
|
+ * @return
|
|
|
+ * @author jmh
|
|
|
+ * @since 2021. 5. 20
|
|
|
+ */
|
|
|
+ private GagaMap createOptionRegisterXml(ShoplinkerGoods shoplinkerGoods) throws IOException {
|
|
|
+
|
|
|
+ GagaMap returnMap = new GagaMap();
|
|
|
+ ShoplinkerGoods regMap = new ShoplinkerGoods();
|
|
|
+ regMap.setApiType("OPTION");
|
|
|
+ regMap.setApiSubUrl(env.getProperty("shoplinker.url.option"));
|
|
|
+ regMap.setGoodsCd(shoplinkerGoods.getGoodsCd());
|
|
|
+ regMap.setRegNo(shoplinkerGoods.getRegNo());
|
|
|
+ regMap.setXmlPath(shoplinkerGoods.getXmlPath());
|
|
|
+ regMap.setDomainUrl(shoplinkerGoods.getDomainUrl());
|
|
|
+
|
|
|
+ int succCnt = 0;
|
|
|
+ int allCnt = 0;
|
|
|
+
|
|
|
+ try {
|
|
|
+ // 옵션 목록조회
|
|
|
+ Collection<ShoplinkerGoods> list = admShoplinkerDao.getOptionList(shoplinkerGoods);
|
|
|
+ if( null != list && !list.isEmpty()) {
|
|
|
+ allCnt = list.size();
|
|
|
+
|
|
|
+ StringBuilder sbRequest;
|
|
|
+ int opCnt = 0;
|
|
|
+ for (ShoplinkerGoods map : list) {
|
|
|
+ opCnt ++;
|
|
|
+
|
|
|
+ // xml 데이터 세팅
|
|
|
+ sbRequest = new StringBuilder();
|
|
|
+ sbRequest.append("<?xml version=\"1.0\" encoding=\"euc-kr\"?>\n");
|
|
|
+ sbRequest.append("<shoplinker>\n");
|
|
|
+ sbRequest.append(" <productInfo>\n");
|
|
|
+ sbRequest.append(" <product>\n");
|
|
|
+
|
|
|
+ sbRequest.append(" <customer_id>").append(shoplinkerGoods.getCustomerId()).append("</customer_id>\n");
|
|
|
+ sbRequest.append(" <partner_product_id><![CDATA[").append(map.getPartnerProductId()).append("]]></partner_product_id>\n");
|
|
|
+ sbRequest.append(" <attribute_code><![CDATA[").append("999999999").append("]]></attribute_code>\n");
|
|
|
+ sbRequest.append(" <product_name><![CDATA[").append(map.getOptCd1()+"_"+map.getOptCd2()).append("]]></product_name>\n");
|
|
|
+ sbRequest.append(" <quantity>").append(map.getQuantity()).append("</quantity>\n");
|
|
|
+
|
|
|
+ sbRequest.append(" </product>\n");
|
|
|
+ sbRequest.append(" </productInfo>\n");
|
|
|
+ sbRequest.append("</shoplinker>\n");
|
|
|
+
|
|
|
+ regMap.setOptCd(map.getPartnerProductId());
|
|
|
+ regMap.setQuantity(map.getQuantity());
|
|
|
+
|
|
|
+ // api 호출 및 결과 history 저장
|
|
|
+ succCnt += callGoodsRegApi(regMap , sbRequest, "option_"+opCnt);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch(Exception e) {
|
|
|
+ log.error("xml 생성오류 ", e);
|
|
|
+ regMap.setApiResult("error");
|
|
|
+ regMap.setApiMessage("xml 생성오류");
|
|
|
+ tscShoplinkerDao.insertShoplinerApiHst(regMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ returnMap.setInt("allCnt", allCnt);
|
|
|
+ returnMap.setInt("succCnt", succCnt);
|
|
|
+
|
|
|
+ return returnMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 샵링커 상품등록 - 2. 상품생성
|
|
|
+ *
|
|
|
+ * @param shoplinkerGoods
|
|
|
+ * @return
|
|
|
+ * @author jmh
|
|
|
+ * @since 2021. 5. 20
|
|
|
+ */
|
|
|
+ public int createGoodsRegisterXml(ShoplinkerGoods shoplinkerGoods) throws IOException {
|
|
|
+
|
|
|
+ ShoplinkerGoods regMap = new ShoplinkerGoods();
|
|
|
+ regMap.setApiType("PRODUCT");
|
|
|
+ regMap.setApiSubUrl(env.getProperty("shoplinker.url.product"));
|
|
|
+ regMap.setGoodsCd(shoplinkerGoods.getGoodsCd());
|
|
|
+ regMap.setRegNo(shoplinkerGoods.getRegNo());
|
|
|
+ regMap.setXmlPath(shoplinkerGoods.getXmlPath());
|
|
|
+ regMap.setDomainUrl(shoplinkerGoods.getDomainUrl());
|
|
|
+
|
|
|
+ int succCnt = 0;
|
|
|
+
|
|
|
+ try {
|
|
|
+ // 상품기본정보
|
|
|
+ ShoplinkerGoods goodsMap = admShoplinkerDao.getGoods(shoplinkerGoods);
|
|
|
+
|
|
|
+ // 상품상세(퍼블) 세팅
|
|
|
+ String detailDesc = this.setDetailDesc(shoplinkerGoods, goodsMap);
|
|
|
+
|
|
|
+ // xml 데이터 세팅
|
|
|
+ StringBuilder sbRequest = new StringBuilder();
|
|
|
+ sbRequest.append("<?xml version=\"1.0\" encoding=\"euc-kr\"?>\n");
|
|
|
+ sbRequest.append("<shoplinker>\n");
|
|
|
+ sbRequest.append(" <productInfo>\n");
|
|
|
+ sbRequest.append(" <product>\n");
|
|
|
+
|
|
|
+ sbRequest.append(" <customer_id>").append(shoplinkerGoods.getCustomerId()).append("</customer_id>\n");
|
|
|
+ sbRequest.append(" <partner_product_id>").append(goodsMap.getGoodsCd()).append("</partner_product_id>\n");
|
|
|
+ sbRequest.append(" <attribute_title_code>").append("999999999").append("</attribute_title_code>\n");
|
|
|
+ sbRequest.append(" <attribute_partner_product_id>").append(goodsMap.getAttributePartnerProductId()).append("</attribute_partner_product_id>\n");
|
|
|
+ sbRequest.append(" <product_name>").append(goodsMap.getProductName()).append("</product_name>\n");
|
|
|
+ sbRequest.append(" <detail_desc>").append(detailDesc).append("</detail_desc>\n");
|
|
|
+
|
|
|
+ // 가격연계
|
|
|
+ if( "Y".equals(goodsMap.getSyncYn())) {
|
|
|
+ //sbRequest.append(" <new_desc_top>").append(goodsMap.getNewDescTop()).append("</new_desc_top>\n");
|
|
|
+ //sbRequest.append(" <market_price>").append(goodsMap.getMarketPrice()).append("</market_price>\n");
|
|
|
+ sbRequest.append(" <sale_price>").append(goodsMap.getSalePrice()).append("</sale_price>\n");
|
|
|
+ sbRequest.append(" <supply_price>").append(goodsMap.getSupplyPrice()).append("</supply_price>\n");
|
|
|
+ //sbRequest.append(" <market_price_p>").append(goodsMap.getMarketPriceP()).append("</market_price_p>\n");
|
|
|
+ //sbRequest.append(" <sale_price_p>").append(goodsMap.getSalePriceP()).append("</sale_price_p>\n");
|
|
|
+ //sbRequest.append(" <supply_price_p>").append(goodsMap.getSupplyPriceP()).append("</supply_price_p>\n");
|
|
|
+ }else{
|
|
|
+ //sbRequest.append(" <new_desc_top>").append(goodsMap.getNewDescTop()).append("</new_desc_top>\n");
|
|
|
+ //sbRequest.append(" <market_price>").append(goodsMap.getMarketPrice()).append("</market_price>\n");
|
|
|
+ sbRequest.append(" <sale_price>").append(0).append("</sale_price>\n");
|
|
|
+ sbRequest.append(" <supply_price>").append(0).append("</supply_price>\n");
|
|
|
+ //sbRequest.append(" <market_price_p>").append(goodsMap.getMarketPriceP()).append("</market_price_p>\n");
|
|
|
+ //sbRequest.append(" <sale_price_p>").append(goodsMap.getSalePriceP()).append("</sale_price_p>\n");
|
|
|
+ //sbRequest.append(" <supply_price_p>").append(goodsMap.getSupplyPriceP()).append("</supply_price_p>\n");
|
|
|
+ }
|
|
|
+
|
|
|
+ sbRequest.append(" <sale_status>").append("001").append("</sale_status>\n"); // 판매중
|
|
|
+ sbRequest.append(" <tax_yn>").append("001").append("</tax_yn>\n"); // 과세
|
|
|
+ sbRequest.append(" <salearea>전국</salearea>\n");
|
|
|
+ sbRequest.append(" <sex>").append(goodsMap.getSex()).append("</sex>\n");
|
|
|
+ sbRequest.append(" <model>").append(goodsMap.getModel()).append("</model>\n");
|
|
|
+ sbRequest.append(" <model_no>").append(goodsMap.getModelNo()).append("</model_no>\n");
|
|
|
+ sbRequest.append(" <brand>").append(goodsMap.getBrand()).append("</brand>\n");
|
|
|
+ sbRequest.append(" <auth_no>").append(goodsMap.getAuthNo()).append("</auth_no>\n");
|
|
|
+ sbRequest.append(" <expirydate>20991231</expirydate>\n");
|
|
|
+ sbRequest.append(" <maker>").append(goodsMap.getMaker()).append("</maker>\n");
|
|
|
+ sbRequest.append(" <origin>").append(goodsMap.getOrigin()).append("</origin>\n");
|
|
|
+ sbRequest.append(" <adult_info>").append(goodsMap.getAdultInfo()).append("</adult_info>\n");
|
|
|
+ sbRequest.append(" <ccategory_l>").append(goodsMap.getCcategoryL()).append("</ccategory_l>\n");
|
|
|
+ sbRequest.append(" <ccategory_m>").append(goodsMap.getCcategoryM()).append("</ccategory_m>\n");
|
|
|
+ sbRequest.append(" <ccategory_s>").append(goodsMap.getCcategoryS()).append("</ccategory_s>\n");
|
|
|
+ sbRequest.append(" <ccategory_d>").append(goodsMap.getCcategoryD()).append("</ccategory_d>\n");
|
|
|
+
|
|
|
+ sbRequest.append(" </product>\n");
|
|
|
+ sbRequest.append(" </productInfo>\n");
|
|
|
+ sbRequest.append("</shoplinker>\n");
|
|
|
+
|
|
|
+ if( null != goodsMap.getShoplinkerItemkindNm()) {
|
|
|
+ // api 호출 및 결과 history 저장
|
|
|
+ succCnt = callGoodsRegApi(regMap , sbRequest, "product");
|
|
|
+
|
|
|
+ }else {
|
|
|
+ // 품목매핑정보 없음. 전송 안함
|
|
|
+ regMap.setXmlTxt(sbRequest.toString());
|
|
|
+ regMap.setApiResult("error");
|
|
|
+ regMap.setApiMessage("API 전송안함=>샵링커 품목매핑정보가 없습니다. (자사품목코드: "+goodsMap.getItemkindCd()+")");
|
|
|
+ tscShoplinkerDao.insertShoplinerApiHst(regMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ }catch(Exception e) {
|
|
|
+ log.error("xml 생성오류 ", e);
|
|
|
+ regMap.setApiResult("error");
|
|
|
+ regMap.setApiMessage("xml 생성오류");
|
|
|
+ tscShoplinkerDao.insertShoplinerApiHst(regMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ return succCnt;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 샵링커 상품등록 - 상세내용 세팅
|
|
|
+ *
|
|
|
+ * @param shoplinkerGoods
|
|
|
+ * @return
|
|
|
+ * @author jmh
|
|
|
+ * @since 2021. 5. 20
|
|
|
+ */
|
|
|
+ private String setDetailDesc(ShoplinkerGoods shoplinkerGoods, ShoplinkerGoods goodsMap) {
|
|
|
+
|
|
|
+ String htmlDesc = "";
|
|
|
+
|
|
|
+ // 상세폼신규사용여부 N: 기존 정보 / Y : html 형식
|
|
|
+ if( "N".equals(goodsMap.getTobeFormYn())){
|
|
|
+ String descStr = goodsMap.getDetailDesc();
|
|
|
+ descStr = descStr.replace("http://www.istyle24.com/Upload/", "http://image.istyle24.com/Local/")
|
|
|
+ .replace("/Upload", "http://image.istyle24.com/Local")
|
|
|
+ .replace("http://www.istyle24.com/Images", "http://image.istyle24.com/Statics/design/Images");
|
|
|
+
|
|
|
+ htmlDesc = descStr;
|
|
|
+
|
|
|
+ }else {
|
|
|
+
|
|
|
+ String imgPath = env.getProperty("upload.goods.view");
|
|
|
+ imgPath = imgPath.replace("/Upload", "/Local")
|
|
|
+ .replace("http://www.istyle24.com/Upload/", "http://image.istyle24.com/Local/")
|
|
|
+ .replace("http://www.istyle24.com/Images", "http://image.istyle24.com/Statics/design/Images");
|
|
|
+
|
|
|
+ Collection<ShoplinkerGoods> imgList = admShoplinkerDao.getGoodsImageList(shoplinkerGoods);
|
|
|
+
|
|
|
+ String dColor = goodsMap.getMainColorEnm(); //대표컬러
|
|
|
+ String dImgFront = ""; //대표상품 앞판컷
|
|
|
+ String dImgBack = ""; //대표상품 뒷판컷
|
|
|
+ String dMaterial = ""; //대표상품 패브릭(소재컷?)
|
|
|
+ ArrayList<String> dImgModelList = new ArrayList<String>(); //대표상품 모델컷
|
|
|
+ ArrayList<String> dImgDetailList = new ArrayList<String>(); //대표상품 디테일컷(상세컷)
|
|
|
+ ArrayList<String> dLabelList = new ArrayList<String>(); //대표상품 케어라벨
|
|
|
+ ArrayList<String> dImgOtherList = new ArrayList<String>(); //상품외부몰용
|
|
|
+
|
|
|
+ // 이미지 정보
|
|
|
+ for(ShoplinkerGoods map : imgList) {
|
|
|
+
|
|
|
+ if( -1 < map.getSysImgNm().indexOf("_"+map.getColorCd()+"_01.jpg")) { //대표상품 앞판컷
|
|
|
+ dImgFront = imgPath +"/"+ map.getSysImgNm();
|
|
|
+ }
|
|
|
+ if( -1 < map.getSysImgNm().indexOf("_"+map.getColorCd()+"_02.jpg")) { //대표상품 뒷판컷
|
|
|
+ dImgBack = imgPath +"/"+ map.getSysImgNm();
|
|
|
+ }
|
|
|
+ if( -1 < map.getSysImgNm().indexOf("_"+map.getColorCd()+"_C")) { //대표상품 모델컷
|
|
|
+ dImgModelList.add(imgPath +"/"+ map.getSysImgNm());
|
|
|
+ }
|
|
|
+ if( -1 < map.getSysImgNm().indexOf("_"+map.getColorCd()+"_D")) { //대표상품 디테일컷(상세컷)
|
|
|
+ dImgDetailList.add(imgPath +"/"+ map.getSysImgNm());
|
|
|
+ }
|
|
|
+ if( -1 < map.getSysImgNm().indexOf("_"+map.getColorCd()+"_F")) { //대표상품 패브릭(소재컷?)
|
|
|
+ dMaterial = imgPath +"/"+ map.getSysImgNm();
|
|
|
+ }
|
|
|
+ if( -1 < map.getSysImgNm().indexOf("_"+map.getColorCd()+"_L")) { //대표상품 케어라벨
|
|
|
+ dLabelList.add(imgPath +"/"+ map.getSysImgNm());
|
|
|
+ }
|
|
|
+ if( -1 < map.getSysImgNm().indexOf("_"+map.getColorCd()+"_X")) { //대표상품 디테일컷(상세컷)
|
|
|
+ dImgOtherList.add(imgPath +"/"+ map.getSysImgNm());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 제대로된 정보 없을 경우, 기존 상세내용으로 보냄
|
|
|
+ if( "".equals(dImgFront) || "".equals(dImgBack)) {
|
|
|
+ String descStr = goodsMap.getDetailDesc();
|
|
|
+ descStr = descStr.replace("http://www.istyle24.com/Upload/", "http://image.istyle24.com/Local/")
|
|
|
+ .replace("/Upload", "http://image.istyle24.com/Local")
|
|
|
+ .replace("http://www.istyle24.com/Images", "http://image.istyle24.com/Statics/design/Images");
|
|
|
+
|
|
|
+ htmlDesc = descStr;
|
|
|
+
|
|
|
+ }else {
|
|
|
+
|
|
|
+ // 1) 상세내용 - 상품설명
|
|
|
+ htmlDesc = "<div class='st_descrp_box' style='max-height:1100px; overflow:hidden;'>";
|
|
|
+ htmlDesc += "<div class='st_desc_simple' style='position:relative; margin-top:0px; margin-left:auto; margin-right:auto;'>";
|
|
|
+ htmlDesc += "<span class='st_tit_desc' style='display:block; margin-bottom:10px; font-size:18px; font-weight:500; letter-spacing:-0.025em;'>"+goodsMap.getDetailDescNew10()+"</span>";
|
|
|
+ htmlDesc += "<p class='st_ptxt01' style='font-size:16px;font-weight:200;line-height:1.5;word-break:keep-all;color:#666666;'>";
|
|
|
+ htmlDesc += goodsMap.getDetailDescNew20();
|
|
|
+ htmlDesc += "</p>";
|
|
|
+ htmlDesc += "</div>";
|
|
|
+ htmlDesc += "<div class='st_desc_character' style='position:relative; margin-top:40px; margin-left:auto; margin-right:auto;'>";
|
|
|
+ htmlDesc += "<span class='st_tit_desc' style='display:block; margin-bottom:10px; font-size:18px; font-weight:500; letter-spacing:-0.025em;'>상품특징</span>";
|
|
|
+ htmlDesc += "<p class='st_ptxt01' style='font-size:16px;font-weight:200;line-height:1.5;word-break:keep-all;color:#666666;'>";
|
|
|
+ htmlDesc += goodsMap.getDetailDescNew30();
|
|
|
+ htmlDesc += "</p>";
|
|
|
+ htmlDesc += "</div>";
|
|
|
+ htmlDesc += "</div>";
|
|
|
+
|
|
|
+ // 2) 상세내용 - 상품옵션별 색상
|
|
|
+ String colorDesc = "";
|
|
|
+ shoplinkerGoods.setColorListYn("Y"); // 상품이미지정보 색상별
|
|
|
+ Collection<ShoplinkerGoods> imgColorList = admShoplinkerDao.getGoodsImageList(shoplinkerGoods);
|
|
|
+ colorDesc = "<div class='st_view_option_box' style='margin-top: 100px;text-align: center;'>";
|
|
|
+ String tmpColor = "";
|
|
|
+ for(ShoplinkerGoods ic : imgColorList ) {
|
|
|
+
|
|
|
+ if( !tmpColor.equals(ic.getColorCd())) {
|
|
|
+ colorDesc += "<span class='st_tit_desc' style='display:block; margin-bottom:10px; font-size:18px; font-weight:500; letter-spacing:-0.025em;'>컬러 : ";
|
|
|
+ colorDesc += "<span>"+ ic.getColorKnm() +"</span></span>";
|
|
|
+ }
|
|
|
+ colorDesc += "<div class='st_view' style='margin-top: 40px;'>";
|
|
|
+ colorDesc += "<img src='"+ imgPath+"/"+ic.getSysImgNm()+"' alt='' style='max-width:100%;margin: 10px auto 0;margin-top: 0;display: block;'>";
|
|
|
+ colorDesc += "<img src='"+ imgPath+"/"+ic.getSysImgNm()+"' alt='' style='max-width:100%;display: block;margin: 10px auto 0;'>";
|
|
|
+ colorDesc += "</div>";
|
|
|
+ if( !tmpColor.equals(ic.getColorCd())) {
|
|
|
+ colorDesc += "<div style='height:100px;'></div>";
|
|
|
+ tmpColor = ic.getColorCd();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ colorDesc += "</div>";
|
|
|
+ htmlDesc += colorDesc;
|
|
|
+
|
|
|
+ // 3) 상세내용 - 모델 착용컷
|
|
|
+ String dtlDesc = "";
|
|
|
+ dtlDesc += "<div class='st_view_outfit_box' style='margin-top: 100px;text-align: center;'>";
|
|
|
+ dtlDesc += "<span class='st_tit_view' style='display: block;color: #222;font-size: 32px;font-weight: 300;text-align: center;'>OUTFIT VIEW</span>";
|
|
|
+ dtlDesc += "<span class='st_model_info' style='display: block;margin-top: 20px;color: #666;font-size: 16px;font-weight: 200;text-align: center;'>"+goodsMap.getModelInfo()+"</span>";
|
|
|
+ dtlDesc += "<div class='st_view' style='margin-top: 40px;'>";
|
|
|
+ for(String img : dImgModelList) {
|
|
|
+ dtlDesc += "<img src='"+ img +"' alt='' style='display: block;margin: 10px auto 0;'>";
|
|
|
+ }
|
|
|
+ dtlDesc += "</div>";
|
|
|
+ dtlDesc += "</div>";
|
|
|
+
|
|
|
+ // 4) 상세내용 - 상품컷
|
|
|
+ dtlDesc += "<div class='st_view_detail_box' style='margin-top: 100px;text-align: center;'>";
|
|
|
+ dtlDesc += "<span class='st_tit_view' style='display: block;color: #222;font-size: 32px;font-weight: 300;text-align: center;'>PRODUCT VIEW</span>";
|
|
|
+ dtlDesc += "<div class='st_view' style='margin-top: 40px;'>";
|
|
|
+ for(String img : dImgDetailList) {
|
|
|
+ dtlDesc += "<img src='"+ img +"' alt='' style='display: block;margin: 10px auto 0;'>";
|
|
|
+ }
|
|
|
+ dtlDesc += "</div>";
|
|
|
+ dtlDesc += " </div>";
|
|
|
+
|
|
|
+ // 5) 상세내용 - 원단
|
|
|
+ dtlDesc += "<div class='st_view_fabric_box' style='margin-top: 100px;text-align: center;'>";
|
|
|
+ dtlDesc += "<span class='st_tit_view' style='display: block;color: #222;font-size: 32px;font-weight: 300;text-align: center;'>FABRIC</span>";
|
|
|
+ dtlDesc += "<div class='st_view' style='margin-top: 40px;'>";
|
|
|
+ dtlDesc += "<img src='"+dMaterial +"' alt='' style='display: block;margin: 10px auto 0;margin-top: 0;'>";
|
|
|
+ dtlDesc += "</div>";
|
|
|
+ dtlDesc += "</div>";
|
|
|
+
|
|
|
+ // 6) 상세내용 - 라벨
|
|
|
+ dtlDesc += "<div class='st_view_label_box' style='margin-top: 100px;text-align: center;'>";
|
|
|
+ dtlDesc += "<span class='st_tit_view' style='display: block;color: #222;font-size: 32px;font-weight: 300;text-align: center;'>LABEL INFO</span>";
|
|
|
+ dtlDesc += "<div class='st_view' style='margin-top: 40px;'>";
|
|
|
+ dtlDesc += "<span style='display:inline-block;'>";
|
|
|
+ for(String img : dLabelList) {
|
|
|
+ dtlDesc += "<img src='"+ img +"' alt='' style='float:left; margin-top:0; margin-left:20px;'>";
|
|
|
+ }
|
|
|
+ dtlDesc += "</span>";
|
|
|
+ dtlDesc += "</div>";
|
|
|
+ dtlDesc += "</div>";
|
|
|
+ htmlDesc += dtlDesc;
|
|
|
+
|
|
|
+ // 7) 상세내용 - 사이즈
|
|
|
+ Collection<ShoplinkerGoods> sizeList = admShoplinkerDao.getGoodsSizeList(shoplinkerGoods);
|
|
|
+ if (sizeList == null || sizeList.isEmpty()) {
|
|
|
+ //대표상품 실측정사이즈표 없을경우 > 브랜드 별 표준 이미지
|
|
|
+ htmlDesc += "<div class='st_view_size_box' style='margin-top: 100px;text-align: center;'>";
|
|
|
+ htmlDesc += "<span class='st_tit_view' style='display: block;color: #222;font-size: 32px;font-weight: 300;text-align: center;'>사이즈정보</span>";
|
|
|
+ htmlDesc += "<div class='st_view' style='margin-top: 40px;'>";
|
|
|
+
|
|
|
+ String brandSizeImg = env.getProperty("upload.image.view") + "/Upload/brandSizeImg/";
|
|
|
+ if( "Y".equals(goodsMap.getKidsYn())){
|
|
|
+ brandSizeImg += "kids/"+goodsMap.getBrandEnm() +".jpg";
|
|
|
+ htmlDesc += "<img src='"+ brandSizeImg +"' alt='ANDEW 표준 사이즈' style='display: block;margin: 10px auto 0;'>";
|
|
|
+ }else {
|
|
|
+ brandSizeImg += "casuals/"+goodsMap.getBrandEnm() +".jpg";
|
|
|
+ htmlDesc += "<img src='"+ brandSizeImg +"' alt='ANDEW 표준 사이즈' style='display: block;margin: 10px auto 0;'>";
|
|
|
+ }
|
|
|
+ htmlDesc += "</div>";
|
|
|
+ htmlDesc += "</div>";
|
|
|
+
|
|
|
+ }else {
|
|
|
+
|
|
|
+ htmlDesc += "<div class='st_view_size_box' style='margin-top: 100px;text-align: center;'>";
|
|
|
+ htmlDesc += "<span class='st_tit_view' style='display: block;color: #222;font-size: 32px;font-weight: 300;text-align: center;'>사이즈정보</span>";
|
|
|
+ htmlDesc += "<div class='st_view' style='margin-top: 40px;'>";
|
|
|
+
|
|
|
+ htmlDesc += "<div class='st_tbl' style='padding:0; border-top:1px solid #000;'>";
|
|
|
+ htmlDesc += "<table style='margin:0;padding:0;border-collapse:collapse;border-spacing:0;width:100%;border-top:1px solid #000;word-break:keep-all;'>";
|
|
|
+ htmlDesc += "<thead style=''>";
|
|
|
+ htmlDesc += "<tr style=''>";
|
|
|
+
|
|
|
+ int cnt = 0;
|
|
|
+ for(ShoplinkerGoods size : sizeList) {
|
|
|
+
|
|
|
+ if( 0 == cnt ) {
|
|
|
+ if( "하의".equals(size.getSizeTypecd())) {
|
|
|
+ htmlDesc += "<th style='position:relative;padding:20px 0;border-bottom:1px solid #ddd;font-weight:500;font-size:16px;letter-spacing:-0.025em;text-align:center;'></th>";
|
|
|
+ htmlDesc += "<th style='position:relative;padding:20px 0;border-bottom:1px solid #ddd;font-weight:500;font-size:16px;letter-spacing:-0.025em;text-align:center;'>허리둘레(cm)</th>";
|
|
|
+ htmlDesc += "<th style='position:relative;padding:20px 0;border-bottom:1px solid #ddd;font-weight:500;font-size:16px;letter-spacing:-0.025em;text-align:center;'>밑위(cm)</th>";
|
|
|
+ htmlDesc += "<th style='position:relative;padding:20px 0;border-bottom:1px solid #ddd;font-weight:500;font-size:16px;letter-spacing:-0.025em;text-align:center;'>엉덩이둘레(cm)</th>";
|
|
|
+ htmlDesc += "<th style='position:relative;padding:20px 0;border-bottom:1px solid #ddd;font-weight:500;font-size:16px;letter-spacing:-0.025em;text-align:center;'>허벅지둘레(cm)</th>";
|
|
|
+ htmlDesc += "<th style='position:relative;padding:20px 0;border-bottom:1px solid #ddd;font-weight:500;font-size:16px;letter-spacing:-0.025em;text-align:center;'>총길이(cm)</th>";
|
|
|
+ }else {
|
|
|
+ htmlDesc += "<th style='position:relative;padding:20px 0;border-bottom:1px solid #ddd;font-weight:500;font-size:16px;letter-spacing:-0.025em;text-align:center;'></th>";
|
|
|
+ htmlDesc += "<th style='position:relative;padding:20px 0;border-bottom:1px solid #ddd;font-weight:500;font-size:16px;letter-spacing:-0.025em;text-align:center;'>가슴둘레(cm)</th>";
|
|
|
+ htmlDesc += "<th style='position:relative;padding:20px 0;border-bottom:1px solid #ddd;font-weight:500;font-size:16px;letter-spacing:-0.025em;text-align:center;'>어깨너비(cm)</th>";
|
|
|
+ htmlDesc += "<th style='position:relative;padding:20px 0;border-bottom:1px solid #ddd;font-weight:500;font-size:16px;letter-spacing:-0.025em;text-align:center;'>팔길이(cm)</th>";
|
|
|
+ htmlDesc += "<th style='position:relative;padding:20px 0;border-bottom:1px solid #ddd;font-weight:500;font-size:16px;letter-spacing:-0.025em;text-align:center;'>총길이(cm)</th>";
|
|
|
+ }
|
|
|
+ htmlDesc += "</tr>";
|
|
|
+ htmlDesc += "</thead>";
|
|
|
+ htmlDesc += "<tbody style=''>";
|
|
|
+ }
|
|
|
+
|
|
|
+ htmlDesc += "<tr style=''>";
|
|
|
+ htmlDesc += "<th style='position:relative;padding:20px 0;border-bottom:1px solid #ddd;font-weight:500;font-size:16px;letter-spacing:-0.025em;text-align:center;'>"+ size.getOptCd2() +"</th>";
|
|
|
+ htmlDesc += "<td style='position:relative; padding:20px 0; border-bottom:1px solid #ddd; font-weight:200; font-size:16px; letter-spacing:-0.025em; text-align:center;'>"+ size.getSizeValue1() +"</td>";
|
|
|
+ htmlDesc += "<td style='position:relative; padding:20px 0; border-bottom:1px solid #ddd; font-weight:200; font-size:16px; letter-spacing:-0.025em; text-align:center;'>"+ size.getSizeValue2() +"</td>";
|
|
|
+ htmlDesc += "<td style='position:relative; padding:20px 0; border-bottom:1px solid #ddd; font-weight:200; font-size:16px; letter-spacing:-0.025em; text-align:center;'>"+ size.getSizeValue3() +"</td>";
|
|
|
+ htmlDesc += "<td style='position:relative; padding:20px 0; border-bottom:1px solid #ddd; font-weight:200; font-size:16px; letter-spacing:-0.025em; text-align:center;'>"+ size.getSizeValue4() +"</td>";
|
|
|
+ if( "하의".equals(size.getSizeTypecd())) {
|
|
|
+ htmlDesc += "<td style='position:relative; padding:20px 0; border-bottom:1px solid #ddd; font-weight:200; font-size:16px; letter-spacing:-0.025em; text-align:center;'>"+ size.getSizeValue5() +"</td>";
|
|
|
+ }
|
|
|
+ cnt ++;
|
|
|
+ }
|
|
|
+
|
|
|
+ htmlDesc += "</tbody>";
|
|
|
+ htmlDesc += "</table>";
|
|
|
+ htmlDesc += "</div>";
|
|
|
+ htmlDesc += "</div>";
|
|
|
+ htmlDesc += " </div>";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 8) 상세내용 - 상품필수정보
|
|
|
+ ShoplinkerGoods certInfo = admShoplinkerDao.getCert(shoplinkerGoods);
|
|
|
+ if( null != certInfo) {
|
|
|
+ if( "G083_1".equals(certInfo.getCertTargetGb())) { // 인증대상
|
|
|
+
|
|
|
+ if( "".equals(certInfo.getCertNum())) {
|
|
|
+
|
|
|
+ htmlDesc += "<div class='st_required_box' style='margin-bottom:80px;'>";
|
|
|
+ htmlDesc += "<div class='st_area_kcl' style='color:#222;display:block; position:relative; min-height:160px; margin-top:100px; padding:40px 40px 40px 160px; box-sizing:border-box; background:#f5f5f5;'>";
|
|
|
+ htmlDesc += "<i class='st_ico_kcl' style='position:absolute;left:64px;top:50%;transform:translateY(-50%);z-index:2;background-image: url(/images/pc/ico_kcl.png);width: 32px;height: 50px;display: inline-block;vertical-align: middle;background-repeat: no-repeat;background-size: contain;background-position: 0% 0%;'></i>";
|
|
|
+ htmlDesc += "<p class='st_tit' style='margin-top:0;color:#222;font-size:16px;font-weight:300;line-height:1;letter-spacing:-0.025em;'>";
|
|
|
+ htmlDesc += certInfo.getCertTargetNm() +"/"+ certInfo.getCertOrganName();
|
|
|
+ htmlDesc += "</p>";
|
|
|
+ htmlDesc += "<p style='margin-top:20px; color:#222; font-size:13px; font-weight: 300; line-height:1; letter-spacing:-0.025em;'>";
|
|
|
+ htmlDesc += certInfo.getCertDiv();
|
|
|
+ htmlDesc += "</p>";
|
|
|
+ htmlDesc += "<p class='st_dot_info' style='color: #888888;position:relative;margin-top:20px;font-size:13px;font-weight:300;line-height:1;letter-spacing:-0.025em;'>";
|
|
|
+ htmlDesc += "<span style='color: #888888 !important;background: #888888 !important;display: inline-block;width: 2px;height: 2px;position: relative;top: -4px;left: 0px;margin-right: 4px;'></span>";
|
|
|
+ htmlDesc += "해당 인증정보는 판매자가 등록한 것으로 등록정보에 대한 일체의 책임은 판매자에게 있습니다.";
|
|
|
+ htmlDesc += "</p>";
|
|
|
+ htmlDesc += "</div>";
|
|
|
+ htmlDesc += "</div>";
|
|
|
+ }else {
|
|
|
+ htmlDesc += "<div class='st_required_box' style='margin-bottom:80px;'>";
|
|
|
+ htmlDesc += "<div class='st_area_kcl' style='display:block; position:relative; min-height:160px; margin-top:100px; padding:40px 40px 40px 160px; box-sizing:border-box; background:#f5f5f5;'>";
|
|
|
+ htmlDesc += "<i class='st_ico_kcl' style='position:absolute;left:64px;top:50%;transform:translateY(-50%);z-index:2;background-image: url(/images/pc/ico_kcl.png);width: 32px;height: 50px;display: inline-block;vertical-align: middle;background-repeat: no-repeat;background-size: contain;background-position: 0% 0%;'></i>";
|
|
|
+ htmlDesc += "<p class='st_tit' style='margin-top:0;color:#222;font-size:16px;font-weight:300;line-height:1;letter-spacing:-0.025em;'>";
|
|
|
+ htmlDesc += certInfo.getCertDiv() +"/"+ certInfo.getCertOrganName();
|
|
|
+ htmlDesc += "</p>";
|
|
|
+ htmlDesc += "<p style='margin-top:20px; color:#222; font-size:13px; font-weight: 300; line-height:1; letter-spacing:-0.025em;'>";
|
|
|
+ htmlDesc += "인증번호: "+ certInfo.getCertNum();
|
|
|
+ htmlDesc += "<a href='http://www.safetykorea.kr/search/searchPop?certNum=XX00000-0000' target='_blank' class='st_linktxt3' style='margin-left:20px; color:#888; font-weight:200; text-decoration:none !important;'>상세보기</a>";
|
|
|
+ htmlDesc += "</p>";
|
|
|
+ htmlDesc += "<p class='st_dot_info' style='color: #888888;position:relative;margin-top:20px;font-size:13px;font-weight:300;line-height:1;letter-spacing:-0.025em;'>";
|
|
|
+ htmlDesc += "<span style='color: #888888 !important;background: #888888 !important;display: inline-block;width: 2px;height: 2px;position: relative;top: -4px;left: 0px;margin-right: 4px;'></span>";
|
|
|
+ htmlDesc += "해당 인증정보는 판매자가 등록한 것으로 등록정보에 대한 일체의 책임은 판매자에게 있습니다.";
|
|
|
+ htmlDesc += "</p>";
|
|
|
+ htmlDesc += "</div>";
|
|
|
+ htmlDesc += "</div>";
|
|
|
+ }
|
|
|
+
|
|
|
+ }else if( "G083_3".equals(certInfo.getCertTargetGb())) { // 상세설명별도표기
|
|
|
+ htmlDesc += "<div class='st_required_box' style='margin-bottom:80px;'>";
|
|
|
+ htmlDesc += "<div class='st_area_kcl st_no-mark' style='display:block;position:relative;min-height:160px;margin-top:100px;padding:40px 40px 40px 160px;box-sizing:border-box;background:#f5f5f5;padding-left:65px;'>";
|
|
|
+ htmlDesc += "<p class='st_tit' style='margin-top:0;color:#222;font-size:16px;font-weight:300;line-height:1;letter-spacing:-0.025em;'>";
|
|
|
+ htmlDesc += certInfo.getCertTargetNm();
|
|
|
+ htmlDesc += "</p>";
|
|
|
+ htmlDesc += "<p style='margin-top:20px; color:#222; font-size:13px; font-weight: 300; line-height:1; letter-spacing:-0.025em;'>";
|
|
|
+ htmlDesc += "제품 상세정보 내 표기되어 있습니다. 상품 정보를 확인해주세요.";
|
|
|
+ htmlDesc += "</p>";
|
|
|
+ htmlDesc += "<p class='st_dot_info' style='color: #888888;position:relative;margin-top:20px;font-size:13px;font-weight:300;line-height:1;letter-spacing:-0.025em;'>";
|
|
|
+ htmlDesc += "<span style='color: #888888 !important;background: #888888 !important;display: inline-block;width: 2px;height: 2px;position: relative;top: -4px;left: 0px;margin-right: 4px;'></span>";
|
|
|
+ htmlDesc += "해당 인증정보는 판매자가 등록한 것으로 등록정보에 대한 일체의 책임은 판매자에게 있습니다.";
|
|
|
+ htmlDesc += "</p>";
|
|
|
+ htmlDesc += "</div>";
|
|
|
+ htmlDesc += "</div>";
|
|
|
+ }else {
|
|
|
+ // G083_2 - 인증대상아님
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return htmlDesc;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 샵링커 상품등록 - 3. 품목(고시)정보
|
|
|
+ *
|
|
|
+ * @param shoplinkerGoods
|
|
|
+ * @return
|
|
|
+ * @author jmh
|
|
|
+ * @since 2021. 5. 20
|
|
|
+ */
|
|
|
+ private int createGoodsNotiRegisterXml(ShoplinkerGoods shoplinkerGoods) throws IOException {
|
|
|
+
|
|
|
+ ShoplinkerGoods regMap = new ShoplinkerGoods();
|
|
|
+ regMap.setApiType("NOTI");
|
|
|
+ regMap.setApiSubUrl(env.getProperty("shoplinker.url.good_noti"));
|
|
|
+ regMap.setGoodsCd(shoplinkerGoods.getGoodsCd());
|
|
|
+ regMap.setRegNo(shoplinkerGoods.getRegNo());
|
|
|
+ regMap.setXmlPath(shoplinkerGoods.getXmlPath());
|
|
|
+ regMap.setDomainUrl(shoplinkerGoods.getDomainUrl());
|
|
|
+
|
|
|
+ int succCnt = 0;
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ Collection<ShoplinkerGoods> list = admShoplinkerDao.getGoodsNotiList(shoplinkerGoods);
|
|
|
+
|
|
|
+ if(null != list ) {
|
|
|
+ if( 0 < list.size()) {
|
|
|
+
|
|
|
+ // xml 데이터 세팅
|
|
|
+ StringBuilder sbRequest = new StringBuilder();
|
|
|
+ sbRequest.append("<?xml version=\"1.0\" encoding=\"euc-kr\"?>\n");
|
|
|
+ sbRequest.append("<openMarket>\n");
|
|
|
+ sbRequest.append(" <goodsinfo>\n");
|
|
|
+
|
|
|
+ sbRequest.append(" <customer_id>").append(shoplinkerGoods.getCustomerId()).append("</customer_id>\n");
|
|
|
+ sbRequest.append(" <product_id />\n");
|
|
|
+
|
|
|
+ int cnt = 0;
|
|
|
+ for (ShoplinkerGoods map : list) {
|
|
|
+ if( 0 == cnt) {
|
|
|
+ sbRequest.append(" <partner_product_id>").append(map.getPartnerProductId()).append("</partner_product_id>\n");
|
|
|
+ sbRequest.append(" <lclass_id>").append(map.getLclassId()).append("</lclass_id>\n");
|
|
|
+ }
|
|
|
+ cnt ++;
|
|
|
+
|
|
|
+ sbRequest.append(" <item>\n");
|
|
|
+ sbRequest.append(" <item_seq>").append(map.getItemSeq()).append("</item_seq>\n");
|
|
|
+ sbRequest.append(" <item_info><![CDATA[").append(map.getItemInfo()).append("]]></item_info>\n");
|
|
|
+ sbRequest.append(" </item>\n");
|
|
|
+ }
|
|
|
+
|
|
|
+ sbRequest.append(" </goodsinfo>\n");
|
|
|
+ sbRequest.append("</openMarket>\n");
|
|
|
+
|
|
|
+ // api 호출 및 결과 history 저장
|
|
|
+ succCnt = callGoodsRegApi(regMap , sbRequest, "goods");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }catch(Exception e) {
|
|
|
+ log.error("xml 생성오류 ", e);
|
|
|
+ regMap.setApiResult("error");
|
|
|
+ regMap.setApiMessage("xml 생성오류");
|
|
|
+ tscShoplinkerDao.insertShoplinerApiHst(regMap);
|
|
|
+ }
|
|
|
+ return succCnt;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 샵링커 상품등록 - 4. 인증정보
|
|
|
+ *
|
|
|
+ * @param shoplinkerGoods
|
|
|
+ * @return
|
|
|
+ * @author jmh
|
|
|
+ * @since 2021. 5. 20
|
|
|
+ */
|
|
|
+ private int createCertRegisterXml(ShoplinkerGoods shoplinkerGoods) throws IOException {
|
|
|
+
|
|
|
+ ShoplinkerGoods regMap = new ShoplinkerGoods();
|
|
|
+ regMap.setApiType("CERT");
|
|
|
+ regMap.setApiSubUrl(env.getProperty("shoplinker.url.cert"));
|
|
|
+ regMap.setGoodsCd(shoplinkerGoods.getGoodsCd());
|
|
|
+ regMap.setRegNo(shoplinkerGoods.getRegNo());
|
|
|
+ regMap.setXmlPath(shoplinkerGoods.getXmlPath());
|
|
|
+ regMap.setDomainUrl(shoplinkerGoods.getDomainUrl());
|
|
|
+
|
|
|
+ int succCnt = 0;
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ ShoplinkerGoods map = admShoplinkerDao.getCert(shoplinkerGoods);
|
|
|
+
|
|
|
+ if(null == map ) {
|
|
|
+ map = new ShoplinkerGoods();
|
|
|
+ map.setPartnerProductId(shoplinkerGoods.getGoodsCd());
|
|
|
+ map.setCertNo("");
|
|
|
+ map.setCertOrgan(".");
|
|
|
+ }
|
|
|
+
|
|
|
+ // xml 데이터 세팅
|
|
|
+ StringBuilder sbRequest = new StringBuilder();
|
|
|
+ sbRequest.append("<?xml version=\"1.0\" encoding=\"euc-kr\"?>\n");
|
|
|
+ sbRequest.append("<shoplinker>\n");
|
|
|
+ sbRequest.append(" <product>\n");
|
|
|
+
|
|
|
+ sbRequest.append(" <customer_id>").append(shoplinkerGoods.getCustomerId()).append("</customer_id>\n");
|
|
|
+ sbRequest.append(" <partner_product_id>").append(map.getPartnerProductId()).append("</partner_product_id>\n");
|
|
|
+ sbRequest.append(" <certinfo>\n");
|
|
|
+ sbRequest.append(" <cert>\n");
|
|
|
+
|
|
|
+ //cert_item 의 경우 인증코드 값이 있으면 'C011', 없으면 'C010'
|
|
|
+ if("".equals(map.getCertNo())){
|
|
|
+ sbRequest.append(" <cert_item>").append("C010").append("</cert_item>\n");
|
|
|
+ }else {
|
|
|
+ sbRequest.append(" <cert_item>").append("C011").append("</cert_item>\n");
|
|
|
+ }
|
|
|
+
|
|
|
+ sbRequest.append(" <cert_organ><![CDATA[").append(map.getCertOrgan()).append("]]></cert_organ>\n");
|
|
|
+ sbRequest.append(" <cert_no><![CDATA[").append(map.getCertNo()).append("]]></cert_no>\n");
|
|
|
+ sbRequest.append(" </cert>\n");
|
|
|
+ sbRequest.append(" </certinfo>\n");
|
|
|
+ sbRequest.append(" </product>\n");
|
|
|
+ sbRequest.append("</shoplinker>\n");
|
|
|
+
|
|
|
+ // api 호출 및 결과 history 저장
|
|
|
+ succCnt = callGoodsRegApi(regMap , sbRequest, "cert");
|
|
|
+
|
|
|
+ }catch(Exception e) {
|
|
|
+ log.error("xml 생성오류 ", e);
|
|
|
+ regMap.setApiResult("error");
|
|
|
+ regMap.setApiMessage("xml 생성오류");
|
|
|
+ tscShoplinkerDao.insertShoplinerApiHst(regMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ return succCnt;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 샵링커 상품등록 - 5. 상품이미지정보
|
|
|
+ *
|
|
|
+ * @param shoplinkerGoods
|
|
|
+ * @return
|
|
|
+ * @author jmh
|
|
|
+ * @since 2021. 5. 20
|
|
|
+ */
|
|
|
+ private int createImageRegisterXml(ShoplinkerGoods shoplinkerGoods) throws IOException {
|
|
|
+
|
|
|
+ ShoplinkerGoods regMap = new ShoplinkerGoods();
|
|
|
+ regMap.setApiType("IMAGE");
|
|
|
+ regMap.setApiSubUrl(env.getProperty("shoplinker.url.image"));
|
|
|
+ regMap.setGoodsCd(shoplinkerGoods.getGoodsCd());
|
|
|
+ regMap.setRegNo(shoplinkerGoods.getRegNo());
|
|
|
+ regMap.setXmlPath(shoplinkerGoods.getXmlPath());
|
|
|
+ regMap.setDomainUrl(shoplinkerGoods.getDomainUrl());
|
|
|
+
|
|
|
+ int succCnt = 0;
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ // 상품이미지정보
|
|
|
+ shoplinkerGoods.setExtmallImgYn("Y");
|
|
|
+ Collection<ShoplinkerGoods> list = admShoplinkerDao.getGoodsImageList(shoplinkerGoods);
|
|
|
+
|
|
|
+ if(null != list) {
|
|
|
+
|
|
|
+ String imgUrl = "";
|
|
|
+ for (ShoplinkerGoods map : list) {
|
|
|
+ imgUrl = map.getSysImgNm();
|
|
|
+ // extmall_yn 이미지를 가져오되, 없는 경우 default 이미지를 가져온다.
|
|
|
+ if( "Y".equals(map.getExtmallImgYn()) && !"".equals(map.getSysImgNm())){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // xml 데이터 세팅
|
|
|
+ StringBuilder sbRequest = new StringBuilder();
|
|
|
+ sbRequest.append("<?xml version=\"1.0\" encoding=\"euc-kr\"?>\n");
|
|
|
+ sbRequest.append("<Shoplinker>\n");
|
|
|
+ sbRequest.append(" <product>\n");
|
|
|
+
|
|
|
+ sbRequest.append(" <customer_id>").append(shoplinkerGoods.getCustomerId()).append("</customer_id>\n");
|
|
|
+ sbRequest.append(" <partner_product_id>").append(shoplinkerGoods.getGoodsCd()).append("</partner_product_id>\n");
|
|
|
+ sbRequest.append(" <image_type><![CDATA[").append("URL").append("]]></image_type>\n");
|
|
|
+ sbRequest.append(" <image_info>\n");
|
|
|
+ sbRequest.append(" <image>\n");
|
|
|
+ sbRequest.append(" <image_kind><![CDATA[").append("IMG1").append("]]></image_kind>\n");
|
|
|
+
|
|
|
+ String img_url = env.getProperty("upload.goods.view");
|
|
|
+ if( img_url.toLowerCase().indexOf("http") < 0) {
|
|
|
+ img_url = img_url.replace("//image", "http://image");
|
|
|
+ }
|
|
|
+ sbRequest.append(" <image_content>").append(img_url+"/"+imgUrl).append("</image_content>\n");
|
|
|
+ sbRequest.append(" </image>\n");
|
|
|
+ sbRequest.append(" </image_info>\n");
|
|
|
+
|
|
|
+ sbRequest.append(" </product>\n");
|
|
|
+ sbRequest.append("</Shoplinker>\n");
|
|
|
+
|
|
|
+ // api 호출 및 결과 history 저장
|
|
|
+ succCnt = callGoodsRegApi(regMap , sbRequest, "image");
|
|
|
+ }
|
|
|
+
|
|
|
+ }catch(Exception e) {
|
|
|
+ log.error("xml 생성오류 ", e);
|
|
|
+ regMap.setApiResult("error");
|
|
|
+ regMap.setApiMessage("xml 생성오류");
|
|
|
+ tscShoplinkerDao.insertShoplinerApiHst(regMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ return succCnt;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 샵링커 상품등록 - 공통 api 호출 & 결과 확인
|
|
|
+ *
|
|
|
+ * @param shoplinkerGoods
|
|
|
+ * @return
|
|
|
+ * @author jmh
|
|
|
+ * @since 2021. 5. 20
|
|
|
+ */
|
|
|
+ private int callGoodsRegApi(ShoplinkerGoods map, StringBuilder sbRequest, String fileNm) throws IOException {
|
|
|
+
|
|
|
+ int succCnt = 0;
|
|
|
+ com.gagaframework.shoplinker.domain.goods.result.Shoplinker shoplinkerResult;
|
|
|
+ com.gagaframework.shoplinker.domain.goods.result.ResultMessage resultMsg;
|
|
|
+
|
|
|
+ StringBuilder xmlFileName = new StringBuilder();
|
|
|
+
|
|
|
+ try {
|
|
|
+ GagaShoplinkertUtil shoplinkerUtil = new GagaShoplinkertUtil("MS949");
|
|
|
+
|
|
|
+ // XML 파일 생성
|
|
|
+ xmlFileName = new StringBuilder();
|
|
|
+ xmlFileName.append(fileNm+"_"+fileAddNm).append(".xml");
|
|
|
+ String xmlPath = GagaFileUtil.getConcatenationPath(map.getXmlPath(), xmlFileName.toString());
|
|
|
+ shoplinkerUtil.makeRequestXmlFile(sbRequest.toString(), xmlPath);
|
|
|
+ String xmlUrl = GagaFileUtil.getConcatenationPath(map.getDomainUrl(), xmlFileName.toString());
|
|
|
+
|
|
|
+ // API 호출 URL
|
|
|
+ String apiUrl = GagaShoplinkerConstants.API_DOMAIN + map.getApiSubUrl() + URLEncoder.encode(xmlUrl);
|
|
|
+
|
|
|
+ // API 호출결과
|
|
|
+ String responseXmlData = shoplinkerUtil.callShoplinkerApiByGet(apiUrl, "");
|
|
|
+
|
|
|
+ // response 결과
|
|
|
+ shoplinkerResult = (com.gagaframework.shoplinker.domain.goods.result.Shoplinker)shoplinkerUtil.unmarshal(com.gagaframework.shoplinker.domain.goods.result.Shoplinker.class, responseXmlData);
|
|
|
+ resultMsg = shoplinkerResult.getResultMessage();
|
|
|
+
|
|
|
+ String slFolder = GagaFileUtil.getConcatenationPath(env.getProperty("shoplinker.xml.path"));
|
|
|
+ File slPath = new File(slFolder);
|
|
|
+
|
|
|
+ map.setXmlTxt(slPath.exists()+"\n"+xmlPath+"\n"+xmlUrl+"\n\n"+sbRequest.toString());
|
|
|
+ map.setApiProductId(resultMsg.getProductId());
|
|
|
+ map.setApiResult(resultMsg.getResult());
|
|
|
+ map.setApiMessage(resultMsg.getMessage());
|
|
|
+
|
|
|
+ if( "true".equals(resultMsg.getResult())){
|
|
|
+ succCnt = 1;
|
|
|
+
|
|
|
+ // 재고 단품 생성
|
|
|
+ if( "OPTION".equals(map.getApiType())) {
|
|
|
+ admShoplinkerDao.insertStockOption(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("error", e);
|
|
|
+ map.setXmlTxt(sbRequest.toString());
|
|
|
+ map.setApiResult("error");
|
|
|
+ map.setApiMessage("API 통신오류");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 생성 파일삭제
|
|
|
+ GagaFileUtil.deleteFile(GagaFileUtil.getConcatenationPath(map.getXmlPath(), xmlFileName.toString()));
|
|
|
+
|
|
|
+ // 전송이력 저장
|
|
|
+ tscShoplinkerDao.insertShoplinerApiHst(map);
|
|
|
+
|
|
|
+ return succCnt;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 상품등록-상품 목록 건수
|
|
|
+ *
|
|
|
+ * @param getGoodsSendListCount
|
|
|
+ * @return
|
|
|
+ * @author jmh
|
|
|
+ * @since 2020. 5. 21
|
|
|
+ */
|
|
|
+ public int getGoodsSendListCount(ShoplinkerSearch shoplinkerSearch) {
|
|
|
+ return admShoplinkerDao.getGoodsSendListCount(shoplinkerSearch);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 상품등록-상품 목록
|
|
|
+ *
|
|
|
+ * @param shoplinkerSearch
|
|
|
+ * @return
|
|
|
+ * @author jmh
|
|
|
+ * @since 2020. 5. 21
|
|
|
+ */
|
|
|
+ public Collection<ShoplinkerGoods> getGoodsSendList(ShoplinkerSearch shoplinkerSearch) {
|
|
|
+ return admShoplinkerDao.getGoodsSendList(shoplinkerSearch);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 상품등록-상품 목록 엑셀다운로드
|
|
|
+ *
|
|
|
+ * @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 = admShoplinkerDao.getGoodsSendExcelList(shoplinkerSearch);
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ GagaExcelUtil.createExcel(excelFilenameWithPath, dataList, "샵링커 상품 정보", listTitles, cellNames, cellTypes, TsaConstants.EXCEL_FOOTER_TITLE);
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new IllegalStateException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 재고전송-목록 건수
|
|
|
+ *
|
|
|
+ * @param shoplinkerSearch
|
|
|
+ * @return
|
|
|
+ * @author jmh
|
|
|
+ * @since 2020. 5. 21
|
|
|
+ */
|
|
|
+ public int getStockListCount(ShoplinkerSearch shoplinkerSearch) {
|
|
|
+ return admShoplinkerDao.getStockListCount(shoplinkerSearch);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 재고전송-목록
|
|
|
+ *
|
|
|
+ * @param shoplinkerSearch
|
|
|
+ * @return
|
|
|
+ * @author jmh
|
|
|
+ * @since 2020. 5. 21
|
|
|
+ */
|
|
|
+ public Collection<ShoplinkerGoods> getStockList(ShoplinkerSearch shoplinkerSearch) {
|
|
|
+ return admShoplinkerDao.getStockList(shoplinkerSearch);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 재고전송-목록 엑셀다운로드
|
|
|
+ *
|
|
|
+ * @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 = admShoplinkerDao.getStockExcelList(shoplinkerSearch);
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ GagaExcelUtil.createExcel(excelFilenameWithPath, dataList, "샵링커 재고 정보", listTitles, cellNames, cellTypes, TsaConstants.EXCEL_FOOTER_TITLE);
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new IllegalStateException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 샵링커주문수집-목록 건수
|
|
|
+ *
|
|
|
+ * @param shoplinkerOrder
|
|
|
+ * @return
|
|
|
+ * @author jmh
|
|
|
+ * @since 2020. 5. 21
|
|
|
+ */
|
|
|
+ public int getShoplinkerOrderListCount(ShoplinkerOrder shoplinkerOrder) {
|
|
|
+ return admShoplinkerDao.getShoplinkerOrderListCount(shoplinkerOrder);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 샵링커주문수집-목록
|
|
|
+ *
|
|
|
+ * @param shoplinkerOrder
|
|
|
+ * @return
|
|
|
+ * @author jmh
|
|
|
+ * @since 2020. 5. 21
|
|
|
+ */
|
|
|
+ public Collection<ShoplinkerOrder> getShoplinkerOrderList(ShoplinkerOrder shoplinkerOrder) {
|
|
|
+ return admShoplinkerDao.getShoplinkerOrderList(shoplinkerOrder);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 샵링커주문수집-상세
|
|
|
+ *
|
|
|
+ * @param shoplinkerOrder
|
|
|
+ * @return
|
|
|
+ * @author jmh
|
|
|
+ * @since 2020. 5. 28
|
|
|
+ */
|
|
|
+ public ShoplinkerOrder getShoplinkerOrderInfo(ShoplinkerOrder shoplinkerOrder) {
|
|
|
+ return admShoplinkerDao.getShoplinkerOrderInfo(shoplinkerOrder);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 샵링커주문수집-제휴몰 주문수집 상세
|
|
|
+ *
|
|
|
+ * @param extmallOrder
|
|
|
+ * @return
|
|
|
+ * @author jmh
|
|
|
+ * @since 2020. 5. 28
|
|
|
+ */
|
|
|
+ public ExtmallOrder getExtmallOrderInfo(String extmallOrder) {
|
|
|
+ return admShoplinkerDao.getExtmallOrderInfo(extmallOrder);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 주문수집-목록 엑셀다운로드
|
|
|
+ *
|
|
|
+ * @param shoplinkerOrder
|
|
|
+ * @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_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_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(),
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name(),
|
|
|
+ GagaExcelConstants.CellType.CHAR_CENTER.name()};
|
|
|
+
|
|
|
+ Collection<GagaMap> dataList = admShoplinkerDao.getOrderExcelList(shoplinkerOrder);
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ GagaExcelUtil.createExcel(excelFilenameWithPath, dataList, "샵링커 주문 정보", listTitles, cellNames, cellTypes, TsaConstants.EXCEL_FOOTER_TITLE);
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new IllegalStateException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 송장전송-전송 (엑셀용)
|
|
|
+ *
|
|
|
+ * @param shoplinkerInvoice
|
|
|
+ * @return
|
|
|
+ * @author jmh
|
|
|
+ * @since 2021. 5. 20
|
|
|
+ */
|
|
|
+ /*********************************************************************************************
|
|
|
+ public void createShoplinkerInvoiceXml(Collection<GagaMap> ecxelGoodsList, ShoplinkerInvoice shoplinkerInvoice) throws IOException {
|
|
|
+ // 파일명 뒤에 붙일 시간
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss");
|
|
|
+ fileAddNm = sdf.format(cal.getTime());
|
|
|
+
|
|
|
+ ShoplinkerGoods apiHstMap = new ShoplinkerGoods();
|
|
|
+
|
|
|
+ GagaMap returnMap = new GagaMap();
|
|
|
+ ShoplinkerGoods regMap = new ShoplinkerGoods();
|
|
|
+ regMap.setApiType("INVOICE");
|
|
|
+ regMap.setApiSubUrl(env.getProperty("shoplinker.url.invoice"));
|
|
|
+ regMap.setRegNo(shoplinkerInvoice.getRegNo());
|
|
|
+ regMap.setXmlPath(shoplinkerInvoice.getXmlPath());
|
|
|
+ regMap.setDomainUrl(shoplinkerInvoice.getDomainUrl());
|
|
|
+
|
|
|
+ StringBuilder sbRequest;
|
|
|
+ com.gagaframework.shoplinker.domain.invoice.ResultMessage resultMsg_tmp;
|
|
|
+
|
|
|
+ for (GagaMap gagaMap : ecxelGoodsList) {
|
|
|
+ if( !"".equals(gagaMap.getString("ordNo").trim())) {
|
|
|
+ shoplinkerInvoice.setOrdNo(gagaMap.getInt("ordNo"));
|
|
|
+
|
|
|
+ Collection<ShoplinkerInvoice> list = shoplinkerDao.getShoplinkerInvoiceOrdDtlSendList(shoplinkerInvoice);
|
|
|
+ for(ShoplinkerInvoice info : list) {
|
|
|
+ apiHstMap = new ShoplinkerGoods();
|
|
|
+
|
|
|
+ // xml 데이터 세팅
|
|
|
+ sbRequest = new StringBuilder();
|
|
|
+ sbRequest.append("<?xml version=\"1.0\" encoding=\"euc-kr\"?>\n");
|
|
|
+ sbRequest.append("<Shoplinker>\n");
|
|
|
+ sbRequest.append(" <Delivery>\n");
|
|
|
+
|
|
|
+ sbRequest.append(" <customer_id>").append(shoplinkerInvoice.getCustomerId()).append("</customer_id>\n");
|
|
|
+ sbRequest.append(" <order_id>").append(info.getAgentOrderId()).append("</order_id>\n");
|
|
|
+ sbRequest.append(" <delivery_name><![CDATA[").append(info.getDeliveryName()).append("]]></delivery_name>\n");
|
|
|
+ sbRequest.append(" <delivery_invoice><![CDATA[").append(info.getDeliveryInvoice()).append("]]></delivery_invoice>\n");
|
|
|
+
|
|
|
+ sbRequest.append(" </Delivery>\n");
|
|
|
+ sbRequest.append("</Shoplinker>\n");
|
|
|
+
|
|
|
+ // api 호출 및 결과 history 저장
|
|
|
+ try {
|
|
|
+
|
|
|
+ GagaShoplinkertUtil shoplinkerUtil = new GagaShoplinkertUtil("MS949");
|
|
|
+
|
|
|
+ // XML 파일 생성
|
|
|
+ StringBuilder xmlFileName = new StringBuilder();
|
|
|
+ xmlFileName.append("invoice_"+info.getOrdDtlNo()+"_"+fileAddNm).append(".xml");
|
|
|
+ String xmlPath = GagaFileUtil.getConcatenationPath(shoplinkerInvoice.getXmlPath(), xmlFileName.toString());
|
|
|
+ shoplinkerUtil.makeRequestXmlFile(sbRequest.toString(), xmlPath);
|
|
|
+ String xmlUrl = GagaFileUtil.getConcatenationPath(shoplinkerInvoice.getDomainUrl(), xmlFileName.toString());
|
|
|
+
|
|
|
+ // API 호출
|
|
|
+ xmlUrl = "http://ts5000.ipdisk.co.kr:8999/shoplinker/invoice.xml";
|
|
|
+ String apiUrl = GagaShoplinkerConstants.API_DOMAIN + regMap.getApiSubUrl() + URLEncoder.encode(xmlUrl);
|
|
|
+ String responseXmlData = shoplinkerUtil.callShoplinkerApiByGet(apiUrl, "");
|
|
|
+
|
|
|
+ log.info(shoplinkerInvoice.getApiType()+" ####xmlUrl "+xmlUrl);
|
|
|
+ log.info(shoplinkerInvoice.getApiType()+" ####apiUrl "+apiUrl);
|
|
|
+
|
|
|
+ // response 결과
|
|
|
+ com.style24.admin.support.util.ResultMessage22 resultMsg;
|
|
|
+ resultMsg = (com.style24.admin.support.util.ResultMessage22)shoplinkerUtil.unmarshal(com.style24.admin.support.util.ResultMessage22.class, responseXmlData);
|
|
|
+ System.out.println(" ##### invoice2 : "+resultMsg);
|
|
|
+ System.out.println(" ##### invoice3 : "+resultMsg.getResult());
|
|
|
+ System.out.println(" ##### invoice4 : "+resultMsg.getMessage());
|
|
|
+ System.out.println(" ##### invoice5 : "+resultMsg.getId());
|
|
|
+
|
|
|
+ //resultMsg = (com.gagaframework.shoplinker.domain.invoice.ResultMessage)shoplinkerUtil.unmarshal(com.gagaframework.shoplinker.domain.invoice.ResultMessage.class, responseXmlData);
|
|
|
+ apiHstMap.setApiType("INVOICE");
|
|
|
+ apiHstMap.setXmlTxt(sbRequest.toString());
|
|
|
+ apiHstMap.setOrdDtlNo(info.getOrdDtlNo());
|
|
|
+ apiHstMap.setApiResult(resultMsg.getResult());
|
|
|
+ apiHstMap.setApiMessage(resultMsg.getMessage());
|
|
|
+
|
|
|
+ // 생성 파일삭제
|
|
|
+ GagaFileUtil.deleteFile(GagaFileUtil.getConcatenationPath(shoplinkerInvoice.getXmlPath(), xmlFileName.toString()));
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("error", e);
|
|
|
+ apiHstMap.setApiType("INVOICE");
|
|
|
+ apiHstMap.setXmlTxt(sbRequest.toString());
|
|
|
+ apiHstMap.setOrdDtlNo(info.getOrdDtlNo());
|
|
|
+ apiHstMap.setApiResult("error");
|
|
|
+ apiHstMap.setApiMessage("API 통신오류");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 전송이력 저장
|
|
|
+ shoplinkerDao.insertShoplinerApiHst(apiHstMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ *******************************************************************************************/
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 송장전송-목록 건수
|
|
|
+ *
|
|
|
+ * @param shoplinkerInvoice
|
|
|
+ * @return
|
|
|
+ * @author jmh
|
|
|
+ * @since 2020. 5. 21
|
|
|
+ */
|
|
|
+ public int getSendInvoiceListCount(ShoplinkerInvoice shoplinkerInvoice) {
|
|
|
+ return admShoplinkerDao.getSendInvoiceListCount(shoplinkerInvoice);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 송장전송-목록
|
|
|
+ *
|
|
|
+ * @param shoplinkerInvoice
|
|
|
+ * @return
|
|
|
+ * @author jmh
|
|
|
+ * @since 2020. 5. 21
|
|
|
+ */
|
|
|
+ public Collection<ShoplinkerInvoice> getSendInvoiceList(ShoplinkerInvoice shoplinkerInvoice) {
|
|
|
+ return admShoplinkerDao.getSendInvoiceList(shoplinkerInvoice);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 송장전송-목록 엑셀다운로드
|
|
|
+ *
|
|
|
+ * @param shoplinkerInvoice
|
|
|
+ * @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 = admShoplinkerDao.getInvoiceExcelList(shoplinkerInvoice);
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ GagaExcelUtil.createExcel(excelFilenameWithPath, dataList, "샵링커 송장 정보", listTitles, cellNames, cellTypes, TsaConstants.EXCEL_FOOTER_TITLE);
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new IllegalStateException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|