Procházet zdrojové kódy

组织更新

tags/24080901
PoffyZhang před 1 rokem
rodič
revize
909451df65
2 změnil soubory, kde provedl 50 přidání a 0 odebrání
  1. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java
  2. +45
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java

+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java Zobrazit soubor

@@ -84,6 +84,11 @@ public class DingInfoPullController {
organizationBatchGetTask.batchGetOrganizationTask();
}

@GetMapping("/organization/{orgCode}")
public void organizationGetSubs(@PathVariable String orgCode) {
organizationBatchGetTask.organizationGetSubs(orgCode);
}

@GetMapping("/employeeByRegionCode/{regionCode}")
public void employeeBatchGetByRegionCode(@PathVariable String regionCode) {
employeeBatchGetTask.batchGetEmployeeTaskByRegionCode(regionCode);


+ 45
- 0
pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java Zobrazit soubor

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.ningdatech.basic.model.GenericResult;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.ding.model.DingOrgInfoTreeDTO;
import com.ningdatech.pmapi.organization.model.entity.DingOrganization;
import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
@@ -21,6 +22,7 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@@ -103,6 +105,49 @@ public class OrganizationBatchGetTask {
}
}

/**
* 更新 其 子单位
* @param orgCode
*/
public void organizationGetSubs(String orgCode) {
log.info("----拉取浙政钉组织子单位开始---,顶级code:" + orgCode);
DingOrganization topOrg = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class)
.eq(DingOrganization::getOrganizationCode, orgCode)
.last(BizConst.LIMIT_1));
// 顶级组织code
List<String> topOrgCodes = Lists.newArrayList(orgCode);
GenericResult<List<DingOrgInfoDTO>> listGenericResult = zwddClient.listOrganizationsByCodes(topOrgCodes);
log.info("listGenericResult: {}" + JSON.toJSONString(listGenericResult));
List<DingOrgInfoDTO> dingOrgInfoDtos = listGenericResult.getData();

for(DingOrgInfoDTO dingOrgInfo : dingOrgInfoDtos){
DingOrganization old = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class)
.eq(DingOrganization::getOrganizationCode, dingOrgInfo.getOrganizationCode())
.last(BizConst.LIMIT_1));
if(Objects.nonNull(old)){
log.info("该单位已经存在 :{}",old.getOrganizationName());
continue;
}

DingOrganization organization = new DingOrganization();
organization.setOrganizationCode(dingOrgInfo.getOrganizationCode());
organization.setOrganizationName(dingOrgInfo.getOrganizationName());
//和顶级单位一个区域
organization.setDivisionCode(topOrg.getDivisionCode());
organization.setParentCode(dingOrgInfo.getParentCode());
organization.setTypeName(dingOrgInfo.getTypeName());
organization.setAddress(dingOrgInfo.getAddress());
organization.setBusinessStripCodes(dingOrgInfo.getBusinessStripCodes());
organization.setDisplayOrder(dingOrgInfo.getDisplayOrder());
organization.setGmtCreate(LocalDateTime.now());
organization.setInstitutionLevelCode(dingOrgInfo.getInstitutionLevelCode());
organization.setParentName(dingOrgInfo.getParentName());
iDingOrganizationService.save(organization);
}

log.info("----拉取浙政钉组织子单位结束---,顶级code:" + orgCode);
}

private void buildSaveRecordList(List<DingOrgInfoTreeDTO> treeDTOList, List<DingOrganization> saveRecordList) {
if (CollectionUtils.isEmpty(treeDTOList)) {
return;


Načítá se…
Zrušit
Uložit