feat(crm): 添加销售报表功能模块
- 新增销售报表查询业务对象CrmSalesReportBo,支持多种查询条件 - 创建销售报表控制器CrmSalesReportController,提供汇总数据、订单明细、统计分析等接口 - 实现销售报表数据访问层CrmSalesReportMapper,包含销售汇总、订单明细、销售员统计等查询 - 开发销售报表服务层ICrmSalesReportService及其实现类,处理报表数据逻辑 - 设计销售报表视图对象CrmSalesReportVo,包含汇总信息、订单明细、统计分析等数据结构 - 集成Excel导出功能,支持订单明细、销售员统计、客户等级统计、行业统计的数据导出 - 实现多维度统计分析,包括销售员业绩、客户等级分布、行业分布等统计功能
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
package com.klp.crm.service;
|
||||
|
||||
import com.klp.crm.domain.vo.CrmSalesReportVo;
|
||||
import com.klp.crm.domain.bo.CrmSalesReportBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 销售报表Service接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2025-12-29
|
||||
*/
|
||||
public interface ICrmSalesReportService {
|
||||
|
||||
/**
|
||||
* 查询销售报表汇总数据
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 销售报表汇总数据
|
||||
*/
|
||||
CrmSalesReportVo.SalesSummary querySalesSummary(CrmSalesReportBo bo);
|
||||
|
||||
/**
|
||||
* 分页查询销售报表订单明细
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 订单明细分页数据
|
||||
*/
|
||||
TableDataInfo<CrmSalesReportVo.OrderDetail> queryOrderDetailPageList(CrmSalesReportBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询销售报表订单明细列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 订单明细列表
|
||||
*/
|
||||
List<CrmSalesReportVo.OrderDetail> queryOrderDetailList(CrmSalesReportBo bo);
|
||||
|
||||
/**
|
||||
* 查询完整销售报表数据
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 完整销售报表数据
|
||||
*/
|
||||
CrmSalesReportVo queryFullSalesReport(CrmSalesReportBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询销售员统计数据
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 销售员统计列表
|
||||
*/
|
||||
List<CrmSalesReportVo.SalesmanStat> querySalesmanStats(CrmSalesReportBo bo);
|
||||
|
||||
/**
|
||||
* 查询客户等级统计数据
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 客户等级统计列表
|
||||
*/
|
||||
List<CrmSalesReportVo.CustomerLevelStat> queryCustomerLevelStats(CrmSalesReportBo bo);
|
||||
|
||||
/**
|
||||
* 查询行业统计数据
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 行业统计列表
|
||||
*/
|
||||
List<CrmSalesReportVo.IndustryStat> queryIndustryStats(CrmSalesReportBo bo);
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.klp.crm.service.impl;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import com.klp.crm.domain.vo.CrmSalesReportVo;
|
||||
import com.klp.crm.domain.bo.CrmSalesReportBo;
|
||||
import com.klp.crm.mapper.CrmSalesReportMapper;
|
||||
import com.klp.crm.service.ICrmSalesReportService;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 销售报表Service业务层处理
|
||||
*
|
||||
* @author klp
|
||||
* @date 2025-12-29
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class CrmSalesReportServiceImpl implements ICrmSalesReportService {
|
||||
|
||||
private final CrmSalesReportMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询销售报表汇总数据
|
||||
*/
|
||||
@Override
|
||||
public CrmSalesReportVo.SalesSummary querySalesSummary(CrmSalesReportBo bo) {
|
||||
CrmSalesReportVo.SalesSummary summary = baseMapper.selectSalesSummary(bo);
|
||||
if (summary != null) {
|
||||
// 查询销售员统计
|
||||
summary.setSalesmanStats(baseMapper.selectSalesmanStats(bo));
|
||||
// 查询客户等级统计
|
||||
summary.setCustomerLevelStats(baseMapper.selectCustomerLevelStats(bo));
|
||||
// 查询行业统计
|
||||
summary.setIndustryStats(baseMapper.selectIndustryStats(bo));
|
||||
}
|
||||
return summary;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询销售报表订单明细
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<CrmSalesReportVo.OrderDetail> queryOrderDetailPageList(CrmSalesReportBo bo, PageQuery pageQuery) {
|
||||
PageHelper.startPage(pageQuery.getPageNum(), pageQuery.getPageSize());
|
||||
List<CrmSalesReportVo.OrderDetail> list = baseMapper.selectOrderDetailList(bo);
|
||||
return TableDataInfo.build(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询销售报表订单明细列表
|
||||
*/
|
||||
@Override
|
||||
public List<CrmSalesReportVo.OrderDetail> queryOrderDetailList(CrmSalesReportBo bo) {
|
||||
return baseMapper.selectOrderDetailList(bo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询完整销售报表数据
|
||||
*/
|
||||
@Override
|
||||
public CrmSalesReportVo queryFullSalesReport(CrmSalesReportBo bo, PageQuery pageQuery) {
|
||||
CrmSalesReportVo reportVo = new CrmSalesReportVo();
|
||||
|
||||
// 查询汇总数据
|
||||
reportVo.setSalesSummary(querySalesSummary(bo));
|
||||
|
||||
// 查询订单明细(分页)
|
||||
TableDataInfo<CrmSalesReportVo.OrderDetail> orderDetailPage = queryOrderDetailPageList(bo, pageQuery);
|
||||
reportVo.setOrderDetails(orderDetailPage.getRows());
|
||||
|
||||
return reportVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询销售员统计数据
|
||||
*/
|
||||
@Override
|
||||
public List<CrmSalesReportVo.SalesmanStat> querySalesmanStats(CrmSalesReportBo bo) {
|
||||
return baseMapper.selectSalesmanStats(bo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询客户等级统计数据
|
||||
*/
|
||||
@Override
|
||||
public List<CrmSalesReportVo.CustomerLevelStat> queryCustomerLevelStats(CrmSalesReportBo bo) {
|
||||
return baseMapper.selectCustomerLevelStats(bo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询行业统计数据
|
||||
*/
|
||||
@Override
|
||||
public List<CrmSalesReportVo.IndustryStat> queryIndustryStats(CrmSalesReportBo bo) {
|
||||
return baseMapper.selectIndustryStats(bo);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user