备份用户部门代码

This commit is contained in:
lulz1 2024-04-04 16:55:43 +08:00
parent 16935ccb5d
commit 276c05ee72
3 changed files with 24 additions and 6 deletions

View File

@ -588,8 +588,14 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
return orderHotelRecord;
}
private String belongDeport(String accountCompanyName, String employeeNo) {
private String belongDeport(String employeeNo, String accountCompanyName) {
User user = userRepository.findByUserEmployeeNo(employeeNo);
if (user == null) {
user = userHttpRequest.loadUserInfo(User.withEmployeeNo(employeeNo));
if (user == null) {
return null;
}
}
if (user.getUserDepartmentInfoList() == null || user.getUserDepartmentInfoList().isEmpty()) {
userHttpRequest.loadUserDeptInfo(user);
}

View File

@ -68,6 +68,9 @@ public class UserHttpRequestImpl implements UserHttpRequest {
@Override
public User loadUserInfo(User user) {
loadSFInfo(user);
if (user == null) {
return null;
}
return loadRankCode(user);
}
@ -104,8 +107,12 @@ public class UserHttpRequestImpl implements UserHttpRequest {
}
private User loadSFInfo(User user) {
List<UserDataDTO> fromJson = userSFRequest
.getUserSFDataFromOpenApi(user)
List<UserDataDTO> userSFDataFromOpenApi = userSFRequest
.getUserSFDataFromOpenApi(user);
if (userSFDataFromOpenApi == null) {
return null;
}
List<UserDataDTO> fromJson = userSFDataFromOpenApi
.stream()
.filter(userDataDTO -> userDataDTO.getStatus().equals("A"))
.toList();
@ -210,11 +217,13 @@ public class UserHttpRequestImpl implements UserHttpRequest {
public User loadUserDeptInfo(User user) {
List<UserDataDTO> userDataDTOList = userSFRequest.getUserSFDataFromOpenApi(user);
if (userDataDTOList != null && userDataDTOList.size() == 1) {
if (userDataDTOList == null) {
return null;
}
if (userDataDTOList.size() == 1) {
addDeptInfo(userDataDTOList.get(0), user, true);
}
if (userDataDTOList != null && userDataDTOList.size() > 1) {
if (userDataDTOList.size() > 1) {
for (UserDataDTO userDataDTO : userDataDTOList) {
if (userDataDTO.getPersonIdExternal().equals(userDataDTO.getLoginUsername())) {
addDeptInfo(userDataDTO, user, true);

View File

@ -69,6 +69,9 @@ public class UserSFRequest {
DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map);
Type type = new TypeToken<List<UserDataDTO>>() {
}.getType();
if(result.getData() == null){
return null;
}
List<UserDataDTO> userDataDTOs = gson.fromJson(result.getData().toString(), type);
if (result.getData() != null) {
return userDataDTOs;