时间轴数据筛选

This commit is contained in:
zhn
2022-05-18 12:03:52 +08:00
parent d81df6abc5
commit 701af03a88
@@ -20,6 +20,7 @@ import com.jero.modules.system.entity.SysDictItem;
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -77,9 +78,37 @@ public class ProjectStatusBoardServiceImpl implements IProjectStatusBoardService
//时间轴数据
int index = 0;
list = projectTaskPlanningService.queryByProjectId(StringUtils.join(projectLibraryBaseIdList, ","), projectLibraryBase.getCut());
//时间段筛选,过滤数据
Date startTime = projectLibraryBase.getStartTime();
Date endTime = projectLibraryBase.getEndTime();
List<List<TimeNodeVO>> listNew = new ArrayList<>();
if(ObjectUtils.isNotEmpty(startTime) && ObjectUtils.isNotEmpty(endTime)){
for (List<TimeNodeVO> timeNodeVOS : list) {
List<TimeNodeVO> timeNodeVOList = new ArrayList<>();
for (TimeNodeVO timeNodeVO : timeNodeVOS) {
Date time = timeNodeVO.getTime();
if(time.after(startTime) && time.before(endTime)){
TimeNodeVO timeNodeVOTemp = new TimeNodeVO();
BeanUtils.copyProperties(timeNodeVO,timeNodeVOTemp);
timeNodeVOTemp.setTime(time);
timeNodeVOList.add(timeNodeVOTemp);
}
}
if(timeNodeVOList.size() != 0){
listNew.add(timeNodeVOList);
}
}
}
for (ProjectLibraryBase libraryBase : projectLibraryBaseList) {
Map<String,Object> mapList = new HashMap<>();
List<List<TimeNodeVO>> collect = list.stream().filter(e -> libraryBase.getId().equals(e.get(0).getProjectId())).collect(Collectors.toList());
List<List<TimeNodeVO>> collect = new ArrayList<>();
if(ObjectUtils.isNotEmpty(startTime) && ObjectUtils.isNotEmpty(endTime)){
collect = listNew.stream().filter(e -> libraryBase.getId().equals(e.get(0).getProjectId())).collect(Collectors.toList());
}else{
collect = list.stream().filter(e -> libraryBase.getId().equals(e.get(0).getProjectId())).collect(Collectors.toList());
}
if(collect.size() != 0){
index ++;
mapList.put("index",index);