From 4df7931523551a5867d13aa75640b92f1c7e7d97 Mon Sep 17 00:00:00 2001 From: wxr Date: Thu, 16 Oct 2025 10:29:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E8=B5=B7=E5=A4=8D=E6=A3=80=E5=A7=94?= =?UTF-8?q?=E6=89=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessAssayParameterDataMapper.java | 10 +++ .../BusinessAssayProjectDataMapper.java | 10 +++ .../mapper/BusinessAssayTaskDataMapper.java | 21 +++++ .../SampleAnalysisAuditServiceImpl.java | 80 ++++++++++++++++++- 4 files changed, 119 insertions(+), 2 deletions(-) diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayParameterDataMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayParameterDataMapper.java index d2f70ed..92ac444 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayParameterDataMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayParameterDataMapper.java @@ -68,5 +68,15 @@ public interface BusinessAssayParameterDataMapper extends BaseMapperX selectByBusinessAssayProjectDataId(Long businessAssayProjectDataId) { + return selectList(new LambdaQueryWrapperX() + .eq(BusinessAssayParameterDataDO::getBusinessAssayProjectDataId, businessAssayProjectDataId)); + } + + default List selectByBusinessAssayProjectDataIds(List businessAssayProjectDataIds) { + return selectList(new LambdaQueryWrapperX() + .in(BusinessAssayParameterDataDO::getBusinessAssayProjectDataId, businessAssayProjectDataIds)); + } } \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayProjectDataMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayProjectDataMapper.java index 46ba28a..fd19e9c 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayProjectDataMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayProjectDataMapper.java @@ -85,6 +85,16 @@ public interface BusinessAssayProjectDataMapper extends BaseMapperX selectByBusinessAssayTaskDataIds(List businessAssayTaskDataIds) { + return selectJoinList(BusinessAssayProjectDataExtendRespVO.class, new MPJLambdaWrapperX() + .leftJoin(DictionaryProjectDO.class, DictionaryProjectDO::getId, BusinessAssayProjectDataDO::getDictionaryProjectId) + .selectAll(BusinessAssayProjectDataDO.class) + .selectAs(DictionaryProjectDO::getKey, BusinessAssayProjectDataExtendRespVO::getDictionaryProjectKey) + .selectAs(DictionaryProjectDO::getSimpleName, BusinessAssayProjectDataExtendRespVO::getSimpleName) + .selectAs(DictionaryProjectDO::getShowName, BusinessAssayProjectDataExtendRespVO::getShowName) + .in(BusinessAssayProjectDataDO::getBusinessAssayTaskDataId, businessAssayTaskDataIds)); + } + default List selectAnalysisBy(BusinessAssayProjectDataReqVO reqVO) { return selectJoinList(BusinessAssayProjectDataExtendRespVO.class, new MPJLambdaWrapperX() .leftJoin(BusinessAssayTaskDataDO.class, BusinessAssayTaskDataDO::getId, BusinessAssayProjectDataDO::getBusinessAssayTaskDataId) diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayTaskDataMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayTaskDataMapper.java index f32cb04..d082666 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayTaskDataMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayTaskDataMapper.java @@ -189,4 +189,25 @@ public interface BusinessAssayTaskDataMapper extends BaseMapperX selectMaxAnalysisCountByBusinessSubSampleIdAndConfigAssayMethodId(Long businessSubSampleId, Long configAssayMethodId) { + BusinessAssayTaskDataDO maxAnalysisCount = selectOne(new LambdaQueryWrapperX() + .eq(BusinessAssayTaskDataDO::getBusinessSubSampleId, businessSubSampleId) + .eq(BusinessAssayTaskDataDO::getConfigAssayMethodId, configAssayMethodId) + .orderByDesc(BusinessAssayTaskDataDO::getAnalysisCount) + .last("LIMIT 1")); + + return selectList(new LambdaQueryWrapperX() + .eq(BusinessAssayTaskDataDO::getBusinessSubSampleId, businessSubSampleId) + .eq(BusinessAssayTaskDataDO::getConfigAssayMethodId, configAssayMethodId) + .eq(BusinessAssayTaskDataDO::getAnalysisCount, maxAnalysisCount.getAnalysisCount())); + + + } + } \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleAnalysisAuditServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleAnalysisAuditServiceImpl.java index 1d3e7db..4f0dead 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleAnalysisAuditServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleAnalysisAuditServiceImpl.java @@ -6,7 +6,6 @@ import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Objects; @@ -19,11 +18,13 @@ import org.springframework.transaction.annotation.Transactional; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.ql.util.express.ExpressRunner; import com.zt.plat.framework.common.exception.ServiceException; import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils; import com.zt.plat.module.qms.business.bus.controller.vo.*; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayParameterDataDO; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayProjectDataDO; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayReportDataDO; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDO; @@ -32,6 +33,7 @@ import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessBaseSampleDO; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleAssessmentDO; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleDO; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessTeamAssessmentDO; +import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayParameterDataMapper; import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayProjectDataMapper; import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayReportDataMapper; import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayTaskDataMapper; @@ -575,6 +577,9 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic @Resource private BusinessSubSampleMapper businessSubSampleMapper; + + @Resource + private BusinessAssayParameterDataMapper businessAssayParameterDataMapper; @Override @Transactional(rollbackFor = Exception.class) @@ -584,10 +589,81 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic //子样配置数据 ConfigSubSampleDO configSubSampleDO = configSubSampleMapper.selectById(businessSubSampleDO.getConfigSubSampleId()); + if (StringUtils.isBlank(configSubSampleDO.getRecheckFlowNodeKey())) { + throw new ServiceException(500, "未配置复检流程,不能发起复检委托!"); + } + List newBusinessAssayTaskDataDOList = new ArrayList<>(); + List newBusinessAssayProjectDataDOList = new ArrayList<>(); + List newBusinessAssayParameterDataDOList = new ArrayList<>(); + + BusinessAssayTaskDataDO newBusinessAssayTaskDataDO = null; + List businessAssayTaskDataDOList = businessAssayTaskDataMapper.selectMaxAnalysisCountByBusinessSubSampleIdAndConfigAssayMethodId(businessSubSampleId, configAssayMethodId); + List businessAssayTaskDataDOIdList = businessAssayTaskDataDOList.stream().map(m -> m.getId()).collect(Collectors.toList()); + List businessAssayProjectDataDOList = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataIds(businessAssayTaskDataDOIdList); + List businessAssayProjectDataDOIdList = businessAssayProjectDataDOList.stream().map(m -> m.getId()).collect(Collectors.toList()); + List businessAssayParameterDataDOList = businessAssayParameterDataMapper.selectByBusinessAssayProjectDataIds(businessAssayProjectDataDOIdList); + for (BusinessAssayTaskDataDO businessAssayTaskDataDO : businessAssayTaskDataDOList) { + // 子样检测任务 + newBusinessAssayTaskDataDO = new BusinessAssayTaskDataDO(); + newBusinessAssayTaskDataDO.setId(IdWorker.getId()); + newBusinessAssayTaskDataDO.setBusinessBaseSampleId(businessAssayTaskDataDO.getBusinessBaseSampleId()); + newBusinessAssayTaskDataDO.setBusinessSubParentSampleId(businessAssayTaskDataDO.getBusinessSubParentSampleId()); + newBusinessAssayTaskDataDO.setBusinessSubSampleId(businessAssayTaskDataDO.getBusinessSubSampleId()); + newBusinessAssayTaskDataDO.setConfigAssayMethodId(businessAssayTaskDataDO.getConfigAssayMethodId()); + newBusinessAssayTaskDataDO.setAssayType(businessAssayTaskDataDO.getAssayType()); + newBusinessAssayTaskDataDO.setTaskType(businessAssayTaskDataDO.getTaskType()); + newBusinessAssayTaskDataDO.setConfigSampleFlowId(businessAssayTaskDataDO.getConfigSampleFlowId()); + newBusinessAssayTaskDataDO.setSampleFlowNodeKey(configSubSampleDO.getRecheckFlowNodeKey()); + newBusinessAssayTaskDataDO.setSampleFlowNodeTime(LocalDateTime.now()); + newBusinessAssayTaskDataDO.setAssayDepartmentId(businessAssayTaskDataDO.getAssayDepartmentId()); + newBusinessAssayTaskDataDO.setAssayDepartmentName(businessAssayTaskDataDO.getAssayDepartmentName()); + newBusinessAssayTaskDataDO.setAnalysisCount(businessAssayTaskDataDO.getAnalysisCount() + 1); + newBusinessAssayTaskDataDO.setAssayProject(businessAssayTaskDataDO.getAssayProject()); + + List businessAssayProjectDataList = businessAssayProjectDataDOList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(businessAssayTaskDataDO.getId())).collect(Collectors.toList()); + for (BusinessAssayProjectDataExtendRespVO businessAssayProjectData : businessAssayProjectDataList) { + //检测项目 + BusinessAssayProjectDataDO businessAssayProjectDataDO = new BusinessAssayProjectDataDO(); + businessAssayProjectDataDO.setId(IdWorker.getId()); + businessAssayProjectDataDO.setBusinessAssayTaskDataId(newBusinessAssayTaskDataDO.getId()); + businessAssayProjectDataDO.setConfigAssayMethodProjectId(businessAssayProjectData.getConfigAssayMethodProjectId()); + businessAssayProjectDataDO.setDictionaryProjectId(businessAssayProjectData.getDictionaryProjectId()); + businessAssayProjectDataDO.setDataType(businessAssayProjectData.getDataType()); + businessAssayProjectDataDO.setDecimalPosition(businessAssayProjectData.getDecimalPosition()); + businessAssayProjectDataDO.setIsEnabled(businessAssayProjectData.getIsEnabled()); + businessAssayProjectDataDO.setIsNotAssessment(0); + + newBusinessAssayProjectDataDOList.add(businessAssayProjectDataDO); + + List businessAssayParameterDataList = businessAssayParameterDataDOList.stream().filter(f -> f.getBusinessAssayProjectDataId().equals(businessAssayProjectData.getId())).collect(Collectors.toList()); + for (BusinessAssayParameterDataDO businessAssayParameterData : businessAssayParameterDataList) { + BusinessAssayParameterDataDO businessAssayParameterDataDO = new BusinessAssayParameterDataDO(); + businessAssayParameterDataDO.setId(IdWorker.getId()); + businessAssayParameterDataDO.setBusinessAssayProjectDataId(businessAssayProjectDataDO.getId()); + businessAssayParameterDataDO.setConfigAssayMethodProjectParameterId(businessAssayParameterData.getConfigAssayMethodProjectParameterId()); + businessAssayParameterDataDO.setDictionaryParameterId(businessAssayParameterData.getDictionaryParameterId()); + businessAssayParameterDataDO.setDataType(businessAssayParameterData.getDataType()); + businessAssayParameterDataDO.setDecimalPosition(businessAssayParameterData.getDecimalPosition()); + + newBusinessAssayParameterDataDOList.add(businessAssayParameterDataDO); + } + } + + newBusinessAssayTaskDataDOList.add(newBusinessAssayTaskDataDO); + + } + if (newBusinessAssayTaskDataDOList.size() > 0) { + businessAssayTaskDataMapper.insertBatch(newBusinessAssayTaskDataDOList); + } + if (newBusinessAssayProjectDataDOList.size() > 0) { + businessAssayProjectDataMapper.insertBatch(newBusinessAssayProjectDataDOList); + } + if (newBusinessAssayParameterDataDOList.size() > 0) { + businessAssayParameterDataMapper.insertBatch(newBusinessAssayParameterDataDOList); + } - //businessAssayTaskDataMapper.select }