package cn.iocoder.yudao.module.crm.controller.admin.finance;
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.module.crm.controller.admin.finance.vo.CrmCustomerStatementReqVO;
|
import cn.iocoder.yudao.module.crm.controller.admin.finance.vo.CrmCustomerStatementRespVO;
|
import cn.iocoder.yudao.module.crm.controller.admin.finance.vo.CrmCustomerStatementSummaryReqVO;
|
import cn.iocoder.yudao.module.crm.controller.admin.finance.vo.CrmCustomerStatementSummaryRespVO;
|
import cn.iocoder.yudao.module.crm.controller.admin.finance.vo.CrmFinanceTrendRespVO;
|
import cn.iocoder.yudao.module.crm.controller.admin.finance.vo.CrmShippedNotInvoicedRespVO;
|
import cn.iocoder.yudao.module.crm.controller.admin.finance.vo.CrmUnwrittenOffRespVO;
|
import cn.iocoder.yudao.module.crm.service.finance.CrmFinanceReportService;
|
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
import jakarta.annotation.Resource;
|
import jakarta.validation.Valid;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.validation.annotation.Validated;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.util.List;
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
/**
|
* 管理后台 - CRM 财务对账与报表
|
*
|
* @author 超级管理员
|
*/
|
@Tag(name = "管理后台 - CRM 财务对账与报表")
|
@RestController
|
@RequestMapping("/crm/finance/report")
|
@Validated
|
public class CrmFinanceReportController {
|
|
@Resource
|
private CrmFinanceReportService financeReportService;
|
|
@GetMapping("/customer-statement")
|
@Operation(summary = "获得客户往来对账数据", description = "按客户统计销售订单、开票、回款流水,可按下单/开票/回款时间过滤")
|
@PreAuthorize("@ss.hasPermission('crm:receivable:query')")
|
public CommonResult<CrmCustomerStatementRespVO> getCustomerStatement(@Valid CrmCustomerStatementReqVO reqVO) {
|
return success(financeReportService.getCustomerStatement(reqVO));
|
}
|
|
@GetMapping("/customer-statement/summary-list")
|
@Operation(summary = "获得各客户往来汇总列表(左侧客户总览)")
|
@PreAuthorize("@ss.hasPermission('crm:receivable:query')")
|
public CommonResult<List<CrmCustomerStatementSummaryRespVO>> getCustomerSummaryList(
|
@Valid CrmCustomerStatementSummaryReqVO reqVO) {
|
return success(financeReportService.getCustomerSummaryList(reqVO));
|
}
|
|
@GetMapping("/shipped-not-invoiced")
|
@Operation(summary = "获得已发货未开票明细")
|
@Parameter(name = "customerId", description = "客户编号,不传时统计全部客户")
|
@PreAuthorize("@ss.hasPermission('crm:invoice:query')")
|
public CommonResult<List<CrmShippedNotInvoicedRespVO>> getShippedNotInvoicedList(
|
@RequestParam(value = "customerId", required = false) Long customerId) {
|
return success(financeReportService.getShippedNotInvoicedList(customerId));
|
}
|
|
@GetMapping("/unwritten-off")
|
@Operation(summary = "获得未核销应收明细", description = "已审批通过开票中仍有未回款金额的部分,返回账龄")
|
@Parameter(name = "customerId", description = "客户编号,不传时统计全部客户")
|
@PreAuthorize("@ss.hasPermission('crm:receivable:query')")
|
public CommonResult<List<CrmUnwrittenOffRespVO>> getUnwrittenOffList(
|
@RequestParam(value = "customerId", required = false) Long customerId) {
|
return success(financeReportService.getUnwrittenOffList(customerId));
|
}
|
|
@GetMapping("/monthly-trend")
|
@Operation(summary = "获得财务月度趋势", description = "返回最近 N 个月的开票金额(审批通过)与回款金额(审批通过)")
|
@Parameter(name = "months", description = "月份数量,默认 6,范围 1-36")
|
@PreAuthorize("@ss.hasPermission('crm:receivable:query')")
|
public CommonResult<List<CrmFinanceTrendRespVO>> getMonthlyTrend(
|
@RequestParam(value = "months", required = false, defaultValue = "6") Integer months) {
|
return success(financeReportService.getMonthlyTrend(months));
|
}
|
|
}
|