fix: 78644

体系搜索--弹窗中表头字段发布日期和实施日期的排序不对
This commit is contained in:
2023-11-24 10:10:22 +08:00
parent abc5e3b666
commit a1bd733db2
@@ -186,7 +186,8 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
List<StandMenuRelation> gbRelations = BeanCopyUtils.copyBeanList(gbStandMenu, StandMenuRelation.class); List<StandMenuRelation> gbRelations = BeanCopyUtils.copyBeanList(gbStandMenu, StandMenuRelation.class);
// 外标 // 外标
List<SarStandMenu> fbStandMenu = sarStandMenuDao.getFBStandMenu().stream().filter(item -> item.getStandId() != null).collect(Collectors.toList());; List<SarStandMenu> fbStandMenu = sarStandMenuDao.getFBStandMenu().stream().filter(item -> item.getStandId() != null).collect(Collectors.toList());
;
List<StandMenuRelation> fbRelations = BeanCopyUtils.copyBeanList(fbStandMenu, StandMenuRelation.class); List<StandMenuRelation> fbRelations = BeanCopyUtils.copyBeanList(fbStandMenu, StandMenuRelation.class);
// 企标 // 企标
@@ -204,6 +205,7 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
@Override @Override
public IPage<StandSystemDTO> standardSystemList(StandSystemDTO standSystemDTO) { public IPage<StandSystemDTO> standardSystemList(StandSystemDTO standSystemDTO) {
boolean timeSort = StrUtil.isNotBlank(standSystemDTO.getSortField());
boolean select = standSystemDTO.getSelectIdList() != null; boolean select = standSystemDTO.getSelectIdList() != null;
String menuId = standSystemDTO.getMenuId(); String menuId = standSystemDTO.getMenuId();
// 校验menuId不能为空 // 校验menuId不能为空
@@ -242,6 +244,7 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
resultList.addAll(fbList); resultList.addAll(fbList);
resultList.addAll(esList); resultList.addAll(esList);
// 默认排序
// 构造体系路径映射 // 构造体系路径映射
Map<String, String> pathMap = new HashMap<>(); Map<String, String> pathMap = new HashMap<>();
sarMenuStandard.buildPathMap(pathMap, ""); sarMenuStandard.buildPathMap(pathMap, "");
@@ -266,6 +269,30 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
this.translateStandardSystemDTO(dto, gbStateDictList, esStateDictList); this.translateStandardSystemDTO(dto, gbStateDictList, esStateDictList);
} }
// 两个时间排序
if (timeSort) {
// 时间排序
String sortField = standSystemDTO.getSortField();
String sortMode = standSystemDTO.getSortMode();
Comparator<StandSystemDTO> comparatorReleaseDate = Comparator.comparing(StandSystemDTO::getReleaseDate
, Comparator.nullsLast(Comparator.naturalOrder()));
if (sortField.equals("releaseDate")) {
if (sortMode.equals("desc")) {
resultList.sort(comparatorReleaseDate.reversed());
} else {
resultList.sort(comparatorReleaseDate);
}
}
Comparator<StandSystemDTO> comparatorImplementDate = Comparator.comparing(StandSystemDTO::getImplementDate
, Comparator.nullsLast(Comparator.naturalOrder()));
if (sortField.equals("implementDate")) {
if (sortMode.equals("desc")) {
resultList.sort(comparatorImplementDate.reversed());
} else {
resultList.sort(comparatorImplementDate);
}
}
} else {
// 根据排序字段对 resultList 进行排序 // 根据排序字段对 resultList 进行排序
// 按照标准体系排序 // 按照标准体系排序
// 体系内部按照国内/海外/企业排序 // 体系内部按照国内/海外/企业排序
@@ -273,20 +300,6 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
resultList.sort(Comparator.comparingInt(StandSystemDTO::getSystemSort) resultList.sort(Comparator.comparingInt(StandSystemDTO::getSystemSort)
.thenComparingInt(StandSystemDTO::getStandTypeSort) .thenComparingInt(StandSystemDTO::getStandTypeSort)
.thenComparingInt(StandSystemDTO::getStandCategorySort)); .thenComparingInt(StandSystemDTO::getStandCategorySort));
// 两个时间排序
String sortField = standSystemDTO.getSortField();
if (StringUtils.isNotBlank(sortField)) {
String sortMode = standSystemDTO.getSortMode();
if (sortField.equals("releaseDate") && sortMode.equals("desc")) {
resultList.sort(Comparator.comparing(StandSystemDTO::getStartImplementDate));
} else {
resultList.sort(Comparator.comparing(StandSystemDTO::getStartImplementDate).reversed());
}
if (sortField.equals("implementDate") && sortMode.equals("desc")) {
resultList.sort(Comparator.comparing(StandSystemDTO::getStartImplementDate));
} else {
resultList.sort(Comparator.comparing(StandSystemDTO::getStartImplementDate).reversed());
}
} }
// 手动分页 // 手动分页
@@ -398,6 +411,7 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
/** /**
* 查询有权限菜单 * 查询有权限菜单
*
* @param sarMenuStandardNew * @param sarMenuStandardNew
*/ */
@Override @Override
@@ -438,6 +452,7 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
/** /**
* 递归调用获取子节点 * 递归调用获取子节点
*
* @return List<TsResource> * @return List<TsResource>
*/ */
private List<SarMenuStandard> recursionGetListChildrenStand(SarMenuStandard resource, List<SarMenuStandard> children) { private List<SarMenuStandard> recursionGetListChildrenStand(SarMenuStandard resource, List<SarMenuStandard> children) {