|
@@ -35,18 +35,18 @@ public class WXCpUserUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static String createOrUpdate(String userId, String name, String[] firstOrgList, String[] secondOrgList,
|
|
|
- String[] thirdOrgList, String[] fourthOrgList, String position, String mobile, String gender,
|
|
|
- String email, String telephone) {
|
|
|
+ public static String createOrUpdate(String userId, String name, Long[] firstOrgWxIdList,
|
|
|
+ Long[] secondOrgWxIdList, Long[] thirdOrgWxIdList, Long[] fourthOrgWxIdList, String position,
|
|
|
+ String mobile, String gender, String email, String telephone) {
|
|
|
WxCpUser user = getById(userId);
|
|
|
try {
|
|
|
if (user == null) {
|
|
|
- user = getUser(userId, name, firstOrgList, secondOrgList, thirdOrgList, fourthOrgList, position, mobile,
|
|
|
- gender, email, telephone);
|
|
|
+ user = getUser(userId, name, firstOrgWxIdList, secondOrgWxIdList, thirdOrgWxIdList, fourthOrgWxIdList,
|
|
|
+ position, mobile, gender, email, telephone);
|
|
|
userService.create(user);
|
|
|
} else {
|
|
|
- user = getUser(userId, name, firstOrgList, secondOrgList, thirdOrgList, fourthOrgList, position, mobile,
|
|
|
- gender, email, telephone);
|
|
|
+ user = getUser(userId, name, firstOrgWxIdList, secondOrgWxIdList, thirdOrgWxIdList, fourthOrgWxIdList,
|
|
|
+ position, mobile, gender, email, telephone);
|
|
|
userService.update(user);
|
|
|
}
|
|
|
return "SUCCESS";
|
|
@@ -55,9 +55,9 @@ public class WXCpUserUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private static WxCpUser getUser(String userId, String name, String[] firstOrgList, String[] secondOrgList,
|
|
|
- String[] thirdOrgList, String[] fourthOrgList, String position, String mobile, String gender, String email, String telephone)
|
|
|
- throws WxErrorException {
|
|
|
+ private static WxCpUser getUser(String userId, String name, Long[] firstOrgWxIdList, Long[] secondOrgWxIdList,
|
|
|
+ Long[] thirdOrgWxIdList, Long[] fourthOrgWxIdList, String position, String mobile, String gender,
|
|
|
+ String email, String telephone) throws WxErrorException {
|
|
|
WxCpUser user = new WxCpUser();
|
|
|
if (Tools.notEmpty(userId)) {
|
|
|
user.setUserId(userId);
|
|
@@ -65,10 +65,10 @@ public class WXCpUserUtil {
|
|
|
if (Tools.notEmpty(name)) {
|
|
|
user.setName(name);
|
|
|
}
|
|
|
- Long[] departIds = new Long[firstOrgList.length];
|
|
|
- for (int i = 0; i < firstOrgList.length; i++) {
|
|
|
- departIds[i] = WXCpDepartUtil.create(firstOrgList[i], secondOrgList[i], thirdOrgList[i],
|
|
|
- fourthOrgList[i]);
|
|
|
+ Long[] departIds = new Long[firstOrgWxIdList.length];
|
|
|
+ for (int i = 0; i < firstOrgWxIdList.length; i++) {
|
|
|
+ departIds[i] = WXCpDepartUtil.create(firstOrgWxIdList[i], secondOrgWxIdList[i], thirdOrgWxIdList[i],
|
|
|
+ fourthOrgWxIdList[i]);
|
|
|
}
|
|
|
user.setDepartIds(departIds);
|
|
|
if (Tools.notEmpty(position)) {
|
|
@@ -87,7 +87,7 @@ public class WXCpUserUtil {
|
|
|
user.setTelephone(telephone);
|
|
|
}
|
|
|
user.setToInvite(false);
|
|
|
- ExternalAttribute attribute = ExternalAttribute.builder().name("所属公司").type(0).value(firstOrgList[0]).build();
|
|
|
+ ExternalAttribute attribute = ExternalAttribute.builder().name("所属公司").type(0).value(firstOrgName).build();
|
|
|
user.addExternalAttr(attribute);
|
|
|
return user;
|
|
|
}
|