From fbde0b947b4641081b558302ea77d88c902c4cd1 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期三, 30 四月 2025 10:03:24 +0800
Subject: [PATCH] 可靠性计划优化检验项
---
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java | 100 ++++++++++++++++++++++++++-----------------------
1 files changed, 53 insertions(+), 47 deletions(-)
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java
index 3f60b21..316c627 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java
@@ -81,21 +81,21 @@
basicTreeDto.setValue(String.valueOf(model.getId()));
basicTreeDto.setLabel(model.getModelName());
basicTreeDto.setChildren(null);
- if(model.getProductId() != null) {
- if(CollectionUtils.isEmpty(productModelMap.get(model.getProductId()))){
+ if (model.getProductId() != null) {
+ if (CollectionUtils.isEmpty(productModelMap.get(model.getProductId()))) {
List<BasicTreeDto> basicTreeDtoList = new ArrayList<>();
basicTreeDtoList.add(basicTreeDto);
- productModelMap.put(model.getProductId(),basicTreeDtoList);
- }else {
+ productModelMap.put(model.getProductId(), basicTreeDtoList);
+ } else {
productModelMap.get(model.getProductId()).add(basicTreeDto);
}
}
- if(model.getStructureTestObjectId() != null) {
- if(CollectionUtils.isEmpty(testObjectModelMap.get(model.getStructureTestObjectId()))){
+ if (model.getStructureTestObjectId() != null) {
+ if (CollectionUtils.isEmpty(testObjectModelMap.get(model.getStructureTestObjectId()))) {
List<BasicTreeDto> basicTreeDtoList = new ArrayList<>();
basicTreeDtoList.add(basicTreeDto);
- testObjectModelMap.put(model.getStructureTestObjectId(),basicTreeDtoList);
- }else {
+ testObjectModelMap.put(model.getStructureTestObjectId(), basicTreeDtoList);
+ } else {
testObjectModelMap.get(model.getStructureTestObjectId()).add(basicTreeDto);
}
}
@@ -122,15 +122,15 @@
StructureTestObjectDto structureTestObjectDto = new StructureTestObjectDto();
BeanUtils.copyProperties(structureTestObject, structureTestObjectDto);
List<BasicTreeDto> children = new ArrayList<>();
- if(!CollectionUtils.isEmpty(productMap.get(structureTestObject.getId()))){
+ if (!CollectionUtils.isEmpty(productMap.get(structureTestObject.getId()))) {
children.addAll(productMap.get(structureTestObject.getId()));
}
- if(!CollectionUtils.isEmpty(testObjectModelMap.get(structureTestObject.getId()))){
+ if (!CollectionUtils.isEmpty(testObjectModelMap.get(structureTestObject.getId()))) {
children.addAll(testObjectModelMap.get(structureTestObject.getId()));
}
structureTestObjectDto.setChildren(children);
return structureTestObjectDto;
- },Collectors.toList())
+ }, Collectors.toList())
)
)
);
@@ -178,7 +178,7 @@
}
}
workShopTreeDto.setChildren(testObjectChildren);
- if(!CollectionUtils.isEmpty(testObjectChildren)){
+ if (!CollectionUtils.isEmpty(testObjectChildren)) {
workShopTreeDtoList.add(workShopTreeDto);
}
}
@@ -201,7 +201,7 @@
return laboratoryTreeDto;
}).collect(Collectors.toList());
List<BasicTreeDto> factoryList = new ArrayList<>();
- factoryList.add(new BasicTreeDto(BasicTreeEnums.FACTORY_TYPE.getCode(),"涓ぉ绉戞妧","1",laboratoryTreeDtoList));
+ factoryList.add(new BasicTreeDto(BasicTreeEnums.FACTORY_TYPE.getCode(), "涓ぉ绉戞妧", "1", laboratoryTreeDtoList));
return factoryList;
}
@@ -210,27 +210,27 @@
@Transactional(rollbackFor = Exception.class)
public int addStandardTree(ModelAddDto modelAddDto) {
// 鏍¢獙
- if(StringUtils.isEmpty(modelAddDto.getParentId())){
+ if (StringUtils.isEmpty(modelAddDto.getParentId())) {
throw new RuntimeException("缂哄皯鐖跺眰绾х粦瀹氬叧绯�");
}
Model model = new Model();
String parentLevel = modelAddDto.getParentLevel();
// 鍚嶇О閲嶅鎬ф�ф牎楠�
QueryWrapper<Model> modelQueryWrapper = new QueryWrapper<>();
- if(BasicTreeEnums.PRODUCT_TYPE.getCode().equals(parentLevel)){
+ if (BasicTreeEnums.PRODUCT_TYPE.getCode().equals(parentLevel)) {
model.setProductId(Integer.valueOf(modelAddDto.getParentId()));
modelQueryWrapper.eq("product_id", model.getProductId());
- }else if(BasicTreeEnums.STRUCTURE_TEST_OBJECT_TYPE.getCode().equals(parentLevel)){
+ } else if (BasicTreeEnums.STRUCTURE_TEST_OBJECT_TYPE.getCode().equals(parentLevel)) {
model.setStructureTestObjectId(Integer.valueOf(modelAddDto.getParentId()));
modelQueryWrapper.eq("structure_test_object_id", model.getStructureTestObjectId());
- }else {
+ } else {
throw new RuntimeException("鍨嬪彿鍙兘缁戝畾瀵硅薄鍜屼骇鍝�");
}
model.setModelName(modelAddDto.getModelName());
modelQueryWrapper.eq("model_name", model.getModelName());
Model modelResult = modelMapper.selectOne(modelQueryWrapper);
- if(ObjectUtils.isNotEmpty(modelResult)){
+ if (ObjectUtils.isNotEmpty(modelResult)) {
throw new RuntimeException("璇峰嬁娣诲姞閲嶅鍨嬪彿");
}
return modelMapper.insert(model);
@@ -238,8 +238,8 @@
@Override
@Transactional(rollbackFor = Exception.class)
- public int delStandardTree(String level,String id) {
- if(BasicTreeEnums.MODEL_TYPE.getCode().equals(level)){
+ public int delStandardTree(String level, String id) {
+ if (BasicTreeEnums.MODEL_TYPE.getCode().equals(level)) {
modelMapper.deleteById(id);
}
return 1;
@@ -262,21 +262,21 @@
basicTreeDto.setValue(model.getModelName());
basicTreeDto.setLabel(model.getModelName());
basicTreeDto.setChildren(null);
- if(model.getProductId() != null) {
- if(CollectionUtils.isEmpty(productModelMap.get(model.getProductId()))){
+ if (model.getProductId() != null) {
+ if (CollectionUtils.isEmpty(productModelMap.get(model.getProductId()))) {
List<BasicTreeDto> basicTreeDtoList = new ArrayList<>();
basicTreeDtoList.add(basicTreeDto);
- productModelMap.put(model.getProductId(),basicTreeDtoList);
- }else {
+ productModelMap.put(model.getProductId(), basicTreeDtoList);
+ } else {
productModelMap.get(model.getProductId()).add(basicTreeDto);
}
}
- if(model.getStructureTestObjectId() != null) {
- if(CollectionUtils.isEmpty(testObjectModelMap.get(model.getStructureTestObjectId()))){
+ if (model.getStructureTestObjectId() != null) {
+ if (CollectionUtils.isEmpty(testObjectModelMap.get(model.getStructureTestObjectId()))) {
List<BasicTreeDto> basicTreeDtoList = new ArrayList<>();
basicTreeDtoList.add(basicTreeDto);
- testObjectModelMap.put(model.getStructureTestObjectId(),basicTreeDtoList);
- }else {
+ testObjectModelMap.put(model.getStructureTestObjectId(), basicTreeDtoList);
+ } else {
testObjectModelMap.get(model.getStructureTestObjectId()).add(basicTreeDto);
}
}
@@ -297,7 +297,7 @@
List<BasicTreeDto> testProjectBasicTreeList = structureTestObjectList.stream().map(structureTestObject -> {
BasicTreeDto basicTreeDto = new BasicTreeDto();
basicTreeDto.setValue(structureTestObject.getSpecimenName());
- basicTreeDto.setLabel(structureTestObject.getSpecimenName());
+ basicTreeDto.setLabel(structureTestObject.getSpecimenName() + "(" + structureTestObject.getObjectType() + ")");
basicTreeDto.setLevel(BasicTreeEnums.STRUCTURE_TEST_OBJECT_TYPE.getCode());
List<BasicTreeDto> children = new ArrayList<>();
if (!CollectionUtils.isEmpty(productMap.get(structureTestObject.getId()))) {
@@ -339,6 +339,7 @@
/**
* 娌冲彛妫�娴嬩腑蹇冨鍏�
+ *
* @param file
*/
@Override
@@ -599,15 +600,19 @@
List<StructureTestObject> testObjects = new ArrayList<>();
for (FactoryDto factoryDto : list) {
for (LaboratoryDto laboratoryDto : factoryDto.getChildren()) {
- List<SampleTypeDto> children = laboratoryDto.getChildren();
- int sort = 0;
- // 寰幆绗笁灞�
- for (SampleTypeDto child : children) {
- StructureTestObject structureTestObject = new StructureTestObject();
- structureTestObject.setSort(sort);
- structureTestObject.setId(child.getSampleTypeId());
- testObjects.add(structureTestObject);
- sort++;
+ for (ObjectTypeDto objectTypeDto : laboratoryDto.getChildren()) {
+ for (WorkShopNameDto workShopNameDto:objectTypeDto.getChildren()) {
+ List<SampleTypeDto> children = workShopNameDto.getChildren();
+ int sort = 0;
+
+ for (SampleTypeDto child : children) {
+ StructureTestObject structureTestObject = new StructureTestObject();
+ structureTestObject.setSort(sort);
+ structureTestObject.setId(child.getSampleTypeId());
+ testObjects.add(structureTestObject);
+ sort++;
+ }
+ }
}
}
}
@@ -618,37 +623,38 @@
/**
* 淇敼鏍囧噯鏁�
+ *
* @param modelAddDto
* @return
*/
@Override
public int updateStandardTree(ModelAddDto modelAddDto) {
- if(modelAddDto.getId() == null){
+ if (modelAddDto.getId() == null) {
throw new RuntimeException("缂哄皯鍨嬪彿涓婚敭");
}
Model model = modelMapper.selectById(modelAddDto.getId());
- if(ObjectUtils.isEmpty(model)){
+ if (ObjectUtils.isEmpty(model)) {
throw new RuntimeException("鍨嬪彿鏌ユ壘澶辫触");
}
QueryWrapper<Model> modelQueryWrapper = new QueryWrapper<>();
- if(model.getStructureTestObjectId() != null){
+ if (model.getStructureTestObjectId() != null) {
modelQueryWrapper.eq("structure_test_object_id", model.getStructureTestObjectId());
}
- if(model.getProductId() != null){
+ if (model.getProductId() != null) {
modelQueryWrapper.eq("product_id", model.getProductId());
}
modelQueryWrapper.eq("model_name", modelAddDto.getModelName());
model.setModelName(modelAddDto.getModelName());
List<Model> modelList = modelMapper.selectList(modelQueryWrapper);
- if(CollectionUtils.isEmpty(modelList)){
+ if (CollectionUtils.isEmpty(modelList)) {
return modelMapper.updateById(model);
- }else if (modelList.size() == 1) {
- if( !model.getId().equals(modelList.get(0).getId())){
+ } else if (modelList.size() == 1) {
+ if (!model.getId().equals(modelList.get(0).getId())) {
throw new RuntimeException("鍨嬪彿鍚嶇О閲嶅");
- }else {
+ } else {
return modelMapper.updateById(model);
}
- }else {
+ } else {
throw new RuntimeException("鍨嬪彿鍚嶇О閲嶅");
}
}
--
Gitblit v1.9.3