5 天以前 0d7d874912d0147376826b55667a1deb6547ed91
src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java
@@ -10,7 +10,6 @@
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.sales.dto.InvoiceLedgerDto;
@@ -67,7 +66,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 salesLedgerService.importData(file);
@@ -183,8 +182,9 @@
     */
    @Log(title = "销售台账", businessType = BusinessType.INSERT)
    @PostMapping("/addOrUpdateSalesLedger")
    public AjaxResult add(@RequestBody SalesLedgerDto salesLedgerDto) {
        return toAjax(salesLedgerService.addOrUpdateSalesLedger(salesLedgerDto));
    public R<?> add(@RequestBody SalesLedgerDto salesLedgerDto) {
        salesLedgerService.addOrUpdateSalesLedger(salesLedgerDto);
        return R.ok();
    }
    /**
@@ -192,11 +192,12 @@
     */
    @Log(title = "销售台账", businessType = BusinessType.DELETE)
    @DeleteMapping("/delLedger")
    public AjaxResult remove(@RequestBody Long[] ids) {
    public R<?> remove(@RequestBody Long[] ids) {
        if (ids == null || ids.length == 0) {
            return AjaxResult.error("请传入要删除的ID");
            return R.fail("请传入要删除的ID");
        }
        return toAjax(salesLedgerService.deleteSalesLedgerByIds(ids));
        salesLedgerService.deleteSalesLedgerByIds(ids);
        return R.ok();
    }
    /**
@@ -206,9 +207,9 @@
     * @return
     */
    @GetMapping("/listNoPage")
    public AjaxResult listNoPage(SalesLedgerDto salesLedgerDto) {
    public R<?> listNoPage(SalesLedgerDto salesLedgerDto) {
        List<SalesLedger> list = salesLedgerService.selectSalesLedgerList(salesLedgerDto);
        return AjaxResult.success(list);
        return R.ok(list);
    }
    /**
@@ -216,23 +217,24 @@
     */
    @Log(title = "销售台账附件删除", businessType = BusinessType.DELETE)
    @DeleteMapping("/delLedgerFile")
    public AjaxResult delLedgerFile(@RequestBody Long[] ids) {
    public R<?> delLedgerFile(@RequestBody Long[] ids) {
        if (ids == null || ids.length == 0) {
            return AjaxResult.error("请传入要删除的ID");
            return R.fail("请传入要删除的ID");
        }
        return toAjax(commonFileService.deleteSalesLedgerByIds(ids));
        commonFileService.deleteSalesLedgerByIds(ids);
        return R.ok();
    }
    /**
     * 本月销售合同金额
     */
    @GetMapping("/getContractAmount")
    public AjaxResult getContractAmount() {
    public R<?> getContractAmount() {
        try {
            BigDecimal contractAmount = salesLedgerService.getContractAmount();
            return AjaxResult.success(contractAmount != null ? contractAmount : BigDecimal.ZERO);
            return R.ok(contractAmount != null ? contractAmount : BigDecimal.ZERO);
        } catch (Exception e) {
            return AjaxResult.error("获取合同金额失败:" + e.getMessage());
            return R.fail("获取合同金额失败:" + e.getMessage());
        }
    }
@@ -240,16 +242,16 @@
     * 客户合同金额TOP5统计
     */
    @GetMapping("/getTopFiveList")
    public AjaxResult getTopFiveList() {
        return AjaxResult.success(salesLedgerService.getTopFiveList());
    public R<?> getTopFiveList() {
        return R.ok(salesLedgerService.getTopFiveList());
    }
    /**
     * 近半年开票,回款金额
     */
    @GetMapping("/getAmountHalfYear")
    public AjaxResult getAmountHalfYear(@RequestParam(value = "type",defaultValue = "1") Integer type) {
        return AjaxResult.success(salesLedgerService.getAmountHalfYear(type));
    public R<?> getAmountHalfYear(@RequestParam(value = "type",defaultValue = "1") Integer type) {
        return R.ok(salesLedgerService.getAmountHalfYear(type));
    }
    /**