Browse Source

修复空指针问题

xueyiming 4 months ago
parent
commit
f613a1bc35

+ 3 - 0
we-com-server/src/main/java/com/tzld/piaoquan/wecom/job/WeComStaffDataJob.java

@@ -59,6 +59,9 @@ public class WeComStaffDataJob {
             }
             for (Corp corp : corps) {
                 List<String> carrierIdList = getCarrierIdList(corp.getId());
+                if (CollectionUtils.isEmpty(carrierIdList)) {
+                    continue;
+                }
                 for (String carrierId : carrierIdList) {
                     StaffExample example = new StaffExample();
                     example.createCriteria().andCarrierIdEqualTo(carrierId).andCorpIdEqualTo(corp.getId());

+ 3 - 1
we-com-server/src/main/java/com/tzld/piaoquan/wecom/job/WeComUserDataJob.java

@@ -196,7 +196,9 @@ public class WeComUserDataJob {
                 for (Staff staff : staffList) {
                     List<String> existExternalUserIds = getUserList(staff.getCarrierId(), corp.getId());
                     List<String> allExternalUserIds = staffWithUserMapper.selectExternalUserIdByStaffId(staff.getId());
-                    allExternalUserIds.removeAll(existExternalUserIds);
+                    if (!CollectionUtils.isEmpty(existExternalUserIds)) {
+                        allExternalUserIds.removeAll(existExternalUserIds);
+                    }
                     if (!CollectionUtils.isEmpty(allExternalUserIds)) {
                         for (String delExternalUserId : allExternalUserIds) {
                             userService.delStaffWithUser(delExternalUserId, staff.getCarrierId(), System.currentTimeMillis());