| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult listPage(Page page, PurchaseLedgerDto purchaseLedger) { |
| | | IPage<PurchaseLedgerDto> purchaseLedgerDtoIPage = purchaseLedgerService.selectPurchaseLedgerListPage(page ,purchaseLedger); |
| | | //过滤掉approvalStatus=3的记录 |
| | | purchaseLedgerDtoIPage.getRecords().removeIf(purchaseLedgerDto -> purchaseLedgerDto.getApprovalStatus() == 3); |
| | | return AjaxResult.success(purchaseLedgerDtoIPage); |
| | | IPage<PurchaseLedgerDto> purchaseLedgerDtoIPage = Optional.ofNullable( |
| | | purchaseLedgerService.selectPurchaseLedgerListPage(page, purchaseLedger) |
| | | ).orElse(new Page<>()); |
| | | |
| | | // 处理null |
| | | Optional.ofNullable(purchaseLedgerDtoIPage.getRecords()) |
| | | .filter(CollectionUtils::isNotEmpty) |
| | | .ifPresent(records -> { |
| | | // 过滤approvalStatus=3的记录 |
| | | records.removeIf(dto -> dto != null && dto.getApprovalStatus() == 3); |
| | | // 修正未收付款金额 |
| | | records.forEach(dto -> { |
| | | if (dto == null) return; |
| | | BigDecimal unReceiptAmt = Optional.ofNullable(dto.getUnReceiptPaymentAmount()).orElse(BigDecimal.ZERO); |
| | | if (unReceiptAmt.compareTo(BigDecimal.ZERO) == 0) { |
| | | dto.setUnReceiptPaymentAmount(Optional.ofNullable(dto.getContractAmount()).orElse(BigDecimal.ZERO)); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | return AjaxResult.success(purchaseLedgerDtoIPage); |
| | | } |
| | | |
| | | @ApiOperation("生成采购序列号") |