liyong
6 天以前 9a30a3a8d3862a9b2ce898535b7cb51c3ddac816
src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerController.java
@@ -8,7 +8,7 @@
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.PurchaseLedgerDto;
import com.ruoyi.purchase.mapper.PurchaseLedgerTemplateMapper;
@@ -67,7 +67,7 @@
    @Log(title = "导入采购台账", businessType = BusinessType.INSERT)
    @PostMapping("/import")
    @Operation(summary = "导入采购台账")
    public AjaxResult importData(@RequestParam("file")
    public R<?> importData(@RequestParam("file")
                                 @ApiParam(value = "Excel文件", required = true)
                                         MultipartFile file) {
        return purchaseLedgerService.importData(file);
@@ -151,8 +151,9 @@
     */
    @Log(title = "采购台账", businessType = BusinessType.INSERT)
    @PostMapping("/addOrEditPurchase")
    public AjaxResult addOrEditPurchase(@RequestBody PurchaseLedgerDto purchaseLedgerDto) throws Exception {
        return toAjax(purchaseLedgerService.addOrEditPurchase(purchaseLedgerDto));
    public R<?> addOrEditPurchase(@RequestBody PurchaseLedgerDto purchaseLedgerDto) throws Exception {
        purchaseLedgerService.addOrEditPurchase(purchaseLedgerDto);
        return R.ok();
    }
    /**
@@ -160,7 +161,7 @@
     */
    @Operation(summary = "/查询采购模板")
    @GetMapping("/getPurchaseTemplateList")
    public AjaxResult getPurchaseTemplateList() {
    public R<?> getPurchaseTemplateList() {
        List<PurchaseLedgerTemplate>  purchaseLedgers = purchaseLedgerTemplateMapper.selectList(null);
        purchaseLedgers.forEach(purchaseLedgerDto1 -> {
            LambdaQueryWrapper<SalesLedgerProductTemplate> queryWrapper = new LambdaQueryWrapper<>();
@@ -171,14 +172,15 @@
                purchaseLedgerDto1.setProductList(list);
            }
        });
        return AjaxResult.success(purchaseLedgers);
        return R.ok(purchaseLedgers);
    }
    /**
     * 修改采购台账审批状态
     */
    @PostMapping("/updateApprovalStatus")
    public AjaxResult addOrEditPurchase(@RequestBody PurchaseLedger purchaseLedger){
        return toAjax(purchaseLedgerService.updateById(purchaseLedger));
    public R<?> addOrEditPurchase(@RequestBody PurchaseLedger purchaseLedger){
        purchaseLedgerService.updateById(purchaseLedger);
        return R.ok();
    }
    /**
     * 查询采购台账和产品父子列表
@@ -201,8 +203,9 @@
     */
    @Log(title = "采购台账", businessType = BusinessType.DELETE)
    @DeleteMapping("/delPurchase")
    public AjaxResult remove(@RequestBody Long[] ids) {
        return toAjax(purchaseLedgerService.deletePurchaseLedgerByIds(ids));
    public R<?> remove(@RequestBody Long[] ids) {
        purchaseLedgerService.deletePurchaseLedgerByIds(ids);
        return R.ok();
    }
    /**
@@ -218,8 +221,8 @@
     * 根据销售合同查询产品信息
     */
    @GetMapping("/getProductBySalesNo")
    public AjaxResult getProductBySalesNo(Long id) {
        return AjaxResult.success(purchaseLedgerService.getProductBySalesNo(id));
    public R<?> getProductBySalesNo(Long id) {
        return R.ok(purchaseLedgerService.getProductBySalesNo(id));
    }
    /**
@@ -234,8 +237,8 @@
     * 根据id查询采购合同号
     */
    @GetMapping("/getPurchaseNoById")
    public AjaxResult getPurchaseNoById(Long id) {
        return AjaxResult.success(purchaseLedgerService.getPurchaseNoById(id));
    public R<?> getPurchaseNoById(Long id) {
        return R.ok(purchaseLedgerService.getPurchaseNoById(id));
    }
    /**
@@ -250,22 +253,22 @@
     * 根据采购合同号查询产品
     */
    @GetMapping("/getInfo")
    public AjaxResult getInfo(PurchaseLedgerDto purchaseLedgerDto) {
        return AjaxResult.success(purchaseLedgerService.getInfo(purchaseLedgerDto));
    public R<?> getInfo(PurchaseLedgerDto purchaseLedgerDto) {
        return R.ok(purchaseLedgerService.getInfo(purchaseLedgerDto));
    }
    /**
     * 查询采购台账列表
     */
    @GetMapping("/listPage")
    public AjaxResult listPage(Page page, PurchaseLedgerDto purchaseLedger) {
        return AjaxResult.success(purchaseLedgerService.selectPurchaseLedgerListPage(page, purchaseLedger));
    public R<?> listPage(Page page, PurchaseLedgerDto purchaseLedger) {
        return R.ok(purchaseLedgerService.selectPurchaseLedgerListPage(page, purchaseLedger));
    }
    @Operation(summary = "生成采购序列号")
    @GetMapping("/createPurchaseNo")
    @Log(title = "生成采购序列号", businessType = BusinessType.OTHER)
    public AjaxResult createPurchaseNo() {
        return AjaxResult.success("生成成功",purchaseLedgerService.getPurchaseNo());
    public R<?> createPurchaseNo() {
        return R.ok(purchaseLedgerService.getPurchaseNo(), "生成成功");
    }
}