Commit 3587066f authored by wei's avatar wei 🎱

属性对应字典名称

parent 982da293
...@@ -319,6 +319,14 @@ public class Constants { ...@@ -319,6 +319,14 @@ public class Constants {
* 项目代号字典type * 项目代号字典type
*/ */
public static final String PROJECT_CODE = "ProjectCode"; public static final String PROJECT_CODE = "ProjectCode";
/**
* 供应商-资质内容
*/
public static final String QUALIFICATIONS_CONTENT = "qualificationsContent";
/**
* 供应商-供方类别
*/
public static final String SUPPLIER_TYPE = "supplierType";
/** /**
* 设计阶段字典type * 设计阶段字典type
*/ */
......
package com.yonde.dcs.plan.core.service.impl; package com.yonde.dcs.plan.core.service.impl;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yonde.dcs.plan.common.constants.Constants;
import com.yonde.dcs.plan.common.vo.ExtQualificationsVO; import com.yonde.dcs.plan.common.vo.ExtQualificationsVO;
import com.yonde.dcs.plan.common.vo.ExtSupplierManageLinkVO; import com.yonde.dcs.plan.common.vo.ExtSupplierManageLinkVO;
import com.yonde.dcs.plan.common.vo.ExtSupplierManageVO; import com.yonde.dcs.plan.common.vo.ExtSupplierManageVO;
...@@ -14,6 +15,8 @@ import com.yonde.dex.basedata.data.search.SearchItems; ...@@ -14,6 +15,8 @@ import com.yonde.dex.basedata.data.search.SearchItems;
import com.yonde.dex.basedata.data.search.SearchQueryCondition; import com.yonde.dex.basedata.data.search.SearchQueryCondition;
import com.yonde.dex.basedata.entity.data.DxPageImpl; import com.yonde.dex.basedata.entity.data.DxPageImpl;
import com.yonde.dex.basedata.exception.DxBusinessException; import com.yonde.dex.basedata.exception.DxBusinessException;
import com.yonde.dex.dict.feign.DictDataFeignService;
import com.yonde.dex.dict.service.vo.DictDataVO;
import com.yonde.dex.wfc.feign.api.WfcProcessFeign; import com.yonde.dex.wfc.feign.api.WfcProcessFeign;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -24,6 +27,9 @@ import java.time.LocalDate; ...@@ -24,6 +27,9 @@ import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.Year; import java.time.Year;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/** /**
* @description: ExtSupplierManage-ServiceImpl * @description: ExtSupplierManage-ServiceImpl
...@@ -45,6 +51,9 @@ public class ExtSupplierManageServiceImpl<V extends ExtSupplierManageVO> impleme ...@@ -45,6 +51,9 @@ public class ExtSupplierManageServiceImpl<V extends ExtSupplierManageVO> impleme
@Autowired @Autowired
private ExtSupplierManageLinkService extSupplierManageLinkService; private ExtSupplierManageLinkService extSupplierManageLinkService;
@Autowired
private DictDataFeignService dictDataService;
@Override @Override
public ExtSupplierManageVO startWorkflow(Long id) { public ExtSupplierManageVO startWorkflow(Long id) {
ExtSupplierManageVO extSupplierManageVO = this.get(id); ExtSupplierManageVO extSupplierManageVO = this.get(id);
...@@ -65,28 +74,40 @@ public class ExtSupplierManageServiceImpl<V extends ExtSupplierManageVO> impleme ...@@ -65,28 +74,40 @@ public class ExtSupplierManageServiceImpl<V extends ExtSupplierManageVO> impleme
LocalDateTime localDateTime = warningDate.atStartOfDay(); LocalDateTime localDateTime = warningDate.atStartOfDay();
DxPageImpl dxPage = this.recursionSupplierManageLinks(searchQueryCondition, localDateTime); DxPageImpl dxPage = this.recursionSupplierManageLinks(searchQueryCondition, localDateTime);
List<ExtSupplierManageLinkVO> content = dxPage.getContent(); List<ExtSupplierManageLinkVO> content = dxPage.getContent();
Map<String, DictDataVO> supplierTypeMap = this.getDictDataVO(Constants.SUPPLIER_TYPE);
Map<String, DictDataVO> qualificationsContentMap = this.getDictDataVO(Constants.QUALIFICATIONS_CONTENT);
for (ExtSupplierManageLinkVO extSupplierManageLinkVO : content) { for (ExtSupplierManageLinkVO extSupplierManageLinkVO : content) {
ExtSupplierManageVO source = extSupplierManageLinkVO.getSource(); ExtSupplierManageVO source = extSupplierManageLinkVO.getSource();
ExtQualificationsVO target = extSupplierManageLinkVO.getTarget(); ExtQualificationsVO target = extSupplierManageLinkVO.getTarget();
list.add(this.buildSupplierEarlyWarningVO(source, target)); list.add(this.buildSupplierEarlyWarningVO(source, target, qualificationsContentMap, supplierTypeMap));
} }
dxPage.setContent(list); dxPage.setContent(list);
return dxPage; return dxPage;
} }
private Map<String, DictDataVO> getDictDataVO(String dictCode) {
List<DictDataVO> dictDatas = dictDataService.getDictDatas(dictCode);
return dictDatas.stream().collect(Collectors.toMap(DictDataVO::getDictKey, Function.identity(), (key1, key2) -> key2));
}
@Override @Override
public List<SupplierEarlyWarningVO> exportEarlyWarningData(SearchQueryCondition searchQueryCondition, int warningDay) { public List<SupplierEarlyWarningVO> exportEarlyWarningData(SearchQueryCondition searchQueryCondition, int warningDay) {
DxPageImpl dxPage = this.earlyWarning(searchQueryCondition, warningDay); DxPageImpl dxPage = this.earlyWarning(searchQueryCondition, warningDay);
return dxPage.getContent(); return dxPage.getContent();
} }
private SupplierEarlyWarningVO buildSupplierEarlyWarningVO(ExtSupplierManageVO source, ExtQualificationsVO target) { private SupplierEarlyWarningVO buildSupplierEarlyWarningVO(ExtSupplierManageVO source, ExtQualificationsVO target,
Map<String, DictDataVO> qualificationsContentMap,
Map<String, DictDataVO> supplierTypeMap) {
SupplierEarlyWarningVO supplierEarlyWarningVO = new SupplierEarlyWarningVO(); SupplierEarlyWarningVO supplierEarlyWarningVO = new SupplierEarlyWarningVO();
BeanUtils.copyProperties(source, supplierEarlyWarningVO); BeanUtils.copyProperties(source, supplierEarlyWarningVO);
supplierEarlyWarningVO.setQualificationsContent(target.getQualificationsContent()); DictDataVO qualificationsContent = qualificationsContentMap.get(target.getQualificationsContent());
DictDataVO supplierType = supplierTypeMap.get(target.getQualificationsContent());
supplierEarlyWarningVO.setId(target.getId());
supplierEarlyWarningVO.setSupplierType(supplierType.getDictValue());
supplierEarlyWarningVO.setQualificationsContent(qualificationsContent.getDictValue());
supplierEarlyWarningVO.setCertificateNumber(target.getCertificateNumber()); supplierEarlyWarningVO.setCertificateNumber(target.getCertificateNumber());
supplierEarlyWarningVO.setCertificateTime(target.getCertificateTime()); supplierEarlyWarningVO.setCertificateTime(target.getCertificateTime());
supplierEarlyWarningVO.setId(target.getId());
return supplierEarlyWarningVO; return supplierEarlyWarningVO;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment