| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | |
| | | List<TErpGoodsType> typeList = erpGoodsTypeMapper.selectBatchIds(typeIds); |
| | | for (TErpGoodsVO tErpGoodsVO : list) { |
| | | List<TErpProcurementGoods> tErpProcurementGoods = goodsSalesMap.get(tErpGoodsVO.getId()); |
| | | // 计算采购数量 |
| | | tErpGoodsVO.setSalesCount(tErpProcurementGoods.stream().filter(e->e.getPurchaseCount()!=null).mapToInt(TErpProcurementGoods::getPurchaseCount).sum()); |
| | | typeList.stream().filter(t -> t.getId().equals(tErpGoodsVO.getTypeId())).findFirst().ifPresent(t -> tErpGoodsVO.setTypeName(t.getTypeName())); |
| | | if(!CollectionUtils.isEmpty(tErpProcurementGoods)){ |
| | | // 计算采购数量 |
| | | tErpGoodsVO.setSalesCount(tErpProcurementGoods.stream().filter(e->e.getPurchaseCount()!=null).mapToInt(TErpProcurementGoods::getPurchaseCount).sum()); |
| | | typeList.stream().filter(t -> t.getId().equals(tErpGoodsVO.getTypeId())).findFirst().ifPresent(t -> tErpGoodsVO.setTypeName(t.getTypeName())); |
| | | }else { |
| | | tErpGoodsVO.setSalesCount(0); |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | |
| | | List<TErpGoodsType> typeList = erpGoodsTypeMapper.selectBatchIds(typeIds); |
| | | for (TErpGoodsVO tErpGoodsVO : list) { |
| | | List<TErpProcurementGoods> tErpProcurementGoods = goodsSalesMap.get(tErpGoodsVO.getId()); |
| | | // 计算采购数量 |
| | | tErpGoodsVO.setSalesCount(tErpProcurementGoods.stream().filter(e->e.getPurchaseCount()!=null).mapToInt(TErpProcurementGoods::getPurchaseCount).sum()); |
| | | typeList.stream().filter(t -> t.getId().equals(tErpGoodsVO.getTypeId())).findFirst().ifPresent(t -> tErpGoodsVO.setTypeName(t.getTypeName())); |
| | | if(!CollectionUtils.isEmpty(tErpProcurementGoods)){ |
| | | // 计算采购数量 |
| | | tErpGoodsVO.setSalesCount(tErpProcurementGoods.stream().filter(e->e.getPurchaseCount()!=null).mapToInt(TErpProcurementGoods::getPurchaseCount).sum()); |
| | | typeList.stream().filter(t -> t.getId().equals(tErpGoodsVO.getTypeId())).findFirst().ifPresent(t -> tErpGoodsVO.setTypeName(t.getTypeName())); |
| | | }else { |
| | | tErpGoodsVO.setSalesCount(0); |
| | | } |
| | | } |
| | | return list; |
| | | } |