| | |
| | | private TErpProcurementGoodsService erpProcurementGoodsService; |
| | | |
| | | |
| | | |
| | | @Override |
| | | public PageInfo<TErpProcurementVo> pageList(TErpProcurementQuery query, SysUser user) { |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<TErpProcurementVo> pageListWarehouse(TErpProcurementQuery query, SysUser user) { |
| | | |
| | | |
| | | Integer roleType = user.getRoleType(); |
| | | String supplierClinicId = null; |
| | | if (roleType == 6) { |
| | | // 供应商 |
| | | TCrmSupplier crmSupplier = crmSupplierMapper.selectOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | supplierClinicId = crmSupplier.getId(); |
| | | |
| | | |
| | | String sTime = null; |
| | | String eTime = null; |
| | | if (query.getTime() != null && !query.getTime().isEmpty()) { |
| | | String[] split = query.getTime().split(" - "); |
| | | sTime = split[0] + " 00:00:00"; |
| | | eTime = split[1] + " 23:59:59"; |
| | | } |
| | | PageInfo<TErpProcurementVo> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TErpProcurementVo> list = this.baseMapper.pageListWarehouse(query, pageInfo, user, sTime, eTime, supplierClinicId); |
| | | // if (list.isEmpty()) { |
| | | // return pageInfo; |
| | | // } |
| | | // List<String> ids = list.stream().map(TErpProcurementVo::getId).collect(Collectors.toList()); |
| | | // List<TErpProcurementGoods> tErpProcurementGoods = erpProcurementGoodsMapper.selectList |
| | | // (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()); |
| | | // tSysCommissions = sysCommissionMapper.selectList(new LambdaQueryWrapper<TSysCommission>().in(TSysCommission::getTErpProcurementGoodsId, collect)); |
| | | // } |
| | | // for (TErpProcurementVo tErpProcurementVo : list) { |
| | | // List<TErpProcurementGoods> collect = tErpProcurementGoods.stream().filter(e -> e.getProcurementId().equals(tErpProcurementVo.getId())).collect(Collectors.toList()); |
| | | // int size = collect.stream().map(TErpProcurementGoods::getGoodsId).collect(Collectors.toSet()).size(); |
| | | // tErpProcurementVo.setTypeNum(size); |
| | | // BigDecimal reduce = collect.stream().map(TErpProcurementGoods::getTotalPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // tErpProcurementVo.setTotalPrice(reduce); |
| | | // if (!collect.isEmpty()) { |
| | | // List<String> collect1 = collect.stream().map(TErpProcurementGoods::getId).collect(Collectors.toList()); |
| | | // List<TSysCommission> collect2 = tSysCommissions.stream().filter(e -> collect1.contains(e.getTErpProcurementGoodsId())).collect(Collectors.toList()); |
| | | // BigDecimal reduce1 = collect2.stream().filter(e -> e.getType() == 1).map(TSysCommission::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // BigDecimal reduce2 = collect2.stream().filter(e -> e.getType() == 2).map(TSysCommission::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // tErpProcurementVo.setPlatformMoney(reduce1); |
| | | // tErpProcurementVo.setSupplierMoney(reduce2); |
| | | // } |
| | | // |
| | | // } |
| | | |
| | | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public TErpProcurementDetailVo detail(String id, SysUser user, String goodsName) { |
| | | |
| | | Integer roleType = user.getRoleType(); |
| | |
| | | tErpProcurementDetailNextVo.setNum(tErpProcurementGood.getPurchaseCount()); |
| | | tErpProcurementDetailNextVo.setTotalPrice(tErpProcurementGood.getTotalPrice()); |
| | | tErpProcurementDetailNextVo.setQuasiNumber(tErpProcurementGood.getQuasiNumber()); |
| | | tErpProcurementDetailNextVo.setPurchasePrice(tErpProcurementGood.getPurchasePrice()); |
| | | tErpProcurementDetailNextVo.setPurchasePrice(tErpProcurementGood.getSalesAmount()); |
| | | |
| | | |
| | | List<TSysCommission> tSysCommissions = sysCommissionMapper.selectList(new LambdaQueryWrapper<TSysCommission>().eq(TSysCommission::getTErpProcurementGoodsId, tErpProcurementGood.getId())); |
| | |
| | | tErpProcurementGoods.setUnitName(tErpGoodsUnit.getUnitName()); |
| | | tErpProcurementGoods.setPurchasePrice(dto.getGoodsSalesAmount()); |
| | | tErpProcurementGoods.setSalesAmount(dto.getSalesAmount()); |
| | | tErpProcurementGoods.setTotalPrice(dto.getSalesAmount().multiply(new BigDecimal(dto.getPurchaseCount()))); |
| | | tErpProcurementGoods.setTotalPrice(dto.getGoodsSalesAmount().multiply(new BigDecimal(dto.getPurchaseCount()))); |
| | | |
| | | tErpProcurementGoods.setPurchaseCount(dto.getPurchaseCount()); |
| | | tErpProcurementGoods.setSupplierId(supplierClinicId); |
| | |
| | | TCrmSupplier supplier = crmSupplierMapper.selectById(tErpProcurement.getSupplierId()); |
| | | detailProcurementVO.setSupplierName(supplier.getSupplierName()); |
| | | detailProcurementVO.setUserName(sysUserMapper.selectUserById(Long.valueOf(tErpProcurement.getCreateId())).getUserName()); |
| | | TCrmClinic tCrmClinic = crmClinicMapper.selectById(tErpProcurement.getClinicId()); |
| | | detailProcurementVO.setClinicName(tCrmClinic.getClinicName()); |
| | | detailProcurementVO.setClinicAddress(tCrmClinic.getClinicAddress()); |
| | | detailProcurementVO.setLogisticsNumber(tErpProcurement.getLogisticsNumber()); |
| | | List<TErpProcurementGoods> list = erpProcurementGoodsService.list(new QueryWrapper<TErpProcurementGoods>().eq("procurement_id", id)); |
| | | ArrayList<DetailProcurementNextVO> detailProcurementNextVOS = new ArrayList<>(); |
| | | for (TErpProcurementGoods tErpProcurementGoods : list) { |
| | |
| | | detailProcurementNextVO.setNum(tErpProcurementGoods.getPurchaseCount()); |
| | | detailProcurementNextVO.setTotalPrice(tErpProcurement.getPayMoney()); |
| | | detailProcurementNextVO.setId(tErpProcurementGoods.getId()); |
| | | detailProcurementNextVO.setPurchasePrice(tErpProcurementGoods.getPurchasePrice()); |
| | | detailProcurementNextVOS.add(detailProcurementNextVO); |
| | | } |
| | | detailProcurementVO.setList(detailProcurementNextVOS); |