zouyu
2026-04-24 5355f421c7471f8ee7f1103e30229e5dbab1ea5f
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java
@@ -6,6 +6,7 @@
import com.baomidou.mybatisplus.core.toolkit.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.basic.vo.StandardProductListVO;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.basic.dto.CopyStandardProductListDto;
@@ -259,7 +260,7 @@
        String[] trees = tree.split(" - ");
        // 判断是否拖拽
        boolean isDrag = false;
        List<StandardProductList> list = new ArrayList<>();
        List<StandardProductListVO> list = new ArrayList<>();
        if (trees.length == 3) {
            List<StandardTree> treeList = new ArrayList<>();
            StandardTree standardTree = new StandardTree();
@@ -296,10 +297,6 @@
                    .eq(StandardProductList::getStandardMethodListId, id)
                    .isNull(StandardProductList::getModel)
                    .like(StandardProductList::getTree, tree));
            if (count == 0) {
                isDrag = true;
            }
            isDrag = true;
            List<StandardTree> treeList = standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]));
            if (treeList.size() == 0) {
@@ -323,23 +320,22 @@
        for (StandardProductList productList : list) {
            productList.setId(IdWorker.getId());
        }
        List<StandardProductList> standardProductLists;
        List<StandardProductListVO> standardProductLists;
        if (isDrag) {
            standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
                    .eq(StandardProductList::getStandardMethodListId, id)
                    .like(StandardProductList::getTree, tree)
                    .orderByAsc(StandardProductList::getSort));
            // 判断是否有没有序号的, 没有序号重置
            boolean b = standardProductLists.stream().anyMatch(standardProductList -> standardProductList.getSort() == null);
        } else {
            standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
                    .eq(StandardProductList::getStandardMethodListId, id)
                    .like(StandardProductList::getTree, tree));
        }
//        if (isDrag) {
//            standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
//                    .eq(StandardProductList::getStandardMethodListId, id)
//                    .like(StandardProductList::getTree, tree)
//                    .orderByAsc(StandardProductList::getSort));
//        } else {
//            standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
//                    .eq(StandardProductList::getStandardMethodListId, id)
//                    .like(StandardProductList::getTree, tree));
//        }
        standardProductLists = standardProductListMapper.selectStandardProductList(id,tree,isDrag);
        for (StandardProductList sp : standardProductLists) {
            for (StandardProductList pl : list) {
        for (StandardProductListVO sp : standardProductLists) {
            for (StandardProductListVO pl : list) {
                // 判断条件是否只有一个, 有一个的话默认第一个
                String radiusList = pl.getRadiusList();
                if (StringUtils.isNotBlank(radiusList) && !radiusList.equals("null") && !radiusList.equals("\"\"")) {
@@ -358,6 +354,12 @@
                    pl.setId(sp.getId());
                    // 添加排序字段
                    pl.setSort(sp.getSort());
                    pl.setCreateUserName(sp.getCreateUserName());
                    pl.setCreateTime(sp.getCreateTime());
                    pl.setCreateUser(sp.getCreateUser());
                    pl.setUpdateUserName(sp.getUpdateUserName());
                    pl.setUpdateTime(sp.getUpdateTime());
                    pl.setUpdateUser(sp.getUpdateUser());
                    if (sp.getState() != null && !sp.getState().equals("")) {
                        pl.setState(sp.getState());
                    } else {
@@ -428,7 +430,7 @@
//            this.saveBatch(productLists);
        // 批量添加标准
        if (CollectionUtils.isNotEmpty(productLists)) {
            baseMapper.saveBatchProductLists(productLists);
            this.saveOrUpdateBatch(productLists);
        }