From ea263b7681c70190a7bd9f78d6731acc21661cfa Mon Sep 17 00:00:00 2001 From: zjh <15615273395@163.com> Date: Tue, 28 Apr 2026 15:50:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=BE=E5=BC=80=E5=8F=82=E6=95=B0=E6=9D=A5?= =?UTF-8?q?=E6=BA=90=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../job/ParameterValueCalculationTimer.java | 71 +++++++++---------- .../service/TcDataQueryService.java | 2 + .../impl/EngineParamDetailServiceImpl.java | 5 +- .../service/impl/TcDataQueryServiceImpl.java | 26 +++++++ 4 files changed, 63 insertions(+), 41 deletions(-) diff --git a/src/main/java/com/xdap/self_development/job/ParameterValueCalculationTimer.java b/src/main/java/com/xdap/self_development/job/ParameterValueCalculationTimer.java index c065fdf..8827d78 100644 --- a/src/main/java/com/xdap/self_development/job/ParameterValueCalculationTimer.java +++ b/src/main/java/com/xdap/self_development/job/ParameterValueCalculationTimer.java @@ -1,12 +1,9 @@ package com.xdap.self_development.job; import com.xdap.self_development.common.BusinessDatabase; -import com.xdap.self_development.domain.pojo.ClassificationAttributePojo; -import com.xdap.self_development.domain.pojo.EnginePartsCollectionPojo; import com.xdap.self_development.domain.view.CalculationParameterView; import com.xdap.self_development.exception.CommonException; import lombok.extern.slf4j.Slf4j; -import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -58,7 +55,7 @@ public class ParameterValueCalculationTimer { } // 每天凌晨执行一次 - @Scheduled(cron = "0 0 0 * * ?") +// @Scheduled(cron = "0 0 0 * * ?") @Transactional public void dailyCalculate() { @@ -91,39 +88,39 @@ public class ParameterValueCalculationTimer { } // 2.从中台更新参数值 - for (CalculationParameterView parameter : parameterValues) { - if (Objects.equals(parameter.getParameterSource(), "TC分类表")) { - tcParameters++; - try { - EnginePartsCollectionPojo enginePartsCollection = bd.getBusinessDatabase() - .eq("ztj", parameter.getProductNumber()) - .eq("lbjmc", parameter.getPartsName()) - .doQueryFirst(EnginePartsCollectionPojo.class); - if (enginePartsCollection == null || enginePartsCollection.getLbjth() == null) { - log.warn("机型【{}】的参数【{}】在TC分类表中未找到对应零部件,零部件名:{}", - parameter.getProductNumber(), parameter.getParameterName(), parameter.getPartsName()); - failedToUpdateFromTC++; - continue; - } - ClassificationAttributePojo classificationAttribute = bd.getBusinessDatabase() - .eq("pitemId", enginePartsCollection.getLbjth()) - .eq("idattrtbutehame", parameter.getParameterName()) - .doQueryFirst(ClassificationAttributePojo.class); - if (classificationAttribute != null && classificationAttribute.getFieldvalue() != null) { - String originalValue = parameter.getParameterValue(); - parameter.setParameterValue(classificationAttribute.getFieldvalue()); - log.debug("机型【{}】的参数【{}】从中台更新值:{} -> {}",parameter.getProductNumber(), parameter.getParameterName(), originalValue, classificationAttribute.getFieldvalue()); - updatedFromTC++; - } else { - log.warn("机型【{}】的参数【{}】在TC分类表中未找到对应值",parameter.getProductNumber(), parameter.getParameterName()); - failedToUpdateFromTC++; - } - } catch (Exception e) { - log.error("机型【{}】的参数【{}】从中台更新值失败:{}",parameter.getProductNumber(), parameter.getParameterName(), e.getMessage(), e); - failedToUpdateFromTC++; - } - } - } +// for (CalculationParameterView parameter : parameterValues) { +// if (Objects.equals(parameter.getParameterSource(), "TC分类表")) { +// tcParameters++; +// try { +// EnginePartsCollectionPojo enginePartsCollection = bd.getTCDatabase() +// .eq("ztj", parameter.getProductNumber()) +// .eq("lbjmc", parameter.getPartsName()) +// .doQueryFirst(EnginePartsCollectionPojo.class); +// if (enginePartsCollection == null || enginePartsCollection.getLbjth() == null) { +// log.warn("机型【{}】的参数【{}】在TC分类表中未找到对应零部件,零部件名:{}", +// parameter.getProductNumber(), parameter.getParameterName(), parameter.getPartsName()); +// failedToUpdateFromTC++; +// continue; +// } +// ClassificationAttributePojo classificationAttribute = bd.getTCDatabase() +// .eq("pitemId", enginePartsCollection.getLbjth()) +// .eq("idattrtbutehame", parameter.getParameterName()) +// .doQueryFirst(ClassificationAttributePojo.class); +// if (classificationAttribute != null && classificationAttribute.getFieldvalue() != null) { +// String originalValue = parameter.getParameterValue(); +// parameter.setParameterValue(classificationAttribute.getFieldvalue()); +// log.debug("机型【{}】的参数【{}】从中台更新值:{} -> {}",parameter.getProductNumber(), parameter.getParameterName(), originalValue, classificationAttribute.getFieldvalue()); +// updatedFromTC++; +// } else { +// log.warn("机型【{}】的参数【{}】在TC分类表中未找到对应值",parameter.getProductNumber(), parameter.getParameterName()); +// failedToUpdateFromTC++; +// } +// } catch (Exception e) { +// log.error("机型【{}】的参数【{}】从中台更新值失败:{}",parameter.getProductNumber(), parameter.getParameterName(), e.getMessage(), e); +// failedToUpdateFromTC++; +// } +// } +// } log.info("从中台更新参数完成,共处理{}个TC参数,成功{}个,失败{}个", tcParameters, updatedFromTC, failedToUpdateFromTC); diff --git a/src/main/java/com/xdap/self_development/service/TcDataQueryService.java b/src/main/java/com/xdap/self_development/service/TcDataQueryService.java index b92dcbb..aee9b6c 100644 --- a/src/main/java/com/xdap/self_development/service/TcDataQueryService.java +++ b/src/main/java/com/xdap/self_development/service/TcDataQueryService.java @@ -25,4 +25,6 @@ public interface TcDataQueryService { Map> tcDataSelectByVersion(AnalysisVerRequest analysisRequest); List tcDataSelectAllByproductNumberBatch(List engineModelPojos); + + List selectTCFromDB(String modelId, List subsystemParts); } diff --git a/src/main/java/com/xdap/self_development/service/impl/EngineParamDetailServiceImpl.java b/src/main/java/com/xdap/self_development/service/impl/EngineParamDetailServiceImpl.java index 38d653e..1b42db2 100644 --- a/src/main/java/com/xdap/self_development/service/impl/EngineParamDetailServiceImpl.java +++ b/src/main/java/com/xdap/self_development/service/impl/EngineParamDetailServiceImpl.java @@ -307,7 +307,6 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService { List pojoList = bd.getBusinessDatabase() .eq("engine_model_id", modelID) .eq("major_version", parameterVersion) - .eq("parameter_source", "数据平台手工录入") .doQuery(EngineParamDetailPojo.class); if (userId == null || userId.isEmpty()) { return pojoList; @@ -529,8 +528,7 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService { MpaasQuery query = bd.getBusinessDatabase() .eq("engine_model_id", model.getId()) .in("subsystem_name", subsystemSet) - .in("parts_name", typeSet) - .eq("parameter_source", "数据平台手工录入"); + .in("parts_name", typeSet); //若传入填写人则查询填写人需要填写的参数 if (ObjectUtils.isNotEmpty(request.getFilledById())) { @@ -556,7 +554,6 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService { .eq("engine_model_id", model.getId()) .in("subsystem_name", subsystemSet) .in("parts_name", typeSet) - .eq("parameter_source", "数据平台手工录入") .eq("filled_by", request.getFilledById()) .eq("major_version", model.getVersionNumber()) .doQuery(EngineParamDetailPojo.class) diff --git a/src/main/java/com/xdap/self_development/service/impl/TcDataQueryServiceImpl.java b/src/main/java/com/xdap/self_development/service/impl/TcDataQueryServiceImpl.java index 097594a..99c70c5 100644 --- a/src/main/java/com/xdap/self_development/service/impl/TcDataQueryServiceImpl.java +++ b/src/main/java/com/xdap/self_development/service/impl/TcDataQueryServiceImpl.java @@ -700,6 +700,32 @@ public class TcDataQueryServiceImpl implements TcDataQueryService { return result; } + @Override + public List selectTCFromDB(String modelId, List subsystemParts) { + DataEntryEngineModelPojo model = engineModelService.selectBymodelId(modelId); + if (model == null) { + throw new CommonException("查询失败:机型不存在"); + } + + Set subsystemSet = new HashSet<>(); + Set partsNameSet = new HashSet<>(); + subsystemParts.forEach(subsystemType -> { + if (subsystemType.split("-").length != 2) { + throw new CommonException("查询条件异常,需子系统-零部件名称,若零部件为空则传入“/”"); + } + String subsystem = subsystemType.split("-")[0]; + String partsName = subsystemType.split("-")[1]; + subsystemSet.add(subsystem); + partsNameSet.add(partsName); + }); + + return bd.getBusinessDatabase() + .eq("engine_model_id", model.getId()) + .in("subsystem_name", subsystemSet) + .in("parts_name", partsNameSet) + .doQuery(EngineParamDetailPojo.class); + } + private void setupResponse(HttpServletResponse response, String fileName) throws IOException { response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); response.setCharacterEncoding("utf-8");