| | |
| | | import com.yuanchu.mom.service.StandardProductListService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.concurrent.CompletableFuture; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private StandardProductListMapper standardProductListMapper; |
| | | |
| | | private StandardTreeMapper standardTreeMapper; |
| | | |
| | | private StandardProductListService standardProductListService; |
| | | |
| | | @Override |
| | | public int upStandardProductList(StandardProductList list) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public List<StandardProductList> selectStandardProductListByMethodId(Integer id, String tree) { |
| | | String[] trees = tree.split(" - "); |
| | | List<StandardProductList> list; |
| | | if(tree.length() == 3){ |
| | | list = standardTreeMapper.selectStandardProductListByTree(trees[2], trees[3]); |
| | | }else{ |
| | | list = standardTreeMapper.selectStandardProductListByTree(trees[2], null); |
| | | StringBuffer str = new StringBuffer(); |
| | | if (trees.length == 3) { |
| | | str.append("\"").append(trees[2]).append("\""); |
| | | } else { |
| | | str.append("\"").append(trees[2]).append("\",\"").append(trees[3]).append("\""); |
| | | } |
| | | List<StandardProductList> standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, id)); |
| | | List<StandardProductList> list = standardTreeMapper.selectStandardProductListByTree(str + ""); |
| | | List<StandardProductList> standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, id).eq(StandardProductList::getTree, tree)); |
| | | for (StandardProductList sp : standardProductLists) { |
| | | for (StandardProductList pl : list) { |
| | | if (sp.getInspectionItem().equals(pl.getInspectionItem()) && sp.getInspectionItemSubclass().equals(pl.getInspectionItemSubclass())) { |
| | | pl.setId(sp.getId()); |
| | | pl.setState(sp.getState()); |
| | | pl.setFactory(sp.getFactory()); |
| | | pl.setLaboratory(sp.getLaboratory()); |
| | | pl.setSampleType(sp.getSampleType()); |
| | | pl.setSample(sp.getSample()); |
| | | pl.setModel(sp.getModel()); |
| | | pl.setMethodS(sp.getMethodS()); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | CompletableFuture.supplyAsync(() -> { |
| | | standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate().eq(StandardProductList::getStandardMethodListId, id).eq(StandardProductList::getTree, tree)); |
| | | standardProductListService.saveBatch(list); |
| | | return null; |
| | | }).thenAccept(res -> { |
| | | }).exceptionally(e -> { |
| | | e.printStackTrace(); |
| | | return null; |
| | | }); |
| | | ; |
| | | return list; |
| | | } |
| | | } |