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
-41
View File
@@ -1,41 +0,0 @@
### 标签管理:
#### 1.标签项管理:
laws_area表:显示的区域。
laws_tag表:表中的字段。
#### 2.标签内容管理:
1. 下拉选择的选择项存在原框架的字典表sys_dict_item里面。
2. 树型结构的选项存在了sys_category里面。
注:返回给前端的查询条件和表单模型时,需要将树型结构的选项一起返回,下拉框则不需要,前端自己调用数据字典的接口。
#### 3.获取树型结构集合:
```java
List<SysCategory> list = new ArrayList<>();
List<SysCategoryTreeVO> tree = TreeUtils.getSysCategoryTree(list, cut);
```
蔚来的树型结构的查询是勾选父级会自动勾选全部子节点,所以可以将这个ids字符串切割后用来做查询判断,拼接成查询条件。
#### 4.各类型思路:
| 类型 | 存储 | 查询 | 返回 |
| ---------------- | -------------- | ------------------ | ------------------------------------------------------------ |
| 输入框(字符串) | 直接存储 | 模糊查询 | 直接返回 |
| 树型结构 | 存储ids | in查询或者模糊查询 | 1.返回ids和tree选项树,前端进行判断显示;2.后端进行翻译显示;3.后端进行筛选返回ids查询出来的选项集合;4.前端根据字典id进行标签内容管理查询。“标签内容管理表sys_category”。 |
| 输入框(数字) | 直接存储 | 大小比较查询 | 直接返回 |
| 单选下拉框 | 存储id | 等于查询 | 1.前端根据字典翻译;2.后端进行翻译;3.后端做id筛选返回对象。 |
| 多选下拉框 | 存储ids | in查询或者模糊查询 | 同树型结构返回。“字典表sys_dict_item”。 |
| 单日期选择 | 直接存储 | 等值或者区间查询 | 直接返回 |
| 多日期选择 | 排序后拼接存储 | | 直接返回 |
| 文件 | 存储文件ids | | 使用“文件表”做翻译拼接。或者筛选后返回列表。 |
| 文本框 | 直接存储 | 模糊查询 | 直接返回 |
| 人员选择 | 存储用户ids | in查询或者模糊查询 | 使用“用户表”做翻译拼接。或者筛选后返回列表。 |
| 标准选择 | 存储标准ids | in查询或者模糊查询 | 使用“标准表”做翻译拼接。或者筛选后返回列表。 |
| 输入框(链接) | 直接存储 | | |
@@ -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 + "");