class GetDepartmentRequest extends ApiRequest<Flux<CorpDepartment>> {

    private final String departmentId;

    private final boolean fetchChild;

    public GetDepartmentRequest() {
        this(null, true);
    }

    public GetDepartmentRequest(boolean fetchChild) {
        this(null, fetchChild);
    }

    @Override
    public Flux<CorpDepartment> execute(WebClient client) {
        return this
            .doRequest(departmentId, client)
            .flatMapIterable(Response::getResult);
    }

    private Flux<Response> doRequest(String departmentId, WebClient client) {<FILL_FUNCTION_BODY>}

    @Getter
    @Setter
    public static class Response extends ApiResponse {

        @JsonProperty
        @JsonAlias("result")
        private List<CorpDepartment> result;

        public List<CorpDepartment> getResult() {
            return result == null ? Collections.emptyList() : result;
        }
    }
}

        return client
            .post()
            .uri("/topapi/v2/department/listsub")
            .contentType(MediaType.APPLICATION_FORM_URLENCODED)
            .body(StringUtils.hasText(departmentId)
                      ? BodyInserters.fromFormData("dept_id", departmentId)
                      : BodyInserters.empty())
            .retrieve()
            .bodyToMono(Response.class)
            .flatMapMany(response -> {
                response.assertSuccess();
                //获取下级部门
                if (fetchChild && CollectionUtils.isNotEmpty(response.getResult())) {
                    return Flux
                        .concat(Mono.just(response),
                                Flux.fromIterable(response.getResult())
                                    .filter(dep -> StringUtils.hasText(dep.getId()))
                                    .flatMap(dep -> doRequest(dep.getId(), client)));
                }
                return Mono.just(response);
            })
            ;
    
<methods>public non-sealed void <init>() ,public abstract Flux<org.jetlinks.community.notify.dingtalk.corp.CorpDepartment> execute(org.springframework.web.reactive.function.client.WebClient) <variables>