Jelajahi Sumber

172-打款无部门id报错问题处理

yzc 1 tahun lalu
induk
melakukan
a427f8c70e

+ 5 - 3
hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountPaymentServiceImpl.java

@@ -117,9 +117,11 @@ public class AccountPaymentServiceImpl extends ServiceImpl<AccountPaymentMapper,
                 .filter(Objects::nonNull)
                 .distinct()
                 .collect(Collectors.toList());
-        List<SysDept> sysDeptList = sysDeptService.listByIds(deptIdList);
-        Map<Long, String> deptMap = sysDeptList.stream().collect(Collectors.toMap(SysDept::getDeptId, SysDept::getDeptName));
-        records.forEach(item -> item.setDeptName(deptMap.get(item.getDepartmentId())));
+        if (ObjectUtil.isNotEmpty(deptIdList)) {
+            List<SysDept> sysDeptList = sysDeptService.listByIds(deptIdList);
+            Map<Long, String> deptMap = sysDeptList.stream().collect(Collectors.toMap(SysDept::getDeptId, SysDept::getDeptName));
+            records.forEach(item -> item.setDeptName(deptMap.get(item.getDepartmentId())));
+        }
         DynamicDataSourceContextHolder.poll();
 
         return page;