From eeb8d7faa8d25b3ca9fe75ef28f035c49af5b06d Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期二, 11 三月 2025 11:05:38 +0800
Subject: [PATCH] Merge branch 'dev' into dev_zj
---
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java | 110 ++++---------------------------------------------------
1 files changed, 8 insertions(+), 102 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 b64ab41..e0529ea 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
@@ -10,7 +10,6 @@
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.basic.dto.FactoryDto;
import com.ruoyi.basic.dto.LaboratoryDto;
import com.ruoyi.basic.dto.SampleTypeDto;
@@ -21,6 +20,8 @@
import com.ruoyi.basic.pojo.StandardTree;
import com.ruoyi.basic.pojo.StructureTestObject;
import com.ruoyi.basic.service.*;
+import com.ruoyi.common.exception.base.BaseException;
+import com.ruoyi.framework.exception.ErrorException;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
@@ -51,24 +52,17 @@
private StandardProductListMapper standardProductListMapper;
- private StandardProductListService standardProductListService;
-
private StandardTemplateService standardTemplateService;
-
- private StructureTestObjectService structureTestObjectService;
-
@Override
public List<FactoryDto> selectStandardTreeList() {
List<FactoryDto> factoryDtos = standardTreeMapper.selectStandardTreeList();
for (FactoryDto factoryDto : factoryDtos) {
for (LaboratoryDto laboratoryDto : factoryDto.getChildren()) {
- laboratoryDto.getChildren().sort((o1, o2) -> (o1.getSort() == null ? 0 : o1.getSort())
- - (o2.getSort() == null ? 0 : o2.getSort()));
for (SampleTypeDto sampleTypeDto : laboratoryDto.getChildren()) {
-// if (sampleTypeDto.getChildren().size() == 0) {
- sampleTypeDto.getChildren().addAll(standardTreeMapper.getStandardTree3(sampleTypeDto.getValue()));
-// }
+ if (sampleTypeDto.getChildren().size() == 0) {
+ sampleTypeDto.setChildren(standardTreeMapper.getStandardTree3(sampleTypeDto.getValue()));
+ }
}
}
}
@@ -80,19 +74,14 @@
@Override
@Transactional(rollbackFor = Exception.class)
public int addStandardTree(StandardTree standardTree) {
- LambdaQueryWrapper<StandardTree> wrapper = Wrappers.<StandardTree>lambdaQuery()
+ StandardTree tree = standardTreeMapper.selectOne(Wrappers.<StandardTree>lambdaQuery()
.eq(StandardTree::getFactory, standardTree.getFactory())
.eq(StandardTree::getLaboratory, standardTree.getLaboratory())
.eq(StandardTree::getSampleType, standardTree.getSampleType())
.eq(StandardTree::getSample, standardTree.getSample())
- .eq(StandardTree::getModel, standardTree.getModel());
- if (StringUtils.isNotBlank(standardTree.getSample())) {
- wrapper.eq(StandardTree::getSample, standardTree.getSample());
- }
-
- StandardTree tree = standardTreeMapper.selectOne(wrapper);
+ .eq(StandardTree::getModel, standardTree.getModel()));
if (tree != null) {
- throw new BaseException("璇ュ瀷鍙峰凡瀛樺湪");
+ throw new ErrorException("璇ュ瀷鍙峰凡瀛樺湪");
}
return standardTreeMapper.insert(standardTree);
}
@@ -109,18 +98,6 @@
standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]).eq(StandardTree::getModel, trees[4]));
}
break;
- /*case 4:
- standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]));
- break;
- case 3:
- standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]));
- break;
- case 2:
- standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]));
- break;
- case 1:
- standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]));
- break;*/
}
return 1;
}
@@ -166,10 +143,6 @@
StandardProductList productList = JSON.parseObject(JSON.toJSONString(product.get("standardProductList")), StandardProductList.class);
if (productList.getMethodS() != null) {
standardProductListMapper.update(productList, Wrappers.<StandardProductList>lambdaUpdate().in(StandardProductList::getId, ids).like(StandardProductList::getMethod, productList.getMethodS()));
- return 1;
- }
- if (productList.getRadiusList() != null) {
- standardProductListMapper.update(productList, Wrappers.<StandardProductList>lambdaUpdate().in(StandardProductList::getId, ids).like(StandardProductList::getRadiusList, productList.getRadius()));
return 1;
}
standardProductListMapper.update(productList, Wrappers.<StandardProductList>lambdaUpdate().in(StandardProductList::getId, ids));
@@ -442,70 +415,6 @@
}
@Override
- public boolean updateTreeSort(List<FactoryDto> list) {
- 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++;
- }
- }
- }
- structureTestObjectService.updateBatchById(testObjects);
-
- return true;
- }
-
- /**
- * 淇敼鏍囧噯鏁�
- * @param standardTree
- * @return
- */
- @Override
- public int updateStandardTree(StandardTree standardTree) {
- // 淇敼鍚嶇О鍖归厤鐨勬爣鍑嗘爲涓嬬殑妫�楠岄」鐩�
- // 鏌ヨ鎵�鏈夊璞�+鍚嶇О鐨勬爲
-
- List<StandardProductList> standardProductLists = standardProductListService.list(Wrappers.<StandardProductList>lambdaUpdate()
- .eq(StandardProductList::getSample, standardTree.getSample())
- .eq(StandardProductList::getSampleType, standardTree.getSampleType())
- .eq(StandardProductList::getModel, standardTree.getOldModel()));
- if (CollectionUtils.isNotEmpty(standardProductLists)) {
- for (StandardProductList standardProductList : standardProductLists) {
- // 淇敼鏍峰搧鍚嶇О
- standardProductList.setModel(standardTree.getModel());
- // 淇敼鏍戝悕绉�
- // 闇�瑕佹埅鍙栫鍥涚骇, 閬垮厤涓夊洓绾у悕绉颁竴鏍蜂慨鏀归敊璇�
- String[] trees = standardProductList.getTree().split(" - ");
- trees[4] = standardTree.getModel();
- List<String> list = CollUtil.newArrayList(trees);
- String newName = CollUtil.join(list, " - ");
- standardProductList.setTree(newName);
- }
- standardProductListService.updateBatchById(standardProductLists);
- }
-
- // 淇敼鏍囧噯鏁版楠岄」鐩�
- LambdaUpdateWrapper<StandardTree> wrapper = Wrappers.<StandardTree>lambdaUpdate()
- .eq(StandardTree::getFactory, standardTree.getFactory())
- .eq(StandardTree::getLaboratory, standardTree.getLaboratory())
- .eq(StandardTree::getSampleType, standardTree.getSampleType())
- .eq(StandardTree::getModel, standardTree.getOldModel())
- .set(StandardTree::getModel, standardTree.getModel());
- if (StringUtils.isNotBlank(standardTree.getSample())) {
- wrapper.eq(StandardTree::getSample, standardTree.getSample());
- }
- return standardTreeMapper.update(null, wrapper);
- }
-
- @Override
public void resetTreeOfPrice(String tree, Integer standardId) {
standardProductListMapper.update(null, Wrappers.<StandardProductList>lambdaUpdate().like(StandardProductList::getTree, tree).eq(StandardProductList::getStandardMethodListId, standardId).set(StandardProductList::getPrice, null));
}
@@ -521,9 +430,6 @@
.set(StandardProductList::getAsk, null)
.set(StandardProductList::getTell, null)
.set(StandardProductList::getSection, null)
- .set(StandardProductList::getCores, null)
- .set(StandardProductList::getConductorMaterial, null)
- .set(StandardProductList::getConductorType, null)
.set(StandardProductList::getPrice, null)
.set(StandardProductList::getManHour, null));
}
--
Gitblit v1.9.3