| | |
| | | } |
| | | List<String> ids = list.stream().map(TErpProcurementVo::getId).collect(Collectors.toList()); |
| | | List<TErpProcurementGoods> tErpProcurementGoods = erpProcurementGoodsMapper.selectList |
| | | (new LambdaQueryWrapper<TErpProcurementGoods>().in(TErpProcurementGoods::getProcurementId, ids).eq(TErpProcurementGoods::getSupplierId, supplierClinicId)); |
| | | (new LambdaQueryWrapper<TErpProcurementGoods>().in(TErpProcurementGoods::getProcurementId, ids)); |
| | | List<TSysCommission> tSysCommissions =new ArrayList<>(); |
| | | if(!tErpProcurementGoods.isEmpty()){ |
| | | List<String> collect = tErpProcurementGoods.stream().map(TErpProcurementGoods::getId).collect(Collectors.toList()); |
| | |
| | | tErpGoodsVO.setTypeName(tErpGoodsVO.getTypeName()); |
| | | } |
| | | } |
| | | List<String> supplierClinicId = list.stream().filter(e->e.getGoodsSource()==1).map(TErpGoods::getSupplierClinicId).collect(Collectors.toList()); |
| | | if(!supplierClinicId.isEmpty()){ |
| | | List<TCrmSupplier> crmClinics = crmSupplierMapper.selectBatchIds(supplierClinicId); |
| | | for (TErpGoods 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 List<TErpGoodsVO> inventoryNotEnoughList(SysUser user) { |
| | | List<TErpGoodsVO> list = this.baseMapper.inventoryNotEnoughList(user); |
| | | List<String> typeIds = list.stream().map(TErpGoodsVO::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())); |
| | | } |
| | | } |
| | | List<String> supplierClinicId = list.stream().filter(e->e.getGoodsSource()==1).map(TErpGoodsVO::getSupplierClinicId).collect(Collectors.toList()); |
| | | if(!supplierClinicId.isEmpty()){ |
| | | List<TCrmSupplier> crmSuppliers = crmSupplierMapper.selectBatchIds(supplierClinicId); |
| | | for (TErpGoodsVO tErpGoodsVO : list) { |
| | | crmSuppliers.stream().filter(t -> t.getId().equals(tErpGoodsVO.getSupplierClinicId())).findFirst().ifPresent(t -> tErpGoodsVO.setSupplierName(t.getSupplierName())); |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | |
| | | |
| | | tErpProcurement.setTermNo(supplier.getTermNo()); |
| | | tErpProcurement.setMerchantNo(supplier.getRecvMerchantNo()); |
| | | tErpProcurement.setPayMoney(value.stream().map(AddProcurementDto::getSalesAmount).reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | tErpProcurement.setCreateId(user.getUserId().toString()); |
| | | |
| | | BigDecimal all = BigDecimal.ZERO; |
| | | |
| | | for (AddProcurementDto addProcurementDto : value) { |
| | | BigDecimal multiply = addProcurementDto.getSalesAmount().multiply(BigDecimal.valueOf(addProcurementDto.getPurchaseCount())); |
| | | all = all.add(multiply); |
| | | } |
| | | tErpProcurement.setPayMoney(all); |
| | | AddProcurementDto addProcurementDto = value.get(0); |
| | | if(addProcurementDto.getState()!=null && addProcurementDto.getState()==1){ |
| | | tErpProcurement.setStatus(1); |
| | |
| | | if(tErpProcurementGoods.getSupplierMoney().doubleValue()<0){ |
| | | throw new RuntimeException("平台抽成不能大于售卖价格"); |
| | | } |
| | | add = add.add(dto.getPlatformCommissionPrice()); |
| | | add = add.add(dto.getPlatformCommissionPrice().multiply(BigDecimal.valueOf(dto.getPurchaseCount()))); |
| | | tErpProcurementGoods1.add(tErpProcurementGoods); |
| | | } |
| | | BigDecimal bigDecimal = tErpProcurement.getPayMoney().multiply(BigDecimal.valueOf(0.0038)).setScale(2, RoundingMode.HALF_UP); |