From 288f12d5dde74ce5bbfc11e64e16670c4b73415e Mon Sep 17 00:00:00 2001 From: liuzicheng <13656693893@163.com> Date: Thu, 14 Sep 2023 11:30:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jqtx/windows/common/factory/CommandProxy.java | 8 +++++++- ...{CreditController.java => BaseController.java} | 15 +++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) rename src/main/java/com/jqtx/windows/web/{CreditController.java => BaseController.java} (62%) diff --git a/src/main/java/com/jqtx/windows/common/factory/CommandProxy.java b/src/main/java/com/jqtx/windows/common/factory/CommandProxy.java index e571cd2..294e355 100644 --- a/src/main/java/com/jqtx/windows/common/factory/CommandProxy.java +++ b/src/main/java/com/jqtx/windows/common/factory/CommandProxy.java @@ -1,17 +1,20 @@ package com.jqtx.windows.common.factory; import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.jqtx.windows.common.exception.BizException; import com.jqtx.windows.infrastructure.enums.ExceptionCodeEnum; import com.jqtx.windows.utils.AbcRsaUtil; import com.jqtx.windows.web.config.RouterConfig; import com.jqtx.windows.web.response.JsonResult; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @Service +@Slf4j public class CommandProxy { @Value("${abc.publicKey}") @@ -36,7 +39,10 @@ public class CommandProxy { ChannelConfig channelConfig = new ChannelConfig(); channelConfig.setAppId(appId); this.setLocalContext(requestBody,channelConfig); - return command.doAction(); + log.info("[娴欏啘璇锋眰request:澶勭悊command:{}------------>{}]",command.getClass().getSimpleName(),decodeBody); + JsonResult result = command.doAction(); + log.info("[娴欏啘璇锋眰response:澶勭悊command:{}=============>{}]",command.getClass().getSimpleName(),JSON.toJSONString(result)); + return result; } public void setLocalContext(String requestBody, ChannelConfig channelConfig) { diff --git a/src/main/java/com/jqtx/windows/web/CreditController.java b/src/main/java/com/jqtx/windows/web/BaseController.java similarity index 62% rename from src/main/java/com/jqtx/windows/web/CreditController.java rename to src/main/java/com/jqtx/windows/web/BaseController.java index d8e11e9..2a23b71 100644 --- a/src/main/java/com/jqtx/windows/web/CreditController.java +++ b/src/main/java/com/jqtx/windows/web/BaseController.java @@ -6,23 +6,22 @@ import com.jqtx.windows.web.response.JsonResult; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import javax.servlet.http.HttpServletRequest; - @RestController @RequestMapping("/zhenong/v1") -@Api(tags = "鎺堜俊鎺ュ彛") -public class CreditController { +@Api(tags = "缃戝叧鎺ュ彛") +public class BaseController { @Autowired private CommandProxy commandProxy; - @ApiOperation(value = "鎻愪氦鎺堜俊") - @PostMapping("/credit_submit") - public JsonResult creditSubmit(HttpServletRequest request, String requestBody) { - return commandProxy.call(requestBody,request.getRequestURI()); + @ApiOperation(value = "缃戝叧鎺ュ彛") + @PostMapping("/{url}") + public JsonResult creditSubmit(@PathVariable String url, String requestBody) { + return commandProxy.call(requestBody,url); } } -- 2.18.1