|
@@ -3405,6 +3405,10 @@ public class WeiXinCorpController {
|
|
|
JSONObject userJson = jsonArray.getJSONObject(m);
|
|
|
String curUserid = userJson.getString("userid");
|
|
|
String openUserid = userJson.getString("open_userid");
|
|
|
+ int status = userJson.getIntValue("status");
|
|
|
+ if(status!=1){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
List<Integer> departments = (List<Integer>) userJson.get("department");
|
|
|
System.out.println("user info======:"+userJson.toString());
|
|
|
//不存在的人员, 进行插入
|
|
@@ -3415,10 +3419,10 @@ public class WeiXinCorpController {
|
|
|
.setRoleName(role.getRolename())
|
|
|
.setCompanyId(company.getId())
|
|
|
.setName(userJson.getString("name"))
|
|
|
- .setCorpwxUserid(openUserid)
|
|
|
+ .setCorpwxUserid(curUserid)
|
|
|
.setCorpwxRealUserid(curUserid)
|
|
|
.setColor(ColorUtil.randomColor())
|
|
|
- .setJobNumber(curUserid.equals(openUserid)?null:curUserid)
|
|
|
+ .setJobNumber(curUserid)
|
|
|
.setPassword(MD5Util.getPassword("000000"))
|
|
|
.setCorpwxDeptid(departmentWx.getWxDeptid());
|
|
|
Integer max = Collections.max(departments);
|
|
@@ -3429,7 +3433,7 @@ public class WeiXinCorpController {
|
|
|
user.setDepartmentId(dp.get().getDepartmentId());
|
|
|
user.setDepartmentCascade(convertDepartmentIdToCascade(dp.get().getDepartmentId(),departmentList));
|
|
|
}
|
|
|
- boolean b = userList.stream().anyMatch(ul ->ul.getCorpwxUserid()!=null&&ul.getCorpwxUserid().equals(openUserid));
|
|
|
+ boolean b = userList.stream().anyMatch(ul ->ul.getCorpwxUserid()!=null&&ul.getCorpwxUserid().equals(user.getCorpwxUserid()));
|
|
|
if(!b){
|
|
|
userList.add(user);
|
|
|
}
|
|
@@ -3450,6 +3454,10 @@ public class WeiXinCorpController {
|
|
|
for (int i = 0; i < userInfo.size(); i++) {
|
|
|
JSONObject object = userInfo.getJSONObject(i);
|
|
|
String corpWxuserid = object.getString("userid");
|
|
|
+ int status = object.getIntValue("status");
|
|
|
+ if(status!=1){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
String userInfoResp=wxCorpInfoService.getUserInfoWithApplication(accessToken,corpWxuserid);
|
|
|
System.out.println("this is userinfo======="+userInfoResp);
|
|
|
JSONObject userInfoOb = JSONObject.parseObject(userInfoResp);
|
|
@@ -3475,7 +3483,7 @@ public class WeiXinCorpController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- user.setCorpwxUserid(openUserid)
|
|
|
+ user.setCorpwxUserid(corpWxuserid)
|
|
|
.setName(userName)
|
|
|
.setRoleName(role.getRolename())
|
|
|
.setRoleId(role.getId())
|
|
@@ -3483,8 +3491,8 @@ public class WeiXinCorpController {
|
|
|
.setCorpwxRealUserid(corpWxuserid)
|
|
|
.setColor(ColorUtil.randomColor())
|
|
|
.setPassword(MD5Util.getPassword("000000"))
|
|
|
- .setJobNumber(corpWxuserid.equals(openUserid)?null:corpWxuserid);
|
|
|
- boolean b = userList.stream().anyMatch(ul -> ul.getCorpwxUserid().equals(openUserid));
|
|
|
+ .setJobNumber(corpWxuserid);
|
|
|
+ boolean b = userList.stream().anyMatch(ul -> ul.getCorpwxUserid().equals(user.getCorpwxUserid()));
|
|
|
if(!b){
|
|
|
userList.add(user);
|
|
|
}
|
|
@@ -3493,6 +3501,7 @@ public class WeiXinCorpController {
|
|
|
throw new Exception(json.toJSONString());
|
|
|
}
|
|
|
}
|
|
|
+ System.out.println("resutlList========="+userList);
|
|
|
userService.saveBatch(userList);
|
|
|
}
|
|
|
}
|