| | |
| | | |
| | | 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 com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.service.ISalesLedgerProductService; |
| | | import com.ruoyi.sales.service.ISalesLedgerService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | 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; |
| | | |
| | | /** |
| | |
| | | @RestController |
| | | @RequestMapping("/purchase/ledger") |
| | | @AllArgsConstructor |
| | | @Api(tags = "111") |
| | | public class PurchaseLedgerController extends BaseController { |
| | | private IPurchaseLedgerService purchaseLedgerService; |
| | | |
| | |
| | | /** |
| | | * 查询采购模板 |
| | | */ |
| | | @ApiOperation("/2222") |
| | | @GetMapping("/getPurchaseTemplateList") |
| | | public AjaxResult getPurchaseTemplateList() { |
| | | PurchaseLedgerDto purchaseLedgerDto = new PurchaseLedgerDto(); |
| | |
| | | */ |
| | | @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("生成采购序列号") |