From c48e3aabf2947e45a9db2eac3ef91190e8647655 Mon Sep 17 00:00:00 2001
From: skyouc <958836976@qq.com>
Date: 星期二, 02 九月 2025 17:03:34 +0800
Subject: [PATCH] agv站点功能调整

---
 rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/impl/WmsRcsServiceImpl.java |   35 +++++++++++++++++++++++++++++++++--
 1 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/impl/WmsRcsServiceImpl.java b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/impl/WmsRcsServiceImpl.java
index 0ecefd8..6adacd8 100644
--- a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/impl/WmsRcsServiceImpl.java
+++ b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/impl/WmsRcsServiceImpl.java
@@ -11,9 +11,11 @@
 import com.vincent.rsf.framework.exception.CoolException;
 import com.vincent.rsf.openApi.config.PlatformProperties;
 import com.vincent.rsf.openApi.entity.Loc;
+import com.vincent.rsf.openApi.entity.constant.WmsConstant;
 import com.vincent.rsf.openApi.entity.dto.CommonResponse;
 import com.vincent.rsf.openApi.entity.constant.RcsConstant;
 import com.vincent.rsf.openApi.entity.dto.SyncLocsDto;
+import com.vincent.rsf.openApi.entity.params.ExMsgCallbackParams;
 import com.vincent.rsf.openApi.entity.params.RcsPubTaskParams;
 import com.vincent.rsf.openApi.entity.params.SyncRcsLocsParam;
 import com.vincent.rsf.openApi.mapper.LocMapper;
@@ -39,6 +41,9 @@
 
     @Autowired
     private PlatformProperties rcsApi;
+
+    @Autowired
+    private PlatformProperties.WmsApi wmsApi;
 
     @Autowired
     private RestTemplate restTemplate;
@@ -99,8 +104,34 @@
      * @version 1.0
      */
     @Override
-    public R callBackEvent(Map<String, Object> params) {
-        return R.ok();
+    public R callBackEvent(ExMsgCallbackParams params) {
+        String callUrl =  wmsApi.getHost() + ":" + wmsApi.getPort() + WmsConstant.callBack;
+        /**WMS鍩虹閰嶇疆閾炬帴*/
+        log.info("浠诲姟鎵ц鐘舵�佷笂鎶ワ紝璇锋眰鍦板潃锛� {}锛� 璇锋眰鍙傛暟锛� {}", callUrl , JSONObject.toJSONString(params));
+        HttpHeaders headers = new HttpHeaders();
+        headers.add("Content-Type", "application/json");
+        headers.add("api-version", "v2.0");
+        HttpEntity httpEntity = new HttpEntity(params, headers);
+        ResponseEntity<String> exchange = restTemplate.exchange(callUrl, HttpMethod.POST, httpEntity, String.class);
+        log.info("浠诲姟鎵ц鐘舵�佷笂鎶ワ紝鍝嶅簲缁撴灉锛� {}", exchange);
+        if (Objects.isNull(exchange.getBody())) {
+            return R.error();
+        } else {
+            ObjectMapper objectMapper = new ObjectMapper();
+            objectMapper.coercionConfigDefaults()
+                    .setCoercion(CoercionInputShape.EmptyString, CoercionAction.AsEmpty);
+            try {
+                CommonResponse result = objectMapper.readValue(exchange.getBody(), CommonResponse.class);
+                if (result.getCode() == 200) {
+                    return R.ok();
+                } else {
+                    return R.error(result.getMsg());
+//                    throw new CoolException("浠诲姟鎵ц鐘舵�佷笂鎶ュけ璐ワ紒锛�");
+                }
+            } catch (JsonProcessingException e) {
+                throw new CoolException(e.getMessage());
+            }
+        }
     }
 
     /**

--
Gitblit v1.9.1