更新统计相关内容
This commit is contained in:
parent
6e095b7b50
commit
75f70259a9
@ -5,6 +5,7 @@ import cn.iocoder.yudao.module.base.service.RepairStatisticsService;
|
|||||||
import cn.iocoder.yudao.module.base.vo.QueryBusinessReqVO;
|
import cn.iocoder.yudao.module.base.vo.QueryBusinessReqVO;
|
||||||
import cn.iocoder.yudao.module.base.vo.QueryBusinessResp;
|
import cn.iocoder.yudao.module.base.vo.QueryBusinessResp;
|
||||||
import cn.iocoder.yudao.module.base.vo.QueryTableResp;
|
import cn.iocoder.yudao.module.base.vo.QueryTableResp;
|
||||||
|
import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@ -85,8 +86,8 @@ public class RepairStatisticsController {
|
|||||||
**/
|
**/
|
||||||
@GetMapping("/repairTypeStatistics")
|
@GetMapping("/repairTypeStatistics")
|
||||||
@Operation(summary = "维修类型相关统计分析饼图")
|
@Operation(summary = "维修类型相关统计分析饼图")
|
||||||
public CommonResult<?> repairTypeStatistics() {
|
public CommonResult<?> repairTypeStatistics(QueryBusinessReqVO reqVO) {
|
||||||
return CommonResult.success(statisticsService.repairTypeStatistics());
|
return CommonResult.success(statisticsService.repairTypeStatistics(reqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -190,8 +191,80 @@ public class RepairStatisticsController {
|
|||||||
* @param reqVO {@link QueryBusinessReqVO}
|
* @param reqVO {@link QueryBusinessReqVO}
|
||||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||||
**/
|
**/
|
||||||
|
@GetMapping("/businseeStatistics")
|
||||||
public CommonResult<?> businseeStatistics(QueryBusinessReqVO reqVO) {
|
public CommonResult<?> businseeStatistics(QueryBusinessReqVO reqVO) {
|
||||||
return CommonResult.success(statisticsService.businseeStatistics(reqVO));
|
return CommonResult.success(statisticsService.businseeStatistics(reqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description :维修项目统计
|
||||||
|
* @author xyc
|
||||||
|
* @date 09:53 2025/10/27
|
||||||
|
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||||
|
**/
|
||||||
|
@GetMapping("/repairProjectStatistics")
|
||||||
|
public CommonResult<?> repairProjectStatistics(QueryBusinessReqVO reqVO) {
|
||||||
|
return CommonResult.success(statisticsService.repairProjectStatistics(reqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : 保险和年审登记统计
|
||||||
|
* @author xyc
|
||||||
|
* @date 10:48 2025/10/28
|
||||||
|
* @param reqVO {@link QueryBusinessReqVO}
|
||||||
|
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||||
|
**/
|
||||||
|
@GetMapping("/insuranceAndAnnualRegistrationStatistics")
|
||||||
|
public CommonResult<?> insuranceAndAnnualRegistrationStatistics(QueryBusinessReqVO reqVO) {
|
||||||
|
return CommonResult.success(statisticsService.insuranceAndAnnualRegistrationStatistics(reqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : 保险或年审列表
|
||||||
|
* @author xyc
|
||||||
|
* @date 11:30 2025/10/28
|
||||||
|
* @param reqVO {@link QueryBusinessReqVO}
|
||||||
|
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||||
|
**/
|
||||||
|
@GetMapping("/insuranceOrAnnualListStatistics")
|
||||||
|
public CommonResult<?> insuranceOrAnnualListStatistics(QueryBusinessReqVO reqVO) {
|
||||||
|
return CommonResult.success(statisticsService.insuranceOrAnnualListStatistics(reqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : 保险公司统计
|
||||||
|
* @author xyc
|
||||||
|
* @date 13:51 2025/10/28
|
||||||
|
* @param reqVO {@link QueryBusinessReqVO}
|
||||||
|
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||||
|
**/
|
||||||
|
@GetMapping("/insuranceCompanyStatistics")
|
||||||
|
public CommonResult<?> insuranceCompanyStatistics(QueryBusinessReqVO reqVO) {
|
||||||
|
return CommonResult.success(statisticsService.insuranceCompanyStatistics(reqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : 车辆品牌统计
|
||||||
|
* @author xyc
|
||||||
|
* @date 14:08 2025/10/28
|
||||||
|
* @param reqVO {@link QueryBusinessReqVO}
|
||||||
|
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||||
|
**/
|
||||||
|
@GetMapping("/carBrandStatistics")
|
||||||
|
public CommonResult<?> carBrandStatistics(QueryBusinessReqVO reqVO) {
|
||||||
|
return CommonResult.success(statisticsService.carBrandStatistics(reqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : 车辆年份统计
|
||||||
|
* @author xyc
|
||||||
|
* @date 14:31 2025/10/28
|
||||||
|
* @param reqVO {@link QueryBusinessReqVO}
|
||||||
|
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||||
|
**/
|
||||||
|
@GetMapping("/carYearStatistics")
|
||||||
|
public CommonResult<?> carYearStatistics(QueryBusinessReqVO reqVO) {
|
||||||
|
return CommonResult.success(statisticsService.carYearStatistics(reqVO));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 维修数据统计
|
* 维修数据统计
|
||||||
@ -61,7 +62,7 @@ public interface RepairStatisticsMapper {
|
|||||||
* @author PQZ
|
* @author PQZ
|
||||||
* @date 14:52 2024/10/21
|
* @date 14:52 2024/10/21
|
||||||
**/
|
**/
|
||||||
List<RepairStatisticsVO> repairTypeStatistics();
|
List<RepairStatisticsVO> repairTypeStatistics(@Param("reqVO") QueryBusinessReqVO reqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工单总数、今日工单、工单总金额、今日工单金额
|
* 工单总数、今日工单、工单总金额、今日工单金额
|
||||||
@ -134,4 +135,48 @@ public interface RepairStatisticsMapper {
|
|||||||
* @return java.util.List<cn.iocoder.yudao.module.base.entity.StaffStatisticsResp>
|
* @return java.util.List<cn.iocoder.yudao.module.base.entity.StaffStatisticsResp>
|
||||||
**/
|
**/
|
||||||
List<StaffStatisticsResp> staffStatistics(QueryBusinessReqVO reqVO);
|
List<StaffStatisticsResp> staffStatistics(QueryBusinessReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : 渠道和来源统计
|
||||||
|
* @author xyc
|
||||||
|
* @date 13:21 2025/10/27
|
||||||
|
* @param reqVO {@link QueryBusinessReqVO}
|
||||||
|
* @return java.util.List<cn.iocoder.yudao.module.base.vo.RepairBusinessStatisticsVO>
|
||||||
|
**/
|
||||||
|
List<RepairBusinessStatisticsVO> businseeStatistics(QueryBusinessReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : 项目统计
|
||||||
|
* @author xyc
|
||||||
|
* @date 15:38 2025/10/27
|
||||||
|
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
|
||||||
|
**/
|
||||||
|
List<Map<String, Object>> repairProjectStatistics(QueryBusinessReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : 保险公司统计
|
||||||
|
* @author xyc
|
||||||
|
* @date 13:51 2025/10/28
|
||||||
|
* @param reqVO {@link QueryBusinessReqVO}
|
||||||
|
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
|
||||||
|
**/
|
||||||
|
List<Map<String, Object>> insuranceCompanyStatistics(QueryBusinessReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : 车辆品牌统计
|
||||||
|
* @author xyc
|
||||||
|
* @date 14:14 2025/10/28
|
||||||
|
* @param reqVO {@link QueryBusinessReqVO}
|
||||||
|
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
|
||||||
|
**/
|
||||||
|
List<Map<String, Object>> carBrandStatistics(QueryBusinessReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description :
|
||||||
|
* @author xyc
|
||||||
|
* @date 14:32 2025/10/28
|
||||||
|
* @param reqVO {@link QueryBusinessReqVO}
|
||||||
|
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
|
||||||
|
**/
|
||||||
|
List<Map<String, Object>> carYearStatistics(QueryBusinessReqVO reqVO);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.base.service;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.module.base.entity.StaffStatisticsResp;
|
import cn.iocoder.yudao.module.base.entity.StaffStatisticsResp;
|
||||||
import cn.iocoder.yudao.module.base.vo.*;
|
import cn.iocoder.yudao.module.base.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
|
||||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
|
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@ -41,7 +42,7 @@ public interface RepairStatisticsService {
|
|||||||
* @author PQZ
|
* @author PQZ
|
||||||
* @date 13:25 2024/10/21
|
* @date 13:25 2024/10/21
|
||||||
**/
|
**/
|
||||||
List<RepairStatisticsVO> repairTypeStatistics();
|
List<RepairStatisticsVO> repairTypeStatistics(QueryBusinessReqVO reqVO);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -118,5 +119,58 @@ public interface RepairStatisticsService {
|
|||||||
* @param reqVO {@link QueryBusinessReqVO}
|
* @param reqVO {@link QueryBusinessReqVO}
|
||||||
* @return java.util.List
|
* @return java.util.List
|
||||||
**/
|
**/
|
||||||
List<RepairBusinessStatisticsVO> businseeStatistics(QueryBusinessReqVO reqVO);
|
List<Map<String, Object>> businseeStatistics(QueryBusinessReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : 工单项目统计
|
||||||
|
* @author xyc
|
||||||
|
* @date 15:32 2025/10/27
|
||||||
|
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
|
||||||
|
**/
|
||||||
|
List<Map<String, Object>> repairProjectStatistics(QueryBusinessReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : 保险和年审登记统计
|
||||||
|
* @author xyc
|
||||||
|
* @date 10:48 2025/10/28
|
||||||
|
* @param reqVO {@link QueryBusinessReqVO}
|
||||||
|
* @return java.util.Map<java.lang.String,java.lang.Object>
|
||||||
|
**/
|
||||||
|
Map<String, Object> insuranceAndAnnualRegistrationStatistics(QueryBusinessReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : 保险或年审列表
|
||||||
|
* @author xyc
|
||||||
|
* @date 11:32 2025/10/28
|
||||||
|
* @param reqVO {@link QueryBusinessReqVO}
|
||||||
|
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
|
||||||
|
**/
|
||||||
|
List<DlRepairTickets> insuranceOrAnnualListStatistics(QueryBusinessReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : 保险公司统计
|
||||||
|
* @author xyc
|
||||||
|
* @date 13:51 2025/10/28
|
||||||
|
* @param reqVO {@link QueryBusinessReqVO}
|
||||||
|
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
|
||||||
|
**/
|
||||||
|
List<Map<String, Object>> insuranceCompanyStatistics(QueryBusinessReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : 车辆品牌统计
|
||||||
|
* @author xyc
|
||||||
|
* @date 14:14 2025/10/28
|
||||||
|
* @param reqVO {@link QueryBusinessReqVO}
|
||||||
|
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
|
||||||
|
**/
|
||||||
|
List<Map<String, Object>> carBrandStatistics(QueryBusinessReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : 车辆年份统计
|
||||||
|
* @author xyc
|
||||||
|
* @date 14:32 2025/10/28
|
||||||
|
* @param reqVO {@link QueryBusinessReqVO}
|
||||||
|
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
|
||||||
|
**/
|
||||||
|
List<Map<String, Object>> carYearStatistics(QueryBusinessReqVO reqVO);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,21 @@
|
|||||||
package cn.iocoder.yudao.module.base.service.impl;
|
package cn.iocoder.yudao.module.base.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.iocoder.yudao.module.base.entity.StaffStatisticsResp;
|
import cn.iocoder.yudao.module.base.entity.StaffStatisticsResp;
|
||||||
import cn.iocoder.yudao.module.base.mapper.RepairStatisticsMapper;
|
import cn.iocoder.yudao.module.base.mapper.RepairStatisticsMapper;
|
||||||
import cn.iocoder.yudao.module.base.service.RepairStatisticsService;
|
import cn.iocoder.yudao.module.base.service.RepairStatisticsService;
|
||||||
import cn.iocoder.yudao.module.base.vo.*;
|
import cn.iocoder.yudao.module.base.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.business.entity.DlBusinessChannel;
|
||||||
|
import cn.iocoder.yudao.module.business.service.BusinessChannelService;
|
||||||
|
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
|
||||||
|
import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
|
||||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
|
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
|
||||||
|
import cn.iocoder.yudao.util.StringUtils;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
@ -23,9 +32,17 @@ import java.util.stream.Collectors;
|
|||||||
@Validated
|
@Validated
|
||||||
public class RepairStatisticsServiceImpl implements RepairStatisticsService {
|
public class RepairStatisticsServiceImpl implements RepairStatisticsService {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(RepairStatisticsServiceImpl.class);
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private RepairStatisticsMapper statisticsMapper;
|
private RepairStatisticsMapper statisticsMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DlRepairTicketsService ticketsService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BusinessChannelService businessChannelService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户来源分析饼图
|
* 客户来源分析饼图
|
||||||
*
|
*
|
||||||
@ -76,8 +93,8 @@ public class RepairStatisticsServiceImpl implements RepairStatisticsService {
|
|||||||
* @date 13:25 2024/10/21
|
* @date 13:25 2024/10/21
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public List<RepairStatisticsVO> repairTypeStatistics() {
|
public List<RepairStatisticsVO> repairTypeStatistics(QueryBusinessReqVO reqVO) {
|
||||||
return statisticsMapper.repairTypeStatistics();
|
return statisticsMapper.repairTypeStatistics(reqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -181,8 +198,146 @@ public class RepairStatisticsServiceImpl implements RepairStatisticsService {
|
|||||||
* @date 09:54 2025/10/27
|
* @date 09:54 2025/10/27
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public List<RepairBusinessStatisticsVO> businseeStatistics(QueryBusinessReqVO reqVO) {
|
public List<Map<String, Object>> businseeStatistics(QueryBusinessReqVO reqVO) {
|
||||||
// return statisticsMapper.businseeStatistics(reqVO);
|
// 查询所有渠道
|
||||||
return null;
|
List<DlBusinessChannel> channels = businessChannelService.list(Wrappers.<DlBusinessChannel>lambdaQuery()
|
||||||
|
.eq(DlBusinessChannel::getSystemCode, "repair")
|
||||||
|
.eq(StringUtils.isEmpty(reqVO.getSearch()),DlBusinessChannel::getType, 0)
|
||||||
|
.eq(StringUtils.isNotEmpty(reqVO.getSearch()), DlBusinessChannel::getPid, reqVO.getSearch()));
|
||||||
|
List<Map<String, Object>> resp = new ArrayList<>();
|
||||||
|
|
||||||
|
// 检查日期范围是否有效
|
||||||
|
List<String> dateRange = reqVO.getDateRange();
|
||||||
|
String startDate = null;
|
||||||
|
String endDate = null;
|
||||||
|
if (dateRange != null && dateRange.size() >= 2 && dateRange.get(0) != null && dateRange.get(1) != null) {
|
||||||
|
startDate = dateRange.get(0);
|
||||||
|
endDate = dateRange.get(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (channels != null && !channels.isEmpty()) {
|
||||||
|
for (DlBusinessChannel channel : channels) {
|
||||||
|
Map<String, Object> respMap = new HashMap<>();
|
||||||
|
if (channel != null && channel.getName() != null) {
|
||||||
|
try {
|
||||||
|
// 查询渠道排名
|
||||||
|
Map<String, Object> bossNumStatistics = ticketsService.getBossNumStatistics(
|
||||||
|
startDate, endDate, StringUtils.isNotEmpty(reqVO.getSearch()) ? null :channel.getName(), StringUtils.isNotEmpty(reqVO.getSearch()) ? channel.getName() :null, false);
|
||||||
|
|
||||||
|
respMap.put("name", channel.getName());
|
||||||
|
respMap.put("id", channel.getId());
|
||||||
|
if (bossNumStatistics != null) {
|
||||||
|
respMap.put("data", bossNumStatistics);
|
||||||
|
resp.add(respMap);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 记录异常但不中断整个流程
|
||||||
|
log.warn("获取渠道统计信息时发生异常,渠道名称: {}", channel.getName(), e);
|
||||||
|
// 添加一个默认的统计对象,避免前端出现空值
|
||||||
|
Map<String, Object> defaultStats = new HashMap<>();
|
||||||
|
defaultStats.put("name", channel.getName());
|
||||||
|
defaultStats.put("id", channel.getId());
|
||||||
|
defaultStats.put("count", 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return java.util.List<java.util.Map < java.lang.String, java.lang.Object>>
|
||||||
|
* @description : 工单项目统计
|
||||||
|
* @author xyc
|
||||||
|
* @date 15:32 2025/10/27
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> repairProjectStatistics(QueryBusinessReqVO reqVO) {
|
||||||
|
return statisticsMapper.repairProjectStatistics(reqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param reqVO {@link QueryBusinessReqVO}
|
||||||
|
* @return java.util.Map<java.lang.String, java.lang.Object>
|
||||||
|
* @description : 保险和年审登记统计
|
||||||
|
* @author xyc
|
||||||
|
* @date 10:48 2025/10/28
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> insuranceAndAnnualRegistrationStatistics(QueryBusinessReqVO reqVO) {
|
||||||
|
List<DlRepairTickets> tickets = ticketsService.list(Wrappers.<DlRepairTickets>lambdaQuery()
|
||||||
|
.between(CollUtil.isNotEmpty(reqVO.getDateRange()), DlRepairTickets::getCreateTime, reqVO.getDateRange().get(0), reqVO.getDateRange().get(1)));
|
||||||
|
// 分别查询nextInspectionDate和insuranceExpiryDate不为空的数量
|
||||||
|
long inspectionCount = tickets.stream()
|
||||||
|
.filter(ticket -> ticket.getNextInspectionDate() != null)
|
||||||
|
.count();
|
||||||
|
long insuranceCount = tickets.stream()
|
||||||
|
.filter(ticket -> ticket.getInsuranceExpiryDate() != null)
|
||||||
|
.count();
|
||||||
|
Map<String, Object> resp = new HashMap<>();
|
||||||
|
resp.put("inspectionCount", inspectionCount);
|
||||||
|
// 计算占比 保留两位小数点
|
||||||
|
double inspectionPercent = tickets.size() > 0 ? inspectionCount * 100.0 / tickets.size() : 0;
|
||||||
|
resp.put("inspectionPercent", String.format("%.2f", inspectionPercent));
|
||||||
|
resp.put("insuranceCount", insuranceCount);
|
||||||
|
double insurancePercent = tickets.size() > 0 ? insuranceCount * 100.0 / tickets.size() : 0;
|
||||||
|
resp.put("insurancePercent", String.format("%.2f", insurancePercent));
|
||||||
|
resp.put("totalCount", tickets.size());
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param reqVO {@link QueryBusinessReqVO}
|
||||||
|
* @return java.util.List<java.util.Map < java.lang.String, java.lang.Object>>
|
||||||
|
* @description : 保险或年审列表
|
||||||
|
* @author xyc
|
||||||
|
* @date 11:32 2025/10/28
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public List<DlRepairTickets> insuranceOrAnnualListStatistics(QueryBusinessReqVO reqVO) {
|
||||||
|
// 根据日期范围查询保险日期快要到期的车辆
|
||||||
|
List<DlRepairTickets> tickets = ticketsService.list(Wrappers.<DlRepairTickets>lambdaQuery()
|
||||||
|
.between("insurance".equals(reqVO.getType()) && CollUtil.isNotEmpty(reqVO.getDateRange()), DlRepairTickets::getInsuranceExpiryDate, reqVO.getDateRange().get(0), reqVO.getDateRange().get(1))
|
||||||
|
.between("inspection".equals(reqVO.getType()) && CollUtil.isNotEmpty(reqVO.getDateRange()), DlRepairTickets::getNextInspectionDate, reqVO.getDateRange().get(0), reqVO.getDateRange().get(1))
|
||||||
|
.orderByDesc("insurance".equals(reqVO.getType()),DlRepairTickets::getInsuranceExpiryDate)
|
||||||
|
.orderByDesc("inspection".equals(reqVO.getType()),DlRepairTickets::getNextInspectionDate));
|
||||||
|
return tickets;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param reqVO {@link QueryBusinessReqVO}
|
||||||
|
* @return java.util.List<java.util.Map < java.lang.String, java.lang.Object>>
|
||||||
|
* @description : 保险公司统计
|
||||||
|
* @author xyc
|
||||||
|
* @date 13:51 2025/10/28
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> insuranceCompanyStatistics(QueryBusinessReqVO reqVO) {
|
||||||
|
return statisticsMapper.insuranceCompanyStatistics(reqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param reqVO {@link QueryBusinessReqVO}
|
||||||
|
* @return java.util.List<java.util.Map < java.lang.String, java.lang.Object>>
|
||||||
|
* @description : 车辆品牌统计
|
||||||
|
* @author xyc
|
||||||
|
* @date 14:14 2025/10/28
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> carBrandStatistics(QueryBusinessReqVO reqVO) {
|
||||||
|
return statisticsMapper.carBrandStatistics(reqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param reqVO {@link QueryBusinessReqVO}
|
||||||
|
* @return java.util.List<java.util.Map < java.lang.String, java.lang.Object>>
|
||||||
|
* @description : 车辆年份统计
|
||||||
|
* @author xyc
|
||||||
|
* @date 14:32 2025/10/28
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> carYearStatistics(QueryBusinessReqVO reqVO) {
|
||||||
|
return statisticsMapper.carYearStatistics(reqVO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.base.vo;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*@BelongsProject: lanan-system
|
*@BelongsProject: lanan-system
|
||||||
*@BelongsPackage: cn.iocoder.yudao.module.base.vo
|
*@BelongsPackage: cn.iocoder.yudao.module.base.vo
|
||||||
@ -16,7 +18,7 @@ public class QueryBusinessReqVO {
|
|||||||
/**
|
/**
|
||||||
* 时间范围
|
* 时间范围
|
||||||
*/
|
*/
|
||||||
private String[] dateRange;
|
private List<String> dateRange;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类型 car: 车辆 customer: 客户
|
* 类型 car: 车辆 customer: 客户
|
||||||
|
|||||||
@ -11,4 +11,10 @@ import lombok.Data;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class RepairBusinessStatisticsVO {
|
public class RepairBusinessStatisticsVO {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private Integer count;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -515,7 +515,7 @@ public class DlRepairTicketsController {
|
|||||||
@GetMapping("/getBossNumStatistics")
|
@GetMapping("/getBossNumStatistics")
|
||||||
public CommonResult<?> getBossNumStatistics(@RequestParam(value = "dateRange[0]", required = false) String startDate,
|
public CommonResult<?> getBossNumStatistics(@RequestParam(value = "dateRange[0]", required = false) String startDate,
|
||||||
@RequestParam(value = "dateRange[1]", required = false) String endDate) {
|
@RequestParam(value = "dateRange[1]", required = false) String endDate) {
|
||||||
return success(dlRepairTicketsService.getBossNumStatistics(startDate, endDate));
|
return success(dlRepairTicketsService.getBossNumStatistics(startDate, endDate,null,null, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -250,6 +250,8 @@ public class DlRepairTickets extends TenantBaseDO {
|
|||||||
private Date insuranceExpiryDate;
|
private Date insuranceExpiryDate;
|
||||||
/** 承保险种,多个英文逗号隔开 */
|
/** 承保险种,多个英文逗号隔开 */
|
||||||
private String insuranceType;
|
private String insuranceType;
|
||||||
|
/** 保险公司 */
|
||||||
|
private String insuranceCompany;
|
||||||
/** 交强险保费 */
|
/** 交强险保费 */
|
||||||
private BigDecimal jiaoqiang;
|
private BigDecimal jiaoqiang;
|
||||||
/** 商业险保费 */
|
/** 商业险保费 */
|
||||||
|
|||||||
@ -336,7 +336,7 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
|
|||||||
* @Param [startDate, endDate]
|
* @Param [startDate, endDate]
|
||||||
* @return java.util.List<java.util.Map>
|
* @return java.util.List<java.util.Map>
|
||||||
**/
|
**/
|
||||||
Map<String, Object> getBossNumStatistics(String startDate, String endDate);
|
Map<String, Object> getBossNumStatistics(String startDate, String endDate, String busiFrom, String cusFrom, boolean isShowChildren);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 许
|
* @Author 许
|
||||||
|
|||||||
@ -929,7 +929,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
* @Param [startDate, endDate]
|
* @Param [startDate, endDate]
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getBossNumStatistics(String startDate, String endDate) {
|
public Map<String, Object> getBossNumStatistics(String startDate, String endDate, String busiFrom, String cusFrom,boolean isShowChildren) {
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
List<Map<String, Object>> statsList = new ArrayList<>();
|
List<Map<String, Object>> statsList = new ArrayList<>();
|
||||||
|
|
||||||
@ -943,6 +943,9 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
endDate + " 23:59:59");
|
endDate + " 23:59:59");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
queryWrapper.eq(busiFrom != null, "busi_from", busiFrom);
|
||||||
|
queryWrapper.in(cusFrom != null, "cus_from", cusFrom);
|
||||||
|
|
||||||
// 根据条件查询工单
|
// 根据条件查询工单
|
||||||
List<DlRepairTickets> ticketsInRange = this.list(queryWrapper);
|
List<DlRepairTickets> ticketsInRange = this.list(queryWrapper);
|
||||||
|
|
||||||
@ -950,17 +953,17 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
Map<String, Long> newOrderStats = ticketsInRange.stream()
|
Map<String, Long> newOrderStats = ticketsInRange.stream()
|
||||||
// .filter(item -> TicketsStatusEnum.NO_WORK.getCode().equals(item.getTicketsStatus()))
|
// .filter(item -> TicketsStatusEnum.NO_WORK.getCode().equals(item.getTicketsStatus()))
|
||||||
.collect(Collectors.groupingBy(DlRepairTickets::getRepairType, Collectors.counting()));
|
.collect(Collectors.groupingBy(DlRepairTickets::getRepairType, Collectors.counting()));
|
||||||
statsList.add(createStatsNode("newOrderNum", "订单(进厂数)", newOrderStats, "jinchang"));
|
statsList.add(createStatsNode("newOrderNum", "订单(进厂数)", newOrderStats, "jinchang",isShowChildren));
|
||||||
|
|
||||||
// 维修中(按 repairType 分组)
|
// 维修中(按 repairType 分组)
|
||||||
Map<String, Long> workingStats = ticketsInRange.stream()
|
Map<String, Long> workingStats = ticketsInRange.stream()
|
||||||
.filter(item -> TicketsStatusEnum.WORKING.getCode().equals(item.getTicketsStatus()))
|
.filter(item -> TicketsStatusEnum.WORKING.getCode().equals(item.getTicketsStatus()))
|
||||||
.collect(Collectors.groupingBy(DlRepairTickets::getRepairType, Collectors.counting()));
|
.collect(Collectors.groupingBy(DlRepairTickets::getRepairType, Collectors.counting()));
|
||||||
statsList.add(createStatsNode("workingNum", "维修中", workingStats, "weixiuzhong"));
|
statsList.add(createStatsNode("workingNum", "维修中", workingStats, "weixiuzhong",isShowChildren));
|
||||||
|
|
||||||
// 已竣工(通过 mapper 查询并按 repairType 分组)
|
// 已竣工(通过 mapper 查询并按 repairType 分组)
|
||||||
Map<String, Long> overStats = getOverStatsByRepairType(startDate, endDate);
|
Map<String, Long> overStats = getOverStatsByRepairType(startDate, endDate);
|
||||||
statsList.add(createStatsNode("overNum", "已竣工", overStats, "yijungong"));
|
statsList.add(createStatsNode("overNum", "已竣工", overStats, "yijungong",isShowChildren));
|
||||||
|
|
||||||
// 竣工已结算
|
// 竣工已结算
|
||||||
|
|
||||||
@ -969,24 +972,24 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
Map<String, Long> noPayStats = ticketsInRange.stream()
|
Map<String, Long> noPayStats = ticketsInRange.stream()
|
||||||
.filter(item -> noPayCodeList.contains(item.getTicketsStatus()))
|
.filter(item -> noPayCodeList.contains(item.getTicketsStatus()))
|
||||||
.collect(Collectors.groupingBy(DlRepairTickets::getRepairType, Collectors.counting()));
|
.collect(Collectors.groupingBy(DlRepairTickets::getRepairType, Collectors.counting()));
|
||||||
statsList.add(createStatsNode("noPayNum", "未结算", noPayStats, "weijiesuan"));
|
statsList.add(createStatsNode("noPayNum", "未结算", noPayStats, "weijiesuan",isShowChildren));
|
||||||
|
|
||||||
// 已交车(通过 mapper 查询并按 repairType 分组)
|
// 已交车(通过 mapper 查询并按 repairType 分组)
|
||||||
Map<String, Long> giveCusStats = getGiveCusStatsByRepairType(startDate, endDate);
|
Map<String, Long> giveCusStats = getGiveCusStatsByRepairType(startDate, endDate);
|
||||||
statsList.add(createStatsNode("giveCusNum", "已交车", giveCusStats, "yijiaoche"));
|
statsList.add(createStatsNode("giveCusNum", "已交车", giveCusStats, "yijiaoche",isShowChildren));
|
||||||
|
|
||||||
// 在厂(未交车且不是已完成状态 03)
|
// 在厂(未交车且不是已完成状态 03)
|
||||||
Map<String, Long> inCompanyStats = ticketsInRange.stream()
|
Map<String, Long> inCompanyStats = ticketsInRange.stream()
|
||||||
.filter(item -> "0".equals(item.getIsHandover()))
|
.filter(item -> "0".equals(item.getIsHandover()))
|
||||||
.filter(item -> !"03".equals(item.getTicketsStatus()))
|
.filter(item -> !"03".equals(item.getTicketsStatus()))
|
||||||
.collect(Collectors.groupingBy(DlRepairTickets::getRepairType, Collectors.counting()));
|
.collect(Collectors.groupingBy(DlRepairTickets::getRepairType, Collectors.counting()));
|
||||||
statsList.add(createStatsNode("inCompanyNum", "在厂", inCompanyStats, "zaichang"));
|
statsList.add(createStatsNode("inCompanyNum", "在厂", inCompanyStats, "zaichang",isShowChildren));
|
||||||
|
|
||||||
// 添加到结果map
|
// 添加到结果map
|
||||||
resultMap.put("stats", statsList);
|
resultMap.put("stats", statsList);
|
||||||
|
|
||||||
// 统计金额信息
|
// 统计金额信息
|
||||||
Map<String, Object> amountStats = calculateAmountStats(startDate, endDate);
|
Map<String, Object> amountStats = calculateAmountStats(startDate, endDate, busiFrom, cusFrom);
|
||||||
resultMap.putAll(amountStats);
|
resultMap.putAll(amountStats);
|
||||||
|
|
||||||
return resultMap;
|
return resultMap;
|
||||||
@ -1091,12 +1094,13 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
* @Param [code, name, stats, selectType] 统计项代码、名称、统计数据、选择类型
|
* @Param [code, name, stats, selectType] 统计项代码、名称、统计数据、选择类型
|
||||||
* @return java.util.Map<java.lang.String, java.lang.Object>
|
* @return java.util.Map<java.lang.String, java.lang.Object>
|
||||||
**/
|
**/
|
||||||
private Map<String, Object> createStatsNode(String code, String name, Map<String, Long> stats, String selectType) {
|
private Map<String, Object> createStatsNode(String code, String name, Map<String, Long> stats, String selectType, boolean ifShowChildren) {
|
||||||
Map<String, Object> node = new HashMap<>();
|
Map<String, Object> node = new HashMap<>();
|
||||||
node.put("code", code);
|
node.put("code", code);
|
||||||
node.put("name", name);
|
node.put("name", name);
|
||||||
node.put("selectType", selectType);
|
node.put("selectType", selectType);
|
||||||
|
|
||||||
|
if (ifShowChildren) {
|
||||||
List<Map<String, Object>> children = stats.entrySet().stream()
|
List<Map<String, Object>> children = stats.entrySet().stream()
|
||||||
.map(entry -> {
|
.map(entry -> {
|
||||||
Map<String, Object> child = new HashMap<>();
|
Map<String, Object> child = new HashMap<>();
|
||||||
@ -1107,6 +1111,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
node.put("children", children);
|
node.put("children", children);
|
||||||
|
}
|
||||||
|
|
||||||
// 计算该统计项的总数
|
// 计算该统计项的总数
|
||||||
long total = stats.values().stream().mapToLong(Long::longValue).sum();
|
long total = stats.values().stream().mapToLong(Long::longValue).sum();
|
||||||
@ -1117,11 +1122,14 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
|
|
||||||
// 计算金额统计
|
// 计算金额统计
|
||||||
private Map<String, Object> calculateAmountStats(String startDate, String endDate) {
|
private Map<String, Object> calculateAmountStats(String startDate, String endDate) {
|
||||||
|
return calculateAmountStats(startDate, endDate, null, null);
|
||||||
|
}
|
||||||
|
// 计算金额统计
|
||||||
|
private Map<String, Object> calculateAmountStats(String startDate, String endDate, String busiFrom, String cusFrom) {
|
||||||
Map<String, Object> amountMap = new HashMap<>();
|
Map<String, Object> amountMap = new HashMap<>();
|
||||||
|
|
||||||
// 应收款:竣工已结算的单子的总金额
|
// 应收款:竣工已结算的单子的总金额
|
||||||
QueryWrapper<DlRepairTickets> receivableWrapper = new QueryWrapper<>();
|
QueryWrapper<DlRepairTickets> receivableWrapper = new QueryWrapper<>();
|
||||||
// receivableWrapper.eq("tickets_status", "03");
|
|
||||||
|
|
||||||
if (startDate != null && endDate != null) {
|
if (startDate != null && endDate != null) {
|
||||||
receivableWrapper.between("drt.create_time",
|
receivableWrapper.between("drt.create_time",
|
||||||
@ -1129,6 +1137,14 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
endDate + " 23:59:59");
|
endDate + " 23:59:59");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 添加渠道或来源查询条件
|
||||||
|
if (busiFrom != null) {
|
||||||
|
receivableWrapper.eq("drt.busi_from", busiFrom);
|
||||||
|
}
|
||||||
|
if (cusFrom != null && !cusFrom.isEmpty()) {
|
||||||
|
receivableWrapper.eq("drt.cus_from", cusFrom);
|
||||||
|
}
|
||||||
|
|
||||||
List<Map<String, Object>> receivables = repairTicketsMapper.selectSumAmount(receivableWrapper);
|
List<Map<String, Object>> receivables = repairTicketsMapper.selectSumAmount(receivableWrapper);
|
||||||
BigDecimal receivableAmount = BigDecimal.ZERO;
|
BigDecimal receivableAmount = BigDecimal.ZERO;
|
||||||
Integer receivableCount = 0;
|
Integer receivableCount = 0;
|
||||||
@ -2724,7 +2740,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
@Override
|
@Override
|
||||||
public void overOrder(DlRepairTicketsRespVO respVO) {
|
public void overOrder(DlRepairTicketsRespVO respVO) {
|
||||||
DlRepairTickets repairTickets = this.getById(respVO.getId());
|
DlRepairTickets repairTickets = this.getById(respVO.getId());
|
||||||
if (TicketsStatusEnum.NO_PAY.getCode().equals(repairTickets.getTicketsStatus())) {
|
if ("01".equals(repairTickets.getPayStatus())) {
|
||||||
//没结账呢还
|
//没结账呢还
|
||||||
repairTickets.setIsHandover("1");
|
repairTickets.setIsHandover("1");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -70,4 +70,6 @@ public class DlRepairTicketsReqVO extends DlRepairTickets {
|
|||||||
|
|
||||||
/** 支付状态集和 */
|
/** 支付状态集和 */
|
||||||
private List<String> payStatuses;
|
private List<String> payStatuses;
|
||||||
|
/** 收益率范围 */
|
||||||
|
private List<String> profitRateRanges;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,6 +69,10 @@
|
|||||||
LEFT JOIN system_dict_data sdd ON drt.repair_type = sdd.value AND sdd.dict_type = 'repair_type' AND sdd.deleted = 0
|
LEFT JOIN system_dict_data sdd ON drt.repair_type = sdd.value AND sdd.dict_type = 'repair_type' AND sdd.deleted = 0
|
||||||
WHERE
|
WHERE
|
||||||
drt.deleted = 0
|
drt.deleted = 0
|
||||||
|
<if test="reqVO.dateRange != null">
|
||||||
|
AND drt.create_time BETWEEN CONCAT(#{reqVO.dateRange[0]}, ' 00:00:00')
|
||||||
|
AND CONCAT(#{reqVO.dateRange[1]}, ' 23:59:59')
|
||||||
|
</if>
|
||||||
GROUP BY
|
GROUP BY
|
||||||
drt.repair_type
|
drt.repair_type
|
||||||
ORDER BY
|
ORDER BY
|
||||||
@ -254,4 +258,120 @@
|
|||||||
totalTasks DESC;
|
totalTasks DESC;
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
<select id="businseeStatistics" resultType="cn.iocoder.yudao.module.base.vo.RepairBusinessStatisticsVO">
|
||||||
|
SELECT
|
||||||
|
ibc.name AS name,
|
||||||
|
ibc.id AS id,
|
||||||
|
COUNT(drt.id) AS count
|
||||||
|
FROM
|
||||||
|
dl_repair_tickets drt
|
||||||
|
<if test="search != null and search != ''">
|
||||||
|
JOIN
|
||||||
|
inspection_business_channel ibc ON drt.busi_from = ibc.name
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="search == null or search == ''">
|
||||||
|
JOIN
|
||||||
|
inspection_business_channel ibc ON drt.cus_from = ibc.name
|
||||||
|
</if>
|
||||||
|
|
||||||
|
WHERE
|
||||||
|
drt.deleted = b'0' -- 过滤掉已删除的工单
|
||||||
|
AND ibc.deleted = b'0' -- 过滤掉已删除的渠道
|
||||||
|
<if test="dateRange != null">
|
||||||
|
AND DATE(drt.create_time) BETWEEN #{dateRange[0]} AND #{dateRange[1]}
|
||||||
|
</if>
|
||||||
|
<if test="search != null and search != ''">
|
||||||
|
AND
|
||||||
|
ibc.pid = #{search}
|
||||||
|
</if>
|
||||||
|
GROUP BY
|
||||||
|
ibc.name
|
||||||
|
ORDER BY
|
||||||
|
count DESC;
|
||||||
|
</select>
|
||||||
|
<select id="repairProjectStatistics" resultType="java.util.Map">
|
||||||
|
SELECT
|
||||||
|
drp.name AS project_name,
|
||||||
|
SUM(drt.item_money) AS total_money,
|
||||||
|
SUM(drt.item_profit) AS total_profit,
|
||||||
|
COUNT(drt.id) AS item_count
|
||||||
|
FROM
|
||||||
|
dl_repair_titem drt
|
||||||
|
JOIN
|
||||||
|
dl_repair_tickets dr ON drt.ticket_id = dr.id
|
||||||
|
JOIN
|
||||||
|
dl_repair_project drp ON drt.project_id = drp.id
|
||||||
|
WHERE
|
||||||
|
drt.deleted = b'0' -- 过滤已删除的记录
|
||||||
|
AND drp.deleted = '0' -- 过滤已删除的项目
|
||||||
|
<if test="dateRange != null">
|
||||||
|
AND DATE(dr.create_time) BETWEEN #{dateRange[0]} AND #{dateRange[1]}
|
||||||
|
</if>
|
||||||
|
GROUP BY
|
||||||
|
drp.name
|
||||||
|
ORDER BY
|
||||||
|
item_count DESC; -- 按项目总金额降序排列
|
||||||
|
|
||||||
|
</select>
|
||||||
|
<select id="insuranceCompanyStatistics" resultType="java.util.Map"
|
||||||
|
parameterType="cn.iocoder.yudao.module.base.vo.QueryBusinessReqVO">
|
||||||
|
SELECT
|
||||||
|
insurance_company AS insuranceCompany,
|
||||||
|
COUNT(*) AS conut
|
||||||
|
FROM dl_repair_tickets
|
||||||
|
WHERE deleted = 0
|
||||||
|
AND insurance_company IS NOT NULL
|
||||||
|
AND insurance_company != ''
|
||||||
|
<if test="dateRange != null">
|
||||||
|
AND DATE(create_time) BETWEEN #{dateRange[0]} AND #{dateRange[1]}
|
||||||
|
</if>
|
||||||
|
GROUP BY insurance_company
|
||||||
|
ORDER BY conut DESC;
|
||||||
|
</select>
|
||||||
|
<select id="carBrandStatistics" resultType="java.util.Map"
|
||||||
|
parameterType="cn.iocoder.yudao.module.base.vo.QueryBusinessReqVO">
|
||||||
|
SELECT
|
||||||
|
car_brand_name AS carBrandName,
|
||||||
|
COUNT(*) AS count
|
||||||
|
FROM dl_repair_tickets
|
||||||
|
WHERE deleted = 0
|
||||||
|
AND car_brand_name IS NOT NULL
|
||||||
|
AND car_brand_name != ''
|
||||||
|
<if test="dateRange != null">
|
||||||
|
AND DATE(create_time) BETWEEN #{dateRange[0]} AND #{dateRange[1]}
|
||||||
|
</if>
|
||||||
|
GROUP BY car_brand_name
|
||||||
|
ORDER BY count DESC
|
||||||
|
</select>
|
||||||
|
<select id="carYearStatistics" resultType="java.util.Map"
|
||||||
|
parameterType="cn.iocoder.yudao.module.base.vo.QueryBusinessReqVO">
|
||||||
|
SELECT
|
||||||
|
carYear,
|
||||||
|
COUNT(*) AS count
|
||||||
|
FROM (
|
||||||
|
SELECT
|
||||||
|
drt.total_price,
|
||||||
|
CASE
|
||||||
|
WHEN TIMESTAMPDIFF(YEAR, bcm.car_register_date, CURDATE()) < 6 THEN '6年以下'
|
||||||
|
WHEN TIMESTAMPDIFF(YEAR, bcm.car_register_date, CURDATE()) = 6 THEN '6年'
|
||||||
|
ELSE CONCAT(TIMESTAMPDIFF(YEAR, bcm.car_register_date, CURDATE()), '年')
|
||||||
|
END AS carYear
|
||||||
|
FROM dl_repair_tickets drt
|
||||||
|
LEFT JOIN base_car_main bcm ON drt.car_id = bcm.id
|
||||||
|
WHERE drt.deleted = 0
|
||||||
|
AND bcm.deleted = 0
|
||||||
|
AND bcm.car_register_date IS NOT NULL
|
||||||
|
<if test="dateRange != null">
|
||||||
|
AND DATE(drt.create_time) BETWEEN #{dateRange[0]} AND #{dateRange[1]}
|
||||||
|
</if>
|
||||||
|
) AS temp
|
||||||
|
GROUP BY carYear
|
||||||
|
ORDER BY
|
||||||
|
CASE
|
||||||
|
WHEN carYear = '6年以下' THEN 0
|
||||||
|
WHEN carYear = '6年' THEN 1
|
||||||
|
ELSE CAST(REPLACE(carYear, '年', '') AS UNSIGNED) + 1
|
||||||
|
END;
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -400,6 +400,15 @@
|
|||||||
</choose>
|
</choose>
|
||||||
</otherwise>
|
</otherwise>
|
||||||
</choose>
|
</choose>
|
||||||
|
<if test="map.profitRateRanges != null and map.profitRateRanges.size > 0">
|
||||||
|
HAVING
|
||||||
|
CASE
|
||||||
|
WHEN SUM(CASE WHEN drti.item_type IN ('01','02') THEN drti.item_money ELSE 0 END) = 0 THEN 0
|
||||||
|
ELSE ROUND(SUM(CASE WHEN drti.item_type = '02' THEN drti.item_profit ELSE 0 END)
|
||||||
|
/ SUM(CASE WHEN drti.item_type IN ('01','02') THEN drti.item_money ELSE 0 END), 4)
|
||||||
|
END
|
||||||
|
BETWEEN #{map.profitRateRanges[0]} AND #{map.profitRateRanges[1]}
|
||||||
|
</if>
|
||||||
GROUP BY drt.id
|
GROUP BY drt.id
|
||||||
order by drt.update_time desc
|
order by drt.update_time desc
|
||||||
</select>
|
</select>
|
||||||
@ -545,6 +554,15 @@
|
|||||||
AND drt.is_handover = '0' AND drt.tickets_status != '03'
|
AND drt.is_handover = '0' AND drt.tickets_status != '03'
|
||||||
</if>
|
</if>
|
||||||
</if>
|
</if>
|
||||||
|
<if test="map.profitRateRanges != null and map.profitRateRanges.size > 0">
|
||||||
|
HAVING
|
||||||
|
CASE
|
||||||
|
WHEN SUM(CASE WHEN drti.item_type IN ('01','02') THEN drti.item_money ELSE 0 END) = 0 THEN 0
|
||||||
|
ELSE ROUND(SUM(CASE WHEN drti.item_type = '02' THEN drti.item_profit ELSE 0 END)
|
||||||
|
/ SUM(CASE WHEN drti.item_type IN ('01','02') THEN drti.item_money ELSE 0 END), 4)
|
||||||
|
END
|
||||||
|
BETWEEN #{map.profitRateRanges[0]} AND #{map.profitRateRanges[1]}
|
||||||
|
</if>
|
||||||
|
|
||||||
GROUP BY drt.id
|
GROUP BY drt.id
|
||||||
ORDER BY drt.update_time DESC
|
ORDER BY drt.update_time DESC
|
||||||
@ -721,6 +739,16 @@
|
|||||||
AND drt.is_handover = '0' AND drt.tickets_status != '03'
|
AND drt.is_handover = '0' AND drt.tickets_status != '03'
|
||||||
</if>
|
</if>
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
|
<if test="map.profitRateRanges != null and map.profitRateRanges.size > 0">
|
||||||
|
HAVING
|
||||||
|
CASE
|
||||||
|
WHEN SUM(CASE WHEN drti.item_type IN ('01','02') THEN drti.item_money ELSE 0 END) = 0 THEN 0
|
||||||
|
ELSE ROUND(SUM(CASE WHEN drti.item_type = '02' THEN drti.item_profit ELSE 0 END)
|
||||||
|
/ SUM(CASE WHEN drti.item_type IN ('01','02') THEN drti.item_money ELSE 0 END), 4)
|
||||||
|
END
|
||||||
|
BETWEEN #{map.profitRateRanges[0]} AND #{map.profitRateRanges[1]}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<select id="selectSumAmount">
|
<select id="selectSumAmount">
|
||||||
select drr.other_data as otherData, drt.pay_status as payType
|
select drr.other_data as otherData, drt.pay_status as payType
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user