完善用户获取部门信息的逻辑
This commit is contained in:
parent
4d9866bf77
commit
856813f848
|
@ -139,7 +139,22 @@ public class UserHttpRequestImpl implements UserHttpRequest {
|
||||||
private User loadBatchSF(List<UserDataDTO> userDataDTOS, User user) {
|
private User loadBatchSF(List<UserDataDTO> userDataDTOS, User user) {
|
||||||
// 获取公司代码,优先从用户获取,若为空则从登录参数中获取
|
// 获取公司代码,优先从用户获取,若为空则从登录参数中获取
|
||||||
String companyCode = Optional.ofNullable(user.getCompanyCode())
|
String companyCode = Optional.ofNullable(user.getCompanyCode())
|
||||||
.orElseGet(() -> BaseContext.getCurrentUser().getUserLoginParam().getCompanyCode());
|
.orElseGet(() ->
|
||||||
|
{
|
||||||
|
User currentUser = BaseContext.getCurrentUser();
|
||||||
|
if (currentUser != null &&
|
||||||
|
currentUser.getUserLoginParam() != null &&
|
||||||
|
currentUser.getUserLoginParam().getCompanyCode() != null) {
|
||||||
|
return currentUser.getUserLoginParam().getCompanyCode();
|
||||||
|
} else {
|
||||||
|
//如果不存在登录信息,那么获取用户的主岗信息
|
||||||
|
Optional<UserDataDTO> userDataDTO = userDataDTOS
|
||||||
|
.stream()
|
||||||
|
.filter(it -> it.getPersonIdExternal().equals(it.getLoginUsername()))
|
||||||
|
.findFirst();
|
||||||
|
return userDataDTO.map(UserDataDTO::getCompany).orElse(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// 根据公司代码获取对应的UserDataDTO
|
// 根据公司代码获取对应的UserDataDTO
|
||||||
Predicate<UserDataDTO> matchCompanyCode = StringCheck.isFirstCharacterChinese(companyCode) ?
|
Predicate<UserDataDTO> matchCompanyCode = StringCheck.isFirstCharacterChinese(companyCode) ?
|
||||||
|
|
Loading…
Reference in New Issue