From 11af23e0c7976eed1211ba2ca0beae3a12e19310 Mon Sep 17 00:00:00 2001
From: lxp <1928192722@qq.com>
Date: 星期三, 12 三月 2025 15:37:47 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev

---
 basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java |  120 +++++------------------------------------------------------
 1 files changed, 11 insertions(+), 109 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..5394368 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
@@ -1,16 +1,10 @@
 package com.ruoyi.basic.service.impl;
 
-import cn.hutool.core.collection.CollUtil;
 import cn.hutool.poi.excel.ExcelUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-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;
@@ -19,8 +13,11 @@
 import com.ruoyi.basic.pojo.StandardProductList;
 import com.ruoyi.basic.pojo.StandardTemplate;
 import com.ruoyi.basic.pojo.StandardTree;
-import com.ruoyi.basic.pojo.StructureTestObject;
-import com.ruoyi.basic.service.*;
+import com.ruoyi.basic.service.StandardMethodListService;
+import com.ruoyi.basic.service.StandardTemplateService;
+import com.ruoyi.basic.service.StandardTreeService;
+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 +48,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().isEmpty()) {
+                        sampleTypeDto.setChildren(standardTreeMapper.getStandardTree3(sampleTypeDto.getValue()));
+                    }
                 }
             }
         }
@@ -80,19 +70,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 +94,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 +139,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 +411,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 +426,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