|
@@ -20,8 +20,10 @@ package org.maxkey.synchronizer.dingding;
|
|
import org.joda.time.DateTime;
|
|
import org.joda.time.DateTime;
|
|
import org.joda.time.format.DateTimeFormat;
|
|
import org.joda.time.format.DateTimeFormat;
|
|
import org.maxkey.constants.ConstantsPasswordSetType;
|
|
import org.maxkey.constants.ConstantsPasswordSetType;
|
|
|
|
+import org.maxkey.entity.SocialsAssociate;
|
|
import org.maxkey.entity.Synchronizers;
|
|
import org.maxkey.entity.Synchronizers;
|
|
import org.maxkey.entity.UserInfo;
|
|
import org.maxkey.entity.UserInfo;
|
|
|
|
+import org.maxkey.persistence.service.SocialsAssociateService;
|
|
import org.maxkey.persistence.service.UserInfoService;
|
|
import org.maxkey.persistence.service.UserInfoService;
|
|
import org.maxkey.synchronizer.ISynchronizerService;
|
|
import org.maxkey.synchronizer.ISynchronizerService;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
@@ -47,6 +49,10 @@ public class DingdingUsersService implements ISynchronizerService
|
|
@Autowired
|
|
@Autowired
|
|
UserInfoService userInfoService;
|
|
UserInfoService userInfoService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ SocialsAssociateService socialsAssociateService;
|
|
|
|
+
|
|
|
|
+
|
|
String access_token;
|
|
String access_token;
|
|
|
|
|
|
public void sync()
|
|
public void sync()
|
|
@@ -85,9 +91,18 @@ public class DingdingUsersService implements ISynchronizerService
|
|
if (loadUser != null)
|
|
if (loadUser != null)
|
|
{
|
|
{
|
|
userInfoService.update(userInfo);
|
|
userInfoService.update(userInfo);
|
|
|
|
+
|
|
} else
|
|
} else
|
|
{
|
|
{
|
|
userInfoService.insert(userInfo);
|
|
userInfoService.insert(userInfo);
|
|
|
|
+ //绑定用户
|
|
|
|
+ SocialsAssociate socialsAssociate = new SocialsAssociate();
|
|
|
|
+ socialsAssociate.setProvider("dingtalk");
|
|
|
|
+ socialsAssociate.setSocialUserId(user.getUnionid());
|
|
|
|
+ socialsAssociate.setUserId(userInfo.getId());
|
|
|
|
+ socialsAssociate.setUsername(userInfo.getUsername());
|
|
|
|
+ socialsAssociateService.merge(socialsAssociate);
|
|
|
|
+ _logger.info("bind user " + socialsAssociate);
|
|
}
|
|
}
|
|
_logger.info("userInfo " + userInfo);
|
|
_logger.info("userInfo " + userInfo);
|
|
}
|
|
}
|
|
@@ -110,8 +125,8 @@ public class DingdingUsersService implements ISynchronizerService
|
|
public UserInfo buildUserInfo(ListUserResponse user)
|
|
public UserInfo buildUserInfo(ListUserResponse user)
|
|
{
|
|
{
|
|
UserInfo userInfo = new UserInfo();
|
|
UserInfo userInfo = new UserInfo();
|
|
-
|
|
|
|
- userInfo.setUsername(user.getUserid());//鐧诲綍鍚�
|
|
|
|
|
|
+ // 手机号 作为用户名
|
|
|
|
+ userInfo.setUsername(user.getMobile());//鐧诲綍鍚�
|
|
userInfo.setNickName(user.getName());//鐢ㄦ埛鍚�
|
|
userInfo.setNickName(user.getName());//鐢ㄦ埛鍚�
|
|
userInfo.setDisplayName(user.getName());//鐢ㄦ埛鍚�
|
|
userInfo.setDisplayName(user.getName());//鐢ㄦ埛鍚�
|
|
userInfo.setFormattedName(user.getName());//鐢ㄦ埛鍚�
|
|
userInfo.setFormattedName(user.getName());//鐢ㄦ埛鍚�
|