|
@@ -491,21 +491,21 @@ public class WeiXinCorpController {
|
|
|
// "ExpireTime":1671465600,"ActiveCode":"LA10000001400000163774145"},
|
|
|
// "ServiceCorpId":"wwf11426cf618e1703",
|
|
|
// "AuthCorpId":"wpy9TkCAAA6ii2OYKAEj5rCEqjwEQSuA","TimeStamp":1668761791}}
|
|
|
+ String corpId = jsonObject.getString("AuthCorpId");
|
|
|
org.json.JSONObject authUserJson = jsonObject.getJSONObject("AccountList");
|
|
|
String authUserId = authUserJson.getString("UserId");
|
|
|
User oneUser = userMapper.selectOne(new QueryWrapper<User>().eq("corpwx_userid", authUserId));
|
|
|
if (oneUser == null) {
|
|
|
//生成该用户
|
|
|
- String corpId = authUserJson.getString("AuthCorpId");
|
|
|
WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectById(corpId);
|
|
|
if (wxCorpInfo != null) {
|
|
|
Integer companyId = wxCorpInfo.getCompanyId();
|
|
|
SysRole defaultRole = sysRoleMapper.selectOne(new QueryWrapper<SysRole>().eq("company_id", companyId).eq("is_default", 1));
|
|
|
- String corpWxUserId = jsonObject.getString("UserID");
|
|
|
- String openUserId = jsonObject.getString("OpenUserID");
|
|
|
+
|
|
|
if (wxCorpInfo.getSaasSyncContact() == 1) {
|
|
|
//直接通过企业微信通讯录同步
|
|
|
- JSONObject userObj = getUserInfo(getCorpAccessToken(wxCorpInfo), corpWxUserId);
|
|
|
+ JSONObject userObj = getUserInfo(getCorpAccessToken(wxCorpInfo), authUserId);
|
|
|
+ System.out.println("userObj=="+userObj);
|
|
|
//成功获取到通讯录的个人详情
|
|
|
Long id = SnowFlake.nextId();
|
|
|
//通过getUserInfo接口获取到的json key是小写的
|
|
@@ -513,6 +513,7 @@ public class WeiXinCorpController {
|
|
|
Integer curUserWXDeptid = getMaxDeptIdFromArray(department);
|
|
|
Department sysDept = departmentMapper.selectOne(new QueryWrapper<Department>().eq("company_id", companyId).eq("corpwx_deptid", curUserWXDeptid));
|
|
|
String userId = userObj.getString("userid");
|
|
|
+ String openUserId = userObj.getString("open_userid");
|
|
|
User user = new User()
|
|
|
.setId(id.toString())
|
|
|
.setRoleId(defaultRole.getId())
|
|
@@ -521,7 +522,7 @@ public class WeiXinCorpController {
|
|
|
.setPhone(userObj.getString("mobile"))
|
|
|
.setPassword(MD5Util.getPassword("000000"))
|
|
|
.setCorpwxUserid(openUserId)
|
|
|
- .setCorpwxRealUserid(corpWxUserId)
|
|
|
+ .setCorpwxRealUserid(userId)
|
|
|
.setJobNumber(openUserId.equals(userId)?null:userId)
|
|
|
.setColor(ColorUtil.randomColor())
|
|
|
.setCompanyId(companyId);
|