From 4b9661fc69e31534c3e17818ba32df167658f31a Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期一, 05 一月 2026 16:30:45 +0800
Subject: [PATCH] yys
---
src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerController.java | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerController.java b/src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerController.java
index ea6eda5..7370882 100644
--- a/src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerController.java
+++ b/src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerController.java
@@ -1,5 +1,6 @@
package com.ruoyi.purchase.controller;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.utils.poi.ExcelUtil;
@@ -11,6 +12,8 @@
import com.ruoyi.purchase.dto.PurchaseLedgerDto;
import com.ruoyi.purchase.pojo.PurchaseLedger;
import com.ruoyi.purchase.service.IPurchaseLedgerService;
+import com.ruoyi.sales.pojo.SalesLedgerProduct;
+import com.ruoyi.sales.service.ISalesLedgerProductService;
import com.ruoyi.sales.service.ISalesLedgerService;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
@@ -19,6 +22,7 @@
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
+import java.util.stream.Collectors;
/**
* 閲囪喘鍙拌处Controller
@@ -33,6 +37,7 @@
private IPurchaseLedgerService purchaseLedgerService;
private ISalesLedgerService salesLedgerService;
+ private ISalesLedgerProductService salesLedgerProductService;
/**
* 鏌ヨ閲囪喘鍙拌处鍒楄〃
@@ -56,6 +61,20 @@
}
/**
+ * 瀵煎嚭鏉ョエ鐧昏鍒楄〃
+ */
+ @Log(title = "瀵煎嚭鏉ョエ鐧昏鍒楄〃", businessType = BusinessType.EXPORT)
+ @PostMapping("/exportOne")
+ public void exportOne(HttpServletResponse response, PurchaseLedger purchaseLedger) {
+ Page page = new Page();
+ page.setCurrent(-1);
+ page.setSize(-1);
+ IPage<PurchaseLedgerDto> purchaseLedgerDtoIPage = purchaseLedgerService.selectPurchaseLedgerListPage(page, new PurchaseLedgerDto());
+ ExcelUtil<PurchaseLedgerDto> util = new ExcelUtil<PurchaseLedgerDto>(PurchaseLedgerDto.class);
+ util.exportExcel(response, purchaseLedgerDtoIPage.getRecords(), "瀵煎嚭鏉ョエ鐧昏鍒楄〃");
+ }
+
+ /**
* 鏂板淇敼閲囪喘鍙拌处
*/
@Log(title = "閲囪喘鍙拌处", businessType = BusinessType.INSERT)
@@ -63,7 +82,39 @@
public AjaxResult addOrEditPurchase(@RequestBody PurchaseLedgerDto purchaseLedgerDto) throws IOException {
return toAjax(purchaseLedgerService.addOrEditPurchase(purchaseLedgerDto));
}
+ /**
+ * 鏂板閲囪喘妯℃澘
+ */
+ @PostMapping("/addPurchaseTemplate")
+ public AjaxResult addPurchaseTemplate(@RequestBody PurchaseLedgerDto purchaseLedgerDto) throws IOException {
+ return toAjax(purchaseLedgerService.addPurchaseTemplate(purchaseLedgerDto));
+ }
+ /**
+ * 鏌ヨ閲囪喘妯℃澘
+ */
+ @GetMapping("/getPurchaseTemplateList")
+ public AjaxResult getPurchaseTemplateList() {
+ IPage<PurchaseLedgerDto> purchaseLedgerDtoIPage = purchaseLedgerService.selectPurchaseLedgerListPage(new Page(1, -1), new PurchaseLedgerDto());
+ List<PurchaseLedgerDto> purchaseLedgers = purchaseLedgerDtoIPage.getRecords();
+ purchaseLedgers = purchaseLedgers.stream().filter(purchaseLedger -> purchaseLedger.getApprovalStatus() == 3).collect(Collectors.toList());
+ purchaseLedgers.forEach(purchaseLedgerDto -> {
+ LambdaQueryWrapper<SalesLedgerProduct> queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.eq(SalesLedgerProduct::getSalesLedgerId, purchaseLedgerDto.getId());
+ List<SalesLedgerProduct> list = salesLedgerProductService.list(queryWrapper);
+ if (!list.isEmpty()) {
+ purchaseLedgerDto.setProductData(list);
+ }
+ });
+ return AjaxResult.success(purchaseLedgers);
+ }
+ /**
+ * 淇敼閲囪喘鍙拌处瀹℃壒鐘舵��
+ */
+ @PostMapping("/updateApprovalStatus")
+ public AjaxResult addOrEditPurchase(@RequestBody PurchaseLedger purchaseLedger){
+ return toAjax(purchaseLedgerService.updateById(purchaseLedger));
+ }
/**
* 鏌ヨ閲囪喘鍙拌处鍜屼骇鍝佺埗瀛愬垪琛�
*/
@@ -134,8 +185,8 @@
* 鏌ヨ閲囪喘鍙拌处鍒楄〃
*/
@GetMapping("/listPage")
- public IPage<PurchaseLedger> listPage(Page page, PurchaseLedger purchaseLedger) {
- return purchaseLedgerService.selectPurchaseLedgerListPage(page ,purchaseLedger);
+ public AjaxResult listPage(Page page, PurchaseLedgerDto purchaseLedger) {
+ return AjaxResult.success(purchaseLedgerService.selectPurchaseLedgerListPage(page ,purchaseLedger));
}
@ApiOperation("鐢熸垚閲囪喘搴忓垪鍙�")
--
Gitblit v1.9.3