fix 更新记录顺序问题引起的bug

This commit is contained in:
liao
2023-09-28 10:27:29 +08:00
parent df3082c225
commit bddcaa2b1b
@@ -772,8 +772,19 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
queryWrapper.in(OSSFile::getId, valueList);
queryWrapper.orderByDesc(OSSFile::getId);
List<OSSFile> fileList = ossFileService.list(queryWrapper);
value = StringUtils.join(fileList.stream()
.map(OSSFile::getFileName).collect(Collectors.toList()), ",");
List<String> textList = fileList.stream()
.map(OSSFile::getFileName).collect(Collectors.toList());
value = StringUtils.join(textList, ",");
// 因为排序问题,值可能不一样
if (StringUtils.isNotBlank(oldValue)) {
List<String> differentList = Arrays.asList(oldValue.split(","));
textList.removeAll(differentList);
// 如果值一样,只是排序问题,则不更新
if (CollectionUtils.isEmpty(textList)) {
oldValue = "";
value = "";
}
}
}
} else if (FieldCommon.STANDARD_SYSTEM.equals(key)) {
// 标准体系
@@ -784,26 +795,28 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
queryWrapper.in(LawsTreeNode::getId, valueList);
queryWrapper.orderByDesc(LawsTreeNode::getId);
List<LawsTreeNode> nodeList = lawsTreeNodeService.list(queryWrapper);
value = StringUtils.join(nodeList.stream()
.map(LawsTreeNode::getNodeName).collect(Collectors.toList()), ",");
List<String> textList = nodeList.stream()
.map(LawsTreeNode::getNodeName).collect(Collectors.toList());
value = StringUtils.join(textList, ",");
// 因为排序问题,值可能不一样
if (StringUtils.isNotBlank(oldValue)) {
List<String> differentList = Arrays.asList(oldValue.split(","));
textList.removeAll(differentList);
// 如果值一样,只是排序问题,则不更新
if (CollectionUtils.isEmpty(textList)) {
oldValue = "";
value = "";
}
}
}
} else if (FieldCommon.REPLACED_STANDARD.equals(key)) {
// 代替标准号
oldValue = (String) oldDataMap.get(key + FieldCommon._DICT_TEXT);
} else if (FieldCommon.REFERENCE_STANDARD.equals(key)) {
// 引用标准
oldValue = (String) oldDataMap.get(key + FieldCommon._DICT_TEXT);
} else if (FieldCommon.PART_NAME.equals(key)) {
// 零部件名称
// 零部件名称(单选)
oldValue = (String) oldDataMap.get(key + FieldCommon._DICT_TEXT);
if (StringUtils.isNotBlank(value)) {
List<String> valueList = Arrays.asList(value.split(","));
LambdaQueryWrapper<SysDictItem> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(SysDictItem::getId, valueList);
queryWrapper.orderByDesc(SysDictItem::getId);
List<SysDictItem> dictList = sysDictItemService.list(queryWrapper);
value = StringUtils.join(dictList.stream()
.map(SysDictItem::getItemText).collect(Collectors.toList()), ",");
queryWrapper.eq(SysDictItem::getId, value);
SysDictItem dictItem = sysDictItemService.getOne(queryWrapper);
value = dictItem.getItemText();
}
} else if (FieldCommon.TYPE_DICT.contains(lawsTag.getFieldShowType())) {
// 字典翻译
@@ -815,8 +828,19 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
queryWrapper.in(SysDictItem::getItemValue, valueList);
queryWrapper.orderByDesc(SysDictItem::getId);
List<SysDictItem> dictList = sysDictItemService.list(queryWrapper);
value = StringUtils.join(dictList.stream()
.map(SysDictItem::getItemText).collect(Collectors.toList()), ",");
List<String> textList = dictList.stream()
.map(SysDictItem::getItemText).collect(Collectors.toList());
value = StringUtils.join(textList, ",");
// 因为排序问题,值可能不一样
if (StringUtils.isNotBlank(oldValue)) {
List<String> differentList = Arrays.asList(oldValue.split(","));
textList.removeAll(differentList);
// 如果值一样,只是排序问题,则不更新
if (CollectionUtils.isEmpty(textList)) {
oldValue = "";
value = "";
}
}
}
}