fix(测试用例): 修复一直在导出中问题
This commit is contained in:
parent
1021bb4c56
commit
4e91ace3ce
|
@ -71,7 +71,7 @@ public class FunctionalCaseCheckEventListener extends AnalysisEventListener<Map<
|
||||||
excelDataClass = clazz;
|
excelDataClass = clazz;
|
||||||
//当前项目模板的自定义字段
|
//当前项目模板的自定义字段
|
||||||
customFieldsMap = customFields.stream().collect(Collectors.toMap(TemplateCustomFieldDTO::getFieldName, i -> i));
|
customFieldsMap = customFields.stream().collect(Collectors.toMap(TemplateCustomFieldDTO::getFieldName, i -> i));
|
||||||
customFieldValidatorMap = CustomFieldValidatorFactory.getValidatorMap();
|
customFieldValidatorMap = CustomFieldValidatorFactory.getValidatorMap(request.getProjectId());
|
||||||
functionalCaseService = CommonBeanFactory.getBean(FunctionalCaseService.class);
|
functionalCaseService = CommonBeanFactory.getBean(FunctionalCaseService.class);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class FunctionalCaseImportEventListener extends AnalysisEventListener<Map
|
||||||
customFieldsMap = customFields.stream().collect(Collectors.toMap(TemplateCustomFieldDTO::getFieldName, i -> i));
|
customFieldsMap = customFields.stream().collect(Collectors.toMap(TemplateCustomFieldDTO::getFieldName, i -> i));
|
||||||
moduleTree = CommonBeanFactory.getBean(FunctionalCaseModuleService.class).getTree(request.getProjectId());
|
moduleTree = CommonBeanFactory.getBean(FunctionalCaseModuleService.class).getTree(request.getProjectId());
|
||||||
functionalCaseService = CommonBeanFactory.getBean(FunctionalCaseService.class);
|
functionalCaseService = CommonBeanFactory.getBean(FunctionalCaseService.class);
|
||||||
customFieldValidatorMap = CustomFieldValidatorFactory.getValidatorMap();
|
customFieldValidatorMap = CustomFieldValidatorFactory.getValidatorMap(request.getProjectId());
|
||||||
lastPos = new AtomicLong(pos);
|
lastPos = new AtomicLong(pos);
|
||||||
this.user = user;
|
this.user = user;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ import io.metersphere.sdk.util.CommonBeanFactory;
|
||||||
import io.metersphere.sdk.util.Translator;
|
import io.metersphere.sdk.util.Translator;
|
||||||
import io.metersphere.system.domain.User;
|
import io.metersphere.system.domain.User;
|
||||||
import io.metersphere.system.dto.sdk.TemplateCustomFieldDTO;
|
import io.metersphere.system.dto.sdk.TemplateCustomFieldDTO;
|
||||||
import io.metersphere.system.utils.SessionUtils;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -25,9 +24,12 @@ public class CustomFieldMemberValidator extends AbstractCustomFieldValidator {
|
||||||
protected Map<String, String> userNameMap;
|
protected Map<String, String> userNameMap;
|
||||||
|
|
||||||
public CustomFieldMemberValidator() {
|
public CustomFieldMemberValidator() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomFieldMemberValidator(String projectId) {
|
||||||
this.isKVOption = true;
|
this.isKVOption = true;
|
||||||
ProjectApplicationService projectApplicationService = CommonBeanFactory.getBean(ProjectApplicationService.class);
|
ProjectApplicationService projectApplicationService = CommonBeanFactory.getBean(ProjectApplicationService.class);
|
||||||
List<User> memberOption = projectApplicationService.getProjectUserList(SessionUtils.getCurrentProjectId());
|
List<User> memberOption = projectApplicationService.getProjectUserList(projectId);
|
||||||
userIdMap = memberOption.stream()
|
userIdMap = memberOption.stream()
|
||||||
.collect(
|
.collect(
|
||||||
Collectors.toMap(user -> user.getId().toLowerCase(), User::getId)
|
Collectors.toMap(user -> user.getId().toLowerCase(), User::getId)
|
||||||
|
|
|
@ -11,7 +11,8 @@ import java.util.HashMap;
|
||||||
public class CustomFieldValidatorFactory {
|
public class CustomFieldValidatorFactory {
|
||||||
|
|
||||||
private static final HashMap<String, AbstractCustomFieldValidator> validatorMap = new HashMap<>();
|
private static final HashMap<String, AbstractCustomFieldValidator> validatorMap = new HashMap<>();
|
||||||
public static HashMap<String, AbstractCustomFieldValidator> getValidatorMap() {
|
|
||||||
|
public static HashMap<String, AbstractCustomFieldValidator> getValidatorMap(String projectId) {
|
||||||
validatorMap.put(CustomFieldType.SELECT.name(), new CustomFieldSelectValidator());
|
validatorMap.put(CustomFieldType.SELECT.name(), new CustomFieldSelectValidator());
|
||||||
validatorMap.put(CustomFieldType.SELECT.name(), new CustomFieldSelectValidator());
|
validatorMap.put(CustomFieldType.SELECT.name(), new CustomFieldSelectValidator());
|
||||||
validatorMap.put(CustomFieldType.RADIO.name(), new CustomFieldSelectValidator());
|
validatorMap.put(CustomFieldType.RADIO.name(), new CustomFieldSelectValidator());
|
||||||
|
@ -27,7 +28,7 @@ public class CustomFieldValidatorFactory {
|
||||||
validatorMap.put(CustomFieldType.DATE.name(), new CustomFieldDateValidator());
|
validatorMap.put(CustomFieldType.DATE.name(), new CustomFieldDateValidator());
|
||||||
validatorMap.put(CustomFieldType.DATETIME.name(), new CustomFieldDateTimeValidator());
|
validatorMap.put(CustomFieldType.DATETIME.name(), new CustomFieldDateTimeValidator());
|
||||||
|
|
||||||
validatorMap.put(CustomFieldType.MEMBER.name(), new CustomFieldMemberValidator());
|
validatorMap.put(CustomFieldType.MEMBER.name(), new CustomFieldMemberValidator(projectId));
|
||||||
validatorMap.put(CustomFieldType.MULTIPLE_MEMBER.name(), new CustomFieldMultipleMemberValidator());
|
validatorMap.put(CustomFieldType.MULTIPLE_MEMBER.name(), new CustomFieldMultipleMemberValidator());
|
||||||
|
|
||||||
validatorMap.put(CustomFieldType.INT.name(), new CustomFieldIntegerValidator());
|
validatorMap.put(CustomFieldType.INT.name(), new CustomFieldIntegerValidator());
|
||||||
|
|
|
@ -755,7 +755,7 @@ public class FunctionalCaseFileService {
|
||||||
if (CollectionUtils.isEmpty(request.getCustomFields())) {
|
if (CollectionUtils.isEmpty(request.getCustomFields())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
HashMap<String, AbstractCustomFieldValidator> customFieldValidatorMap = CustomFieldValidatorFactory.getValidatorMap();
|
HashMap<String, AbstractCustomFieldValidator> customFieldValidatorMap = CustomFieldValidatorFactory.getValidatorMap(request.getProjectId());
|
||||||
Map<String, TemplateCustomFieldDTO> customFieldsMap = templateCustomFields.stream().collect(Collectors.toMap(TemplateCustomFieldDTO::getFieldId, i -> i));
|
Map<String, TemplateCustomFieldDTO> customFieldsMap = templateCustomFields.stream().collect(Collectors.toMap(TemplateCustomFieldDTO::getFieldId, i -> i));
|
||||||
Map<String, String> caseFieldvalueMap = functionalCaseCustomFields.stream().collect(Collectors.toMap(FunctionalCaseCustomField::getFieldId, FunctionalCaseCustomField::getValue));
|
Map<String, String> caseFieldvalueMap = functionalCaseCustomFields.stream().collect(Collectors.toMap(FunctionalCaseCustomField::getFieldId, FunctionalCaseCustomField::getValue));
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class XMindCaseParser {
|
||||||
customFieldsMap = customFields.stream().collect(Collectors.toMap(TemplateCustomFieldDTO::getFieldName, i -> i));
|
customFieldsMap = customFields.stream().collect(Collectors.toMap(TemplateCustomFieldDTO::getFieldName, i -> i));
|
||||||
functionalCaseService = CommonBeanFactory.getBean(FunctionalCaseService.class);
|
functionalCaseService = CommonBeanFactory.getBean(FunctionalCaseService.class);
|
||||||
moduleTree = CommonBeanFactory.getBean(FunctionalCaseModuleService.class).getTree(request.getProjectId());
|
moduleTree = CommonBeanFactory.getBean(FunctionalCaseModuleService.class).getTree(request.getProjectId());
|
||||||
customFieldValidatorMap = CustomFieldValidatorFactory.getValidatorMap();
|
customFieldValidatorMap = CustomFieldValidatorFactory.getValidatorMap(request.getProjectId());
|
||||||
lastPos = new AtomicLong(pos);
|
lastPos = new AtomicLong(pos);
|
||||||
this.user = user;
|
this.user = user;
|
||||||
process = new DetailUtil();
|
process = new DetailUtil();
|
||||||
|
|
|
@ -518,7 +518,7 @@ public class XmindExportUtil {
|
||||||
//自定义字段
|
//自定义字段
|
||||||
Map<String, String> customColumnsMap = request.getCustomFields().stream().collect(Collectors.toMap(FunctionalCaseHeader::getId, FunctionalCaseHeader::getName));
|
Map<String, String> customColumnsMap = request.getCustomFields().stream().collect(Collectors.toMap(FunctionalCaseHeader::getId, FunctionalCaseHeader::getName));
|
||||||
Map<String, TemplateCustomFieldDTO> temCustomFieldsMap = templateCustomFields.stream().collect(Collectors.toMap(TemplateCustomFieldDTO::getFieldId, i -> i));
|
Map<String, TemplateCustomFieldDTO> temCustomFieldsMap = templateCustomFields.stream().collect(Collectors.toMap(TemplateCustomFieldDTO::getFieldId, i -> i));
|
||||||
HashMap<String, AbstractCustomFieldValidator> customFieldValidatorMap = CustomFieldValidatorFactory.getValidatorMap();
|
HashMap<String, AbstractCustomFieldValidator> customFieldValidatorMap = CustomFieldValidatorFactory.getValidatorMap(request.getProjectId());
|
||||||
|
|
||||||
customColumnsMap.forEach((k, v) -> {
|
customColumnsMap.forEach((k, v) -> {
|
||||||
if (customFieldMap.containsKey(k) && temCustomFieldsMap.containsKey(k)) {
|
if (customFieldMap.containsKey(k) && temCustomFieldsMap.containsKey(k)) {
|
||||||
|
|
Loading…
Reference in New Issue