瀏覽代碼

Merge branch 'develop' of http://112.172.147.34:4936/style24/style24.core into develop

jsshin 4 年之前
父節點
當前提交
59e2727802

+ 51 - 1
src/main/java/com/style24/core/biz/thirdparty/HansaeErp.java

@@ -41,7 +41,10 @@ public class HansaeErp {
 
 	// 재고 URL
 	private String stockUrl = "http://erp.hansaemk.com:96/api/#{erpGb}/Shop/StockCheck";
-
+	
+	// RT URL
+	private String stockRtUrl = "http://erp.hansaemk.com:96/api/#{erpGb}/Shop/StockRTConfirm";
+		
 	// 매출반영 URL
 	private String salesUrl = "http://erp.hansaemk.com:96/api/#{erpGb}/Shop/SaleIF";
 
@@ -284,4 +287,51 @@ public class HansaeErp {
 		return salesMap;
 	}
 
+	/**
+	 * ERP RT
+	 * @param erpGb - ERP구분(hsmk:한세MK, hsdr:한세드림)
+	 * @param Collection<Erp> - 재고이동 정보  
+	 * @return
+	 * @author moon
+	 * @since 2021. 06. 21
+	 */
+	public String erpStockRt(String erpGb, Collection<Erp> rtList) {
+		GagaMap salesMap = new GagaMap();
+		String rtn = "S";
+
+		try {
+			// Parameter
+			String requestData = (new Gson()).toJson(rtList, new TypeToken<Collection<Erp>>() {
+			}.getType());
+			MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
+			params.add("DATA", requestData);
+			log.info("params: {}", params);
+
+			String requestUrl = GagaStringUtil.replace(stockRtUrl, "#{erpGb}", erpGb);
+			log.info("requestUrl: {}", requestUrl);
+
+			HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(params);
+			URI url = URI.create(requestUrl);
+
+			// POST방식으로 호출
+			ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, request, String.class);
+			log.info("responseEntity.getStatusCode(): {} ", responseEntity.getStatusCode());
+
+			String jsonResult = responseEntity.getBody();
+			log.info("responseEntity.getBody(): {}", jsonResult);
+
+			Gson gson = new Gson();
+			GagaMap resultMap = gson.fromJson(jsonResult, GagaMap.class);
+
+			if (resultMap.containsKey("Message")) { // 실패 메시지
+				log.error("Message: {}", resultMap.get("Message").toString());
+				rtn = "F";
+			} 
+		} catch (Exception e) {
+			log.error("{}", e.getMessage().toString());
+		}
+
+		return rtn;
+	}
+	
 }

+ 6 - 0
src/main/java/com/style24/persistence/domain/Erp.java

@@ -38,5 +38,11 @@ public class Erp implements Serializable {
 	// 매출반영 Response
 	private String CD_SALEBILL;	// 판매전표번호(매출일자, 브랜드 단위)
 	private String DS_ERROR;	// 실패메시지
+	
+	// rt
+	private String CD_RTOUTSHOP; // 매장코드
+	private String QT_RTOUT;     // 수량 
+	private String DS_INVOICE;   // 송장번호
+	
 
 }