| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.system.mapper.TErpGoodsMapper; |
| | | import com.ruoyi.system.mapper.TErpGoodsTypeMapper; |
| | | import com.ruoyi.system.mapper.TErpSupplierInventoryMapper; |
| | | import com.ruoyi.system.mapper.TErpSupplierWarehousingMapper; |
| | | import com.ruoyi.system.mapper.*; |
| | | import com.ruoyi.system.model.TErpGoods; |
| | | import com.ruoyi.system.model.TErpGoodsType; |
| | | import com.ruoyi.system.model.TErpGoodsUnit; |
| | | import com.ruoyi.system.model.TSysBanner; |
| | | import com.ruoyi.system.query.TErpGoodsQuery; |
| | | import com.ruoyi.system.service.TErpGoodsService; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | @Resource |
| | | private TErpGoodsTypeMapper erpGoodsTypeMapper; |
| | | |
| | | @Resource |
| | | private TErpGoodsUnitMapper erpGoodsUnitMapper; |
| | | |
| | | |
| | | |
| | | @Override |
| | | public PageInfo<TErpGoodsVO> pageList(TErpGoodsQuery query, SysUser user) { |
| | |
| | | List<TErpGoodsType> typeList = erpGoodsTypeMapper.selectBatchIds(typeIds); |
| | | for (TErpGoodsVO tErpGoodsVO : list) { |
| | | typeList.stream().filter(t -> t.getId().equals(tErpGoodsVO.getTypeId())).findFirst().ifPresent(t -> tErpGoodsVO.setTypeName(t.getTypeName())); |
| | | } |
| | | } |
| | | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public List<TErpGoodsVO> listExport(TErpGoodsQuery query, SysUser user) { |
| | | List<TErpGoodsVO> list = this.baseMapper.listExport(query,user); |
| | | if(list.isEmpty()){ |
| | | return list; |
| | | } |
| | | List<String> typeIds = list.stream().map(TErpGoods::getTypeId).collect(Collectors.toList()); |
| | | if(!typeIds.isEmpty()){ |
| | | List<TErpGoodsType> typeList = erpGoodsTypeMapper.selectBatchIds(typeIds); |
| | | for (TErpGoodsVO tErpGoodsVO : list) { |
| | | typeList.stream().filter(t -> t.getId().equals(tErpGoodsVO.getTypeId())).findFirst().ifPresent(t -> tErpGoodsVO.setTypeName(t.getTypeName())); |
| | | tErpGoodsVO.setTypeName(tErpGoodsVO.getTypeName()); |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | List<String> lowUnitIds = list.stream().map(TErpGoods::getLowUnitId).collect(Collectors.toList()); |
| | | if(!lowUnitIds.isEmpty()){ |
| | | List<TErpGoodsUnit> tErpGoodsUnits = erpGoodsUnitMapper.selectBatchIds(lowUnitIds); |
| | | for (TErpGoodsVO tErpGoodsVO : list) { |
| | | tErpGoodsUnits.stream().filter(t -> t.getId().equals(tErpGoodsVO.getLowUnitId())).findFirst().ifPresent(t -> tErpGoodsVO.setLowUnitName(t.getUnitName())); |
| | | } |
| | | } |
| | | List<String> packingUnitId = list.stream().map(TErpGoods::getPackingUnitId).collect(Collectors.toList()); |
| | | if(!packingUnitId.isEmpty()){ |
| | | List<TErpGoodsUnit> tErpGoodsUnits = erpGoodsUnitMapper.selectBatchIds(lowUnitIds); |
| | | for (TErpGoodsVO tErpGoodsVO : list) { |
| | | tErpGoodsUnits.stream().filter(t -> t.getId().equals(tErpGoodsVO.getPackingUnitId())).findFirst().ifPresent(t -> tErpGoodsVO.setPackingUnitName(t.getUnitName())); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | @Override |