diff --git a/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/ErrorCodeConstants.java b/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/ErrorCodeConstants.java index f816868..1c55656 100644 --- a/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/ErrorCodeConstants.java +++ b/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/ErrorCodeConstants.java @@ -54,6 +54,7 @@ public interface ErrorCodeConstants { ErrorCode CONFIG_REPORT_TYPE_NOT_EXISTS = new ErrorCode(1_032_050_000, "报表类型配置不存在"); ErrorCode CONFIG_PROJECT_NOT_EXISTS = new ErrorCode(1_032_050_000, "检测项目配置不存在"); ErrorCode CONFIG_ENTRUST_SOURCE_NOT_EXISTS = new ErrorCode(1_032_050_000, "检验委托来源配置不存在"); + ErrorCode CONFIG_ENTRUST_SOURCE_SAMPLE_TYPE_NOT_EXISTS = new ErrorCode(1_032_050_000, "检验委托来源与样品类型配置不存在"); ErrorCode CONFIG_BASE_SAMPLE_NOT_EXISTS = new ErrorCode(1_032_050_000, "主样配置不存在"); ErrorCode CONFIG_ASSAY_METHOD_PROJECT_PARAMETER_NOT_EXISTS = new ErrorCode(1_032_050_000, "检测方法分析项目参数配置不存在"); diff --git a/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/QmsCommonConstant.java b/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/QmsCommonConstant.java index 19a8a8e..adafb2b 100644 --- a/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/QmsCommonConstant.java +++ b/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/QmsCommonConstant.java @@ -107,6 +107,15 @@ public interface QmsCommonConstant { /** 检验委托 **/ String ENTRUST_INSPECTION = "entrust_inspection"; + /** 委托样品类型: 委检样 **/ + String ENTRUST_COMMISSION_INSPECTION_SAMPLE = "commissionInspectionSample"; + + /** 委托样品类型: 商检分析样 **/ + String ENTRUST_INSPECTION_ANALYSIS_SAMPLE = "inspectionAnalysisSample"; + + /** 委托样品类型: 商检综合 **/ + String ENTRUST_COMPREHENSIVE_INSPECTION_SAMPLE = "comprehensiveInspectionSample"; + /** 中心收样 **/ String FLOW_NODE_CENTER_RECEIVE = "flw_center_receive"; @@ -179,6 +188,10 @@ public interface QmsCommonConstant { /** 检验完成状态-未完成 **/ String UNCHECKED = "unchecked"; + /** 数据回报状态 未回报 **/ + String UNRETURNED = "unreturned"; + + /** 自动 **/ String AUTOMATIC = "automatic"; @@ -194,4 +207,7 @@ public interface QmsCommonConstant { /** 允许提交 **/ String ALLOW_SUBMIT = "allow_submit"; + + + } diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/entrust/SampleEntrustGenSampleDataCmp.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/entrust/SampleEntrustGenSampleDataCmp.java index 2b6bcee..77eaa50 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/entrust/SampleEntrustGenSampleDataCmp.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/entrust/SampleEntrustGenSampleDataCmp.java @@ -9,13 +9,15 @@ import java.util.stream.Collectors; import org.apache.commons.lang3.StringUtils; import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.yomahub.liteflow.annotation.LiteflowComponent; import com.yomahub.liteflow.core.NodeComponent; import cn.hutool.core.collection.CollUtil; + import com.zt.plat.framework.common.exception.ServiceException; -import com.zt.plat.framework.tenant.core.context.TenantContextHolder; 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; @@ -46,11 +48,11 @@ import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessSubSampleAssessmen import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessSubSampleMapper; import com.zt.plat.module.qms.business.bus.liteflow.param.SampleFlowInfo; import com.zt.plat.module.qms.business.bus.liteflow.slot.SampleEntrustContext; +import com.zt.plat.module.qms.business.config.controller.vo.ConfigAssayMethodProjectExtendRespVO; import com.zt.plat.module.qms.business.config.controller.vo.ConfigSubSampleMethodConfAdd; import com.zt.plat.module.qms.business.config.controller.vo.ConfigSubSampleMethodConfInfo; import com.zt.plat.module.qms.business.config.dal.dataobject.BaseSampleDO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodDO; -import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectDO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectParameterDO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigBaseSampleDO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigSampleFlowDO; @@ -79,6 +81,13 @@ import com.zt.plat.module.qms.enums.QmsCommonConstant; import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; +/** + * 委检样 是否有来样品位S值, 是: 综合分析室分析配料元素,试金分析室获取分析的配料元素 ;否:不送往综合分析室,配料时采用来样品位S值,如果是必须含有Cu、S的,则试金分析人员称样时,估一个Cu品位进行配料。 + * + * 商检分析样 这批样中第一个样品默认产生1个配料任务(综合分析室分析),最终这些配料元素对应到这批商检分析样的每一个试金样品的配料参数上; + * + * 商检综合样 综合样,除了杂质元素,如果要分析Au、Ag,单个样品综合分析室分析配料元素会单独生成1个任务;这个结果匹配到综合样自身的试金任务的配料参数上; + */ @Slf4j @LiteflowComponent(id = "sampleEntrustGenSampleDataCmp", name = "样品委托生成系统样品数据") public class SampleEntrustGenSampleDataCmp extends NodeComponent { @@ -182,47 +191,33 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent { //样品来样品位 List sampleAssayResultList = sampleEntrustContext.getSampleAssayResultList(); - //金银检测项目字典id列表 -// List auAgDictionaryProjectIdList = new ArrayList<>() { -// private static final long serialVersionUID = 1L; -// -// { -// add(1000000000000000002L); -// add(1000000000000000003L); -// }}; - //硫的检测项目字典id -// Long sDictionaryProjectId = 1000000000000000004L; - - //商检样品来源id -// List sjEntrustSourceIdList = new ArrayList<>() { -// private static final long serialVersionUID = 1L; -// -// { -// add(1000000000000000002L);//中铜国贸 -// }}; + List baseSampleIdList = sampleEntrustDetailList.stream().map(m -> m.getBaseSampleId()).distinct().collect(Collectors.toList()); //样品大类列表 - List baseSampleList = baseSampleMapper.selectList(); + List baseSampleList = baseSampleMapper.selectByIds(baseSampleIdList); //主样配置 - List configBaseSampleList = configBaseSampleMapper.selectList(); + List configBaseSampleList = configBaseSampleMapper.selectByBaseSampleIds(baseSampleIdList); + List configBaseSampleIdList = configBaseSampleList.stream().map(m -> m.getId()).collect(Collectors.toList()); //分样配置 - List configSubSampleParentList = configSubSampleParentMapper.selectList(); + List configSubSampleParentList = configSubSampleParentMapper.selectByBaseSampleIds(baseSampleIdList); //子样配置 - List configSubSampleList = configSubSampleMapper.selectList(); + List configSubSampleList = configSubSampleMapper.selectByBaseSampleIds(baseSampleIdList); + List configSubSampleIdList = configSubSampleList.stream().map(m -> m.getId()).collect(Collectors.toList()); //子样分析方法配置 - List configSubSampleMethodList = configSubSampleMethodMapper.selectList(); + List configSubSampleMethodList = configSubSampleMethodMapper.selectByConfigSubSampleIds(configSubSampleIdList); + List configAssayMethodIdList = configSubSampleMethodList.stream().map(m -> m.getConfigAssayMethodId()).distinct().collect(Collectors.toList()); //分析方法配置 - List configAssayMethodList = configAssayMethodMapper.selectList(); + List configAssayMethodList = configAssayMethodMapper.selectByIds(configAssayMethodIdList); //分析方法检测项目配置 - List configAssayMethodProjectList = configAssayMethodProjectMapper.selectList(); + List configAssayMethodProjectList = configAssayMethodProjectMapper.selectByConfigAssayMethodIds(configAssayMethodIdList); //分析方法检测项目参数配置 - List configAssayMethodProjectParameterList = configAssayMethodProjectParameterMapper.selectList(); + List configAssayMethodProjectParameterList = configAssayMethodProjectParameterMapper.selectByConfigAssayMethodIds(configAssayMethodIdList); //检测项目字典 List dictionaryProjectList = dictionaryProjectMapper.selectList(); //主样报表配置 - List configSampleReportList = configSampleReportMapper.selectList(); + List configSampleReportList = configSampleReportMapper.selectByConfigBaseSampleIds(configBaseSampleIdList); //样品流程配置 List configSampleFlowKeyList = new ArrayList<>(); @@ -253,13 +248,6 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent { //分析报表数据 List businessAssayReportDataDOList = new ArrayList<>(); - //是否为商检委托 -// Boolean isSjEntrust = sjEntrustSourceIdList.contains(sampleEntrustRegistration.getConfigEntrustSourceId()); - //是否分析金银 -// Boolean isAssayAuAg = sampleEntrustProjectList.stream().anyMatch(f -> auAgDictionaryProjectIdList.contains(f.getDictionaryProjectId())); - //是否分析硫 -// Boolean isAssayS = sampleEntrustProjectList.stream().anyMatch(f -> f.getDictionaryProjectId().equals(sDictionaryProjectId)); - //子样流转信息列表 List sampleFlowInfoList = new ArrayList<>(); @@ -267,11 +255,19 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent { List sampleEntrustDetailListSort = sampleEntrustDetailList.stream().sorted(Comparator.comparingInt(BusinessSampleEntrustDetailDO::getSort)).collect(Collectors.toList()); //主样 BusinessBaseSampleDO businessBaseSampleDO = null; - int sort = 0;//委托明细顺序 + int sjfxyOne = -1;//商检分析样第一个是值为0,已经过商检分析样的值为1,默认值为-1; for (BusinessSampleEntrustDetailDO businessSampleEntrustDetailDO : sampleEntrustDetailListSort) {//委托样品明细 //样品大类 BaseSampleDO baseSampleDO = baseSampleList.stream().filter(f -> f.getId().equals(businessSampleEntrustDetailDO.getBaseSampleId())).findFirst().orElse(null); + + if (QmsCommonConstant.ENTRUST_INSPECTION_ANALYSIS_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey())){//如果是商检分析样 + if (sjfxyOne == -1) { + sjfxyOne = 0;//第一个商检分析样 + } else { + sjfxyOne = 1;//商检分析样已添加过 + } + } //获取当前样品的检测项目 List sampleEntrustProjectDOList = sampleEntrustProjectList.stream().filter(f -> businessSampleEntrustDetailDO.getId().equals(f.getBusinessSampleEntrustDetailId())).collect(Collectors.toList()); @@ -286,42 +282,17 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent { List materialAssayStandardMethodList = sampleEntrustContext.getMaterialAssayStandardMethodDefaultByMaterialAssayStandardDetailIds(materialAssayStandardDetailIdList); //获取检测方法 - List configAssayMethodIdList = materialAssayStandardMethodList.stream().map(m -> m.getConfigAssayMethodId()).distinct().collect(Collectors.toList()); + List materialAssayStandardConfigAssayMethodIdList = materialAssayStandardMethodList.stream().map(m -> m.getConfigAssayMethodId()).distinct().collect(Collectors.toList()); - //查找子样配置 - List configSubSampleIdList = configSubSampleMethodList.stream().filter(f -> f.getIsDefaultUse().equals(QmsCommonConstant.YES) && configAssayMethodIdList.contains(f.getConfigAssayMethodId())).map(m -> m.getConfigSubSampleId()).distinct().collect(Collectors.toList()); + //查找当前委托明细分析的子样配置 + List currentConfigSubSampleIdList = configSubSampleMethodList.stream().filter(f -> f.getIsDefaultUse().equals(QmsCommonConstant.YES) && materialAssayStandardConfigAssayMethodIdList.contains(f.getConfigAssayMethodId())).map(m -> m.getConfigSubSampleId()).distinct().collect(Collectors.toList()); //查询当前委托样品对应的子样 - List entrustConfigSubSampleList = configSubSampleList.stream().filter(f -> configSubSampleIdList.contains(f.getId()) && f.getBaseSampleId().equals(businessSampleEntrustDetailDO.getBaseSampleId())).distinct().collect(Collectors.toList()); + List entrustConfigSubSampleList = configSubSampleList.stream().filter(f -> currentConfigSubSampleIdList.contains(f.getId()) && f.getBaseSampleId().equals(businessSampleEntrustDetailDO.getBaseSampleId())).distinct().collect(Collectors.toList()); if (entrustConfigSubSampleList.size() != 1) { throw new ServiceException(1_032_100_000, "子样配置不正确"); } - - - //是否创建综合样S分析 -// Boolean isCreateZhy = false; - //综合样分析方法 -// ConfigAssayMethodDO configAssayMethodZhy = null; - - //是商检样品,分析金银,第一个样品 -// if (isSjEntrust && isAssayAuAg && sort == 0) { - //是否分析硫 -// isAssayS = dictionaryProjectIdList.contains(sDictionaryProjectId); -// if (isAssayS) { -// isCreateZhy = false; -// } else { -// isCreateZhy = true; -// MaterialAssayStandardMethodDO materialAssayStandardMethodDO = materialAssayStandardMethodMapper.selectByBaseSampleIdAndDictionaryProjectId(businessSampleEntrustDetailDO.getBaseSampleId(), sDictionaryProjectId); -// if (materialAssayStandardMethodDO == null) { -// throw new ServiceException(1_032_100_000, "商检样品,检测项目存在金银,但未找到S配置"); -// } -// configAssayMethodZhy = configAssayMethodMapper.selectById(materialAssayStandardMethodDO.getConfigAssayMethodId()); -// } -// -// } - - - + //获取到子样配置 ConfigSubSampleDO configSubSample = entrustConfigSubSampleList.get(0); Long configSubSampleParentId = configSubSample.getConfigSubSampleParentId(); @@ -437,7 +408,7 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent { //子样对应的分析班组 BusinessSubSampleAnalysisGroupDO businessSubSampleAnalysisGroupDO = null; - for (Long configAssayMethodId : configAssayMethodIdList) { + for (Long configAssayMethodId : materialAssayStandardConfigAssayMethodIdList) { //查询分析方法 ConfigAssayMethodDO configAssayMethodDO = configAssayMethodList.stream().filter(f -> f.getId().equals(configAssayMethodId)).findFirst().orElse(null); @@ -456,128 +427,52 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent { List projectIdList = addAssayTask.getProjectIdList(); //判定检测项目包含条件中的检测项目 Boolean isAssayConditionProjectList = sampleEntrustProjectList.stream().anyMatch(f -> conditionProjectIdList.contains(f.getDictionaryProjectId())); - if (isAssayConditionProjectList && sort == 0) { - ConfigAssayMethodDO addAssayTaskConfigAssayMethod = configAssayMethodMapper.selectById(methodId); - Long addAssayTaskAssayDepartmentId = addAssayTaskConfigAssayMethod.getAssayDepartmentId(); - - //查询子样对应的分析方法 - ConfigSubSampleMethodDO addAssayTaskConfigSubSampleMethodDO = configSubSampleMethodList.stream().filter(f -> f.getIsDefaultUse().equals(QmsCommonConstant.YES) && f.getConfigAssayMethodId().equals(methodId) && f.getConfigSubSampleId().equals(configSubSample.getId())).findFirst().orElse(null); - - businessSubSampleAnalysisGroupDO = businessSubSampleAnalysisGroupDOList.stream().filter(f -> f.getBusinessSubSampleId().equals(businessSubSampleDO.getId()) && f.getAssayDepartmentId().equals(addAssayTaskAssayDepartmentId)).findFirst().orElse(null); - if (businessSubSampleAnalysisGroupDO == null) { - businessSubSampleAnalysisGroupDO = new BusinessSubSampleAnalysisGroupDO(); - businessSubSampleAnalysisGroupDO.setId(IdWorker.getId()); - businessSubSampleAnalysisGroupDO.setBusinessBaseSampleId(businessSubSampleDO.getBusinessBaseSampleId()); - businessSubSampleAnalysisGroupDO.setBusinessSubParentSampleId(businessSubSampleDO.getBusinessSubParentSampleId()); - businessSubSampleAnalysisGroupDO.setBusinessSubSampleId(businessSubSampleDO.getId()); - businessSubSampleAnalysisGroupDO.setAssayDepartmentId(addAssayTaskConfigAssayMethod.getAssayDepartmentId()); - businessSubSampleAnalysisGroupDO.setAssayDepartmentName(addAssayTaskConfigAssayMethod.getAssayDepartmentName()); - businessSubSampleAnalysisGroupDO.setSampleStatus("待收样"); - - businessSubSampleAnalysisGroupDOList.add(businessSubSampleAnalysisGroupDO); - } - - //根据任务数判断是平行还是 - String assayType = addAssayTaskConfigSubSampleMethodDO.getTaskCount() > 1 ? QmsCommonConstant.ASSAY_TYPE_SINGLE_PARALLEL : QmsCommonConstant.ASSAY_TYPE_SINGLE_CUP; - - //分样判定数据 - BusinessSubParentSampleAssessmentDO businessSubParentSampleAssessmentDO = new BusinessSubParentSampleAssessmentDO(); - businessSubParentSampleAssessmentDO.setId(IdWorker.getId()); - businessSubParentSampleAssessmentDO.setBusinessSubParentSampleId(businessSubSampleDO.getBusinessSubParentSampleId()); - businessSubParentSampleAssessmentDO.setConfigAssayMethodId(addAssayTaskConfigAssayMethod.getId()); - businessSubParentSampleAssessmentDO.setAssayType(assayType); - businessSubParentSampleAssessmentDO.setTaskType("常规"); - businessSubParentSampleAssessmentDOList.add(businessSubParentSampleAssessmentDO); - - //子样判定数据 - BusinessSubSampleAssessmentDO businessSubSampleAssessmentDO = new BusinessSubSampleAssessmentDO(); - businessSubSampleAssessmentDO.setId(IdWorker.getId()); - businessSubSampleAssessmentDO.setBusinessBaseSampleId(businessSubSampleDO.getBusinessBaseSampleId()); - businessSubSampleAssessmentDO.setBusinessSubParentSampleId(businessSubSampleDO.getBusinessSubParentSampleId()); - businessSubSampleAssessmentDO.setBusinessSubParentSampleAssessmentId(businessSubParentSampleAssessmentDO.getId()); - businessSubSampleAssessmentDO.setBusinessSubSampleId(businessSubSampleDO.getId()); - businessSubSampleAssessmentDO.setConfigAssayMethodId(addAssayTaskConfigAssayMethod.getId()); - businessSubSampleAssessmentDO.setAssayType(assayType); - businessSubSampleAssessmentDO.setTaskType("常规"); - - businessSubSampleAssessmentDOList.add(businessSubSampleAssessmentDO); - - //根据检测方法循环 - BusinessAssayTaskDataDO businessAssayTaskDataDO = null; - //根据任务数循环 - for (int i = 0; i < addAssayTaskConfigSubSampleMethodDO.getTaskCount(); i++) { - //子样检测任务 - businessAssayTaskDataDO = new BusinessAssayTaskDataDO(); - businessAssayTaskDataDO.setId(IdWorker.getId()); - businessAssayTaskDataDO.setBusinessBaseSampleId(businessSubSampleDO.getBusinessBaseSampleId()); - businessAssayTaskDataDO.setBusinessSubParentSampleId(businessSubSampleDO.getBusinessSubParentSampleId()); - businessAssayTaskDataDO.setBusinessSubSampleId(businessSubSampleDO.getId()); - businessAssayTaskDataDO.setBusinessSubSampleAssessmentId(businessSubSampleAssessmentDO.getId());//子样判定id - businessAssayTaskDataDO.setConfigAssayMethodId(addAssayTaskConfigAssayMethod.getId()); - businessAssayTaskDataDO.setAssayType(assayType); - businessAssayTaskDataDO.setTaskType("常规"); - businessAssayTaskDataDO.setConfigSampleFlowId(configSampleFlowSub.getId()); - businessAssayTaskDataDO.setSampleFlowNodeKey(sampleFlowNodeSub.getNodeKey()); - businessAssayTaskDataDO.setSampleFlowNodeTime(currentDateTime); - businessAssayTaskDataDO.setAssayDepartmentId(addAssayTaskConfigAssayMethod.getAssayDepartmentId()); - businessAssayTaskDataDO.setAssayDepartmentName(addAssayTaskConfigAssayMethod.getAssayDepartmentName()); - - List configAssayMethodProjectDOList = configAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(methodId)).collect(Collectors.toList()); - - StringBuilder assayProjectBuilder = new StringBuilder(); - - for (ConfigAssayMethodProjectDO configAssayMethodProjectDO : configAssayMethodProjectDOList) { - - //如果当前分析方法的项目不在当前检测项目中,则跳出循环继续 - if (!projectIdList.contains(configAssayMethodProjectDO.getDictionaryProjectId())) { - continue; - } - - DictionaryProjectDO dictionaryProject = dictionaryProjectList.stream().filter(f -> f.getId().equals(configAssayMethodProjectDO.getDictionaryProjectId())).findFirst().orElse(null); - assayProjectBuilder.append(dictionaryProject.getShowName()).append(","); - - - //检测项目 - BusinessAssayProjectDataDO businessAssayProjectDataDO = new BusinessAssayProjectDataDO(); - businessAssayProjectDataDO.setId(IdWorker.getId()); - businessAssayProjectDataDO.setBusinessAssayTaskDataId(businessAssayTaskDataDO.getId()); - businessAssayProjectDataDO.setConfigAssayMethodProjectId(configAssayMethodProjectDO.getId()); - businessAssayProjectDataDO.setDictionaryProjectId(configAssayMethodProjectDO.getDictionaryProjectId()); - businessAssayProjectDataDO.setDataType(configAssayMethodProjectDO.getDataType()); - businessAssayProjectDataDO.setDecimalPosition(configAssayMethodProjectDO.getDecimalPosition()); - businessAssayProjectDataDO.setUsage(QmsCommonConstant.ASSAY_PROJECT_USAGE_INGREDIENT); - businessAssayProjectDataDO.setMinimumLimitValue(configAssayMethodProjectDO.getMinimumLimitValue()); - businessAssayProjectDataDO.setIsEnabled(1); - businessAssayProjectDataDO.setIsNotAssessment(0); - - businessAssayProjectDataDOList.add(businessAssayProjectDataDO); - - List configAssayMethodProjectParameterDOList = configAssayMethodProjectParameterList.stream().filter(f -> f.getConfigAssayMethodProjectId().equals(configAssayMethodProjectDO.getId())).collect(Collectors.toList()); - for (ConfigAssayMethodProjectParameterDO configAssayMethodProjectParameterDO : configAssayMethodProjectParameterDOList) { - BusinessAssayParameterDataDO businessAssayParameterDataDO = new BusinessAssayParameterDataDO(); - businessAssayParameterDataDO.setId(IdWorker.getId()); - businessAssayParameterDataDO.setConfigAssayMethodProjectParameterId(configAssayMethodProjectParameterDO.getId()); - businessAssayParameterDataDO.setBusinessAssayProjectDataId(businessAssayProjectDataDO.getId()); - businessAssayParameterDataDO.setDictionaryParameterId(configAssayMethodProjectParameterDO.getDictionaryParameterId()); - businessAssayParameterDataDO.setDataType(configAssayMethodProjectParameterDO.getDataType()); - businessAssayParameterDataDO.setDecimalPosition(configAssayMethodProjectParameterDO.getDecimalPosition()); - - - businessAssayParameterDataDOList.add(businessAssayParameterDataDO); - } + //是否预报S值 + Boolean isForecastS = false; + String forecastResult = businessSampleEntrustDetailDO.getForecastResult(); + if (StringUtils.isNotBlank(forecastResult)) { + JSONArray array = JSON.parseArray(forecastResult); + for (int i = 0; i < array.size(); i++) { + JSONObject item = array.getJSONObject(i); + if ("S".equals(item.getString("simpleName"))) { + isForecastS = true; + break; } - - assayProjectBuilder.delete(assayProjectBuilder.length() - 1 , assayProjectBuilder.length()); - businessAssayTaskDataDO.setAssayProject(assayProjectBuilder.toString()); - businessAssayTaskDataDOList.add(businessAssayTaskDataDO); } - + } + + //如果是商检样分析,且为第一个商检分析样,并且包含要检测的项目, + if (QmsCommonConstant.ENTRUST_INSPECTION_ANALYSIS_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey()) && isAssayConditionProjectList && sjfxyOne == 0) { + addAssayTask(currentDateTime, configSubSampleMethodList, configAssayMethodProjectList, + configAssayMethodProjectParameterList, dictionaryProjectList, + businessSubParentSampleAssessmentDOList, businessSubSampleAnalysisGroupDOList, + businessSubSampleAssessmentDOList, businessAssayTaskDataDOList, + businessAssayProjectDataDOList, businessAssayParameterDataDOList, configSubSample, + configSampleFlowSub, sampleFlowNodeSub, businessSubSampleDO, methodId, + projectIdList); + } else if (QmsCommonConstant.ENTRUST_COMPREHENSIVE_INSPECTION_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey()) && isAssayConditionProjectList) {//如果是商检综合样,并且包含需检查的项目 + addAssayTask(currentDateTime, configSubSampleMethodList, configAssayMethodProjectList, + configAssayMethodProjectParameterList, dictionaryProjectList, + businessSubParentSampleAssessmentDOList, businessSubSampleAnalysisGroupDOList, + businessSubSampleAssessmentDOList, businessAssayTaskDataDOList, + businessAssayProjectDataDOList, businessAssayParameterDataDOList, configSubSample, + configSampleFlowSub, sampleFlowNodeSub, businessSubSampleDO, methodId, + projectIdList); + + } else if (QmsCommonConstant.ENTRUST_COMMISSION_INSPECTION_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey()) && isAssayConditionProjectList && !isForecastS ) {//如果是委检样,包含检测项目,未预报S值 + addAssayTask(currentDateTime, configSubSampleMethodList, configAssayMethodProjectList, + configAssayMethodProjectParameterList, dictionaryProjectList, + businessSubParentSampleAssessmentDOList, businessSubSampleAnalysisGroupDOList, + businessSubSampleAssessmentDOList, businessAssayTaskDataDOList, + businessAssayProjectDataDOList, businessAssayParameterDataDOList, configSubSample, + configSampleFlowSub, sampleFlowNodeSub, businessSubSampleDO, methodId, + projectIdList); } } } - + //分析班组 businessSubSampleAnalysisGroupDO = businessSubSampleAnalysisGroupDOList.stream().filter(f -> f.getBusinessSubSampleId().equals(businessSubSampleDO.getId()) && f.getAssayDepartmentId().equals(configAssayMethodDO.getAssayDepartmentId())).findFirst().orElse(null); if (businessSubSampleAnalysisGroupDO == null) { businessSubSampleAnalysisGroupDO = new BusinessSubSampleAnalysisGroupDO(); @@ -638,11 +533,11 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent { businessAssayTaskDataDO.setAssayDepartmentName(configAssayMethodDO.getAssayDepartmentName()); - List configAssayMethodProjectDOList = configAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(configAssayMethodId)).collect(Collectors.toList()); + List configAssayMethodProjectDOList = configAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(configAssayMethodId)).collect(Collectors.toList()); StringBuilder assayProjectBuilder = new StringBuilder(); - for (ConfigAssayMethodProjectDO configAssayMethodProjectDO : configAssayMethodProjectDOList) { + for (ConfigAssayMethodProjectExtendRespVO configAssayMethodProjectDO : configAssayMethodProjectDOList) { //如果当前分析方法的项目不在当前检测项目中,则跳出循环继续 if (!dictionaryProjectIdList.contains(configAssayMethodProjectDO.getDictionaryProjectId())) { @@ -661,9 +556,6 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent { businessAssayProjectDataDO.setDataType(configAssayMethodProjectDO.getDataType()); businessAssayProjectDataDO.setDecimalPosition(configAssayMethodProjectDO.getDecimalPosition()); businessAssayProjectDataDO.setUsage(QmsCommonConstant.ASSAY_PROJECT_USAGE_REPORT); -// if (isSjEntrust && isAssayAuAg && sort == 0 && !isCreateZhy && sDictionaryProjectId.equals(configAssayMethodProjectDO.getDictionaryProjectId())) {//是商检样品,分析金银,第一个样品,不创建综合样,并且是S值 -// businessAssayProjectDataDO.setUsage(QmsCommonConstant.ASSAY_PROJECT_USAGE_INGREDIENT_REPORT); -// } businessAssayProjectDataDO.setMinimumLimitValue(configAssayMethodProjectDO.getMinimumLimitValue()); businessAssayProjectDataDO.setIsEnabled(1); @@ -693,119 +585,11 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent { } } - - /** - //判定是商检 分析金银 需要创建综合样,样品为第1个 - if (isSjEntrust && isAssayAuAg && sort == 0 && isCreateZhy && configAssayMethodZhy != null) { - Long configAssayMethodIdZhy = configAssayMethodZhy.getId(); - Long assayDepartmentIdZhy = configAssayMethodZhy.getAssayDepartmentId(); - - //查询子样对应的分析方法 - ConfigSubSampleMethodDO configSubSampleMethodDO = configSubSampleMethodList.stream().filter(f -> f.getIsDefaultUse().equals(QmsCommonConstant.YES) && f.getConfigAssayMethodId().equals(configAssayMethodIdZhy) && f.getConfigSubSampleId().equals(configSubSample.getId())).findFirst().orElse(null); - - businessSubSampleAnalysisGroupDO = businessSubSampleAnalysisGroupDOList.stream().filter(f -> f.getBusinessSubSampleId().equals(businessSubSampleDO.getId()) && f.getAssayDepartmentId().equals(assayDepartmentIdZhy)).findFirst().orElse(null); - if (businessSubSampleAnalysisGroupDO == null) { - businessSubSampleAnalysisGroupDO = new BusinessSubSampleAnalysisGroupDO(); - businessSubSampleAnalysisGroupDO.setId(IdWorker.getId()); - businessSubSampleAnalysisGroupDO.setBusinessBaseSampleId(businessSubSampleDO.getBusinessBaseSampleId()); - businessSubSampleAnalysisGroupDO.setBusinessSubParentSampleId(businessSubSampleDO.getBusinessSubParentSampleId()); - businessSubSampleAnalysisGroupDO.setBusinessSubSampleId(businessSubSampleDO.getId()); - businessSubSampleAnalysisGroupDO.setAssayDepartmentId(configAssayMethodZhy.getAssayDepartmentId()); - businessSubSampleAnalysisGroupDO.setAssayDepartmentName(configAssayMethodZhy.getAssayDepartmentName()); - businessSubSampleAnalysisGroupDO.setSampleStatus("待收样"); - - businessSubSampleAnalysisGroupDOList.add(businessSubSampleAnalysisGroupDO); - } - - //根据任务数判断是平行还是 - String assayType = configSubSampleMethodDO.getTaskCount() > 1 ? QmsCommonConstant.ASSAY_TYPE_SINGLE_PARALLEL : QmsCommonConstant.ASSAY_TYPE_SINGLE_CUP; - - //分样判定数据 - BusinessSubParentSampleAssessmentDO businessSubParentSampleAssessmentDO = new BusinessSubParentSampleAssessmentDO(); - businessSubParentSampleAssessmentDO.setId(IdWorker.getId()); - businessSubParentSampleAssessmentDO.setBusinessSubParentSampleId(businessSubSampleDO.getBusinessSubParentSampleId()); - businessSubParentSampleAssessmentDO.setConfigAssayMethodId(configAssayMethodZhy.getId()); - businessSubParentSampleAssessmentDO.setAssayType(assayType); - businessSubParentSampleAssessmentDO.setTaskType("常规"); - businessSubParentSampleAssessmentDOList.add(businessSubParentSampleAssessmentDO); - - //子样判定数据 - BusinessSubSampleAssessmentDO businessSubSampleAssessmentDO = new BusinessSubSampleAssessmentDO(); - businessSubSampleAssessmentDO.setId(IdWorker.getId()); - businessSubSampleAssessmentDO.setBusinessBaseSampleId(businessSubSampleDO.getBusinessBaseSampleId()); - businessSubSampleAssessmentDO.setBusinessSubParentSampleId(businessSubSampleDO.getBusinessSubParentSampleId()); - businessSubSampleAssessmentDO.setBusinessSubParentSampleAssessmentId(businessSubParentSampleAssessmentDO.getId()); - businessSubSampleAssessmentDO.setBusinessSubSampleId(businessSubSampleDO.getId()); - businessSubSampleAssessmentDO.setConfigAssayMethodId(configAssayMethodZhy.getId()); - businessSubSampleAssessmentDO.setAssayType(assayType); - businessSubSampleAssessmentDO.setTaskType("常规"); - - businessSubSampleAssessmentDOList.add(businessSubSampleAssessmentDO); - - //根据检测方法循环 - BusinessAssayTaskDataDO businessAssayTaskDataDO = null; - //根据任务数循环 - for (int i = 0; i < configSubSampleMethodDO.getTaskCount(); i++) { - //子样检测任务 - businessAssayTaskDataDO = new BusinessAssayTaskDataDO(); - businessAssayTaskDataDO.setId(IdWorker.getId()); - businessAssayTaskDataDO.setBusinessBaseSampleId(businessSubSampleDO.getBusinessBaseSampleId()); - businessAssayTaskDataDO.setBusinessSubParentSampleId(businessSubSampleDO.getBusinessSubParentSampleId()); - businessAssayTaskDataDO.setBusinessSubSampleId(businessSubSampleDO.getId()); - businessAssayTaskDataDO.setBusinessSubSampleAssessmentId(businessSubSampleAssessmentDO.getId());//子样判定id - businessAssayTaskDataDO.setConfigAssayMethodId(configAssayMethodZhy.getId()); - businessAssayTaskDataDO.setAssayType(assayType); - businessAssayTaskDataDO.setTaskType("常规"); - businessAssayTaskDataDO.setConfigSampleFlowId(configSampleFlowSub.getId()); - businessAssayTaskDataDO.setSampleFlowNodeKey(sampleFlowNodeSub.getNodeKey()); - businessAssayTaskDataDO.setSampleFlowNodeTime(currentDateTime); - businessAssayTaskDataDO.setAssayDepartmentId(configAssayMethodZhy.getAssayDepartmentId()); - businessAssayTaskDataDO.setAssayDepartmentName(configAssayMethodZhy.getAssayDepartmentName()); - - - //查询S检测项目 - ConfigAssayMethodProjectDO configAssayMethodProjectDO = configAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(configAssayMethodIdZhy) && f.getDictionaryProjectId().equals(sDictionaryProjectId)).findFirst().orElse(null); - - - - //检测项目 - BusinessAssayProjectDataDO businessAssayProjectDataDO = new BusinessAssayProjectDataDO(); - businessAssayProjectDataDO.setId(IdWorker.getId()); - businessAssayProjectDataDO.setBusinessAssayTaskDataId(businessAssayTaskDataDO.getId()); - businessAssayProjectDataDO.setConfigAssayMethodProjectId(configAssayMethodProjectDO.getId()); - businessAssayProjectDataDO.setDictionaryProjectId(configAssayMethodProjectDO.getDictionaryProjectId()); - businessAssayProjectDataDO.setDataType(configAssayMethodProjectDO.getDataType()); - businessAssayProjectDataDO.setDecimalPosition(configAssayMethodProjectDO.getDecimalPosition()); - businessAssayProjectDataDO.setUsage(QmsCommonConstant.ASSAY_PROJECT_USAGE_INGREDIENT); - businessAssayProjectDataDO.setMinimumLimitValue(configAssayMethodProjectDO.getMinimumLimitValue()); - businessAssayProjectDataDO.setIsEnabled(1); - businessAssayProjectDataDO.setIsNotAssessment(0); - - businessAssayProjectDataDOList.add(businessAssayProjectDataDO); - - List configAssayMethodProjectParameterDOList = configAssayMethodProjectParameterList.stream().filter(f -> f.getConfigAssayMethodProjectId().equals(configAssayMethodProjectDO.getId())).collect(Collectors.toList()); - for (ConfigAssayMethodProjectParameterDO configAssayMethodProjectParameterDO : configAssayMethodProjectParameterDOList) { - BusinessAssayParameterDataDO businessAssayParameterDataDO = new BusinessAssayParameterDataDO(); - businessAssayParameterDataDO.setId(IdWorker.getId()); - businessAssayParameterDataDO.setConfigAssayMethodProjectParameterId(configAssayMethodProjectParameterDO.getId()); - businessAssayParameterDataDO.setBusinessAssayProjectDataId(businessAssayProjectDataDO.getId()); - businessAssayParameterDataDO.setDictionaryParameterId(configAssayMethodProjectParameterDO.getDictionaryParameterId()); - businessAssayParameterDataDO.setDataType(configAssayMethodProjectParameterDO.getDataType()); - businessAssayParameterDataDO.setDecimalPosition(configAssayMethodProjectParameterDO.getDecimalPosition()); - - - businessAssayParameterDataDOList.add(businessAssayParameterDataDO); - } - - businessAssayTaskDataDO.setAssayProject("S"); - businessAssayTaskDataDOList.add(businessAssayTaskDataDO); - } - } - **/ - sort++; } sampleEntrustRegistration.setRegistrationStatus(QmsCommonConstant.SUBMITTED); + sampleEntrustRegistration.setAssayStatus(QmsCommonConstant.UNCHECKED); + sampleEntrustRegistration.setDataStatus(QmsCommonConstant.UNRETURNED); sampleEntrustContext.setSampleFlowInfoList(sampleFlowInfoList); @@ -838,6 +622,7 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent { businessSubSampleAssessmentMapper.insertBatch(businessSubSampleAssessmentDOList); } if (CollUtil.isNotEmpty(businessAssayTaskDataDOList)) { + sampleEntrustRegistration.setTaskQuantity(businessAssayTaskDataDOList.size()); businessAssayTaskDataMapper.insertBatch(businessAssayTaskDataDOList); } if (CollUtil.isNotEmpty(businessAssayProjectDataDOList)) { @@ -851,4 +636,133 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent { } } + private void addAssayTask(LocalDateTime currentDateTime, List configSubSampleMethodList, + List configAssayMethodProjectList, + List configAssayMethodProjectParameterList, + List dictionaryProjectList, + List businessSubParentSampleAssessmentDOList, + List businessSubSampleAnalysisGroupDOList, + List businessSubSampleAssessmentDOList, + List businessAssayTaskDataDOList, + List businessAssayProjectDataDOList, + List businessAssayParameterDataDOList, ConfigSubSampleDO configSubSample, + ConfigSampleFlowDO configSampleFlowSub, SampleFlowNode sampleFlowNodeSub, + BusinessSubSampleDO businessSubSampleDO, Long methodId, List projectIdList) { + BusinessSubSampleAnalysisGroupDO businessSubSampleAnalysisGroupDO; + ConfigAssayMethodDO addAssayTaskConfigAssayMethod = configAssayMethodMapper.selectById(methodId); + Long addAssayTaskAssayDepartmentId = addAssayTaskConfigAssayMethod.getAssayDepartmentId(); + + //查询子样对应的分析方法 + ConfigSubSampleMethodDO addAssayTaskConfigSubSampleMethodDO = configSubSampleMethodList.stream().filter(f -> f.getIsDefaultUse().equals(QmsCommonConstant.YES) && f.getConfigAssayMethodId().equals(methodId) && f.getConfigSubSampleId().equals(configSubSample.getId())).findFirst().orElse(null); + + businessSubSampleAnalysisGroupDO = businessSubSampleAnalysisGroupDOList.stream().filter(f -> f.getBusinessSubSampleId().equals(businessSubSampleDO.getId()) && f.getAssayDepartmentId().equals(addAssayTaskAssayDepartmentId)).findFirst().orElse(null); + if (businessSubSampleAnalysisGroupDO == null) { + businessSubSampleAnalysisGroupDO = new BusinessSubSampleAnalysisGroupDO(); + businessSubSampleAnalysisGroupDO.setId(IdWorker.getId()); + businessSubSampleAnalysisGroupDO.setBusinessBaseSampleId(businessSubSampleDO.getBusinessBaseSampleId()); + businessSubSampleAnalysisGroupDO.setBusinessSubParentSampleId(businessSubSampleDO.getBusinessSubParentSampleId()); + businessSubSampleAnalysisGroupDO.setBusinessSubSampleId(businessSubSampleDO.getId()); + businessSubSampleAnalysisGroupDO.setAssayDepartmentId(addAssayTaskConfigAssayMethod.getAssayDepartmentId()); + businessSubSampleAnalysisGroupDO.setAssayDepartmentName(addAssayTaskConfigAssayMethod.getAssayDepartmentName()); + businessSubSampleAnalysisGroupDO.setSampleStatus("待收样"); + + businessSubSampleAnalysisGroupDOList.add(businessSubSampleAnalysisGroupDO); + } + + //根据任务数判断是平行还是 + String assayType = addAssayTaskConfigSubSampleMethodDO.getTaskCount() > 1 ? QmsCommonConstant.ASSAY_TYPE_SINGLE_PARALLEL : QmsCommonConstant.ASSAY_TYPE_SINGLE_CUP; + + //分样判定数据 + BusinessSubParentSampleAssessmentDO businessSubParentSampleAssessmentDO = new BusinessSubParentSampleAssessmentDO(); + businessSubParentSampleAssessmentDO.setId(IdWorker.getId()); + businessSubParentSampleAssessmentDO.setBusinessSubParentSampleId(businessSubSampleDO.getBusinessSubParentSampleId()); + businessSubParentSampleAssessmentDO.setConfigAssayMethodId(addAssayTaskConfigAssayMethod.getId()); + businessSubParentSampleAssessmentDO.setAssayType(assayType); + businessSubParentSampleAssessmentDO.setTaskType("常规"); + businessSubParentSampleAssessmentDOList.add(businessSubParentSampleAssessmentDO); + + //子样判定数据 + BusinessSubSampleAssessmentDO businessSubSampleAssessmentDO = new BusinessSubSampleAssessmentDO(); + businessSubSampleAssessmentDO.setId(IdWorker.getId()); + businessSubSampleAssessmentDO.setBusinessBaseSampleId(businessSubSampleDO.getBusinessBaseSampleId()); + businessSubSampleAssessmentDO.setBusinessSubParentSampleId(businessSubSampleDO.getBusinessSubParentSampleId()); + businessSubSampleAssessmentDO.setBusinessSubParentSampleAssessmentId(businessSubParentSampleAssessmentDO.getId()); + businessSubSampleAssessmentDO.setBusinessSubSampleId(businessSubSampleDO.getId()); + businessSubSampleAssessmentDO.setConfigAssayMethodId(addAssayTaskConfigAssayMethod.getId()); + businessSubSampleAssessmentDO.setAssayType(assayType); + businessSubSampleAssessmentDO.setTaskType("常规"); + + businessSubSampleAssessmentDOList.add(businessSubSampleAssessmentDO); + + //根据检测方法循环 + BusinessAssayTaskDataDO businessAssayTaskDataDO = null; + //根据任务数循环 + for (int i = 0; i < addAssayTaskConfigSubSampleMethodDO.getTaskCount(); i++) { + //子样检测任务 + businessAssayTaskDataDO = new BusinessAssayTaskDataDO(); + businessAssayTaskDataDO.setId(IdWorker.getId()); + businessAssayTaskDataDO.setBusinessBaseSampleId(businessSubSampleDO.getBusinessBaseSampleId()); + businessAssayTaskDataDO.setBusinessSubParentSampleId(businessSubSampleDO.getBusinessSubParentSampleId()); + businessAssayTaskDataDO.setBusinessSubSampleId(businessSubSampleDO.getId()); + businessAssayTaskDataDO.setBusinessSubSampleAssessmentId(businessSubSampleAssessmentDO.getId());//子样判定id + businessAssayTaskDataDO.setConfigAssayMethodId(addAssayTaskConfigAssayMethod.getId()); + businessAssayTaskDataDO.setAssayType(assayType); + businessAssayTaskDataDO.setTaskType("常规"); + businessAssayTaskDataDO.setConfigSampleFlowId(configSampleFlowSub.getId()); + businessAssayTaskDataDO.setSampleFlowNodeKey(sampleFlowNodeSub.getNodeKey()); + businessAssayTaskDataDO.setSampleFlowNodeTime(currentDateTime); + businessAssayTaskDataDO.setAssayDepartmentId(addAssayTaskConfigAssayMethod.getAssayDepartmentId()); + businessAssayTaskDataDO.setAssayDepartmentName(addAssayTaskConfigAssayMethod.getAssayDepartmentName()); + + List configAssayMethodProjectDOList = configAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(methodId)).collect(Collectors.toList()); + + StringBuilder assayProjectBuilder = new StringBuilder(); + + for (ConfigAssayMethodProjectExtendRespVO configAssayMethodProjectDO : configAssayMethodProjectDOList) { + + //如果当前分析方法的项目不在当前检测项目中,则跳出循环继续 + if (!projectIdList.contains(configAssayMethodProjectDO.getDictionaryProjectId())) { + continue; + } + + DictionaryProjectDO dictionaryProject = dictionaryProjectList.stream().filter(f -> f.getId().equals(configAssayMethodProjectDO.getDictionaryProjectId())).findFirst().orElse(null); + assayProjectBuilder.append(dictionaryProject.getShowName()).append(","); + + + //检测项目 + BusinessAssayProjectDataDO businessAssayProjectDataDO = new BusinessAssayProjectDataDO(); + businessAssayProjectDataDO.setId(IdWorker.getId()); + businessAssayProjectDataDO.setBusinessAssayTaskDataId(businessAssayTaskDataDO.getId()); + businessAssayProjectDataDO.setConfigAssayMethodProjectId(configAssayMethodProjectDO.getId()); + businessAssayProjectDataDO.setDictionaryProjectId(configAssayMethodProjectDO.getDictionaryProjectId()); + businessAssayProjectDataDO.setDataType(configAssayMethodProjectDO.getDataType()); + businessAssayProjectDataDO.setDecimalPosition(configAssayMethodProjectDO.getDecimalPosition()); + businessAssayProjectDataDO.setUsage(QmsCommonConstant.ASSAY_PROJECT_USAGE_INGREDIENT); + businessAssayProjectDataDO.setMinimumLimitValue(configAssayMethodProjectDO.getMinimumLimitValue()); + businessAssayProjectDataDO.setIsEnabled(1); + businessAssayProjectDataDO.setIsNotAssessment(0); + + businessAssayProjectDataDOList.add(businessAssayProjectDataDO); + + List configAssayMethodProjectParameterDOList = configAssayMethodProjectParameterList.stream().filter(f -> f.getConfigAssayMethodProjectId().equals(configAssayMethodProjectDO.getId())).collect(Collectors.toList()); + for (ConfigAssayMethodProjectParameterDO configAssayMethodProjectParameterDO : configAssayMethodProjectParameterDOList) { + BusinessAssayParameterDataDO businessAssayParameterDataDO = new BusinessAssayParameterDataDO(); + businessAssayParameterDataDO.setId(IdWorker.getId()); + businessAssayParameterDataDO.setConfigAssayMethodProjectParameterId(configAssayMethodProjectParameterDO.getId()); + businessAssayParameterDataDO.setBusinessAssayProjectDataId(businessAssayProjectDataDO.getId()); + businessAssayParameterDataDO.setDictionaryParameterId(configAssayMethodProjectParameterDO.getDictionaryParameterId()); + businessAssayParameterDataDO.setDataType(configAssayMethodProjectParameterDO.getDataType()); + businessAssayParameterDataDO.setDecimalPosition(configAssayMethodProjectParameterDO.getDecimalPosition()); + + + businessAssayParameterDataDOList.add(businessAssayParameterDataDO); + } + } + + assayProjectBuilder.delete(assayProjectBuilder.length() - 1 , assayProjectBuilder.length()); + businessAssayTaskDataDO.setAssayProject(assayProjectBuilder.toString()); + businessAssayTaskDataDOList.add(businessAssayTaskDataDO); + } + } + } diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/BaseSampleController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/BaseSampleController.java index 00e7fc2..4329898 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/BaseSampleController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/BaseSampleController.java @@ -99,6 +99,13 @@ public class BaseSampleController implements BusinessControllerMarker { PageResult pageResult = baseSampleService.getBaseSamplePage(pageReqVO); return success(BeanUtils.toBean(pageResult, BaseSampleRespVO.class)); } + + @GetMapping("/list") + @Operation(summary = "获得样品大类管理列表") + public CommonResult getBaseSampleList(BaseSamplePageReqVO reqVO) { + List list = baseSampleService.getBaseSampleList(reqVO); + return success(list); + } @GetMapping("/export-excel") @Operation(summary = "导出样品大类管理 Excel") diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/ConfigEntrustSourceSampleTypeController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/ConfigEntrustSourceSampleTypeController.java new file mode 100644 index 0000000..6c7da2e --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/ConfigEntrustSourceSampleTypeController.java @@ -0,0 +1,106 @@ +package com.zt.plat.module.qms.business.config.controller.admin; + +import org.springframework.web.bind.annotation.*; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import com.zt.plat.framework.business.interceptor.BusinessControllerMarker; + +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import jakarta.validation.constraints.*; +import jakarta.validation.*; +import jakarta.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO; +import com.zt.plat.framework.common.pojo.PageParam; +import com.zt.plat.framework.common.pojo.PageResult; +import com.zt.plat.framework.common.pojo.CommonResult; +import com.zt.plat.framework.common.util.object.BeanUtils; +import static com.zt.plat.framework.common.pojo.CommonResult.success; + +import com.zt.plat.framework.excel.core.util.ExcelUtils; +import com.zt.plat.module.qms.business.config.controller.vo.*; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigEntrustSourceSampleTypeDO; +import com.zt.plat.module.qms.business.config.service.ConfigEntrustSourceSampleTypeService; +import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog; +import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*; + +@Tag(name = "管理后台 - 检验委托来源与样品类型配置") +@RestController +@RequestMapping("/qms/config-entrust-source-sample-type") +@Validated +public class ConfigEntrustSourceSampleTypeController implements BusinessControllerMarker { + + + @Resource + private ConfigEntrustSourceSampleTypeService configEntrustSourceSampleTypeService; + + @PostMapping("/create") + @Operation(summary = "创建检验委托来源与样品类型配置") + @PreAuthorize("@ss.hasPermission('qms:config-entrust-source-sample-type:create')") + public CommonResult createConfigEntrustSourceSampleType(@Valid @RequestBody ConfigEntrustSourceSampleTypeSaveReqVO createReqVO) { + return success(configEntrustSourceSampleTypeService.createConfigEntrustSourceSampleType(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新检验委托来源与样品类型配置") + @PreAuthorize("@ss.hasPermission('qms:config-entrust-source-sample-type:update')") + public CommonResult updateConfigEntrustSourceSampleType(@Valid @RequestBody ConfigEntrustSourceSampleTypeSaveReqVO updateReqVO) { + configEntrustSourceSampleTypeService.updateConfigEntrustSourceSampleType(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除检验委托来源与样品类型配置") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('qms:config-entrust-source-sample-type:delete')") + public CommonResult deleteConfigEntrustSourceSampleType(@RequestParam("id") Long id) { + configEntrustSourceSampleTypeService.deleteConfigEntrustSourceSampleType(id); + return success(true); + } + + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除检验委托来源与样品类型配置") + @PreAuthorize("@ss.hasPermission('qms:config-entrust-source-sample-type:delete')") + public CommonResult deleteConfigEntrustSourceSampleTypeList(@RequestBody BatchDeleteReqVO req) { + configEntrustSourceSampleTypeService.deleteConfigEntrustSourceSampleTypeListByIds(req.getIds()); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得检验委托来源与样品类型配置") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('qms:config-entrust-source-sample-type:query')") + public CommonResult getConfigEntrustSourceSampleType(@RequestParam("id") Long id) { + ConfigEntrustSourceSampleTypeDO configEntrustSourceSampleType = configEntrustSourceSampleTypeService.getConfigEntrustSourceSampleType(id); + return success(BeanUtils.toBean(configEntrustSourceSampleType, ConfigEntrustSourceSampleTypeRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得检验委托来源与样品类型配置分页") + @PreAuthorize("@ss.hasPermission('qms:config-entrust-source-sample-type:query')") + public CommonResult> getConfigEntrustSourceSampleTypePage(@Valid ConfigEntrustSourceSampleTypePageReqVO pageReqVO) { + PageResult pageResult = configEntrustSourceSampleTypeService.getConfigEntrustSourceSampleTypePage(pageReqVO); + return success(BeanUtils.toBean(pageResult, ConfigEntrustSourceSampleTypeRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出检验委托来源与样品类型配置 Excel") + @PreAuthorize("@ss.hasPermission('qms:config-entrust-source-sample-type:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportConfigEntrustSourceSampleTypeExcel(@Valid ConfigEntrustSourceSampleTypePageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = configEntrustSourceSampleTypeService.getConfigEntrustSourceSampleTypePage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "检验委托来源与样品类型配置.xls", "数据", ConfigEntrustSourceSampleTypeRespVO.class, + BeanUtils.toBean(list, ConfigEntrustSourceSampleTypeRespVO.class)); + } + +} \ 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/config/controller/vo/BaseSamplePageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/BaseSamplePageReqVO.java index d5f78f4..c47e27b 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/BaseSamplePageReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/BaseSamplePageReqVO.java @@ -42,4 +42,9 @@ public class BaseSamplePageReqVO extends PageParam { @Schema(description = "检测标准数量") private String assayStandardCount; + @Schema(description = "检验委托来源配置ID", example = "321") + private Long configEntrustSourceId; + + @Schema(description = "委托类型,委托登记-entrust_registration、检验委托-entrust_inspection", example = "1") + private String entrustType; } \ 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/config/controller/vo/ConfigEntrustSourceSampleTypePageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigEntrustSourceSampleTypePageReqVO.java new file mode 100644 index 0000000..1d095c2 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigEntrustSourceSampleTypePageReqVO.java @@ -0,0 +1,35 @@ +package com.zt.plat.module.qms.business.config.controller.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.zt.plat.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 检验委托来源与样品类型配置分页 Request VO") +@Data +public class ConfigEntrustSourceSampleTypePageReqVO extends PageParam { + + @Schema(description = "检验委托来源配置ID", example = "321") + private Long configEntrustSourceId; + + @Schema(description = "样品类型_ID,字典表【T_DIC_BSN】样品类型:委检样、商检分析样、商检综合样、西南铜产品", example = "30057") + private Long dictionaryBusinessId; + + @Schema(description = "参数分组_Key,字典表【T_DIC_BSN】样品类型") + private String dictionaryBusinessKey; + + @Schema(description = "所属部门") + private String systemDepartmentCode; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "备注") + private String remark; + +} \ 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/config/controller/vo/ConfigEntrustSourceSampleTypeRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigEntrustSourceSampleTypeRespVO.java new file mode 100644 index 0000000..8f35c3c --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigEntrustSourceSampleTypeRespVO.java @@ -0,0 +1,43 @@ +package com.zt.plat.module.qms.business.config.controller.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 检验委托来源与样品类型配置 Response VO") +@Data +@ExcelIgnoreUnannotated +public class ConfigEntrustSourceSampleTypeRespVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2073") + @ExcelProperty("ID") + private Long id; + + @Schema(description = "检验委托来源配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "321") + @ExcelProperty("检验委托来源配置ID") + private Long configEntrustSourceId; + + @Schema(description = "样品类型_ID,字典表【T_DIC_BSN】样品类型:委检样、商检分析样、商检综合样、西南铜产品", requiredMode = Schema.RequiredMode.REQUIRED, example = "30057") + @ExcelProperty("样品类型_ID,字典表【T_DIC_BSN】样品类型:委检样、商检分析样、商检综合样、西南铜产品") + private Long dictionaryBusinessId; + + @Schema(description = "参数分组_Key,字典表【T_DIC_BSN】样品类型") + @ExcelProperty("参数分组_Key,字典表【T_DIC_BSN】样品类型") + private String dictionaryBusinessKey; + + @Schema(description = "所属部门") + @ExcelProperty("所属部门") + private String systemDepartmentCode; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "备注") + @ExcelProperty("备注") + private String remark; + +} \ 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/config/controller/vo/ConfigEntrustSourceSampleTypeSaveReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigEntrustSourceSampleTypeSaveReqVO.java new file mode 100644 index 0000000..ee2d798 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigEntrustSourceSampleTypeSaveReqVO.java @@ -0,0 +1,32 @@ +package com.zt.plat.module.qms.business.config.controller.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import jakarta.validation.constraints.*; + +@Schema(description = "管理后台 - 检验委托来源与样品类型配置新增/修改 Request VO") +@Data +public class ConfigEntrustSourceSampleTypeSaveReqVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2073") + private Long id; + + @Schema(description = "检验委托来源配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "321") + @NotEmpty(message = "检验委托来源配置ID不能为空") + private Long configEntrustSourceId; + + @Schema(description = "样品类型_ID,字典表【T_DIC_BSN】样品类型:委检样、商检分析样、商检综合样、西南铜产品", requiredMode = Schema.RequiredMode.REQUIRED, example = "30057") + @NotNull(message = "样品类型_ID,字典表【T_DIC_BSN】样品类型:委检样、商检分析样、商检综合样、西南铜产品不能为空") + private Long dictionaryBusinessId; + + @Schema(description = "参数分组_Key,字典表【T_DIC_BSN】样品类型") + private String dictionaryBusinessKey; + + @Schema(description = "所属部门") + private String systemDepartmentCode; + + @Schema(description = "备注") + private String remark; + +} \ 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/config/dal/dataobject/BaseSampleDO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/dataobject/BaseSampleDO.java index 9fd5436..1656e6e 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/dataobject/BaseSampleDO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/dataobject/BaseSampleDO.java @@ -52,10 +52,15 @@ public class BaseSampleDO extends BusinessBaseDO { @TableField("MTRL_NAME") private String materialName; /** - * 样品类型_ID,字典表【T_DIC_BSN】结算样、委检样、抽查样 + * 样品类型 */ @TableField("DIC_BSN_ID") private Long dictionaryBusinessId; + /** + * 样品类型key + */ + @TableField("DIC_BSN_KY") + private String dictionaryBusinessKey; /** * 所属部门 */ diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/dataobject/ConfigEntrustSourceSampleTypeDO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/dataobject/ConfigEntrustSourceSampleTypeDO.java new file mode 100644 index 0000000..412c862 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/dataobject/ConfigEntrustSourceSampleTypeDO.java @@ -0,0 +1,60 @@ +package com.zt.plat.module.qms.business.config.dal.dataobject; + +import lombok.*; +import java.util.*; + import java.time.LocalDateTime; + import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO; +/** +* 检验委托来源与样品类型配置 DO +* +* @author 后台管理 +*/ +@TableName("t_cfg_entt_src_smp_tp") +@KeySequence("t_cfg_entt_src_smp_tp_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +/** +* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO +*/ +public class ConfigEntrustSourceSampleTypeDO extends BusinessBaseDO { + + + + /** + * ID + */ + @TableId(type = IdType.ASSIGN_ID) + private Long id; + /** + * 检验委托来源配置ID + */ + @TableField("CFG_ENTT_SRC_ID") + private Long configEntrustSourceId; + /** + * 样品类型_ID,字典表【T_DIC_BSN】样品类型:委检样、商检分析样、商检综合样、西南铜产品 + */ + @TableField("DIC_BSN_ID") + private Long dictionaryBusinessId; + /** + * 参数分组_Key,字典表【T_DIC_BSN】样品类型 + */ + @TableField("DIC_BSN_KY") + private String dictionaryBusinessKey; + /** + * 所属部门 + */ + @TableField("SYS_DEPT_CD") + private String systemDepartmentCode; + /** + * 备注 + */ + @TableField("RMK") + private String remark; + +} \ 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/config/dal/mapper/BaseSampleMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/BaseSampleMapper.java index d208ce7..fab1519 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/BaseSampleMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/BaseSampleMapper.java @@ -1,10 +1,17 @@ package com.zt.plat.module.qms.business.config.dal.mapper; import com.zt.plat.framework.common.pojo.PageResult; +import com.zt.plat.framework.common.util.object.BeanUtils; import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX; import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; -import com.zt.plat.module.qms.business.config.controller.vo.BaseSamplePageReqVO; +import com.zt.plat.module.qms.business.config.controller.vo.*; import com.zt.plat.module.qms.business.config.dal.dataobject.BaseSampleDO; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigEntrustSourceSampleTypeDO; +import com.zt.plat.module.qms.enums.QmsCommonConstant; + +import cn.hutool.core.util.ObjectUtil; + import org.apache.ibatis.annotations.Mapper; import java.util.List; @@ -29,6 +36,28 @@ public interface BaseSampleMapper extends BaseMapperX { .eqIfPresent(BaseSampleDO::getRemark, reqVO.getRemark()) .orderByDesc(BaseSampleDO::getId)); } + + default List selectList(BaseSamplePageReqVO reqVO) { + LambdaQueryWrapperX queryWrapperX = new LambdaQueryWrapperX() + .likeIfPresent(BaseSampleDO::getName, reqVO.getName()) + .eqIfPresent(BaseSampleDO::getMaterialId, reqVO.getMaterialId()) + .eqIfPresent(BaseSampleDO::getMaterialCode, reqVO.getMaterialCode()) + .likeIfPresent(BaseSampleDO::getMaterialName, reqVO.getMaterialName()) + .eqIfPresent(BaseSampleDO::getDictionaryBusinessId, reqVO.getDictionaryBusinessId()) + .eqIfPresent(BaseSampleDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode()) + .betweenIfPresent(BaseSampleDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(BaseSampleDO::getRemark, reqVO.getRemark()); + if (ObjectUtil.isNotEmpty(reqVO.getConfigEntrustSourceId())) { + queryWrapperX.inSql(BaseSampleDO::getDictionaryBusinessId, "SELECT tcesst.DIC_BSN_ID FROM T_CFG_ENTT_SRC_SMP_TP tcesst WHERE tcesst.CFG_ENTT_SRC_ID = " + reqVO.getConfigEntrustSourceId()); + } + if (QmsCommonConstant.ENTRUST_INSPECTION.equals(reqVO.getEntrustType())) { + queryWrapperX.inSql(BaseSampleDO::getDictionaryBusinessId, "SELECT tcesst.DIC_BSN_ID FROM T_CFG_ENTT_SRC_SMP_TP tcesst LEFT JOIN T_CFG_ENTT_SRC tces ON tcesst.CFG_ENTT_SRC_ID = tces.ID WHERE tces.ENTT_TP = '" + reqVO.getEntrustType() + "'"); + } + + queryWrapperX.orderByDesc(BaseSampleDO::getId); + List list = selectList(queryWrapperX); + return BeanUtils.toBean(list, BaseSampleRespVO.class); + } List getBaseSampleListWithAssayStandardCount(); diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigAssayMethodMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigAssayMethodMapper.java index 03df34b..2b0dbeb 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigAssayMethodMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigAssayMethodMapper.java @@ -69,5 +69,6 @@ public interface ConfigAssayMethodMapper extends BaseMapperX .eqIfPresent(ConfigBaseSampleDO::getVersion, reqVO.getVersion()) .orderByDesc(ConfigBaseSampleDO::getId)); } + + default List selectByBaseSampleIds(List baseSampleIds) { + return selectList(new LambdaQueryWrapperX() + .in(ConfigBaseSampleDO::getBaseSampleId, baseSampleIds)); + } } \ 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/config/dal/mapper/ConfigEntrustSourceSampleTypeMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigEntrustSourceSampleTypeMapper.java new file mode 100644 index 0000000..dd2edad --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigEntrustSourceSampleTypeMapper.java @@ -0,0 +1,31 @@ +package com.zt.plat.module.qms.business.config.dal.mapper; + +import java.util.*; + +import com.zt.plat.framework.common.pojo.PageResult; +import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.zt.plat.module.qms.business.config.controller.vo.ConfigEntrustSourceSampleTypePageReqVO; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigEntrustSourceSampleTypeDO; +import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; +import org.apache.ibatis.annotations.Mapper; + +/** + * 检验委托来源与样品类型配置 Mapper + * + * @author 后台管理 + */ +@Mapper +public interface ConfigEntrustSourceSampleTypeMapper extends BaseMapperX { + + default PageResult selectPage(ConfigEntrustSourceSampleTypePageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(ConfigEntrustSourceSampleTypeDO::getConfigEntrustSourceId, reqVO.getConfigEntrustSourceId()) + .eqIfPresent(ConfigEntrustSourceSampleTypeDO::getDictionaryBusinessId, reqVO.getDictionaryBusinessId()) + .eqIfPresent(ConfigEntrustSourceSampleTypeDO::getDictionaryBusinessKey, reqVO.getDictionaryBusinessKey()) + .eqIfPresent(ConfigEntrustSourceSampleTypeDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode()) + .betweenIfPresent(ConfigEntrustSourceSampleTypeDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(ConfigEntrustSourceSampleTypeDO::getRemark, reqVO.getRemark()) + .orderByDesc(ConfigEntrustSourceSampleTypeDO::getId)); + } + +} \ 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/config/dal/mapper/ConfigSampleReportMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigSampleReportMapper.java index d38332e..5839b93 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigSampleReportMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigSampleReportMapper.java @@ -51,4 +51,9 @@ public interface ConfigSampleReportMapper extends BaseMapperX selectByConfigBaseSampleIds(List configBaseSampleIds) { + return selectList(new LambdaQueryWrapperX() + .in(ConfigSampleReportDO::getConfigBaseSampleId, configBaseSampleIds)); + } } \ 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/config/dal/mapper/ConfigSubSampleMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigSubSampleMapper.java index 96fd270..afdab78 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigSubSampleMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigSubSampleMapper.java @@ -6,6 +6,9 @@ import com.zt.plat.module.qms.business.config.controller.vo.*; import com.zt.plat.module.qms.business.config.controller.vo.ConfigSubSamplePageReqVO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigSubSampleDO; import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; + +import java.util.List; + import org.apache.ibatis.annotations.Mapper; /** @@ -39,5 +42,10 @@ public interface ConfigSubSampleMapper extends BaseMapperX { .eqIfPresent(ConfigSubSampleDO::getVersion, reqVO.getVersion()) .orderByDesc(ConfigSubSampleDO::getId)); } + + default List selectByBaseSampleIds(List baseSampleIds) { + return selectList(new LambdaQueryWrapperX() + .in(ConfigSubSampleDO::getBaseSampleId, baseSampleIds)); + } } \ 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/config/dal/mapper/ConfigSubSampleMethodMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigSubSampleMethodMapper.java index 7abb095..ee769be 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigSubSampleMethodMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigSubSampleMethodMapper.java @@ -59,5 +59,10 @@ public interface ConfigSubSampleMethodMapper extends BaseMapperX selectByConfigSubSampleIds(List configSubSampleIds) { + return selectList(new LambdaQueryWrapper() + .in(ConfigSubSampleMethodDO::getConfigSubSampleId, configSubSampleIds)); + } } \ 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/config/dal/mapper/ConfigSubSampleParentMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigSubSampleParentMapper.java index 128215f..4b7cc8b 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigSubSampleParentMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigSubSampleParentMapper.java @@ -6,6 +6,9 @@ import com.zt.plat.module.qms.business.config.controller.vo.*; import com.zt.plat.module.qms.business.config.controller.vo.ConfigSubSampleParentPageReqVO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigSubSampleParentDO; import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; + +import java.util.List; + import org.apache.ibatis.annotations.Mapper; /** @@ -30,5 +33,10 @@ public interface ConfigSubSampleParentMapper extends BaseMapperX selectByBaseSampleIds(List baseSampleIds) { + return selectList(new LambdaQueryWrapperX() + .in(ConfigSubSampleParentDO::getBaseSampleId, baseSampleIds)); + } } \ 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/config/service/BaseSampleService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/BaseSampleService.java index e67626b..bea9c10 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/BaseSampleService.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/BaseSampleService.java @@ -63,4 +63,11 @@ public interface BaseSampleService { */ PageResult getBaseSamplePage(BaseSamplePageReqVO pageReqVO); + /** + * 获得样品大类管理列表 + * @param reqVO + * @return + */ + List getBaseSampleList(BaseSamplePageReqVO reqVO); + } \ 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/config/service/BaseSampleServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/BaseSampleServiceImpl.java index f6fee31..2e3e788 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/BaseSampleServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/BaseSampleServiceImpl.java @@ -92,4 +92,9 @@ public class BaseSampleServiceImpl implements BaseSampleService { return baseSampleMapper.selectPage(pageReqVO); } + @Override + public List getBaseSampleList(BaseSamplePageReqVO reqVO) { + return baseSampleMapper.selectList(reqVO); + } + } \ 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/config/service/ConfigEntrustSourceSampleTypeService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigEntrustSourceSampleTypeService.java new file mode 100644 index 0000000..69224a5 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigEntrustSourceSampleTypeService.java @@ -0,0 +1,61 @@ +package com.zt.plat.module.qms.business.config.service; + +import java.util.*; +import jakarta.validation.*; +import com.zt.plat.framework.common.pojo.PageResult; +import com.zt.plat.module.qms.business.config.controller.vo.*; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigEntrustSourceSampleTypeDO; + +/** + * 检验委托来源与样品类型配置 Service 接口 + * + * @author 后台管理 + */ +public interface ConfigEntrustSourceSampleTypeService { + + /** + * 创建检验委托来源与样品类型配置 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + ConfigEntrustSourceSampleTypeRespVO createConfigEntrustSourceSampleType(@Valid ConfigEntrustSourceSampleTypeSaveReqVO createReqVO); + + /** + * 更新检验委托来源与样品类型配置 + * + * @param updateReqVO 更新信息 + */ + void updateConfigEntrustSourceSampleType(@Valid ConfigEntrustSourceSampleTypeSaveReqVO updateReqVO); + + /** + * 删除检验委托来源与样品类型配置 + * + * @param id 编号 + */ + void deleteConfigEntrustSourceSampleType(Long id); + + /** + * 批量删除检验委托来源与样品类型配置 + * + * @param ids 编号 + */ + void deleteConfigEntrustSourceSampleTypeListByIds(List ids); + + /** + * 获得检验委托来源与样品类型配置 + * + * @param id 编号 + * @return 检验委托来源与样品类型配置 + */ + ConfigEntrustSourceSampleTypeDO getConfigEntrustSourceSampleType(Long id); + + /** + * 获得检验委托来源与样品类型配置分页 + * + * @param pageReqVO 分页查询 + * @return 检验委托来源与样品类型配置分页 + */ + PageResult getConfigEntrustSourceSampleTypePage(ConfigEntrustSourceSampleTypePageReqVO pageReqVO); + +} \ 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/config/service/ConfigEntrustSourceSampleTypeServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigEntrustSourceSampleTypeServiceImpl.java new file mode 100644 index 0000000..ec2289b --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigEntrustSourceSampleTypeServiceImpl.java @@ -0,0 +1,91 @@ +package com.zt.plat.module.qms.business.config.service; + +import cn.hutool.core.collection.CollUtil; +import org.springframework.stereotype.Service; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import com.zt.plat.framework.common.pojo.PageResult; +import com.zt.plat.framework.common.pojo.PageParam; +import com.zt.plat.framework.common.util.object.BeanUtils; +import com.zt.plat.module.qms.business.config.controller.vo.*; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigEntrustSourceSampleTypeDO; +import com.zt.plat.module.qms.business.config.dal.mapper.ConfigEntrustSourceSampleTypeMapper; + +import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.zt.plat.framework.common.util.collection.CollectionUtils.convertList; +import static com.zt.plat.framework.common.util.collection.CollectionUtils.diffList; +import static com.zt.plat.module.qms.enums.ErrorCodeConstants.*; + +/** + * 检验委托来源与样品类型配置 Service 实现类 + * + * @author 后台管理 + */ +@Service +@Validated +public class ConfigEntrustSourceSampleTypeServiceImpl implements ConfigEntrustSourceSampleTypeService { + + @Resource + private ConfigEntrustSourceSampleTypeMapper configEntrustSourceSampleTypeMapper; + + @Override + public ConfigEntrustSourceSampleTypeRespVO createConfigEntrustSourceSampleType(ConfigEntrustSourceSampleTypeSaveReqVO createReqVO) { + // 插入 + ConfigEntrustSourceSampleTypeDO configEntrustSourceSampleType = BeanUtils.toBean(createReqVO, ConfigEntrustSourceSampleTypeDO.class); + configEntrustSourceSampleTypeMapper.insert(configEntrustSourceSampleType); + // 返回 + return BeanUtils.toBean(configEntrustSourceSampleType, ConfigEntrustSourceSampleTypeRespVO.class); + } + + @Override + public void updateConfigEntrustSourceSampleType(ConfigEntrustSourceSampleTypeSaveReqVO updateReqVO) { + // 校验存在 + validateConfigEntrustSourceSampleTypeExists(updateReqVO.getId()); + // 更新 + ConfigEntrustSourceSampleTypeDO updateObj = BeanUtils.toBean(updateReqVO, ConfigEntrustSourceSampleTypeDO.class); + configEntrustSourceSampleTypeMapper.updateById(updateObj); + } + + @Override + public void deleteConfigEntrustSourceSampleType(Long id) { + // 校验存在 + validateConfigEntrustSourceSampleTypeExists(id); + // 删除 + configEntrustSourceSampleTypeMapper.deleteById(id); + } + + @Override + public void deleteConfigEntrustSourceSampleTypeListByIds(List ids) { + // 校验存在 + validateConfigEntrustSourceSampleTypeExists(ids); + // 删除 + configEntrustSourceSampleTypeMapper.deleteByIds(ids); + } + + private void validateConfigEntrustSourceSampleTypeExists(List ids) { + List list = configEntrustSourceSampleTypeMapper.selectByIds(ids); + if (CollUtil.isEmpty(list) || list.size() != ids.size()) { + throw exception(CONFIG_ENTRUST_SOURCE_SAMPLE_TYPE_NOT_EXISTS); + } + } + + private void validateConfigEntrustSourceSampleTypeExists(Long id) { + if (configEntrustSourceSampleTypeMapper.selectById(id) == null) { + throw exception(CONFIG_ENTRUST_SOURCE_SAMPLE_TYPE_NOT_EXISTS); + } + } + + @Override + public ConfigEntrustSourceSampleTypeDO getConfigEntrustSourceSampleType(Long id) { + return configEntrustSourceSampleTypeMapper.selectById(id); + } + + @Override + public PageResult getConfigEntrustSourceSampleTypePage(ConfigEntrustSourceSampleTypePageReqVO pageReqVO) { + return configEntrustSourceSampleTypeMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file