diff --git a/src/main/java/com/chint/application/out/UserController.java b/src/main/java/com/chint/application/out/UserController.java index a6804ed2..0703dee8 100644 --- a/src/main/java/com/chint/application/out/UserController.java +++ b/src/main/java/com/chint/application/out/UserController.java @@ -8,6 +8,7 @@ import com.chint.domain.repository.UserRepository; import com.chint.infrastructure.util.BaseContext; import com.chint.infrastructure.util.Result; import com.chint.interfaces.rest.user.PushUser; +import com.chint.interfaces.rest.user.UserHttpRequest; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -26,6 +27,9 @@ public class UserController { @Autowired private UserRepository userRepository; + @Autowired + private UserHttpRequest userHttpRequest; + @ApiOperation("根据Id查询用户信息") @PostMapping("/query") public Result getUserByEmployeeNo() { @@ -46,6 +50,10 @@ public class UserController { @GetMapping("/public/query/dept/{employeeNo}") public Result> getUserDeptInfoByEmployeeNo(@PathVariable String employeeNo) { User byUserEmployeeNo = userRepository.findByUserEmployeeNo(employeeNo); - return Result.Success(SUCCESS, byUserEmployeeNo.getUserDepartmentInfoList()); + List userDepartmentInfoList = byUserEmployeeNo.getUserDepartmentInfoList(); + if (userDepartmentInfoList == null || userDepartmentInfoList.isEmpty()) { + userDepartmentInfoList = userHttpRequest.loadUserDeptInfo(User.withEmployeeNo(employeeNo)).getUserDepartmentInfoList(); + } + return Result.Success(SUCCESS, userDepartmentInfoList); } } 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 82ea5b3c..fd02710d 100644 --- a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java +++ b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java @@ -271,6 +271,10 @@ public class UserHttpRequestImpl implements UserHttpRequest { } } } + if(user.getName() == null || user.getName().isEmpty() || user.getName().isBlank()){ + getDataFromUserSFData(user,userDataDTOList.get(0)); + } + return userRepository.save(user); }