TC查询分析图表优化
This commit is contained in:
parent
ee9c482b11
commit
04a189b08f
@ -19,5 +19,6 @@ public interface AnalysisCommonParametersService {
|
||||
ArrayList<AnalysisModelParamterView> selectModelParamByCommon(AnalysisRequest analysisRequest);
|
||||
|
||||
AnalysisModelParamterViewAndParam showReport(ReportRequest analysisRequest);
|
||||
AnalysisModelParamterViewAndParam showReportParamList(ReportRequest analysisRequest);
|
||||
|
||||
}
|
||||
|
||||
@ -81,6 +81,22 @@ public class AnalysisCommonParametersServiceImpl implements AnalysisCommonParame
|
||||
@Override
|
||||
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()
|
||||
// .eq("yc_or_oth", request.getYcOrOth())
|
||||
.like("model_name", request.getModelName())
|
||||
@ -102,7 +118,7 @@ public class AnalysisCommonParametersServiceImpl implements AnalysisCommonParame
|
||||
engineModelPojos = queryResult.stream().filter(dataEntryEngineModelPojo -> {
|
||||
String engineCapacity = dataEntryEngineModelPojo.getEngineCapacity();
|
||||
Double ec = extractDisplacement(engineCapacity);
|
||||
if (ec == null){
|
||||
if (ec == null) {
|
||||
return false;
|
||||
}
|
||||
return (Double.compare(ec, engineCapacityMin) >= 0 && Double.compare(ec, engineCapacityMax) < 0);
|
||||
@ -115,7 +131,7 @@ public class AnalysisCommonParametersServiceImpl implements AnalysisCommonParame
|
||||
for (DataEntryEngineModelPojo engineModelPojo : engineModelPojos) {
|
||||
AnalysisModelParamterView analysisModelParamterView = new AnalysisModelParamterView();
|
||||
List<EngineParamDetailPojo> pojoList = engineParamDetailService.selectByModelNewVersion(engineModelPojo.getId());
|
||||
// 编号&&零部件名称-参数
|
||||
//
|
||||
ArrayList<EngineParamDetailPojo> engineParamDetailPojos = tcDataQueryService.tcDataSelectAllByproductNumber(engineModelPojo);
|
||||
if (ObjectUtils.isNotEmpty(engineParamDetailPojos)) {
|
||||
pojoList.addAll(engineParamDetailPojos);
|
||||
@ -134,6 +150,8 @@ public class AnalysisCommonParametersServiceImpl implements AnalysisCommonParame
|
||||
List<String> strings = list.stream().distinct().collect(Collectors.toList());
|
||||
andParam.setParamList(strings);
|
||||
andParam.setPojos(analysisModelParamterViews);
|
||||
long endTime = System.currentTimeMillis();
|
||||
// throw new RuntimeException(String.valueOf(endTime-startTime));
|
||||
return andParam;
|
||||
}
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@ import com.xdap.self_development.service.EngineParamDetailService;
|
||||
import com.xdap.self_development.service.TcDataQueryService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -54,7 +55,7 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
||||
}
|
||||
|
||||
|
||||
//通过状态代号(产品编号) 返回编号&&零部件名称-参数
|
||||
//通过状态代号(产品编号)
|
||||
@Override
|
||||
public ArrayList<EngineParamDetailPojo> tcDataSelectAllByproductNumber(DataEntryEngineModelPojo engineModelPojo) {
|
||||
String productNumber = engineModelPojo.getProductNumber();
|
||||
@ -62,27 +63,53 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
||||
if (ObjectUtils.isEmpty(productNumber)) {
|
||||
return null;
|
||||
}
|
||||
ArrayList<EngineParamDetailPojo> engineParamDetailPojos = new ArrayList<>();
|
||||
//查找参数模板TC参数数据
|
||||
List<Parameter> parameters = engineParamDetailService.selectAllAndTcByNewVersion();
|
||||
List<Parameter> collect = parameters.stream().filter(x -> "TC分类表".equals(x.getParameterSource())).collect(Collectors.toList());
|
||||
if (ObjectUtils.isEmpty(collect)) {
|
||||
return null;
|
||||
}
|
||||
//通过零部件集合+状态机 查找图号
|
||||
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);
|
||||
ArrayList<EngineParamDetailPojo> engineParamDetailPojos = new ArrayList<>();
|
||||
for (EnginePartsCollection partsCollection : partsCollections) {
|
||||
if (partsCollections == null || partsCollection.getLbjth() == null) {
|
||||
continue;
|
||||
}
|
||||
List<ClassificationAttribute> list = bd.getTCDatabase()
|
||||
.eq("pitemId", partsCollection.getLbjth())
|
||||
.doQuery(ClassificationAttribute.class);
|
||||
for (ClassificationAttribute classificationAttribute : list) {
|
||||
//查找图号
|
||||
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(partsCollection.getLbjmc());
|
||||
engineParamDetailPojo.setPartsName(partsName);
|
||||
engineParamDetailPojo.setParameterName(classificationAttribute.getIdattrtbutehame());
|
||||
engineParamDetailPojo.setParameterValue(classificationAttribute.getFieldvalue());
|
||||
engineParamDetailPojos.add(engineParamDetailPojo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return engineParamDetailPojos;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user