tuqin
2026-09-24 0891b6708cc09c2672a19661a8555aae0e742df1
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, "入库导入模板");
    }
}