|  | @@ -23,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.core.io.ClassPathResource;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  import org.springframework.transaction.annotation.Isolation;
 | 
	
		
			
				|  |  | +import org.springframework.transaction.annotation.Propagation;
 | 
	
		
			
				|  |  |  import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  |  import org.springframework.util.CollectionUtils;
 | 
	
		
			
				|  |  |  import org.springframework.web.multipart.MultipartFile;
 | 
	
	
		
			
				|  | @@ -464,55 +465,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	@Override
 | 
	
		
			
				|  |  | -	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
 | 
	
		
			
				|  |  | -	public void getGoodsTest(List<Integer> goodsIds) {
 | 
	
		
			
				|  |  | -		List<Goods> tempGoodsList = goodsDao.lockGoods(new ArrayList<>(goodsIds));
 | 
	
		
			
				|  |  | -		Map<Integer, Goods> idTempGoodsMap = tempGoodsList.stream().collect(Collectors.toMap(Goods::getId, g -> g));
 | 
	
		
			
				|  |  | -		List<GoodsProcurement> goodsProcurements = new ArrayList<>();
 | 
	
		
			
				|  |  | -		for (Integer goodsId : goodsIds) {
 | 
	
		
			
				|  |  | -			Goods tempGoods = goodsDao.get(goodsId);
 | 
	
		
			
				|  |  | -			List<Goods> childGoods = new ArrayList<>();
 | 
	
		
			
				|  |  | -			if(StringUtils.isBlank(tempGoods.getComplementGoodsIdList())){
 | 
	
		
			
				|  |  | -				childGoods.add(tempGoods);
 | 
	
		
			
				|  |  | -			}else{
 | 
	
		
			
				|  |  | -				List<Integer> complementGoodsIds = Arrays.stream(tempGoods.getComplementGoodsIdList().split(",")).map(s -> Integer.valueOf(s)).collect(Collectors.toList());
 | 
	
		
			
				|  |  | -				childGoods = goodsDao.lockGoods(complementGoodsIds);
 | 
	
		
			
				|  |  | -			}
 | 
	
		
			
				|  |  | -			for (Goods goods : childGoods) {
 | 
	
		
			
				|  |  | -				GoodsProcurement goodsProcurement = null;
 | 
	
		
			
				|  |  | -				if(StockType.INTERNAL.equals(goods.getStockType())||(StockType.ALL.equals(goods.getStockType())&&AccountType.INTERNAL.equals(AccountType.INTERNAL))){
 | 
	
		
			
				|  |  | -					goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
 | 
	
		
			
				|  |  | -					goods.setStockCount(new AtomicInteger(goods.getStockCount()).decrementAndGet());
 | 
	
		
			
				|  |  | -					if(Objects.nonNull(goodsProcurement)){
 | 
	
		
			
				|  |  | -						goodsProcurement.setStockSoldNum(new AtomicInteger(goodsProcurement.getStockSoldNum()).incrementAndGet());
 | 
	
		
			
				|  |  | -					}
 | 
	
		
			
				|  |  | -				}else if(StockType.EXTERNAL.equals(goods.getStockType())||(StockType.ALL.equals(goods.getStockType())&&AccountType.EXTERNAL.equals(AccountType.EXTERNAL))){
 | 
	
		
			
				|  |  | -					goodsProcurement = goodsProcurementDao.getWithTaxStockSurplusProcurement(goods.getId());
 | 
	
		
			
				|  |  | -					goods.setTaxStockCount(new AtomicInteger(goods.getTaxStockCount()).decrementAndGet());
 | 
	
		
			
				|  |  | -					if(Objects.nonNull(goodsProcurement)){
 | 
	
		
			
				|  |  | -						goodsProcurement.setTaxStockSoldNum(new AtomicInteger(goodsProcurement.getTaxStockSoldNum()).incrementAndGet());
 | 
	
		
			
				|  |  | -					}
 | 
	
		
			
				|  |  | -				}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -				goods.setSellCount(new AtomicInteger(goods.getSellCount()).incrementAndGet());
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -				goodsDao.update(goods);
 | 
	
		
			
				|  |  | -				if(Objects.nonNull(goodsProcurement)){
 | 
	
		
			
				|  |  | -					goodsProcurementDao.update(goodsProcurement);
 | 
	
		
			
				|  |  | -				}else{
 | 
	
		
			
				|  |  | -					goodsProcurement = new GoodsProcurement(goods.getId());
 | 
	
		
			
				|  |  | -				}
 | 
	
		
			
				|  |  | -				if(StringUtils.isNotBlank(tempGoods.getComplementGoodsIdList())){
 | 
	
		
			
				|  |  | -					goodsProcurement.setParentGoodsId(tempGoods.getId());
 | 
	
		
			
				|  |  | -				}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -				goodsProcurements.add(goodsProcurement);
 | 
	
		
			
				|  |  | -			}
 | 
	
		
			
				|  |  | -		}
 | 
	
		
			
				|  |  | -	}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	@Override
 | 
	
		
			
				|  |  | -	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
 | 
	
		
			
				|  |  | +	@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED)
 | 
	
		
			
				|  |  |  	public List<SellOrder> subtractStock(List<Integer> goodsIds, AccountType accountType) {
 | 
	
		
			
				|  |  |  		if(CollectionUtils.isEmpty(goodsIds)){
 | 
	
		
			
				|  |  |  			return Collections.emptyList();
 | 
	
	
		
			
				|  | @@ -522,7 +475,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 | 
	
		
			
				|  |  |  		Map<Integer, Goods> idTempGoodsMap = tempGoodsList.stream().collect(Collectors.toMap(Goods::getId, g -> g));
 | 
	
		
			
				|  |  |  		List<GoodsProcurement> goodsProcurements = new ArrayList<>();
 | 
	
		
			
				|  |  |  		for (Integer goodsId : goodsIds) {
 | 
	
		
			
				|  |  | -			Goods tempGoods = idTempGoodsMap.get(goodsId);
 | 
	
		
			
				|  |  | +			Goods tempGoods = goodsDao.get(goodsId);
 | 
	
		
			
				|  |  |  			List<Goods> childGoods = new ArrayList<>();
 | 
	
		
			
				|  |  |  			if(StringUtils.isBlank(tempGoods.getComplementGoodsIdList())){
 | 
	
		
			
				|  |  |  				childGoods.add(tempGoods);
 |