From 0d7d874912d0147376826b55667a1deb6547ed91 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期四, 21 五月 2026 15:25:27 +0800
Subject: [PATCH] Merge branch 'dev_New_pro' into dev_宁夏_英泽防锈
---
src/main/java/com/ruoyi/sales/controller/ReceiptPaymentController.java | 99 +++++++++++++++++++++++++++++++++----------------
1 files changed, 67 insertions(+), 32 deletions(-)
diff --git a/src/main/java/com/ruoyi/sales/controller/ReceiptPaymentController.java b/src/main/java/com/ruoyi/sales/controller/ReceiptPaymentController.java
index 104f3d0..7d91849 100644
--- a/src/main/java/com/ruoyi/sales/controller/ReceiptPaymentController.java
+++ b/src/main/java/com/ruoyi/sales/controller/ReceiptPaymentController.java
@@ -2,27 +2,35 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.utils.bean.BeanUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.domain.R;
import com.ruoyi.framework.web.page.TableDataInfo;
-import com.ruoyi.purchase.dto.InvoicePurchaseDto;
+import com.ruoyi.sales.dto.InvoiceLedgerDto;
import com.ruoyi.sales.dto.ReceiptPaymentDto;
+import com.ruoyi.sales.dto.ReceiptPaymentRecordDto;
import com.ruoyi.sales.pojo.ReceiptPayment;
import com.ruoyi.sales.service.ReceiptPaymentService;
-import io.swagger.annotations.ApiModelProperty;
-import org.springframework.beans.factory.annotation.Autowired;
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.AllArgsConstructor;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
-import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
+import java.util.stream.Collectors;
@RestController
@RequestMapping("/receiptPayment")
+@AllArgsConstructor
public class ReceiptPaymentController extends BaseController {
- @Autowired
private ReceiptPaymentService receiptPaymentService;
/**
@@ -31,9 +39,9 @@
* @return
*/
@PostMapping("/saveOrUpdate")
- public AjaxResult receiptPaymentSaveOrUpdate (@RequestBody ReceiptPayment receiptPayment) {
+ public R<?> receiptPaymentSaveOrUpdate (@RequestBody List<ReceiptPayment> receiptPayment) {
receiptPaymentService.receiptPaymentSaveOrUpdate(receiptPayment);
- return AjaxResult.success();
+ return R.ok();
}
/**
@@ -42,8 +50,9 @@
* @return
*/
@PostMapping("/update")
- public AjaxResult receiptPaymentUpdate (@RequestBody ReceiptPayment receiptPayment) {
- return AjaxResult.success(receiptPaymentService.receiptPaymentUpdate(receiptPayment));
+ @Transactional(rollbackFor = Exception.class)
+ public R<?> receiptPaymentUpdate (@RequestBody ReceiptPayment receiptPayment) {
+ return R.ok(receiptPaymentService.receiptPaymentUpdate(receiptPayment));
}
/**
@@ -52,8 +61,9 @@
* @return
*/
@DeleteMapping("/del")
- public AjaxResult receiptPaymentDel (@RequestBody List<Integer> ids) {
- return AjaxResult.success(receiptPaymentService.receiptPaymentDel(ids));
+ @Transactional(rollbackFor = Exception.class)
+ public R<?> receiptPaymentDel (@RequestBody List<Integer> ids) {
+ return R.ok(receiptPaymentService.receiptPaymentDel(ids));
}
/**
@@ -62,8 +72,8 @@
* @return
*/
@GetMapping("/customerInteractions")
- public AjaxResult customerInteractions (ReceiptPaymentDto receiptPaymentDto) {
- return AjaxResult.success(receiptPaymentService.customerInteractions(receiptPaymentDto));
+ public R<?> customerInteractions (InvoiceLedgerDto receiptPaymentDto) {
+ return R.ok(receiptPaymentService.customerInteractions(receiptPaymentDto));
}
/**
@@ -72,20 +82,20 @@
* @return
*/
@GetMapping("/info")
- public AjaxResult receiptPaymentInfo (Integer id) {
- return AjaxResult.success(receiptPaymentService.receiptPaymentInfo(id));
+ public R<?> receiptPaymentInfo (Integer id) {
+ return R.ok(receiptPaymentService.receiptPaymentInfo(id));
}
/**
* 鏈湀鍥炴閲戦
*/
@GetMapping("/getReceiptAmount")
- public AjaxResult getReceiptAmount() {
+ public R<?> getReceiptAmount() {
try {
BigDecimal receiptAmount = receiptPaymentService.getReceiptAmount();
- return AjaxResult.success(receiptAmount != null ? receiptAmount : BigDecimal.ZERO);
+ return R.ok(receiptAmount != null ? receiptAmount : BigDecimal.ZERO);
} catch (Exception e) {
- return AjaxResult.error("鑾峰彇鍥炴閲戦澶辫触锛�" + e.getMessage());
+ return R.fail("鑾峰彇鍥炴閲戦澶辫触锛�" + e.getMessage());
}
}
@@ -96,19 +106,24 @@
* @return
*/
@GetMapping("/bindInvoiceNoRegPage")
- public AjaxResult bindInvoiceNoRegPage(Page page, ReceiptPaymentDto receiptPaymentDto) {
- return AjaxResult.success(receiptPaymentService.bindInvoiceNoRegPage(page,receiptPaymentDto));
+ public R<?> bindInvoiceNoRegPage(Page page, ReceiptPaymentDto receiptPaymentDto) {
+ return R.ok(receiptPaymentService.bindInvoiceNoRegPage(page,receiptPaymentDto));
}
- @ApiModelProperty("瀵煎嚭鍥炴鐧昏")
+ @Schema(description = "瀵煎嚭鍥炴鐧昏")
@PostMapping("/export")
- public void export(HttpServletResponse response, ArrayList<Long> ids) {
- //ids閫夋嫨灏辨槸鍏ㄥ鍑�
-// if (ids == null || ids.size() == 0) {
-// receiptPaymentService.exportPaymentList(response);
-// }
- receiptPaymentService.exportPaymentList(response, ids);
+ public void export(HttpServletResponse response, String ids) {
+ if (ids == null || ids.isEmpty()) {
+ receiptPaymentService.exportPaymentList(response, null);
+ } else {
+ ArrayList<Long> idList = (ArrayList<Long>) Arrays.stream(ids.split(","))
+ .map(s -> s.replaceAll("[\\[\\]]", "").trim())
+ .map(Long::valueOf)
+ .collect(Collectors.toList());
+ receiptPaymentService.exportPaymentList(response, idList);
+ }
}
+
/**
* 寮�绁ㄥ彴璐﹁鎯�
@@ -116,16 +131,16 @@
* @return
*/
@GetMapping("/invoiceInfo")
- public AjaxResult invoiceInfo (Integer id) {
- return AjaxResult.success(receiptPaymentService.invoiceInfo(id));
+ public R<?> invoiceInfo (Integer id) {
+ return R.ok(receiptPaymentService.invoiceInfo(id));
}
/**
* 鏈湀搴旀敹,鍥炴閲戦
*/
@GetMapping("/getAmountMouth")
- public AjaxResult getAmountMouth() {
- return AjaxResult.success(receiptPaymentService.getAmountMouth());
+ public R<?> getAmountMouth() {
+ return R.ok(receiptPaymentService.getAmountMouth());
}
/**
@@ -147,6 +162,26 @@
}
/**
+ * 瀵煎嚭鍥炴娴佹按鍒楄〃
+ */
+ @Log(title = "瀵煎嚭鍥炴娴佹按鍒楄〃", businessType = BusinessType.EXPORT)
+ @PostMapping("/exportOne")
+ public void exportOne(HttpServletResponse response, ReceiptPaymentDto salesLedgerDto) {
+ Page page = new Page();
+ page.setCurrent(-1);
+ page.setSize(-1);
+ IPage<ReceiptPaymentDto> salesLedgerIPage = receiptPaymentHistoryListPage(page, salesLedgerDto);
+ ExcelUtil<ReceiptPaymentRecordDto> util = new ExcelUtil<ReceiptPaymentRecordDto>(ReceiptPaymentRecordDto.class);
+ List<ReceiptPaymentRecordDto> receiptPaymentRecordDtos = new ArrayList<>();
+ salesLedgerIPage.getRecords().forEach(receiptPaymentRecordDto -> {
+ ReceiptPaymentRecordDto receiptPaymentRecordDto1 = new ReceiptPaymentRecordDto();
+ BeanUtils.copyProperties(receiptPaymentRecordDto, receiptPaymentRecordDto1);
+ receiptPaymentRecordDtos.add(receiptPaymentRecordDto1);
+ });
+ util.exportExcel(response, receiptPaymentRecordDtos, "瀵煎嚭寮�绁ㄧ櫥璁板垪琛�");
+ }
+
+ /**
* 鏌ヨ鍥炴璁板綍涓嶅垎椤�
*/
@GetMapping("/receiptPaymentHistoryListNoPage")
--
Gitblit v1.9.3