From 6ef869b1adcf3a5bb8e4c3117dc507d173f13fd8 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期三, 18 九月 2024 15:19:55 +0800
Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/dmvisit

---
 server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/WmsPushCloudController.java |  152 ++++++++++++++++++--------------------------------
 1 files changed, 54 insertions(+), 98 deletions(-)

diff --git a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/WmsPushCloudController.java b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/WmsPushCloudController.java
index 25e0b13..9b5a429 100644
--- a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/WmsPushCloudController.java
+++ b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/WmsPushCloudController.java
@@ -1,5 +1,6 @@
 package com.doumee.cloud.admin;
 
+import com.alibaba.cloud.commons.io.IOUtils;
 import com.alibaba.fastjson.JSONObject;
 import com.doumee.api.BaseController;
 import com.doumee.config.annotation.LoginNoRequired;
@@ -15,12 +16,18 @@
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
 import java.util.List;
 
 /**
@@ -30,119 +37,68 @@
 @Api(tags = "WMS骞冲彴鏁版嵁鎺ㄩ�佹帴鍙�")
 @RestController
 @Slf4j
+@LoginNoRequired
 @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/wms")
 public class WmsPushCloudController extends BaseController {
 
     @Autowired
     private WmsService wmsService;
 
-    @PreventRepeat
-    @ApiOperation("銆怌MS銆戞帹閫佸叆搴撳崟閫氱煡浠诲姟")
+    @ApiOperation("銆怶MS銆戞帹閫佸叆搴撳崟閫氱煡浠诲姟")
     @PostMapping("/push/inboundNotice")
-    public WmsBaseResponse inboundNotice(@RequestBody WmsBaseRequest<WmsInboundNoticeRequest> param) {
-
-        int success = Constants.ZERO;
-        WmsBaseResponse result =null;
-        try {
-            result = wmsService.inboundNotice(param);
-        }catch (BusinessException e){
-            log.error("銆怌MS銆戞帹閫佸叆搴撳崟閫氱煡浠诲姟===澶辫触锛�"+e.getMessage());
-            success = Constants.ONE;
-        }catch (Exception e){
-            log.error("銆怌MS銆戞帹閫佸叆搴撳崟閫氱煡浠诲姟===澶辫触锛�"+e.getMessage());
-            e.printStackTrace();
-            success = Constants.ONE;
-        }finally {
-            wmsService.saveInterfaceLog("/wms/push/inboundNotice", "鎺ㄩ�佸叆搴撳崟閫氱煡浠诲姟",JSONObject.toJSONString(param),
-                    success, JSONObject.toJSONString(result),Constants.ONE);
-        }
-
-        return result;
+    @LoginNoRequired
+    public WmsBaseResponse inboundNotice(HttpServletRequest request, HttpServletResponse response)   {
+        doPringParam(request,"銆怶MS銆戞帹閫佸叆搴撳崟閫氱煡浠诲姟");
+        return new WmsBaseResponse();
     }
 
-    @PreventRepeat
-    @ApiOperation("銆怌MS銆戞帹閫佸嚭搴撳崟閫氱煡浠诲姟")
+    @ApiOperation("銆怶MS銆戞帹閫佸嚭搴撳崟閫氱煡浠诲姟")
+    @LoginNoRequired
     @PostMapping("/push/outboundNotice")
-    public WmsBaseResponse outboundNotice(@RequestBody WmsBaseRequest<WmsOutboundNoticeRequest> param) {
-        int success = Constants.ZERO;
-        WmsBaseResponse result =null;
-        try {
-            result = wmsService.outboundNotice(param);
-        }catch (BusinessException e){
-            log.error("銆怌MS銆戞帹閫佸嚭搴撳崟閫氱煡浠诲姟===澶辫触锛�"+e.getMessage());
-            success = Constants.ONE;
-        }catch (Exception e){
-            log.error("銆怌MS銆戞帹閫佸嚭搴撳崟閫氱煡浠诲姟===澶辫触锛�"+e.getMessage());
-            e.printStackTrace();
-            success = Constants.ONE;
-        }finally {
-            wmsService.saveInterfaceLog("/wms/push/outboundNotice", "鎺ㄩ�佸嚭搴撳崟閫氱煡浠诲姟",JSONObject.toJSONString(param),success
-                    , JSONObject.toJSONString(result),Constants.ONE);
-        }
-
-        return result;
+    public WmsBaseResponse outboundNotice(HttpServletRequest request, HttpServletResponse response)   {
+        doPringParam(request,"銆怶MS銆戞帹閫佸嚭搴撳崟閫氱煡浠诲姟");
+        return new WmsBaseResponse();
     }
-    @PreventRepeat
-    @ApiOperation("銆怌MS銆戞帹閫佸彇娑堝叆搴撳崟閫氱煡浠诲姟")
+    @ApiOperation("銆怶MS銆戞帹閫佸彇娑堝叆搴撳崟閫氱煡浠诲姟")
+    @LoginNoRequired
     @PostMapping("/push/cancelInbound")
-    public WmsBaseResponse cancelInbound(@RequestBody WmsBaseRequest<WmsActionNoticeRequest> param) {
-        int success = Constants.ZERO;
-        WmsBaseResponse result =null;
-        try {
-            result = wmsService.cancelInbound(param);
-        }catch (BusinessException e){
-            log.error("銆怌MS銆戞帹閫佸彇娑堝叆搴撳崟閫氱煡浠诲姟===澶辫触锛�"+e.getMessage());
-            success = Constants.ONE;
-        }catch (Exception e){
-            log.error("銆怌MS銆戞帹閫佸彇娑堝叆搴撳崟閫氱煡浠诲姟===澶辫触锛�"+e.getMessage());
-            e.printStackTrace();
-            success = Constants.ONE;
-        }finally {
-            wmsService.saveInterfaceLog("/wms/push/cancelInbound", "鎺ㄩ�佸彇娑堝叆搴撳崟閫氱煡浠诲姟",JSONObject.toJSONString(param),
-                    success, JSONObject.toJSONString(result),Constants.ONE);
-        }
-        return result;
+    public WmsBaseResponse cancelInbound(HttpServletRequest request, HttpServletResponse response)   {
+        doPringParam(request,"銆怶MS銆戞帹閫佸彇娑堝叆搴撳崟閫氱煡浠诲姟");
+        return new WmsBaseResponse();
     }
-    @PreventRepeat
-    @ApiOperation("銆怌MS銆戞帹閫佸彇娑堝嚭搴撳崟閫氱煡浠诲姟")
+    @ApiOperation("銆怶MS銆戞帹閫佸彇娑堝嚭搴撳崟閫氱煡浠诲姟")
+    @LoginNoRequired
     @PostMapping("/push/cancelOutbound")
-    public WmsBaseResponse cancelOutbound(@RequestBody WmsBaseRequest<WmsActionNoticeRequest> param) {
-        int success = Constants.ZERO;
-        WmsBaseResponse result =null;
-        try {
-            result = wmsService.cancelOutbound(param);
-        }catch (BusinessException e){
-            log.error("銆怌MS銆戞帹閫佸彇娑堝嚭搴撳崟閫氱煡浠诲姟===澶辫触锛�"+e.getMessage());
-            success = Constants.ONE;
-        }catch (Exception e){
-            log.error("銆怌MS銆戞帹閫佸彇娑堝嚭搴撳崟閫氱煡浠诲姟===澶辫触锛�"+e.getMessage());
-            e.printStackTrace();
-            success = Constants.ONE;
-        }finally {
-            wmsService.saveInterfaceLog("/wms/push/cancelOutbound", "鎺ㄩ�佸彇娑堝嚭搴撳崟閫氱煡浠诲姟",
-                    JSONObject.toJSONString(param),  success, JSONObject.toJSONString(result),Constants.ONE);
-        }
-        return result;
+    public WmsBaseResponse cancelOutbound(HttpServletRequest request, HttpServletResponse response)   {
+        doPringParam(request,"銆怶MS銆戞帹閫佸彇娑堝嚭搴撳崟閫氱煡浠诲姟");
+        return new WmsBaseResponse();
     }
-    @PreventRepeat
-    @ApiOperation("銆怌MS銆戞帹閫佸嚭鍏ュ簱浣滀笟瀹屾垚閫氱煡浠诲姟")
+
+    @ApiOperation("銆怶MS銆戞帹閫佸嚭鍏ュ簱浣滀笟瀹屾垚閫氱煡浠诲姟")
+    @LoginNoRequired
     @PostMapping("/push/doneTask")
-    public WmsBaseResponse doneTask(@RequestBody WmsBaseRequest<WmsActionNoticeRequest> param) {
-        int success = Constants.ZERO;
-        WmsBaseResponse result =null;
-        try {
-            result = wmsService.doneTask(param);
-        }catch (BusinessException e){
-            log.error("銆怌MS銆戞帹閫佸嚭鍏ュ簱浣滀笟瀹屾垚閫氱煡浠诲姟===澶辫触锛�"+e.getMessage());
-            success = Constants.ONE;
-        }catch (Exception e){
-            log.error("銆怌MS銆戞帹閫佸嚭鍏ュ簱浣滀笟瀹屾垚閫氱煡浠诲姟===澶辫触锛�"+e.getMessage());
-            e.printStackTrace();
-            success = Constants.ONE;
-        }finally {
-            wmsService.saveInterfaceLog("/wms/push/doneTask", "鎺ㄩ�佸嚭鍏ュ簱浣滀笟瀹屾垚閫氱煡浠诲姟",JSONObject.toJSONString(param),
-                    success, JSONObject.toJSONString(result),Constants.ONE);
-        }
-        return result;
+    public WmsBaseResponse doneTask(HttpServletRequest request, HttpServletResponse response)   {
+        doPringParam(request,"銆怶MS銆戞帹閫佸嚭鍏ュ簱浣滀笟瀹屾垚閫氱煡浠诲姟");
+        return new WmsBaseResponse();
     }
+
+    private void doPringParam(HttpServletRequest request,String name) {
+        try {
+            StringBuilder data =new StringBuilder();
+            String line;
+            BufferedReader reader =request.getReader();
+            while(null !=(line = reader.readLine())) {
+                data.append(line);
+            }
+            if(StringUtils.isNotBlank( data.toString())){
+                log.info(name+"=================鍙傛暟锛�"+ data.toString());
+            }else {
+                log.info(name+"=================锛氬弬鏁颁负绌�");
+            }
+        }catch (Exception e){
+
+            log.info(name+"================= 鍙傛暟寮傚父锛�"+e.getMessage());
+        }
+    }
+
 }

--
Gitblit v1.9.3