Browse Source

单位列表fix

master
niohe·erbao 1 year ago
parent
commit
35852157c2
7 changed files with 89 additions and 6 deletions
  1. +61
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/ding/task/GovBusinessStripsTask.java
  2. +4
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java
  3. +7
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java
  4. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/DingOrganization.java
  5. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqOrganizationListPO.java
  6. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java
  7. +10
    -1
      pmapi/src/test/java/com/ningdatech/pmapi/organization/OrganizationTest.java

+ 61
- 0
pmapi/src/main/java/com/ningdatech/pmapi/ding/task/GovBusinessStripsTask.java View File

@@ -1,11 +1,20 @@
package com.ningdatech.pmapi.ding.task;

import cn.hutool.core.collection.CollectionUtil;
import com.ningdatech.basic.model.GenericResult;
import com.ningdatech.pmapi.organization.entity.GovBusinessStrip;
import com.ningdatech.pmapi.organization.service.IGovBusinessStripService;
import com.ningdatech.zwdd.client.ZwddClient;
import com.ningdatech.zwdd.model.Page;
import com.ningdatech.zwdd.model.dto.SubGovBusinessStripsDTO;
import com.ningdatech.zwdd.model.query.PageSubGovBusinessStripsQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.stream.Collectors;

/**
* @author liuxinxin
* @date 2023/3/8 下午2:55
@@ -21,11 +30,63 @@ public class GovBusinessStripsTask {
@Autowired
private ZwddClient zwddClient;

@Autowired
private IGovBusinessStripService iGovBusinessStripService;

@Transactional(rollbackFor = Exception.class)
public void batchGetGovBusinessStripsTask() {
PageSubGovBusinessStripsQuery pageSubGovBusinessStripsQuery = new PageSubGovBusinessStripsQuery();
pageSubGovBusinessStripsQuery.setPageNo(1);
pageSubGovBusinessStripsQuery.setPageSize(100);
GenericResult<Page<SubGovBusinessStripsDTO>> pageGenericResult = zwddClient.pageSubGovBusinessStrips(pageSubGovBusinessStripsQuery);
Page<SubGovBusinessStripsDTO> data = pageGenericResult.getData();
List<SubGovBusinessStripsDTO> govBusinessStripsDTOList = data.getData();

List<GovBusinessStrip> govBusinessStripList = govBusinessStripsDTOList.stream().map(r -> {
GovBusinessStrip govBusinessStrip = new GovBusinessStrip();
govBusinessStrip.setBusinessStripCode(r.getCode());
govBusinessStrip.setBusinessStripName(r.getName());
return govBusinessStrip;
}).collect(Collectors.toList());

saveBatch(govBusinessStripList);

for (SubGovBusinessStripsDTO subGovBusinessStripsDTO : govBusinessStripsDTOList) {
saveSub(subGovBusinessStripsDTO);
}

}


public void saveSub(SubGovBusinessStripsDTO parentGovBusinessStripsDTO) {
String parentCode = parentGovBusinessStripsDTO.getCode();
String parentName = parentGovBusinessStripsDTO.getName();

PageSubGovBusinessStripsQuery pageSubGovBusinessStripsQuery = new PageSubGovBusinessStripsQuery();
pageSubGovBusinessStripsQuery.setPageNo(1);
pageSubGovBusinessStripsQuery.setPageSize(100);
pageSubGovBusinessStripsQuery.setBusinessStripCode(parentCode);
GenericResult<Page<SubGovBusinessStripsDTO>> pageGenericResult = zwddClient.pageSubGovBusinessStrips(pageSubGovBusinessStripsQuery);
Page<SubGovBusinessStripsDTO> data = pageGenericResult.getData();
List<SubGovBusinessStripsDTO> govBusinessStripsDTOList = data.getData();

if (CollectionUtil.isNotEmpty(govBusinessStripsDTOList)) {
List<GovBusinessStrip> govBusinessStripList = govBusinessStripsDTOList.stream().map(r -> {
GovBusinessStrip govBusinessStrip = new GovBusinessStrip();
govBusinessStrip.setBusinessStripCode(r.getCode());
govBusinessStrip.setBusinessStripName(r.getName());
govBusinessStrip.setParentCode(parentCode);
govBusinessStrip.setParentName(parentName);
return govBusinessStrip;
}).collect(Collectors.toList());
saveBatch(govBusinessStripList);
}
}


public void saveBatch(List<GovBusinessStrip> govBusinessStripList) {
if (CollectionUtil.isNotEmpty(govBusinessStripList)) {
iGovBusinessStripService.saveBatch(govBusinessStripList);
}
}
}

+ 4
- 1
pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java View File

@@ -4,6 +4,7 @@ package com.ningdatech.pmapi.ding.task;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSONObject;
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.ding.model.DingOrgInfoTreeDTO;
@@ -48,7 +49,7 @@ public class OrganizationBatchGetTask {
// List<DingOrganization> allList = iDingOrganizationService.list();
// List<String> currentAllOrganizationCodeList = allList.stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toList());
// 全量删除
// iDingOrganizationService.remove(Wrappers.lambdaQuery(DingOrganization.class).isNotNull(DingOrganization::getId));
iDingOrganizationService.remove(Wrappers.lambdaQuery(DingOrganization.class).isNotNull(DingOrganization::getId));
// 获取顶级组织code
GenericResult<DingScopesV2DTO> scopesV2Result = zwddClient.getScopesV2();
DingScopesV2DTO scopesV2 = scopesV2Result.getData();
@@ -109,6 +110,8 @@ public class OrganizationBatchGetTask {
saveRecord.setDisplayOrder(dingOrgInfoDTO.getDisplayOrder());
// saveRecord.setEnabled("1");
saveRecord.setParentCode(dingOrgInfoDTO.getParentCode());
saveRecord.setTypeCode(dingOrgInfoDTO.getTypeCode());
saveRecord.setTypeName(dingOrgInfoDTO.getTypeName());
saveRecord.setOrganizationCode(dingOrgInfoDTO.getOrganizationCode());
// saveRecord.setSubCount((long) dingOrgInfoTreeDTO.getChildCodes().size());
saveRecord.setOrganizationName(dingOrgInfoDTO.getOrganizationName());


+ 7
- 3
pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java View File

@@ -50,6 +50,7 @@ public class OrganizationManage {

public PageVo<ResOrganizationListVO> organizationList(ReqOrganizationListPO reqOrganizationListPO) {
String orgName = reqOrganizationListPO.getOrgName();
Boolean onlyUnit = reqOrganizationListPO.getOnlyUnit();
String regionId = reqOrganizationListPO.getRegionId();

Page<DingOrganization> page = iDingOrganizationService
@@ -57,8 +58,8 @@ public class OrganizationManage {
, Wrappers.lambdaQuery(DingOrganization.class)
.like(StringUtils.isNotBlank(orgName), DingOrganization::getOrganizationName, orgName)
.eq(StringUtils.isNotBlank(regionId), DingOrganization::getDivisionCode, regionId)
.notIn(onlyUnit, DingOrganization::getTypeCode, "GOV_INTERNAL_INSTITUTION")
.orderByAsc(DingOrganization::getId)

);

long total = page.getTotal();
@@ -134,6 +135,7 @@ public class OrganizationManage {
String organizationCode = request.getOrganizationCode();
String organizationName = request.getOrganizationName();
String employeeName = request.getEmployeeName();
Boolean onlyUnit = request.getOnlyUnit();

// 用户搜索为特殊逻辑
if (StringUtils.isNotBlank(employeeName)) {
@@ -144,7 +146,8 @@ public class OrganizationManage {
List<String> organizationCodeList = new ArrayList<>();
if (StringUtils.isNotBlank(organizationName)) {
dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class)
.like(DingOrganization::getOrganizationName, organizationName));
.like(DingOrganization::getOrganizationName, organizationName)
.notIn(onlyUnit, DingOrganization::getTypeCode, "GOV_INTERNAL_INSTITUTION"));
if (dingOrganizationList.size() == 0) {
return new ArrayList<>();
}
@@ -156,7 +159,8 @@ public class OrganizationManage {

if (CollectionUtil.isEmpty(dingOrganizationList)) {
dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class)
.in(DingOrganization::getOrganizationCode, organizationCodeList));
.in(DingOrganization::getOrganizationCode, organizationCodeList)
.notIn(onlyUnit, DingOrganization::getTypeCode, "GOV_INTERNAL_INSTITUTION"));
}

List<KeyTreeVO> orgKeyTreeVOList = dingOrganizationList.stream().map(r -> {


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/DingOrganization.java View File

@@ -32,7 +32,7 @@ public class DingOrganization implements Serializable {

private Long displayOrder;

private Long typeName;
private String typeName;

private Integer leaf;



+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqOrganizationListPO.java View File

@@ -28,4 +28,7 @@ public class ReqOrganizationListPO extends PagePo {
@ApiModelProperty("是否为上级条线主管单位")
private Boolean isSuperiorLineCompetentUnit;

@ApiModelProperty("是否只筛选单位")
private Boolean onlyUnit = false;

}

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java View File

@@ -24,4 +24,7 @@ public class ReqSynthesizePO {

@ApiModelProperty("筛选人员姓名")
private String employeeName;

@ApiModelProperty("是否只筛选单位")
private Boolean onlyUnit = false;
}

+ 10
- 1
pmapi/src/test/java/com/ningdatech/pmapi/organization/OrganizationTest.java View File

@@ -2,6 +2,7 @@ package com.ningdatech.pmapi.organization;

import com.ningdatech.pmapi.AppTests;
import com.ningdatech.pmapi.ding.task.EmployeeBatchGetTask;
import com.ningdatech.pmapi.ding.task.GovBusinessStripsTask;
import com.ningdatech.pmapi.ding.task.OrganizationBatchGetTask;
import com.ningdatech.zwdd.client.ZwddAuthClient;
import com.ningdatech.zwdd.client.ZwddClient;
@@ -27,14 +28,22 @@ class OrganizationTest extends AppTests {
@Autowired
private EmployeeBatchGetTask employeeBatchGetTask;

@Autowired
private GovBusinessStripsTask govBusinessStripsTask;

@Test
public void testBatchGetOrganization() {
organizationBatchGetTask.batchGetOrganizationTask();
}

@Test
public void testEmployeeBatchGetTask(){
public void testEmployeeBatchGetTask() {
employeeBatchGetTask.batchGetEmployeeTask();
}

@Test
public void testGovBusinessStripsTask() {
govBusinessStripsTask.batchGetGovBusinessStripsTask();
}

}

Loading…
Cancel
Save