| | |
| | | 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[] models = insSample.getModel().split("-(?=[^-]*$)");//拆分最后一个【-】 |
| | | String model = insSample.getModel(); |
| | | String modelNum = insSample.getModelNum(); |
| | | List<StandardProductList> list = standardProductListMapper.selectDetail(insSample.getStandardMethodListId(), 1, model, insSample.getIsCableTag()); |
| | | if (list.size() == 0) { |
| | | List<StandardProductList> list = standardProductListMapper.selectDetail(insSample.getStandardMethodListId(), 1, model,insSample.getFactory(), insSample.getIsCableTag()); |
| | | if (list.isEmpty()) { |
| | | if (Objects.equals(insSample.getFactory(), "") || insSample.getFactory() == null) { |
| | | return null; |
| | | } |
| | |
| | | split[3] = split[3].replace("- ", ""); |
| | | String tree = split[0] + " - " + split[1] + " - " + split[2] + " - " + split[3] + " - null"; |
| | | list = standardProductListMapper.selectDetail2(insSample.getStandardMethodListId(), 1, tree, insSample.getIsCableTag()); |
| | | if (list.size() == 0) { |
| | | if (list.isEmpty()) { |
| | | String tree1 = split[0] + " - " + split[1] + " - " + split[2] + " - null - " + split[3]; |
| | | list = standardProductListMapper.selectDetail2(insSample.getStandardMethodListId(), 1, tree1, insSample.getIsCableTag()); |
| | | |
| | | // 只有对象的一层 |
| | | if (list.size() == 0) { |
| | | if (list.isEmpty()) { |
| | | String tree2 = split[0] + " - " + split[1] + " - " + split[2] + " - null - null"; |
| | | list = standardProductListMapper.selectDetail2(insSample.getStandardMethodListId(), 1, tree2, insSample.getIsCableTag()); |
| | | // 样品直接赋值样品分类 |
| | |
| | | } |
| | | } |
| | | String[] split1 = insSample.getFactory().split(" - "); |
| | | if(split1[3].equals("null")){ |
| | | split1[3] = ""; |
| | | } |
| | | if (!isNoSample) { |
| | | //判断长度 |
| | | if (split1.length > 4) { |
| | | if (ObjectUtils.isNotEmpty(split1[3])) { |
| | | list = list.stream().filter(list1 -> Objects.nonNull(list1.getSample()) && Objects.equals(list1.getSample(), split1[3])).collect(Collectors.toList()); |
| | | } else if (split1[3].equals("")) { |
| | | } else if (split1[3].isEmpty()) { |
| | | list = list.stream().filter(list1 -> Objects.nonNull(list1.getSampleType()) && Objects.equals(list1.getSampleType(), split1[2])).collect(Collectors.toList()); |
| | | } |
| | | } |
| | |
| | | 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); |
| | | } |
| | | |
| | | |