| | |
| | | typeList.stream().filter(t -> t.getId().equals(tErpGoodsVO.getTypeId())).findFirst().ifPresent(t -> tErpGoodsVO.setTypeName(t.getTypeName())); |
| | | } |
| | | } |
| | | List<String> collect = list.stream().filter(e -> e.getGoodsSource() == 1).map(TErpGoods::getSupplierClinicId).collect(Collectors.toList()); |
| | | if (!collect.isEmpty()) { |
| | | List<TCrmSupplier> crmClinics = crmSupplierMapper.selectBatchIds(collect); |
| | | for (TErpGoodsVO tErpGoodsVO : list) { |
| | | crmClinics.stream().filter(t -> t.getId().equals(tErpGoodsVO.getSupplierClinicId())).findFirst().ifPresent(t -> tErpGoodsVO.setSupplierName(t.getSupplierName())); |
| | | } |
| | | } |
| | | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | @Override |
| | | public PageInfo<TErpGoodsVO> pageList1(TErpGoodsQuery query, SysUser user) { |
| | | PageInfo<TErpGoodsVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TErpGoodsVO> list = this.baseMapper.pageList(query, pageInfo, user); |
| | | if (list.isEmpty()) { |
| | | return pageInfo; |
| | | } |
| | | 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())); |
| | | } |
| | | } |
| | | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean isExit(String goodsIdCode, String quasiNumber) { |
| | | Long size = this.baseMapper.selectCount(new LambdaQueryWrapper<>(TErpGoods.class).eq(TErpGoods::getGoodsIdCode, goodsIdCode).or().eq(TErpGoods::getQuasiNumber, quasiNumber)); |
| | | public boolean isExit(String goodsIdCode, String quasiNumber,String id) { |
| | | Long size = this.baseMapper.selectCount(new LambdaQueryWrapper<>(TErpGoods.class).ne(id!=null,TErpGoods::getId, id).and(q -> q.eq(TErpGoods::getGoodsIdCode, goodsIdCode).or().eq(TErpGoods::getQuasiNumber, quasiNumber))); |
| | | if (size > 0) { |
| | | return true; |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | |
| | | } |
| | | wrapper.orderByDesc(BaseModel::getCreateTime); |
| | | Page<TErpGoods> page = this.page(new Page<>(query.getPageNum(), query.getPageSize()), wrapper); |
| | | List<TErpGoods> records = page.getRecords(); |
| | | if(records.isEmpty()){ |
| | | return page; |
| | | } |
| | | List<String> packingUnitId = records.stream().map(TErpGoods::getPackingUnitId).collect(Collectors.toList()); |
| | | if(!packingUnitId.isEmpty()){ |
| | | List<TErpGoodsUnit> tErpGoodsUnits = erpGoodsUnitMapper.selectBatchIds(packingUnitId); |
| | | for (TErpGoods tErpGoods : records) { |
| | | tErpGoodsUnits.stream().filter(t -> t.getId().equals(tErpGoods.getPackingUnitId())).findFirst().ifPresent(t -> tErpGoods.setPackingUnitName(t.getUnitName())); |
| | | } |
| | | } |
| | | page.setRecords( records); |
| | | return page; |
| | | } |
| | | |