From 6129b2f446ed6d9d5443eef861542fde793e56b0 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Wed, 6 Sep 2023 11:56:33 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/ding/task/OrganizationBatchGetTask.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java index 5b1ddb3..2e5979d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java @@ -115,12 +115,14 @@ public class OrganizationBatchGetTask { .eq(DingOrganization::getOrganizationCode, orgCode) .last(BizConst.LIMIT_1)); // 顶级组织code - List topOrgCodes = Lists.newArrayList(orgCode); - GenericResult> listGenericResult = zwddClient.listOrganizationsByCodes(topOrgCodes); - log.info("listGenericResult: {}" + JSON.toJSONString(listGenericResult)); - List dingOrgInfoDtos = listGenericResult.getData(); - - for(DingOrgInfoDTO dingOrgInfo : dingOrgInfoDtos){ + GenericResult subOrganizationResult = zwddClient.pageSubOrganizationCodes(1, 10000, orgCode); + log.info("subOrganizationResult: {}" + JSON.toJSONString(subOrganizationResult)); + PageSubOrganizationCodeDTO data = subOrganizationResult.getData(); + List subOrganizationCodeList = data.getSubOrganizationCodeList(); + + for(String subOrganizationCode : subOrganizationCodeList){ + GenericResult organizationByCode = zwddClient.getOrganizationByCode(subOrganizationCode); + DingOrgInfoDTO dingOrgInfo = organizationByCode.getData(); DingOrganization old = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) .eq(DingOrganization::getOrganizationCode, dingOrgInfo.getOrganizationCode()) .last(BizConst.LIMIT_1)); @@ -142,7 +144,9 @@ public class OrganizationBatchGetTask { organization.setGmtCreate(LocalDateTime.now()); organization.setInstitutionLevelCode(dingOrgInfo.getInstitutionLevelCode()); organization.setParentName(dingOrgInfo.getParentName()); - iDingOrganizationService.save(organization); + if(iDingOrganizationService.save(organization)){ + organizationGetSubs(organization.getOrganizationCode()); + } } log.info("----拉取浙政钉组织子单位结束---,顶级code:" + orgCode);