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