wangliang преди 1 година
родител
ревизия
a0259c7214
променени са 1 файла, в които са добавени 15 реда и са изтрити 9 реда
  1. 15 9
      sop-business/src/main/java/com/qmth/sop/business/service/impl/SysUserRoleServiceImpl.java

+ 15 - 9
sop-business/src/main/java/com/qmth/sop/business/service/impl/SysUserRoleServiceImpl.java

@@ -193,19 +193,25 @@ public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUs
             for (SysRole s : sysRoleList) {
                 if (s.getType() == RoleTypeEnum.BUSSINESS) {
                     List<TBService> tbServiceList = tbServiceService.listByIds(Arrays.asList(serviceId));
-                    tbServiceList = tbServiceList.stream().filter(i -> Objects.nonNull(i.getServiceLeadId()) ? true : false).collect(Collectors.toList());
-                    List<String> serviceLeadIdList = tbServiceList.stream().map(i -> String.valueOf(i.getServiceLeadId())).collect(Collectors.toList());
-                    userIdList.addAll(serviceLeadIdList);
+                    if (!CollectionUtils.isEmpty(tbServiceList)) {
+                        tbServiceList = tbServiceList.stream().filter(i -> Objects.nonNull(i.getServiceLeadId()) ? true : false).collect(Collectors.toList());
+                        List<String> serviceLeadIdList = tbServiceList.stream().map(i -> String.valueOf(i.getServiceLeadId())).collect(Collectors.toList());
+                        userIdList.addAll(serviceLeadIdList);
+                    }
                 } else if (s.getType() == RoleTypeEnum.REGION_MANAGER) {
                     List<TBCrm> tbCrmList = tbCrmService.list(new QueryWrapper<TBCrm>().lambda().eq(TBCrm::getServiceId, serviceId));
-                    tbCrmList = tbCrmList.stream().filter(i -> Objects.nonNull(i.getLeadId()) ? true : false).collect(Collectors.toList());
-                    List<String> leadIdList = tbCrmList.stream().map(i -> String.valueOf(i.getLeadId())).collect(Collectors.toList());
-                    userIdList.addAll(leadIdList);
+                    if (!CollectionUtils.isEmpty(tbCrmList)) {
+                        tbCrmList = tbCrmList.stream().filter(i -> Objects.nonNull(i.getLeadId()) ? true : false).collect(Collectors.toList());
+                        List<String> leadIdList = tbCrmList.stream().map(i -> String.valueOf(i.getLeadId())).collect(Collectors.toList());
+                        userIdList.addAll(leadIdList);
+                    }
                 } else if (s.getType() == RoleTypeEnum.REGION_COORDINATOR) {
                     List<TBCrm> tbCrmList = tbCrmService.list(new QueryWrapper<TBCrm>().lambda().eq(TBCrm::getServiceId, serviceId));
-                    tbCrmList = tbCrmList.stream().filter(i -> Objects.nonNull(i.getRegionCoordinatorId()) ? true : false).collect(Collectors.toList());
-                    List<String> regionCoordinatorIdList = tbCrmList.stream().map(i -> String.valueOf(i.getRegionCoordinatorId())).collect(Collectors.toList());
-                    userIdList.addAll(regionCoordinatorIdList);
+                    if (!CollectionUtils.isEmpty(tbCrmList)) {
+                        tbCrmList = tbCrmList.stream().filter(i -> Objects.nonNull(i.getRegionCoordinatorId()) ? true : false).collect(Collectors.toList());
+                        List<String> regionCoordinatorIdList = tbCrmList.stream().map(i -> String.valueOf(i.getRegionCoordinatorId())).collect(Collectors.toList());
+                        userIdList.addAll(regionCoordinatorIdList);
+                    }
                 } else {
                     sysRoleOtherList.add(s.getId());
                 }