refactor(sampling-plan): 重构抽样方案相关实体字段及新增接口测试

- 合并并简化抽样方案检验实体字段,移除冗余特殊检验和一般检验字段
- 修改QmsSamplingPlanInspection中检验类型和字码字段命名
- 新增完整的抽样方案模块API测试用例,覆盖新增场景与参数校验
- 实现抽样方案新增、编辑、删除及查询的业务逻辑服务层
- 新增抽样方案详情VO,包含关联的AQL优先值、转移规则、字码等信息
- 提升代码结构清晰度及增强接口调用的自动化测试覆盖
This commit is contained in:
曹鹏飞 2026-04-14 09:46:29 +08:00
parent 8e720af85e
commit 577f7a44bf
5 changed files with 23 additions and 143 deletions

View File

@ -146,13 +146,8 @@ public class QmsSamplingPlanControllerService {
.setSamplingPlanId(planId) .setSamplingPlanId(planId)
.setRangeStart(qo.getRangeStart()) .setRangeStart(qo.getRangeStart())
.setRangeEnd(qo.getRangeEnd()) .setRangeEnd(qo.getRangeEnd())
.setSpecialInspectionS1(qo.getSpecialInspectionS1()) .setInspectionDictionaryItemId(qo.getInspectionDictionaryItemId())
.setSpecialInspectionS2(qo.getSpecialInspectionS2()) .setCodeLetterId(qo.getCodeLetterId());
.setSpecialInspectionS3(qo.getSpecialInspectionS3())
.setSpecialInspectionS4(qo.getSpecialInspectionS4())
.setGeneralInspection1(qo.getGeneralInspection1())
.setGeneralInspection2(qo.getGeneralInspection2())
.setGeneralInspection3(qo.getGeneralInspection3());
inspections.add(entity); inspections.add(entity);
} }
samplingPlanInspectionService.saveBatch(inspections); samplingPlanInspectionService.saveBatch(inspections);
@ -265,13 +260,8 @@ public class QmsSamplingPlanControllerService {
.setSamplingPlanId(planId) .setSamplingPlanId(planId)
.setRangeStart(qo.getRangeStart()) .setRangeStart(qo.getRangeStart())
.setRangeEnd(qo.getRangeEnd()) .setRangeEnd(qo.getRangeEnd())
.setSpecialInspectionS1(qo.getSpecialInspectionS1()) .setInspectionDictionaryItemId(qo.getInspectionDictionaryItemId())
.setSpecialInspectionS2(qo.getSpecialInspectionS2()) .setCodeLetterId(qo.getCodeLetterId());
.setSpecialInspectionS3(qo.getSpecialInspectionS3())
.setSpecialInspectionS4(qo.getSpecialInspectionS4())
.setGeneralInspection1(qo.getGeneralInspection1())
.setGeneralInspection2(qo.getGeneralInspection2())
.setGeneralInspection3(qo.getGeneralInspection3());
inspections.add(entity); inspections.add(entity);
} }
samplingPlanInspectionService.saveBatch(inspections); samplingPlanInspectionService.saveBatch(inspections);
@ -406,13 +396,7 @@ public class QmsSamplingPlanControllerService {
detail.setSamplingPlanInspections(inspections.stream() detail.setSamplingPlanInspections(inspections.stream()
.map(i -> { .map(i -> {
QmsSamplingPlanDetailVO.SamplingPlanInspectionVO vo = BeanUtil.copyProperties(i, QmsSamplingPlanDetailVO.SamplingPlanInspectionVO.class); QmsSamplingPlanDetailVO.SamplingPlanInspectionVO vo = BeanUtil.copyProperties(i, QmsSamplingPlanDetailVO.SamplingPlanInspectionVO.class);
vo.setSpecialInspectionS1Code(codeLetterMap.get(i.getSpecialInspectionS1())); vo.setCodeLetter(codeLetterMap.get(i.getCodeLetterId()));
vo.setSpecialInspectionS2Code(codeLetterMap.get(i.getSpecialInspectionS2()));
vo.setSpecialInspectionS3Code(codeLetterMap.get(i.getSpecialInspectionS3()));
vo.setSpecialInspectionS4Code(codeLetterMap.get(i.getSpecialInspectionS4()));
vo.setGeneralInspection1Code(codeLetterMap.get(i.getGeneralInspection1()));
vo.setGeneralInspection2Code(codeLetterMap.get(i.getGeneralInspection2()));
vo.setGeneralInspection3Code(codeLetterMap.get(i.getGeneralInspection3()));
return vo; return vo;
}) })
.collect(Collectors.toList())); .collect(Collectors.toList()));

View File

@ -254,13 +254,8 @@ public class QmsSamplingPlanApiTest {
QmsSamplingPlanAddQO.SamplingPlanInspectionQO inspection = new QmsSamplingPlanAddQO.SamplingPlanInspectionQO(); QmsSamplingPlanAddQO.SamplingPlanInspectionQO inspection = new QmsSamplingPlanAddQO.SamplingPlanInspectionQO();
inspection.setRangeStart(1201); inspection.setRangeStart(1201);
inspection.setRangeEnd(3200); inspection.setRangeEnd(3200);
inspection.setSpecialInspectionS1(1L); inspection.setInspectionDictionaryItemId(1L);
inspection.setSpecialInspectionS2(1L); inspection.setCodeLetterId(1L);
inspection.setSpecialInspectionS3(1L);
inspection.setSpecialInspectionS4(1L);
inspection.setGeneralInspection1(1L);
inspection.setGeneralInspection2(1L);
inspection.setGeneralInspection3(1L);
inspections.add(inspection); inspections.add(inspection);
request.setSamplingPlanInspections(inspections); request.setSamplingPlanInspections(inspections);

View File

@ -174,45 +174,15 @@ public class QmsSamplingPlanAddQO {
private Integer rangeEnd; private Integer rangeEnd;
/** /**
* 特殊检验S1字码ID * 检验类型id关联字典项id
*/ */
@NotNull(message = "特殊检验S1不能为空") @NotNull(message = "检验类型不能为空")
private Long specialInspectionS1; private Long inspectionDictionaryItemId;
/** /**
* 特殊检验S2字码ID * 字码ID
*/ */
@NotNull(message = "特殊检验S2不能为空") @NotNull(message = "字码ID不能为空")
private Long specialInspectionS2; private Long codeLetterId;
/**
* 特殊检验S3字码ID
*/
@NotNull(message = "特殊检验S3不能为空")
private Long specialInspectionS3;
/**
* 特殊检验S4字码ID
*/
@NotNull(message = "特殊检验S4不能为空")
private Long specialInspectionS4;
/**
* 一般检验I字码ID
*/
@NotNull(message = "一般检验I不能为空")
private Long generalInspection1;
/**
* 一般检验II字码ID
*/
@NotNull(message = "一般检验II不能为空")
private Long generalInspection2;
/**
* 一般检验III字码ID
*/
@NotNull(message = "一般检验III不能为空")
private Long generalInspection3;
} }
} }

View File

@ -141,60 +141,16 @@ public class QmsSamplingPlanDetailVO extends QmsSamplingPlanVO {
*/ */
private Integer rangeEnd; private Integer rangeEnd;
/** /**
* 特殊检验S1字码ID * 检验类型id关联字典项id
*/ */
private Long specialInspectionS1; private Long inspectionDictionaryItemId;
/** /**
* 特殊检验S1字码 * 字码ID
*/ */
private String specialInspectionS1Code; private Long codeLetterId;
/** /**
* 特殊检验S2字码ID * 字码
*/ */
private Long specialInspectionS2; private String codeLetter;
/**
* 特殊检验S2字码
*/
private String specialInspectionS2Code;
/**
* 特殊检验S3字码ID
*/
private Long specialInspectionS3;
/**
* 特殊检验S3字码
*/
private String specialInspectionS3Code;
/**
* 特殊检验S4字码ID
*/
private Long specialInspectionS4;
/**
* 特殊检验S4字码
*/
private String specialInspectionS4Code;
/**
* 一般检验I字码ID
*/
private Long generalInspection1;
/**
* 一般检验I字码
*/
private String generalInspection1Code;
/**
* 一般检验II字码ID
*/
private Long generalInspection2;
/**
* 一般检验II字码
*/
private String generalInspection2Code;
/**
* 一般检验III字码ID
*/
private Long generalInspection3;
/**
* 一般检验III字码
*/
private String generalInspection3Code;
} }
} }

View File

@ -41,37 +41,12 @@ public class QmsSamplingPlanInspection implements Serializable {
private Integer rangeEnd; private Integer rangeEnd;
/** /**
* 特殊检验S1字码ID * 检验类型id关联字典项id
*/ */
private Long specialInspectionS1; private Long inspectionDictionaryItemId;
/** /**
* 特殊检验S2字码ID * 字码ID
*/ */
private Long specialInspectionS2; private Long codeLetterId;
/**
* 特殊检验S3字码ID
*/
private Long specialInspectionS3;
/**
* 特殊检验S4字码ID
*/
private Long specialInspectionS4;
/**
* 一般检验I字码ID
*/
private Long generalInspection1;
/**
* 一般检验II字码ID
*/
private Long generalInspection2;
/**
* 一般检验III字码ID
*/
private Long generalInspection3;
} }