wangyunpeng 3 semanas atrás
pai
commit
76b59f88e6

+ 10 - 1
api-module/src/main/java/com/tzld/piaoquan/api/job/wecom/thirdpart/WeComUserDetailJob.java

@@ -125,7 +125,16 @@ public class WeComUserDetailJob {
         List<ThirdPartWeComStaffUser> existUserList = getThirdPartWeComStaffUserListByStaffId(thirdStaffId);
         List<Long> existUserIdList = existUserList.stream().map(ThirdPartWeComStaffUser::getUserId).collect(Collectors.toList());
         Map<Long, ThirdPartWeComStaffUser> existUserMap = existUserList.stream()
-                .collect(Collectors.toMap(ThirdPartWeComStaffUser::getUserId, user -> user));
+                .collect(Collectors.toMap(ThirdPartWeComStaffUser::getUserId, user -> user, (a, b) -> {
+                    if (a.getAddCustomerTime() == 0) {
+                        return b;
+                    } else if (b.getAddCustomerTime() == 0) {
+                        return a;
+                    } else if (a.getAddCustomerTime() > b.getAddCustomerTime()) {
+                        return b;
+                    }
+                    return b;
+                }));
         List<ThirdPartWeComStaffUser> saveList = new ArrayList<>();
         List<ThirdPartWeComStaffUser> updateList = new ArrayList<>();
         for (ExternalContactsResponse.ContactItem contactItem : contactItemList) {