|
@@ -26,7 +26,7 @@ public class WXCpUserUtil {
|
|
|
|
|
|
public static String createOrUpdateForTest(String userId, String name, String[] subCompanyList,
|
|
|
String[] departmentList, String position, String mobile, String gender, String email) {
|
|
|
- WxCpUser user = getById(userId);
|
|
|
+ WxCpUser user = getByIdOrEmail(userId, email);
|
|
|
try {
|
|
|
if (user == null) {
|
|
|
user = getUserForTest(userId, name, subCompanyList, departmentList, position, mobile, gender, email);
|
|
@@ -45,7 +45,7 @@ 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) {
|
|
|
- WxCpUser user = getById(userId);
|
|
|
+ WxCpUser user = getByIdOrEmail(userId, email);
|
|
|
try {
|
|
|
if (user == null) {
|
|
|
user = getUser(userId, name, firstOrgWxDepartIdList, secondOrgWxDepartIdList, thirdOrgWxDepartIdList,
|
|
@@ -137,7 +137,7 @@ public class WXCpUserUtil {
|
|
|
return user;
|
|
|
}
|
|
|
|
|
|
- public static WxCpUser getById(String userId) {
|
|
|
+ public static WxCpUser getByIdOrEmail(String userId, String email) {
|
|
|
try {
|
|
|
WxCpUser user = userService.getById(userId);
|
|
|
if (user != null) {
|
|
@@ -145,6 +145,13 @@ public class WXCpUserUtil {
|
|
|
}
|
|
|
} catch (WxErrorException e) {
|
|
|
}
|
|
|
+ try {
|
|
|
+ WxCpUser user = userService.getById(email);
|
|
|
+ if (user != null) {
|
|
|
+ return user;
|
|
|
+ }
|
|
|
+ } catch (WxErrorException e) {
|
|
|
+ }
|
|
|
return null;
|
|
|
}
|
|
|
|