|
@@ -42,19 +42,18 @@ public class WXCpUserUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static String createOrUpdate(String userId, String name, Long[] firstOrgWxDepartIdList,
|
|
|
- Long[] secondOrgWxDepartIdList, Long[] thirdOrgWxDepartIdList, Long[] fourthOrgWxDepartIdList,
|
|
|
- String position, String mobile, String gender, String email, String telephone, String firstOrgName) {
|
|
|
+ public static String createOrUpdate(String userId, String name, Long[] firstWxDepartIdList,
|
|
|
+ Long[] secondWxDepartIdList, Long[] thirdWxDepartIdList, Long[] fourthWxDepartIdList, String position,
|
|
|
+ String mobile, String gender, String email, String telephone, String firstOrgName) {
|
|
|
WxCpUser user = getByIdOrEmail(userId, email);
|
|
|
try {
|
|
|
if (user == null) {
|
|
|
- user = getUser(userId, name, firstOrgWxDepartIdList, secondOrgWxDepartIdList, thirdOrgWxDepartIdList,
|
|
|
- fourthOrgWxDepartIdList, position, mobile, gender, email, telephone, firstOrgName);
|
|
|
+ user = getUser(userId, name, firstWxDepartIdList, secondWxDepartIdList, thirdWxDepartIdList,
|
|
|
+ fourthWxDepartIdList, position, mobile, gender, email, telephone, firstOrgName);
|
|
|
userService.create(user);
|
|
|
} else {
|
|
|
- user = getUser(user.getUserId(), name, firstOrgWxDepartIdList, secondOrgWxDepartIdList,
|
|
|
- thirdOrgWxDepartIdList, fourthOrgWxDepartIdList, position, mobile, gender, email, telephone,
|
|
|
- firstOrgName);
|
|
|
+ user = getUser(user.getUserId(), name, firstWxDepartIdList, secondWxDepartIdList, thirdWxDepartIdList,
|
|
|
+ fourthWxDepartIdList, position, mobile, gender, email, telephone, firstOrgName);
|
|
|
userService.update(user);
|
|
|
}
|
|
|
return SapUserResultEnum.SUCCESS.getCode();
|
|
@@ -63,10 +62,9 @@ public class WXCpUserUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private static WxCpUser getUser(String userId, String name, Long[] firstOrgWxDepartIdList,
|
|
|
- Long[] secondOrgWxDepartIdList, Long[] thirdOrgWxDepartIdList, Long[] fourthOrgWxDepartIdList,
|
|
|
- String position, String mobile, String gender, String email, String telephone, String firstOrgName)
|
|
|
- throws WxErrorException {
|
|
|
+ private static WxCpUser getUser(String userId, String name, Long[] firstWxDepartIdList, Long[] secondWxDepartIdList,
|
|
|
+ Long[] thirdWxDepartIdList, Long[] fourthWxDepartIdList, String position, String mobile, String gender,
|
|
|
+ String email, String telephone, String firstOrgName) throws WxErrorException {
|
|
|
WxCpUser user = new WxCpUser();
|
|
|
if (Tools.notEmpty(userId)) {
|
|
|
user.setUserId(userId);
|
|
@@ -74,10 +72,10 @@ public class WXCpUserUtil {
|
|
|
if (Tools.notEmpty(name)) {
|
|
|
user.setName(name);
|
|
|
}
|
|
|
- Long[] departIds = new Long[firstOrgWxDepartIdList.length];
|
|
|
- for (int i = 0; i < firstOrgWxDepartIdList.length; i++) {
|
|
|
- departIds[i] = WXCpDepartUtil.create(firstOrgWxDepartIdList[i], secondOrgWxDepartIdList[i],
|
|
|
- thirdOrgWxDepartIdList[i], fourthOrgWxDepartIdList[i]);
|
|
|
+ Long[] departIds = new Long[firstWxDepartIdList.length];
|
|
|
+ for (int i = 0; i < firstWxDepartIdList.length; i++) {
|
|
|
+ departIds[i] = WXCpDepartUtil.create(firstWxDepartIdList[i], secondWxDepartIdList[i],
|
|
|
+ thirdWxDepartIdList[i], fourthWxDepartIdList[i]);
|
|
|
}
|
|
|
user.setDepartIds(departIds);
|
|
|
if (Tools.notEmpty(position)) {
|
|
@@ -173,7 +171,7 @@ public class WXCpUserUtil {
|
|
|
for (WxCpDepart depart : departs) {
|
|
|
List<WxCpUser> users = WXCpUserUtil.listByDepartment(depart.getId());
|
|
|
for (WxCpUser user : users) {
|
|
|
- if(!set.contains(user.getUserId())) {
|
|
|
+ if (!set.contains(user.getUserId())) {
|
|
|
result.add(user);
|
|
|
set.add(user.getUserId());
|
|
|
}
|