Sfoglia il codice sorgente

fix 系统管理-单位管理,切换区县,每个区县的单位都相同

master
niohe·erbao 1 anno fa
parent
commit
a43db9b7a8
5 ha cambiato i file con 60 aggiunte e 4 eliminazioni
  1. +11
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/fiscal/service/ICompanyFiscalCodeService.java
  2. +19
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/fiscal/service/impl/CompanyFiscalCodeServiceImpl.java
  3. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/basic/AbstractDictionaryCache.java
  4. +26
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java
  5. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java

+ 11
- 0
pmapi/src/main/java/com/ningdatech/pmapi/fiscal/service/ICompanyFiscalCodeService.java Vedi File

@@ -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;

/**
* <p>
* 服务类
@@ -14,4 +17,12 @@ import com.ningdatech.pmapi.fiscal.entity.CompanyFiscalCode;
public interface ICompanyFiscalCodeService extends IService<CompanyFiscalCode> {

CompanyFiscalCode getByOrganizationCode(String orgCode);

/**
* 获取 key orgCode fiscalCode
*
* @param orgCodeList
* @return
*/
Map<String, String> getByOrgFiscalCodeMap(List<String> orgCodeList);
}

+ 19
- 0
pmapi/src/main/java/com/ningdatech/pmapi/fiscal/service/impl/CompanyFiscalCodeServiceImpl.java Vedi File

@@ -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;

/**
* <p>
* 服务实现类
@@ -30,4 +36,17 @@ public class CompanyFiscalCodeServiceImpl extends ServiceImpl<NdCompanyFiscalCod
.eq(CompanyFiscalCode::getOrganizationCode, orgCode));

}

@Override
public Map<String, String> getByOrgFiscalCodeMap(List<String> orgCodeList) {
if (CollUtil.isNotEmpty(orgCodeList)) {
return new HashMap<String, String>();
}
List<CompanyFiscalCode> companyFiscalCodeList = this.list(Wrappers.lambdaQuery(CompanyFiscalCode.class)
.in(CompanyFiscalCode::getOrganizationCode, orgCodeList));

Map<String, String> orgCodeAndFiscalCodeMap = companyFiscalCodeList.stream()
.collect(Collectors.toMap(CompanyFiscalCode::getOrganizationCode, CompanyFiscalCode::getFiscalCode));
return orgCodeAndFiscalCodeMap;
}
}

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/basic/AbstractDictionaryCache.java Vedi File

@@ -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;



+ 26
- 3
pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java Vedi File

@@ -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<ResOrganizationListVO> organizationList(ReqOrganizationListPO reqOrganizationListPO) {
String orgName = reqOrganizationListPO.getOrgName();
String regionId = reqOrganizationListPO.getRegionId();

Page<DingOrganization> 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<DingOrganization> records = page.getRecords();

List<ResOrganizationListVO> resVOList = new ArrayList<>();
if (CollUtil.isNotEmpty(records)) {
List<String> organizationCodeList = records.stream().map(DingOrganization::getOrganizationCode)
.distinct().collect(Collectors.toList());
Map<String, String> 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());
}


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

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

@ApiModelProperty("单位名称")
private String organizationName;

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

Loading…
Annulla
Salva