| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.service.AccountIncomeService; |
| | | import com.ruoyi.aftersalesservice.pojo.AfterSalesService; |
| | | import com.ruoyi.basic.mapper.CustomerMapper; |
| | | import com.ruoyi.basic.mapper.ProductMapper; |
| | | import com.ruoyi.basic.mapper.ProductModelMapper; |
| | |
| | | return lossProductModelDtos; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<SalesLedgerDto> listSalesLedger(SalesLedgerDto salesLedgerDto, Page page) { |
| | | IPage<SalesLedgerDto> salesLedgerDtoIPage = salesLedgerMapper.listSalesLedger(page, salesLedgerDto); |
| | | for (SalesLedgerDto salesLedger : salesLedgerDtoIPage.getRecords()) { |
| | | LambdaQueryWrapper<SalesLedgerProduct> productWrapper = new LambdaQueryWrapper<>(); |
| | | productWrapper.eq(SalesLedgerProduct::getSalesLedgerId, salesLedger.getId()); |
| | | productWrapper.eq(SalesLedgerProduct::getType, 1); |
| | | List<SalesLedgerProduct> products = salesLedgerProductMapper.selectList(productWrapper); |
| | | for (SalesLedgerProduct product : products) { |
| | | product.setOriginalNoInvoiceNum(product.getNoInvoiceNum()); |
| | | // 提供临时未开票数,未开票金额供前段计算 |
| | | product.setTempnoInvoiceAmount(product.getNoInvoiceAmount()); |
| | | product.setTempNoInvoiceNum(product.getNoInvoiceNum()); |
| | | product.setRegister(SecurityUtils.getLoginUser().getUser().getNickName()); |
| | | product.setRegisterDate(LocalDateTime.now()); |
| | | // 发货信息 |
| | | ShippingInfo shippingInfo = shippingInfoMapper.selectOne(new LambdaQueryWrapper<ShippingInfo>() |
| | | .eq(ShippingInfo::getSalesLedgerProductId, product.getId()) |
| | | .orderByDesc(ShippingInfo::getCreateTime) |
| | | .last("limit 1")); |
| | | if (shippingInfo != null) { |
| | | product.setShippingStatus(shippingInfo.getStatus()); |
| | | |
| | | } |
| | | } |
| | | if (!products.isEmpty()) { |
| | | salesLedger.setHasChildren(true); |
| | | salesLedger.setProductData(products); |
| | | } |
| | | } |
| | | |
| | | return salesLedgerDtoIPage; |
| | | } |
| | | |
| | | |
| | | // 内部类用于存储聚合结果 |
| | | private static class GroupedCustomer { |