From a9deac566e3cb15bdf556156487085b48d111baf Mon Sep 17 00:00:00 2001 From: liuxinxin Date: Sat, 11 Feb 2023 14:08:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=98=E5=B7=A5=E5=88=97=E8=A1=A8=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/ding/task/EmployeeBatchGetTask.java | 59 ++++++++++++++++++++++ .../controller/CompanyFiscalCodeController.java | 6 +-- .../controller/DingOrganizationController.java | 2 +- 3 files changed, 61 insertions(+), 6 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java index f7cc263..279b65f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java @@ -1,9 +1,20 @@ package com.ningdatech.pmapi.ding.task; +import cn.hutool.core.collection.CollUtil; +import com.ningdatech.basic.model.GenericResult; +import com.ningdatech.pmapi.common.config.GovDingProperties; +import com.ningdatech.pmapi.organization.entity.DingOrganization; +import com.ningdatech.pmapi.organization.service.IDingOrganizationService; import com.ningdatech.zwdd.client.ZwddClient; +import com.ningdatech.zwdd.model.Page; +import com.ningdatech.zwdd.model.query.PageOrganizationEmployeePositionsQuery; +import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; +import java.util.List; + /** * @author liuxinxin * @date 2023/2/10 上午9:52 @@ -11,11 +22,59 @@ import org.springframework.transaction.annotation.Transactional; public class EmployeeBatchGetTask { + private final static Integer PAGE_SIZE = 20; + @Autowired private ZwddClient zwddClient; + private IDingOrganizationService iDingOrganizationService; @Transactional(rollbackFor = Exception.class) public void batchGetEmployeeTask() { + List dingOrganizationList = iDingOrganizationService.list(); + if (CollUtil.isNotEmpty(dingOrganizationList)) { + List allOrganizationEmployeePositionList = new ArrayList<>(); + + for (DingOrganization dingOrganization : dingOrganizationList) { + String organizationCode = dingOrganization.getOrganizationCode(); + PageOrganizationEmployeePositionsQuery query = new PageOrganizationEmployeePositionsQuery(); + query.setEmployeeStatus("A"); + query.setOrganizationCode(organizationCode); + query.setReturnTotalSize(true); + query.setTenantId(GovDingProperties.tenantId); + + int pageNo = 1; + query.setPageNo(pageNo); + query.setPageSize(PAGE_SIZE); + + GenericResult> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); + Page data = firstPageGenericResult.getData(); + + if (CollUtil.isNotEmpty(data.getData())) { + allOrganizationEmployeePositionList.addAll(data.getData()); + } + + Long totalSize = data.getTotalSize(); + if (totalSize > PAGE_SIZE) { + int maxPageNo = (int) Math.ceil(totalSize / PAGE_SIZE); + for (pageNo = 2; pageNo <= maxPageNo; pageNo++) { + query.setPageNo(maxPageNo); + GenericResult> pageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); + + if (CollUtil.isNotEmpty(pageGenericResult.getData().getData())) { + allOrganizationEmployeePositionList.addAll(pageGenericResult.getData().getData()); + + } + } + } else { + + } + + } + +// zwddClient.pageOrganizationEmployeePositions(query); + + } + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/controller/CompanyFiscalCodeController.java b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/controller/CompanyFiscalCodeController.java index aa7dde5..3d2f987 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/controller/CompanyFiscalCodeController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/controller/CompanyFiscalCodeController.java @@ -6,7 +6,6 @@ import com.ningdatech.pmapi.fiscal.model.po.ReqCompanyFiscalCodeAndSealSnPO; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -29,13 +28,10 @@ public class CompanyFiscalCodeController { private final CompanyFiscalCodeManage companyFiscalCodeManage; @ApiOperation(value = "财政编码/配置", notes = "财政编码配置") - @PostMapping("/configure") + @PostMapping("/fiscal-and-seal/configure") public void fiscalAndSealCodeConfigure(@Valid @RequestBody ReqCompanyFiscalCodeAndSealSnPO reqCompanyFiscalCodeAndSealSnPO) { companyFiscalCodeManage.fiscalCodeConfigure(reqCompanyFiscalCodeAndSealSnPO); } - - - } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java index c86682d..12973e6 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java @@ -14,7 +14,7 @@ import org.springframework.stereotype.Controller; * @since 2023-02-09 */ @Controller -@RequestMapping("/pmapi.organization/ding-organization") +@RequestMapping("/api/v1/organization") public class DingOrganizationController { }