|
|
@@ -1,5 +1,6 @@
|
|
|
package com.style24.core.biz.service;
|
|
|
|
|
|
+import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.text.DecimalFormat;
|
|
|
@@ -155,7 +156,7 @@ public class TscShoplinkerService {
|
|
|
currListCount = map.getInt("currListCount");
|
|
|
|
|
|
DecimalFormat formatter = new DecimalFormat("###,###");
|
|
|
- slkSearch.setTxt("["+shoplinkerOrder.getInfoStr()+"]"+ " 총페이지: "+totalPage+ "("+formatter.format(totalCount)+"건) || "+currentlyPage);
|
|
|
+ slkSearch.setTxt(fileAddNm+" ["+shoplinkerOrder.getInfoStr()+"]"+ " 총페이지: "+totalPage+ "("+formatter.format(totalCount)+"건) || "+currentlyPage);
|
|
|
updateCallApiRunable(slkSearch);
|
|
|
|
|
|
if( currentlyPage < 1 ) currentlyPage = 1;
|
|
|
@@ -177,7 +178,7 @@ public class TscShoplinkerService {
|
|
|
}else {
|
|
|
// 수집건없음, 수집실패, 오류
|
|
|
log.info("\n################### SHOPLINKER_CHECK 4 : "+ map);
|
|
|
- String txt = "["+shoplinkerOrder.getInfoStr()+"] "+ map.getString("RESULT_MESSAGE");
|
|
|
+ String txt = fileAddNm+" ["+shoplinkerOrder.getInfoStr()+"] "+ map.getString("RESULT_MSG");
|
|
|
slkSearch.setTxt(StringUtils.abbreviate(txt, 0 , 200));
|
|
|
updateCallApiRunable(slkSearch);
|
|
|
}
|
|
|
@@ -238,21 +239,42 @@ public class TscShoplinkerService {
|
|
|
|
|
|
|
|
|
GagaShoplinkertUtil shoplinkerUtil = new GagaShoplinkertUtil("MS949");
|
|
|
- log.info("\n################### SHOPLINKER_CHECK 1 : "+ shoplinkerUtil);
|
|
|
-
|
|
|
+ String responseXmlPath = "";
|
|
|
+
|
|
|
// XML 파일 생성
|
|
|
StringBuilder xmlFileName = new StringBuilder();
|
|
|
xmlFileName.append("order"+"_"+fileAddNm).append(".xml");
|
|
|
String xmlPath = GagaFileUtil.getConcatenationPath(shoplinkerOrder.getXmlPath(), xmlFileName.toString());
|
|
|
+ log.info("\n################### SHOPLINKER_CHECK 0-1 : "+shoplinkerOrder.getProfiles()+" | "+ xmlPath);
|
|
|
+ log.info("\n################### SHOPLINKER_CHECK 0-2 : "+shoplinkerOrder.getXmlPath());
|
|
|
+ // 파일 권한확인 --------------------------------------------------
|
|
|
+ File dir = new File(shoplinkerOrder.getXmlPath());
|
|
|
+ if (dir.canRead()){
|
|
|
+ log.info("\n################### SHOPLINKER_CHECK 1-1 읽기 가능 ");
|
|
|
+ }
|
|
|
+ // 쓰기 가능한 파일인지 확인
|
|
|
+ if (dir.canWrite()){
|
|
|
+ log.info("\n################### SHOPLINKER_CHECK 1-2 쓰기 가능 ");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 파일 권한확인 끝 ------------------------------------------------
|
|
|
shoplinkerUtil.makeRequestXmlFile(sbRequest.toString(), xmlPath);
|
|
|
+ log.info("\n################### SHOPLINKER_CHECK 2-1 : ");
|
|
|
String xmlUrl = GagaFileUtil.getConcatenationPath(shoplinkerOrder.getDomainUrl(), xmlFileName.toString());
|
|
|
-
|
|
|
- log.info("\n################### SHOPLINKER_CHECK 2 : "+shoplinkerOrder.getProfiles()+" // "+ xmlPath);
|
|
|
+ log.info("\n################### SHOPLINKER_CHECK 2-2 : "+xmlUrl);
|
|
|
if (!"locd".equals(shoplinkerOrder.getProfiles())) { // 로컬이 아닐때
|
|
|
try {
|
|
|
// API 호출
|
|
|
responseXmlData = shoplinkerUtil.callShoplinkerApiByGet(GagaShoplinkerConstants.API_DOMAIN+regMap.getApiSubUrl()+URLEncoder.encode(xmlUrl), "");
|
|
|
-
|
|
|
+
|
|
|
+ // 받은 내용 쌓음.(누락 데이터 확인용)
|
|
|
+ try {
|
|
|
+ responseXmlPath = GagaFileUtil.getConcatenationPath(shoplinkerOrder.getXmlPath(), "rp_"+fileAddNm+"_"+shoplinkerOrder.getOrderPageNo()+".xml");
|
|
|
+ shoplinkerUtil.makeRequestXmlFile(responseXmlData, responseXmlPath);
|
|
|
+ }catch(Exception e) {
|
|
|
+ log.error("insertShoplinkerOrderStep1Xml > responseXmlData error "+e);
|
|
|
+ }
|
|
|
+
|
|
|
// response 결과
|
|
|
shoplinkerResult = (com.gagaframework.shoplinker.domain.orderlist.Shoplinker)shoplinkerUtil.unmarshal(com.gagaframework.shoplinker.domain.orderlist.Shoplinker.class, responseXmlData);
|
|
|
rHeader = shoplinkerResult.getHeader();
|
|
|
@@ -328,13 +350,13 @@ public class TscShoplinkerService {
|
|
|
orderFailResultMsg = orderFailResult.getResultMessage();
|
|
|
|
|
|
returnMap.setString("RESULT_TYPE", orderFailResultMsg.getResult());
|
|
|
- returnMap.setString("RESULT_MESSAGE", orderFailResultMsg.getMessage());
|
|
|
+ returnMap.setString("RESULT_MSG", orderFailResultMsg.getMessage());
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
log.error("insertShoplinkerOrderStep1Xml error", e);
|
|
|
returnMap.setString("RESULT_TYPE", TscConstants.ShoplinkerApiStat.ERROR.value());
|
|
|
- returnMap.setString("RESULT_MESSAGE", StringUtils.abbreviate(e.getMessage(), 0 , 120));
|
|
|
+ returnMap.setString("RESULT_MSG", StringUtils.abbreviate(e.getMessage(), 0 , 120));
|
|
|
|
|
|
// 상세오류내역
|
|
|
ShoplinkerGoods map = new ShoplinkerGoods();
|