From 9ee1c19a9e982722ac16ca774fc0733ad78471a1 Mon Sep 17 00:00:00 2001
From: Junjie <DELL@qq.com>
Date: 星期二, 23 十二月 2025 09:37:47 +0800
Subject: [PATCH] #

---
 src/main/webapp/views/httpRequestLog/httpRequestLog.html   |    9 ++++
 src/main/webapp/static/js/httpRequestLog/httpRequestLog.js |    1 
 src/main/java/com/zy/core/utils/WmsOperateUtils.java       |   49 ++++++++++++++++++++----
 src/main/resources/mapper/HttpRequestLogMapper.xml         |    1 
 src/main/java/com/zy/asrs/entity/HttpRequestLog.java       |    5 ++
 5 files changed, 56 insertions(+), 9 deletions(-)

diff --git a/src/main/java/com/zy/asrs/entity/HttpRequestLog.java b/src/main/java/com/zy/asrs/entity/HttpRequestLog.java
index a46ccff..755044c 100644
--- a/src/main/java/com/zy/asrs/entity/HttpRequestLog.java
+++ b/src/main/java/com/zy/asrs/entity/HttpRequestLog.java
@@ -36,9 +36,12 @@
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
     private Date createTime;
 
+    @ApiModelProperty(value= "")
+    private Integer result;
+
     public HttpRequestLog() {}
 
-    public HttpRequestLog(String name,String request,String response,Date createTime) {
+    public HttpRequestLog(String name,String request,String response,Date createTime,Integer result) {
         this.name = name;
         this.request = request;
         this.response = response;
diff --git a/src/main/java/com/zy/core/utils/WmsOperateUtils.java b/src/main/java/com/zy/core/utils/WmsOperateUtils.java
index 07da8b9..0f855a4 100644
--- a/src/main/java/com/zy/core/utils/WmsOperateUtils.java
+++ b/src/main/java/com/zy/core/utils/WmsOperateUtils.java
@@ -1,10 +1,8 @@
 package com.zy.core.utils;
 
 import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
-import com.core.common.Cools;
-import com.core.exception.CoolException;
 import com.zy.asrs.entity.BasCrnp;
 import com.zy.asrs.entity.HttpRequestLog;
 import com.zy.asrs.entity.WrkMast;
@@ -66,6 +64,7 @@
 
         HashMap<String, Object> requestParam = new HashMap<>();
         String response = null;
+        int result = 0;
         try {
             requestParam.put("barcode", barcode);
             requestParam.put("sourceStaNo", sourceStaNo);
@@ -79,7 +78,17 @@
                     .setTimeout(360, TimeUnit.SECONDS)
                     .build()
                     .doPost();
-            News.info("璇锋眰WMS鍏ュ簱鎺ュ彛鎴愬姛锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + wmsSystemInUrl, JSON.toJSONString(requestParam), response);
+            if (response != null) {
+                JSONObject jsonObject = JSON.parseObject(response);
+                if (jsonObject.getInteger("code") == 200) {
+                    result = 1;
+                    News.info("璇锋眰WMS鍏ュ簱鎺ュ彛鎴愬姛锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + wmsSystemInUrl, JSON.toJSONString(requestParam), response);
+                }else {
+                    News.info("璇锋眰WMS鍏ュ簱鎺ュ彛澶辫触锛屾帴鍙h繑鍥濩ode寮傚父锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + wmsSystemInUrl, JSON.toJSONString(requestParam), response);
+                }
+            }else {
+                News.info("璇锋眰WMS鍏ュ簱鎺ュ彛澶辫触锛屾帴鍙f湭鍝嶅簲锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + wmsSystemInUrl, JSON.toJSONString(requestParam), response);
+            }
         } catch (Exception e) {
             News.error("璇锋眰WMS鍏ュ簱鎺ュ彛寮傚父锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + wmsSystemInUrl, JSON.toJSONString(requestParam), response, e);
         } finally {
@@ -88,6 +97,7 @@
             httpRequestLog.setRequest(JSON.toJSONString(requestParam));
             httpRequestLog.setResponse(response);
             httpRequestLog.setCreateTime(new Date());
+            httpRequestLog.setResult(result);
             httpRequestLogService.insert(httpRequestLog);
         }
         return response;
@@ -125,6 +135,7 @@
 
         HashMap<String, Object> requestParam = new HashMap<>();
         String response = null;
+        int result = 0;
         try {
             requestParam.put("taskNo", wrkMast.getWmsWrkNo());
             requestParam.put("row", Utils.getInTaskEnableRow(new ArrayList<>(wrkMast.getCrnNo()), false));
@@ -136,7 +147,17 @@
                     .setTimeout(360, TimeUnit.SECONDS)
                     .build()
                     .doPost();
-            News.info("璇锋眰鐢宠浠诲姟閲嶆柊鍒嗛厤鍏ュ簱鎺ュ彛鎴愬姛锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + wmsSystemReassignInTaskUrl, JSON.toJSONString(requestParam), response);
+            if (response != null) {
+                JSONObject jsonObject = JSON.parseObject(response);
+                if (jsonObject.getInteger("code") == 200) {
+                    result = 1;
+                    News.info("璇锋眰鐢宠浠诲姟閲嶆柊鍒嗛厤鍏ュ簱鎺ュ彛鎴愬姛锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + wmsSystemReassignInTaskUrl, JSON.toJSONString(requestParam), response);
+                }else {
+                    News.info("璇锋眰鐢宠浠诲姟閲嶆柊鍒嗛厤鍏ュ簱鎺ュ彛澶辫触锛屾帴鍙h繑鍥濩ode寮傚父锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + wmsSystemReassignInTaskUrl, JSON.toJSONString(requestParam), response);
+                }
+            }else {
+                News.info("璇锋眰鐢宠浠诲姟閲嶆柊鍒嗛厤鍏ュ簱鎺ュ彛澶辫触锛屾帴鍙f湭鍝嶅簲锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + wmsSystemReassignInTaskUrl, JSON.toJSONString(requestParam), response);
+            }
         } catch (Exception e) {
             News.error("璇锋眰鐢宠浠诲姟閲嶆柊鍒嗛厤鍏ュ簱鎺ュ彛寮傚父锛侊紒锛乽rl锛歿}锛況equest锛歿}锛� response锛歿}", wmsUrl + wmsSystemReassignInTaskUrl, JSON.toJSONString(requestParam), response, e);
         } finally {
@@ -145,6 +166,7 @@
             httpRequestLog.setRequest(JSON.toJSONString(requestParam));
             httpRequestLog.setResponse(response);
             httpRequestLog.setCreateTime(new Date());
+            httpRequestLog.setResult(result);
             httpRequestLogService.insert(httpRequestLog);
         }
         return response;
@@ -191,6 +213,7 @@
 
         HashMap<String, Object> requestParam = new HashMap<>();
         String response = null;
+        int result = 0;
         try {
             requestParam.put("locNo", locNo);
             requestParam.put("row", crnRows);
@@ -202,9 +225,18 @@
                     .setTimeout(360, TimeUnit.SECONDS)
                     .build()
                     .doPost();
-            News.info("璇锋眰WMS鐢宠鏇存崲搴撲綅鎺ュ彛鎴愬姛锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + wmsSystemChangeLocNoUrl, JSON.toJSONString(requestParam), response);
 
-            return response;
+            if (response != null) {
+                JSONObject jsonObject = JSON.parseObject(response);
+                if (jsonObject.getInteger("code") == 200) {
+                    result = 1;
+                    News.info("璇锋眰WMS鐢宠鏇存崲搴撲綅鎺ュ彛鎴愬姛锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + wmsSystemChangeLocNoUrl, JSON.toJSONString(requestParam), response);
+                }else {
+                    News.info("璇锋眰WMS鐢宠鏇存崲搴撲綅鎺ュ彛澶辫触锛屾帴鍙h繑鍥濩ode寮傚父锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + wmsSystemChangeLocNoUrl, JSON.toJSONString(requestParam), response);
+                }
+            }else {
+                News.info("璇锋眰WMS鐢宠鏇存崲搴撲綅鎺ュ彛澶辫触锛屾帴鍙f湭鍝嶅簲锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + wmsSystemChangeLocNoUrl, JSON.toJSONString(requestParam), response);
+            }
         } catch (Exception e) {
             News.error("璇锋眰WMS鐢宠鏇存崲搴撲綅鎺ュ彛寮傚父锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + wmsSystemChangeLocNoUrl, JSON.toJSONString(requestParam), response, e);
         } finally {
@@ -213,9 +245,10 @@
             httpRequestLog.setRequest(JSON.toJSONString(requestParam));
             httpRequestLog.setResponse(response);
             httpRequestLog.setCreateTime(new Date());
+            httpRequestLog.setResult(result);
             httpRequestLogService.insert(httpRequestLog);
         }
-        return null;
+        return response;
     }
 
 }
diff --git a/src/main/resources/mapper/HttpRequestLogMapper.xml b/src/main/resources/mapper/HttpRequestLogMapper.xml
index ef5b6b7..f06a0e9 100644
--- a/src/main/resources/mapper/HttpRequestLogMapper.xml
+++ b/src/main/resources/mapper/HttpRequestLogMapper.xml
@@ -9,6 +9,7 @@
         <result column="request" property="request" />
         <result column="response" property="response" />
         <result column="create_time" property="createTime" />
+        <result column="result" property="result" />
 
     </resultMap>
 
diff --git a/src/main/webapp/static/js/httpRequestLog/httpRequestLog.js b/src/main/webapp/static/js/httpRequestLog/httpRequestLog.js
index 18c2727..da9ed91 100644
--- a/src/main/webapp/static/js/httpRequestLog/httpRequestLog.js
+++ b/src/main/webapp/static/js/httpRequestLog/httpRequestLog.js
@@ -26,6 +26,7 @@
             ,{field: 'name', align: 'center',title: 'URL'}
             ,{field: 'request', align: 'center',title: '璇锋眰鍙傛暟'}
             ,{field: 'response', align: 'center',title: '鍝嶅簲鍙傛暟'}
+            ,{field: 'result$', align: 'center',title: '缁撴灉', templet: '#resTpl', width: 80}
             ,{field: 'createTime$', align: 'center',title: '璇锋眰鏃堕棿'}
 
             ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:120}
diff --git a/src/main/webapp/views/httpRequestLog/httpRequestLog.html b/src/main/webapp/views/httpRequestLog/httpRequestLog.html
index da49c37..12d3ed5 100644
--- a/src/main/webapp/views/httpRequestLog/httpRequestLog.html
+++ b/src/main/webapp/views/httpRequestLog/httpRequestLog.html
@@ -60,6 +60,15 @@
     <a class="layui-btn layui-btn-danger layui-btn-xs btn-edit" lay-event="del">鍒犻櫎</a>
 </script>
 
+<script type="text/html" id="resTpl">
+    <span name="settle"
+          {{# if( d.result === 1){ }}
+          class="layui-badge layui-badge-green" >鎴愬姛</span>
+    {{# }else { }}
+    class="layui-badge layui-badge-red" >澶辫触</span>
+    {{# } }}
+</script>
+
 <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
 <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script>
 <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>

--
Gitblit v1.9.1