属性字段初始化

This commit is contained in:
zhaokaiyao@91isoft.com
2021-09-10 17:40:29 +08:00
parent 61be8c0aaa
commit fe072412d9
@@ -10,6 +10,7 @@ import com.adc.da.slrs.sarBussionessStand.service.ISarBussionessStandService;
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
import com.adc.da.util.UUIDUtils;
import com.adc.da.utils.util.InitStandAttrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.gson.Gson;
@@ -274,6 +275,14 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
public List<ImportDto> storageExclData(Map<String, List<ImportDto>> importListMap) {
error = importListMap.get("error");
/**
* 初始化国内外标准属性字段
*/
List<String> listStandField = InitStandAttrUtil.queryFieldList;
Map<String,String> standAttrMap = new TreeMap<>();
listStandField.forEach(item ->{
standAttrMap.put(item,"");
});
/**
* 海外标准
@@ -282,12 +291,11 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
String standID = UUIDUtils.randomUUID20();
SarStandardsInfo ForeignEO = parseImportDtoToStandardsInfo(item, standID);
//
//
//使用初始化的属性字段映射 获得key值,value为""
Map<String, String> mapFilter = standAttrMap;
SarStandardsInfo ForeignEO = parseImportDtoToStandardsInfo(item,mapFilter, standID);
if (ForeignEO != null) {
ForeignEO.setValidFlag("0");
ForeignEO.setStandType("FOREIGN");
QueryWrapper<SarStandardsInfo> standSaveWrapper = new QueryWrapper<>();
@@ -335,10 +343,12 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
/**
* 国内标准
*/
importListMap.get("GNBZ").forEach(item -> {
String standID = UUIDUtils.randomUUID20();
SarStandardsInfo InlandEO = parseImportDtoToStandardsInfo(item, standID);
//使用初始化的属性字段映射 获得key值,value为""
Map<String, String> mapStandFiled = standAttrMap;
SarStandardsInfo InlandEO = parseImportDtoToStandardsInfo(item, mapStandFiled,standID);
if (InlandEO != null) {
@@ -392,10 +402,18 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
/**
* 企业标准
*/
/**
* 初始化企业标准属性字段
*/
List<String> listStandBussField = InitStandAttrUtil.queryFieldListBuss;
Map<String,String> bussAttrMap = new TreeMap<>();
listStandBussField.forEach(item->{
bussAttrMap.put(item,"");
});
importListMap.get("QYBZ").forEach(item -> {
String standId = UUIDUtils.randomUUID20();
SarBussionessStand BussEO = parseImportDtoToSarBussionessStand(item, standId);
SarBussionessStand BussEO = parseImportDtoToSarBussionessStand(item, bussAttrMap,standId);
if (BussEO != null) {
@@ -432,10 +450,11 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
/**
* 整理为标准信息实体
* @param importDto
* @param filedMap 属性字段
* @param standId
* @return
*/
public SarStandardsInfo parseImportDtoToStandardsInfo(ImportDto importDto, String standId) {
public SarStandardsInfo parseImportDtoToStandardsInfo(ImportDto importDto,Map<String,String> filedMap, String standId) {
HashMap<String, String> analysis = analysisStandId(importDto);
@@ -468,10 +487,9 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
/**
* 标准属性字段
*/
HashMap<String, String> attrInfoMap = new HashMap<>();
attrInfoMap.put("new","构建映射");
attrInfoMap.put("DTBJH", importDto.getReplaceId());
attrInfoMap.put("SSRQ", importDto.getImplementedTime().substring(0, 19));
filedMap.put("DTBJH", importDto.getReplaceId());
filedMap.put("SSRQ", importDto.getImplementedTime().substring(0, 19));
/**
@@ -494,9 +512,9 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
AttFileVo fileInfo = attFileEOService.saveFileInfo(file);
if (importDto.getImplementedTime() != null) {
attrInfoMap.put("FBGJBD", fileInfo.getAttId());
filedMap.put("FBGJBD", fileInfo.getAttId());
} else {
attrInfoMap.put("GLWJ", fileInfo.getAttId());
filedMap.put("GLWJ", fileInfo.getAttId());
}
} else {
@@ -513,7 +531,7 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
}
// attrInfoMap.put("")
Gson gson = new Gson();
String attrInfoJson = gson.toJson(attrInfoMap);
String attrInfoJson = gson.toJson(filedMap);
sarStandardsInfoEO.setSarStandAttrEOStr(attrInfoJson);//新增修改时属性表信息
@@ -528,7 +546,7 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
* @param standId
* @return
*/
public SarBussionessStand parseImportDtoToSarBussionessStand(ImportDto importDto, String standId) {
public SarBussionessStand parseImportDtoToSarBussionessStand(ImportDto importDto,Map<String,String> mapFiled, String standId) {
HashMap<String, String> analysis = analysisStandId(importDto);
@@ -554,8 +572,7 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
* 企业标准属性字段
*/
HashMap<String, String> attrInfoMap = new HashMap<>();
attrInfoMap.put("new","构建映射");
if (importDto.getPath() != null) {
String path[] = importDto.getPath().split("/");
String realPath = "";
@@ -575,10 +592,10 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
if (importDto.getImplementedTime()!=null && importDto.getImplementedTime()!=""){
attrInfoMap.put("FBGBUSS",fileInfo.getAttId());
mapFiled.put("FBGBUSS",fileInfo.getAttId());
}else {
attrInfoMap.put("GLWJBUSS",fileInfo.getAttId());
mapFiled.put("GLWJBUSS",fileInfo.getAttId());
}
@@ -597,7 +614,7 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
}
String attrInfoJson = new Gson().toJson(attrInfoMap);
String attrInfoJson = new Gson().toJson(mapFiled);
sarBussionessStand.setSarStandAttrEOStr(attrInfoJson);//新增修改时属性表信息
return sarBussionessStand;
}