refactor(qms-inspection): 优化检验标准相关版本号及字典项处理

- 将检验标准相关的版本号字段由字符串类型改为数值类型,更精确对应数据库字段
- 增加采样方案及AQL优先级值服务依赖,简化名称获取逻辑,替换原有字典项名称映射方式
- 在检验标准内容VO中新增判定类型字典项名称字段并赋值,完善展示信息
- 优化空集合处理避免空指针异常
- 修改多处SQL映射,统一版本号字段取值为数值型version
- 调整检验标准项VO中AQL值名称类型为BigDecimal,提升数值表达准确性
This commit is contained in:
曹鹏飞 2026-04-21 14:44:30 +08:00
parent 54a6056231
commit c4f618ad9a
6 changed files with 32 additions and 24 deletions

View File

@ -1,5 +1,6 @@
package com.nflg.qms.admin.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -53,6 +54,12 @@ public class QmsInspectionStandardControllerService {
@Resource
private IDictionaryItemService dictionaryItemService;
@Resource
private IQmsSamplingPlanService samplingPlanService;
@Resource
private IQmsAqlPriorityValueService aqlPriorityValueService;
/**
* 分页查询检验标准
*/
@ -156,7 +163,7 @@ public class QmsInspectionStandardControllerService {
detail.setId(standard.getId());
detail.setMaterialId(standard.getMaterialId());
detail.setDrawingUrl(standard.getDrawingUrl());
detail.setVersionNo(standard.getVersion() != null ? standard.getVersion().toString() : null);
detail.setVersion(standard.getVersion());
detail.setIsEnabled(standard.getIsEnabled());
detail.setPackagingMethodId(standard.getPackagingMethodId());
detail.setInspectionCycle(standard.getInspectionCycle());
@ -185,10 +192,10 @@ public class QmsInspectionStandardControllerService {
dictionaryItemIds.add(item.getSamplingMethodDictItemId());
dictionaryItemIds.add(item.getInspectionLevelDictItemId());
dictionaryItemIds.add(item.getAqlTypeDictItemId());
dictionaryItemIds.add(item.getAqlPriorityValueId());
dictionaryItemIds.add(item.getInspectionStandardId());
});
List<DictionaryItem> dictionaryItems = dictionaryItemService.lambdaQuery()
List<DictionaryItem> dictionaryItems = CollectionUtil.isEmpty(dictionaryItemIds)
? new ArrayList<>()
: dictionaryItemService.lambdaQuery()
.in(DictionaryItem::getId, dictionaryItemIds)
.list();
for (QmsInspectionStandardItem item : items) {
@ -235,12 +242,7 @@ public class QmsInspectionStandardControllerService {
.orElse(null)
);
vo.setSamplingPlanId(item.getSamplingPlanId());
vo.setSamplingPlanName(dictionaryItems.stream()
.filter(it -> it.getId().equals(item.getSamplingPlanId()))
.findFirst()
.map(DictionaryItem::getName)
.orElse(null)
);
vo.setSamplingPlanName(samplingPlanService.getById(item.getSamplingPlanId()).getPlanName());
vo.setInspectionLevelDictItemId(item.getInspectionLevelDictItemId());
vo.setInspectionLevelDictItemName(dictionaryItems.stream()
.filter(it -> it.getId().equals(item.getInspectionLevelDictItemId()))
@ -249,12 +251,7 @@ public class QmsInspectionStandardControllerService {
.orElse(null)
);
vo.setAqlPriorityValueId(item.getAqlPriorityValueId());
vo.setAqlPriorityValueName(dictionaryItems.stream()
.filter(it -> it.getId().equals(item.getAqlPriorityValueId()))
.findFirst()
.map(DictionaryItem::getName)
.orElse(null)
);
vo.setAqlPriorityValueName(aqlPriorityValueService.getById(item.getAqlPriorityValueId()).getPriorityValue());
vo.setAqlTypeDictItemId(item.getAqlTypeDictItemId());
vo.setAqlTypeDictItemName(dictionaryItems.stream()
.filter(it -> it.getId().equals(item.getAqlTypeDictItemId()))
@ -283,6 +280,11 @@ public class QmsInspectionStandardControllerService {
vo.setLegend(content.getLegend());
vo.setPdfInfo(content.getPdfInfo());
vo.setJudgmentTypeDictItemId(content.getJudgmentTypeDictItemId());
vo.setJudgmentTypeDictItemName(
Optional.ofNullable(dictionaryItemService.getById(content.getJudgmentTypeDictItemId()))
.map(DictionaryItem::getName)
.orElse(null)
);
vo.setCreateUserName(content.getCreateUserName());
vo.setCreateTime(content.getCreateTime());
vo.setUpdateUserName(content.getUpdateUserName());

View File

@ -49,7 +49,7 @@ public class QmsInspectionStandardDetailVO {
/**
* 版本号
*/
private String versionNo;
private String version;
/**
* 是否启用

View File

@ -45,6 +45,11 @@ public class QmsInspectionStandardItemContentVO {
*/
private Long judgmentTypeDictItemId;
/**
* 判定类型字典项名称
*/
private String judgmentTypeDictItemName;
/**
* 创建人姓名
*/

View File

@ -2,6 +2,7 @@ package com.nflg.wms.common.pojo.vo;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@ -72,9 +73,9 @@ public class QmsInspectionStandardItemVO {
private Long aqlPriorityValueId;
/**
* AQL值名称
* AQL值
*/
private String aqlPriorityValueName;
private BigDecimal aqlPriorityValueName;
/**
* AQL类型字典项ID

View File

@ -38,7 +38,7 @@ public class QmsInspectionStandardVO {
/**
* 检测版本号
*/
private String versionNo;
private String version;
/**
* 所属IQE

View File

@ -14,7 +14,7 @@
m.material_category_code_path_name AS materialCategoryCodePathName,
m.material_desc AS materialDesc,
m.drawing_no_ver AS drawingNoVer,
s.version AS versionNo,
s.version,
STRING_AGG(DISTINCT iqe_user.user_name, ',') AS iqeName,
s.inspection_cycle AS inspectionCycle,
s.packaging_method_id AS packagingMethodId,
@ -60,7 +60,7 @@
m.material_desc AS materialDesc,
m.drawing_no_ver AS drawingNoVer,
s.drawing_url AS drawingUrl,
s.version AS versionNo,
s.version,
s.is_enabled AS isEnabled,
s.packaging_method_id AS packagingMethodId,
s.inspection_cycle AS inspectionCycle,