diff --git a/sop-admin/sop-admin-front/assets/css/xadmin.css b/sop-admin/sop-admin-front/assets/css/xadmin.css
index ffd4fe72..d3baaa9c 100644
--- a/sop-admin/sop-admin-front/assets/css/xadmin.css
+++ b/sop-admin/sop-admin-front/assets/css/xadmin.css
@@ -161,6 +161,9 @@ xblock{
.x-green{
color: green;
}
+.x-yellow{
+ color: #ffae19;
+}
.x-a{
color: #1AA093;
}
diff --git a/sop-admin/sop-admin-front/assets/js/Form.js b/sop-admin/sop-admin-front/assets/js/Form.js
new file mode 100644
index 00000000..b6dfcdcf
--- /dev/null
+++ b/sop-admin/sop-admin-front/assets/js/Form.js
@@ -0,0 +1,180 @@
+/**
+ * 表单插件,使用方法:
+ * var myform = layui.Form('formId');
+ * myform.setData({...})
+ *
+ * var data = myform.getData();
+ *
+ * var name = myform.getData('name')
+ */
+layui.define(function (exports) {
+
+ /**
+ * form = new Form('formId');
+ * @param formId
+ * @constructor
+ */
+ var Form = function (formId) {
+ this.$form = $('#' + formId);
+ this.parseForm(this.$form);
+ }
+
+ Form.prototype = {
+ fire: function (eventName, data) {
+ var handler = this['on' + eventName];
+ handler && handler(data);
+ }
+ , opt: function (attr) {
+ return this[attr];
+ }
+ /**
+ * @private
+ */
+ , parseForm: function ($form) {
+ var that = this;
+ this.form = $form[0];
+ this.$els = $form.find('input,select,textarea');
+ }
+
+
+ /**
+ * 同load(data)
+ */
+ , setData: function (data) {
+ this.loadData(data);
+ }
+
+ /**
+ * @private
+ */
+ , loadData: function (data) {
+ this.reset();
+ for (var name in data) {
+ var val = data[name];
+ var $el = this.$form.find('[name="' + name + '"]');
+
+ $el.each(function () {
+ var _$el = $(this);
+ if (_$el.is(':radio') || _$el.is(':checkbox')) {
+ _$el.prop('checked', false);
+ var elVal = _$el.val();
+
+ if ($.isArray(val)) {
+ for (var i = 0, len = val.length; i < len; i++) {
+ if (elVal == val[i]) {
+ _$el.prop('checked', true);
+ }
+ }
+ } else {
+ _$el.prop('checked', elVal == val);
+ }
+
+ } else {
+ _$el.val(val);
+ }
+
+ });
+ }
+ }
+ /**
+ * 清除表单中的值,清除错误信息
+ */
+ , clear: function () {
+ this.$els.each(function () {
+ var _$el = $(this);
+ if (_$el.is(':radio') || _$el.is(':checkbox')) {
+ this.checked = false;
+ } else {
+ this.value = '';
+ }
+
+ var msg = _$el.data('msg');
+ if (msg) {
+ msg.text('');
+ }
+
+ });
+ }
+ /**
+ * 重置表单
+ */
+ , reset: function () {
+ var form = this.form;
+ if (form && form.reset) {
+ form.reset();
+ } else {
+ this.clear();
+ }
+ }
+ /**
+ * 获取表单数据,如果有fieldName参数则返回表单对应的值
+ * var id = form.getData('id') 等同于 var id = form.getData().id;
+ * @param {String} fieldName
+ * @return {Object} 返回JSON对象,如果有fieldName参数,则返回对应的值
+ */
+ , getData: function (fieldName) {
+ var that = this;
+ var data = {};
+
+ this.$els.each(function () {
+ var value = that._getInputVal($(this));
+ if (value) {
+ var name = this.name;
+ var dataValue = data[name];
+ if (dataValue) {
+ if ($.isArray(dataValue)) {
+ dataValue.push(value);
+ } else {
+ data[name] = [dataValue, value];
+ }
+ } else {
+ data[name] = value;
+ }
+ }
+ });
+
+ if (typeof fieldName === 'string') {
+ return data[fieldName];
+ }
+
+ return data;
+ }
+ , getFormData: function ($form) {
+ var data = {};
+ var dataArr = $form.serializeArray();
+ for (var i = 0, len = dataArr.length; i < len; i++) {
+ var item = dataArr[i];
+ var name = item.name;
+ var itemValue = item.value;
+ var dataValue = data[name];
+
+ if (dataValue) {
+ if ($.isArray(dataValue)) {
+ dataValue.push(itemValue);
+ } else {
+ data[name] = [dataValue, itemValue];
+ }
+ } else {
+ data[name] = itemValue;
+ }
+
+ }
+
+ return data;
+ }
+ , _getInputVal: function ($input) {
+ if ($input.is(":radio") || $input.is(":checkbox")) {
+ if ($input.is(':checked')) {
+ return $input.val();
+ }
+ } else {
+ return $input.val();
+ }
+ }
+
+ }
+
+ exports('Form', function (formId) {
+ return new Form(formId);
+ });
+});
\ No newline at end of file
diff --git a/sop-admin/sop-admin-front/assets/js/lib.js b/sop-admin/sop-admin-front/assets/js/lib.js
index 3f4246c5..3dc971ca 100644
--- a/sop-admin/sop-admin-front/assets/js/lib.js
+++ b/sop-admin/sop-admin-front/assets/js/lib.js
@@ -14,6 +14,7 @@ var lib = (function () {
,'../../assets/lib/layui/layui.js'
,'../../assets/lib/easyopen/sdk.js'
,'../../assets/js/ApiUtil.js'
+ ,'../../assets/js/Form.js'
,'../../assets/js/profile.js'
]
@@ -53,7 +54,7 @@ var lib = (function () {
}
return jsArr;
}
-
+
return {
/**
* 加载js模块
diff --git a/sop-admin/sop-admin-front/pages/service/routeManager.html b/sop-admin/sop-admin-front/pages/service/routeManager.html
index e283f866..b061b9e6 100644
--- a/sop-admin/sop-admin-front/pages/service/routeManager.html
+++ b/sop-admin/sop-admin-front/pages/service/routeManager.html
@@ -82,18 +82,25 @@
+
@@ -127,18 +134,25 @@
+
diff --git a/sop-admin/sop-admin-front/pages/service/routeManager.js b/sop-admin/sop-admin-front/pages/service/routeManager.js
index 1ad562bf..31125c79 100644
--- a/sop-admin/sop-admin-front/pages/service/routeManager.js
+++ b/sop-admin/sop-admin-front/pages/service/routeManager.js
@@ -1,13 +1,20 @@
lib.use(['element', 'table', 'tree', 'form'], function () {
+ var ROUTE_STATUS = {
+ '0': '待审核'
+ ,'1': '
已启用'
+ ,'2': '
已禁用'
+ }
+ var profile = window.profile;
var form = layui.form;
+ var updateForm = layui.Form('updateForm');
+ var addForm = layui.Form('addForm');
var table = layui.table;
+
var currentServiceId;
var routeTable;
- var profile = window.profile;
- var $updateForm = $('#updateForm');
- var $addForm = $('#addForm');
var smTitle;
+
form.on('submit(searchFilter)', function (data) {
var param = data.field;
param.serviceId = currentServiceId;
@@ -108,16 +115,17 @@ lib.use(['element', 'table', 'tree', 'form'], function () {
, {field: 'path', title: 'path', width: 200}
, {
field: 'ignoreValidate', width: 80, title: '忽略验证', templet: function (row) {
- return row.ignoreValidate
- ? '
是'
- : '
否';
+ return row.ignoreValidate ? '
是' : '
否';
}
}
, {
- field: 'disabled', title: '状态', width: 80, templet: function (row) {
- return row.disabled
- ? '
禁用'
- : '
启用';
+ field: 'mergeResult', title: '合并结果', width: 80, templet: function (row) {
+ return row.mergeResult ? '合并' : '
不合并';
+ }
+ }
+ , {
+ field: 'status', title: '状态', width: 80, templet: function (row) {
+ return ROUTE_STATUS[row.status + ''];
}
}
, {fixed: 'right', title: '操作', toolbar: '#optBar', width: 100}
@@ -128,38 +136,37 @@ lib.use(['element', 'table', 'tree', 'form'], function () {
table.on('tool(routeTable)', function(obj) {
var data = obj.data;
if(obj.event === 'edit'){
- $updateForm.get(0).reset();
//表单初始赋值
data.profile = profile;
data.serviceId = currentServiceId;
- data.disabled = data.disabled + '';
- data.ignoreValidate = data.ignoreValidate + '';
- form.val('updateWinFilter', data)
+
+ updateForm.setData(data);
+
+ // form.val('updateWinFilter', data);
layer.open({
type: 1
,title: '修改路由' + smTitle
- ,area: ['500px', '400px']
+ ,area: ['500px', '460px']
,content: $('#updateWin') //这里content是一个DOM,注意:最好该元素要存放在body最外层,否则可能被其它的相对元素所影响
});
}
});
table.on('toolbar(routeTable)', function(obj) {
if (obj.event === 'add') {
- $addForm.find('input[name=id]').prop('readonly', false);
- $addForm.get(0).reset();
var data = {};
data.profile = profile;
data.serviceId = currentServiceId;
data.id = '';
// 新加的路由先设置成禁用
- data.disabled = 'true';
- data.ignoreValidate = 'false';
- form.val('addWinFilter', data);
+ data.status = 2;
+ data.ignoreValidate = 0;
+ data.mergeResult = 1;
+ addForm.setData(data);
layer.open({
type: 1
,title: '添加路由' + smTitle
- ,area: ['500px', '400px']
+ ,area: ['500px', '460px']
,content: $('#addWin')
});
}
diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/RouteParam.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/RouteParam.java
index 73e95d83..820481e6 100644
--- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/RouteParam.java
+++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/param/RouteParam.java
@@ -45,13 +45,20 @@ public class RouteParam {
* 是否忽略验证,业务参数验证除外
*/
@NotNull
- @ApiDocField(description = "是否忽略验证")
- private Boolean ignoreValidate;
+ @ApiDocField(description = "是否忽略验证,1:是,0:否")
+ private Integer ignoreValidate;
/**
- * 是否禁用
+ * 状态
*/
@NotNull
- @ApiDocField(description = "是否禁用")
- private Boolean disabled;
+ @ApiDocField(description = "状态,0:审核,1:启用,2:禁用")
+ private Integer status;
+
+ /**
+ * 状态
+ */
+ @NotNull
+ @ApiDocField(description = "是否合并结果,1:是,0:否")
+ private Integer mergeResult;
}
diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/GatewayRouteDefinition.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/GatewayRouteDefinition.java
index 59ada758..f3dab58a 100644
--- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/GatewayRouteDefinition.java
+++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/GatewayRouteDefinition.java
@@ -43,10 +43,15 @@ public class GatewayRouteDefinition {
/**
* 是否忽略验证,业务参数验证除外
*/
- private boolean ignoreValidate;
+ private int ignoreValidate;
/**
- * 是否禁用
+ * 状态,0:待审核,1:启用,2:禁用
*/
- private boolean disabled;
+ private int status = 1;
+
+ /**
+ * 合并结果
+ */
+ private int mergeResult = 1;
}
\ No newline at end of file
diff --git a/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/ApiConfig.java b/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/ApiConfig.java
index b794ab47..28b451c1 100644
--- a/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/ApiConfig.java
+++ b/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/ApiConfig.java
@@ -93,15 +93,17 @@ public class ApiConfig {
private List
i18nModules = new ArrayList();
// -------- fields ---------
+
/**
- * 忽略验证
+ * 忽略验证,设置true,则所有接口不会进行签名校验
*/
private boolean ignoreValidate;
/**
- * 是否对结果进行合并
+ * 是否对结果进行合并。
+ * 默认情况下是否合并结果由微服务端决定,一旦指定该值,则由该值决定,不管微服务端如何设置。
*/
- private boolean mergeResult = true;
+ private Boolean mergeResult;
/**
* 超时时间
diff --git a/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/BaseRouteDefinition.java b/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/BaseRouteDefinition.java
index 987e78d1..d4f74733 100644
--- a/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/BaseRouteDefinition.java
+++ b/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/BaseRouteDefinition.java
@@ -9,6 +9,7 @@ import lombok.Setter;
@Getter
@Setter
public class BaseRouteDefinition {
+
/**
* 路由的Id
*/
@@ -31,15 +32,19 @@ public class BaseRouteDefinition {
/**
* 是否忽略验证,业务参数验证除外
*/
- private boolean ignoreValidate;
+ private int ignoreValidate;
/**
- * 是否禁用
+ * 状态,0:待审核,1:启用,2:禁用
*/
- private boolean disabled;
+ private int status = 1;
/**
* 是否合并结果
*/
- private boolean mergeResult;
+ private int mergeResult;
+
+ public boolean enable() {
+ return status == RouteStatus.ENABLE.getStatus();
+ }
}
diff --git a/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/RouteStatus.java b/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/RouteStatus.java
new file mode 100644
index 00000000..bc72bbc5
--- /dev/null
+++ b/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/RouteStatus.java
@@ -0,0 +1,25 @@
+package com.gitee.sop.gatewaycommon.bean;
+
+/**
+ * @author tanghc
+ */
+public enum RouteStatus {
+ AUDIT(0, "待审核"),
+ ENABLE(1, "已启用"),
+ DISABLE(2, "已禁用"),
+ ;
+ private int status;
+ private String description;
+
+ RouteStatus(int status, String description) {
+ this.status = status;
+ this.description = description;
+ }
+
+ public int getStatus() {
+ return status;
+ }
+
+ public String getDescription() {
+ return description;
+ }}
diff --git a/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/route/NameVersionRoutePredicateFactory.java b/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/route/NameVersionRoutePredicateFactory.java
index cd94d346..cc6686cc 100644
--- a/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/route/NameVersionRoutePredicateFactory.java
+++ b/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/route/NameVersionRoutePredicateFactory.java
@@ -64,7 +64,7 @@ public class NameVersionRoutePredicateFactory extends AbstractRoutePredicateFact
boolean match = (name + version).equals(nameVersion);
if (match) {
TargetRoute targetRoute = RouteRepositoryContext.getRouteRepository().get(nameVersion);
- if (targetRoute != null && targetRoute.getRouteDefinition().isDisabled()) {
+ if (targetRoute != null && !targetRoute.getRouteDefinition().enable()) {
return false;
}
}
diff --git a/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/param/ApiParamFactory.java b/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/param/ApiParamFactory.java
index 4193035c..038d9fdb 100644
--- a/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/param/ApiParamFactory.java
+++ b/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/param/ApiParamFactory.java
@@ -6,6 +6,7 @@ import com.gitee.sop.gatewaycommon.manager.RouteRepository;
import com.gitee.sop.gatewaycommon.manager.RouteRepositoryContext;
import com.gitee.sop.gatewaycommon.message.ErrorEnum;
import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.BooleanUtils;
import java.util.Map;
@@ -30,7 +31,7 @@ public class ApiParamFactory {
if (routeDefinition == null) {
throw ErrorEnum.ISV_INVALID_METHOD.getErrorMeta().getException();
}
- apiParam.setIgnoreValidate(routeDefinition.isIgnoreValidate());
+ apiParam.setIgnoreValidate(BooleanUtils.toBoolean(routeDefinition.getIgnoreValidate()));
return apiParam;
}
}
diff --git a/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/result/BaseExecutorAdapter.java b/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/result/BaseExecutorAdapter.java
index 1cdf7057..2e4f257d 100644
--- a/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/result/BaseExecutorAdapter.java
+++ b/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/result/BaseExecutorAdapter.java
@@ -9,6 +9,7 @@ import com.gitee.sop.gatewaycommon.manager.RouteRepositoryContext;
import com.gitee.sop.gatewaycommon.message.ErrorEnum;
import com.gitee.sop.gatewaycommon.message.ErrorMeta;
import com.gitee.sop.gatewaycommon.param.ParamNames;
+import org.apache.commons.lang.BooleanUtils;
import org.springframework.http.HttpStatus;
import org.springframework.util.StringUtils;
@@ -48,7 +49,7 @@ public abstract class BaseExecutorAdapter implements ResultExecutor
@Override
public String mergeResult(T request, String serviceResult) {
- boolean isMergeResult = this.isRouteMergeResult(request);
+ boolean isMergeResult = this.isMergeResult(request);
if (!isMergeResult) {
return serviceResult;
}
@@ -80,26 +81,26 @@ public abstract class BaseExecutorAdapter implements ResultExecutor
* @param request
* @return
*/
- protected boolean isRouteMergeResult(T request) {
- boolean defaultSetting = ApiContext.getApiConfig().isMergeResult();
- boolean isMergeResult = true;
+ protected boolean isMergeResult(T request) {
+ // 默认全局设置
+ Boolean defaultSetting = ApiContext.getApiConfig().getMergeResult();
+ if (defaultSetting != null) {
+ return defaultSetting;
+ }
Map params = this.getApiParam(request);
Object name = params.get(ParamNames.API_NAME);
Object version = params.get(ParamNames.VERSION_NAME);
if(name == null) {
+ // 随便生成一个name
name = System.currentTimeMillis();
}
TargetRoute targetRoute = RouteRepositoryContext.getRouteRepository().get(String.valueOf(name) + version);
if (targetRoute == null) {
- return defaultSetting;
+ return true;
} else {
- isMergeResult = targetRoute.getRouteDefinition().isMergeResult();
- }
- // 如果路由说合并,还得看网关全局设置,网关全局设置优先级最大
- if (isMergeResult) {
- isMergeResult = defaultSetting;
+ int mergeResult = targetRoute.getRouteDefinition().getMergeResult();
+ return BooleanUtils.toBoolean(mergeResult);
}
- return isMergeResult;
}
protected String wrapResult(String serviceResult) {
diff --git a/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/route/SopRouteLocator.java b/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/route/SopRouteLocator.java
index c5175404..0972e51a 100644
--- a/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/route/SopRouteLocator.java
+++ b/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/route/SopRouteLocator.java
@@ -50,8 +50,8 @@ public class SopRouteLocator implements RouteLocator, Ordered {
if (zuulTargetRoute == null) {
return null;
}
- // 路由被禁用
- if (zuulTargetRoute.getRouteDefinition().isDisabled()) {
+ // 路由是否启用
+ if (!zuulTargetRoute.getRouteDefinition().enable()) {
throw ErrorEnum.ISV_INVALID_METHOD.getErrorMeta().getException();
}
return zuulTargetRoute.getTargetRouteDefinition();
diff --git a/sop-service-common/pom.xml b/sop-service-common/pom.xml
index 0a3a3b0a..fd3bb690 100644
--- a/sop-service-common/pom.xml
+++ b/sop-service-common/pom.xml
@@ -16,6 +16,7 @@
2.1.2.RELEASE
1.8
1.8
+ 3.8.1
1.2.15
3.4.12
@@ -50,6 +51,13 @@
spring-boot-starter-data-redis
+
+
+ org.apache.commons
+ commons-lang3
+ ${commons-lang3.version}
+
+
com.alibaba
fastjson
diff --git a/sop-service-common/src/main/java/com/gitee/sop/servercommon/bean/ServiceApiInfo.java b/sop-service-common/src/main/java/com/gitee/sop/servercommon/bean/ServiceApiInfo.java
index 7c69ebbc..59628584 100644
--- a/sop-service-common/src/main/java/com/gitee/sop/servercommon/bean/ServiceApiInfo.java
+++ b/sop-service-common/src/main/java/com/gitee/sop/servercommon/bean/ServiceApiInfo.java
@@ -23,9 +23,9 @@ public class ServiceApiInfo {
/** 版本号 */
private String version;
/** 是否忽略验证 */
- private boolean ignoreValidate;
+ private int ignoreValidate;
/** 是否合并结果 */
- private boolean mergeResult;
+ private int mergeResult;
public ApiMeta() {
}
diff --git a/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/EasyopenServiceConfiguration.java b/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/EasyopenServiceConfiguration.java
index 090afcde..6a229866 100644
--- a/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/EasyopenServiceConfiguration.java
+++ b/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/EasyopenServiceConfiguration.java
@@ -1,30 +1,26 @@
package com.gitee.sop.servercommon.configuration;
-import com.gitee.easyopen.ApiContext;
import com.gitee.easyopen.annotation.Api;
-import com.gitee.easyopen.annotation.ApiService;
import com.gitee.easyopen.util.ReflectionUtil;
import com.gitee.sop.servercommon.bean.ServiceApiInfo;
import com.gitee.sop.servercommon.manager.ApiMetaManager;
import com.gitee.sop.servercommon.manager.DefaultRequestMappingEvent;
import com.gitee.sop.servercommon.manager.RequestMappingEvent;
import com.gitee.sop.servercommon.mapping.ApiMappingHandlerMapping;
+import org.apache.commons.lang3.BooleanUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.core.env.Environment;
-import org.springframework.util.ReflectionUtils;
import org.springframework.util.StringUtils;
-import org.springframework.web.method.HandlerMethod;
-import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
import java.util.function.Consumer;
/**
* 提供给easyopen项目使用
+ *
* @author tanghc
*/
public class EasyopenServiceConfiguration extends BaseServiceConfiguration {
@@ -59,7 +55,7 @@ public class EasyopenServiceConfiguration extends BaseServiceConfiguration {
ServiceApiInfo.ApiMeta apiMeta = new ServiceApiInfo.ApiMeta();
apiMeta.setName(api.name());
apiMeta.setVersion(api.version());
- apiMeta.setIgnoreValidate(api.ignoreValidate());
+ apiMeta.setIgnoreValidate(BooleanUtils.toInteger(api.ignoreValidate()));
// /api/goods.get/
String servletPath = this.buildPath(api);
apiMeta.setPath(servletPath);
diff --git a/sop-service-common/src/main/java/com/gitee/sop/servercommon/manager/DefaultRequestMappingEvent.java b/sop-service-common/src/main/java/com/gitee/sop/servercommon/manager/DefaultRequestMappingEvent.java
index 14bdb3ac..4170803f 100644
--- a/sop-service-common/src/main/java/com/gitee/sop/servercommon/manager/DefaultRequestMappingEvent.java
+++ b/sop-service-common/src/main/java/com/gitee/sop/servercommon/manager/DefaultRequestMappingEvent.java
@@ -5,8 +5,8 @@ import com.gitee.sop.servercommon.mapping.ApiMappingHandlerMapping;
import com.gitee.sop.servercommon.mapping.ApiMappingInfo;
import com.gitee.sop.servercommon.mapping.ApiMappingRequestCondition;
import lombok.Getter;
+import org.apache.commons.lang3.BooleanUtils;
import org.springframework.core.env.Environment;
-import org.springframework.util.DigestUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.mvc.condition.RequestCondition;
@@ -92,8 +92,8 @@ public class DefaultRequestMappingEvent implements RequestMappingEvent {
name = buildName(path);
}
ServiceApiInfo.ApiMeta apiMeta = new ServiceApiInfo.ApiMeta(name, path, version);
- apiMeta.setIgnoreValidate(apiMappingInfo.isIgnoreValidate());
- apiMeta.setMergeResult(apiMappingInfo.isMergeResult());
+ apiMeta.setIgnoreValidate(BooleanUtils.toInteger(apiMappingInfo.isIgnoreValidate()));
+ apiMeta.setMergeResult(BooleanUtils.toInteger(apiMappingInfo.isMergeResult()));
return apiMeta;
}
return null;
diff --git a/sop-service-common/src/main/java/com/gitee/sop/servercommon/manager/ServiceZookeeperApiMetaManager.java b/sop-service-common/src/main/java/com/gitee/sop/servercommon/manager/ServiceZookeeperApiMetaManager.java
index 9899c75d..0c35012b 100644
--- a/sop-service-common/src/main/java/com/gitee/sop/servercommon/manager/ServiceZookeeperApiMetaManager.java
+++ b/sop-service-common/src/main/java/com/gitee/sop/servercommon/manager/ServiceZookeeperApiMetaManager.java
@@ -110,8 +110,8 @@ public class ServiceZookeeperApiMetaManager implements ApiMetaManager {
String path = this.buildServletPath(serviceApiInfo, apiMeta);
gatewayRouteDefinition.setUri(uri);
gatewayRouteDefinition.setPath(path);
- gatewayRouteDefinition.setIgnoreValidate(apiMeta.isIgnoreValidate());
- gatewayRouteDefinition.setMergeResult(apiMeta.isMergeResult());
+ gatewayRouteDefinition.setIgnoreValidate(apiMeta.getIgnoreValidate());
+ gatewayRouteDefinition.setMergeResult(apiMeta.getMergeResult());
return gatewayRouteDefinition;
}
diff --git a/sop-service-common/src/main/java/com/gitee/sop/servercommon/route/GatewayRouteDefinition.java b/sop-service-common/src/main/java/com/gitee/sop/servercommon/route/GatewayRouteDefinition.java
index f028847d..6de1a81f 100644
--- a/sop-service-common/src/main/java/com/gitee/sop/servercommon/route/GatewayRouteDefinition.java
+++ b/sop-service-common/src/main/java/com/gitee/sop/servercommon/route/GatewayRouteDefinition.java
@@ -43,15 +43,15 @@ public class GatewayRouteDefinition {
/**
* 是否忽略验证,业务参数验证除外
*/
- private boolean ignoreValidate;
+ private int ignoreValidate;
/**
- * 是否禁用
+ * 状态,0:待审核,1:启用,2:禁用
*/
- private boolean disabled;
+ private int status = 1;
/**
* 是否合并结果
*/
- private boolean mergeResult;
+ private int mergeResult;
}
\ No newline at end of file