jmh 4 лет назад
Родитель
Сommit
23230cf699

+ 6 - 4
src/main/java/com/style24/batch/biz/job/shoplinker/TsbShoplinkerStockJob.java

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