From 0950b4eaf72d2b253fbc378f5dd56b59a2a6a4ab Mon Sep 17 00:00:00 2001 From: liukangdong <898885815@qq.com> Date: 星期四, 19 九月 2024 10:43:07 +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 | 125 +++++++++++++++++++++++++++-------------- 1 files changed, 83 insertions(+), 42 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 9b5a429..1ca7bc2 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,10 +1,8 @@ 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; -import com.doumee.core.annotation.pr.PreventRepeat; import com.doumee.core.exception.BusinessException; import com.doumee.core.utils.Constants; import com.doumee.core.wms.model.request.WmsActionNoticeRequest; @@ -16,19 +14,11 @@ 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; /** * @author 姹熻箘韫� @@ -47,58 +37,109 @@ @ApiOperation("銆怶MS銆戞帹閫佸叆搴撳崟閫氱煡浠诲姟") @PostMapping("/push/inboundNotice") @LoginNoRequired - public WmsBaseResponse inboundNotice(HttpServletRequest request, HttpServletResponse response) { - doPringParam(request,"銆怶MS銆戞帹閫佸叆搴撳崟閫氱煡浠诲姟"); - return new WmsBaseResponse(); + 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; } @ApiOperation("銆怶MS銆戞帹閫佸嚭搴撳崟閫氱煡浠诲姟") @LoginNoRequired @PostMapping("/push/outboundNotice") - public WmsBaseResponse outboundNotice(HttpServletRequest request, HttpServletResponse response) { - doPringParam(request,"銆怶MS銆戞帹閫佸嚭搴撳崟閫氱煡浠诲姟"); - return new WmsBaseResponse(); + 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; } @ApiOperation("銆怶MS銆戞帹閫佸彇娑堝叆搴撳崟閫氱煡浠诲姟") @LoginNoRequired @PostMapping("/push/cancelInbound") - public WmsBaseResponse cancelInbound(HttpServletRequest request, HttpServletResponse response) { - doPringParam(request,"銆怶MS銆戞帹閫佸彇娑堝叆搴撳崟閫氱煡浠诲姟"); - return new WmsBaseResponse(); + 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; } @ApiOperation("銆怶MS銆戞帹閫佸彇娑堝嚭搴撳崟閫氱煡浠诲姟") @LoginNoRequired @PostMapping("/push/cancelOutbound") - public WmsBaseResponse cancelOutbound(HttpServletRequest request, HttpServletResponse response) { - doPringParam(request,"銆怶MS銆戞帹閫佸彇娑堝嚭搴撳崟閫氱煡浠诲姟"); - return new WmsBaseResponse(); + 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; } - @ApiOperation("銆怶MS銆戞帹閫佸嚭鍏ュ簱浣滀笟瀹屾垚閫氱煡浠诲姟") @LoginNoRequired @PostMapping("/push/doneTask") - public WmsBaseResponse doneTask(HttpServletRequest request, HttpServletResponse response) { - doPringParam(request,"銆怶MS銆戞帹閫佸嚭鍏ュ簱浣滀笟瀹屾垚閫氱煡浠诲姟"); - return new WmsBaseResponse(); - } - - private void doPringParam(HttpServletRequest request,String name) { + public WmsBaseResponse doneTask(@RequestBody WmsBaseRequest<WmsActionNoticeRequest> param) { + int success = Constants.ZERO; + WmsBaseResponse result = null; 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+"=================锛氬弬鏁颁负绌�"); - } + result = wmsService.doneTask(param); + }catch (BusinessException e){ + log.error("銆怶MS銆戞帹閫佸嚭鍏ュ簱浣滀笟瀹屾垚閫氱煡浠诲姟===澶辫触锛�"+e.getMessage()); + success = Constants.ONE; }catch (Exception e){ - - log.info(name+"================= 鍙傛暟寮傚父锛�"+e.getMessage()); + 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; } } -- Gitblit v1.9.3