Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -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, "检测标准明细不存在");
|
||||
|
||||
@@ -110,6 +110,12 @@
|
||||
<dependency>
|
||||
<groupId>com.zt.plat</groupId>
|
||||
<artifactId>zt-spring-boot-starter-test</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.vaadin.external.google</groupId>
|
||||
<artifactId>android-json</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- 工具类相关 -->
|
||||
|
||||
@@ -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<BusinessAssayTaskDataDO> {
|
||||
|
||||
|
||||
List<BusinessAssayTaskDataGroupRespVO> selectUnAssayTaskGroupList(@Param("reqVO") BusinessAssayTaskDataReqVO reqVO);
|
||||
|
||||
List<BusinessAssayTaskDataGroupRespVO> selectUnAuditTaskGroupList(@Param("reqVO") BusinessAssayTaskDataReqVO reqVO);
|
||||
|
||||
default List<BusinessAssayTaskDataExtendRespVO> selectList(BusinessAssayTaskDataReqVO reqVO) {
|
||||
return selectJoinList(BusinessAssayTaskDataExtendRespVO.class, new MPJLambdaWrapperX<BusinessAssayTaskDataDO>()
|
||||
.leftJoin(ConfigAssayMethodDO.class, ConfigAssayMethodDO::getId, BusinessAssayTaskDataDO::getConfigAssayMethodId)
|
||||
@@ -102,4 +98,44 @@ public interface BusinessAssayTaskDataMapper extends BaseMapperX<BusinessAssayTa
|
||||
.orderByDesc(BusinessAssayTaskDataDO::getId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询未指派的分析任务分组
|
||||
* @param reqVO
|
||||
* @return
|
||||
*/
|
||||
List<BusinessAssayTaskDataGroupRespVO> selectUnAssayTaskGroupList(@Param("reqVO") BusinessAssayTaskDataReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 查询未审核的分析任务分组
|
||||
* @param reqVO
|
||||
* @return
|
||||
*/
|
||||
List<BusinessAssayTaskDataGroupRespVO> selectUnAuditTaskGroupList(@Param("reqVO") BusinessAssayTaskDataReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 根据任务分配单id查询分析任务
|
||||
* @param businessAssayTaskId 任务分配单id
|
||||
* @return
|
||||
*/
|
||||
default List<BusinessAssayTaskDataDO> selectByBusinessAssayTaskId(Long businessAssayTaskId) {
|
||||
return selectList(new LambdaQueryWrapperX<BusinessAssayTaskDataDO>()
|
||||
.eq(BusinessAssayTaskDataDO::getBusinessAssayTaskId, businessAssayTaskId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询是否上报的分析任务
|
||||
* @param excludeIds 排除的id列表
|
||||
* @param businessSubSampleId 子样id
|
||||
* @param configAssayMethodId 分析方法id
|
||||
* @param isReported 是否上报
|
||||
* @return
|
||||
*/
|
||||
default List<BusinessAssayTaskDataDO> selectIsReportedList(List<Long> excludeIds, Long businessSubSampleId, Long configAssayMethodId, Integer isReported) {
|
||||
return selectList(new LambdaQueryWrapperX<BusinessAssayTaskDataDO>()
|
||||
.notIn(BusinessAssayTaskDataDO::getId, excludeIds)
|
||||
.eq(BusinessAssayTaskDataDO::getBusinessSubSampleId, businessSubSampleId)
|
||||
.eq(BusinessAssayTaskDataDO::getConfigAssayMethodId, configAssayMethodId)
|
||||
.eq(BusinessAssayTaskDataDO::getIsReported, isReported));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<BusinessAssay
|
||||
.orderByDesc(BusinessAssayTaskDetailDO::getId));
|
||||
}
|
||||
|
||||
default List<BusinessAssayTaskDetailDO> selectByBusinessAssayTaskId(Long businessAssayTaskId) {
|
||||
return selectList(new LambdaQueryWrapperX<BusinessAssayTaskDetailDO>()
|
||||
.eqIfPresent(BusinessAssayTaskDetailDO::getBusinessAssayTaskId, businessAssayTaskId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<ConfigAssayMethodProjectAssessmentDO> 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;//允差值
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<Long> configAssayMethodIdList = materialAssayStandardMethodList.stream().map(m -> m.getConfigAssayMethodId()).distinct().collect(Collectors.toList());
|
||||
|
||||
//查找子样配置
|
||||
List<Long> configSubSampleIdList = configSubSampleMethodList.stream().filter(f -> configAssayMethodIdList.contains(f.getConfigAssayMethodId())).map(m -> m.getConfigSubSampleId()).distinct().collect(Collectors.toList());
|
||||
List<Long> configSubSampleIdList = configSubSampleMethodList.stream().filter(f -> f.getIsDefaultUse().equals(QmsCommonConstant.YES) && configAssayMethodIdList.contains(f.getConfigAssayMethodId())).map(m -> m.getConfigSubSampleId()).distinct().collect(Collectors.toList());
|
||||
|
||||
//查询当前委托样品对应的子样
|
||||
List<ConfigSubSampleDO> 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();
|
||||
@@ -328,6 +331,14 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent {
|
||||
businessSubSampleAnalysisGroupDOList.add(businessSubSampleAnalysisGroupDO);
|
||||
}
|
||||
|
||||
//根据检测方法循环
|
||||
BusinessAssayTaskDataDO businessAssayTaskDataDO = null;
|
||||
|
||||
//根据任务数判断是平行还是
|
||||
String assayType = configSubSampleMethodDO.getTaskCount() > 1 ? "平行" : "单杯";
|
||||
|
||||
//根据任务数循环
|
||||
for (int i = 0; i < configSubSampleMethodDO.getTaskCount(); i++) {
|
||||
//子样检测任务
|
||||
businessAssayTaskDataDO = new BusinessAssayTaskDataDO();
|
||||
businessAssayTaskDataDO.setId(IdWorker.getId());
|
||||
@@ -335,7 +346,7 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent {
|
||||
businessAssayTaskDataDO.setBusinessSubParentSampleId(businessSubSampleDO.getBusinessSubParentSampleId());
|
||||
businessAssayTaskDataDO.setBusinessSubSampleId(businessSubSampleDO.getId());
|
||||
businessAssayTaskDataDO.setConfigAssayMethodId(configAssayMethodId);
|
||||
businessAssayTaskDataDO.setAssayType("单杯");
|
||||
businessAssayTaskDataDO.setAssayType(assayType);
|
||||
businessAssayTaskDataDO.setTaskType("常规");
|
||||
businessAssayTaskDataDO.setConfigSampleFlowId(configSampleFlowSub.getId());
|
||||
businessAssayTaskDataDO.setSampleFlowNodeKey(sampleFlowNodeSub.getNodeKey());
|
||||
@@ -392,6 +403,7 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent {
|
||||
assayProjectBuilder.delete(assayProjectBuilder.length() - 1 , assayProjectBuilder.length());
|
||||
businessAssayTaskDataDO.setAssayProject(assayProjectBuilder.toString());
|
||||
businessAssayTaskDataDOList.add(businessAssayTaskDataDO);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* <b>SampleTaskAssignMethodCmp</b>
|
||||
* <p>
|
||||
* 更新历史:
|
||||
* <pre> 版本 更新时间 更新者 更新内容<hr/>
|
||||
* V1.0 2025年9月20日 wxr Add</pre>
|
||||
* <b>Copyright (C) 云南志者竟成科技有限公司</b>
|
||||
* </p>
|
||||
* @author 王兴荣<wxr@wangxingrong.com>
|
||||
* @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<AssignAssayUser> assignAssayUserList = sampleTaskAssignContext.getAssignAssayUserList();
|
||||
//查询分析方法配置
|
||||
ConfigAssayMethodDO configAssayMethod = configAssayMethodMapper.selectById(assignConfigAssayMethodId);
|
||||
List<ConfigAssayMethodDO> configAssayMethodList = sampleTaskAssignContext.getConfigAssayMethodList();
|
||||
if (CollUtil.isEmpty(configAssayMethodList)) {
|
||||
configAssayMethodList = new ArrayList<>();
|
||||
configAssayMethodList.add(configAssayMethod);
|
||||
}
|
||||
//查询报表模板
|
||||
ConfigReportTemplateDO configReportTemplate = configReportTemplateMapper.selectLatestConfigReportTemplateByKey(configAssayMethod.getConfigReportTemplateKey());
|
||||
|
||||
List<BusinessAssayTaskDataDO> businessAssayTaskDataDOList = businessAssayTaskDataMapper.selectList(new LambdaQueryWrapperX<BusinessAssayTaskDataDO>().eq(BusinessAssayTaskDataDO::getConfigAssayMethodId, assignConfigAssayMethodId).eq(BusinessAssayTaskDataDO::getIsAssignTasked, QmsCommonConstant.NO));
|
||||
|
||||
List<Long> businessSubSampleIdList = businessAssayTaskDataDOList.stream().map(m -> m.getBusinessSubSampleId()).collect(Collectors.toList());
|
||||
List<BusinessSubSampleDO> businessSubSampleList = businessSubSampleMapper.selectByIds(businessSubSampleIdList);
|
||||
sampleTaskAssignContext.setBusinessSubSampleList(businessSubSampleList);
|
||||
|
||||
List<BusinessAssayTaskDataDO> businessAssayTaskDataList = new ArrayList<>();
|
||||
|
||||
//任务分配单
|
||||
List<BusinessAssayTaskDO> businessAssayTaskList = new ArrayList<>();
|
||||
//任务分配单明细
|
||||
List<BusinessAssayTaskDetailDO> 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* <b>SampleTaskAssignSampleCmp</b>
|
||||
* <p>
|
||||
* 更新历史:
|
||||
* <pre> 版本 更新时间 更新者 更新内容<hr/>
|
||||
* V1.0 2025年9月20日 wxr Add</pre>
|
||||
* <b>Copyright (C) 云南志者竟成科技有限公司</b>
|
||||
* </p>
|
||||
* @author 王兴荣<wxr@wangxingrong.com>
|
||||
* @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<Long> assignSampleIdList = sampleTaskAssignContext.getAssignSampleIdList();
|
||||
//根据分配的样品id查询分析任务数据
|
||||
List<BusinessAssayTaskDataDO> businessAssayTaskDataList = businessAssayTaskDataMapper.selectList(new LambdaQueryWrapperX<BusinessAssayTaskDataDO>().in(BusinessAssayTaskDataDO::getBusinessSubSampleId, assignSampleIdList).eq(BusinessAssayTaskDataDO::getIsAssignTasked, QmsCommonConstant.NO));
|
||||
List<Long> configAssayMethodIdList = businessAssayTaskDataList.stream().map(m -> m.getConfigAssayMethodId()).distinct().collect(Collectors.toList());
|
||||
List<ConfigAssayMethodDO> configAssayMethodList = configAssayMethodMapper.selectByIds(configAssayMethodIdList);
|
||||
sampleTaskAssignContext.setConfigAssayMethodList(configAssayMethodList);
|
||||
|
||||
//查询子样
|
||||
List<BusinessSubSampleDO> businessSubSampleList = businessSubSampleMapper.selectByIds(assignSampleIdList);
|
||||
sampleTaskAssignContext.setBusinessSubSampleList(businessSubSampleList);
|
||||
|
||||
//任务分配单
|
||||
List<BusinessAssayTaskDO> businessAssayTaskList = new ArrayList<>();
|
||||
//任务分配单明细
|
||||
List<BusinessAssayTaskDetailDO> businessAssayTaskDetailList = new ArrayList<>();
|
||||
|
||||
//按分析方法分组
|
||||
Map<Long, List<BusinessAssayTaskDataDO>> groupBusinessAssayTaskDataListMap = businessAssayTaskDataList.stream().collect(Collectors.groupingBy(BusinessAssayTaskDataDO::getConfigAssayMethodId));
|
||||
for (Map.Entry<Long, List<BusinessAssayTaskDataDO>> 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<BusinessAssayTaskDataDO> 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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,9 +41,27 @@ 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,6 +71,138 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
|
||||
businessAssayTaskDO.setFlowStatus(QmsCommonConstant.APPROVED);
|
||||
businessAssayTaskDO.setReportTime(LocalDateTime.now());
|
||||
businessAssayTaskDO.setReportOperator(SecurityFrameworkUtils.getLoginUserNickname());
|
||||
|
||||
//List<BusinessAssayTaskDetailDO> businessAssayTaskDetailDOList = businessAssayTaskDetailMapper.selectByBusinessAssayTaskId(businessAssayTaskId);
|
||||
|
||||
//查询分析任务明细
|
||||
List<BusinessAssayTaskDataDO> businessAssayTaskDataDOList = businessAssayTaskDataMapper.selectByBusinessAssayTaskId(businessAssayTaskId);
|
||||
|
||||
Map<Long, List<BusinessAssayTaskDataDO>> businessAssayTaskDataDOMap = businessAssayTaskDataDOList.stream().collect(Collectors.groupingBy(BusinessAssayTaskDataDO::getBusinessSubSampleId));
|
||||
for (Map.Entry<Long, List<BusinessAssayTaskDataDO>> businessAssayTaskDataDOMapEntry : businessAssayTaskDataDOMap.entrySet()) {
|
||||
//Long key = businessAssayTaskDataDOMapEntry.getKey();
|
||||
List<BusinessAssayTaskDataDO> businessAssayTaskDataList = businessAssayTaskDataDOMapEntry.getValue();
|
||||
List<Long> businessAssayTaskDataIdList = businessAssayTaskDataList.stream().map(m -> m.getId()).collect(Collectors.toList());
|
||||
BusinessAssayTaskDataDO businessAssayTaskDataDO = businessAssayTaskDataList.get(0);
|
||||
|
||||
if ("平行".equals(businessAssayTaskDataDO.getAssayType())) {
|
||||
//根据子样id及分析方法id,查询未上报的分析任务
|
||||
List<BusinessAssayTaskDataDO> unReportedList = businessAssayTaskDataMapper.selectIsReportedList(businessAssayTaskDataIdList, businessAssayTaskDataDO.getBusinessSubSampleId(), businessAssayTaskDataDO.getConfigAssayMethodId(), QmsCommonConstant.NO);
|
||||
if (unReportedList.size() > 0) {//还有未上报数据,直接处理,无需判定
|
||||
continue;
|
||||
} else {//做超差判定
|
||||
//根据子样id及分析方法id,查询已上报的分析任务
|
||||
List<BusinessAssayTaskDataDO> reportedList = businessAssayTaskDataMapper.selectIsReportedList(businessAssayTaskDataIdList, businessAssayTaskDataDO.getBusinessSubSampleId(), businessAssayTaskDataDO.getConfigAssayMethodId(), QmsCommonConstant.YES);
|
||||
if (reportedList.size() > 0) {
|
||||
List<Long> reportedBusinessAssayTaskDataIdList = reportedList.stream().map(m -> m.getId()).collect(Collectors.toList());
|
||||
businessAssayTaskDataIdList.addAll(reportedBusinessAssayTaskDataIdList);
|
||||
}
|
||||
|
||||
//查询分析项目
|
||||
List<BusinessAssayProjectDataDO> businessAssayProjectDataDOList = businessAssayProjectDataMapper.selectList(new LambdaQueryWrapperX<BusinessAssayProjectDataDO>().in(BusinessAssayProjectDataDO::getBusinessAssayTaskDataId, businessAssayTaskDataIdList));
|
||||
Map<Long, List<BusinessAssayProjectDataDO>> businessAssayProjectDataDOMap = businessAssayProjectDataDOList.stream().collect(Collectors.groupingBy(BusinessAssayProjectDataDO::getDictionaryProjectId));
|
||||
for (Map.Entry<Long, List<BusinessAssayProjectDataDO>> entry1 : businessAssayProjectDataDOMap.entrySet()) {
|
||||
Long dictionaryProjectId = entry1.getKey();
|
||||
List<BusinessAssayProjectDataDO> val1 = entry1.getValue();
|
||||
BusinessAssayProjectDataDO businessAssayProjectDataDO = val1.get(0);
|
||||
List<ConfigAssayMethodProjectAssessmentDO> configAssayMethodProjectAssessmentDOList = configAssayMethodProjectAssessmentMapper.selectList(new LambdaQueryWrapperX<ConfigAssayMethodProjectAssessmentDO>().eq(ConfigAssayMethodProjectAssessmentDO::getConfigAssayMethodId, businessAssayTaskDataDO.getConfigAssayMethodId()).eq(ConfigAssayMethodProjectAssessmentDO::getConfigAssayMethodProjectId, businessAssayProjectDataDO.getConfigAssayMethodProjectId()));
|
||||
|
||||
|
||||
// 排序并处理 null
|
||||
List<BigDecimal> 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);
|
||||
@@ -44,4 +210,46 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
|
||||
businessAssayTaskMapper.updateById(businessAssayTaskDO);
|
||||
}
|
||||
|
||||
// 查找匹配的允差区间
|
||||
private ConfigAssayMethodProjectAssessmentDO findMatchingRule(List<ConfigAssayMethodProjectAssessmentDO> 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<BigDecimal> 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<ConfigAssayMethodProjectAssessmentRespVO> 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<Boolean> 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<Boolean> 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<Boolean> 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<ConfigAssayMethodProjectAssessmentRespVO> 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<PageResult<ConfigAssayMethodProjectAssessmentRespVO>> getConfigAssayMethodProjectAssessmentPage(@Valid ConfigAssayMethodProjectAssessmentPageReqVO pageReqVO) {
|
||||
PageResult<ConfigAssayMethodProjectAssessmentDO> 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<ConfigAssayMethodProjectAssessmentDO> list = configAssayMethodProjectAssessmentService.getConfigAssayMethodProjectAssessmentPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "检测方法分析项目判定.xls", "数据", ConfigAssayMethodProjectAssessmentRespVO.class,
|
||||
BeanUtils.toBean(list, ConfigAssayMethodProjectAssessmentRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<ConfigAssayMethodProjectCoefficientRespVO> 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<Boolean> 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<Boolean> 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<Boolean> 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<ConfigAssayMethodProjectCoefficientRespVO> 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<PageResult<ConfigAssayMethodProjectCoefficientRespVO>> getConfigAssayMethodProjectCoefficientPage(@Valid ConfigAssayMethodProjectCoefficientPageReqVO pageReqVO) {
|
||||
PageResult<ConfigAssayMethodProjectCoefficientDO> 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<ConfigAssayMethodProjectCoefficientDO> list = configAssayMethodProjectCoefficientService.getConfigAssayMethodProjectCoefficientPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "检测方法分析项目补正系数.xls", "数据", ConfigAssayMethodProjectCoefficientRespVO.class,
|
||||
BeanUtils.toBean(list, ConfigAssayMethodProjectCoefficientRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<ConfigRuleRespVO> createConfigRule(@Valid @RequestBody ConfigRuleSaveReqVO createReqVO) {
|
||||
return success(configRuleService.createConfigRule(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新规则配置")
|
||||
@PreAuthorize("@ss.hasPermission('qms:config-rule:update')")
|
||||
public CommonResult<Boolean> 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<Boolean> 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<Boolean> 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<ConfigRuleRespVO> 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<PageResult<ConfigRuleRespVO>> getConfigRulePage(@Valid ConfigRulePageReqVO pageReqVO) {
|
||||
PageResult<ConfigRuleDO> 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<ConfigRuleDO> list = configRuleService.getConfigRulePage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "规则配置.xls", "数据", ConfigRuleRespVO.class,
|
||||
BeanUtils.toBean(list, ConfigRuleRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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<ConfigAssayMethodProjectAssessmentDO> {
|
||||
|
||||
default PageResult<ConfigAssayMethodProjectAssessmentDO> selectPage(ConfigAssayMethodProjectAssessmentPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ConfigAssayMethodProjectAssessmentDO>()
|
||||
.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));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<ConfigAssayMethodProjectCoefficientDO> {
|
||||
|
||||
default PageResult<ConfigAssayMethodProjectCoefficientDO> selectPage(ConfigAssayMethodProjectCoefficientPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ConfigAssayMethodProjectCoefficientDO>()
|
||||
.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));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<ConfigRuleDO> {
|
||||
|
||||
default PageResult<ConfigRuleDO> selectPage(ConfigRulePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ConfigRuleDO>()
|
||||
.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));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得检测方法分析项目判定
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 检测方法分析项目判定
|
||||
*/
|
||||
ConfigAssayMethodProjectAssessmentDO getConfigAssayMethodProjectAssessment(Long id);
|
||||
|
||||
/**
|
||||
* 获得检测方法分析项目判定分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 检测方法分析项目判定分页
|
||||
*/
|
||||
PageResult<ConfigAssayMethodProjectAssessmentDO> getConfigAssayMethodProjectAssessmentPage(ConfigAssayMethodProjectAssessmentPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -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<Long> ids) {
|
||||
// 校验存在
|
||||
validateConfigAssayMethodProjectAssessmentExists(ids);
|
||||
// 删除
|
||||
configAssayMethodProjectAssessmentMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validateConfigAssayMethodProjectAssessmentExists(List<Long> ids) {
|
||||
List<ConfigAssayMethodProjectAssessmentDO> 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<ConfigAssayMethodProjectAssessmentDO> getConfigAssayMethodProjectAssessmentPage(ConfigAssayMethodProjectAssessmentPageReqVO pageReqVO) {
|
||||
return configAssayMethodProjectAssessmentMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得检测方法分析项目补正系数
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 检测方法分析项目补正系数
|
||||
*/
|
||||
ConfigAssayMethodProjectCoefficientDO getConfigAssayMethodProjectCoefficient(Long id);
|
||||
|
||||
/**
|
||||
* 获得检测方法分析项目补正系数分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 检测方法分析项目补正系数分页
|
||||
*/
|
||||
PageResult<ConfigAssayMethodProjectCoefficientDO> getConfigAssayMethodProjectCoefficientPage(ConfigAssayMethodProjectCoefficientPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -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<Long> ids) {
|
||||
// 校验存在
|
||||
validateConfigAssayMethodProjectCoefficientExists(ids);
|
||||
// 删除
|
||||
configAssayMethodProjectCoefficientMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validateConfigAssayMethodProjectCoefficientExists(List<Long> ids) {
|
||||
List<ConfigAssayMethodProjectCoefficientDO> 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<ConfigAssayMethodProjectCoefficientDO> getConfigAssayMethodProjectCoefficientPage(ConfigAssayMethodProjectCoefficientPageReqVO pageReqVO) {
|
||||
return configAssayMethodProjectCoefficientMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得规则配置
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 规则配置
|
||||
*/
|
||||
ConfigRuleDO getConfigRule(Long id);
|
||||
|
||||
/**
|
||||
* 获得规则配置分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 规则配置分页
|
||||
*/
|
||||
PageResult<ConfigRuleDO> getConfigRulePage(ConfigRulePageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -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<Long> ids) {
|
||||
// 校验存在
|
||||
validateConfigRuleExists(ids);
|
||||
// 删除
|
||||
configRuleMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validateConfigRuleExists(List<Long> ids) {
|
||||
List<ConfigRuleDO> 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<ConfigRuleDO> getConfigRulePage(ConfigRulePageReqVO pageReqVO) {
|
||||
return configRuleMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<String, Object> 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);
|
||||
}
|
||||
}
|
||||
@@ -5,18 +5,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import com.ql.util.express.ExpressRunner;
|
||||
|
||||
/**
|
||||
* <b>QlExpressRuleEngineConfig</b>
|
||||
* <p>
|
||||
* 更新历史:
|
||||
* <pre> 版本 更新时间 更新者 更新内容<hr/>
|
||||
* V1.0 2025年10月9日 wxr Add</pre>
|
||||
* <b>Copyright (C) 云南志者竟成科技有限公司</b>
|
||||
* </p>
|
||||
* @author 王兴荣<wxr@wangxingrong.com>
|
||||
* @version V1.0
|
||||
* @since 2025年10月9日
|
||||
*/
|
||||
@Configuration
|
||||
public class QlExpressRuleEngineConfig {
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodProjectAssessmentMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodProjectCoefficientMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zt.plat.module.qms.business.config.dal.mapper.ConfigRuleMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user