|
@@ -30,6 +30,8 @@ public class SapUserService extends BaseService {
|
|
|
@Autowired
|
|
|
private RequestService requestService;
|
|
|
@Autowired
|
|
|
+ private SapEmpJobService sapEmpJobService;
|
|
|
+ @Autowired
|
|
|
private SapPersonalService sapPersonalService;
|
|
|
|
|
|
private static boolean isTestWXSync = true;
|
|
@@ -49,47 +51,27 @@ public class SapUserService extends BaseService {
|
|
|
if (!userId.startsWith("Test")) {
|
|
|
String username = userNode.get("username").asText().trim();
|
|
|
String name = userNode.get("lastName").asText().trim() + userNode.get("firstName").asText().trim();
|
|
|
- String position = userNode.get("jobCode").asText().trim();
|
|
|
- String formatPosition = formatLastCode(position).trim();
|
|
|
String mobile = userNode.get("cellPhone").asText().trim();
|
|
|
String businessPhone = userNode.get("businessPhone").asText().trim();
|
|
|
- String formatMobile = formatMobile(mobile).trim();
|
|
|
String email = userNode.get("email").asText().trim();
|
|
|
String personId = JsonNodeUtil.getValue(userNode, "personKeyNav", "personIdExternal");
|
|
|
- // 手机号码脱敏
|
|
|
-// if (StringUtils.isNotBlank(formatMobile) && formatMobile.length() == 11) {
|
|
|
-// formatMobile = formatMobile.substring(0, 8) + "999";
|
|
|
-// } else {
|
|
|
-// formatMobile = "";
|
|
|
-// }
|
|
|
- // 员工信息
|
|
|
SapUser sapUser = SapUser.builder().userId(userId).personId(personId).username(username).name(name)
|
|
|
- .position(position).formatPosition(formatPosition).mobile(mobile).formatMobile(formatMobile)
|
|
|
- .businessPhone(businessPhone).formatBusinessPhone(businessPhone).email(email)
|
|
|
- .formatEmail(email).isPrimary(userId.equals(personId)).build();
|
|
|
+ .mobile(mobile).formatMobile(mobile).businessPhone(businessPhone)
|
|
|
+ .formatBusinessPhone(businessPhone).email(email).formatEmail(email)
|
|
|
+ .isPrimary(userId.equals(personId)).build();
|
|
|
sapUsers.add(sapUser);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
// 获取用户对应机构
|
|
|
- sapUsers = sapOrgService.setOrg(headers, sapUsers);
|
|
|
+ sapOrgService.setOrg(sapUsers);
|
|
|
// 获取用户对应性别
|
|
|
- sapUsers = sapPersonalService.setGender(headers, sapUsers);
|
|
|
+ sapPersonalService.setGender(sapUsers);
|
|
|
+ // 获取用户对应职务
|
|
|
+ sapEmpJobService.setPosition(sapUsers);
|
|
|
return sapUsers;
|
|
|
}
|
|
|
|
|
|
- private String formatLastCode(String str) {
|
|
|
- str = str.replace(" ", "");
|
|
|
- if (str.endsWith(")")) {
|
|
|
- return str.substring(0, str.lastIndexOf("("));
|
|
|
- }
|
|
|
- return str;
|
|
|
- }
|
|
|
-
|
|
|
- private String formatMobile(String mobile) {
|
|
|
- return mobile.replace(" ", "").replace("(86)", "").replace("(86)", "");
|
|
|
- }
|
|
|
-
|
|
|
public void saveOneAndSyncWX(SapUser entity) throws Exception {
|
|
|
entity.setCreateDate(new Date());
|
|
|
entity.setDelFlag(false);
|
|
@@ -139,7 +121,7 @@ public class SapUserService extends BaseService {
|
|
|
fourthOrgWxDepartIdList[i] = sapUser.getFourthOrgWxDepartId();
|
|
|
}
|
|
|
return WXCpUserUtil.createOrUpdate(personId, wxSapUser.getName(), firstOrgWxDepartIdList,
|
|
|
- secondOrgWxDepartIdList, thirdOrgWxDepartIdList, fourthOrgWxDepartIdList, wxSapUser.getFormatPosition(),
|
|
|
+ secondOrgWxDepartIdList, thirdOrgWxDepartIdList, fourthOrgWxDepartIdList, wxSapUser.getPosition(),
|
|
|
wxSapUser.getFormatMobile(), wxSapUser.getGender(), wxSapUser.getFormatEmail(),
|
|
|
wxSapUser.getFormatBusinessPhone(), wxSapUser.getFirstOrgName());
|
|
|
}
|
|
@@ -210,7 +192,7 @@ public class SapUserService extends BaseService {
|
|
|
}
|
|
|
|
|
|
public SapUser toInfoDetail(SapUser sapUser) throws Exception {
|
|
|
- if(sapUser != null) {
|
|
|
+ if (sapUser != null) {
|
|
|
List<SapUser> users = selectListByPersonId(sapUser.getPersonId());
|
|
|
List<List<SapOrg>> departList = Lists.newArrayList();
|
|
|
for (int i = 0; i < users.size(); i++) {
|