From e5be58873ebaadcd83007e323454c20289d2e238 Mon Sep 17 00:00:00 2001 From: liao Date: Mon, 25 Sep 2023 16:59:59 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E6=A0=87=E5=87=86=E6=B3=95=E8=A7=84-?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AE=B0=E5=BD=95=E7=89=B9=E6=AE=8A=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NOTE.md | 41 ---------------- .../service/impl/LawsCommonServiceImpl.java | 47 ++++++++++++++++--- 2 files changed, 40 insertions(+), 48 deletions(-) delete mode 100644 NOTE.md diff --git a/NOTE.md b/NOTE.md deleted file mode 100644 index 2b7019bc..00000000 --- a/NOTE.md +++ /dev/null @@ -1,41 +0,0 @@ -### 标签管理: - -#### 1.标签项管理: - -laws_area表:显示的区域。 - -laws_tag表:表中的字段。 - -#### 2.标签内容管理: - -1. 下拉选择的选择项存在原框架的字典表sys_dict_item里面。 -2. 树型结构的选项存在了sys_category里面。 - -注:返回给前端的查询条件和表单模型时,需要将树型结构的选项一起返回,下拉框则不需要,前端自己调用数据字典的接口。 - -#### 3.获取树型结构集合: - -```java -List list = new ArrayList<>(); -List 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查询或者模糊查询 | 使用“标准表”做翻译拼接。或者筛选后返回列表。 | -| 输入框(链接) | 直接存储 | | | - diff --git a/laws-modules/src/main/java/com/jero/modules/laws/common/service/impl/LawsCommonServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/laws/common/service/impl/LawsCommonServiceImpl.java index 913acb82..b9c60d72 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/common/service/impl/LawsCommonServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/common/service/impl/LawsCommonServiceImpl.java @@ -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 valueList = Arrays.asList(value.split(",")); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.in(OSSFile::getId, valueList); + List 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 valueList = Arrays.asList(value.split(",")); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.in(LawsTreeNode::getId, valueList); + List 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 valueList = Arrays.asList(value.split(",")); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(SysDictItem::getDictId, lawsTag.getDictId()); + queryWrapper.in(SysDictItem::getItemValue, valueList); + List 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 + "由");