Преглед на файлове

普通报销所有项目权限时部门查询修改

chenjun преди 8 месеца
родител
ревизия
8517889484
променени са 1 файла, в които са добавени 14 реда и са изтрити 4 реда
  1. 14 4
      zjugis-business/src/main/java/com/zjugis/business/flow/commoncost/service/CommonCostServiceImpl.java

+ 14 - 4
zjugis-business/src/main/java/com/zjugis/business/flow/commoncost/service/CommonCostServiceImpl.java

@@ -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();