|
@@ -292,8 +292,13 @@ public class CommonCostServiceImpl implements CommonCostService {
|
|
|
public PageResult<CommonCostRespVO> getCommonCostDeptPage(CommonCostPageReqVO pageReqVO) {
|
|
|
List<Project> projects = projectService.selectByPermission();
|
|
|
Set<String> deptProjectIds = convertSet(projects, Project::getId);
|
|
|
- List<CommonCostDetailDO> detailList = commonCostDetailService.getListByProjectIds(deptProjectIds);
|
|
|
- Set<String> ids = convertSet(detailList, CommonCostDetailDO::getCommonCostId);
|
|
|
+ Set<String> ids;
|
|
|
+ if (CollectionUtil.isEmpty(deptProjectIds)){
|
|
|
+ ids = Collections.emptySet();
|
|
|
+ } else {
|
|
|
+ List<CommonCostDetailDO> detailList = commonCostDetailService.getListByProjectIds(deptProjectIds);
|
|
|
+ ids = convertSet(detailList, CommonCostDetailDO::getCommonCostId);
|
|
|
+ }
|
|
|
PageResult<CommonCostDO> pageResult = commonCostDao.getCommonCostDeptPage(pageReqVO, ids);
|
|
|
PageResult<CommonCostRespVO> commonCostRespVOPageResult = getCommonCostRespVOPageResult(pageResult);
|
|
|
return commonCostRespVOPageResult;
|
|
@@ -324,8 +329,13 @@ public class CommonCostServiceImpl implements CommonCostService {
|
|
|
public CommonCostOverviewVO getCommonCostOverviewDept(CommonCostPageReqVO pageReqVO) {
|
|
|
List<Project> projects = projectService.selectByPermission();
|
|
|
Set<String> deptProjectIds = convertSet(projects, Project::getId);
|
|
|
- List<CommonCostDetailDO> detailList = commonCostDetailService.getListByProjectIds(deptProjectIds);
|
|
|
- Set<String> ids = convertSet(detailList, CommonCostDetailDO::getCommonCostId);
|
|
|
+ Set<String> ids;
|
|
|
+ if (CollectionUtil.isEmpty(deptProjectIds)){
|
|
|
+ ids = Collections.emptySet();
|
|
|
+ } else {
|
|
|
+ List<CommonCostDetailDO> detailList = commonCostDetailService.getListByProjectIds(deptProjectIds);
|
|
|
+ ids = convertSet(detailList, CommonCostDetailDO::getCommonCostId);
|
|
|
+ }
|
|
|
List<CommonCostDO> commonCostList = commonCostDao.getCommonCostDeptList(pageReqVO, ids);
|
|
|
CommonCostOverviewVO result = new CommonCostOverviewVO();
|
|
|
double totalAmount = commonCostList.stream().collect(Collectors.summarizingDouble(value -> value.getTotalAmount().doubleValue())).getSum();
|