fix: 78644
体系搜索--弹窗中表头字段发布日期和实施日期的排序不对
This commit is contained in:
+71
-56
@@ -54,7 +54,7 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 服务实现类
|
* 服务实现类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author super_liu
|
* @author super_liu
|
||||||
@@ -88,27 +88,27 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
|
|||||||
private SarBussStandMenuDao sarBussStandMenuDao;
|
private SarBussStandMenuDao sarBussStandMenuDao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTopMenu(SarMenuStandardNew sarMenuStandardNew){
|
public String getTopMenu(SarMenuStandardNew sarMenuStandardNew) {
|
||||||
QueryWrapper qw = new QueryWrapper();
|
QueryWrapper qw = new QueryWrapper();
|
||||||
if(StringUtils.isNotBlank(sarMenuStandardNew.getId())){
|
if (StringUtils.isNotBlank(sarMenuStandardNew.getId())) {
|
||||||
qw.eq("ID",sarMenuStandardNew.getId());
|
qw.eq("ID", sarMenuStandardNew.getId());
|
||||||
}
|
}
|
||||||
if(StringUtils.isNotBlank(sarMenuStandardNew.getMenuName())){
|
if (StringUtils.isNotBlank(sarMenuStandardNew.getMenuName())) {
|
||||||
qw.eq("MENU_NAME",sarMenuStandardNew.getMenuName());
|
qw.eq("MENU_NAME", sarMenuStandardNew.getMenuName());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<SarMenuStandard> list = dao.selectList(qw);
|
List<SarMenuStandard> list = dao.selectList(qw);
|
||||||
if(!list.isEmpty()){
|
if (!list.isEmpty()) {
|
||||||
if(StringUtils.isNotBlank(list.get(0).getParentIds())){
|
if (StringUtils.isNotBlank(list.get(0).getParentIds())) {
|
||||||
List<String> topIdList = Arrays.stream(list.get(0).getParentIds().split(",")).map(String::trim).collect(Collectors.toList());
|
List<String> topIdList = Arrays.stream(list.get(0).getParentIds().split(",")).map(String::trim).collect(Collectors.toList());
|
||||||
QueryWrapper wrapper = new QueryWrapper();
|
QueryWrapper wrapper = new QueryWrapper();
|
||||||
wrapper.in("ID",topIdList);
|
wrapper.in("ID", topIdList);
|
||||||
List<SarMenuStandard> topList = dao.selectTopList(wrapper,list.get(0).getParentIds());
|
List<SarMenuStandard> topList = dao.selectTopList(wrapper, list.get(0).getParentIds());
|
||||||
List<String> filterList = topList.stream().map(SarMenuStandard::getMenuName).collect(Collectors.toList());
|
List<String> filterList = topList.stream().map(SarMenuStandard::getMenuName).collect(Collectors.toList());
|
||||||
if(!filterList.isEmpty()){
|
if (!filterList.isEmpty()) {
|
||||||
return StringUtils.join(filterList, "/")+'/'+list.get(0).getMenuName();
|
return StringUtils.join(filterList, "/") + '/' + list.get(0).getMenuName();
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
return list.get(0).getMenuName();
|
return list.get(0).getMenuName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
|
|||||||
@Override
|
@Override
|
||||||
public void addMenuStandard(SarMenuStandardNew sarMenuStandardNew) {
|
public void addMenuStandard(SarMenuStandardNew sarMenuStandardNew) {
|
||||||
SarMenuStandard sarMenuStandard = new SarMenuStandard();
|
SarMenuStandard sarMenuStandard = new SarMenuStandard();
|
||||||
BeanUtils.copyProperties(sarMenuStandardNew,sarMenuStandard);
|
BeanUtils.copyProperties(sarMenuStandardNew, sarMenuStandard);
|
||||||
String parentId = sarMenuStandardNew.getParentId();
|
String parentId = sarMenuStandardNew.getParentId();
|
||||||
if (StringUtils.isNotBlank(parentId)) {
|
if (StringUtils.isNotBlank(parentId)) {
|
||||||
SarMenuStandard sarMenuStandard1 = dao.selectById(parentId);
|
SarMenuStandard sarMenuStandard1 = dao.selectById(parentId);
|
||||||
@@ -139,8 +139,8 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
|
|||||||
List<String> roleIdList = tsRoleDao.getRoleByUserId(LoginUserUtil.getUserId());
|
List<String> roleIdList = tsRoleDao.getRoleByUserId(LoginUserUtil.getUserId());
|
||||||
for (String roleId : roleIdList) {
|
for (String roleId : roleIdList) {
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
map.put("resourceId",sarMenuStandard.getId());
|
map.put("resourceId", sarMenuStandard.getId());
|
||||||
map.put("roleId",roleId);
|
map.put("roleId", roleId);
|
||||||
resourceDao.insertTsRoleResource(map);
|
resourceDao.insertTsRoleResource(map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -148,11 +148,11 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
|
|||||||
@Override
|
@Override
|
||||||
public SarMenuStandard getMenuStandardById(String menuId) {
|
public SarMenuStandard getMenuStandardById(String menuId) {
|
||||||
SarMenuStandard sarMenuStandard = dao.selectById(menuId);
|
SarMenuStandard sarMenuStandard = dao.selectById(menuId);
|
||||||
if(sarMenuStandard != null && StringUtils.isNotBlank(sarMenuStandard.getParentIds())){
|
if (sarMenuStandard != null && StringUtils.isNotBlank(sarMenuStandard.getParentIds())) {
|
||||||
LambdaQueryWrapper<SarMenuStandard> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SarMenuStandard> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.in(SarMenuStandard::getId,Arrays.asList(sarMenuStandard.getParentIds().split(",")));
|
wrapper.in(SarMenuStandard::getId, Arrays.asList(sarMenuStandard.getParentIds().split(",")));
|
||||||
List<SarMenuStandard> menuStandards = dao.selectList(wrapper);
|
List<SarMenuStandard> menuStandards = dao.selectList(wrapper);
|
||||||
if(!menuStandards.isEmpty()){
|
if (!menuStandards.isEmpty()) {
|
||||||
String parentIdsName = menuStandards.stream().map(SarMenuStandard::getMenuName).collect(Collectors.joining(","));
|
String parentIdsName = menuStandards.stream().map(SarMenuStandard::getMenuName).collect(Collectors.joining(","));
|
||||||
sarMenuStandard.setParentIdsName(parentIdsName);
|
sarMenuStandard.setParentIdsName(parentIdsName);
|
||||||
}
|
}
|
||||||
@@ -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,27 +269,37 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
|
|||||||
this.translateStandardSystemDTO(dto, gbStateDictList, esStateDictList);
|
this.translateStandardSystemDTO(dto, gbStateDictList, esStateDictList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据排序字段对 resultList 进行排序
|
|
||||||
// 按照标准体系排序
|
|
||||||
// 体系内部按照国内/海外/企业排序
|
|
||||||
// 每个类别的标准内部按照类别排序
|
|
||||||
resultList.sort(Comparator.comparingInt(StandSystemDTO::getSystemSort)
|
|
||||||
.thenComparingInt(StandSystemDTO::getStandTypeSort)
|
|
||||||
.thenComparingInt(StandSystemDTO::getStandCategorySort));
|
|
||||||
// 两个时间排序
|
// 两个时间排序
|
||||||
String sortField = standSystemDTO.getSortField();
|
if (timeSort) {
|
||||||
if (StringUtils.isNotBlank(sortField)) {
|
// 时间排序
|
||||||
|
String sortField = standSystemDTO.getSortField();
|
||||||
String sortMode = standSystemDTO.getSortMode();
|
String sortMode = standSystemDTO.getSortMode();
|
||||||
if (sortField.equals("releaseDate") && sortMode.equals("desc")) {
|
Comparator<StandSystemDTO> comparatorReleaseDate = Comparator.comparing(StandSystemDTO::getReleaseDate
|
||||||
resultList.sort(Comparator.comparing(StandSystemDTO::getStartImplementDate));
|
, Comparator.nullsLast(Comparator.naturalOrder()));
|
||||||
} else {
|
if (sortField.equals("releaseDate")) {
|
||||||
resultList.sort(Comparator.comparing(StandSystemDTO::getStartImplementDate).reversed());
|
if (sortMode.equals("desc")) {
|
||||||
|
resultList.sort(comparatorReleaseDate.reversed());
|
||||||
|
} else {
|
||||||
|
resultList.sort(comparatorReleaseDate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (sortField.equals("implementDate") && sortMode.equals("desc")) {
|
Comparator<StandSystemDTO> comparatorImplementDate = Comparator.comparing(StandSystemDTO::getImplementDate
|
||||||
resultList.sort(Comparator.comparing(StandSystemDTO::getStartImplementDate));
|
, Comparator.nullsLast(Comparator.naturalOrder()));
|
||||||
} else {
|
if (sortField.equals("implementDate")) {
|
||||||
resultList.sort(Comparator.comparing(StandSystemDTO::getStartImplementDate).reversed());
|
if (sortMode.equals("desc")) {
|
||||||
|
resultList.sort(comparatorImplementDate.reversed());
|
||||||
|
} else {
|
||||||
|
resultList.sort(comparatorImplementDate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// 根据排序字段对 resultList 进行排序
|
||||||
|
// 按照标准体系排序
|
||||||
|
// 体系内部按照国内/海外/企业排序
|
||||||
|
// 每个类别的标准内部按照类别排序
|
||||||
|
resultList.sort(Comparator.comparingInt(StandSystemDTO::getSystemSort)
|
||||||
|
.thenComparingInt(StandSystemDTO::getStandTypeSort)
|
||||||
|
.thenComparingInt(StandSystemDTO::getStandCategorySort));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 手动分页
|
// 手动分页
|
||||||
@@ -345,7 +358,7 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
|
|||||||
standSystemDTO.setPageSize(Integer.MAX_VALUE);
|
standSystemDTO.setPageSize(Integer.MAX_VALUE);
|
||||||
try {
|
try {
|
||||||
response.setHeader("Content-Disposition",
|
response.setHeader("Content-Disposition",
|
||||||
"attachment; filename=" + ReadExcel.encodeFileName(standSystemDTO.getExportName()+".xlsx",
|
"attachment; filename=" + ReadExcel.encodeFileName(standSystemDTO.getExportName() + ".xlsx",
|
||||||
request));
|
request));
|
||||||
// 导出数据,若指定了值则使用ids字段条件导出,否则根据条件导出
|
// 导出数据,若指定了值则使用ids字段条件导出,否则根据条件导出
|
||||||
IPage<StandSystemDTO> page = this.standardSystemList(standSystemDTO);
|
IPage<StandSystemDTO> page = this.standardSystemList(standSystemDTO);
|
||||||
@@ -398,39 +411,40 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询有权限菜单
|
* 查询有权限菜单
|
||||||
|
*
|
||||||
* @param sarMenuStandardNew
|
* @param sarMenuStandardNew
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SarMenuStandard> getListStandLimit(SarMenuStandardNew sarMenuStandardNew, List<String> access) {
|
public List<SarMenuStandard> getListStandLimit(SarMenuStandardNew sarMenuStandardNew, List<String> access) {
|
||||||
List<SarMenuStandard> TsResources = new ArrayList<>();
|
List<SarMenuStandard> TsResources = new ArrayList<>();
|
||||||
|
|
||||||
QueryWrapper<SarMenuStandard> queryWrapper =new QueryWrapper<>();
|
QueryWrapper<SarMenuStandard> queryWrapper = new QueryWrapper<>();
|
||||||
if(sarMenuStandardNew.getSorDivide()!=null){
|
if (sarMenuStandardNew.getSorDivide() != null) {
|
||||||
queryWrapper.eq("sor_divide", sarMenuStandardNew.getSorDivide());
|
queryWrapper.eq("sor_divide", sarMenuStandardNew.getSorDivide());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sarMenuStandardNew.getDicId()!=null){
|
if (sarMenuStandardNew.getDicId() != null) {
|
||||||
queryWrapper.eq("DIC_ID", sarMenuStandardNew.getDicId());
|
queryWrapper.eq("DIC_ID", sarMenuStandardNew.getDicId());
|
||||||
}
|
}
|
||||||
if(access!=null && !access.isEmpty()){
|
if (access != null && !access.isEmpty()) {
|
||||||
queryWrapper.in(null!=access && !access.isEmpty(),"ID",access);
|
queryWrapper.in(null != access && !access.isEmpty(), "ID", access);
|
||||||
}
|
}
|
||||||
queryWrapper.eq("VALID_FLAG",0);
|
queryWrapper.eq("VALID_FLAG", 0);
|
||||||
queryWrapper.isNull("PARENT_ID");
|
queryWrapper.isNull("PARENT_ID");
|
||||||
queryWrapper.orderByAsc("DISPLAY_SEQ");
|
queryWrapper.orderByAsc("DISPLAY_SEQ");
|
||||||
TsResources=dao.selectList(queryWrapper);
|
TsResources = dao.selectList(queryWrapper);
|
||||||
|
|
||||||
for(SarMenuStandard resource:TsResources){
|
for (SarMenuStandard resource : TsResources) {
|
||||||
resource.setTreeType("sarMs");
|
resource.setTreeType("sarMs");
|
||||||
QueryWrapper<SarMenuStandard> TsResourceQueryWrapper=new QueryWrapper<>();
|
QueryWrapper<SarMenuStandard> TsResourceQueryWrapper = new QueryWrapper<>();
|
||||||
TsResourceQueryWrapper.like("PARENT_IDS",resource.getId());
|
TsResourceQueryWrapper.like("PARENT_IDS", resource.getId());
|
||||||
if(access!=null && !access.isEmpty()){
|
if (access != null && !access.isEmpty()) {
|
||||||
TsResourceQueryWrapper.in(null!=access && !access.isEmpty(),"ID",access);
|
TsResourceQueryWrapper.in(null != access && !access.isEmpty(), "ID", access);
|
||||||
}
|
}
|
||||||
TsResourceQueryWrapper.eq("VALID_FLAG",0);
|
TsResourceQueryWrapper.eq("VALID_FLAG", 0);
|
||||||
TsResourceQueryWrapper.orderByAsc("DISPLAY_SEQ");
|
TsResourceQueryWrapper.orderByAsc("DISPLAY_SEQ");
|
||||||
List<SarMenuStandard> children=dao.selectList(TsResourceQueryWrapper);
|
List<SarMenuStandard> children = dao.selectList(TsResourceQueryWrapper);
|
||||||
resource.setChildren(recursionGetListChildrenStand((resource),(children)));
|
resource.setChildren(recursionGetListChildrenStand((resource), (children)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return TsResources;
|
return TsResources;
|
||||||
@@ -438,17 +452,18 @@ 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) {
|
||||||
List<SarMenuStandard> tsResources = children.stream()
|
List<SarMenuStandard> tsResources = children.stream()
|
||||||
.filter(resource1 -> resource1.getParentId().equals(resource.getId()))
|
.filter(resource1 -> resource1.getParentId().equals(resource.getId()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
if(!tsResources.isEmpty()){
|
if (!tsResources.isEmpty()) {
|
||||||
tsResources = tsResources.stream().sorted(Comparator.comparing(resource1 -> resource1.getDisplaySeq())).collect(Collectors.toList());
|
tsResources = tsResources.stream().sorted(Comparator.comparing(resource1 -> resource1.getDisplaySeq())).collect(Collectors.toList());
|
||||||
tsResources.forEach(resource1 -> {
|
tsResources.forEach(resource1 -> {
|
||||||
resource1.setTreeType("sarMs");
|
resource1.setTreeType("sarMs");
|
||||||
resource1.setChildren(recursionGetListChildrenStand((resource1),(children)));
|
resource1.setChildren(recursionGetListChildrenStand((resource1), (children)));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return tsResources;
|
return tsResources;
|
||||||
|
|||||||
Reference in New Issue
Block a user