update 标准法规-更新记录特殊字段处理

This commit is contained in:
liao
2023-09-25 16:59:59 +08:00
parent 14a791fc1b
commit e5be58873e
2 changed files with 40 additions and 48 deletions
@@ -23,10 +23,8 @@ import com.jero.modules.laws.enterprise.entity.EnterpriseStandardInspectContent;
import com.jero.modules.laws.enterprise.service.EnterpriseStandardInspectContentService;
import com.jero.modules.laws.enterprise.util.EnterpriseStandardUtil;
import com.jero.modules.laws.standard.entity.LawsNodeRelation;
import com.jero.modules.laws.standard.service.ILawsNodeRelationService;
import com.jero.modules.laws.standard.service.ILawsReplacedStandardService;
import com.jero.modules.laws.standard.service.ILawsStandardFileService;
import com.jero.modules.laws.standard.service.ILawsUpdateRecordService;
import com.jero.modules.laws.standard.entity.LawsTreeNode;
import com.jero.modules.laws.standard.service.*;
import com.jero.modules.oss.entity.OSSFile;
import com.jero.modules.oss.service.IOSSFileService;
import com.jero.modules.personal.entity.LawsStandardCollection;
@@ -98,6 +96,8 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
private ILawsReplacedStandardService lawsReplacedStandardService;
@Autowired
private ILawsStandardFileService lawsStandardFileService;
@Autowired
private ILawsTreeNodeService lawsTreeNodeService;
@Resource
private EnterpriseStandardInspectContentService esInspectContentService;
@@ -334,9 +334,9 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
resultMap.put(key + FieldCommon._DICT_TEXT, "");
} else {
resultMap.put(key, StringUtils.join(fileList.stream()
.map(OSSFile::getId).collect(Collectors.toList()), ""));
.map(OSSFile::getId).collect(Collectors.toList()), ","));
resultMap.put(key + FieldCommon._DICT_TEXT, StringUtils.join(fileList.stream()
.map(OSSFile::getFileName).collect(Collectors.toList()), ""));
.map(OSSFile::getFileName).collect(Collectors.toList()), ","));
}
}
}
@@ -702,17 +702,50 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
// 对特殊值做处理(新旧值)
if (LawsFieldTypeEnum.FILE_UP.getValue().equals(lawsTag.getFieldShowType())) {
// 文件处理
oldValue = (String) oldDataMap.get(key + FieldCommon._DICT_TEXT);
if (StringUtils.isNotBlank(value)) {
List<String> valueList = Arrays.asList(value.split(","));
LambdaQueryWrapper<OSSFile> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(OSSFile::getId, valueList);
List<OSSFile> fileList = ossFileService.list(queryWrapper);
value = StringUtils.join(fileList.stream()
.map(OSSFile::getFileName).collect(Collectors.toList()), ",");
}
} else if (FieldCommon.STANDARD_SYSTEM.equals(key)) {
// 标准体系
oldValue = (String) oldDataMap.get(key + FieldCommon._DICT_TEXT);
if (StringUtils.isNotBlank(value)) {
List<String> valueList = Arrays.asList(value.split(","));
LambdaQueryWrapper<LawsTreeNode> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(LawsTreeNode::getId, valueList);
List<LawsTreeNode> nodeList = lawsTreeNodeService.list(queryWrapper);
value = StringUtils.join(nodeList.stream()
.map(LawsTreeNode::getNodeName).collect(Collectors.toList()), ",");
}
} 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.TYPE_DICT.contains(lawsTag.getFieldShowType())) {
// 字典翻译
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.eq(SysDictItem::getDictId, lawsTag.getDictId());
queryWrapper.in(SysDictItem::getItemValue, valueList);
List<SysDictItem> dictList = sysDictItemService.list(queryWrapper);
value = StringUtils.join(dictList.stream()
.map(SysDictItem::getItemText).collect(Collectors.toList()), ",");
}
}
if (Objects.isNull(oldValue)) oldValue = "";
if (Objects.isNull(value)) value = "";
if (StringUtils.isBlank(oldValue) && StringUtils.isBlank(value)) return;
// 如果新旧值不一样
if (!oldValue.equals(value)) {
recordBuffer.append(FieldCommon.QUOTE + lawsTag.getDbFieldTxt() + FieldCommon.QUOTE + "");