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 08e832b..6866b9e 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 @@ -38,6 +38,8 @@ public interface ErrorCodeConstants { ErrorCode CONFIG_ASSAY_METHOD_NOT_EXISTS = new ErrorCode(1_032_050_000, "检测方法配置不存在"); ErrorCode CONFIG_ASSAY_METHOD_PROJECT_NOT_EXISTS = new ErrorCode(1_032_050_000, "检测方法分析项目配置不存在"); ErrorCode CONFIG_ASSAY_METHOD_PROJECT_RANGE_NOT_EXISTS = new ErrorCode(1_032_050_000, "检测方法分析项目区间不存在"); + ErrorCode CONFIG_ASSAY_METHOD_PROJECT_ASSESSMENT_NOT_EXISTS = new ErrorCode(1_032_050_000, "检测方法分析项目判定不存在"); + ErrorCode CONFIG_ASSAY_METHOD_PROJECT_COEFFICIENT_NOT_EXISTS = new ErrorCode(1_032_050_000, "检测方法分析项目补正系数不存在"); ErrorCode CONFIG_REPORT_FIELD_NOT_EXISTS = new ErrorCode(1_032_050_000, "报表字段配置不存在"); ErrorCode CONFIG_STANDARD_SAMPLE_TYPE_NOT_EXISTS = new ErrorCode(1_032_050_000, "标准样类型配置不存在"); ErrorCode CONFIG_STANDARD_SAMPLE_PROJECT_NOT_EXISTS = new ErrorCode(1_032_050_000, "标准样检测项目配置不存在"); @@ -55,6 +57,7 @@ public interface ErrorCodeConstants { ErrorCode CONFIG_WAREHOUSE_LOCATION_INFOMATION_NOT_EXISTS = new ErrorCode(1_032_050_000, "样品库位信息不存在"); ErrorCode CONFIG_SIMPLE_FLOW_RULE_NOT_EXISTS = new ErrorCode(1_032_050_000, "LiteFlow规则配置不存在"); ErrorCode CONFIG_SIMPLE_FLOW_CODE_NOT_EXISTS = new ErrorCode(1_032_050_000, "LiteFlow脚本配置不存在"); + ErrorCode CONFIG_RULE_NOT_EXISTS = new ErrorCode(1_032_050_000, "规则配置不存在"); ErrorCode BASE_SAMPLE_NOT_EXISTS = new ErrorCode(1_032_050_000, "样品大类管理不存在"); ErrorCode MATERIAL_ASSAY_STANDARD_DETAIL_NOT_EXISTS = new ErrorCode(1_032_050_000, "检测标准明细不存在"); diff --git a/zt-module-qms/zt-module-qms-server/pom.xml b/zt-module-qms/zt-module-qms-server/pom.xml index 798ba07..2f4659a 100644 --- a/zt-module-qms/zt-module-qms-server/pom.xml +++ b/zt-module-qms/zt-module-qms-server/pom.xml @@ -110,6 +110,12 @@ com.zt.plat zt-spring-boot-starter-test + + + com.vaadin.external.google + android-json + + 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 f2f4de2..f9fece6 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 @@ -13,6 +13,7 @@ import com.zt.plat.module.qms.business.bus.controller.vo.BusinessAssayTaskDataRe import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDataDO; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleDO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodDO; +import com.zt.plat.module.qms.enums.QmsCommonConstant; import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -25,11 +26,6 @@ import org.apache.ibatis.annotations.Param; @Mapper public interface BusinessAssayTaskDataMapper extends BaseMapperX { - - List selectUnAssayTaskGroupList(@Param("reqVO") BusinessAssayTaskDataReqVO reqVO); - - List selectUnAuditTaskGroupList(@Param("reqVO") BusinessAssayTaskDataReqVO reqVO); - default List selectList(BusinessAssayTaskDataReqVO reqVO) { return selectJoinList(BusinessAssayTaskDataExtendRespVO.class, new MPJLambdaWrapperX() .leftJoin(ConfigAssayMethodDO.class, ConfigAssayMethodDO::getId, BusinessAssayTaskDataDO::getConfigAssayMethodId) @@ -101,5 +97,45 @@ public interface BusinessAssayTaskDataMapper extends BaseMapperX selectUnAssayTaskGroupList(@Param("reqVO") BusinessAssayTaskDataReqVO reqVO); + + /** + * 查询未审核的分析任务分组 + * @param reqVO + * @return + */ + List selectUnAuditTaskGroupList(@Param("reqVO") BusinessAssayTaskDataReqVO reqVO); + + /** + * 根据任务分配单id查询分析任务 + * @param businessAssayTaskId 任务分配单id + * @return + */ + default List selectByBusinessAssayTaskId(Long businessAssayTaskId) { + return selectList(new LambdaQueryWrapperX() + .eq(BusinessAssayTaskDataDO::getBusinessAssayTaskId, businessAssayTaskId)); + } + + /** + * 查询是否上报的分析任务 + * @param excludeIds 排除的id列表 + * @param businessSubSampleId 子样id + * @param configAssayMethodId 分析方法id + * @param isReported 是否上报 + * @return + */ + default List selectIsReportedList(List excludeIds, Long businessSubSampleId, Long configAssayMethodId, Integer isReported) { + return selectList(new LambdaQueryWrapperX() + .notIn(BusinessAssayTaskDataDO::getId, excludeIds) + .eq(BusinessAssayTaskDataDO::getBusinessSubSampleId, businessSubSampleId) + .eq(BusinessAssayTaskDataDO::getConfigAssayMethodId, configAssayMethodId) + .eq(BusinessAssayTaskDataDO::getIsReported, isReported)); + } } \ 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/BusinessAssayTaskDetailMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayTaskDetailMapper.java index c44a8d6..8fb2a4f 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayTaskDetailMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayTaskDetailMapper.java @@ -3,9 +3,11 @@ package com.zt.plat.module.qms.business.bus.dal.mapper; import com.zt.plat.framework.common.pojo.PageResult; import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; import com.zt.plat.module.qms.business.bus.controller.vo.*; -import com.zt.plat.module.qms.business.bus.controller.vo.BusinessAssayTaskDetailPageReqVO; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDetailDO; import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; + +import java.util.List; + import org.apache.ibatis.annotations.Mapper; /** @@ -33,4 +35,9 @@ public interface BusinessAssayTaskDetailMapper extends BaseMapperX selectByBusinessAssayTaskId(Long businessAssayTaskId) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(BusinessAssayTaskDetailDO::getBusinessAssayTaskId, businessAssayTaskId)); + } + } \ 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/liteflow/sample/analysisaudit/SampleAnalysisProjectAssessmentCmp.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/analysisaudit/SampleAnalysisProjectAssessmentCmp.java new file mode 100644 index 0000000..3492f76 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/analysisaudit/SampleAnalysisProjectAssessmentCmp.java @@ -0,0 +1,35 @@ +package com.zt.plat.module.qms.business.bus.liteflow.sample.analysisaudit; + +import java.math.BigDecimal; +import java.util.List; + +import com.yomahub.liteflow.annotation.LiteflowComponent; +import com.yomahub.liteflow.core.NodeComponent; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectAssessmentDO; +import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodProjectAssessmentMapper; + +import jakarta.annotation.Resource; + +@LiteflowComponent(id = "sampleAnalysisProjectAssessmentCmp", name = "样品分析项目判定") +public class SampleAnalysisProjectAssessmentCmp extends NodeComponent { + + @Resource + private ConfigAssayMethodProjectAssessmentMapper configAssayMethodProjectAssessmentMapper; + + @Override + public void process() throws Exception { + + List configAssayMethodProjectAssessmentList = configAssayMethodProjectAssessmentMapper.selectList(); + + BigDecimal min_yc = BigDecimal.ZERO;//最小允差 + BigDecimal max_yc = BigDecimal.ZERO;//最大允差 + BigDecimal min_va = BigDecimal.ZERO;//最小值 + BigDecimal max_va = BigDecimal.ZERO;//最大值 + BigDecimal k = BigDecimal.ZERO;//斜率k + BigDecimal b = BigDecimal.ZERO;//纵截距b + BigDecimal c = BigDecimal.ZERO;//调整参数 + BigDecimal yc_value = BigDecimal.ZERO;//允差值 + + } + +} 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 7c37607..01fef7f 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 @@ -3,6 +3,7 @@ package com.zt.plat.module.qms.business.bus.liteflow.sample.entrust; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Comparator; +import java.util.Iterator; import java.util.List; import java.util.stream.Collectors; @@ -209,7 +210,7 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent { List configAssayMethodIdList = materialAssayStandardMethodList.stream().map(m -> m.getConfigAssayMethodId()).distinct().collect(Collectors.toList()); //查找子样配置 - List configSubSampleIdList = configSubSampleMethodList.stream().filter(f -> configAssayMethodIdList.contains(f.getConfigAssayMethodId())).map(m -> m.getConfigSubSampleId()).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 entrustConfigSubSampleList = configSubSampleList.stream().filter(f -> configSubSampleIdList.contains(f.getId()) && f.getBaseSampleId().equals(businessSampleEntrustDetailDO.getBaseSampleId())).distinct().collect(Collectors.toList()); @@ -309,11 +310,13 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent { //子样对应的分析班组 BusinessSubSampleAnalysisGroupDO businessSubSampleAnalysisGroupDO = null; - //根据检测方法循环 - BusinessAssayTaskDataDO businessAssayTaskDataDO = null; for (Long configAssayMethodId : configAssayMethodIdList) { + //查询分析方法 ConfigAssayMethodDO configAssayMethodDO = configAssayMethodList.stream().filter(f -> f.getId().equals(configAssayMethodId)).findFirst().orElse(null); + //查询子样对应的分析方法 + ConfigSubSampleMethodDO configSubSampleMethodDO = configSubSampleMethodList.stream().filter(f -> f.getIsDefaultUse().equals(QmsCommonConstant.YES) && f.getConfigAssayMethodId().equals(configAssayMethodId) && f.getConfigSubSampleId().equals(configSubSample.getId())).findFirst().orElse(null); + businessSubSampleAnalysisGroupDO = businessSubSampleAnalysisGroupDOList.stream().filter(f -> f.getAssayDepartmentId().equals(configAssayMethodDO.getAssayDepartmentId())).findFirst().orElse(null); if (businessSubSampleAnalysisGroupDO == null) { businessSubSampleAnalysisGroupDO = new BusinessSubSampleAnalysisGroupDO(); @@ -327,71 +330,80 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent { businessSubSampleAnalysisGroupDOList.add(businessSubSampleAnalysisGroupDO); } - - //子样检测任务 - businessAssayTaskDataDO = new BusinessAssayTaskDataDO(); - businessAssayTaskDataDO.setId(IdWorker.getId()); - businessAssayTaskDataDO.setBusinessBaseSampleId(businessSubSampleDO.getBusinessBaseSampleId()); - businessAssayTaskDataDO.setBusinessSubParentSampleId(businessSubSampleDO.getBusinessSubParentSampleId()); - businessAssayTaskDataDO.setBusinessSubSampleId(businessSubSampleDO.getId()); - businessAssayTaskDataDO.setConfigAssayMethodId(configAssayMethodId); - businessAssayTaskDataDO.setAssayType("单杯"); - businessAssayTaskDataDO.setTaskType("常规"); - businessAssayTaskDataDO.setConfigSampleFlowId(configSampleFlowSub.getId()); - businessAssayTaskDataDO.setSampleFlowNodeKey(sampleFlowNodeSub.getNodeKey()); - businessAssayTaskDataDO.setSampleFlowNodeTime(currentDateTime); - businessAssayTaskDataDO.setAssayDepartmentId(configAssayMethodDO.getAssayDepartmentId()); - businessAssayTaskDataDO.setAssayDepartmentName(configAssayMethodDO.getAssayDepartmentName()); - - - List configAssayMethodProjectDOList = configAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(configAssayMethodId)).collect(Collectors.toList()); - - StringBuilder assayProjectBuilder = new StringBuilder(); - - for (ConfigAssayMethodProjectDO configAssayMethodProjectDO : configAssayMethodProjectDOList) { - - //如果当前分析方法的项目不在当前检测项目中,则跳出循环继续 - if (!dictionaryProjectIdList.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.setIsEnabled(1); - businessAssayProjectDataDO.setIsNotAssessment(0); + //根据检测方法循环 + BusinessAssayTaskDataDO businessAssayTaskDataDO = null; + + //根据任务数判断是平行还是 + String assayType = configSubSampleMethodDO.getTaskCount() > 1 ? "平行" : "单杯"; + + //根据任务数循环 + 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.setConfigAssayMethodId(configAssayMethodId); + businessAssayTaskDataDO.setAssayType(assayType); + businessAssayTaskDataDO.setTaskType("常规"); + businessAssayTaskDataDO.setConfigSampleFlowId(configSampleFlowSub.getId()); + businessAssayTaskDataDO.setSampleFlowNodeKey(sampleFlowNodeSub.getNodeKey()); + businessAssayTaskDataDO.setSampleFlowNodeTime(currentDateTime); + businessAssayTaskDataDO.setAssayDepartmentId(configAssayMethodDO.getAssayDepartmentId()); + businessAssayTaskDataDO.setAssayDepartmentName(configAssayMethodDO.getAssayDepartmentName()); - 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()); + List configAssayMethodProjectDOList = configAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(configAssayMethodId)).collect(Collectors.toList()); + + StringBuilder assayProjectBuilder = new StringBuilder(); + + for (ConfigAssayMethodProjectDO configAssayMethodProjectDO : configAssayMethodProjectDOList) { + + //如果当前分析方法的项目不在当前检测项目中,则跳出循环继续 + if (!dictionaryProjectIdList.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.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); + } + - businessAssayParameterDataDOList.add(businessAssayParameterDataDO); } - - + assayProjectBuilder.delete(assayProjectBuilder.length() - 1 , assayProjectBuilder.length()); + businessAssayTaskDataDO.setAssayProject(assayProjectBuilder.toString()); + businessAssayTaskDataDOList.add(businessAssayTaskDataDO); } - - 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/bus/liteflow/sample/flow/SampleSubProcessUpdateCmp.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/flow/SampleSubProcessUpdateCmp.java index 6990ffc..4c4c455 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/flow/SampleSubProcessUpdateCmp.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/flow/SampleSubProcessUpdateCmp.java @@ -5,6 +5,7 @@ import java.util.List; import java.util.stream.Collectors; import com.alibaba.fastjson2.JSON; +import com.ql.util.express.ExpressRunner; import com.yomahub.liteflow.annotation.LiteflowComponent; import com.yomahub.liteflow.core.NodeComponent; @@ -24,6 +25,9 @@ public class SampleSubProcessUpdateCmp extends NodeComponent { // @Resource // private ConfigSubSampleService configSubSampleService; + @Resource + private ExpressRunner expressRunner; + @Resource private ConfigSampleFlowService configSampleFlowService; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/taskassign/SampleTaskAssignMethodCmp.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/taskassign/SampleTaskAssignMethodCmp.java new file mode 100644 index 0000000..9340860 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/taskassign/SampleTaskAssignMethodCmp.java @@ -0,0 +1,153 @@ +package com.zt.plat.module.qms.business.bus.liteflow.sample.taskassign; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +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.mybatis.core.query.LambdaQueryWrapperX; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDO; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDataDO; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDetailDO; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleDO; +import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayTaskDataMapper; +import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessSubSampleMapper; +import com.zt.plat.module.qms.business.bus.liteflow.param.AssignAssayUser; +import com.zt.plat.module.qms.business.bus.liteflow.slot.SampleTaskAssignContext; +import com.zt.plat.module.qms.business.bus.liteflow.slot.SampleTaskAssignTypeEnum; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodDO; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigReportTemplateDO; +import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodMapper; +import com.zt.plat.module.qms.business.config.dal.mapper.ConfigReportTemplateMapper; +import com.zt.plat.module.qms.core.code.SequenceUtil; +import com.zt.plat.module.qms.enums.QmsCommonConstant; +import jakarta.annotation.Resource; + +/** + * SampleTaskAssignMethodCmp + *

+ * 更新历史: + *

 版本         更新时间            更新者        更新内容
+ * V1.0 2025年9月20日 wxr Add
+ * Copyright (C) 云南志者竟成科技有限公司 + *

+ * @author 王兴荣 + * @version V1.0 + * @since 2025年9月20日 + */ +@LiteflowComponent(id = "sampleTaskAssignMethodCmp", name = "按分析方法分配") +public class SampleTaskAssignMethodCmp extends NodeComponent { + + @Resource + private SequenceUtil sequenceUtil; + + @Resource + private ConfigAssayMethodMapper configAssayMethodMapper; + + @Resource + private ConfigReportTemplateMapper configReportTemplateMapper; + + @Resource + private BusinessAssayTaskDataMapper businessAssayTaskDataMapper; + + @Resource + private BusinessSubSampleMapper businessSubSampleMapper; + + @Override + public void process() throws Exception { + SampleTaskAssignContext sampleTaskAssignContext = this.getContextBean(SampleTaskAssignContext.class); + String loginRealname = sampleTaskAssignContext.getLoginRealname(); + LocalDateTime currentDateTime = sampleTaskAssignContext.getCurrentDateTime(); + Long assignConfigAssayMethodId = sampleTaskAssignContext.getAssignConfigAssayMethodId(); + List assignAssayUserList = sampleTaskAssignContext.getAssignAssayUserList(); + //查询分析方法配置 + ConfigAssayMethodDO configAssayMethod = configAssayMethodMapper.selectById(assignConfigAssayMethodId); + List configAssayMethodList = sampleTaskAssignContext.getConfigAssayMethodList(); + if (CollUtil.isEmpty(configAssayMethodList)) { + configAssayMethodList = new ArrayList<>(); + configAssayMethodList.add(configAssayMethod); + } + //查询报表模板 + ConfigReportTemplateDO configReportTemplate = configReportTemplateMapper.selectLatestConfigReportTemplateByKey(configAssayMethod.getConfigReportTemplateKey()); + + List businessAssayTaskDataDOList = businessAssayTaskDataMapper.selectList(new LambdaQueryWrapperX().eq(BusinessAssayTaskDataDO::getConfigAssayMethodId, assignConfigAssayMethodId).eq(BusinessAssayTaskDataDO::getIsAssignTasked, QmsCommonConstant.NO)); + + List businessSubSampleIdList = businessAssayTaskDataDOList.stream().map(m -> m.getBusinessSubSampleId()).collect(Collectors.toList()); + List businessSubSampleList = businessSubSampleMapper.selectByIds(businessSubSampleIdList); + sampleTaskAssignContext.setBusinessSubSampleList(businessSubSampleList); + + List businessAssayTaskDataList = new ArrayList<>(); + + //任务分配单 + List businessAssayTaskList = new ArrayList<>(); + //任务分配单明细 + List businessAssayTaskDetailList = new ArrayList<>(); + + //循环分析人员分配任务 + for (AssignAssayUser assignAssayUser : assignAssayUserList) { + Integer sampleNum = assignAssayUser.getSampleNum(); + + String taskNo = sequenceUtil.genCode(configAssayMethod.getCodeRule()); + + BusinessAssayTaskDO businessAssayTaskDO = new BusinessAssayTaskDO(); + businessAssayTaskDO.setId(IdWorker.getId()); + businessAssayTaskDO.setTaskNo(taskNo); + businessAssayTaskDO.setTaskName(configAssayMethod.getName()); + businessAssayTaskDO.setConfigAssayMethodId(assignConfigAssayMethodId); + businessAssayTaskDO.setAssayOperator(assignAssayUser.getRealName()); + businessAssayTaskDO.setTaskOperator(loginRealname); + businessAssayTaskDO.setTaskOperatorTime(currentDateTime); + businessAssayTaskDO.setTaskStatus("in_progress"); + businessAssayTaskDO.setTaskSourceType("分配"); + businessAssayTaskDO.setConfigReportTemplateId(configReportTemplate.getId()); + businessAssayTaskDO.setConfigReportTemplateKey(configReportTemplate.getKey()); + + BusinessAssayTaskDetailDO businessAssayTaskDetailDO = null; + for (int i = 0; i < sampleNum; i++) { + BusinessAssayTaskDataDO businessAssayTaskDataDO = businessAssayTaskDataDOList.get(0); + businessAssayTaskDataDO.setIsAssignTasked(QmsCommonConstant.YES); + businessAssayTaskDataDO.setAssignTaskTime(currentDateTime); + businessAssayTaskDataDO.setAssayOperator(assignAssayUser.getRealName()); + businessAssayTaskDataDO.setBusinessAssayTaskId(businessAssayTaskDO.getId()); + + BusinessSubSampleDO businessSubSampleDO = sampleTaskAssignContext.getBusinessSubSampleById(businessAssayTaskDataDO.getBusinessSubSampleId()); + + businessAssayTaskDetailDO = new BusinessAssayTaskDetailDO(); + businessAssayTaskDetailDO.setBusinessAssayTaskId(businessAssayTaskDO.getId()); + businessAssayTaskDetailDO.setTaskNo(taskNo); + businessAssayTaskDetailDO.setSampleId(businessAssayTaskDataDO.getBusinessSubSampleId()); + businessAssayTaskDetailDO.setSampleCode(businessSubSampleDO.getSampleAssayCode()); + businessAssayTaskDetailDO.setSampleName(businessSubSampleDO.getSampleName()); + businessAssayTaskDetailDO.setDataSourceType("正常"); + businessAssayTaskDetailDO.setSortNo(i+1); + + + businessAssayTaskDetailList.add(businessAssayTaskDetailDO); + + businessAssayTaskDataList.add(businessAssayTaskDataDO); + + //移除当前对象 + businessAssayTaskDataDOList.remove(businessAssayTaskDataDO); + + } + businessAssayTaskList.add(businessAssayTaskDO); + } + sampleTaskAssignContext.setBusinessAssayTaskList(businessAssayTaskList); + sampleTaskAssignContext.setBusinessAssayTaskDetailList(businessAssayTaskDetailList); + sampleTaskAssignContext.setBusinessAssayTaskDataList(businessAssayTaskDataList); + + + } + + @Override + public boolean isAccess() { + SampleTaskAssignContext sampleTaskAssignContext = this.getContextBean(SampleTaskAssignContext.class); + return sampleTaskAssignContext.getSampleTaskAssignType().equals(SampleTaskAssignTypeEnum.ASSAY_METHOD); + } + +} diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/taskassign/SampleTaskAssignSampleCmp.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/taskassign/SampleTaskAssignSampleCmp.java new file mode 100644 index 0000000..4f5c351 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/taskassign/SampleTaskAssignSampleCmp.java @@ -0,0 +1,145 @@ +package com.zt.plat.module.qms.business.bus.liteflow.sample.taskassign; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.yomahub.liteflow.annotation.LiteflowComponent; +import com.yomahub.liteflow.core.NodeComponent; +import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDO; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDataDO; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDetailDO; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleDO; +import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayTaskDataMapper; +import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessSubSampleMapper; +import com.zt.plat.module.qms.business.bus.liteflow.param.AssignAssayUser; +import com.zt.plat.module.qms.business.bus.liteflow.slot.SampleTaskAssignContext; +import com.zt.plat.module.qms.business.bus.liteflow.slot.SampleTaskAssignTypeEnum; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodDO; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigReportTemplateDO; +import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodMapper; +import com.zt.plat.module.qms.business.config.dal.mapper.ConfigReportTemplateMapper; +import com.zt.plat.module.qms.core.code.SequenceUtil; +import com.zt.plat.module.qms.enums.QmsCommonConstant; +import jakarta.annotation.Resource; + +/** + * SampleTaskAssignSampleCmp + *

+ * 更新历史: + *

 版本         更新时间            更新者        更新内容
+ * V1.0 2025年9月20日 wxr Add
+ * Copyright (C) 云南志者竟成科技有限公司 + *

+ * @author 王兴荣 + * @version V1.0 + * @since 2025年9月20日 + */ +@LiteflowComponent(id = "sampleTaskAssignSampleCmp", name = "按样品分配") +public class SampleTaskAssignSampleCmp extends NodeComponent { + + @Resource + private SequenceUtil sequenceUtil; + + @Resource + private ConfigAssayMethodMapper configAssayMethodMapper; + + @Resource + private ConfigReportTemplateMapper configReportTemplateMapper; + + @Resource + private BusinessAssayTaskDataMapper businessAssayTaskDataMapper; + + @Resource + private BusinessSubSampleMapper businessSubSampleMapper; + + @Override + public void process() throws Exception { + SampleTaskAssignContext sampleTaskAssignContext = this.getContextBean(SampleTaskAssignContext.class); + String loginRealname = sampleTaskAssignContext.getLoginRealname(); + LocalDateTime currentDateTime = sampleTaskAssignContext.getCurrentDateTime(); + AssignAssayUser assignAssayUser = sampleTaskAssignContext.getAssignAssayUser(); + List assignSampleIdList = sampleTaskAssignContext.getAssignSampleIdList(); + //根据分配的样品id查询分析任务数据 + List businessAssayTaskDataList = businessAssayTaskDataMapper.selectList(new LambdaQueryWrapperX().in(BusinessAssayTaskDataDO::getBusinessSubSampleId, assignSampleIdList).eq(BusinessAssayTaskDataDO::getIsAssignTasked, QmsCommonConstant.NO)); + List configAssayMethodIdList = businessAssayTaskDataList.stream().map(m -> m.getConfigAssayMethodId()).distinct().collect(Collectors.toList()); + List configAssayMethodList = configAssayMethodMapper.selectByIds(configAssayMethodIdList); + sampleTaskAssignContext.setConfigAssayMethodList(configAssayMethodList); + + //查询子样 + List businessSubSampleList = businessSubSampleMapper.selectByIds(assignSampleIdList); + sampleTaskAssignContext.setBusinessSubSampleList(businessSubSampleList); + + //任务分配单 + List businessAssayTaskList = new ArrayList<>(); + //任务分配单明细 + List businessAssayTaskDetailList = new ArrayList<>(); + + //按分析方法分组 + Map> groupBusinessAssayTaskDataListMap = businessAssayTaskDataList.stream().collect(Collectors.groupingBy(BusinessAssayTaskDataDO::getConfigAssayMethodId)); + for (Map.Entry> entry : groupBusinessAssayTaskDataListMap.entrySet()) { + long key = entry.getKey(); + ConfigAssayMethodDO configAssayMethod = sampleTaskAssignContext.getConfigAssayMethodById(key); + //查询报表模板 + ConfigReportTemplateDO configReportTemplate = configReportTemplateMapper.selectLatestConfigReportTemplateByKey(configAssayMethod.getConfigReportTemplateKey()); + + String taskNo = sequenceUtil.genCode(configAssayMethod.getCodeRule()); + + BusinessAssayTaskDO businessAssayTaskDO = new BusinessAssayTaskDO(); + businessAssayTaskDO.setId(IdWorker.getId()); + businessAssayTaskDO.setTaskNo(taskNo); + businessAssayTaskDO.setTaskName(configAssayMethod.getName()); + businessAssayTaskDO.setAssayOperator(assignAssayUser.getRealName()); + businessAssayTaskDO.setTaskOperator(loginRealname); + businessAssayTaskDO.setTaskOperatorTime(currentDateTime); + businessAssayTaskDO.setConfigAssayMethodId(key); + businessAssayTaskDO.setTaskStatus("in_progress"); + businessAssayTaskDO.setTaskSourceType("分配"); + businessAssayTaskDO.setConfigReportTemplateId(configReportTemplate.getId()); + businessAssayTaskDO.setConfigReportTemplateKey(configReportTemplate.getKey()); + + BusinessAssayTaskDetailDO businessAssayTaskDetailDO = null; + List valList = entry.getValue(); + + int sort = 1; + for (BusinessAssayTaskDataDO val : valList) { + val.setIsAssignTasked(QmsCommonConstant.YES); + val.setAssignTaskTime(currentDateTime); + val.setAssayOperator(assignAssayUser.getRealName()); + val.setBusinessAssayTaskId(businessAssayTaskDO.getId()); + + BusinessSubSampleDO businessSubSampleDO = sampleTaskAssignContext.getBusinessSubSampleById(val.getBusinessSubSampleId()); + + businessAssayTaskDetailDO = new BusinessAssayTaskDetailDO(); + businessAssayTaskDetailDO.setBusinessAssayTaskId(businessAssayTaskDO.getId()); + businessAssayTaskDetailDO.setTaskNo(taskNo); + businessAssayTaskDetailDO.setSampleId(val.getBusinessSubSampleId()); + businessAssayTaskDetailDO.setSampleCode(businessSubSampleDO.getSampleAssayCode()); + businessAssayTaskDetailDO.setSampleName(businessSubSampleDO.getSampleName()); + businessAssayTaskDetailDO.setDataSourceType("正常"); + businessAssayTaskDetailDO.setSortNo(sort); + sort++; + + + businessAssayTaskDetailList.add(businessAssayTaskDetailDO); + } + + businessAssayTaskList.add(businessAssayTaskDO); + } + + sampleTaskAssignContext.setBusinessAssayTaskDataList(businessAssayTaskDataList); + sampleTaskAssignContext.setBusinessAssayTaskList(businessAssayTaskList); + sampleTaskAssignContext.setBusinessAssayTaskDetailList(businessAssayTaskDetailList); + } + + @Override + public boolean isAccess() { + SampleTaskAssignContext sampleTaskAssignContext = this.getContextBean(SampleTaskAssignContext.class); + return sampleTaskAssignContext.getSampleTaskAssignType().equals(SampleTaskAssignTypeEnum.SAMPLE); + } + +} 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 61c2f02..971c0cc 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 @@ -1,12 +1,28 @@ package com.zt.plat.module.qms.business.bus.service; +import java.math.BigDecimal; +import java.math.RoundingMode; import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; import org.springframework.stereotype.Service; +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.dal.dataobject.BusinessAssayProjectDataDO; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDO; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDataDO; +import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayProjectDataMapper; +import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayTaskDataMapper; +import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayTaskDetailMapper; import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayTaskMapper; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectAssessmentDO; +import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodProjectAssessmentMapper; +import com.zt.plat.module.qms.core.qlexpress.cmp.AllowanceCalculatorComponent; import com.zt.plat.module.qms.enums.QmsCommonConstant; import jakarta.annotation.Resource; @@ -25,8 +41,26 @@ import jakarta.annotation.Resource; @Service public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditService { + @Resource + private ExpressRunner expressRunner; + + @Resource + private AllowanceCalculatorComponent allowanceCalculatorComponent; + @Resource private BusinessAssayTaskMapper businessAssayTaskMapper; + + @Resource + private BusinessAssayTaskDetailMapper businessAssayTaskDetailMapper; + + @Resource + private BusinessAssayTaskDataMapper businessAssayTaskDataMapper; + + @Resource + private BusinessAssayProjectDataMapper businessAssayProjectDataMapper; + + @Resource + private ConfigAssayMethodProjectAssessmentMapper configAssayMethodProjectAssessmentMapper; @Override public void crossAuditByByTaskId(Long businessAssayTaskId, String auditStatus) { @@ -37,11 +71,185 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic businessAssayTaskDO.setFlowStatus(QmsCommonConstant.APPROVED); businessAssayTaskDO.setReportTime(LocalDateTime.now()); businessAssayTaskDO.setReportOperator(SecurityFrameworkUtils.getLoginUserNickname()); + + //List businessAssayTaskDetailDOList = businessAssayTaskDetailMapper.selectByBusinessAssayTaskId(businessAssayTaskId); + + //查询分析任务明细 + List businessAssayTaskDataDOList = businessAssayTaskDataMapper.selectByBusinessAssayTaskId(businessAssayTaskId); + + Map> businessAssayTaskDataDOMap = businessAssayTaskDataDOList.stream().collect(Collectors.groupingBy(BusinessAssayTaskDataDO::getBusinessSubSampleId)); + for (Map.Entry> businessAssayTaskDataDOMapEntry : businessAssayTaskDataDOMap.entrySet()) { + //Long key = businessAssayTaskDataDOMapEntry.getKey(); + List businessAssayTaskDataList = businessAssayTaskDataDOMapEntry.getValue(); + List businessAssayTaskDataIdList = businessAssayTaskDataList.stream().map(m -> m.getId()).collect(Collectors.toList()); + BusinessAssayTaskDataDO businessAssayTaskDataDO = businessAssayTaskDataList.get(0); + + if ("平行".equals(businessAssayTaskDataDO.getAssayType())) { + //根据子样id及分析方法id,查询未上报的分析任务 + List unReportedList = businessAssayTaskDataMapper.selectIsReportedList(businessAssayTaskDataIdList, businessAssayTaskDataDO.getBusinessSubSampleId(), businessAssayTaskDataDO.getConfigAssayMethodId(), QmsCommonConstant.NO); + if (unReportedList.size() > 0) {//还有未上报数据,直接处理,无需判定 + continue; + } else {//做超差判定 + //根据子样id及分析方法id,查询已上报的分析任务 + List reportedList = businessAssayTaskDataMapper.selectIsReportedList(businessAssayTaskDataIdList, businessAssayTaskDataDO.getBusinessSubSampleId(), businessAssayTaskDataDO.getConfigAssayMethodId(), QmsCommonConstant.YES); + if (reportedList.size() > 0) { + List reportedBusinessAssayTaskDataIdList = reportedList.stream().map(m -> m.getId()).collect(Collectors.toList()); + businessAssayTaskDataIdList.addAll(reportedBusinessAssayTaskDataIdList); + } + + //查询分析项目 + List businessAssayProjectDataDOList = businessAssayProjectDataMapper.selectList(new LambdaQueryWrapperX().in(BusinessAssayProjectDataDO::getBusinessAssayTaskDataId, businessAssayTaskDataIdList)); + Map> businessAssayProjectDataDOMap = businessAssayProjectDataDOList.stream().collect(Collectors.groupingBy(BusinessAssayProjectDataDO::getDictionaryProjectId)); + for (Map.Entry> entry1 : businessAssayProjectDataDOMap.entrySet()) { + Long dictionaryProjectId = entry1.getKey(); + List val1 = entry1.getValue(); + BusinessAssayProjectDataDO businessAssayProjectDataDO = val1.get(0); + List configAssayMethodProjectAssessmentDOList = configAssayMethodProjectAssessmentMapper.selectList(new LambdaQueryWrapperX().eq(ConfigAssayMethodProjectAssessmentDO::getConfigAssayMethodId, businessAssayTaskDataDO.getConfigAssayMethodId()).eq(ConfigAssayMethodProjectAssessmentDO::getConfigAssayMethodProjectId, businessAssayProjectDataDO.getConfigAssayMethodProjectId())); + + + // 排序并处理 null + List sortedValues = val1.stream() + .map(v -> { + String val = v.getValue(); + return val == null || val.trim().isEmpty() ? BigDecimal.ZERO : new BigDecimal(val.trim()); + }) + .sorted() + .collect(Collectors.toList()); + + // 获取小数精度 + int elementScale = businessAssayProjectDataDO.getDecimalPosition(); + // 计算代表值(均值或差值) + BigDecimal representativeValue = calculateRepresentativeValue(sortedValues); + + // 查找匹配的允差规则 + ConfigAssayMethodProjectAssessmentDO matchedRule = findMatchingRule(configAssayMethodProjectAssessmentDOList, representativeValue); + if (matchedRule == null) { + throw new ServiceException(500, "未找到超差判定区间范围,元素ID: " + dictionaryProjectId + ", 值: " + representativeValue); + } + + // 计算允差值 + BigDecimal allowValue; + try { + allowValue = allowanceCalculatorComponent.calculateAllowableValue(new BigDecimal(matchedRule.getMinimumValue()), new BigDecimal(matchedRule.getMaximumValue()), new BigDecimal(matchedRule.getMinimumToleraanceValue()), new BigDecimal(matchedRule.getMaximumToleraanceValue()), new BigDecimal(matchedRule.getToleraanceAdjustmentValue()), representativeValue, matchedRule.getIsUseFormula(), matchedRule.getFormula(), elementScale); + } catch (Exception e) { + throw new ServiceException(500, "超差判定计算出错,检测项目ID: " + dictionaryProjectId); + } + + // 判断相邻差值是否超差 + for (int i = 0; i < sortedValues.size() - 1; i++) { + BigDecimal diff = sortedValues.get(i + 1).subtract(sortedValues.get(i)).abs(); + if (diff.compareTo(allowValue) > 0) { + + } + } + + + + } + + + + + + + + + + + + + + + + + + + + + + } + + + } else if ("双杯".equals(businessAssayTaskDataDO.getAssayType())) { + + } else {//单杯 + + } + + + } + +// for (BusinessAssayTaskDataDO businessAssayTaskDataDO : businessAssayTaskDataDOList) { +// if ("平行".equals(businessAssayTaskDataDO.getAssayType())) { +// //判定检查项目是否都已上报 +// +// +// } +// +// +// +// } + + + + + + + + + + + + + + } else { businessAssayTaskDO.setFinishStatus(QmsCommonConstant.PENDING); businessAssayTaskDO.setFlowStatus(QmsCommonConstant.NOT_START); } businessAssayTaskMapper.updateById(businessAssayTaskDO); } + + // 查找匹配的允差区间 + private ConfigAssayMethodProjectAssessmentDO findMatchingRule(List rules, BigDecimal value) { + if (rules == null || rules.isEmpty()) return null; + // 特殊处理 level=0 和 level=4 + for (ConfigAssayMethodProjectAssessmentDO rule : rules) { + if (rule.getAssessmentLevel() == 0) { + ConfigAssayMethodProjectAssessmentDO next = rules.stream() + .filter(r -> r.getAssessmentLevel() == 1) + .findFirst() + .orElse(rule); + if (value.compareTo(new BigDecimal(next.getMinimumValue())) >= 0 && value.compareTo(new BigDecimal(next.getMaximumValue())) <= 0) { + return next; + } + } else if (rule.getAssessmentLevel() == 4) { + ConfigAssayMethodProjectAssessmentDO prev = rules.stream() + .filter(r -> r.getAssessmentLevel() == 3) + .findFirst() + .orElse(rule); + if (value.compareTo(new BigDecimal(prev.getMinimumValue())) >= 0 && value.compareTo(new BigDecimal(prev.getMaximumValue())) <= 0) { + return prev; + } + } else { + if (value.compareTo(new BigDecimal(rule.getMinimumValue())) >= 0 && value.compareTo(new BigDecimal(rule.getMaximumValue())) <= 0) { + return rule; + } + } + } + return null; + } + + // 计算代表值:1个取本身,2个取均值,>2取平均 + private BigDecimal calculateRepresentativeValue(List values) { + int size = values.size(); + if (size == 0) return BigDecimal.ZERO; + if (size == 1) return values.get(0); + if (size == 2) { + return values.get(0).add(values.get(1)).divide(BigDecimal.valueOf(2), 6, RoundingMode.HALF_EVEN); + } + BigDecimal sum = values.stream().reduce(BigDecimal.ZERO, BigDecimal::add); + return sum.divide(BigDecimal.valueOf(size), 6, RoundingMode.HALF_EVEN); + } } diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/ConfigAssayMethodProjectAssessmentController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/ConfigAssayMethodProjectAssessmentController.java new file mode 100644 index 0000000..6d513c4 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/ConfigAssayMethodProjectAssessmentController.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.ConfigAssayMethodProjectAssessmentDO; +import com.zt.plat.module.qms.business.config.service.ConfigAssayMethodProjectAssessmentService; +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-assay-method-project-assessment") +@Validated +public class ConfigAssayMethodProjectAssessmentController implements BusinessControllerMarker { + + + @Resource + private ConfigAssayMethodProjectAssessmentService configAssayMethodProjectAssessmentService; + + @PostMapping("/create") + @Operation(summary = "创建检测方法分析项目判定") + @PreAuthorize("@ss.hasPermission('qms:config-assay-method-project-assessment:create')") + public CommonResult createConfigAssayMethodProjectAssessment(@Valid @RequestBody ConfigAssayMethodProjectAssessmentSaveReqVO createReqVO) { + return success(configAssayMethodProjectAssessmentService.createConfigAssayMethodProjectAssessment(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新检测方法分析项目判定") + @PreAuthorize("@ss.hasPermission('qms:config-assay-method-project-assessment:update')") + public CommonResult updateConfigAssayMethodProjectAssessment(@Valid @RequestBody ConfigAssayMethodProjectAssessmentSaveReqVO updateReqVO) { + configAssayMethodProjectAssessmentService.updateConfigAssayMethodProjectAssessment(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除检测方法分析项目判定") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('qms:config-assay-method-project-assessment:delete')") + public CommonResult deleteConfigAssayMethodProjectAssessment(@RequestParam("id") Long id) { + configAssayMethodProjectAssessmentService.deleteConfigAssayMethodProjectAssessment(id); + return success(true); + } + + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除检测方法分析项目判定") + @PreAuthorize("@ss.hasPermission('qms:config-assay-method-project-assessment:delete')") + public CommonResult deleteConfigAssayMethodProjectAssessmentList(@RequestBody BatchDeleteReqVO req) { + configAssayMethodProjectAssessmentService.deleteConfigAssayMethodProjectAssessmentListByIds(req.getIds()); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得检测方法分析项目判定") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('qms:config-assay-method-project-assessment:query')") + public CommonResult getConfigAssayMethodProjectAssessment(@RequestParam("id") Long id) { + ConfigAssayMethodProjectAssessmentDO configAssayMethodProjectAssessment = configAssayMethodProjectAssessmentService.getConfigAssayMethodProjectAssessment(id); + return success(BeanUtils.toBean(configAssayMethodProjectAssessment, ConfigAssayMethodProjectAssessmentRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得检测方法分析项目判定分页") + @PreAuthorize("@ss.hasPermission('qms:config-assay-method-project-assessment:query')") + public CommonResult> getConfigAssayMethodProjectAssessmentPage(@Valid ConfigAssayMethodProjectAssessmentPageReqVO pageReqVO) { + PageResult pageResult = configAssayMethodProjectAssessmentService.getConfigAssayMethodProjectAssessmentPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, ConfigAssayMethodProjectAssessmentRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出检测方法分析项目判定 Excel") + @PreAuthorize("@ss.hasPermission('qms:config-assay-method-project-assessment:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportConfigAssayMethodProjectAssessmentExcel(@Valid ConfigAssayMethodProjectAssessmentPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = configAssayMethodProjectAssessmentService.getConfigAssayMethodProjectAssessmentPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "检测方法分析项目判定.xls", "数据", ConfigAssayMethodProjectAssessmentRespVO.class, + BeanUtils.toBean(list, ConfigAssayMethodProjectAssessmentRespVO.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/admin/ConfigAssayMethodProjectCoefficientController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/ConfigAssayMethodProjectCoefficientController.java new file mode 100644 index 0000000..7647dac --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/ConfigAssayMethodProjectCoefficientController.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.ConfigAssayMethodProjectCoefficientDO; +import com.zt.plat.module.qms.business.config.service.ConfigAssayMethodProjectCoefficientService; +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-assay-method-project-coefficient") +@Validated +public class ConfigAssayMethodProjectCoefficientController implements BusinessControllerMarker { + + + @Resource + private ConfigAssayMethodProjectCoefficientService configAssayMethodProjectCoefficientService; + + @PostMapping("/create") + @Operation(summary = "创建检测方法分析项目补正系数") + @PreAuthorize("@ss.hasPermission('qms:config-assay-method-project-coefficient:create')") + public CommonResult createConfigAssayMethodProjectCoefficient(@Valid @RequestBody ConfigAssayMethodProjectCoefficientSaveReqVO createReqVO) { + return success(configAssayMethodProjectCoefficientService.createConfigAssayMethodProjectCoefficient(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新检测方法分析项目补正系数") + @PreAuthorize("@ss.hasPermission('qms:config-assay-method-project-coefficient:update')") + public CommonResult updateConfigAssayMethodProjectCoefficient(@Valid @RequestBody ConfigAssayMethodProjectCoefficientSaveReqVO updateReqVO) { + configAssayMethodProjectCoefficientService.updateConfigAssayMethodProjectCoefficient(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除检测方法分析项目补正系数") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('qms:config-assay-method-project-coefficient:delete')") + public CommonResult deleteConfigAssayMethodProjectCoefficient(@RequestParam("id") Long id) { + configAssayMethodProjectCoefficientService.deleteConfigAssayMethodProjectCoefficient(id); + return success(true); + } + + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除检测方法分析项目补正系数") + @PreAuthorize("@ss.hasPermission('qms:config-assay-method-project-coefficient:delete')") + public CommonResult deleteConfigAssayMethodProjectCoefficientList(@RequestBody BatchDeleteReqVO req) { + configAssayMethodProjectCoefficientService.deleteConfigAssayMethodProjectCoefficientListByIds(req.getIds()); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得检测方法分析项目补正系数") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('qms:config-assay-method-project-coefficient:query')") + public CommonResult getConfigAssayMethodProjectCoefficient(@RequestParam("id") Long id) { + ConfigAssayMethodProjectCoefficientDO configAssayMethodProjectCoefficient = configAssayMethodProjectCoefficientService.getConfigAssayMethodProjectCoefficient(id); + return success(BeanUtils.toBean(configAssayMethodProjectCoefficient, ConfigAssayMethodProjectCoefficientRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得检测方法分析项目补正系数分页") + @PreAuthorize("@ss.hasPermission('qms:config-assay-method-project-coefficient:query')") + public CommonResult> getConfigAssayMethodProjectCoefficientPage(@Valid ConfigAssayMethodProjectCoefficientPageReqVO pageReqVO) { + PageResult pageResult = configAssayMethodProjectCoefficientService.getConfigAssayMethodProjectCoefficientPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, ConfigAssayMethodProjectCoefficientRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出检测方法分析项目补正系数 Excel") + @PreAuthorize("@ss.hasPermission('qms:config-assay-method-project-coefficient:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportConfigAssayMethodProjectCoefficientExcel(@Valid ConfigAssayMethodProjectCoefficientPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = configAssayMethodProjectCoefficientService.getConfigAssayMethodProjectCoefficientPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "检测方法分析项目补正系数.xls", "数据", ConfigAssayMethodProjectCoefficientRespVO.class, + BeanUtils.toBean(list, ConfigAssayMethodProjectCoefficientRespVO.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/admin/ConfigRuleController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/ConfigRuleController.java new file mode 100644 index 0000000..d882e64 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/ConfigRuleController.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.ConfigRuleDO; +import com.zt.plat.module.qms.business.config.service.ConfigRuleService; +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-rule") +@Validated +public class ConfigRuleController implements BusinessControllerMarker { + + + @Resource + private ConfigRuleService configRuleService; + + @PostMapping("/create") + @Operation(summary = "创建规则配置") + @PreAuthorize("@ss.hasPermission('qms:config-rule:create')") + public CommonResult createConfigRule(@Valid @RequestBody ConfigRuleSaveReqVO createReqVO) { + return success(configRuleService.createConfigRule(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新规则配置") + @PreAuthorize("@ss.hasPermission('qms:config-rule:update')") + public CommonResult updateConfigRule(@Valid @RequestBody ConfigRuleSaveReqVO updateReqVO) { + configRuleService.updateConfigRule(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除规则配置") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('qms:config-rule:delete')") + public CommonResult deleteConfigRule(@RequestParam("id") Long id) { + configRuleService.deleteConfigRule(id); + return success(true); + } + + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除规则配置") + @PreAuthorize("@ss.hasPermission('qms:config-rule:delete')") + public CommonResult deleteConfigRuleList(@RequestBody BatchDeleteReqVO req) { + configRuleService.deleteConfigRuleListByIds(req.getIds()); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得规则配置") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('qms:config-rule:query')") + public CommonResult getConfigRule(@RequestParam("id") Long id) { + ConfigRuleDO configRule = configRuleService.getConfigRule(id); + return success(BeanUtils.toBean(configRule, ConfigRuleRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得规则配置分页") + @PreAuthorize("@ss.hasPermission('qms:config-rule:query')") + public CommonResult> getConfigRulePage(@Valid ConfigRulePageReqVO pageReqVO) { + PageResult pageResult = configRuleService.getConfigRulePage(pageReqVO); + return success(BeanUtils.toBean(pageResult, ConfigRuleRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出规则配置 Excel") + @PreAuthorize("@ss.hasPermission('qms:config-rule:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportConfigRuleExcel(@Valid ConfigRulePageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = configRuleService.getConfigRulePage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "规则配置.xls", "数据", ConfigRuleRespVO.class, + BeanUtils.toBean(list, ConfigRuleRespVO.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/ConfigAssayMethodProjectAssessmentPageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigAssayMethodProjectAssessmentPageReqVO.java new file mode 100644 index 0000000..fd7b1b6 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigAssayMethodProjectAssessmentPageReqVO.java @@ -0,0 +1,65 @@ +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 ConfigAssayMethodProjectAssessmentPageReqVO extends PageParam { + + @Schema(description = "检测方法配置ID", example = "18120") + private Long configAssayMethodId; + + @Schema(description = "检测方法分析项目配置ID", example = "10083") + private Long configAssayMethodProjectId; + + @Schema(description = "检测项目ID,字典表【T_DIC_PRJ】", example = "31414") + private Long dictionaryProjectId; + + @Schema(description = "级别") + private Integer assessmentLevel; + + @Schema(description = "范围") + private String assessmentRange; + + @Schema(description = "最小允差值") + private String minimumToleraanceValue; + + @Schema(description = "最大允差值") + private String maximumToleraanceValue; + + @Schema(description = "最小值") + private String minimumValue; + + @Schema(description = "最大值") + private String maximumValue; + + @Schema(description = "计算公式") + private String formula; + + @Schema(description = "是否使用公式计算计算允差值,1-是,0-否") + private Integer isUseFormula; + + @Schema(description = "允差值调整参数") + private String toleraanceAdjustmentValue; + + @Schema(description = "所属部门") + private String systemDepartmentCode; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "备注") + private String remark; + + @Schema(description = "版本") + private Integer version; + +} \ 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/ConfigAssayMethodProjectAssessmentRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigAssayMethodProjectAssessmentRespVO.java new file mode 100644 index 0000000..2501d8e --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigAssayMethodProjectAssessmentRespVO.java @@ -0,0 +1,83 @@ +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 ConfigAssayMethodProjectAssessmentRespVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "912") + @ExcelProperty("ID") + private Long id; + + @Schema(description = "检测方法配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18120") + @ExcelProperty("检测方法配置ID") + private Long configAssayMethodId; + + @Schema(description = "检测方法分析项目配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "10083") + @ExcelProperty("检测方法分析项目配置ID") + private Long configAssayMethodProjectId; + + @Schema(description = "检测项目ID,字典表【T_DIC_PRJ】", requiredMode = Schema.RequiredMode.REQUIRED, example = "31414") + @ExcelProperty("检测项目ID,字典表【T_DIC_PRJ】") + private Long dictionaryProjectId; + + @Schema(description = "级别") + @ExcelProperty("级别") + private Integer assessmentLevel; + + @Schema(description = "范围") + @ExcelProperty("范围") + private String assessmentRange; + + @Schema(description = "最小允差值") + @ExcelProperty("最小允差值") + private String minimumToleraanceValue; + + @Schema(description = "最大允差值", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("最大允差值") + private String maximumToleraanceValue; + + @Schema(description = "最小值") + @ExcelProperty("最小值") + private String minimumValue; + + @Schema(description = "最大值", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("最大值") + private String maximumValue; + + @Schema(description = "计算公式") + @ExcelProperty("计算公式") + private String formula; + + @Schema(description = "是否使用公式计算计算允差值,1-是,0-否") + @ExcelProperty("是否使用公式计算计算允差值,1-是,0-否") + private Integer isUseFormula; + + @Schema(description = "允差值调整参数") + @ExcelProperty("允差值调整参数") + private String toleraanceAdjustmentValue; + + @Schema(description = "所属部门") + @ExcelProperty("所属部门") + private String systemDepartmentCode; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "备注") + @ExcelProperty("备注") + private String remark; + + @Schema(description = "版本", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("版本") + private Integer version; + +} \ 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/ConfigAssayMethodProjectAssessmentSaveReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigAssayMethodProjectAssessmentSaveReqVO.java new file mode 100644 index 0000000..efd5e17 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigAssayMethodProjectAssessmentSaveReqVO.java @@ -0,0 +1,66 @@ +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 ConfigAssayMethodProjectAssessmentSaveReqVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "912") + private Long id; + + @Schema(description = "检测方法配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18120") + @NotNull(message = "检测方法配置ID不能为空") + private Long configAssayMethodId; + + @Schema(description = "检测方法分析项目配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "10083") + @NotNull(message = "检测方法分析项目配置ID不能为空") + private Long configAssayMethodProjectId; + + @Schema(description = "检测项目ID,字典表【T_DIC_PRJ】", requiredMode = Schema.RequiredMode.REQUIRED, example = "31414") + @NotNull(message = "检测项目ID,字典表【T_DIC_PRJ】不能为空") + private Long dictionaryProjectId; + + @Schema(description = "级别") + private Integer assessmentLevel; + + @Schema(description = "范围") + private String assessmentRange; + + @Schema(description = "最小允差值") + private String minimumToleraanceValue; + + @Schema(description = "最大允差值", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "最大允差值不能为空") + private String maximumToleraanceValue; + + @Schema(description = "最小值") + private String minimumValue; + + @Schema(description = "最大值", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "最大值不能为空") + private String maximumValue; + + @Schema(description = "计算公式") + private String formula; + + @Schema(description = "是否使用公式计算计算允差值,1-是,0-否") + private Integer isUseFormula; + + @Schema(description = "允差值调整参数") + private String toleraanceAdjustmentValue; + + @Schema(description = "所属部门") + private String systemDepartmentCode; + + @Schema(description = "备注") + private String remark; + + @Schema(description = "版本", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "版本不能为空") + private Integer version; + +} \ 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/ConfigAssayMethodProjectCoefficientPageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigAssayMethodProjectCoefficientPageReqVO.java new file mode 100644 index 0000000..4a904f5 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigAssayMethodProjectCoefficientPageReqVO.java @@ -0,0 +1,54 @@ +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 java.math.BigDecimal; +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 ConfigAssayMethodProjectCoefficientPageReqVO extends PageParam { + + @Schema(description = "检测方法配置ID", example = "10243") + private Long configAssayMethodId; + + @Schema(description = "检测方法分析项目配置ID", example = "2854") + private Long configAssayMethodProjectId; + + @Schema(description = "检测项目ID,字典表【T_DIC_PRJ】", example = "23760") + private Long dictionaryProjectId; + + @Schema(description = "检测项目缩写", example = "李四") + private String projectSimpleName; + + @Schema(description = "范围") + private String range; + + @Schema(description = "最小值") + private String minimumValue; + + @Schema(description = "最大值") + private String maximumValue; + + @Schema(description = "补正系数") + private BigDecimal coefficient; + + @Schema(description = "所属部门") + private String systemDepartmentCustomsDeclaration; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "备注") + private String remark; + + @Schema(description = "版本") + private Integer version; + +} \ 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/ConfigAssayMethodProjectCoefficientRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigAssayMethodProjectCoefficientRespVO.java new file mode 100644 index 0000000..de91112 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigAssayMethodProjectCoefficientRespVO.java @@ -0,0 +1,68 @@ +package com.zt.plat.module.qms.business.config.controller.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.math.BigDecimal; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 检测方法分析项目补正系数 Response VO") +@Data +@ExcelIgnoreUnannotated +public class ConfigAssayMethodProjectCoefficientRespVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26850") + @ExcelProperty("ID") + private Long id; + + @Schema(description = "检测方法配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "10243") + @ExcelProperty("检测方法配置ID") + private Long configAssayMethodId; + + @Schema(description = "检测方法分析项目配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2854") + @ExcelProperty("检测方法分析项目配置ID") + private Long configAssayMethodProjectId; + + @Schema(description = "检测项目ID,字典表【T_DIC_PRJ】", requiredMode = Schema.RequiredMode.REQUIRED, example = "23760") + @ExcelProperty("检测项目ID,字典表【T_DIC_PRJ】") + private Long dictionaryProjectId; + + @Schema(description = "检测项目缩写", example = "李四") + @ExcelProperty("检测项目缩写") + private String projectSimpleName; + + @Schema(description = "范围") + @ExcelProperty("范围") + private String range; + + @Schema(description = "最小值") + @ExcelProperty("最小值") + private String minimumValue; + + @Schema(description = "最大值", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("最大值") + private String maximumValue; + + @Schema(description = "补正系数") + @ExcelProperty("补正系数") + private BigDecimal coefficient; + + @Schema(description = "所属部门") + @ExcelProperty("所属部门") + private String systemDepartmentCustomsDeclaration; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "备注") + @ExcelProperty("备注") + private String remark; + + @Schema(description = "版本", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("版本") + private Integer version; + +} \ 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/ConfigAssayMethodProjectCoefficientSaveReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigAssayMethodProjectCoefficientSaveReqVO.java new file mode 100644 index 0000000..359d1e3 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigAssayMethodProjectCoefficientSaveReqVO.java @@ -0,0 +1,54 @@ +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.*; +import java.math.BigDecimal; + +@Schema(description = "管理后台 - 检测方法分析项目补正系数新增/修改 Request VO") +@Data +public class ConfigAssayMethodProjectCoefficientSaveReqVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26850") + private Long id; + + @Schema(description = "检测方法配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "10243") + @NotNull(message = "检测方法配置ID不能为空") + private Long configAssayMethodId; + + @Schema(description = "检测方法分析项目配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2854") + @NotNull(message = "检测方法分析项目配置ID不能为空") + private Long configAssayMethodProjectId; + + @Schema(description = "检测项目ID,字典表【T_DIC_PRJ】", requiredMode = Schema.RequiredMode.REQUIRED, example = "23760") + @NotNull(message = "检测项目ID,字典表【T_DIC_PRJ】不能为空") + private Long dictionaryProjectId; + + @Schema(description = "检测项目缩写", example = "李四") + private String projectSimpleName; + + @Schema(description = "范围") + private String range; + + @Schema(description = "最小值") + private String minimumValue; + + @Schema(description = "最大值", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "最大值不能为空") + private String maximumValue; + + @Schema(description = "补正系数") + private BigDecimal coefficient; + + @Schema(description = "所属部门") + private String systemDepartmentCustomsDeclaration; + + @Schema(description = "备注") + private String remark; + + @Schema(description = "版本", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "版本不能为空") + private Integer version; + +} \ 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/ConfigRulePageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigRulePageReqVO.java new file mode 100644 index 0000000..9785f21 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigRulePageReqVO.java @@ -0,0 +1,47 @@ +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 ConfigRulePageReqVO extends PageParam { + + @Schema(description = "编码") + private String code; + + @Schema(description = "名称", example = "芋艿") + private String name; + + @Schema(description = "描述") + private String description; + + @Schema(description = "类型", example = "2") + private String type; + + @Schema(description = "表达式") + private String eXPRESSION; + + @Schema(description = "版本") + private Integer version; + + @Schema(description = "是否最新版本,1-是,0-否") + private Integer isLast; + + @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/ConfigRuleRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigRuleRespVO.java new file mode 100644 index 0000000..369e372 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigRuleRespVO.java @@ -0,0 +1,59 @@ +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 ConfigRuleRespVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21005") + @ExcelProperty("ID") + private Long id; + + @Schema(description = "编码") + @ExcelProperty("编码") + private String code; + + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") + @ExcelProperty("名称") + private String name; + + @Schema(description = "描述", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("描述") + private String description; + + @Schema(description = "类型", example = "2") + @ExcelProperty("类型") + private String type; + + @Schema(description = "表达式", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("表达式") + private String eXPRESSION; + + @Schema(description = "版本", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("版本") + private Integer version; + + @Schema(description = "是否最新版本,1-是,0-否") + @ExcelProperty("是否最新版本,1-是,0-否") + private Integer isLast; + + @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/ConfigRuleSaveReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigRuleSaveReqVO.java new file mode 100644 index 0000000..16a0ca7 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigRuleSaveReqVO.java @@ -0,0 +1,46 @@ +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 ConfigRuleSaveReqVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21005") + private Long id; + + @Schema(description = "编码") + private String code; + + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") + @NotEmpty(message = "名称不能为空") + private String name; + + @Schema(description = "描述", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "描述不能为空") + private String description; + + @Schema(description = "类型", example = "2") + private String type; + + @Schema(description = "表达式", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "表达式不能为空") + private String eXPRESSION; + + @Schema(description = "版本", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "版本不能为空") + private Integer version; + + @Schema(description = "是否最新版本,1-是,0-否") + private Integer isLast; + + @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/ConfigAssayMethodProjectAssessmentDO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/dataobject/ConfigAssayMethodProjectAssessmentDO.java new file mode 100644 index 0000000..789f4b4 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/dataobject/ConfigAssayMethodProjectAssessmentDO.java @@ -0,0 +1,110 @@ +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_asy_mthd_prj_asmt") +@KeySequence("t_cfg_asy_mthd_prj_asmt_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +/** +* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO +*/ +public class ConfigAssayMethodProjectAssessmentDO extends BusinessBaseDO { + + + + /** + * ID + */ + @TableId(type = IdType.ASSIGN_ID) + private Long id; + /** + * 检测方法配置ID + */ + @TableField("CFG_ASY_MTHD_ID") + private Long configAssayMethodId; + /** + * 检测方法分析项目配置ID + */ + @TableField("CFG_ASY_MTHD_PRJ_ID") + private Long configAssayMethodProjectId; + /** + * 检测项目ID,字典表【T_DIC_PRJ】 + */ + @TableField("DIC_PRJ_ID") + private Long dictionaryProjectId; + /** + * 级别 + */ + @TableField("ASMT_LVL") + private Integer assessmentLevel; + /** + * 范围 + */ + @TableField("ASMT_RNG") + private String assessmentRange; + /** + * 最小允差值 + */ + @TableField("MIN_TLC_VAL") + private String minimumToleraanceValue; + /** + * 最大允差值 + */ + @TableField("MAX_TLC_VAL") + private String maximumToleraanceValue; + /** + * 最小值 + */ + @TableField("MIN_VAL") + private String minimumValue; + /** + * 最大值 + */ + @TableField("MAX_VAL") + private String maximumValue; + /** + * 计算公式 + */ + @TableField("FMU") + private String formula; + /** + * 是否使用公式计算计算允差值,1-是,0-否 + */ + @TableField("IS_USE_FMU") + private Integer isUseFormula; + /** + * 允差值调整参数 + */ + @TableField("TLC_ADJ_VAL") + private String toleraanceAdjustmentValue; + /** + * 所属部门 + */ + @TableField("SYS_DEPT_CD") + private String systemDepartmentCode; + /** + * 备注 + */ + @TableField("RMK") + private String remark; + /** + * 版本 + */ + @TableField("VER") + private Integer version; + +} \ 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/ConfigAssayMethodProjectCoefficientDO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/dataobject/ConfigAssayMethodProjectCoefficientDO.java new file mode 100644 index 0000000..284957e --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/dataobject/ConfigAssayMethodProjectCoefficientDO.java @@ -0,0 +1,91 @@ +package com.zt.plat.module.qms.business.config.dal.dataobject; + +import lombok.*; +import java.util.*; + import java.math.BigDecimal; + 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_asy_mthd_prj_coef") +@KeySequence("t_cfg_asy_mthd_prj_coef_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +/** +* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO +*/ +public class ConfigAssayMethodProjectCoefficientDO extends BusinessBaseDO { + + + + /** + * ID + */ + @TableId(type = IdType.ASSIGN_ID) + private Long id; + /** + * 检测方法配置ID + */ + @TableField("CFG_ASY_MTHD_ID") + private Long configAssayMethodId; + /** + * 检测方法分析项目配置ID + */ + @TableField("CFG_ASY_MTHD_PRJ_ID") + private Long configAssayMethodProjectId; + /** + * 检测项目ID,字典表【T_DIC_PRJ】 + */ + @TableField("DIC_PRJ_ID") + private Long dictionaryProjectId; + /** + * 检测项目缩写 + */ + @TableField("PRJ_SMPL_NAME") + private String projectSimpleName; + /** + * 范围 + */ + @TableField("RNG") + private String range; + /** + * 最小值 + */ + @TableField("MIN_VAL") + private String minimumValue; + /** + * 最大值 + */ + @TableField("MAX_VAL") + private String maximumValue; + /** + * 补正系数 + */ + @TableField("COEF") + private BigDecimal coefficient; + /** + * 所属部门 + */ + @TableField("SYS_DEPT_CD") + private String systemDepartmentCustomsDeclaration; + /** + * 备注 + */ + @TableField("RMK") + private String remark; + /** + * 版本 + */ + @TableField("VER") + private Integer version; + +} \ 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/ConfigRuleDO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/dataobject/ConfigRuleDO.java new file mode 100644 index 0000000..f975373 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/dataobject/ConfigRuleDO.java @@ -0,0 +1,80 @@ +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_rul") +@KeySequence("t_cfg_rul_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +/** +* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO +*/ +public class ConfigRuleDO extends BusinessBaseDO { + + + + /** + * ID + */ + @TableId(type = IdType.ASSIGN_ID) + private Long id; + /** + * 编码 + */ + @TableField("CD") + private String code; + /** + * 名称 + */ + @TableField("NAME") + private String name; + /** + * 描述 + */ + @TableField("DSP") + private String description; + /** + * 类型 + */ + @TableField("TP") + private String type; + /** + * 表达式 + */ + @TableField("EPSSN") + private String eXPRESSION; + /** + * 版本 + */ + @TableField("VER") + private Integer version; + /** + * 是否最新版本,1-是,0-否 + */ + @TableField("IS_LST") + private Integer isLast; + /** + * 所属部门 + */ + @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/ConfigAssayMethodProjectAssessmentMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigAssayMethodProjectAssessmentMapper.java new file mode 100644 index 0000000..2f493b8 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigAssayMethodProjectAssessmentMapper.java @@ -0,0 +1,41 @@ +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.*; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectAssessmentDO; +import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; +import org.apache.ibatis.annotations.Mapper; + +/** + * 检测方法分析项目判定 Mapper + * + * @author 后台管理 + */ +@Mapper +public interface ConfigAssayMethodProjectAssessmentMapper extends BaseMapperX { + + default PageResult selectPage(ConfigAssayMethodProjectAssessmentPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getConfigAssayMethodId, reqVO.getConfigAssayMethodId()) + .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getConfigAssayMethodProjectId, reqVO.getConfigAssayMethodProjectId()) + .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getDictionaryProjectId, reqVO.getDictionaryProjectId()) + .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getAssessmentLevel, reqVO.getAssessmentLevel()) + .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getAssessmentRange, reqVO.getAssessmentRange()) + .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getMinimumToleraanceValue, reqVO.getMinimumToleraanceValue()) + .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getMaximumToleraanceValue, reqVO.getMaximumToleraanceValue()) + .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getMinimumValue, reqVO.getMinimumValue()) + .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getMaximumValue, reqVO.getMaximumValue()) + .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getFormula, reqVO.getFormula()) + .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getIsUseFormula, reqVO.getIsUseFormula()) + .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getToleraanceAdjustmentValue, reqVO.getToleraanceAdjustmentValue()) + .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode()) + .betweenIfPresent(ConfigAssayMethodProjectAssessmentDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getRemark, reqVO.getRemark()) + .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getVersion, reqVO.getVersion()) + .orderByDesc(ConfigAssayMethodProjectAssessmentDO::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/ConfigAssayMethodProjectCoefficientMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigAssayMethodProjectCoefficientMapper.java new file mode 100644 index 0000000..de081f1 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigAssayMethodProjectCoefficientMapper.java @@ -0,0 +1,37 @@ +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.*; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectCoefficientDO; +import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; +import org.apache.ibatis.annotations.Mapper; + +/** + * 检测方法分析项目补正系数 Mapper + * + * @author 后台管理 + */ +@Mapper +public interface ConfigAssayMethodProjectCoefficientMapper extends BaseMapperX { + + default PageResult selectPage(ConfigAssayMethodProjectCoefficientPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(ConfigAssayMethodProjectCoefficientDO::getConfigAssayMethodId, reqVO.getConfigAssayMethodId()) + .eqIfPresent(ConfigAssayMethodProjectCoefficientDO::getConfigAssayMethodProjectId, reqVO.getConfigAssayMethodProjectId()) + .eqIfPresent(ConfigAssayMethodProjectCoefficientDO::getDictionaryProjectId, reqVO.getDictionaryProjectId()) + .likeIfPresent(ConfigAssayMethodProjectCoefficientDO::getProjectSimpleName, reqVO.getProjectSimpleName()) + .eqIfPresent(ConfigAssayMethodProjectCoefficientDO::getRange, reqVO.getRange()) + .eqIfPresent(ConfigAssayMethodProjectCoefficientDO::getMinimumValue, reqVO.getMinimumValue()) + .eqIfPresent(ConfigAssayMethodProjectCoefficientDO::getMaximumValue, reqVO.getMaximumValue()) + .eqIfPresent(ConfigAssayMethodProjectCoefficientDO::getCoefficient, reqVO.getCoefficient()) + .eqIfPresent(ConfigAssayMethodProjectCoefficientDO::getSystemDepartmentCustomsDeclaration, reqVO.getSystemDepartmentCustomsDeclaration()) + .betweenIfPresent(ConfigAssayMethodProjectCoefficientDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(ConfigAssayMethodProjectCoefficientDO::getRemark, reqVO.getRemark()) + .eqIfPresent(ConfigAssayMethodProjectCoefficientDO::getVersion, reqVO.getVersion()) + .orderByDesc(ConfigAssayMethodProjectCoefficientDO::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/ConfigRuleMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigRuleMapper.java new file mode 100644 index 0000000..364bc3c --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigRuleMapper.java @@ -0,0 +1,35 @@ +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.*; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigRuleDO; +import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; +import org.apache.ibatis.annotations.Mapper; + +/** + * 规则配置 Mapper + * + * @author 后台管理 + */ +@Mapper +public interface ConfigRuleMapper extends BaseMapperX { + + default PageResult selectPage(ConfigRulePageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(ConfigRuleDO::getCode, reqVO.getCode()) + .likeIfPresent(ConfigRuleDO::getName, reqVO.getName()) + .eqIfPresent(ConfigRuleDO::getDescription, reqVO.getDescription()) + .eqIfPresent(ConfigRuleDO::getType, reqVO.getType()) + .eqIfPresent(ConfigRuleDO::getEXPRESSION, reqVO.getEXPRESSION()) + .eqIfPresent(ConfigRuleDO::getVersion, reqVO.getVersion()) + .eqIfPresent(ConfigRuleDO::getIsLast, reqVO.getIsLast()) + .eqIfPresent(ConfigRuleDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode()) + .betweenIfPresent(ConfigRuleDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(ConfigRuleDO::getRemark, reqVO.getRemark()) + .orderByDesc(ConfigRuleDO::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/service/ConfigAssayMethodProjectAssessmentService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigAssayMethodProjectAssessmentService.java new file mode 100644 index 0000000..e7bb76b --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigAssayMethodProjectAssessmentService.java @@ -0,0 +1,62 @@ +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.ConfigAssayMethodProjectAssessmentDO; +import com.zt.plat.framework.common.pojo.PageParam; + +/** + * 检测方法分析项目判定 Service 接口 + * + * @author 后台管理 + */ +public interface ConfigAssayMethodProjectAssessmentService { + + /** + * 创建检测方法分析项目判定 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + ConfigAssayMethodProjectAssessmentRespVO createConfigAssayMethodProjectAssessment(@Valid ConfigAssayMethodProjectAssessmentSaveReqVO createReqVO); + + /** + * 更新检测方法分析项目判定 + * + * @param updateReqVO 更新信息 + */ + void updateConfigAssayMethodProjectAssessment(@Valid ConfigAssayMethodProjectAssessmentSaveReqVO updateReqVO); + + /** + * 删除检测方法分析项目判定 + * + * @param id 编号 + */ + void deleteConfigAssayMethodProjectAssessment(Long id); + + /** + * 批量删除检测方法分析项目判定 + * + * @param ids 编号 + */ + void deleteConfigAssayMethodProjectAssessmentListByIds(List ids); + + /** + * 获得检测方法分析项目判定 + * + * @param id 编号 + * @return 检测方法分析项目判定 + */ + ConfigAssayMethodProjectAssessmentDO getConfigAssayMethodProjectAssessment(Long id); + + /** + * 获得检测方法分析项目判定分页 + * + * @param pageReqVO 分页查询 + * @return 检测方法分析项目判定分页 + */ + PageResult getConfigAssayMethodProjectAssessmentPage(ConfigAssayMethodProjectAssessmentPageReqVO 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/ConfigAssayMethodProjectAssessmentServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigAssayMethodProjectAssessmentServiceImpl.java new file mode 100644 index 0000000..0b86211 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigAssayMethodProjectAssessmentServiceImpl.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.ConfigAssayMethodProjectAssessmentDO; +import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodProjectAssessmentMapper; + +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 ConfigAssayMethodProjectAssessmentServiceImpl implements ConfigAssayMethodProjectAssessmentService { + + @Resource + private ConfigAssayMethodProjectAssessmentMapper configAssayMethodProjectAssessmentMapper; + + @Override + public ConfigAssayMethodProjectAssessmentRespVO createConfigAssayMethodProjectAssessment(ConfigAssayMethodProjectAssessmentSaveReqVO createReqVO) { + // 插入 + ConfigAssayMethodProjectAssessmentDO configAssayMethodProjectAssessment = BeanUtils.toBean(createReqVO, ConfigAssayMethodProjectAssessmentDO.class); + configAssayMethodProjectAssessmentMapper.insert(configAssayMethodProjectAssessment); + // 返回 + return BeanUtils.toBean(configAssayMethodProjectAssessment, ConfigAssayMethodProjectAssessmentRespVO.class); + } + + @Override + public void updateConfigAssayMethodProjectAssessment(ConfigAssayMethodProjectAssessmentSaveReqVO updateReqVO) { + // 校验存在 + validateConfigAssayMethodProjectAssessmentExists(updateReqVO.getId()); + // 更新 + ConfigAssayMethodProjectAssessmentDO updateObj = BeanUtils.toBean(updateReqVO, ConfigAssayMethodProjectAssessmentDO.class); + configAssayMethodProjectAssessmentMapper.updateById(updateObj); + } + + @Override + public void deleteConfigAssayMethodProjectAssessment(Long id) { + // 校验存在 + validateConfigAssayMethodProjectAssessmentExists(id); + // 删除 + configAssayMethodProjectAssessmentMapper.deleteById(id); + } + + @Override + public void deleteConfigAssayMethodProjectAssessmentListByIds(List ids) { + // 校验存在 + validateConfigAssayMethodProjectAssessmentExists(ids); + // 删除 + configAssayMethodProjectAssessmentMapper.deleteByIds(ids); + } + + private void validateConfigAssayMethodProjectAssessmentExists(List ids) { + List list = configAssayMethodProjectAssessmentMapper.selectByIds(ids); + if (CollUtil.isEmpty(list) || list.size() != ids.size()) { + throw exception(CONFIG_ASSAY_METHOD_PROJECT_ASSESSMENT_NOT_EXISTS); + } + } + + private void validateConfigAssayMethodProjectAssessmentExists(Long id) { + if (configAssayMethodProjectAssessmentMapper.selectById(id) == null) { + throw exception(CONFIG_ASSAY_METHOD_PROJECT_ASSESSMENT_NOT_EXISTS); + } + } + + @Override + public ConfigAssayMethodProjectAssessmentDO getConfigAssayMethodProjectAssessment(Long id) { + return configAssayMethodProjectAssessmentMapper.selectById(id); + } + + @Override + public PageResult getConfigAssayMethodProjectAssessmentPage(ConfigAssayMethodProjectAssessmentPageReqVO pageReqVO) { + return configAssayMethodProjectAssessmentMapper.selectPage(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/ConfigAssayMethodProjectCoefficientService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigAssayMethodProjectCoefficientService.java new file mode 100644 index 0000000..09ce8f3 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigAssayMethodProjectCoefficientService.java @@ -0,0 +1,62 @@ +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.ConfigAssayMethodProjectCoefficientDO; +import com.zt.plat.framework.common.pojo.PageParam; + +/** + * 检测方法分析项目补正系数 Service 接口 + * + * @author 后台管理 + */ +public interface ConfigAssayMethodProjectCoefficientService { + + /** + * 创建检测方法分析项目补正系数 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + ConfigAssayMethodProjectCoefficientRespVO createConfigAssayMethodProjectCoefficient(@Valid ConfigAssayMethodProjectCoefficientSaveReqVO createReqVO); + + /** + * 更新检测方法分析项目补正系数 + * + * @param updateReqVO 更新信息 + */ + void updateConfigAssayMethodProjectCoefficient(@Valid ConfigAssayMethodProjectCoefficientSaveReqVO updateReqVO); + + /** + * 删除检测方法分析项目补正系数 + * + * @param id 编号 + */ + void deleteConfigAssayMethodProjectCoefficient(Long id); + + /** + * 批量删除检测方法分析项目补正系数 + * + * @param ids 编号 + */ + void deleteConfigAssayMethodProjectCoefficientListByIds(List ids); + + /** + * 获得检测方法分析项目补正系数 + * + * @param id 编号 + * @return 检测方法分析项目补正系数 + */ + ConfigAssayMethodProjectCoefficientDO getConfigAssayMethodProjectCoefficient(Long id); + + /** + * 获得检测方法分析项目补正系数分页 + * + * @param pageReqVO 分页查询 + * @return 检测方法分析项目补正系数分页 + */ + PageResult getConfigAssayMethodProjectCoefficientPage(ConfigAssayMethodProjectCoefficientPageReqVO 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/ConfigAssayMethodProjectCoefficientServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigAssayMethodProjectCoefficientServiceImpl.java new file mode 100644 index 0000000..1c68247 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigAssayMethodProjectCoefficientServiceImpl.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.ConfigAssayMethodProjectCoefficientDO; +import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodProjectCoefficientMapper; + +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 ConfigAssayMethodProjectCoefficientServiceImpl implements ConfigAssayMethodProjectCoefficientService { + + @Resource + private ConfigAssayMethodProjectCoefficientMapper configAssayMethodProjectCoefficientMapper; + + @Override + public ConfigAssayMethodProjectCoefficientRespVO createConfigAssayMethodProjectCoefficient(ConfigAssayMethodProjectCoefficientSaveReqVO createReqVO) { + // 插入 + ConfigAssayMethodProjectCoefficientDO configAssayMethodProjectCoefficient = BeanUtils.toBean(createReqVO, ConfigAssayMethodProjectCoefficientDO.class); + configAssayMethodProjectCoefficientMapper.insert(configAssayMethodProjectCoefficient); + // 返回 + return BeanUtils.toBean(configAssayMethodProjectCoefficient, ConfigAssayMethodProjectCoefficientRespVO.class); + } + + @Override + public void updateConfigAssayMethodProjectCoefficient(ConfigAssayMethodProjectCoefficientSaveReqVO updateReqVO) { + // 校验存在 + validateConfigAssayMethodProjectCoefficientExists(updateReqVO.getId()); + // 更新 + ConfigAssayMethodProjectCoefficientDO updateObj = BeanUtils.toBean(updateReqVO, ConfigAssayMethodProjectCoefficientDO.class); + configAssayMethodProjectCoefficientMapper.updateById(updateObj); + } + + @Override + public void deleteConfigAssayMethodProjectCoefficient(Long id) { + // 校验存在 + validateConfigAssayMethodProjectCoefficientExists(id); + // 删除 + configAssayMethodProjectCoefficientMapper.deleteById(id); + } + + @Override + public void deleteConfigAssayMethodProjectCoefficientListByIds(List ids) { + // 校验存在 + validateConfigAssayMethodProjectCoefficientExists(ids); + // 删除 + configAssayMethodProjectCoefficientMapper.deleteByIds(ids); + } + + private void validateConfigAssayMethodProjectCoefficientExists(List ids) { + List list = configAssayMethodProjectCoefficientMapper.selectByIds(ids); + if (CollUtil.isEmpty(list) || list.size() != ids.size()) { + throw exception(CONFIG_ASSAY_METHOD_PROJECT_COEFFICIENT_NOT_EXISTS); + } + } + + private void validateConfigAssayMethodProjectCoefficientExists(Long id) { + if (configAssayMethodProjectCoefficientMapper.selectById(id) == null) { + throw exception(CONFIG_ASSAY_METHOD_PROJECT_COEFFICIENT_NOT_EXISTS); + } + } + + @Override + public ConfigAssayMethodProjectCoefficientDO getConfigAssayMethodProjectCoefficient(Long id) { + return configAssayMethodProjectCoefficientMapper.selectById(id); + } + + @Override + public PageResult getConfigAssayMethodProjectCoefficientPage(ConfigAssayMethodProjectCoefficientPageReqVO pageReqVO) { + return configAssayMethodProjectCoefficientMapper.selectPage(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/ConfigRuleService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigRuleService.java new file mode 100644 index 0000000..d63f088 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigRuleService.java @@ -0,0 +1,62 @@ +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.ConfigRuleDO; +import com.zt.plat.framework.common.pojo.PageParam; + +/** + * 规则配置 Service 接口 + * + * @author 后台管理 + */ +public interface ConfigRuleService { + + /** + * 创建规则配置 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + ConfigRuleRespVO createConfigRule(@Valid ConfigRuleSaveReqVO createReqVO); + + /** + * 更新规则配置 + * + * @param updateReqVO 更新信息 + */ + void updateConfigRule(@Valid ConfigRuleSaveReqVO updateReqVO); + + /** + * 删除规则配置 + * + * @param id 编号 + */ + void deleteConfigRule(Long id); + + /** + * 批量删除规则配置 + * + * @param ids 编号 + */ + void deleteConfigRuleListByIds(List ids); + + /** + * 获得规则配置 + * + * @param id 编号 + * @return 规则配置 + */ + ConfigRuleDO getConfigRule(Long id); + + /** + * 获得规则配置分页 + * + * @param pageReqVO 分页查询 + * @return 规则配置分页 + */ + PageResult getConfigRulePage(ConfigRulePageReqVO 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/ConfigRuleServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigRuleServiceImpl.java new file mode 100644 index 0000000..30c5740 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigRuleServiceImpl.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.ConfigRuleDO; +import com.zt.plat.module.qms.business.config.dal.mapper.ConfigRuleMapper; + +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 ConfigRuleServiceImpl implements ConfigRuleService { + + @Resource + private ConfigRuleMapper configRuleMapper; + + @Override + public ConfigRuleRespVO createConfigRule(ConfigRuleSaveReqVO createReqVO) { + // 插入 + ConfigRuleDO configRule = BeanUtils.toBean(createReqVO, ConfigRuleDO.class); + configRuleMapper.insert(configRule); + // 返回 + return BeanUtils.toBean(configRule, ConfigRuleRespVO.class); + } + + @Override + public void updateConfigRule(ConfigRuleSaveReqVO updateReqVO) { + // 校验存在 + validateConfigRuleExists(updateReqVO.getId()); + // 更新 + ConfigRuleDO updateObj = BeanUtils.toBean(updateReqVO, ConfigRuleDO.class); + configRuleMapper.updateById(updateObj); + } + + @Override + public void deleteConfigRule(Long id) { + // 校验存在 + validateConfigRuleExists(id); + // 删除 + configRuleMapper.deleteById(id); + } + + @Override + public void deleteConfigRuleListByIds(List ids) { + // 校验存在 + validateConfigRuleExists(ids); + // 删除 + configRuleMapper.deleteByIds(ids); + } + + private void validateConfigRuleExists(List ids) { + List list = configRuleMapper.selectByIds(ids); + if (CollUtil.isEmpty(list) || list.size() != ids.size()) { + throw exception(CONFIG_RULE_NOT_EXISTS); + } + } + + private void validateConfigRuleExists(Long id) { + if (configRuleMapper.selectById(id) == null) { + throw exception(CONFIG_RULE_NOT_EXISTS); + } + } + + @Override + public ConfigRuleDO getConfigRule(Long id) { + return configRuleMapper.selectById(id); + } + + @Override + public PageResult getConfigRulePage(ConfigRulePageReqVO pageReqVO) { + return configRuleMapper.selectPage(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/core/qlexpress/cmp/AllowanceCalculatorComponent.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/core/qlexpress/cmp/AllowanceCalculatorComponent.java new file mode 100644 index 0000000..fcc29d1 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/core/qlexpress/cmp/AllowanceCalculatorComponent.java @@ -0,0 +1,136 @@ +package com.zt.plat.module.qms.core.qlexpress.cmp; + +import java.math.BigDecimal; +import java.math.RoundingMode; + +import org.springframework.stereotype.Component; + +import com.ql.util.express.DefaultContext; +import com.ql.util.express.ExpressRunner; + +import jakarta.annotation.Resource; +import lombok.extern.slf4j.Slf4j; + +/** + * 允差值计算器工具类 + */ +@Slf4j +@Component +public class AllowanceCalculatorComponent { + + @Resource + private ExpressRunner expressRunner; + + /** + * 计算允差值:支持原生线性公式 和 Express 自定义公式混合模式 + * + * @param minValue 允差范围最小值 (X1) + * @param maxValue 允差范围最大值 (X2) + * @param minYc 最小允差值 (Y1) + * @param maxYc 最大允差值 (Y2) + * @param c 常数偏移量 C + * @param ran 当前测量值 X + * @param isUseFormula 是否使用自定义公式 (1=是, 其他=否) + * @param formula 自定义表达式字符串,如 "X > 10 ? 0.5 : 0.3",变量用 X 表示当前值 + * @param scale 结果保留小数位数 + * @return 允差值 yc + */ + public BigDecimal calculateAllowableValue( + BigDecimal minValue, + BigDecimal maxValue, + BigDecimal minYc, + BigDecimal maxYc, + BigDecimal c, + BigDecimal ran, + Integer isUseFormula, + String formula, + int scale) { + + // 参数校验 + if (minValue == null || maxValue == null || minYc == null || maxYc == null || + c == null || ran == null || scale < 0) { + throw new IllegalArgumentException("参数不能为空,且 scale >= 0"); + } + + boolean useCustomFormula = isUseFormula != null && isUseFormula.intValue() == 1; + + if (useCustomFormula && (formula == null || formula.trim().isEmpty())) { + throw new IllegalArgumentException("启用了自定义公式,但 formula 为空"); + } + + BigDecimal ycValue; + + try { + if (useCustomFormula) { + log.debug("使用自定义公式计算: formula='{}', X={}", formula, ran); + ycValue = evaluateCustomFormula(formula, ran, scale); + } else { + log.debug("使用线性公式计算: X={}, range=[{},{}], yc=[{},{}]", ran, minValue, maxValue, minYc, maxYc); + ycValue = calculateLinearAllowance(minValue, maxValue, minYc, maxYc, c, ran, scale); + } + } catch (Exception e) { + log.error("计算允差值失败", e); + throw new RuntimeException("计算允差值失败: " + e.getMessage(), e); + } + + return ycValue; + } + + /** + * 使用 Express 执行自定义公式 + */ + private BigDecimal evaluateCustomFormula(String formula, BigDecimal xValue, int scale) { + DefaultContext context = new DefaultContext<>(); + context.put("X", xValue); // 用户公式中使用 X 作为变量名 + + try { + Object result = expressRunner.execute(formula, context, null, true, false); + + if (result == null) { + throw new RuntimeException("Express 公式返回结果为 null"); + } + + BigDecimal decimalResult; + if (result instanceof BigDecimal) { + decimalResult = (BigDecimal) result; + } else if (result instanceof Number) { + decimalResult = new BigDecimal(((Number) result).toString()); + } else { + decimalResult = new BigDecimal(result.toString()); + } + + return decimalResult.setScale(scale, RoundingMode.HALF_EVEN); + } catch (Exception e) { + throw new RuntimeException("执行自定义公式失败: '" + formula + "', 错误: " + e.getMessage(), e); + } + } + + /** + * 原生 Java 计算线性允差值:yc = k * X + b + c + */ + private BigDecimal calculateLinearAllowance( + BigDecimal minValue, + BigDecimal maxValue, + BigDecimal minYc, + BigDecimal maxYc, + BigDecimal c, + BigDecimal ran, + int scale) { + + BigDecimal deltaVa = maxValue.subtract(minValue); + BigDecimal deltaYc = maxYc.subtract(minYc); + + BigDecimal k; + if (deltaVa.compareTo(BigDecimal.ZERO) == 0) { + k = BigDecimal.ZERO; // 防止除零 + } else { + k = deltaYc.divide(deltaVa, 10, RoundingMode.HALF_EVEN); // 高精度除法 + } + + BigDecimal b = maxYc.subtract(maxValue.multiply(k)); + return k.multiply(ran) + .add(b) + .add(c) + .setScale(scale, RoundingMode.HALF_EVEN); + } +} diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/core/qlexpress/config/QlExpressRuleEngineConfig.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/core/qlexpress/config/QlExpressRuleEngineConfig.java index f22725f..8bbd346 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/core/qlexpress/config/QlExpressRuleEngineConfig.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/core/qlexpress/config/QlExpressRuleEngineConfig.java @@ -5,18 +5,6 @@ import org.springframework.context.annotation.Configuration; import com.ql.util.express.ExpressRunner; -/** - * QlExpressRuleEngineConfig - *

- * 更新历史: - *

 版本         更新时间            更新者        更新内容
- * V1.0 2025年10月9日 wxr Add
- * Copyright (C) 云南志者竟成科技有限公司 - *

- * @author 王兴荣 - * @version V1.0 - * @since 2025年10月9日 - */ @Configuration public class QlExpressRuleEngineConfig { diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/config/dal/mapper/ConfigAssayMethodProjectAssessmentMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/config/dal/mapper/ConfigAssayMethodProjectAssessmentMapper.xml new file mode 100644 index 0000000..6ae50ce --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/config/dal/mapper/ConfigAssayMethodProjectAssessmentMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/config/dal/mapper/ConfigAssayMethodProjectCoefficientMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/config/dal/mapper/ConfigAssayMethodProjectCoefficientMapper.xml new file mode 100644 index 0000000..db17ab0 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/config/dal/mapper/ConfigAssayMethodProjectCoefficientMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/config/dal/mapper/ConfigRuleMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/config/dal/mapper/ConfigRuleMapper.xml new file mode 100644 index 0000000..a82b62c --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/config/dal/mapper/ConfigRuleMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/test/java/com/zt/plat/module/qms/AllowanceCalculatorComponentTest.java b/zt-module-qms/zt-module-qms-server/src/test/java/com/zt/plat/module/qms/AllowanceCalculatorComponentTest.java new file mode 100644 index 0000000..fcda29a --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/test/java/com/zt/plat/module/qms/AllowanceCalculatorComponentTest.java @@ -0,0 +1,109 @@ +package com.zt.plat.module.qms; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import java.math.BigDecimal; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit.jupiter.SpringExtension; + +import com.zt.plat.module.qms.core.qlexpress.cmp.AllowanceCalculatorComponent; +import com.zt.plat.module.qms.core.qlexpress.config.QlExpressRuleEngineConfig; + +import jakarta.annotation.Resource; + +@ExtendWith(SpringExtension.class) +@ContextConfiguration(classes = { AllowanceCalculatorComponent.class, QlExpressRuleEngineConfig.class }) +@DisplayName("允差计算器 AllowanceCalculatorComponent 测试") +public class AllowanceCalculatorComponentTest { + + @Resource + private AllowanceCalculatorComponent calculator; + + private final int SCALE = 4; + + @BeforeEach + void setUp() { + // 可在此模拟依赖或初始化数据 + } + + @Test + @DisplayName("应正确计算线性允差值") + void shouldCalculateLinearAllowanceCorrectly() { + + BigDecimal minValue = new BigDecimal("0"); + BigDecimal maxValue = new BigDecimal("100"); + BigDecimal minYc = new BigDecimal("0.1"); + BigDecimal maxYc = new BigDecimal("0.5"); + BigDecimal c = new BigDecimal("0.02"); + BigDecimal ran = new BigDecimal("60"); + Integer isUseFormula = 0; + + BigDecimal result = calculator.calculateAllowableValue( + minValue, maxValue, minYc, maxYc, c, ran, isUseFormula, null, SCALE); + + // Assert + assertEquals(new BigDecimal("0.3600"), result); + + } + + @Test + @DisplayName("应正确执行自定义表达式") + void shouldEvaluateCustomFormulaCorrectly() { + // Arrange + BigDecimal minValue = BigDecimal.ZERO; + BigDecimal maxValue = new BigDecimal("100"); + BigDecimal minYc = new BigDecimal("0.1"); + BigDecimal maxYc = new BigDecimal("0.5"); + BigDecimal c = BigDecimal.ZERO; + BigDecimal ran = new BigDecimal("70"); + Integer isUseFormula = 1; + String formula = "X > 50 ? 0.8 : 0.3"; + + // Act + BigDecimal result = calculator.calculateAllowableValue(minValue, maxValue, minYc, maxYc, c, ran, isUseFormula, + formula, SCALE); + + // Assert + assertEquals(new BigDecimal("0.8000"), result); + } + + // —————————————————————————————————————— + // 测试:异常情况 + // —————————————————————————————————————— + + @Test + @DisplayName("启用自定义公式但 formula 为空应抛出异常") + void shouldThrowExceptionWhenFormulaIsNullAndUseFormulaIsTrue() { + assertThrows(IllegalArgumentException.class, () -> { + calculator.calculateAllowableValue( + BigDecimal.ONE, BigDecimal.TEN, BigDecimal.ONE, BigDecimal.TEN, + BigDecimal.ZERO, BigDecimal.ONE, 1, null, SCALE); + }); + } + + @Test + @DisplayName("表达式语法错误应抛出异常") + void shouldThrowExceptionWhenFormulaSyntaxError() { + assertThrows(RuntimeException.class, () -> { + calculator.calculateAllowableValue( + BigDecimal.ONE, BigDecimal.TEN, BigDecimal.ONE, BigDecimal.TEN, + BigDecimal.ZERO, BigDecimal.ONE, 1, "X + + 1", SCALE); + }); + } + + @Test + @DisplayName("参数为 null 应抛出异常") + void shouldThrowExceptionWhenNullParameter() { + assertThrows(IllegalArgumentException.class, () -> { + calculator.calculateAllowableValue( + null, BigDecimal.TEN, BigDecimal.ONE, BigDecimal.TEN, + BigDecimal.ZERO, BigDecimal.ONE, 0, null, SCALE); + }); + } +}