fix: --bug=1007798 --user=陈建星 【接口定义】swagger导入之后覆盖了标签,是不应该覆盖噢 https://www.tapd.cn/55049933/s/1068036

This commit is contained in:
chenjianxing 2021-11-16 11:25:47 +08:00 committed by jianxing
parent d35b0cca4c
commit 8149af9d17
2 changed files with 6 additions and 6 deletions

View File

@ -683,13 +683,14 @@ public class ApiDefinitionService {
apiDefinition.setStatus(sameRequest.get(0).getStatus());
apiDefinition.setOriginalState(sameRequest.get(0).getOriginalState());
apiDefinition.setCaseStatus(sameRequest.get(0).getCaseStatus());
apiDefinition.setNum(sameRequest.get(0).getNum()); //id 不变
apiDefinition.setTags(sameRequest.get(0).getTags()); //tag 不变
if (StringUtils.equalsIgnoreCase(apiDefinition.getProtocol(), RequestType.HTTP)) {
//如果存在则修改
apiDefinition.setId(sameRequest.get(0).getId());
String request = setImportHashTree(apiDefinition);
apiDefinition.setModuleId(sameRequest.get(0).getModuleId());
apiDefinition.setModulePath(sameRequest.get(0).getModulePath());
apiDefinition.setNum(sameRequest.get(0).getNum()); //id 不变
apiDefinition.setOrder(sameRequest.get(0).getOrder());
apiDefinitionMapper.updateByPrimaryKeyWithBLOBs(apiDefinition);
apiDefinition.setRequest(request);

View File

@ -2,8 +2,6 @@ package io.metersphere.commons.utils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.metersphere.commons.exception.MSException;
import io.metersphere.i18n.Translator;
import org.apache.commons.lang3.StringUtils;
import java.util.*;
@ -15,12 +13,13 @@ public class XMLUtils {
Set<Map.Entry<String, Object>> se = jObj.entrySet();
StringBuffer nowTab = new StringBuffer(tab.toString());
for (Map.Entry<String, Object> en : se) {
if ("com.alibaba.fastjson.JSONObject".equals(en.getValue().getClass().getName())) {
if (en == null || en.getValue() == null) continue;
if (en.getValue() instanceof JSONObject) {
buffer.append(tab).append("<").append(en.getKey()).append(">\n");
JSONObject jo = jObj.getJSONObject(en.getKey());
jsonToXmlStr(jo, buffer, nowTab.append("\t"));
buffer.append(tab).append("</").append(en.getKey()).append(">\n");
} else if ("com.alibaba.fastjson.JSONArray".equals(en.getValue().getClass().getName())) {
} else if (en.getValue() instanceof JSONArray) {
JSONArray jarray = jObj.getJSONArray(en.getKey());
for (int i = 0; i < jarray.size(); i++) {
buffer.append(tab).append("<").append(en.getKey()).append(">\n");
@ -30,7 +29,7 @@ public class XMLUtils {
buffer.append(tab).append("</").append(en.getKey()).append(">\n");
}
}
} else if ("java.lang.String".equals(en.getValue().getClass().getName())) {
} else if (en.getValue() instanceof String) {
buffer.append(tab).append("<").append(en.getKey()).append(">").append(en.getValue());
buffer.append("</").append(en.getKey()).append(">\n");
}