From 0891b6708cc09c2672a19661a8555aae0e742df1 Mon Sep 17 00:00:00 2001
From: tuqin <tuqin@tuqin.cn>
Date: 星期四, 24 九月 2026 16:54:27 +0800
Subject: [PATCH] feat: 新增多模块导入导出功能
---
src/main/java/com/ruoyi/stock/controller/StockInRecordController.java | 55 +++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 41 insertions(+), 14 deletions(-)
diff --git a/src/main/java/com/ruoyi/stock/controller/StockInRecordController.java b/src/main/java/com/ruoyi/stock/controller/StockInRecordController.java
index f26bc5f..652c962 100644
--- a/src/main/java/com/ruoyi/stock/controller/StockInRecordController.java
+++ b/src/main/java/com/ruoyi/stock/controller/StockInRecordController.java
@@ -4,9 +4,10 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.R;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.stock.dto.StockInRecordDto;
+import com.ruoyi.stock.dto.StockInRecordImportDto;
import com.ruoyi.stock.service.StockInRecordService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
@@ -14,6 +15,7 @@
import lombok.RequiredArgsConstructor;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@@ -21,37 +23,37 @@
@Tag(name = "鍏ュ簱")
@RequestMapping("/stockInRecord")
@RequiredArgsConstructor
-public class StockInRecordController extends BaseController {
+public class StockInRecordController {
private final StockInRecordService stockInRecordService;
@GetMapping("/listPage")
@Log(title = "鐢熶骇鍏ュ簱-鍏ュ簱绠$悊-鍒楄〃", businessType = BusinessType.OTHER)
@Operation(summary = "鍏ュ簱绠$悊鍒楄〃")
- public R<?> listPage(Page page, StockInRecordDto stockInRecordDto) {
+ public AjaxResult listPage(Page page, StockInRecordDto stockInRecordDto) {
IPage<StockInRecordDto> result = stockInRecordService.listPage(page, stockInRecordDto);
- return R.ok(result);
+ return AjaxResult.success(result);
}
@DeleteMapping("")
@Log(title = "鍏ュ簱绠$悊-鍒犻櫎鍏ュ簱", businessType = BusinessType.DELETE)
- public R<?> delete(@RequestBody List<Long> ids) {
+ public AjaxResult delete(@RequestBody List<Long> ids) {
if(CollectionUtils.isEmpty(ids)){
- return R.fail("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
+ return AjaxResult.error("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
}
- return R.ok(stockInRecordService.batchDelete(ids));
+ return AjaxResult.success(stockInRecordService.batchDelete(ids));
}
@DeleteMapping("/pending")
@Log(title = "鍏ュ簱绠$悊-鍒犻櫎寰呭鎵瑰叆搴�", businessType = BusinessType.DELETE)
@Operation(summary = "鍒犻櫎寰呭鎵圭殑鍏ュ簱璁板綍")
- public R<?> deletePending(@RequestBody List<Long> ids) {
+ public AjaxResult deletePending(@RequestBody List<Long> ids) {
if(CollectionUtils.isEmpty(ids)){
- return R.fail("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
+ return AjaxResult.error("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
}
- return R.ok(stockInRecordService.batchDeletePending(ids));
+ return AjaxResult.success(stockInRecordService.batchDeletePending(ids));
}
@PostMapping("/exportStockInRecord")
@@ -63,12 +65,37 @@
@PostMapping("/approve")
@Log(title = "鍏ュ簱绠$悊-瀹℃壒鍏ュ簱", businessType = BusinessType.UPDATE)
@Operation(summary = "鎵归噺瀹℃壒鍏ュ簱璁板綍")
- public R<?> approve(@RequestBody StockInRecordDto approveDto) {
+ public AjaxResult approve(@RequestBody StockInRecordDto approveDto) {
if(CollectionUtils.isEmpty(approveDto.getIds())){
- return R.fail("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
+ return AjaxResult.error("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
}
stockInRecordService.batchApprove(approveDto.getIds(), approveDto.getApprovalStatus());
- return R.ok();
+ return AjaxResult.success();
+ }
+
+ @PostMapping("/reAudit")
+ @Log(title = "鍏ュ簱绠$悊-鍙嶅鍏ュ簱", businessType = BusinessType.UPDATE)
+ @Operation(summary = "鎵归噺鍙嶅鍏ュ簱璁板綍")
+ public AjaxResult reAudit(@RequestBody StockInRecordDto approveDto) {
+ if(CollectionUtils.isEmpty(approveDto.getIds())){
+ return AjaxResult.error("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
+ }
+ stockInRecordService.batchReAudit(approveDto.getIds());
+ return AjaxResult.success();
+ }
+
+ @PostMapping("/import")
+ @Log(title = "鍏ュ簱绠$悊-瀵煎叆", businessType = BusinessType.IMPORT)
+ @Operation(summary = "鍏ュ簱绠$悊-瀵煎叆")
+ public AjaxResult importData(MultipartFile file, String type) {
+ return stockInRecordService.importData(file, type);
+ }
+
+ @PostMapping("/importTemplate")
+ @Operation(summary = "鍏ュ簱绠$悊-瀵煎叆妯℃澘")
+ public void importTemplate(HttpServletResponse response) {
+ ExcelUtil<StockInRecordImportDto> util = new ExcelUtil<StockInRecordImportDto>(StockInRecordImportDto.class);
+ util.importTemplateExcel(response, "鍏ュ簱瀵煎叆妯℃澘");
}
}
--
Gitblit v1.9.3