Merge branch 'develop'

master
tanghc 3 years ago
commit b1e346d48d
  1. 4
      sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/ApiConfig.java
  2. 4
      sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/result/BizResultHandler.java
  3. 4
      sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/result/GatewayResultExecutor.java
  4. 4
      sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/result/BaseExecutorAdapter.java

@ -1,6 +1,6 @@
package com.gitee.sop.gatewaycommon.bean; package com.gitee.sop.gatewaycommon.bean;
import com.gitee.sop.gatewaycommon.gateway.result.BizContentHandler; import com.gitee.sop.gatewaycommon.gateway.result.BizResultHandler;
import com.gitee.sop.gatewaycommon.gateway.result.GatewayResultExecutor; import com.gitee.sop.gatewaycommon.gateway.result.GatewayResultExecutor;
import com.gitee.sop.gatewaycommon.interceptor.RouteInterceptor; import com.gitee.sop.gatewaycommon.interceptor.RouteInterceptor;
import com.gitee.sop.gatewaycommon.limit.DefaultLimitManager; import com.gitee.sop.gatewaycommon.limit.DefaultLimitManager;
@ -147,7 +147,7 @@ public class ApiConfig {
/** /**
* 业务返回参数处理 * 业务返回参数处理
*/ */
private BizContentHandler bizContentHandler = (serviceData, serviceObj, apiParam, request) -> { private BizResultHandler bizResultHandler = (serviceData, serviceObj, apiParam, request) -> {
serviceData.putAll(serviceObj); serviceData.putAll(serviceObj);
}; };

@ -7,10 +7,10 @@ import org.springframework.web.server.ServerWebExchange;
import java.util.Map; import java.util.Map;
/** /**
* 处理业务数据 * 处理业务返回数据
* @author thc * @author thc
*/ */
public interface BizContentHandler { public interface BizResultHandler {
/** /**
* 处理业务参数 * 处理业务参数

@ -96,7 +96,7 @@ public class GatewayResultExecutor extends BaseExecutorAdapter<ServerWebExchange
} }
@Override @Override
protected void handleBizContent(Map<String, Object> serviceData, JSONObject serviceObj, ApiParam apiParam, ServerWebExchange request) { protected void handleBizResult(Map<String, Object> serviceData, JSONObject serviceObj, ApiParam apiParam, ServerWebExchange request) {
ApiConfig.getInstance().getBizContentHandler().handle(serviceData, serviceObj, apiParam, request); ApiConfig.getInstance().getBizResultHandler().handle(serviceData, serviceObj, apiParam, request);
} }
} }

@ -179,11 +179,11 @@ public abstract class BaseExecutorAdapter<T, R> implements ResultExecutor<T, R>
serviceData.put(GATEWAY_CODE_NAME, errorMeta.getCode()); serviceData.put(GATEWAY_CODE_NAME, errorMeta.getCode());
serviceData.put(GATEWAY_MSG_NAME, errorMeta.getError(getLocale(request)).getMsg()); serviceData.put(GATEWAY_MSG_NAME, errorMeta.getError(getLocale(request)).getMsg());
JSONObject serviceObj = JSON.parseObject(serviceResult, Feature.OrderedField); JSONObject serviceObj = JSON.parseObject(serviceResult, Feature.OrderedField);
this.handleBizContent(serviceData, serviceObj, apiParam, request); this.handleBizResult(serviceData, serviceObj, apiParam, request);
return serviceData; return serviceData;
} }
protected abstract void handleBizContent(Map<String, Object> serviceData, JSONObject serviceObj, ApiParam apiParam, T request); protected abstract void handleBizResult(Map<String, Object> serviceData, JSONObject serviceObj, ApiParam apiParam, T request);
/** /**

Loading…
Cancel
Save