diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/service/ICompanyFiscalCodeService.java b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/service/ICompanyFiscalCodeService.java
index 80741af..02690f7 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/service/ICompanyFiscalCodeService.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/service/ICompanyFiscalCodeService.java
@@ -3,6 +3,9 @@ package com.ningdatech.pmapi.fiscal.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.pmapi.fiscal.entity.CompanyFiscalCode;
+import java.util.List;
+import java.util.Map;
+
/**
*
* 服务类
@@ -14,4 +17,12 @@ import com.ningdatech.pmapi.fiscal.entity.CompanyFiscalCode;
public interface ICompanyFiscalCodeService extends IService {
CompanyFiscalCode getByOrganizationCode(String orgCode);
+
+ /**
+ * 获取 key orgCode fiscalCode
+ *
+ * @param orgCodeList
+ * @return
+ */
+ Map getByOrgFiscalCodeMap(List orgCodeList);
}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/service/impl/CompanyFiscalCodeServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/service/impl/CompanyFiscalCodeServiceImpl.java
index dcef437..26315f4 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/service/impl/CompanyFiscalCodeServiceImpl.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/service/impl/CompanyFiscalCodeServiceImpl.java
@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.fiscal.service.impl;
+import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -8,6 +9,11 @@ import com.ningdatech.pmapi.fiscal.mapper.NdCompanyFiscalCodeMapper;
import com.ningdatech.pmapi.fiscal.service.ICompanyFiscalCodeService;
import org.springframework.stereotype.Service;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
/**
*
* 服务实现类
@@ -30,4 +36,17 @@ public class CompanyFiscalCodeServiceImpl extends ServiceImpl getByOrgFiscalCodeMap(List orgCodeList) {
+ if (CollUtil.isNotEmpty(orgCodeList)) {
+ return new HashMap();
+ }
+ List companyFiscalCodeList = this.list(Wrappers.lambdaQuery(CompanyFiscalCode.class)
+ .in(CompanyFiscalCode::getOrganizationCode, orgCodeList));
+
+ Map orgCodeAndFiscalCodeMap = companyFiscalCodeList.stream()
+ .collect(Collectors.toMap(CompanyFiscalCode::getOrganizationCode, CompanyFiscalCode::getFiscalCode));
+ return orgCodeAndFiscalCodeMap;
+ }
}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/basic/AbstractDictionaryCache.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/basic/AbstractDictionaryCache.java
index e1175b6..77bb4a5 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/basic/AbstractDictionaryCache.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/basic/AbstractDictionaryCache.java
@@ -2,10 +2,10 @@ package com.ningdatech.pmapi.meta.helper.basic;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.LoadingCache;
-import com.ningdatech.pmapi.meta.service.IMetaDictionaryService;
import com.ningdatech.pmapi.meta.constant.DictAllTypeEnum;
import com.ningdatech.pmapi.meta.helper.DictionaryCache;
import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO;
+import com.ningdatech.pmapi.meta.service.IMetaDictionaryService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java
index 4e2083b..067983b 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java
@@ -7,7 +7,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.common.config.DingOrganizationProperties;
+import com.ningdatech.pmapi.common.helper.RegionCacheHelper;
import com.ningdatech.pmapi.common.util.StrUtils;
+import com.ningdatech.pmapi.fiscal.service.ICompanyFiscalCodeService;
import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo;
import com.ningdatech.pmapi.organization.model.entity.DingOrganization;
import com.ningdatech.pmapi.organization.model.po.ReqOrganizationListPO;
@@ -17,6 +19,7 @@ import com.ningdatech.pmapi.organization.model.vo.OrganizationTreeVO;
import com.ningdatech.pmapi.organization.model.vo.ResOrganizationListVO;
import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService;
import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
+import com.ningdatech.pmapi.sys.model.dto.RegionDTO;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;
@@ -24,6 +27,7 @@ import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
+import java.util.Map;
import java.util.stream.Collectors;
/**
@@ -40,24 +44,43 @@ public class OrganizationManage {
private final IDingEmployeeInfoService iDingEmployeeInfoService;
+ private final RegionCacheHelper regionCacheHelper;
+
+ private final ICompanyFiscalCodeService iCompanyFiscalCodeService;
+
public PageVo organizationList(ReqOrganizationListPO reqOrganizationListPO) {
String orgName = reqOrganizationListPO.getOrgName();
+ String regionId = reqOrganizationListPO.getRegionId();
Page page = iDingOrganizationService
.page(new Page<>(reqOrganizationListPO.getPageNumber(), reqOrganizationListPO.getPageSize())
, Wrappers.lambdaQuery(DingOrganization.class)
- .like(StringUtils.isNotBlank(orgName), DingOrganization::getOrganizationName, orgName));
+ .like(StringUtils.isNotBlank(orgName), DingOrganization::getOrganizationName, orgName)
+ .eq(StringUtils.isNotBlank(regionId), DingOrganization::getDivisionCode, regionId)
+ .orderByAsc(DingOrganization::getId)
+
+ );
long total = page.getTotal();
List records = page.getRecords();
-
List resVOList = new ArrayList<>();
if (CollUtil.isNotEmpty(records)) {
+ List organizationCodeList = records.stream().map(DingOrganization::getOrganizationCode)
+ .distinct().collect(Collectors.toList());
+ Map orgFiscalCodeMap = iCompanyFiscalCodeService.getByOrgFiscalCodeMap(organizationCodeList);
+
resVOList = records.stream().map(r -> {
ResOrganizationListVO resOrganizationListVO = new ResOrganizationListVO();
resOrganizationListVO.setOrgCode(r.getOrganizationCode());
resOrganizationListVO.setOrgName(r.getOrganizationName());
- // TODO 补充其他字段
+ String divisionCode = r.getDivisionCode();
+ if (StringUtils.isNotBlank(divisionCode)) {
+ RegionDTO regionDTO = regionCacheHelper.getByCodeAndLevel(divisionCode, 3);
+ resOrganizationListVO.setRegionId(regionDTO.getRegionCode());
+ resOrganizationListVO.setRegionName(regionDTO.getRegionName());
+ }
+ String fiscalCode = orgFiscalCodeMap.get(r.getOrganizationCode());
+ resOrganizationListVO.setFiscalCode(fiscalCode);
return resOrganizationListVO;
}).collect(Collectors.toList());
}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java
index 189929d..7bd77fe 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java
@@ -21,4 +21,7 @@ public class ReqSynthesizePO {
@ApiModelProperty("单位名称")
private String organizationName;
+
+ @ApiModelProperty("筛选人员姓名")
+ private String employeeName;
}