TC查询分析图表优化

This commit is contained in:
ys.git 2025-12-19 15:14:08 +08:00
parent ee9c482b11
commit 04a189b08f
3 changed files with 68 additions and 22 deletions

View File

@ -19,5 +19,6 @@ public interface AnalysisCommonParametersService {
ArrayList<AnalysisModelParamterView> selectModelParamByCommon(AnalysisRequest analysisRequest); ArrayList<AnalysisModelParamterView> selectModelParamByCommon(AnalysisRequest analysisRequest);
AnalysisModelParamterViewAndParam showReport(ReportRequest analysisRequest); AnalysisModelParamterViewAndParam showReport(ReportRequest analysisRequest);
AnalysisModelParamterViewAndParam showReportParamList(ReportRequest analysisRequest);
} }

View File

@ -81,6 +81,22 @@ public class AnalysisCommonParametersServiceImpl implements AnalysisCommonParame
@Override @Override
public AnalysisModelParamterViewAndParam showReport(ReportRequest request) { public AnalysisModelParamterViewAndParam showReport(ReportRequest request) {
return showReport1(request);
}
//返回参数列表
@Override
public AnalysisModelParamterViewAndParam showReportParamList(ReportRequest request) {
// return showReport1(request);
return null;
}
public AnalysisModelParamterViewAndParam showReport1(ReportRequest request) {
long startTime = System.currentTimeMillis();
List<DataEntryEngineModelPojo> queryResult = businessDatabase.getBusinessDatabase() List<DataEntryEngineModelPojo> queryResult = businessDatabase.getBusinessDatabase()
// .eq("yc_or_oth", request.getYcOrOth()) // .eq("yc_or_oth", request.getYcOrOth())
.like("model_name", request.getModelName()) .like("model_name", request.getModelName())
@ -102,7 +118,7 @@ public class AnalysisCommonParametersServiceImpl implements AnalysisCommonParame
engineModelPojos = queryResult.stream().filter(dataEntryEngineModelPojo -> { engineModelPojos = queryResult.stream().filter(dataEntryEngineModelPojo -> {
String engineCapacity = dataEntryEngineModelPojo.getEngineCapacity(); String engineCapacity = dataEntryEngineModelPojo.getEngineCapacity();
Double ec = extractDisplacement(engineCapacity); Double ec = extractDisplacement(engineCapacity);
if (ec == null){ if (ec == null) {
return false; return false;
} }
return (Double.compare(ec, engineCapacityMin) >= 0 && Double.compare(ec, engineCapacityMax) < 0); return (Double.compare(ec, engineCapacityMin) >= 0 && Double.compare(ec, engineCapacityMax) < 0);
@ -115,7 +131,7 @@ public class AnalysisCommonParametersServiceImpl implements AnalysisCommonParame
for (DataEntryEngineModelPojo engineModelPojo : engineModelPojos) { for (DataEntryEngineModelPojo engineModelPojo : engineModelPojos) {
AnalysisModelParamterView analysisModelParamterView = new AnalysisModelParamterView(); AnalysisModelParamterView analysisModelParamterView = new AnalysisModelParamterView();
List<EngineParamDetailPojo> pojoList = engineParamDetailService.selectByModelNewVersion(engineModelPojo.getId()); List<EngineParamDetailPojo> pojoList = engineParamDetailService.selectByModelNewVersion(engineModelPojo.getId());
// 编号&&零部件名称-参数 //
ArrayList<EngineParamDetailPojo> engineParamDetailPojos = tcDataQueryService.tcDataSelectAllByproductNumber(engineModelPojo); ArrayList<EngineParamDetailPojo> engineParamDetailPojos = tcDataQueryService.tcDataSelectAllByproductNumber(engineModelPojo);
if (ObjectUtils.isNotEmpty(engineParamDetailPojos)) { if (ObjectUtils.isNotEmpty(engineParamDetailPojos)) {
pojoList.addAll(engineParamDetailPojos); pojoList.addAll(engineParamDetailPojos);
@ -134,6 +150,8 @@ public class AnalysisCommonParametersServiceImpl implements AnalysisCommonParame
List<String> strings = list.stream().distinct().collect(Collectors.toList()); List<String> strings = list.stream().distinct().collect(Collectors.toList());
andParam.setParamList(strings); andParam.setParamList(strings);
andParam.setPojos(analysisModelParamterViews); andParam.setPojos(analysisModelParamterViews);
long endTime = System.currentTimeMillis();
// throw new RuntimeException(String.valueOf(endTime-startTime));
return andParam; return andParam;
} }

View File

@ -12,6 +12,7 @@ import com.xdap.self_development.service.EngineParamDetailService;
import com.xdap.self_development.service.TcDataQueryService; import com.xdap.self_development.service.TcDataQueryService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -54,7 +55,7 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
} }
//通过状态代号产品编号 返回编号&&零部件名称-参数 //通过状态代号产品编号
@Override @Override
public ArrayList<EngineParamDetailPojo> tcDataSelectAllByproductNumber(DataEntryEngineModelPojo engineModelPojo) { public ArrayList<EngineParamDetailPojo> tcDataSelectAllByproductNumber(DataEntryEngineModelPojo engineModelPojo) {
String productNumber = engineModelPojo.getProductNumber(); String productNumber = engineModelPojo.getProductNumber();
@ -62,27 +63,53 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
if (ObjectUtils.isEmpty(productNumber)) { if (ObjectUtils.isEmpty(productNumber)) {
return null; return null;
} }
List<EnginePartsCollection> partsCollections = bd.getTCDatabase()
.eq("ztj", productNumber)
.doQuery(EnginePartsCollection.class);
ArrayList<EngineParamDetailPojo> engineParamDetailPojos = new ArrayList<>(); ArrayList<EngineParamDetailPojo> engineParamDetailPojos = new ArrayList<>();
for (EnginePartsCollection partsCollection : partsCollections) { //查找参数模板TC参数数据
if (partsCollections == null || partsCollection.getLbjth() == null) { List<Parameter> parameters = engineParamDetailService.selectAllAndTcByNewVersion();
continue; List<Parameter> collect = parameters.stream().filter(x -> "TC分类表".equals(x.getParameterSource())).collect(Collectors.toList());
} if (ObjectUtils.isEmpty(collect)) {
List<ClassificationAttribute> list = bd.getTCDatabase() return null;
.eq("pitemId", partsCollection.getLbjth())
.doQuery(ClassificationAttribute.class);
for (ClassificationAttribute classificationAttribute : list) {
EngineParamDetailPojo engineParamDetailPojo = new EngineParamDetailPojo();
engineParamDetailPojo.setEngineModelId(engineModelPojo.getId());
engineParamDetailPojo.setPartsName(partsCollection.getLbjmc());
engineParamDetailPojo.setParameterName(classificationAttribute.getIdattrtbutehame());
engineParamDetailPojo.setParameterValue(classificationAttribute.getFieldvalue());
engineParamDetailPojos.add(engineParamDetailPojo);
}
} }
//通过零部件集合+状态机 查找图号
String id = engineModelPojo.getId();
Map<String, List<Parameter>> stringListMap = collect.stream().collect(Collectors.groupingBy(Parameter::getPartsName));
Set<String> partsNames = stringListMap.keySet();
for (String partsName : partsNames) {
//获取系统内零部件下的参数
List<String> parametersOnPartsName = stringListMap.get(partsName).stream().map(x->x.getParameterName()).collect(Collectors.toList());
List<EnginePartsCollection> partsCollections = bd.getTCDatabase()
.eq("ztj", productNumber)
.eq("lbjmc", partsName)
.doQuery(EnginePartsCollection.class);
//查找图号
List<String> allLbjths = partsCollections.stream()
.map(EnginePartsCollection::getLbjth)
.filter(ObjectUtils::isNotEmpty)
.distinct()
.collect(Collectors.toList());
//查找参数
if (!allLbjths.isEmpty()) {
List<ClassificationAttribute> allClassifications = bd.getTCDatabase()
.in("pitemId", allLbjths)
.doQuery(ClassificationAttribute.class)
.stream()
.filter(attr -> parametersOnPartsName.contains(attr.getIdattrtbutehame()))
.collect(Collectors.toList());
for (ClassificationAttribute classificationAttribute : allClassifications) {
EngineParamDetailPojo engineParamDetailPojo = new EngineParamDetailPojo();
engineParamDetailPojo.setEngineModelId(engineModelPojo.getId());
engineParamDetailPojo.setPartsName(partsName);
engineParamDetailPojo.setParameterName(classificationAttribute.getIdattrtbutehame());
engineParamDetailPojo.setParameterValue(classificationAttribute.getFieldvalue());
engineParamDetailPojos.add(engineParamDetailPojo);
}
}
}
return engineParamDetailPojos; return engineParamDetailPojos;
} }