tuqin
2026-09-24 0891b6708cc09c2672a19661a8555aae0e742df1
src/main/java/com/ruoyi/stock/controller/StockInRecordController.java
@@ -4,8 +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.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;
@@ -13,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;
@@ -43,10 +46,56 @@
        return AjaxResult.success(stockInRecordService.batchDelete(ids));
    }
    @DeleteMapping("/pending")
    @Log(title = "入库管理-删除待审批入库", businessType = BusinessType.DELETE)
    @Operation(summary = "删除待审批的入库记录")
    public AjaxResult deletePending(@RequestBody List<Long> ids) {
        if(CollectionUtils.isEmpty(ids)){
            return AjaxResult.error("请选择至少一条数据");
        }
        return AjaxResult.success(stockInRecordService.batchDeletePending(ids));
    }
    @PostMapping("/exportStockInRecord")
    @Operation(summary = "导出入库记录")
    public void exportStockInRecord(HttpServletResponse response, StockInRecordDto stockInRecordDto) {
        stockInRecordService.exportStockInRecord(response,stockInRecordDto);
    }
    @PostMapping("/approve")
    @Log(title = "入库管理-审批入库", businessType = BusinessType.UPDATE)
    @Operation(summary = "批量审批入库记录")
    public AjaxResult approve(@RequestBody StockInRecordDto approveDto) {
        if(CollectionUtils.isEmpty(approveDto.getIds())){
            return AjaxResult.error("请选择至少一条数据");
        }
        stockInRecordService.batchApprove(approveDto.getIds(), approveDto.getApprovalStatus());
        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, "入库导入模板");
    }
}