TC数据全部替换为数据库数据
This commit is contained in:
parent
ea263b7681
commit
1ae1dd83f0
@ -92,7 +92,6 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
|||||||
DataEntryEngineModelPojo dataEntryEngineModelPojo = engineModelService.selectBymodelId(engineModelID);
|
DataEntryEngineModelPojo dataEntryEngineModelPojo = engineModelService.selectBymodelId(engineModelID);
|
||||||
//查到所有TC表的参数 返回零部件,参数列表
|
//查到所有TC表的参数 返回零部件,参数列表
|
||||||
for (String subsystemType : subsystemTypes) {
|
for (String subsystemType : subsystemTypes) {
|
||||||
HashMap<String, List<ClassificationAttributePojo>> stringListHashMap = new HashMap<>();
|
|
||||||
if (subsystemType.split("-").length != 2) {
|
if (subsystemType.split("-").length != 2) {
|
||||||
throw new CommonException("查询条件异常,需子系统-零部件名称,若零部件为空则传入“/”");
|
throw new CommonException("查询条件异常,需子系统-零部件名称,若零部件为空则传入“/”");
|
||||||
}
|
}
|
||||||
@ -113,46 +112,28 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
|||||||
allPojos.addAll(pojoList);
|
allPojos.addAll(pojoList);
|
||||||
}
|
}
|
||||||
|
|
||||||
//开始查找TC数据
|
//使用selectTCFromDB查询TC数据
|
||||||
List<EnginePartsCollectionPojo> lbjmcs = bd.getTCDatabase()
|
List<String> tcSubsystemParts = new ArrayList<>();
|
||||||
.eq("ztj", dataEntryEngineModelPojo.getProductNumber())
|
tcSubsystemParts.add(subsystem + "-" + partsName);
|
||||||
.eq("lbjmc", partsName)
|
List<EngineParamDetailPojo> tcPojos = selectTCFromDB(engineModelID, tcSubsystemParts);
|
||||||
.doQuery(EnginePartsCollectionPojo.class);
|
|
||||||
if (ObjectUtils.isEmpty(lbjmcs)) {
|
//处理TC数据,转换为EngineParamDetailPojo
|
||||||
log.error("根据零部件未找到状态机图号列表");
|
for (EngineParamDetailPojo tcPojo : tcPojos) {
|
||||||
}
|
String paramName = tcPojo.getParameterName();
|
||||||
List<ClassificationAttributePojo> listl = new ArrayList<>();
|
String paramValue = tcPojo.getParameterValue();
|
||||||
for (EnginePartsCollectionPojo lbjmc : lbjmcs) {
|
List<EngineParamDetailPojo> matchedPojos = parameters.stream()
|
||||||
//获取图号
|
.filter(x -> (x.getPartsName() + "&&" + x.getParameterName()).equals(partsName + "&&" + paramName))
|
||||||
String lbjth = lbjmc.getLbjth();
|
|
||||||
if (ObjectUtils.isEmpty(lbjth)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
listl.addAll(bd.getTCDatabase()
|
|
||||||
.eq("pitemId", lbjth)
|
|
||||||
.doQuery(ClassificationAttributePojo.class));
|
|
||||||
}
|
|
||||||
stringListHashMap.put(partsName, listl);
|
|
||||||
for (Map.Entry<String, List<ClassificationAttributePojo>> stringListEntry : stringListHashMap.entrySet()) {
|
|
||||||
String key = stringListEntry.getKey();//零部件
|
|
||||||
List<ClassificationAttributePojo> list = stringListEntry.getValue();//零部件里的值
|
|
||||||
for (ClassificationAttributePojo classificationAttribute : list) {
|
|
||||||
String idattrtbutehame = classificationAttribute.getIdattrtbutehame();
|
|
||||||
String fieldvalue = classificationAttribute.getFieldvalue();
|
|
||||||
List<EngineParamDetailPojo> pojos = parameters.stream()
|
|
||||||
.filter(x -> (x.getPartsName() + "&&" + x.getParameterName()).equals(key + "&&" + idattrtbutehame))
|
|
||||||
.map(x -> {
|
.map(x -> {
|
||||||
EngineParamDetailPojo engineParamDetailPojo = new EngineParamDetailPojo();
|
EngineParamDetailPojo engineParamDetailPojo = new EngineParamDetailPojo();
|
||||||
engineParamDetailPojo.setEngineModelId(dataEntryEngineModelPojo.getId());
|
engineParamDetailPojo.setEngineModelId(dataEntryEngineModelPojo.getId());
|
||||||
engineParamDetailPojo.setPartsName(x.getPartsName());
|
engineParamDetailPojo.setPartsName(x.getPartsName());
|
||||||
engineParamDetailPojo.setSubsystemName(x.getSubsystemName());
|
engineParamDetailPojo.setSubsystemName(x.getSubsystemName());
|
||||||
engineParamDetailPojo.setParameterName(x.getParameterName());
|
engineParamDetailPojo.setParameterName(x.getParameterName());
|
||||||
engineParamDetailPojo.setParameterValue(fieldvalue);
|
engineParamDetailPojo.setParameterValue(paramValue);
|
||||||
return engineParamDetailPojo;
|
return engineParamDetailPojo;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
if (ObjectUtils.isNotEmpty(pojos)) {
|
if (ObjectUtils.isNotEmpty(matchedPojos)) {
|
||||||
allPojos.addAll(pojos);
|
allPojos.addAll(matchedPojos);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,73 +192,25 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
|||||||
|
|
||||||
allPojos.addAll(filteredSystemData);
|
allPojos.addAll(filteredSystemData);
|
||||||
|
|
||||||
//批量查询所有TC数据
|
//使用selectTCFromDB批量查询TC数据
|
||||||
List<String> uniquePartsNames = subsystemPartsPairs.stream()
|
List<EngineParamDetailPojo> tcDataPojos = selectTCFromDB(engineModelID, subsystemTypes);
|
||||||
.map(Map.Entry::getValue)
|
|
||||||
.distinct()
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
List<EnginePartsCollectionPojo> allEngineParts = bd.getTCDatabase()
|
//处理TC数据,转换为EngineParamDetailPojo
|
||||||
.eq("ztj", dataEntryEngineModelPojo.getProductNumber())
|
List<EngineParamDetailPojo> convertedTcPojos = tcDataPojos.stream()
|
||||||
.in("lbjmc", uniquePartsNames)
|
.filter(tcPojo -> parameterMap.containsKey(tcPojo.getPartsName() + "&&" + tcPojo.getParameterName()))
|
||||||
.doQuery(EnginePartsCollectionPojo.class);
|
.map(tcPojo -> {
|
||||||
|
ParameterPojo param = parameterMap.get(tcPojo.getPartsName() + "&&" + tcPojo.getParameterName()).get(0);
|
||||||
// 按零部件名称分组
|
|
||||||
Map<String, List<EnginePartsCollectionPojo>> partsMap = allEngineParts.stream()
|
|
||||||
.collect(Collectors.groupingBy(EnginePartsCollectionPojo::getLbjmc));
|
|
||||||
|
|
||||||
//批量查询所有图号对应的分类属性
|
|
||||||
List<String> allLbjths = allEngineParts.stream()
|
|
||||||
.map(EnginePartsCollectionPojo::getLbjth)
|
|
||||||
.filter(ObjectUtils::isNotEmpty)
|
|
||||||
.distinct()
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
Map<String, List<ClassificationAttributePojo>> classificationMap = new HashMap<>();
|
|
||||||
if (!allLbjths.isEmpty()) {
|
|
||||||
List<ClassificationAttributePojo> allClassifications = bd.getTCDatabase()
|
|
||||||
.in("pitemId", allLbjths)
|
|
||||||
.doQuery(ClassificationAttributePojo.class);
|
|
||||||
|
|
||||||
// 按图号分组
|
|
||||||
classificationMap = allClassifications.stream()
|
|
||||||
.collect(Collectors.groupingBy(ClassificationAttributePojo::getPitemId));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理每个子系统-零部件对
|
|
||||||
for (Map.Entry<String, String> pair : subsystemPartsPairs) {
|
|
||||||
|
|
||||||
String partsName = pair.getValue();
|
|
||||||
|
|
||||||
// 获取该零部件的所有图号
|
|
||||||
List<EnginePartsCollectionPojo> partsCollections = partsMap.getOrDefault(partsName, Collections.emptyList());
|
|
||||||
|
|
||||||
// 获取所有分类属性
|
|
||||||
List<ClassificationAttributePojo> allAttributes = new ArrayList<>();
|
|
||||||
for (EnginePartsCollectionPojo parts : partsCollections) {
|
|
||||||
String lbjth = parts.getLbjth();
|
|
||||||
if (ObjectUtils.isNotEmpty(lbjth)) {
|
|
||||||
allAttributes.addAll(classificationMap.getOrDefault(lbjth, Collections.emptyList()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//批量处理分类属性
|
|
||||||
List<EngineParamDetailPojo> tcDataPojos = allAttributes.stream()
|
|
||||||
.filter(attr -> parameterMap.containsKey(partsName + "&&" + attr.getIdattrtbutehame()))
|
|
||||||
.map(attr -> {
|
|
||||||
ParameterPojo param = parameterMap.get(partsName + "&&" + attr.getIdattrtbutehame()).get(0);
|
|
||||||
EngineParamDetailPojo pojo = new EngineParamDetailPojo();
|
EngineParamDetailPojo pojo = new EngineParamDetailPojo();
|
||||||
pojo.setEngineModelId(dataEntryEngineModelPojo.getId());
|
pojo.setEngineModelId(dataEntryEngineModelPojo.getId());
|
||||||
pojo.setPartsName(param.getPartsName());
|
pojo.setPartsName(param.getPartsName());
|
||||||
pojo.setSubsystemName(param.getSubsystemName());
|
pojo.setSubsystemName(param.getSubsystemName());
|
||||||
pojo.setParameterName(param.getParameterName());
|
pojo.setParameterName(param.getParameterName());
|
||||||
pojo.setParameterValue(attr.getFieldvalue());
|
pojo.setParameterValue(tcPojo.getParameterValue());
|
||||||
return pojo;
|
return pojo;
|
||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
allPojos.addAll(tcDataPojos);
|
allPojos.addAll(convertedTcPojos);
|
||||||
}
|
|
||||||
//将allPojos存到Redis,KEY为userID+engineModelID+预操作,过期时间24小时
|
//将allPojos存到Redis,KEY为userID+engineModelID+预操作,过期时间24小时
|
||||||
try {
|
try {
|
||||||
String redisKey = userID + ":" + engineModelID + ":" + "ComparisonExport";
|
String redisKey = userID + ":" + engineModelID + ":" + "ComparisonExport";
|
||||||
@ -304,7 +237,7 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
|||||||
try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).build()) {
|
try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).build()) {
|
||||||
setupResponse(response, "参数值导入模板" + (new Date()));
|
setupResponse(response, "参数值导入模板" + (new Date()));
|
||||||
ArrayList<EnginePartsCollectionPojo> enginePartsCollections = new ArrayList<>();
|
ArrayList<EnginePartsCollectionPojo> enginePartsCollections = new ArrayList<>();
|
||||||
List<EnginePartsCollectionPojo> lbjmcs = bd.getTCDatabase()
|
List<EnginePartsCollectionPojo> lbjmcs = bd.getBusinessDatabase()
|
||||||
.doQuery(EnginePartsCollectionPojo.class);
|
.doQuery(EnginePartsCollectionPojo.class);
|
||||||
for (EnginePartsCollectionPojo parameter : lbjmcs) {
|
for (EnginePartsCollectionPojo parameter : lbjmcs) {
|
||||||
EnginePartsCollectionPojo engineParamDetailExcel = new EnginePartsCollectionPojo();
|
EnginePartsCollectionPojo engineParamDetailExcel = new EnginePartsCollectionPojo();
|
||||||
@ -331,7 +264,7 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
|||||||
public void excelExportB(HttpServletResponse response) {
|
public void excelExportB(HttpServletResponse response) {
|
||||||
try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).build()) {
|
try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).build()) {
|
||||||
ArrayList<ClassificationAttributePojo> enginePartsCollections = new ArrayList<>();
|
ArrayList<ClassificationAttributePojo> enginePartsCollections = new ArrayList<>();
|
||||||
List<ClassificationAttributePojo> lbjmcs = bd.getTCDatabase()
|
List<ClassificationAttributePojo> lbjmcs = bd.getBusinessDatabase()
|
||||||
.doQuery(ClassificationAttributePojo.class);
|
.doQuery(ClassificationAttributePojo.class);
|
||||||
for (ClassificationAttributePojo parameter : lbjmcs) {
|
for (ClassificationAttributePojo parameter : lbjmcs) {
|
||||||
ClassificationAttributePojo engineParamDetailExcel = new ClassificationAttributePojo();
|
ClassificationAttributePojo engineParamDetailExcel = new ClassificationAttributePojo();
|
||||||
@ -460,77 +393,21 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
|||||||
//批量查询所有TC数据
|
//批量查询所有TC数据
|
||||||
Map<String, List<EngineParamDetailPojo>> parameterMapTc = tcPojos.stream()
|
Map<String, List<EngineParamDetailPojo>> parameterMapTc = tcPojos.stream()
|
||||||
.collect(Collectors.groupingBy(p -> p.getPartsName() + "&&" + p.getParameterName()));
|
.collect(Collectors.groupingBy(p -> p.getPartsName() + "&&" + p.getParameterName()));
|
||||||
List<Map.Entry<String, String>> subsystemPartsPairsTc = analysisRequest.getSubsystemParts().stream()
|
|
||||||
.map(subsystemType -> {
|
|
||||||
if (subsystemType.split("-").length != 2) {
|
|
||||||
throw new CommonException("查询条件异常,需子系统-零部件名称,若零部件为空则传入“/ ”");
|
|
||||||
}
|
|
||||||
String subsystem = subsystemType.split("-")[0];
|
|
||||||
String partsName = subsystemType.split("-")[1];
|
|
||||||
return new AbstractMap.SimpleEntry<>(subsystem, partsName);
|
|
||||||
})
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
List<String> uniquePartsNames = subsystemPartsPairsTc.stream()
|
|
||||||
.map(Map.Entry::getValue)
|
|
||||||
.distinct()
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
List<EnginePartsCollectionPojo> allEngineParts = bd.getTCDatabase()
|
//使用selectTCFromDB查询TC数据
|
||||||
.eq("ztj", dataEntryEngineModelPojo.getProductNumber())
|
List<EngineParamDetailPojo> tcDataResults = selectTCFromDB(analysisRequest.getEngineModelID(), analysisRequest.getSubsystemParts());
|
||||||
.in("lbjmc", uniquePartsNames)
|
|
||||||
.doQuery(EnginePartsCollectionPojo.class);
|
|
||||||
|
|
||||||
// 按零部件名称分组
|
//处理TC数据,更新parameterValue
|
||||||
Map<String, List<EnginePartsCollectionPojo>> partsMap = allEngineParts.stream()
|
List<EngineParamDetailPojo> convertedTcPojos = tcDataResults.stream()
|
||||||
.collect(Collectors.groupingBy(EnginePartsCollectionPojo::getLbjmc));
|
.filter(tcPojo -> parameterMapTc.containsKey(tcPojo.getPartsName() + "&&" + tcPojo.getParameterName()))
|
||||||
|
.map(tcPojo -> {
|
||||||
//批量查询所有图号对应的分类属性
|
EngineParamDetailPojo param = parameterMapTc.get(tcPojo.getPartsName() + "&&" + tcPojo.getParameterName()).get(0);
|
||||||
List<String> allLbjths = allEngineParts.stream()
|
param.setParameterValue(tcPojo.getParameterValue());
|
||||||
.map(EnginePartsCollectionPojo::getLbjth)
|
|
||||||
.filter(ObjectUtils::isNotEmpty)
|
|
||||||
.distinct()
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
Map<String, List<ClassificationAttributePojo>> classificationMap = new HashMap<>();
|
|
||||||
if (!allLbjths.isEmpty()) {
|
|
||||||
List<ClassificationAttributePojo> allClassifications = bd.getTCDatabase()
|
|
||||||
.in("pitemId", allLbjths)
|
|
||||||
.doQuery(ClassificationAttributePojo.class);
|
|
||||||
|
|
||||||
// 按图号分组
|
|
||||||
classificationMap = allClassifications.stream()
|
|
||||||
.collect(Collectors.groupingBy(ClassificationAttributePojo::getPitemId));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理每个子系统-零部件对
|
|
||||||
for (Map.Entry<String, String> pair : subsystemPartsPairsTc) {
|
|
||||||
|
|
||||||
String partsName = pair.getValue();
|
|
||||||
|
|
||||||
// 获取该零部件的所有图号
|
|
||||||
List<EnginePartsCollectionPojo> partsCollections = partsMap.getOrDefault(partsName, Collections.emptyList());
|
|
||||||
|
|
||||||
// 获取所有分类属性
|
|
||||||
List<ClassificationAttributePojo> allAttributes = new ArrayList<>();
|
|
||||||
for (EnginePartsCollectionPojo parts : partsCollections) {
|
|
||||||
String lbjth = parts.getLbjth();
|
|
||||||
if (ObjectUtils.isNotEmpty(lbjth)) {
|
|
||||||
allAttributes.addAll(classificationMap.getOrDefault(lbjth, Collections.emptyList()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//批量处理分类属性
|
|
||||||
List<EngineParamDetailPojo> tcDataPojos = allAttributes.stream()
|
|
||||||
.filter(attr -> parameterMapTc.containsKey(partsName + "&&" + attr.getIdattrtbutehame()))
|
|
||||||
.map(attr -> {
|
|
||||||
EngineParamDetailPojo param = parameterMapTc.get(partsName + "&&" + attr.getIdattrtbutehame()).get(0);
|
|
||||||
param.setParameterValue(attr.getFieldvalue());
|
|
||||||
return param;
|
return param;
|
||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
systemDataList.addAll(tcDataPojos);
|
systemDataList.addAll(convertedTcPojos);
|
||||||
}
|
|
||||||
|
|
||||||
// 按权限过滤返回数据
|
// 按权限过滤返回数据
|
||||||
List<EngineParamDetailPojo> filerData = engineParamDetailService.selectModelParamByIsUserId(systemDataList, analysisRequest.getUserID());
|
List<EngineParamDetailPojo> filerData = engineParamDetailService.selectModelParamByIsUserId(systemDataList, analysisRequest.getUserID());
|
||||||
@ -557,16 +434,6 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
|||||||
* @return 引擎参数详情列表
|
* @return 引擎参数详情列表
|
||||||
*/
|
*/
|
||||||
public List<EngineParamDetailPojo> tcDataSelectAllByproductNumberBatch(List<DataEntryEngineModelPojo> engineModelPojos) {
|
public List<EngineParamDetailPojo> tcDataSelectAllByproductNumberBatch(List<DataEntryEngineModelPojo> engineModelPojos) {
|
||||||
// 收集所有 productNumber
|
|
||||||
Set<String> productNumbers = engineModelPojos.stream()
|
|
||||||
.map(DataEntryEngineModelPojo::getProductNumber)
|
|
||||||
.filter(ObjectUtils::isNotEmpty)
|
|
||||||
.collect(Collectors.toSet());
|
|
||||||
|
|
||||||
if (productNumbers.isEmpty()) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 一次性查询所有参数模板 TC 参数数据
|
// 一次性查询所有参数模板 TC 参数数据
|
||||||
List<ParameterPojo> parameters = engineParamDetailService.selectAllAndTcByNewVersion();
|
List<ParameterPojo> parameters = engineParamDetailService.selectAllAndTcByNewVersion();
|
||||||
List<ParameterPojo> collect = parameters.stream()
|
List<ParameterPojo> collect = parameters.stream()
|
||||||
@ -594,108 +461,41 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 一次性查询所有 EnginePartsCollectionPojo
|
|
||||||
List<EnginePartsCollectionPojo> allPartsCollections = bd.getTCDatabase()
|
|
||||||
.in("ztj", productNumbers)
|
|
||||||
.in("lbjmc", partsNames)
|
|
||||||
.doQuery(EnginePartsCollectionPojo.class);
|
|
||||||
|
|
||||||
// 按 productNumber 和 partsName 分组
|
|
||||||
Map<String, Map<String, List<EnginePartsCollectionPojo>>> partsCollectionsMap = allPartsCollections.stream()
|
|
||||||
.collect(Collectors.groupingBy(
|
|
||||||
EnginePartsCollectionPojo::getZtj,
|
|
||||||
Collectors.groupingBy(EnginePartsCollectionPojo::getLbjmc)
|
|
||||||
));
|
|
||||||
|
|
||||||
// 收集所有图号
|
|
||||||
Set<String> allLbjths = allPartsCollections.stream()
|
|
||||||
.map(EnginePartsCollectionPojo::getLbjth)
|
|
||||||
.filter(ObjectUtils::isNotEmpty)
|
|
||||||
.collect(Collectors.toSet());
|
|
||||||
|
|
||||||
if (allLbjths.isEmpty()) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 一次性查询所有 ClassificationAttributePojo
|
|
||||||
List<ClassificationAttributePojo> allClassifications = bd.getTCDatabase()
|
|
||||||
.in("pitemId", allLbjths)
|
|
||||||
.doQuery(ClassificationAttributePojo.class);
|
|
||||||
|
|
||||||
// 按 pitemId 分组
|
|
||||||
Map<String, List<ClassificationAttributePojo>> classificationMap = allClassifications.stream()
|
|
||||||
.collect(Collectors.groupingBy(ClassificationAttributePojo::getPitemId));
|
|
||||||
|
|
||||||
Map<String, Map<String, List<String>>> productPartsLbjthMap = new HashMap<>();
|
|
||||||
for (Map.Entry<String, Map<String, List<EnginePartsCollectionPojo>>> productEntry : partsCollectionsMap.entrySet()) {
|
|
||||||
String productNumber = productEntry.getKey();
|
|
||||||
Map<String, List<EnginePartsCollectionPojo>> partsMap = productEntry.getValue();
|
|
||||||
|
|
||||||
Map<String, List<String>> partsLbjthMap = new HashMap<>();
|
|
||||||
for (Map.Entry<String, List<EnginePartsCollectionPojo>> partsEntry : partsMap.entrySet()) {
|
|
||||||
String partsName = partsEntry.getKey();
|
|
||||||
List<EnginePartsCollectionPojo> partsCollections = partsEntry.getValue();
|
|
||||||
|
|
||||||
// 提前过滤并收集图号
|
|
||||||
List<String> lbjths = partsCollections.stream()
|
|
||||||
.map(EnginePartsCollectionPojo::getLbjth)
|
|
||||||
.filter(ObjectUtils::isNotEmpty)
|
|
||||||
.filter(classificationMap::containsKey)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
partsLbjthMap.put(partsName, lbjths);
|
|
||||||
}
|
|
||||||
productPartsLbjthMap.put(productNumber, partsLbjthMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 构建结果
|
// 构建结果
|
||||||
List<EngineParamDetailPojo> result = new ArrayList<>();
|
List<EngineParamDetailPojo> result = new ArrayList<>();
|
||||||
|
|
||||||
for (DataEntryEngineModelPojo engineModelPojo : engineModelPojos) {
|
for (DataEntryEngineModelPojo engineModelPojo : engineModelPojos) {
|
||||||
String productNumber = engineModelPojo.getProductNumber();
|
if (ObjectUtils.isEmpty(engineModelPojo.getId())) {
|
||||||
if (ObjectUtils.isEmpty(productNumber)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, List<EnginePartsCollectionPojo>> partsMap = partsCollectionsMap.get(productNumber);
|
|
||||||
if (partsMap == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, List<String>> partsLbjthMap = productPartsLbjthMap.get(productNumber);
|
|
||||||
if (partsLbjthMap == null) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 构建 subsystemParts 列表
|
||||||
|
List<String> subsystemPartsList = new ArrayList<>();
|
||||||
for (String partsName : partsNames) {
|
for (String partsName : partsNames) {
|
||||||
|
// 由于没有 subsystem 信息,使用 partsName 作为占位符
|
||||||
|
// 实际应用中需要根据业务逻辑获取 subsystem
|
||||||
|
subsystemPartsList.add("*-" + partsName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用 selectTCFromDB 查询
|
||||||
|
List<EngineParamDetailPojo> tcDataResults = selectTCFromDB(engineModelPojo.getId(), subsystemPartsList);
|
||||||
|
|
||||||
|
// 过滤并构建结果
|
||||||
|
for (EngineParamDetailPojo tcData : tcDataResults) {
|
||||||
|
String partsName = tcData.getPartsName();
|
||||||
|
String paramName = tcData.getParameterName();
|
||||||
|
|
||||||
Set<String> parameterNameSet = partsParamNameMap.get(partsName);
|
Set<String> parameterNameSet = partsParamNameMap.get(partsName);
|
||||||
if (parameterNameSet == null || parameterNameSet.isEmpty()) {
|
if (parameterNameSet != null && parameterNameSet.contains(paramName)) {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> lbjths = partsLbjthMap.get(partsName);
|
|
||||||
if (lbjths == null || lbjths.isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (String lbjth : lbjths) {
|
|
||||||
List<ClassificationAttributePojo> classifications = classificationMap.get(lbjth);
|
|
||||||
if (classifications == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (ClassificationAttributePojo classificationAttribute : classifications) {
|
|
||||||
if (parameterNameSet.contains(classificationAttribute.getIdattrtbutehame())) {
|
|
||||||
EngineParamDetailPojo engineParamDetailPojo = new EngineParamDetailPojo();
|
EngineParamDetailPojo engineParamDetailPojo = new EngineParamDetailPojo();
|
||||||
engineParamDetailPojo.setEngineModelId(engineModelPojo.getId());
|
engineParamDetailPojo.setEngineModelId(engineModelPojo.getId());
|
||||||
engineParamDetailPojo.setPartsName(partsName);
|
engineParamDetailPojo.setPartsName(partsName);
|
||||||
engineParamDetailPojo.setParameterName(classificationAttribute.getIdattrtbutehame());
|
engineParamDetailPojo.setParameterName(paramName);
|
||||||
engineParamDetailPojo.setParameterValue(classificationAttribute.getFieldvalue());
|
engineParamDetailPojo.setParameterValue(tcData.getParameterValue());
|
||||||
result.add(engineParamDetailPojo);
|
result.add(engineParamDetailPojo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user