mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-05 05:29:29 +08:00
fix(接口测试): 引用的公共脚本被删除,获取接口详情报错
This commit is contained in:
parent
f1215eba88
commit
c7c8734ced
@ -57,6 +57,10 @@ public abstract class ScriptProcessorConverter extends MsProcessorConverter<Scri
|
||||
String scriptLanguage = scriptProcessor.getScriptLanguage();
|
||||
String script = scriptProcessor.getScript();
|
||||
if (scriptProcessor.isEnableCommonScript()) {
|
||||
if (BooleanUtils.isTrue(scriptProcessor.getCommonScriptInfo().getDeleted())) {
|
||||
// 如果公共脚本被删除则不处理
|
||||
return;
|
||||
}
|
||||
scriptLanguage = scriptProcessor.getCommonScriptInfo().getScriptLanguage();
|
||||
script = scriptProcessor.getCommonScriptInfo().getScript();
|
||||
}
|
||||
|
@ -208,8 +208,17 @@ public class ApiCommonService {
|
||||
for (ScriptProcessor processor : scriptsProcessors) {
|
||||
CommonScriptInfo commonScriptInfo = processor.getCommonScriptInfo();
|
||||
CustomFunctionBlob customFunctionBlob = customFunctionBlobMap.get(commonScriptInfo.getId());
|
||||
|
||||
CustomFunction customFunction = customFunctionMap.get(commonScriptInfo.getId());
|
||||
|
||||
if (customFunction == null || customFunctionBlob == null) {
|
||||
if (customFunction == null) {
|
||||
// 公共脚本被删除,就改成非公共脚本
|
||||
processor.getCommonScriptInfo().setDeleted(true);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// 设置公共脚本信息
|
||||
Optional.ofNullable(customFunctionBlob.getParams()).ifPresent(paramsBlob -> {
|
||||
List<KeyValueParam> commonParams = JSON.parseArray(new String(paramsBlob), KeyValueParam.class);
|
||||
|
@ -18,6 +18,10 @@ public class CommonScriptInfo {
|
||||
*/
|
||||
@Size(min = 1, max = 50)
|
||||
private String id;
|
||||
/**
|
||||
* 脚本是否删除
|
||||
*/
|
||||
private Boolean deleted = false;
|
||||
/**
|
||||
* 公共脚本的名字
|
||||
* 页面展示需要
|
||||
|
Loading…
Reference in New Issue
Block a user