diff --git a/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java b/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java index 4f3c246e..48ef9945 100644 --- a/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java @@ -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); } diff --git a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java index fd72becd..407f7828 100644 --- a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java +++ b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java @@ -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 fromJson = userSFRequest - .getUserSFDataFromOpenApi(user) + List userSFDataFromOpenApi = userSFRequest + .getUserSFDataFromOpenApi(user); + if (userSFDataFromOpenApi == null) { + return null; + } + List 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 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); diff --git a/src/main/java/com/chint/interfaces/rest/user/UserSFRequest.java b/src/main/java/com/chint/interfaces/rest/user/UserSFRequest.java index 6745b4d9..5faacc02 100644 --- a/src/main/java/com/chint/interfaces/rest/user/UserSFRequest.java +++ b/src/main/java/com/chint/interfaces/rest/user/UserSFRequest.java @@ -69,6 +69,9 @@ public class UserSFRequest { DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map); Type type = new TypeToken>() { }.getType(); + if(result.getData() == null){ + return null; + } List userDataDTOs = gson.fromJson(result.getData().toString(), type); if (result.getData() != null) { return userDataDTOs;