feat(crm): 添加销售报表功能模块
- 新增销售报表查询业务对象CrmSalesReportBo,支持多种查询条件 - 创建销售报表控制器CrmSalesReportController,提供汇总数据、订单明细、统计分析等接口 - 实现销售报表数据访问层CrmSalesReportMapper,包含销售汇总、订单明细、销售员统计等查询 - 开发销售报表服务层ICrmSalesReportService及其实现类,处理报表数据逻辑 - 设计销售报表视图对象CrmSalesReportVo,包含汇总信息、订单明细、统计分析等数据结构 - 集成Excel导出功能,支持订单明细、销售员统计、客户等级统计、行业统计的数据导出 - 实现多维度统计分析,包括销售员业绩、客户等级分布、行业分布等统计功能
This commit is contained in:
@@ -0,0 +1,127 @@
|
||||
package com.klp.crm.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.crm.domain.vo.CrmSalesReportVo;
|
||||
import com.klp.crm.domain.bo.CrmSalesReportBo;
|
||||
import com.klp.crm.service.ICrmSalesReportService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 销售报表
|
||||
*
|
||||
* @author klp
|
||||
* @date 2025-12-29
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/crm/salesReport")
|
||||
public class CrmSalesReportController extends BaseController {
|
||||
|
||||
private final ICrmSalesReportService iCrmSalesReportService;
|
||||
|
||||
/**
|
||||
* 查询销售报表汇总数据
|
||||
*/
|
||||
@GetMapping("/summary")
|
||||
public R<CrmSalesReportVo.SalesSummary> getSalesSummary(CrmSalesReportBo bo) {
|
||||
CrmSalesReportVo.SalesSummary summary = iCrmSalesReportService.querySalesSummary(bo);
|
||||
return R.ok(summary);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询销售报表订单明细
|
||||
*/
|
||||
@GetMapping("/orderDetails")
|
||||
public TableDataInfo<CrmSalesReportVo.OrderDetail> getOrderDetails(CrmSalesReportBo bo, PageQuery pageQuery) {
|
||||
return iCrmSalesReportService.queryOrderDetailPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询完整销售报表数据
|
||||
*/
|
||||
@GetMapping("/fullReport")
|
||||
public R<CrmSalesReportVo> getFullSalesReport(CrmSalesReportBo bo, PageQuery pageQuery) {
|
||||
CrmSalesReportVo reportVo = iCrmSalesReportService.queryFullSalesReport(bo, pageQuery);
|
||||
return R.ok(reportVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询销售员统计数据
|
||||
*/
|
||||
@GetMapping("/salesmanStats")
|
||||
public R<List<CrmSalesReportVo.SalesmanStat>> getSalesmanStats(CrmSalesReportBo bo) {
|
||||
List<CrmSalesReportVo.SalesmanStat> stats = iCrmSalesReportService.querySalesmanStats(bo);
|
||||
return R.ok(stats);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询客户等级统计数据
|
||||
*/
|
||||
@GetMapping("/customerLevelStats")
|
||||
public R<List<CrmSalesReportVo.CustomerLevelStat>> getCustomerLevelStats(CrmSalesReportBo bo) {
|
||||
List<CrmSalesReportVo.CustomerLevelStat> stats = iCrmSalesReportService.queryCustomerLevelStats(bo);
|
||||
return R.ok(stats);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询行业统计数据
|
||||
*/
|
||||
@GetMapping("/industryStats")
|
||||
public R<List<CrmSalesReportVo.IndustryStat>> getIndustryStats(CrmSalesReportBo bo) {
|
||||
List<CrmSalesReportVo.IndustryStat> stats = iCrmSalesReportService.queryIndustryStats(bo);
|
||||
return R.ok(stats);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出销售报表订单明细
|
||||
*/
|
||||
@Log(title = "销售报表", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/exportOrderDetails")
|
||||
public void exportOrderDetails(CrmSalesReportBo bo, HttpServletResponse response) {
|
||||
List<CrmSalesReportVo.OrderDetail> list = iCrmSalesReportService.queryOrderDetailList(bo);
|
||||
ExcelUtil.exportExcel(list, "销售报表订单明细", CrmSalesReportVo.OrderDetail.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出销售员统计数据
|
||||
*/
|
||||
@Log(title = "销售报表", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/exportSalesmanStats")
|
||||
public void exportSalesmanStats(CrmSalesReportBo bo, HttpServletResponse response) {
|
||||
List<CrmSalesReportVo.SalesmanStat> list = iCrmSalesReportService.querySalesmanStats(bo);
|
||||
ExcelUtil.exportExcel(list, "销售员统计", CrmSalesReportVo.SalesmanStat.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出客户等级统计数据
|
||||
*/
|
||||
@Log(title = "销售报表", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/exportCustomerLevelStats")
|
||||
public void exportCustomerLevelStats(CrmSalesReportBo bo, HttpServletResponse response) {
|
||||
List<CrmSalesReportVo.CustomerLevelStat> list = iCrmSalesReportService.queryCustomerLevelStats(bo);
|
||||
ExcelUtil.exportExcel(list, "客户等级统计", CrmSalesReportVo.CustomerLevelStat.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出行业统计数据
|
||||
*/
|
||||
@Log(title = "销售报表", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/exportIndustryStats")
|
||||
public void exportIndustryStats(CrmSalesReportBo bo, HttpServletResponse response) {
|
||||
List<CrmSalesReportVo.IndustryStat> list = iCrmSalesReportService.queryIndustryStats(bo);
|
||||
ExcelUtil.exportExcel(list, "行业统计", CrmSalesReportVo.IndustryStat.class, response);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user