fix(接口测试): 修复接口导入时间变化问题

--user=郭雨琦
--bug=1014707
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001014707
This commit is contained in:
guoyuqi 2022-07-21 17:44:54 +08:00 committed by xiaomeinvG
parent cd261c4fa8
commit 2306bfda73
1 changed files with 50 additions and 3 deletions

View File

@ -1207,7 +1207,9 @@ public class ApiDefinitionService {
}
if (!StringUtils.equals(apiDefinition.getTags(), existApi.getTags())) {
return true;
if (apiDefinition.getTags() != null && Objects.equals(apiDefinition.getTags(), "") && existApi.getTags() != null && Objects.equals(existApi.getTags(), "")) {
return true;
}
}
if (!StringUtils.equals(existApi.getRemark(), apiDefinition.getRemark())) {
@ -1218,8 +1220,53 @@ public class ApiDefinitionService {
return true;
}
if (!StringUtils.equals(existApi.getResponse(), apiDefinition.getResponse())) {
return true;
JsonNode exApiResponse = null;
JsonNode apiResponse = null;
try {
exApiResponse = objectMapper.readTree(existApi.getResponse());
apiResponse = objectMapper.readTree(apiDefinition.getResponse());
} catch (JsonProcessingException e) {
e.printStackTrace();
}
if (exApiResponse == null || apiResponse == null) {
return false;
}
if (exApiResponse.get("headers") != null && apiResponse.get("headers") != null) {
if (!StringUtils.equals(exApiResponse.get("headers").toString(), apiResponse.get("headers").toString())) {
return true;
}
}
if (exApiResponse.get("type") != null && apiResponse.get("type") != null) {
if (!StringUtils.equals(exApiResponse.get("type").toString(), apiResponse.get("type").toString())) {
return true;
}
}
if (exApiResponse.get("name") != null && apiResponse.get("name") != null) {
if (!StringUtils.equals(exApiResponse.get("name").toString(), apiResponse.get("name").toString())) {
return true;
}
}
if (exApiResponse.get("body") != null && apiResponse.get("body") != null) {
if (!StringUtils.equals(exApiResponse.get("body").toString(), apiResponse.get("body").toString())) {
return true;
}
}
if (exApiResponse.get("statusCode") != null && apiResponse.get("statusCode") != null) {
if (!StringUtils.equals(exApiResponse.get("statusCode").toString(), apiResponse.get("statusCode").toString())) {
return true;
}
}
if (exApiResponse.get("enable") != null && apiResponse.get("enable") != null) {
if (!StringUtils.equals(exApiResponse.get("enable").toString(), apiResponse.get("enable").toString())) {
return true;
}
}
JsonNode exApiRequest = null;