Skip to content

Commit

Permalink
fix: 修复矩阵自增顺序bug
Browse files Browse the repository at this point in the history
  • Loading branch information
javahuang committed Aug 5, 2024
1 parent 841ea04 commit fb3b6d0
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.PropertyAccessorFactory;
import org.springframework.util.CollectionUtils;

import java.text.Format;
import java.text.SimpleDateFormat;
Expand Down Expand Up @@ -233,9 +234,22 @@ else if (questionType.name().startsWith("Matrix")) {
.findFirst().orElseGet(SurveySchema.Row::new).getTitle());
List<String> valueList = new ArrayList<>();
((LinkedHashMap) valueMap).forEach((childOptId, val) -> {
if (val != null && val instanceof Boolean) {
if (val != null) {
valueList.add(trimHtmlTag(schemaType.getChildren().stream()
.filter(x -> x.getId().equals(childOptId)).findFirst().orElseGet(SurveySchema::new).getTitle()));
.filter(x -> x.getId().equals(childOptId)).findFirst()
.map(x -> {
if(!CollectionUtils.isEmpty(x.getDataSource())) {
Optional<SurveySchema.DataSource> findDataSource = x.getDataSource().stream()
.filter(data -> data.getValue().equals(val)).findFirst();
if (findDataSource.isPresent()) {
return findDataSource.get().getLabel();
} else {
return val+"";
}
} else {
return x.getTitle();
}
}).orElse("")));
}
else {
valueList.add(val + "");
Expand Down

0 comments on commit fb3b6d0

Please sign in to comment.