| | |
| | | import com.ruoyi.basic.service.StandardProductListService; |
| | | import com.ruoyi.basic.service.StandardTreeService; |
| | | import com.ruoyi.basic.service.StructureTestObjectService; |
| | | import com.ruoyi.basic.vo.StandardTreeVO; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | 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())); |
| | | laboratoryDto.getChildren().sort(Comparator.comparingInt(o -> (o.getSort() == null ? 0 : o.getSort()))); |
| | | for (SampleTypeDto sampleTypeDto : laboratoryDto.getChildren()) { |
| | | // if (sampleTypeDto.getChildren().size() == 0) { |
| | | sampleTypeDto.getChildren().addAll(standardTreeMapper.getStandardTree3(sampleTypeDto.getValue())); |
| | | // } |
| | | } |
| | | } |
| | | } |
| | |
| | | // 修改名称匹配的标准树下的检验项目 |
| | | // 查询所有对象+名称的树 |
| | | |
| | | List<StandardProductList> standardProductLists = standardProductListService.list(Wrappers.<StandardProductList>lambdaUpdate() |
| | | .eq(StandardProductList::getSample, standardTree.getSample()) |
| | | LambdaUpdateWrapper<StandardProductList> updateWrapper = Wrappers.<StandardProductList>lambdaUpdate() |
| | | .eq(StandardProductList::getFactory, standardTree.getFactory()) |
| | | .eq(StandardProductList::getLaboratory, standardTree.getLaboratory()) |
| | | .eq(StandardProductList::getSampleType, standardTree.getSampleType()) |
| | | .eq(StandardProductList::getModel, standardTree.getOldModel())); |
| | | .eq(StandardProductList::getModel, standardTree.getOldModel()); |
| | | if (StringUtils.isNotBlank(standardTree.getSample()) && !standardTree.getSample().equals("null")) { |
| | | updateWrapper.eq(StandardProductList::getSample, standardTree.getSample()); |
| | | } else { |
| | | updateWrapper.isNull(StandardProductList::getSample); |
| | | } |
| | | |
| | | List<StandardProductList> standardProductLists = standardProductListService.list(updateWrapper); |
| | | if (CollectionUtils.isNotEmpty(standardProductLists)) { |
| | | for (StandardProductList standardProductList : 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); |
| | | StandardTree updateEntity = new StandardTree(); |
| | | updateEntity.setId(standardTree.getId()); |
| | | updateEntity.setModel(standardTree.getModel()); |
| | | return standardTreeMapper.updateById(updateEntity); |
| | | } |
| | | |
| | | @Override |
| | | public StandardTreeVO selectStandardTreeById(Integer standardTreeId) { |
| | | return standardTreeMapper.selectStandardTreeById(standardTreeId); |
| | | } |
| | | |
| | | |