|  | @@ -7,6 +7,7 @@ import com.ym.mec.auth.api.client.SysUserFeignService;
 | 
	
		
			
				|  |  |  import com.ym.mec.auth.api.entity.SysUser;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dao.*;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dto.BasicUserDto;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dto.GoodsBatchNoDto;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dto.GoodsSellDto;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dto.RepairGoodsDto;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.*;
 | 
	
	
		
			
				|  | @@ -739,6 +740,37 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
 | 
	
		
			
				|  |  |          List<GoodsSellDto> goodsSellDtos = JSONObject.parseArray(goodsJson, GoodsSellDto.class);
 | 
	
		
			
				|  |  |          Map<Integer, List<GoodsSellDto>> collect = goodsSellDtos.stream().collect(Collectors.groupingBy(GoodsSellDto::getGoodsId));
 | 
	
		
			
				|  |  |          List<Integer> goodsId = goodsSellDtos.stream().map(e -> e.getGoodsId()).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        List<Integer> goodsIds = new ArrayList<>();
 | 
	
		
			
				|  |  | +        goodsSellDtos.forEach(e->{
 | 
	
		
			
				|  |  | +            for (int i = 0; i < e.getGoodsNum(); i++) {
 | 
	
		
			
				|  |  | +                goodsIds.add(e.getGoodsId());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +        List<GoodsSellDto> goodsSellDtoList = new ArrayList<>();
 | 
	
		
			
				|  |  | +        //扣减库存
 | 
	
		
			
				|  |  | +        List<GoodsProcurement> goodsBatchNoDtos = goodsService.subtractStock(goodsIds, AccountType.EXTERNAL);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        Map<String, List<GoodsProcurement>> listMap = goodsBatchNoDtos.stream().collect(Collectors.groupingBy(GoodsProcurement::getBatchNo));
 | 
	
		
			
				|  |  | +        Set<String> listMapKeys = listMap.keySet();
 | 
	
		
			
				|  |  | +        listMapKeys.forEach(e->{
 | 
	
		
			
				|  |  | +            listMap.get(e).forEach(z->{
 | 
	
		
			
				|  |  | +                GoodsSellDto goodsSellDto1 = collect.get(z.getGoodsId()).get(0);
 | 
	
		
			
				|  |  | +                GoodsSellDto goodsSellDto = new GoodsSellDto();
 | 
	
		
			
				|  |  | +                if(StringUtils.isEmpty(z.getBatchNo())){
 | 
	
		
			
				|  |  | +                    goodsSellDto.setGoodsNum(1);
 | 
	
		
			
				|  |  | +                    goodsSellDto.setTotalGoodsPrice(goodsSellDto1.getGoodsPrice());
 | 
	
		
			
				|  |  | +                    goodsSellDto.setGoodsPrice(goodsSellDto1.getGoodsPrice());
 | 
	
		
			
				|  |  | +                    goodsSellDto.setGoodsId(goodsSellDto1.getGoodsId());
 | 
	
		
			
				|  |  | +                    goodsSellDto.setGoodsName(goodsSellDto1.getGoodsName());
 | 
	
		
			
				|  |  | +                    goodsSellDto.setGoodsType(goodsSellDto1.getGoodsType());
 | 
	
		
			
				|  |  | +                    goodsSellDto.setImage(goodsSellDto1.getImage());
 | 
	
		
			
				|  |  | +                }else {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          List<Goods> goodsByIds = goodsService.findGoodsByIds(StringUtils.join(goodsId, ","));
 | 
	
		
			
				|  |  |          Map<Integer, List<Goods>> goodsMap = goodsByIds.stream().collect(Collectors.groupingBy(Goods::getId));
 | 
	
		
			
				|  |  |          Map<String, BigDecimal> costMap = new HashMap<>(2);
 |