| | |
| | | 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; |
| | |
| | | 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(); |
| | |
| | | .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) { |
| | |
| | | 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("\"\"")) { |
| | |
| | | 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 { |
| | |
| | | // this.saveBatch(productLists); |
| | | // 批量添加标准 |
| | | if (CollectionUtils.isNotEmpty(productLists)) { |
| | | baseMapper.saveBatchProductLists(productLists); |
| | | this.saveOrUpdateBatch(productLists); |
| | | } |
| | | |
| | | |