| | |
| | | private final SysUserMapper sysUserMapper; |
| | | private final ISalesLedgerProductService salesLedgerProductService; |
| | | private final ISalesLedgerService salesLedgerService; |
| | | private final com.ruoyi.sales.mapper.ShippingInfoMapper shippingInfoMapper; |
| | | |
| | | @Override |
| | | public IPage<AfterSalesServiceNewDto> listPage(Page page, AfterSalesServiceNewDto afterSalesService) { |
| | |
| | | SalesLedger byId = salesLedgerService.getById(afterSalesService.getSalesLedgerId()); |
| | | List<Long> collect = Arrays.stream(afterSalesService.getProductModelIds().split(",")).map(Long::valueOf).collect(Collectors.toList()); |
| | | List<SalesLedgerProduct> list = salesLedgerProductService.list(new QueryWrapper<SalesLedgerProduct>().lambda().in(SalesLedgerProduct::getId, collect)); |
| | | |
| | | if (StringUtils.isNotEmpty(afterSalesService.getProductModelQuantities())) { |
| | | String[] quantities = afterSalesService.getProductModelQuantities().split(","); |
| | | for (int i = 0; i < collect.size(); i++) { |
| | | Long productId = collect.get(i); |
| | | for (SalesLedgerProduct product : list) { |
| | | if (product.getId().equals(productId)) { |
| | | if (i < quantities.length && StringUtils.isNotEmpty(quantities[i])) { |
| | | product.setQuantity(new java.math.BigDecimal(quantities[i])); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | for (SalesLedgerProduct product : list) { |
| | | com.ruoyi.sales.pojo.ShippingInfo shippingInfo = shippingInfoMapper.selectOne( |
| | | new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<com.ruoyi.sales.pojo.ShippingInfo>() |
| | | .eq(com.ruoyi.sales.pojo.ShippingInfo::getSalesLedgerProductId, product.getId()) |
| | | .orderByDesc(com.ruoyi.sales.pojo.ShippingInfo::getCreateTime) |
| | | .last("limit 1") |
| | | ); |
| | | if (shippingInfo != null) { |
| | | product.setShippingCarNumber(shippingInfo.getShippingCarNumber()); |
| | | product.setShippingDate(shippingInfo.getShippingDate()); |
| | | product.setShippingStatus(shippingInfo.getStatus()); |
| | | product.setExpressCompany(shippingInfo.getExpressCompany()); |
| | | product.setExpressNumber(shippingInfo.getExpressNumber()); |
| | | } |
| | | } |
| | | |
| | | AfterSalesServiceNewDto afterSalesServiceNewDto = new AfterSalesServiceNewDto(); |
| | | BeanUtils.copyProperties(afterSalesService, afterSalesServiceNewDto); |
| | | SalesLedgerDto salesLedgerDto = new SalesLedgerDto(); |