|
@@ -5,6 +5,7 @@ import java.io.IOException;
|
|
|
import java.net.URLEncoder;
|
|
import java.net.URLEncoder;
|
|
|
import java.util.Collection;
|
|
import java.util.Collection;
|
|
|
|
|
|
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.core.env.Environment;
|
|
import org.springframework.core.env.Environment;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
@@ -135,6 +136,7 @@ public class TsbShoplinkerStockJob extends TsbAbstractJob<Collection<ShoplinkerG
|
|
|
private int callGoodsRegApi(ShoplinkerGoods map, StringBuilder sbRequest, String fileNm) throws IOException {
|
|
private int callGoodsRegApi(ShoplinkerGoods map, StringBuilder sbRequest, String fileNm) throws IOException {
|
|
|
|
|
|
|
|
int succCnt = 0;
|
|
int succCnt = 0;
|
|
|
|
|
+ String responseXmlData = "";
|
|
|
StringBuilder xmlFileName = new StringBuilder();
|
|
StringBuilder xmlFileName = new StringBuilder();
|
|
|
com.gagaframework.shoplinker.domain.goods.result.Shoplinker shoplinkerResult;
|
|
com.gagaframework.shoplinker.domain.goods.result.Shoplinker shoplinkerResult;
|
|
|
com.gagaframework.shoplinker.domain.goods.result.ResultMessage resultMsg;
|
|
com.gagaframework.shoplinker.domain.goods.result.ResultMessage resultMsg;
|
|
@@ -153,12 +155,12 @@ public class TsbShoplinkerStockJob extends TsbAbstractJob<Collection<ShoplinkerG
|
|
|
String apiUrl = GagaShoplinkerConstants.API_DOMAIN + map.getApiSubUrl() + URLEncoder.encode(xmlUrl);
|
|
String apiUrl = GagaShoplinkerConstants.API_DOMAIN + map.getApiSubUrl() + URLEncoder.encode(xmlUrl);
|
|
|
|
|
|
|
|
// API 호출결과
|
|
// API 호출결과
|
|
|
- String responseXmlData = shoplinkerUtil.callShoplinkerApiByGet(apiUrl, "");
|
|
|
|
|
|
|
+ responseXmlData = shoplinkerUtil.callShoplinkerApiByGet(apiUrl, "");
|
|
|
|
|
|
|
|
// response 결과
|
|
// response 결과
|
|
|
shoplinkerResult = (com.gagaframework.shoplinker.domain.goods.result.Shoplinker)shoplinkerUtil.unmarshal(com.gagaframework.shoplinker.domain.goods.result.Shoplinker.class, responseXmlData);
|
|
shoplinkerResult = (com.gagaframework.shoplinker.domain.goods.result.Shoplinker)shoplinkerUtil.unmarshal(com.gagaframework.shoplinker.domain.goods.result.Shoplinker.class, responseXmlData);
|
|
|
resultMsg = shoplinkerResult.getResultMessage();
|
|
resultMsg = shoplinkerResult.getResultMessage();
|
|
|
- map.setXmlTxt("stock_"+fileNm+"\n"+sbRequest.toString());
|
|
|
|
|
|
|
+ map.setXmlTxt(sbRequest.toString());
|
|
|
map.setApiProductId(resultMsg.getProductId());
|
|
map.setApiProductId(resultMsg.getProductId());
|
|
|
map.setApiResult(resultMsg.getResult());
|
|
map.setApiResult(resultMsg.getResult());
|
|
|
map.setApiMessage(resultMsg.getMessage());
|
|
map.setApiMessage(resultMsg.getMessage());
|
|
@@ -172,9 +174,9 @@ public class TsbShoplinkerStockJob extends TsbAbstractJob<Collection<ShoplinkerG
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
log.error("error", e);
|
|
log.error("error", e);
|
|
|
- map.setXmlTxt("stock_"+fileNm+"\n"+sbRequest.toString());
|
|
|
|
|
|
|
+ map.setXmlTxt(sbRequest.toString());
|
|
|
map.setApiResult("error");
|
|
map.setApiResult("error");
|
|
|
- map.setApiMessage("API 통신오류");
|
|
|
|
|
|
|
+ map.setApiMessage("API 오류 " +StringUtils.abbreviate(responseXmlData, 0 , 120));
|
|
|
|
|
|
|
|
shoplinkerService.updateStockInfo(map);
|
|
shoplinkerService.updateStockInfo(map);
|
|
|
}
|
|
}
|