This commit is contained in:
2025-07-01 17:54:58 +08:00
commit 57dcd609e2
5136 changed files with 346184 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.zhwl</groupId>
<artifactId>zhwl-travel-agency</artifactId>
<version>3.8.7</version>
</parent>
<description>旅行社报表模块</description>
<artifactId>zhwl-travel-agency-report</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.zhwl</groupId>
<artifactId>zhwl-travel-agency-ticket-order</artifactId>
</dependency>
<dependency>
<groupId>com.zhwl</groupId>
<artifactId>zhwl-cms</artifactId>
</dependency>
<dependency>
<groupId>com.github.duanyashu</groupId>
<artifactId>chartscp</artifactId>
<version>1.1.3</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,103 @@
package com.zhwl.travelagency.report.controller;
import com.github.pagehelper.PageInfo;
import com.zhwl.common.constant.HttpStatus;
import com.zhwl.common.core.controller.BaseController;
import com.zhwl.common.core.domain.AjaxResult;
import com.zhwl.common.core.page.TableDataInfo;
import com.zhwl.travelagency.account.domain.vo.ZdyTravelAgencyAccountBalanceChangesVO;
import com.zhwl.travelagency.order.dto.ZdyTravelAgencyOrderSalesRecordDTO;
import com.zhwl.travelagency.order.service.IZdyTravelAgencyOrderSalesRecordService;
import com.zhwl.travelagency.order.vo.ZdyTravelAgencyOrderSalesRecordVO;
import com.zhwl.travelagency.report.dto.GuideSaleSummaryDTO;
import com.zhwl.travelagency.report.service.ITravelAgencyReportService;
import com.zhwl.travelagency.report.vo.GuideSaleSummaryVO;
import com.zhwl.travelagency.report.vo.HomePageStatisticsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
* @Title: TravelAgencyReportController
* @Author wangtao
* @Date 2024/6/28 10:50
* @description: 旅行社报表统计模块
*/
@RestController
@RequestMapping("/travelagency/report")
public class TravelAgencyReportController extends BaseController {
@Autowired
private ITravelAgencyReportService travelAgencyReportService;
@Autowired
private IZdyTravelAgencyOrderSalesRecordService zdyTravelAgencyOrderSalesRecordService;
/**
* 查询导游销售汇总记录
*
* @return
*/
@PreAuthorize("@ss.hasPermi('travelagency:report:guide:sale:summary:list')")
@PostMapping("/query/guide/sale/summary")
public TableDataInfo queryGuideSaleSummary(@RequestBody GuideSaleSummaryDTO guideSaleSummaryDTO) {
List<GuideSaleSummaryVO> list = travelAgencyReportService.queryGuideSaleSummary(guideSaleSummaryDTO);
return getDataTable(list);
}
/**
* 查询余额交易记录
*
* @return
*/
@PreAuthorize("@ss.hasPermi('travelagency:report:balance:transaction:list')")
@GetMapping("/query/balance/transaction/record")
public TableDataInfo queryBalanceTransactionRecord() {
List<ZdyTravelAgencyAccountBalanceChangesVO> list = travelAgencyReportService.queryBalanceTransactionRecord();
return getDataTable(list);
}
/**
* 查询销售汇总记录
*
* @return
*/
@PreAuthorize("@ss.hasPermi('travelagency:report:sale:summary:list')")
@PostMapping("/query/sale/summary")
public TableDataInfo querySaleSummary(@RequestBody ZdyTravelAgencyOrderSalesRecordDTO zdyTravelAgencyOrderSalesRecordDTO) {
//分页数据
List<ZdyTravelAgencyOrderSalesRecordVO> orderSalesRecordVOS = travelAgencyReportService.querySaleSummary(zdyTravelAgencyOrderSalesRecordDTO);
//合计
ZdyTravelAgencyOrderSalesRecordVO summaryVo = zdyTravelAgencyOrderSalesRecordService.summary(zdyTravelAgencyOrderSalesRecordDTO);
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(orderSalesRecordVOS);
rspData.setTotal(new PageInfo(orderSalesRecordVOS).getTotal());
if (Objects.isNull(summaryVo)) {
rspData.setData(Collections.emptyList());
} else {
rspData.setData(Collections.singletonList(summaryVo));
}
return rspData;
}
/**
* 旅行社首页统计
*
* @return
*/
@PreAuthorize("@ss.hasPermi('travelagency:report:home:page:statistics')")
@GetMapping("/home/page/statistics")
public AjaxResult homePageStatistics() {
HomePageStatisticsVO homePageStatisticsVO = travelAgencyReportService.homePageStatistics();
return success(homePageStatisticsVO);
}
}

View File

@@ -0,0 +1,92 @@
package com.zhwl.travelagency.report.dto;
import com.zhwl.common.core.domain.BaseEntity;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* @Title: GuideSaleSummaryDTO
* @Author wangtao
* @Date 2024/6/28 10:54
* @description:
*/
public class GuideSaleSummaryDTO extends BaseEntity {
private static final long serialVersionUID = 7851078152786319920L;
/**
* 旅行社id
*/
private Long travelAgencyId;
/**
* 导游姓名
*/
private String guideName;
/**
* 旅行社姓名
*/
private String travelAgencyName;
/**
* 门票名称
*/
private String ticketName;
/**
* 客源地
*/
private String customerSourceArea;
/**
* 手机号
*/
private String phone;
public Long getTravelAgencyId() {
return travelAgencyId;
}
public void setTravelAgencyId(Long travelAgencyId) {
this.travelAgencyId = travelAgencyId;
}
public String getGuideName() {
return guideName;
}
public void setGuideName(String guideName) {
this.guideName = guideName;
}
public String getTravelAgencyName() {
return travelAgencyName;
}
public void setTravelAgencyName(String travelAgencyName) {
this.travelAgencyName = travelAgencyName;
}
public String getTicketName() {
return ticketName;
}
public void setTicketName(String ticketName) {
this.ticketName = ticketName;
}
public String getCustomerSourceArea() {
return customerSourceArea;
}
public void setCustomerSourceArea(String customerSourceArea) {
this.customerSourceArea = customerSourceArea;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
}

View File

@@ -0,0 +1,45 @@
package com.zhwl.travelagency.report.mapper;
import com.github.duanyashu.chartscp.ChartscpResultMap;
import com.zhwl.common.annotation.DataScope;
import com.zhwl.travelagency.report.dto.GuideSaleSummaryDTO;
import com.zhwl.travelagency.report.vo.*;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Title: TravelAgencyReportMapper
* @Author wangtao
* @Date 2024/6/28 11:40
* @description:
*/
public interface TravelAgencyReportMapper {
/**
* 查询导游销售订单汇总
*
* @param guideSaleSummaryDTO
* @return
*/
@DataScope(deptAlias = "c")
List<GuideSaleSummaryVO> queryGuideSaleSummary(GuideSaleSummaryDTO guideSaleSummaryDTO);
/**
* 累计带团人数
*
* @param tourIds 导游id集合
*/
Integer countAccumulatedTeamLeadersNumber(@Param("travelAgencyId") Long travelAgencyId);
TravelAgencyDataStatisticsVo selectOverViewToday(@Param("travelAgencyId") Long travelAgencyId);
List<ChartscpResultMap> tourGuideAndGroupStatisticsLastWeek(@Param("travelAgencyId") Long travelAgencyId);
List<ChartscpResultMap> tourGuideAndGroupStatisticsLastMonth(@Param("travelAgencyId") Long travelAgencyId);
List<OrderStatisticsVO> orderStatistics(@Param("travelAgencyId") Long travelAgencyId);
List<CustomerSourcesVo> customerSourcesRank(@Param("travelAgencyId") Long travelAgencyId);
}

View File

@@ -0,0 +1,32 @@
package com.zhwl.travelagency.report.service;
import com.zhwl.travelagency.account.domain.vo.ZdyTravelAgencyAccountBalanceChangesVO;
import com.zhwl.travelagency.order.dto.ZdyTravelAgencyOrderSalesRecordDTO;
import com.zhwl.travelagency.order.vo.ZdyTravelAgencyOrderSalesRecordVO;
import com.zhwl.travelagency.report.dto.GuideSaleSummaryDTO;
import com.zhwl.travelagency.report.vo.GuideSaleSummaryVO;
import com.zhwl.travelagency.report.vo.HomePageStatisticsVO;
import java.util.List;
/**
* @Title: TravelAgencyReportService
* @Author wangtao
* @Date 2024/6/28 10:51
* @description:
*/
public interface ITravelAgencyReportService {
/**
* 查询导游销售汇总记录
*
* @param guideSaleSummaryDTO
* @return
*/
List<GuideSaleSummaryVO> queryGuideSaleSummary(GuideSaleSummaryDTO guideSaleSummaryDTO);
List<ZdyTravelAgencyAccountBalanceChangesVO> queryBalanceTransactionRecord();
List<ZdyTravelAgencyOrderSalesRecordVO> querySaleSummary(ZdyTravelAgencyOrderSalesRecordDTO zdyTravelAgencyOrderSalesRecordDTO);
HomePageStatisticsVO homePageStatistics();
}

View File

@@ -0,0 +1,219 @@
package com.zhwl.travelagency.report.service.impl;
import com.github.duanyashu.chartscp.ChartscpResultMap;
import com.zhwl.cms.domain.ZdyArea;
import com.zhwl.cms.mapper.ZdyAreaMapper;
import com.zhwl.common.core.domain.BaseEntity;
import com.zhwl.common.utils.PageUtils;
import com.zhwl.common.utils.StringUtils;
import com.zhwl.travelagency.account.domain.ZdyTravelAgencyInfo;
import com.zhwl.travelagency.account.domain.vo.ZdyTravelAgencyAccountBalanceChangesVO;
import com.zhwl.travelagency.account.service.ITravelAgencyCommonService;
import com.zhwl.travelagency.account.service.IZdyTravelAgencyAccountBalanceChangesService;
import com.zhwl.travelagency.account.service.IZdyTravelAgencyInfoService;
import com.zhwl.travelagency.guide.domain.ZdyTravelAgencyGuide;
import com.zhwl.travelagency.guide.service.IZdyTravelAgencyGuideService;
import com.zhwl.travelagency.order.dto.ZdyTravelAgencyOrderSalesRecordDTO;
import com.zhwl.travelagency.order.service.IZdyTravelAgencyOrderSalesRecordService;
import com.zhwl.travelagency.order.vo.ZdyTravelAgencyOrderSalesRecordVO;
import com.zhwl.travelagency.report.dto.GuideSaleSummaryDTO;
import com.zhwl.travelagency.report.mapper.TravelAgencyReportMapper;
import com.zhwl.travelagency.report.service.ITravelAgencyReportService;
import com.zhwl.travelagency.report.vo.*;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Title: TravelAgencyReportServiceImpl
* @Author wangtao
* @Date 2024/6/28 10:51
* @description: 旅行社报表服务
*/
@Service
public class TravelAgencyReportServiceImpl implements ITravelAgencyReportService {
@Autowired
private TravelAgencyReportMapper travelAgencyReportMapper;
@Autowired
private ITravelAgencyCommonService travelAgencyCommonService;
@Autowired
private IZdyTravelAgencyAccountBalanceChangesService zdyTravelAgencyAccountBalanceChangesService;
@Autowired
private ZdyAreaMapper zdyAreaMapper;
@Autowired
private IZdyTravelAgencyInfoService zdyTravelAgencyInfoService;
@Autowired
private IZdyTravelAgencyGuideService zdyTravelAgencyGuideService;
@Autowired
private IZdyTravelAgencyOrderSalesRecordService zdyTravelAgencyOrderSalesRecordService;
/**
* 查询导游销售汇总记录
* 添加数据权限
*
* @param guideSaleSummaryDTO
* @return
*/
@Override
public List<GuideSaleSummaryVO> queryGuideSaleSummary(GuideSaleSummaryDTO guideSaleSummaryDTO) {
PageUtils.startPage();
List<GuideSaleSummaryVO> list = travelAgencyReportMapper.queryGuideSaleSummary(guideSaleSummaryDTO);
for (GuideSaleSummaryVO summaryVO : list) {
String areaCode = summaryVO.getCustomerSourceArea();
if (StringUtils.isNotBlank(areaCode)) {
ZdyArea zdyArea = zdyAreaMapper.selectZdyAreaByAreaCode(Long.parseLong(areaCode));
summaryVO.setCustomerSourceAreaName(zdyArea.getName());
}
}
return list;
}
@Override
public List<ZdyTravelAgencyAccountBalanceChangesVO> queryBalanceTransactionRecord() {
PageUtils.startPage();
return zdyTravelAgencyAccountBalanceChangesService.selectZdyTravelAgencyAccountBalanceChanges(new BaseEntity());
}
/**
* 查询旅行社汇总订单
*
* @param zdyTravelAgencyOrderSalesRecordDTO
* @return
*/
@Override
public List<ZdyTravelAgencyOrderSalesRecordVO> querySaleSummary(ZdyTravelAgencyOrderSalesRecordDTO zdyTravelAgencyOrderSalesRecordDTO) {
PageUtils.startPage();
List<ZdyTravelAgencyOrderSalesRecordVO> records = zdyTravelAgencyOrderSalesRecordService.selectZdyTravelAgencyOrderSalesRecordListReport(zdyTravelAgencyOrderSalesRecordDTO);
if (CollectionUtils.isEmpty(records)) {
return Collections.emptyList();
}
//统一计算实收金额
for (ZdyTravelAgencyOrderSalesRecordVO record : records) {
BigDecimal salesOrderPrice1 = Objects.isNull(record.getSalesOrderPrice()) ? BigDecimal.ZERO : record.getSalesOrderPrice();
BigDecimal refundOrderPrice1 = Objects.isNull(record.getRefundOrderPrice()) ? BigDecimal.ZERO : record.getRefundOrderPrice();
record.setActualOrderPrice(salesOrderPrice1.subtract(refundOrderPrice1));
}
return records;
}
/**
* 查询首页统计
*
* @return
*/
@Override
public HomePageStatisticsVO homePageStatistics() {
Long travelAgencyId = travelAgencyCommonService.getTravelAgencyId();
HomePageStatisticsVO homePageStatisticsVO = new HomePageStatisticsVO();
TravelAgencyInfoVo travelAgencyInfoVo = new TravelAgencyInfoVo();
//查询旅行社基本信息
ZdyTravelAgencyInfo zdyTravelAgencyInfo = zdyTravelAgencyInfoService.selectZdyTravelAgencyInfoById(travelAgencyId);
travelAgencyInfoVo.setId(zdyTravelAgencyInfo.getId());
travelAgencyInfoVo.setName(zdyTravelAgencyInfo.getName());
travelAgencyInfoVo.setBalance(zdyTravelAgencyInfo.getBalance());
//查询当前旅行社下面的导游
List<ZdyTravelAgencyGuide> zdyTravelAgencyGuides = zdyTravelAgencyGuideService.selectZdyTravelAgencyGuideListByTravelAgencyId(travelAgencyId);
//设置导游数量
travelAgencyInfoVo.setTourGuidesNumber(zdyTravelAgencyGuides.size());
//查询累计带团人数
Integer accumulatedTeamLeadersNumber = travelAgencyReportMapper.countAccumulatedTeamLeadersNumber(travelAgencyId);
travelAgencyInfoVo.setAccumulatedTeamLeadersNumber(accumulatedTeamLeadersNumber);
//查询今日订单和今日销售金额以及今天带团人数
TravelAgencyDataStatisticsVo travelAgencyDataStatisticsVo = travelAgencyReportMapper.selectOverViewToday(travelAgencyId);
//查询近一周/近一个月导游带团统计
homePageStatisticsVO.setTourGuideAndGroupStatisticsLastWeek(tourGuideAndGroupStatisticsLastWeek(travelAgencyId));
homePageStatisticsVO.setTourGuideAndGroupStatisticsLastMonth(tourGuideAndGroupStatisticsLastMonth(travelAgencyId));
//查询销售订单
Map<String, ECharsVo> orderedStatistics = orderStatistics(travelAgencyId);
homePageStatisticsVO.setOrderPriceStatistics(orderedStatistics.get("orderCountStatistics"));
homePageStatisticsVO.setOrderPriceStatistics(orderedStatistics.get("orderPriceStatistics"));
//客源地排行
homePageStatisticsVO.setCustomerSourcesRank(customerSourcesRank(travelAgencyId));
homePageStatisticsVO.setTravelAgencyDataStatisticsVo(travelAgencyDataStatisticsVo);
homePageStatisticsVO.setTravelAgencyInfo(travelAgencyInfoVo);
return homePageStatisticsVO;
}
/**
* 导游带团统计
* 近一周
*
* @return
*/
private ECharsVo tourGuideAndGroupStatisticsLastWeek(Long travelAgencyId) {
return convert(travelAgencyReportMapper.tourGuideAndGroupStatisticsLastWeek(travelAgencyId));
}
/**
* 导游带团统计
* 近一月
*
* @return
*/
private ECharsVo tourGuideAndGroupStatisticsLastMonth(Long travelAgencyId) {
return convert(travelAgencyReportMapper.tourGuideAndGroupStatisticsLastMonth(travelAgencyId));
}
/**
* 订单销量排行
* 近一周
*
* @return
*/
private Map<String, ECharsVo> orderStatistics(Long travelAgencyId) {
Map<String, ECharsVo> map = new HashMap<>();
List<OrderStatisticsVO> orderStatisticsVOS = travelAgencyReportMapper.orderStatistics(travelAgencyId);
ECharsVo orderCountStatistics = new ECharsVo();
ECharsVo orderPriceStatistics = new ECharsVo();
List<Object> dates = orderStatisticsVOS.stream().map(OrderStatisticsVO::getStatisticsDate).collect(Collectors.toList());
orderCountStatistics.setxCells(dates);
orderPriceStatistics.setxCells(dates);
orderCountStatistics.setDatas(orderStatisticsVOS.stream().map(OrderStatisticsVO::getOrderNumber).collect(Collectors.toList()));
orderPriceStatistics.setDatas(orderStatisticsVOS.stream().map(OrderStatisticsVO::getOrderSalesPrice).collect(Collectors.toList()));
map.put("orderCountStatistics", orderCountStatistics);
map.put("orderPriceStatistics", orderPriceStatistics);
return map;
}
/**
* 客源地排行
*
* @return
*/
private List<CustomerSourcesVo> customerSourcesRank(Long travelAgencyId) {
return travelAgencyReportMapper.customerSourcesRank(travelAgencyId);
}
private ECharsVo convert(List<ChartscpResultMap> resultMaps) {
ECharsVo eCharsVo = new ECharsVo();
eCharsVo.setxCells(resultMaps.stream().map(ChartscpResultMap::getXcell).collect(Collectors.toList()));
eCharsVo.setDatas(resultMaps.stream().map(ChartscpResultMap::getData).collect(Collectors.toList()));
return eCharsVo;
}
}

View File

@@ -0,0 +1,39 @@
package com.zhwl.travelagency.report.vo;
import java.io.Serializable;
/**
* @Title: CustomerSourcesVo
* @Author wangtao
* @Date 2024/7/3 17:25
* @description: 客源地
*/
public class CustomerSourcesVo implements Serializable {
private static final long serialVersionUID = 5173140337769370279L;
/**
* 客源地名称
*/
private String customerSourcesName;
/**
* 频次
*/
private Integer frequency;
public String getCustomerSourcesName() {
return customerSourcesName;
}
public void setCustomerSourcesName(String customerSourcesName) {
this.customerSourcesName = customerSourcesName;
}
public Integer getFrequency() {
return frequency;
}
public void setFrequency(Integer frequency) {
this.frequency = frequency;
}
}

View File

@@ -0,0 +1,34 @@
package com.zhwl.travelagency.report.vo;
import java.io.Serializable;
import java.util.List;
/**
* @Title: EcharsVo
* @Author wangtao
* @Date 2024/7/3 15:04
* @description:
*/
public class ECharsVo implements Serializable {
private static final long serialVersionUID = 7182334868264545978L;
private List<Object> xCells;
private List<Object> datas;
public List<Object> getxCells() {
return xCells;
}
public void setxCells(List<Object> xCells) {
this.xCells = xCells;
}
public List<Object> getDatas() {
return datas;
}
public void setDatas(List<Object> datas) {
this.datas = datas;
}
}

View File

@@ -0,0 +1,127 @@
package com.zhwl.travelagency.report.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serializable;
import java.util.Date;
/**
* @Title: GuideSaleSummaryVO
* @Author wangtao
* @Date 2024/6/28 11:38
* @description:
*/
public class GuideSaleSummaryVO implements Serializable {
private static final long serialVersionUID = -3822143824456403963L;
/**
* 主订单id
*/
private Long orderId;
/**
* 导游姓名
*/
private String guideName;
/**
* 旅行社姓名
*/
private String travelAgencyName;
/**
* 门票名称
*/
private String ticketName;
/**
* 带团时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date leadingGroupTime;
/**
* 带团人数
*/
private Integer leadingGroupPersons;
/**
* 客源地code
*/
private String customerSourceArea;
/**
* 客源地名称
*/
private String customerSourceAreaName;
/**
* phone
*/
private String phone;
public Long getOrderId() {
return orderId;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
public String getGuideName() {
return guideName;
}
public void setGuideName(String guideName) {
this.guideName = guideName;
}
public String getTravelAgencyName() {
return travelAgencyName;
}
public void setTravelAgencyName(String travelAgencyName) {
this.travelAgencyName = travelAgencyName;
}
public String getTicketName() {
return ticketName;
}
public void setTicketName(String ticketName) {
this.ticketName = ticketName;
}
public Date getLeadingGroupTime() {
return leadingGroupTime;
}
public void setLeadingGroupTime(Date leadingGroupTime) {
this.leadingGroupTime = leadingGroupTime;
}
public Integer getLeadingGroupPersons() {
return leadingGroupPersons;
}
public void setLeadingGroupPersons(Integer leadingGroupPersons) {
this.leadingGroupPersons = leadingGroupPersons;
}
public String getCustomerSourceArea() {
return customerSourceArea;
}
public void setCustomerSourceArea(String customerSourceArea) {
this.customerSourceArea = customerSourceArea;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getCustomerSourceAreaName() {
return customerSourceAreaName;
}
public void setCustomerSourceAreaName(String customerSourceAreaName) {
this.customerSourceAreaName = customerSourceAreaName;
}
}

View File

@@ -0,0 +1,109 @@
package com.zhwl.travelagency.report.vo;
import java.io.Serializable;
import java.util.List;
/**
* @Title: HomePageStatisticsVO
* @Author wangtao
* @Date 2024/7/2 18:02
* @description: 首页统计
*/
public class HomePageStatisticsVO implements Serializable {
private static final long serialVersionUID = 1734652573403022841L;
/**
* 旅行社信息
*/
private TravelAgencyInfoVo travelAgencyInfo;
/**
* 旅行社数据统计
*/
private TravelAgencyDataStatisticsVo travelAgencyDataStatisticsVo;
/**
* 导游带团统计 近一周
*/
private ECharsVo tourGuideAndGroupStatisticsLastWeek;
/**
* 导游带团统计 近一个月
*/
private ECharsVo tourGuideAndGroupStatisticsLastMonth;
/**
* 客源地排行
*/
private List<CustomerSourcesVo> customerSourcesRank;
/**
* 订单销量
*/
private ECharsVo orderCountStatistics;
/**
* 订单销售额
*/
private ECharsVo orderPriceStatistics;
public TravelAgencyInfoVo getTravelAgencyInfo() {
return travelAgencyInfo;
}
public void setTravelAgencyInfo(TravelAgencyInfoVo travelAgencyInfo) {
this.travelAgencyInfo = travelAgencyInfo;
}
public TravelAgencyDataStatisticsVo getTravelAgencyDataStatisticsVo() {
return travelAgencyDataStatisticsVo;
}
public void setTravelAgencyDataStatisticsVo(TravelAgencyDataStatisticsVo travelAgencyDataStatisticsVo) {
this.travelAgencyDataStatisticsVo = travelAgencyDataStatisticsVo;
}
public ECharsVo getTourGuideAndGroupStatisticsLastWeek() {
return tourGuideAndGroupStatisticsLastWeek;
}
public void setTourGuideAndGroupStatisticsLastWeek(ECharsVo tourGuideAndGroupStatisticsLastWeek) {
this.tourGuideAndGroupStatisticsLastWeek = tourGuideAndGroupStatisticsLastWeek;
}
public ECharsVo getTourGuideAndGroupStatisticsLastMonth() {
return tourGuideAndGroupStatisticsLastMonth;
}
public void setTourGuideAndGroupStatisticsLastMonth(ECharsVo tourGuideAndGroupStatisticsLastMonth) {
this.tourGuideAndGroupStatisticsLastMonth = tourGuideAndGroupStatisticsLastMonth;
}
public List<CustomerSourcesVo> getCustomerSourcesRank() {
return customerSourcesRank;
}
public void setCustomerSourcesRank(List<CustomerSourcesVo> customerSourcesRank) {
this.customerSourcesRank = customerSourcesRank;
}
public ECharsVo getOrderPriceStatistics() {
return orderPriceStatistics;
}
public void setOrderPriceStatistics(ECharsVo orderPriceStatistics) {
this.orderPriceStatistics = orderPriceStatistics;
}
public ECharsVo getOrderCountStatistics() {
return orderCountStatistics;
}
public void setOrderCountStatistics(ECharsVo orderCountStatistics) {
this.orderCountStatistics = orderCountStatistics;
}
}

View File

@@ -0,0 +1,54 @@
package com.zhwl.travelagency.report.vo;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Title: OrderStatisticsVO
* @Author wangtao
* @Date 2024/7/3 15:23
* @description:
*/
public class OrderStatisticsVO implements Serializable {
private static final long serialVersionUID = -8069294041526140313L;
/**
* 统计日期
*/
private String statisticsDate;
/**
* 订单销量
*/
private Integer orderNumber;
/**
* 订单销售额
*/
private BigDecimal orderSalesPrice;
public String getStatisticsDate() {
return statisticsDate;
}
public void setStatisticsDate(String statisticsDate) {
this.statisticsDate = statisticsDate;
}
public Integer getOrderNumber() {
return orderNumber;
}
public void setOrderNumber(Integer orderNumber) {
this.orderNumber = orderNumber;
}
public BigDecimal getOrderSalesPrice() {
return orderSalesPrice;
}
public void setOrderSalesPrice(BigDecimal orderSalesPrice) {
this.orderSalesPrice = orderSalesPrice;
}
}

View File

@@ -0,0 +1,54 @@
package com.zhwl.travelagency.report.vo;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Title: TravelAgencyInfoVo
* @Author wangtao
* @Date 2024/7/3 10:10
* @description:
*/
public class TravelAgencyDataStatisticsVo implements Serializable {
private static final long serialVersionUID = -8309544414444621563L;
/**
* 今日订单数
*/
private Integer todayOrderNumber;
/**
* 今日销售额
*/
private BigDecimal todaySalesPrice;
/**
* 今日带团人数
*/
private Integer todayTeamLeadersNumber;
public Integer getTodayOrderNumber() {
return todayOrderNumber;
}
public void setTodayOrderNumber(Integer todayOrderNumber) {
this.todayOrderNumber = todayOrderNumber;
}
public BigDecimal getTodaySalesPrice() {
return todaySalesPrice;
}
public void setTodaySalesPrice(BigDecimal todaySalesPrice) {
this.todaySalesPrice = todaySalesPrice;
}
public Integer getTodayTeamLeadersNumber() {
return todayTeamLeadersNumber;
}
public void setTodayTeamLeadersNumber(Integer todayTeamLeadersNumber) {
this.todayTeamLeadersNumber = todayTeamLeadersNumber;
}
}

View File

@@ -0,0 +1,79 @@
package com.zhwl.travelagency.report.vo;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Title: TravelAgencyInfoVo
* @Author wangtao
* @Date 2024/7/3 10:10
* @description:
*/
public class TravelAgencyInfoVo implements Serializable {
private static final long serialVersionUID = -8309544414444621563L;
/**
* id
*/
private Long id;
/**
* 旅行社名称
*/
private String name;
/**
* 旅行社余额
*/
private BigDecimal balance;
/**
* 导游人数
*/
private Integer tourGuidesNumber;
/**
* 累计带团人数
*/
private Integer accumulatedTeamLeadersNumber;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public BigDecimal getBalance() {
return balance;
}
public void setBalance(BigDecimal balance) {
this.balance = balance;
}
public Integer getTourGuidesNumber() {
return tourGuidesNumber;
}
public void setTourGuidesNumber(Integer tourGuidesNumber) {
this.tourGuidesNumber = tourGuidesNumber;
}
public Integer getAccumulatedTeamLeadersNumber() {
return accumulatedTeamLeadersNumber;
}
public void setAccumulatedTeamLeadersNumber(Integer accumulatedTeamLeadersNumber) {
this.accumulatedTeamLeadersNumber = accumulatedTeamLeadersNumber;
}
}

View File

@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhwl.travelagency.report.mapper.TravelAgencyReportMapper">
<resultMap type="com.zhwl.travelagency.report.vo.GuideSaleSummaryVO" id="GuideSaleSummaryVoResult">
<result property="orderId" column="order_id"/>
<result property="guideName" column="guide_name"/>
<result property="travelAgencyName" column="travel_agency_name"/>
<result property="ticketName" column="ticket_name"/>
<result property="leadingGroupTime" column="leading_group_time"/>
<result property="leadingGroupPersons" column="leading_group_persons"/>
<result property="customerSourceArea" column="customer_source_area"/>
<result property="phone" column="phone"/>
</resultMap>
<select id="queryGuideSaleSummary" parameterType="com.zhwl.travelagency.report.dto.GuideSaleSummaryDTO"
resultMap="GuideSaleSummaryVoResult">
select
a.id order_id,
b.name guide_name,
b.phone phone,
c.name travel_agency_name,
d.ticket_name ticket_name,
a.create_time leading_group_time,
a.tourist_source customer_source_area,
a.tours_num leading_group_persons
from zdy_ticket_order a
left join zdy_travel_agency_guide b on b.id = a.tour_id
left join zdy_travel_agency_info c on c.id = b.travel_agency_id
left join zdy_ticket_order_item d on d.order_id = a.id
<where>
and a.travel_agency_id is not null
<if test="travelAgencyId!=null">
and c.id = #{travelAgencyId}
</if>
<if test="guideName !=null and guideName !='' ">
and b.name like concat('%',#{guideName},'%')
</if>
<if test="travelAgencyName !=null and travelAgencyName !='' ">
and c.name like concat('%',#{travelAgencyName},'%')
</if>
<if test="ticketName !=null and ticketName !='' ">
and d.ticket_name like concat('%',#{ticketName},'%')
</if>
<if test="customerSourceArea !=null and customerSourceArea !='' ">
and a.tourist_source = #{customerSourceArea}
</if>
<if test="params.startLeadingGroupTime != null and params.startLeadingGroupTime != ''"><!-- 带团开始时间检索 -->
and date_format(a.create_time,'%y%m%d') &gt;= date_format(#{params.startLeadingGroupTime},'%y%m%d')
</if>
<if test="params.endLeadingGroupTime != null and params.endLeadingGroupTime != ''"><!-- 带团结束时间检索 -->
and date_format(a.create_time,'%y%m%d') &lt;= date_format(#{params.endLeadingGroupTime},'%y%m%d')
</if>
<if test="phone !=null and phone !='' ">
and b.phone like concat('%',#{phone},'%')
</if>
${params.dataScope}
</where>
order by a.create_time desc
</select>
<select id="countAccumulatedTeamLeadersNumber" parameterType="long" resultType="int">
select ifnull(sum(ifnull(tours_num, 0)),0)
from zdy_ticket_order
where del_flag = '0'
and payment_type = 200
and travel_agency_id = #{travelAgencyId}
</select>
<select id="selectOverViewToday" parameterType="long"
resultType="com.zhwl.travelagency.report.vo.TravelAgencyDataStatisticsVo">
select count(1) todayOrderNumber,
ifnull(sum(ifnull(total_price, 0)), 0) todaySalesPrice,
ifnull(sum(ifnull(tours_num, 0)), 0) todayTeamLeadersNumber
from zdy_ticket_order
WHERE del_flag = 0
and DATE (create_time) = CURDATE()
AND payment_type = 200
and travel_agency_id = #{travelAgencyId}
</select>
<select id="tourGuideAndGroupStatisticsLastWeek" resultType="com.github.duanyashu.chartscp.ChartscpResultMap">
select b.name xcell, a.data data
from (select tour_id,
sum(ifnull(tours_num, 0)) data
from zdy_ticket_order
WHERE payment_type = 200
AND del_flag = 0
and travel_agency_id = #{travelAgencyId}
and create_time >= CURDATE() - INTERVAL 7 DAY
GROUP BY tour_id) a
left join zdy_travel_agency_guide b
on a.tour_id = b.id where b.del_flag = '0'
</select>
<select id="tourGuideAndGroupStatisticsLastMonth" resultType="com.github.duanyashu.chartscp.ChartscpResultMap">
select b.name xcell, a.data data
from (select tour_id,
sum(ifnull(tours_num, 0)) data
from zdy_ticket_order
WHERE payment_type = 200
AND del_flag = 0
and travel_agency_id = #{travelAgencyId}
and create_time >= CURDATE() - INTERVAL 30 DAY
GROUP BY tour_id) a
left join zdy_travel_agency_guide b
on a.tour_id = b.id where b.del_flag = '0'
</select>
<select id="orderStatistics" parameterType="long" resultType="com.zhwl.travelagency.report.vo.OrderStatisticsVO">
select DATE_FORMAT(create_time, '%m-%d') statisticsDate, count(1) orderNumber, sum(ifnull(total_price, 0)) orderSalesPrice
from zdy_ticket_order
WHERE del_flag = 0
and create_time >= CURDATE() - INTERVAL 7 DAY
AND payment_type = 200
and travel_agency_id = #{travelAgencyId}
group by DATE_FORMAT(create_time, '%m-%d')
</select>
<select id="customerSourcesRank" parameterType="long"
resultType="com.zhwl.travelagency.report.vo.CustomerSourcesVo">
select b.name customerSourcesName, a.frequency
from (select tourist_source, sum(ifnull(tours_num, 0)) frequency
from zdy_ticket_order
WHERE del_flag = 0
AND payment_type = 200
and travel_agency_id = #{travelAgencyId}
group by tourist_source) a
left join zdy_area b on a.tourist_source = b.area_code
where a.tourist_source is not null
order by frequency desc limit 5
</select>
</mapper>

View File

@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhwl.travelagency.report.mapper.TravelAgencyReportMapper">
<resultMap type="com.zhwl.travelagency.report.vo.GuideSaleSummaryVO" id="GuideSaleSummaryVoResult">
<result property="orderId" column="order_id"/>
<result property="guideName" column="guide_name"/>
<result property="travelAgencyName" column="travel_agency_name"/>
<result property="ticketName" column="ticket_name"/>
<result property="leadingGroupTime" column="leading_group_time"/>
<result property="leadingGroupPersons" column="leading_group_persons"/>
<result property="customerSourceArea" column="customer_source_area"/>
<result property="phone" column="phone"/>
</resultMap>
<select id="queryGuideSaleSummary" parameterType="com.zhwl.travelagency.report.dto.GuideSaleSummaryDTO"
resultMap="GuideSaleSummaryVoResult">
select
a.id order_id,
b.name guide_name,
b.phone phone,
c.name travel_agency_name,
d.ticket_name ticket_name,
a.create_time leading_group_time,
a.tourist_source customer_source_area,
a.tours_num leading_group_persons
from zdy_ticket_order a
left join zdy_travel_agency_guide b on b.id = a.tour_id
left join zdy_travel_agency_info c on c.id = b.travel_agency_id
left join zdy_ticket_order_item d on d.order_id = a.id
<where>
and a.travel_agency_id is not null
<if test="travelAgencyId!=null">
and c.id = #{travelAgencyId}
</if>
<if test="guideName !=null and guideName !='' ">
and b.name like concat('%',#{guideName},'%')
</if>
<if test="travelAgencyName !=null and travelAgencyName !='' ">
and c.name like concat('%',#{travelAgencyName},'%')
</if>
<if test="ticketName !=null and ticketName !='' ">
and d.ticket_name like concat('%',#{ticketName},'%')
</if>
<if test="customerSourceArea !=null and customerSourceArea !='' ">
and a.tourist_source = #{customerSourceArea}
</if>
<if test="params.startLeadingGroupTime != null and params.startLeadingGroupTime != ''"><!-- 带团开始时间检索 -->
and date_format(a.create_time,'%y%m%d') &gt;= date_format(#{params.startLeadingGroupTime},'%y%m%d')
</if>
<if test="params.endLeadingGroupTime != null and params.endLeadingGroupTime != ''"><!-- 带团结束时间检索 -->
and date_format(a.create_time,'%y%m%d') &lt;= date_format(#{params.endLeadingGroupTime},'%y%m%d')
</if>
<if test="phone !=null and phone !='' ">
and b.phone like concat('%',#{phone},'%')
</if>
${params.dataScope}
</where>
order by a.create_time desc
</select>
<select id="countAccumulatedTeamLeadersNumber" parameterType="long" resultType="int">
select ifnull(sum(ifnull(tours_num, 0)),0)
from zdy_ticket_order
where del_flag = '0'
and payment_type = 200
and travel_agency_id = #{travelAgencyId}
</select>
<select id="selectOverViewToday" parameterType="long"
resultType="com.zhwl.travelagency.report.vo.TravelAgencyDataStatisticsVo">
select count(1) todayOrderNumber,
ifnull(sum(ifnull(total_price, 0)), 0) todaySalesPrice,
ifnull(sum(ifnull(tours_num, 0)), 0) todayTeamLeadersNumber
from zdy_ticket_order
WHERE del_flag = 0
and DATE (create_time) = CURDATE()
AND payment_type = 200
and travel_agency_id = #{travelAgencyId}
</select>
<select id="tourGuideAndGroupStatisticsLastWeek" resultType="com.github.duanyashu.chartscp.ChartscpResultMap">
select b.name xcell, a.data data
from (select tour_id,
sum(ifnull(tours_num, 0)) data
from zdy_ticket_order
WHERE payment_type = 200
AND del_flag = 0
and travel_agency_id = #{travelAgencyId}
and create_time >= CURDATE() - INTERVAL 7 DAY
GROUP BY tour_id) a
left join zdy_travel_agency_guide b
on a.tour_id = b.id where b.del_flag = '0'
</select>
<select id="tourGuideAndGroupStatisticsLastMonth" resultType="com.github.duanyashu.chartscp.ChartscpResultMap">
select b.name xcell, a.data data
from (select tour_id,
sum(ifnull(tours_num, 0)) data
from zdy_ticket_order
WHERE payment_type = 200
AND del_flag = 0
and travel_agency_id = #{travelAgencyId}
and create_time >= CURDATE() - INTERVAL 30 DAY
GROUP BY tour_id) a
left join zdy_travel_agency_guide b
on a.tour_id = b.id where b.del_flag = '0'
</select>
<select id="orderStatistics" parameterType="long" resultType="com.zhwl.travelagency.report.vo.OrderStatisticsVO">
select DATE_FORMAT(create_time, '%m-%d') statisticsDate, count(1) orderNumber, sum(ifnull(total_price, 0)) orderSalesPrice
from zdy_ticket_order
WHERE del_flag = 0
and create_time >= CURDATE() - INTERVAL 7 DAY
AND payment_type = 200
and travel_agency_id = #{travelAgencyId}
group by DATE_FORMAT(create_time, '%m-%d')
</select>
<select id="customerSourcesRank" parameterType="long"
resultType="com.zhwl.travelagency.report.vo.CustomerSourcesVo">
select b.name customerSourcesName, a.frequency
from (select tourist_source, sum(ifnull(tours_num, 0)) frequency
from zdy_ticket_order
WHERE del_flag = 0
AND payment_type = 200
and travel_agency_id = #{travelAgencyId}
group by tourist_source) a
left join zdy_area b on a.tourist_source = b.area_code
where a.tourist_source is not null
order by frequency desc limit 5
</select>
</mapper>