Commit c01ca213 authored by 赵啸非's avatar 赵啸非

添加更新用户钉钉id任务

parent 45f94f6a
...@@ -65,42 +65,43 @@ public class SyncUserTaskImpl implements ITaskExcuteService { ...@@ -65,42 +65,43 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
log.info("同步用户"); log.info("同步用户");
staffService.syncPersons(null); staffService.syncPersons(null);
log.info("同步钉钉usreId"); log.info("同步钉钉usreId");
try {
List<UserEntity> userList = userService.getCacheList().stream() List<UserEntity> userList = userService.getCacheList().stream()
.filter(f -> !ObjectUtils.isEmpty(f.getCustomerId())) .filter(f -> !ObjectUtils.isEmpty(f.getCustomerId()))
.filter(f -> ObjectUtils.isEmpty(f.getDingUserId())).collect(Collectors.toList()); .filter(f -> ObjectUtils.isEmpty(f.getDingUserId())).collect(Collectors.toList());
List<UserEntity> updateUserList = userList.stream().map(item -> {
UserEntity userEntity = new UserEntity();
List<UserEntity> updateUserList = userList.stream().map(item -> { userEntity.setId(item.getId());
UserEntity userEntity = new UserEntity();
userEntity.setId(item.getId()); String mobile = item.getMobile();
if (ObjectUtils.isEmpty(mobile)) {
String mobile = item.getMobile(); //根据customerId查询staff 看是否有
if (ObjectUtils.isEmpty(mobile)) { StaffEntity staffCache = staffService.getCache(item.getCustomerId().toString());
//根据customerId查询staff 看是否有 if (!ObjectUtils.isEmpty(staffCache) && !ObjectUtils.isEmpty(staffCache.getPhoneNumber())) {
StaffEntity staffCache = staffService.getCache(item.getCustomerId().toString()); mobile = staffCache.getPhoneNumber();
if (!ObjectUtils.isEmpty(staffCache) && !ObjectUtils.isEmpty(staffCache.getPhoneNumber())) { userEntity.setMobile(mobile);
mobile = staffCache.getPhoneNumber(); }
userEntity.setMobile(mobile);
} }
} if (!ObjectUtils.isEmpty(mobile)) {
if (!ObjectUtils.isEmpty(mobile)) { Rest<String> personByMobile = dingPersonService.getPersonByMobile(mobile);
Rest<String> personByMobile = dingPersonService.getPersonByMobile(mobile); if (!ObjectUtils.isEmpty(personByMobile) &&
if (!ObjectUtils.isEmpty(personByMobile) && YesNoEnum.YES.getValue() == personByMobile.getCode()
YesNoEnum.YES.getValue() == personByMobile.getCode() && !ObjectUtils.isEmpty(personByMobile.getData())) {
&& !ObjectUtils.isEmpty(personByMobile.getData())) { userEntity.setDingUserId(personByMobile.getData());
userEntity.setDingUserId(personByMobile.getData()); }
} }
}
userEntity.setUpdateTime(new Date()); userEntity.setUpdateTime(new Date());
userEntity.setUpdateUserId(1L); userEntity.setUpdateUserId(1L);
return userEntity; return userEntity;
}).filter(f->!ObjectUtils.isEmpty(f.getDingUserId())).collect(Collectors.toList()); }).filter(f -> !ObjectUtils.isEmpty(f.getDingUserId())).collect(Collectors.toList());
if(!ObjectUtils.isEmpty(updateUserList)){ if (!ObjectUtils.isEmpty(updateUserList)) {
log.info("更新用户钉钉id信息数量:{}",updateUserList.size()); log.info("更新用户钉钉id信息数量:{}", updateUserList.size());
userService.getUserDao().updateBatch(updateUserList); userService.getUserDao().updateBatch(updateUserList);
}
} catch (Exception e) {
log.error("同步钉钉usreId失败");
} }
} catch (Exception e) { } catch (Exception e) {
log.error("同步人事异常", e); log.error("同步人事异常", e);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment