查询分析开发
This commit is contained in:
parent
6b69a8b65e
commit
db852294b5
@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/custom/analysis")
|
||||
@ -31,4 +32,11 @@ public class AnalysisCommonController {
|
||||
return Response.ok().data(lists);
|
||||
}
|
||||
|
||||
// //模糊查询下拉列表
|
||||
// @GetMapping("/analysisShowList")
|
||||
// public Response analysisShowList(@RequestParam("attribute") String attribute) {
|
||||
// List<String> lists = analysisCommonParametersService.analysisShowList(attribute);
|
||||
// return Response.ok().data(lists);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@ -3,16 +3,7 @@ package com.xdap.self_development.controller.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 待办事项表
|
||||
* </p>
|
||||
*
|
||||
* @author Lys111
|
||||
* @since 2025-11-18
|
||||
*/
|
||||
@Data
|
||||
public class ReportRequest {
|
||||
|
||||
@ -25,7 +16,7 @@ public class ReportRequest {
|
||||
private String projectNumber;
|
||||
private String emission;
|
||||
private String burnType;
|
||||
private String engineCapacityMin;
|
||||
private String engineCapacityMax;
|
||||
private Double engineCapacityMin;
|
||||
private Double engineCapacityMax;
|
||||
|
||||
}
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package com.xdap.self_development.service.impl;
|
||||
|
||||
|
||||
import com.definesys.mpaas.query.db.PageQueryResult;
|
||||
import com.xdap.api.moudle.department.pojo.entity.XdapDepartments;
|
||||
import com.xdap.api.moudle.user.pojo.XdapUsers;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import com.xdap.self_development.config.BusinessDatabase;
|
||||
import com.xdap.self_development.controller.request.*;
|
||||
import com.xdap.self_development.enums.ParamPermissionEnum;
|
||||
@ -88,15 +87,39 @@ public class AnalysisCommonParametersServiceImpl implements AnalysisCommonParame
|
||||
.like("burn_type", request.getBurnType())
|
||||
.doQuery(DataEntryEngineModelPojo.class);
|
||||
|
||||
String engineCapacityMin = request.getEngineCapacityMin();
|
||||
String engineCapacityMax = request.getEngineCapacityMax();
|
||||
// queryResult.stream().filter(new Predicate<DataEntryEngineModelPojo>() {
|
||||
// @Override
|
||||
// public boolean test(DataEntryEngineModelPojo dataEntryEngineModelPojo) {
|
||||
// dataEntryEngineModelPojo.get
|
||||
// return false;
|
||||
// }
|
||||
// })
|
||||
Double engineCapacityMin = request.getEngineCapacityMin();
|
||||
Double engineCapacityMax = request.getEngineCapacityMax();
|
||||
List<DataEntryEngineModelPojo> engineModelPojos = queryResult.stream().filter(dataEntryEngineModelPojo -> {
|
||||
String engineCapacity = dataEntryEngineModelPojo.getEngineCapacity();
|
||||
Double ec = extractDisplacement(engineCapacity);
|
||||
return (Double.compare(ec, engineCapacityMin) >= 0 && Double.compare(ec, engineCapacityMax) < 0);
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
ArrayList<AnalysisModelParamterView> analysisModelParamterViews = new ArrayList<>();
|
||||
for (DataEntryEngineModelPojo engineModelPojo : engineModelPojos) {
|
||||
AnalysisModelParamterView analysisModelParamterView = new AnalysisModelParamterView();
|
||||
List<EngineParamDetailPojo> pojoList = engineParamDetailService.selectByModelNewVersion(engineModelPojo.getId());
|
||||
analysisModelParamterView.setModelID(engineModelPojo.getId());
|
||||
analysisModelParamterView.setModelName(engineModelPojo.getModelName());
|
||||
analysisModelParamterView.setPojos(pojoList);
|
||||
analysisModelParamterViews.add(analysisModelParamterView);
|
||||
}
|
||||
return analysisModelParamterViews;
|
||||
}
|
||||
|
||||
public static Double extractDisplacement(String displacementStr) {
|
||||
if (displacementStr == null || displacementStr.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 正则匹配:数字(包含小数)
|
||||
Pattern pattern = java.util.regex.Pattern.compile("(\\d+\\.?\\d*)");
|
||||
Matcher matcher = pattern.matcher(displacementStr);
|
||||
|
||||
if (matcher.find()) {
|
||||
return Double.parseDouble(matcher.group(1));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user