|
@@ -27,7 +27,8 @@ public class WXCpUserUtil {
|
|
user = getUserForTest(userId, name, subCompanyList, departmentList, position, mobile, gender, email);
|
|
user = getUserForTest(userId, name, subCompanyList, departmentList, position, mobile, gender, email);
|
|
userService.create(user);
|
|
userService.create(user);
|
|
} else {
|
|
} else {
|
|
- user = getUserForTest(user.getUserId(), name, subCompanyList, departmentList, position, mobile, gender, email);
|
|
|
|
|
|
+ user = getUserForTest(user.getUserId(), name, subCompanyList, departmentList, position, mobile, gender,
|
|
|
|
+ email);
|
|
userService.update(user);
|
|
userService.update(user);
|
|
}
|
|
}
|
|
return WebConstants.SUCCESS;
|
|
return WebConstants.SUCCESS;
|
|
@@ -46,8 +47,9 @@ public class WXCpUserUtil {
|
|
fourthOrgWxDepartIdList, position, mobile, gender, email, telephone, firstOrgName);
|
|
fourthOrgWxDepartIdList, position, mobile, gender, email, telephone, firstOrgName);
|
|
userService.create(user);
|
|
userService.create(user);
|
|
} else {
|
|
} else {
|
|
- user = getUser(user.getUserId(), name, firstOrgWxDepartIdList, secondOrgWxDepartIdList, thirdOrgWxDepartIdList,
|
|
|
|
- fourthOrgWxDepartIdList, position, mobile, gender, email, telephone, firstOrgName);
|
|
|
|
|
|
+ user = getUser(user.getUserId(), name, firstOrgWxDepartIdList, secondOrgWxDepartIdList,
|
|
|
|
+ thirdOrgWxDepartIdList, fourthOrgWxDepartIdList, position, mobile, gender, email, telephone,
|
|
|
|
+ firstOrgName);
|
|
userService.update(user);
|
|
userService.update(user);
|
|
}
|
|
}
|
|
return "SUCCESS";
|
|
return "SUCCESS";
|
|
@@ -133,13 +135,19 @@ public class WXCpUserUtil {
|
|
public static WxCpUser getByIdOrEmail(String userId, String email) {
|
|
public static WxCpUser getByIdOrEmail(String userId, String email) {
|
|
try {
|
|
try {
|
|
WxCpUser user = userService.getById(userId);
|
|
WxCpUser user = userService.getById(userId);
|
|
- if (user == null) {
|
|
|
|
- user = userService.getById(email);
|
|
|
|
|
|
+ if (user != null) {
|
|
|
|
+ return user;
|
|
|
|
+ }
|
|
|
|
+ } catch (WxErrorException e) {
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ WxCpUser user = userService.getById(email);
|
|
|
|
+ if (user != null) {
|
|
|
|
+ return user;
|
|
}
|
|
}
|
|
- return user;
|
|
|
|
} catch (WxErrorException e) {
|
|
} catch (WxErrorException e) {
|
|
- return null;
|
|
|
|
}
|
|
}
|
|
|
|
+ return null;
|
|
}
|
|
}
|
|
|
|
|
|
public static void delete(String userId) {
|
|
public static void delete(String userId) {
|
|
@@ -154,7 +162,6 @@ public class WXCpUserUtil {
|
|
}
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
- createOrUpdateForTest("yangbin", "杨斌", new String[] { "华人时代" }, new String[] { "管理层" }, "", "", "男",
|
|
|
|
- "13671179900@jiinfo.cn");
|
|
|
|
|
|
+ System.out.println(getByIdOrEmail("111", "weisong.fang@cdelive.cn"));
|
|
}
|
|
}
|
|
}
|
|
}
|