|
@@ -41,7 +41,7 @@ public class TsbShoplinkerStockAllJob extends TsbAbstractJob<Collection<Shoplink
|
|
|
@Override
|
|
@Override
|
|
|
public Collection<ShoplinkerGoods> read() throws Exception {
|
|
public Collection<ShoplinkerGoods> read() throws Exception {
|
|
|
|
|
|
|
|
- // 재고 전체전송목록 - 1000 건씩 가져옴
|
|
|
|
|
|
|
+ // 재고 전체전송목록 - 1300 건씩 가져옴
|
|
|
return shoplinkerService.getSyncStockAllList();
|
|
return shoplinkerService.getSyncStockAllList();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -54,28 +54,9 @@ public class TsbShoplinkerStockAllJob extends TsbAbstractJob<Collection<Shoplink
|
|
|
public String write(Collection<ShoplinkerGoods> stockList) throws Exception {
|
|
public String write(Collection<ShoplinkerGoods> stockList) throws Exception {
|
|
|
ShoplinkerGoods regMap = new ShoplinkerGoods();
|
|
ShoplinkerGoods regMap = new ShoplinkerGoods();
|
|
|
|
|
|
|
|
- // xml 생성경로
|
|
|
|
|
- String xmlPath = env.getProperty("shoplinker.xml.path");
|
|
|
|
|
-
|
|
|
|
|
- // 샵링커 기본폴더 존재여부 확인
|
|
|
|
|
- String slFolder = GagaFileUtil.getConcatenationPath(xmlPath);
|
|
|
|
|
- File slPath = new File(slFolder);
|
|
|
|
|
- if (!slPath.exists()) {
|
|
|
|
|
- slPath.mkdir();
|
|
|
|
|
- }
|
|
|
|
|
- //하위폴더존재확인(재고)
|
|
|
|
|
- slFolder = GagaFileUtil.getConcatenationPath(xmlPath+"/stock");
|
|
|
|
|
- slPath = new File(slFolder);
|
|
|
|
|
- if (!slPath.exists()) {
|
|
|
|
|
- slPath.mkdir();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
if (stockList != null && !stockList.isEmpty()) {
|
|
if (stockList != null && !stockList.isEmpty()) {
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
// 2. xml 파일 정보세팅
|
|
// 2. xml 파일 정보세팅
|
|
|
- String toDtTime = GagaDateUtil.getTodayDateTime();
|
|
|
|
|
String customerId = env.getProperty("shoplinker.customer_id");
|
|
String customerId = env.getProperty("shoplinker.customer_id");
|
|
|
regMap.setSendYn("N"); // 성공이 아닐경우만 개별업데이트
|
|
regMap.setSendYn("N"); // 성공이 아닐경우만 개별업데이트
|
|
|
regMap.setAllUpdYn("N"); // 성공이 아닐경우만 개별업데이트
|
|
regMap.setAllUpdYn("N"); // 성공이 아닐경우만 개별업데이트
|
|
@@ -86,13 +67,8 @@ public class TsbShoplinkerStockAllJob extends TsbAbstractJob<Collection<Shoplink
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
StringBuilder sbRequest;
|
|
StringBuilder sbRequest;
|
|
|
- int qty = 0;
|
|
|
|
|
for (ShoplinkerGoods map : stockList) {
|
|
for (ShoplinkerGoods map : stockList) {
|
|
|
|
|
|
|
|
- // 21.10.18 재고비율 추가 - 샵링커에 전송 및 전송이력에는 재고비율 수량으로 저장함
|
|
|
|
|
- // 참고)재고 마스터 테이블에는 원 수량임(동기화 처리시에도 원 수량으로 됨)
|
|
|
|
|
- qty = GetStockQtyForBrand(map, false);
|
|
|
|
|
-
|
|
|
|
|
// xml 데이터 세팅
|
|
// xml 데이터 세팅
|
|
|
sbRequest = new StringBuilder();
|
|
sbRequest = new StringBuilder();
|
|
|
sbRequest.append("<?xml version=\"1.0\" encoding=\"euc-kr\"?>\n");
|
|
sbRequest.append("<?xml version=\"1.0\" encoding=\"euc-kr\"?>\n");
|
|
@@ -102,14 +78,14 @@ public class TsbShoplinkerStockAllJob extends TsbAbstractJob<Collection<Shoplink
|
|
|
sbRequest.append(" <customer_id>").append(customerId).append("</customer_id>\n");
|
|
sbRequest.append(" <customer_id>").append(customerId).append("</customer_id>\n");
|
|
|
sbRequest.append(" <mall_update_yn>N</mall_update_yn>\n");
|
|
sbRequest.append(" <mall_update_yn>N</mall_update_yn>\n");
|
|
|
sbRequest.append(" <partner_product_id><![CDATA[").append(map.getOptCd()).append("]]></partner_product_id>\n");
|
|
sbRequest.append(" <partner_product_id><![CDATA[").append(map.getOptCd()).append("]]></partner_product_id>\n");
|
|
|
- sbRequest.append(" <quantity>").append(qty).append("</quantity>\n");
|
|
|
|
|
|
|
+ sbRequest.append(" <quantity>").append(map.getQuantity()).append("</quantity>\n");
|
|
|
|
|
|
|
|
sbRequest.append(" </product>\n");
|
|
sbRequest.append(" </product>\n");
|
|
|
sbRequest.append("</shoplinker>\n");
|
|
sbRequest.append("</shoplinker>\n");
|
|
|
|
|
|
|
|
regMap.setGoodsCd(map.getGoodsCd());
|
|
regMap.setGoodsCd(map.getGoodsCd());
|
|
|
regMap.setOptCd(map.getOptCd());
|
|
regMap.setOptCd(map.getOptCd());
|
|
|
- regMap.setQuantity(qty);
|
|
|
|
|
|
|
+ regMap.setQuantity(map.getQuantity());
|
|
|
|
|
|
|
|
// 3. api 호출 및 결과 history 저장
|
|
// 3. api 호출 및 결과 history 저장
|
|
|
callGoodsRegApi(regMap , sbRequest, map.getOptCd());
|
|
callGoodsRegApi(regMap , sbRequest, map.getOptCd());
|
|
@@ -203,112 +179,4 @@ public class TsbShoplinkerStockAllJob extends TsbAbstractJob<Collection<Shoplink
|
|
|
return succCnt;
|
|
return succCnt;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 샵링커 브랜드별 재고비율
|
|
|
|
|
- *
|
|
|
|
|
- * @return
|
|
|
|
|
- * @author jmh
|
|
|
|
|
- * @since 2021. 10. 18
|
|
|
|
|
- */
|
|
|
|
|
- private int GetStockQtyForBrand(ShoplinkerGoods map, boolean isFirst)
|
|
|
|
|
- {
|
|
|
|
|
- int resultQty = 0;
|
|
|
|
|
- String brandCd = map.getBrandCd();
|
|
|
|
|
- int qty = map.getQuantity();
|
|
|
|
|
-
|
|
|
|
|
- if (brandCd.equals("S0016") || brandCd.equals("S0018") || brandCd.equals("S0012"))
|
|
|
|
|
- {
|
|
|
|
|
- if (qty >= 0 && qty <= 5)
|
|
|
|
|
- {
|
|
|
|
|
- resultQty = isFirst ? 1 : 0;
|
|
|
|
|
- }
|
|
|
|
|
- else if (qty >= 6 && qty <= 29)
|
|
|
|
|
- {
|
|
|
|
|
- resultQty = (int)Math.floor(qty * 0.25);
|
|
|
|
|
- }
|
|
|
|
|
- else if (qty >= 30)
|
|
|
|
|
- {
|
|
|
|
|
- resultQty = (int)Math.floor(qty * 0.4);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else if (brandCd.equals("S0005"))
|
|
|
|
|
- {
|
|
|
|
|
- if (qty >= 0 && qty <= 3)
|
|
|
|
|
- {
|
|
|
|
|
- resultQty = isFirst ? 1 : 0;
|
|
|
|
|
- }
|
|
|
|
|
- else if (qty >= 4 && qty <= 29)
|
|
|
|
|
- {
|
|
|
|
|
- resultQty = (int)Math.floor(qty * 0.25);
|
|
|
|
|
- }
|
|
|
|
|
- else if (qty >= 30)
|
|
|
|
|
- {
|
|
|
|
|
- resultQty = (int)Math.floor(qty * 0.4);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else if (brandCd.equals("S0003") || brandCd.equals("S0004") || brandCd.equals("S0007") || brandCd.equals("S0001") || brandCd.equals("S0006"))
|
|
|
|
|
- {
|
|
|
|
|
- if (qty >= 0 && qty <= 3)
|
|
|
|
|
- {
|
|
|
|
|
- resultQty = isFirst ? 1 : 0;
|
|
|
|
|
- }
|
|
|
|
|
- else if (qty >= 4 && qty <= 29)
|
|
|
|
|
- {
|
|
|
|
|
- resultQty = (int)Math.ceil(qty * 0.25);
|
|
|
|
|
- }
|
|
|
|
|
- else if (qty >= 30)
|
|
|
|
|
- {
|
|
|
|
|
- resultQty = (int)Math.floor(qty * 0.4);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else if (brandCd.equals("S0013"))
|
|
|
|
|
- {
|
|
|
|
|
- if (qty >= 0 && qty <= 2)
|
|
|
|
|
- {
|
|
|
|
|
- resultQty = isFirst ? 1 : 0;
|
|
|
|
|
- }
|
|
|
|
|
- else if (qty >= 3 && qty <= 29)
|
|
|
|
|
- {
|
|
|
|
|
- resultQty = (int)Math.ceil(qty * 0.25);
|
|
|
|
|
- }
|
|
|
|
|
- else if (qty >= 30)
|
|
|
|
|
- {
|
|
|
|
|
- resultQty = (int)Math.floor(qty * 0.4);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- else if (brandCd.equals("S0015"))
|
|
|
|
|
- {
|
|
|
|
|
- if (qty >= 0 && qty <= 2)
|
|
|
|
|
- {
|
|
|
|
|
- resultQty = isFirst ? 1 : 0;
|
|
|
|
|
- }
|
|
|
|
|
- else if (qty >= 3 && qty <= 29)
|
|
|
|
|
- {
|
|
|
|
|
- resultQty = (int)Math.ceil(qty * 0.25);
|
|
|
|
|
- }
|
|
|
|
|
- else if (qty >= 30)
|
|
|
|
|
- {
|
|
|
|
|
- resultQty = (int)Math.floor(qty * 0.4);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- if (qty >= 0 && qty <= 2)
|
|
|
|
|
- {
|
|
|
|
|
- resultQty = isFirst ? 1 : 0;
|
|
|
|
|
- }
|
|
|
|
|
- else if (qty >= 3 && qty <= 29)
|
|
|
|
|
- {
|
|
|
|
|
- resultQty = (int)Math.ceil(qty * 0.25);
|
|
|
|
|
- }
|
|
|
|
|
- else if (qty >= 30)
|
|
|
|
|
- {
|
|
|
|
|
- resultQty = (int)Math.floor(qty * 0.4);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return resultQty;
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|