Compare commits
No commits in common. "b3fbacc358c4bab8425def6bada704811dce757a" and "a7fb98bdce5c710d10edde667d8223ddf6868add" have entirely different histories.
b3fbacc358
...
a7fb98bdce
@ -74,8 +74,7 @@ public class InspectionBusinessChannelController {
|
|||||||
.map(String::valueOf)
|
.map(String::valueOf)
|
||||||
.collect(Collectors.joining(","));
|
.collect(Collectors.joining(","));
|
||||||
channel.setUserIds(userIds);
|
channel.setUserIds(userIds);
|
||||||
}else if (ObjectUtil.isEmpty(channel.getUserIds())) {
|
|
||||||
channel.setUserIds("");
|
|
||||||
}
|
}
|
||||||
return CommonResult.success(inspectionBusinessChannelService.updateById(channel));
|
return CommonResult.success(inspectionBusinessChannelService.updateById(channel));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|||||||
import cn.iocoder.yudao.module.base.service.RepairStatisticsService;
|
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 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;
|
||||||
@ -156,19 +155,4 @@ public class RepairStatisticsController {
|
|||||||
return CommonResult.success(statisticsService.listBusinessByCustomerOrCar(reqVO,page));
|
return CommonResult.success(statisticsService.listBusinessByCustomerOrCar(reqVO,page));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author 许
|
|
||||||
* @Description 根据客户或者车辆查询订单列表
|
|
||||||
* @Date 17:06 2025/9/1
|
|
||||||
* @Param [reqVO, pageNo, pageSize]
|
|
||||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
|
||||||
**/
|
|
||||||
@GetMapping("/pageByCustomerOrCar")
|
|
||||||
public CommonResult<?> pageByCustomerOrCar(QueryBusinessReqVO reqVO,
|
|
||||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
||||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
|
||||||
Page<QueryTableResp> page = new Page<>(pageNo, pageSize);
|
|
||||||
return CommonResult.success(statisticsService.pageByCustomerOrCar(reqVO,page));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
package cn.iocoder.yudao.module.base.mapper;
|
package cn.iocoder.yudao.module.base.mapper;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.base.vo.*;
|
import cn.iocoder.yudao.module.base.vo.QueryBusinessReqVO;
|
||||||
|
import cn.iocoder.yudao.module.base.vo.QueryBusinessResp;
|
||||||
|
import cn.iocoder.yudao.module.base.vo.RepairStatisticsVO;
|
||||||
|
import cn.iocoder.yudao.module.base.vo.RepairTicketStatisticsVO;
|
||||||
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;
|
||||||
@ -115,13 +118,4 @@ public interface RepairStatisticsMapper {
|
|||||||
* @return java.util.List
|
* @return java.util.List
|
||||||
**/
|
**/
|
||||||
IPage<QueryBusinessResp> listBusinessByCar(@Param("reqVO") QueryBusinessReqVO reqVO,@Param("page") Page<QueryBusinessResp> page);
|
IPage<QueryBusinessResp> listBusinessByCar(@Param("reqVO") QueryBusinessReqVO reqVO,@Param("page") Page<QueryBusinessResp> page);
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author 许
|
|
||||||
* @Description 根据客户或车牌查询订单
|
|
||||||
* @Date 17:13 2025/9/1
|
|
||||||
* @Param [reqVO, page]
|
|
||||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.base.vo.QueryTableResp>
|
|
||||||
**/
|
|
||||||
IPage<QueryTableResp> pageByCustomerOrCar(@Param("reqVO") QueryBusinessReqVO reqVO,@Param("page") Page<QueryTableResp> page);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
package cn.iocoder.yudao.module.base.service;
|
package cn.iocoder.yudao.module.base.service;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.base.vo.*;
|
import cn.iocoder.yudao.module.base.vo.QueryBusinessReqVO;
|
||||||
|
import cn.iocoder.yudao.module.base.vo.QueryBusinessResp;
|
||||||
|
import cn.iocoder.yudao.module.base.vo.RepairStatisticsVO;
|
||||||
|
import cn.iocoder.yudao.module.base.vo.RepairTicketStatisticsVO;
|
||||||
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;
|
||||||
@ -91,13 +94,4 @@ public interface RepairStatisticsService {
|
|||||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.base.vo.QueryBusinessResp>
|
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.base.vo.QueryBusinessResp>
|
||||||
**/
|
**/
|
||||||
IPage<QueryBusinessResp> listBusinessByCustomerOrCar(QueryBusinessReqVO reqVO, Page<QueryBusinessResp> page);
|
IPage<QueryBusinessResp> listBusinessByCustomerOrCar(QueryBusinessReqVO reqVO, Page<QueryBusinessResp> page);
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author 许
|
|
||||||
* @Description 根据客户或者车辆插叙订单
|
|
||||||
* @Date 17:08 2025/9/1
|
|
||||||
* @Param [reqVO, page]
|
|
||||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.base.vo.QueryTableResp>
|
|
||||||
**/
|
|
||||||
IPage<QueryTableResp> pageByCustomerOrCar(QueryBusinessReqVO reqVO, Page<QueryTableResp> page);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,10 @@ package cn.iocoder.yudao.module.base.service.impl;
|
|||||||
|
|
||||||
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.QueryBusinessReqVO;
|
||||||
|
import cn.iocoder.yudao.module.base.vo.QueryBusinessResp;
|
||||||
|
import cn.iocoder.yudao.module.base.vo.RepairStatisticsVO;
|
||||||
|
import cn.iocoder.yudao.module.base.vo.RepairTicketStatisticsVO;
|
||||||
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;
|
||||||
@ -148,17 +151,4 @@ public class RepairStatisticsServiceImpl implements RepairStatisticsService {
|
|||||||
}
|
}
|
||||||
return queryBusinessResps;
|
return queryBusinessResps;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.base.vo.QueryTableResp>
|
|
||||||
* @Author 许
|
|
||||||
* @Description 根据客户或者车辆插叙订单
|
|
||||||
* @Date 17:08 2025/9/1
|
|
||||||
* @Param [reqVO, page]
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public IPage<QueryTableResp> pageByCustomerOrCar(QueryBusinessReqVO reqVO, Page<QueryTableResp> page) {
|
|
||||||
IPage<QueryTableResp> queryTableResps = statisticsMapper.pageByCustomerOrCar(reqVO,page);
|
|
||||||
return queryTableResps;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,14 +27,4 @@ public class QueryBusinessReqVO {
|
|||||||
* 搜索
|
* 搜索
|
||||||
*/
|
*/
|
||||||
private String search;
|
private String search;
|
||||||
|
|
||||||
/**
|
|
||||||
* 手机
|
|
||||||
*/
|
|
||||||
private String phone;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车牌
|
|
||||||
*/
|
|
||||||
private String carNo;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,18 +51,8 @@ public class QueryBusinessResp {
|
|||||||
*/
|
*/
|
||||||
private String source;
|
private String source;
|
||||||
|
|
||||||
/**
|
|
||||||
* 业务来源
|
|
||||||
*/
|
|
||||||
private String sourceStr;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车牌号
|
* 车牌号
|
||||||
*/
|
*/
|
||||||
private String carNum;
|
private String carNum;
|
||||||
|
|
||||||
/**
|
|
||||||
* 经办人
|
|
||||||
*/
|
|
||||||
private String handleName;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,25 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.base.vo;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*@BelongsProject: lanan-system
|
|
||||||
*@BelongsPackage: cn.iocoder.yudao.module.base.vo
|
|
||||||
*@Author: 许
|
|
||||||
*@CreateTime: 2025-09-01 17:07
|
|
||||||
*@Description: 查询表单
|
|
||||||
*@Version: 1.0
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class QueryTableResp extends DlRepairTickets {
|
|
||||||
/**
|
|
||||||
* 订单ID
|
|
||||||
*/
|
|
||||||
private String orderId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 工单来源
|
|
||||||
*/
|
|
||||||
private String sourceStr;
|
|
||||||
}
|
|
||||||
@ -477,33 +477,6 @@ public class DlRepairTicketsController {
|
|||||||
return success(dlRepairTicketsService.getBossNum(selectType, startDate, endDate));
|
return success(dlRepairTicketsService.getBossNum(selectType, startDate, endDate));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author 许
|
|
||||||
* @Description 数据统计-新版
|
|
||||||
* @Date 10:53 2025/9/1
|
|
||||||
* @Param [startDate, endDate]
|
|
||||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
|
||||||
**/
|
|
||||||
@GetMapping("/getBossNumNew")
|
|
||||||
@Operation(summary = "从总检的角度查进场数、维修中、已完成、已交车、在厂的工单数量")
|
|
||||||
public CommonResult<?> getBossNumNew(@RequestParam(value = "dateRange[0]", required = false) String startDate,
|
|
||||||
@RequestParam(value = "dateRange[1]", required = false) String endDate) {
|
|
||||||
return success(dlRepairTicketsService.getBossNum(startDate, endDate));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author 许
|
|
||||||
* @Description 统计详情-细分工单类型
|
|
||||||
* @Date 14:14 2025/9/3
|
|
||||||
* @Param [startDate, endDate]
|
|
||||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
|
||||||
**/
|
|
||||||
@GetMapping("/getBossNumStatistics")
|
|
||||||
public CommonResult<?> getBossNumStatistics(@RequestParam(value = "dateRange[0]", required = false) String startDate,
|
|
||||||
@RequestParam(value = "dateRange[1]", required = false) String endDate) {
|
|
||||||
return success(dlRepairTicketsService.getBossNumStatistics(startDate, endDate));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取日期范围
|
* 获取日期范围
|
||||||
* @author vinjor-M
|
* @author vinjor-M
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.tickets.mapper;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
|
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
|
||||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsReqVO;
|
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsReqVO;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
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;
|
||||||
@ -58,16 +57,6 @@ public interface DlRepairTicketsMapper extends BaseMapper<DlRepairTickets> {
|
|||||||
**/
|
**/
|
||||||
List<String> selectTicketIdByParams(@Param("nowDate")String dayDate, @Param("recordCode")String recordCode, @Param("startTime")String startTime, @Param("endTime")String endTime);
|
List<String> selectTicketIdByParams(@Param("nowDate")String dayDate, @Param("recordCode")String recordCode, @Param("startTime")String startTime, @Param("endTime")String endTime);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author 许
|
|
||||||
* @Description 根据条件查询统计
|
|
||||||
* @Date 11:32 2025/9/4
|
|
||||||
* @Param [queryWrapper]
|
|
||||||
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
|
|
||||||
**/
|
|
||||||
List<Map<String, Object>> selectTicketIdByParamsNew(@Param("ew") QueryWrapper<DlRepairTickets> queryWrapper);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 许
|
* @Author 许
|
||||||
* @Description 统计工单
|
* @Description 统计工单
|
||||||
@ -77,9 +66,6 @@ public interface DlRepairTicketsMapper extends BaseMapper<DlRepairTickets> {
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
Map<String, Object> getStatistics(@Param("map") DlRepairTicketsReqVO repairTicketsReqVO);
|
Map<String, Object> getStatistics(@Param("map") DlRepairTicketsReqVO repairTicketsReqVO);
|
||||||
|
|
||||||
// 通用金额求和查询
|
|
||||||
List<Map<String, Object>> selectSumAmount(@Param("ew") QueryWrapper<DlRepairTickets> receivableWrapper);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -173,15 +172,6 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
|
|||||||
**/
|
**/
|
||||||
Map<String,Object> getBossNum(String selectType,String startDate,String endDate);
|
Map<String,Object> getBossNum(String selectType,String startDate,String endDate);
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author 许
|
|
||||||
* @Description 数据统计
|
|
||||||
* @Date 10:51 2025/9/1
|
|
||||||
* @Param [startDate, endDate]
|
|
||||||
* @return java.util.Map<java.lang.String,java.lang.Object>
|
|
||||||
**/
|
|
||||||
Map<String,Object> getBossNum(String startDate,String endDate);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务顾问通知客户取车
|
* 服务顾问通知客户取车
|
||||||
*
|
*
|
||||||
@ -328,13 +318,4 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
TicketsSettlementVO getSettlement(DlRepairTicketsReqVO repairTicketsReqVO);
|
TicketsSettlementVO getSettlement(DlRepairTicketsReqVO repairTicketsReqVO);
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author 许
|
|
||||||
* @Description 统计详情-细分工单类型
|
|
||||||
* @Date 14:15 2025/9/3
|
|
||||||
* @Param [startDate, endDate]
|
|
||||||
* @return java.util.List<java.util.Map>
|
|
||||||
**/
|
|
||||||
Map<String, Object> getBossNumStatistics(String startDate, String endDate);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,10 +66,8 @@ import cn.iocoder.yudao.module.tickets.vo.*;
|
|||||||
import cn.iocoder.yudao.util.CreateQRCodeUtil;
|
import cn.iocoder.yudao.util.CreateQRCodeUtil;
|
||||||
import cn.iocoder.yudao.util.SendSmsUtil;
|
import cn.iocoder.yudao.util.SendSmsUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
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.core.toolkit.Wrappers;
|
||||||
@ -887,223 +885,6 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
return approvalVO;
|
return approvalVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return java.util.List<java.util.Map>
|
|
||||||
* @Author 许
|
|
||||||
* @Description 统计详情-细分工单类型
|
|
||||||
* @Date 14:15 2025/9/3
|
|
||||||
* @Param [startDate, endDate]
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> getBossNumStatistics(String startDate, String endDate) {
|
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
|
||||||
List<Map<String, Object>> statsList = new ArrayList<>();
|
|
||||||
|
|
||||||
// 构建查询条件
|
|
||||||
QueryWrapper<DlRepairTickets> queryWrapper = new QueryWrapper<>();
|
|
||||||
|
|
||||||
if (startDate != null && endDate != null) {
|
|
||||||
// 如果有时间范围,添加时间条件
|
|
||||||
queryWrapper.between("create_time",
|
|
||||||
startDate + " 00:00:00",
|
|
||||||
endDate + " 23:59:59");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 根据条件查询工单
|
|
||||||
List<DlRepairTickets> ticketsInRange = this.list(queryWrapper);
|
|
||||||
|
|
||||||
// 维修中(按 repairType 分组)
|
|
||||||
Map<String, Long> workingStats = ticketsInRange.stream()
|
|
||||||
.filter(item -> TicketsStatusEnum.WORKING.getCode().equals(item.getTicketsStatus()))
|
|
||||||
.collect(Collectors.groupingBy(DlRepairTickets::getRepairType, Collectors.counting()));
|
|
||||||
statsList.add(createStatsNode("workingNum", "维修中", workingStats));
|
|
||||||
|
|
||||||
// 在厂(未交车且不是已完成状态 03)
|
|
||||||
Map<String, Long> inCompanyStats = ticketsInRange.stream()
|
|
||||||
.filter(item -> "0".equals(item.getIsHandover()))
|
|
||||||
.filter(item -> !"03".equals(item.getTicketsStatus()))
|
|
||||||
.collect(Collectors.groupingBy(DlRepairTickets::getRepairType, Collectors.counting()));
|
|
||||||
statsList.add(createStatsNode("inCompanyNum", "在厂", inCompanyStats));
|
|
||||||
|
|
||||||
// 未结算
|
|
||||||
List<String> noPayCodeList = Arrays.asList("04", "05", "07", "01");
|
|
||||||
Map<String, Long> noPayStats = ticketsInRange.stream()
|
|
||||||
.filter(item -> noPayCodeList.contains(item.getTicketsStatus()))
|
|
||||||
.collect(Collectors.groupingBy(DlRepairTickets::getRepairType, Collectors.counting()));
|
|
||||||
statsList.add(createStatsNode("noPayNum", "未结算", noPayStats));
|
|
||||||
|
|
||||||
// 进厂数(所有在范围内创建的)
|
|
||||||
Map<String, Long> newOrderStats = ticketsInRange.stream()
|
|
||||||
.collect(Collectors.groupingBy(DlRepairTickets::getRepairType, Collectors.counting()));
|
|
||||||
statsList.add(createStatsNode("newOrderNum", "进厂数", newOrderStats));
|
|
||||||
|
|
||||||
// 已完成(通过 mapper 查询并按 repairType 分组)
|
|
||||||
Map<String, Long> overStats = getOverStatsByRepairType(startDate, endDate);
|
|
||||||
statsList.add(createStatsNode("overNum", "已完成", overStats));
|
|
||||||
|
|
||||||
// 已交车(通过 mapper 查询并按 repairType 分组)
|
|
||||||
Map<String, Long> giveCusStats = getGiveCusStatsByRepairType(startDate, endDate);
|
|
||||||
statsList.add(createStatsNode("giveCusNum", "已交车", giveCusStats));
|
|
||||||
|
|
||||||
// 添加到结果map
|
|
||||||
resultMap.put("stats", statsList);
|
|
||||||
|
|
||||||
// 统计金额信息
|
|
||||||
Map<String, Object> amountStats = calculateAmountStats(startDate, endDate);
|
|
||||||
resultMap.putAll(amountStats);
|
|
||||||
|
|
||||||
return resultMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取已完成工单按维修类型分组的统计(优化版本)
|
|
||||||
private Map<String, Long> getOverStatsByRepairType(String startDate, String endDate) {
|
|
||||||
// 直接使用 mapper 查询已完成工单并按 repairType 分组
|
|
||||||
QueryWrapper<DlRepairTickets> queryWrapper = new QueryWrapper<>();
|
|
||||||
queryWrapper.ne("drt.tickets_status", "03"); // 已完成状态
|
|
||||||
|
|
||||||
if (startDate != null && endDate != null) {
|
|
||||||
queryWrapper.between("drt.create_time",
|
|
||||||
startDate + " 00:00:00",
|
|
||||||
endDate + " 23:59:59");
|
|
||||||
}
|
|
||||||
queryWrapper.eq("drr.type", RecordTypeEnum.ZJ.getCode());
|
|
||||||
|
|
||||||
// // 使用 group by 直接在数据库层面分组统计
|
|
||||||
// List<Map<String, Object>> result = repairTicketsMapper.selectMaps(
|
|
||||||
// queryWrapper.select("repair_type", "count(*) as count")
|
|
||||||
// .groupBy("repair_type")
|
|
||||||
// queryWrapper.getSqlSelect()
|
|
||||||
// );
|
|
||||||
|
|
||||||
// 使用 group by 直接在数据库层面分组统计
|
|
||||||
List<Map<String, Object>> result = repairTicketsMapper.selectTicketIdByParamsNew(
|
|
||||||
queryWrapper.select("repair_type", "count(*) as count")
|
|
||||||
.groupBy("repair_type")
|
|
||||||
);
|
|
||||||
|
|
||||||
return convertGroupResult(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取已交车工单按维修类型分组的统计(优化版本)
|
|
||||||
private Map<String, Long> getGiveCusStatsByRepairType(String startDate, String endDate) {
|
|
||||||
// 直接使用 mapper 查询已交车工单并按 repairType 分组
|
|
||||||
QueryWrapper<DlRepairTickets> queryWrapper = new QueryWrapper<>();
|
|
||||||
queryWrapper.eq("is_handover", "1"); // 已交车
|
|
||||||
|
|
||||||
if (startDate != null && endDate != null) {
|
|
||||||
queryWrapper.between("create_time",
|
|
||||||
startDate + " 00:00:00",
|
|
||||||
endDate + " 23:59:59");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 使用 group by 直接在数据库层面分组统计
|
|
||||||
List<Map<String, Object>> result = repairTicketsMapper.selectMaps(
|
|
||||||
queryWrapper.select("repair_type", "count(*) as count")
|
|
||||||
.groupBy("repair_type")
|
|
||||||
);
|
|
||||||
|
|
||||||
return convertGroupResult(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 转换分组查询结果
|
|
||||||
private Map<String, Long> convertGroupResult(List<Map<String, Object>> result) {
|
|
||||||
Map<String, Long> stats = new HashMap<>();
|
|
||||||
if (result != null) {
|
|
||||||
for (Map<String, Object> map : result) {
|
|
||||||
String repairType = (String) map.get("repair_type");
|
|
||||||
Long count = (Long) map.get("count");
|
|
||||||
if (repairType != null && count != null) {
|
|
||||||
stats.put(repairType, count);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return stats;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建统计节点的辅助方法
|
|
||||||
private Map<String, Object> createStatsNode(String code, String name, Map<String, Long> stats) {
|
|
||||||
Map<String, Object> node = new HashMap<>();
|
|
||||||
node.put("code", code);
|
|
||||||
node.put("name", name);
|
|
||||||
|
|
||||||
List<Map<String, Object>> children = stats.entrySet().stream()
|
|
||||||
.map(entry -> {
|
|
||||||
Map<String, Object> child = new HashMap<>();
|
|
||||||
child.put("repairType", entry.getKey());
|
|
||||||
child.put("count", entry.getValue());
|
|
||||||
return child;
|
|
||||||
})
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
node.put("children", children);
|
|
||||||
|
|
||||||
// 计算该统计项的总数
|
|
||||||
long total = stats.values().stream().mapToLong(Long::longValue).sum();
|
|
||||||
node.put("total", total);
|
|
||||||
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 计算金额统计
|
|
||||||
private Map<String, Object> calculateAmountStats(String startDate, String endDate) {
|
|
||||||
Map<String, Object> amountMap = new HashMap<>();
|
|
||||||
|
|
||||||
// 应收款:竣工已结算的单子的总金额
|
|
||||||
QueryWrapper<DlRepairTickets> receivableWrapper = new QueryWrapper<>();
|
|
||||||
// receivableWrapper.eq("tickets_status", "03");
|
|
||||||
|
|
||||||
if (startDate != null && endDate != null) {
|
|
||||||
receivableWrapper.between("drt.create_time",
|
|
||||||
startDate + " 00:00:00",
|
|
||||||
endDate + " 23:59:59");
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Map<String, Object>> receivables = repairTicketsMapper.selectSumAmount(receivableWrapper);
|
|
||||||
BigDecimal receivableAmount = BigDecimal.ZERO;
|
|
||||||
Integer receivableCount = 0;
|
|
||||||
BigDecimal receivedAmount = BigDecimal.ZERO;
|
|
||||||
Integer receivedCount = 0;
|
|
||||||
for (Map<String, Object> receivable : receivables) {
|
|
||||||
// 转换为TicketsSettlementVO
|
|
||||||
Object otherData = receivable.get("otherData");
|
|
||||||
TicketsSettlementVO settlement = JSONObject.parseObject(
|
|
||||||
otherData.toString(), TicketsSettlementVO.class
|
|
||||||
);
|
|
||||||
|
|
||||||
//计算实付金额的总和
|
|
||||||
BigDecimal actualMoney = settlement.getActualMoney();
|
|
||||||
receivableAmount = receivableAmount.add(actualMoney);
|
|
||||||
|
|
||||||
receivableCount++;
|
|
||||||
|
|
||||||
//判断是否是已经确认收款的
|
|
||||||
Object payType = receivable.get("payType");
|
|
||||||
if (payType != null && "03".equals(payType.toString())) {
|
|
||||||
// 计算已收款金额
|
|
||||||
BigDecimal isConfirmedReceive = settlement.getActualMoney();
|
|
||||||
receivedAmount = receivedAmount.add(isConfirmedReceive);
|
|
||||||
|
|
||||||
receivedCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
amountMap.put("receivableAmount", receivableAmount != null ? receivableAmount : BigDecimal.ZERO);
|
|
||||||
amountMap.put("receivableCount", receivableCount);
|
|
||||||
|
|
||||||
// 已收款:应收款里面出纳确认收款的金额
|
|
||||||
amountMap.put("receivedAmount", receivedAmount != null ? receivedAmount : BigDecimal.ZERO);
|
|
||||||
amountMap.put("receivedCount", receivedCount);
|
|
||||||
|
|
||||||
// 待收款:应收 - 已收
|
|
||||||
BigDecimal receivable = (BigDecimal) amountMap.get("receivableAmount");
|
|
||||||
BigDecimal received = (BigDecimal) amountMap.get("receivedAmount");
|
|
||||||
BigDecimal pendingAmount = receivable.subtract(received);
|
|
||||||
amountMap.put("pendingAmount", pendingAmount);
|
|
||||||
amountMap.put("pendingCount", receivableCount - receivedCount);
|
|
||||||
|
|
||||||
return amountMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户信息和车辆信息 新增、修改
|
* 客户信息和车辆信息 新增、修改
|
||||||
* @param customerAndCarVO 用户信息和车辆信息
|
* @param customerAndCarVO 用户信息和车辆信息
|
||||||
@ -2231,104 +2012,6 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
return rtnMap;
|
return rtnMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author 许
|
|
||||||
* @Description 数据统计
|
|
||||||
* @Date 10:51 2025/9/1
|
|
||||||
* @Param [startDate, endDate]
|
|
||||||
* @return java.util.Map<java.lang.String, java.lang.Object>
|
|
||||||
**/
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> getBossNum(String startDate, String endDate) {
|
|
||||||
Map<String, Object> rtnMap = new HashMap<>();
|
|
||||||
long workingNum = 0;
|
|
||||||
long inCompanyNum = 0;
|
|
||||||
long newOrderNum = 0;
|
|
||||||
long overNum = 0;
|
|
||||||
long giveCusNum = 0;
|
|
||||||
long noPayNum = 0;
|
|
||||||
|
|
||||||
List<String> workingIdList = new ArrayList<>();
|
|
||||||
List<String> inCompanyIdList = new ArrayList<>();
|
|
||||||
List<String> newOrderIdList = new ArrayList<>();
|
|
||||||
List<String> overIdList = new ArrayList<>();
|
|
||||||
List<String> giveCusIdList = new ArrayList<>();
|
|
||||||
List<String> noPayIdList = new ArrayList<>();
|
|
||||||
|
|
||||||
// 查询所有工单
|
|
||||||
List<DlRepairTickets> repairTickets = this.list();
|
|
||||||
if (!repairTickets.isEmpty()) {
|
|
||||||
List<DlRepairTickets> ticketsInRange = repairTickets;
|
|
||||||
|
|
||||||
// 只有当startDate和endDate都不为null时才进行时间过滤
|
|
||||||
if (startDate != null && endDate != null) {
|
|
||||||
// 时间范围
|
|
||||||
LocalDateTime startTime = LocalDateTime.parse(startDate + " 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
||||||
LocalDateTime endTime = LocalDateTime.parse(endDate + " 23:59:59", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
||||||
|
|
||||||
// 在时间范围内的工单
|
|
||||||
ticketsInRange = repairTickets.stream()
|
|
||||||
.filter(item -> {
|
|
||||||
LocalDateTime createTime = item.getCreateTime();
|
|
||||||
return (createTime.isEqual(startTime) || createTime.isAfter(startTime)) &&
|
|
||||||
(createTime.isEqual(endTime) || createTime.isBefore(endTime));
|
|
||||||
})
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 维修中
|
|
||||||
workingIdList = ticketsInRange.stream()
|
|
||||||
.filter(item -> TicketsStatusEnum.WORKING.getCode().equals(item.getTicketsStatus()))
|
|
||||||
.map(DlRepairTickets::getId).collect(Collectors.toList());
|
|
||||||
workingNum = workingIdList.size();
|
|
||||||
|
|
||||||
// 在厂(未交车且不是已完成状态 03)
|
|
||||||
inCompanyIdList = ticketsInRange.stream()
|
|
||||||
.filter(item -> "0".equals(item.getIsHandover()))
|
|
||||||
.filter(item -> !"03".equals(item.getTicketsStatus()))
|
|
||||||
.map(DlRepairTickets::getId).collect(Collectors.toList());
|
|
||||||
inCompanyNum = inCompanyIdList.size();
|
|
||||||
|
|
||||||
// 未结算
|
|
||||||
List<String> noPayCodeList = Arrays.asList("04", "05", "07", "01");
|
|
||||||
noPayIdList = ticketsInRange.stream()
|
|
||||||
.filter(item -> noPayCodeList.contains(item.getTicketsStatus()))
|
|
||||||
.map(DlRepairTickets::getId).collect(Collectors.toList());
|
|
||||||
noPayNum = noPayIdList.size();
|
|
||||||
|
|
||||||
// 进厂数(所有在范围内创建的)
|
|
||||||
newOrderIdList = ticketsInRange.stream().map(DlRepairTickets::getId).collect(Collectors.toList());
|
|
||||||
newOrderNum = newOrderIdList.size();
|
|
||||||
|
|
||||||
// 已完成(走 mapper 查记录)
|
|
||||||
overIdList = repairTicketsMapper.selectTicketIdByParams(null, RecordTypeEnum.ZJ.getCode(),
|
|
||||||
startDate != null ? startDate + " 00:00:00" : null,
|
|
||||||
endDate != null ? endDate + " 23:59:59" : null);
|
|
||||||
overNum = overIdList.size();
|
|
||||||
|
|
||||||
// 已交车(走 mapper 查记录)
|
|
||||||
giveCusIdList = repairTicketsMapper.selectTicketIdByParams(null, RecordTypeEnum.JC.getCode(),
|
|
||||||
startDate != null ? startDate + " 00:00:00" : null,
|
|
||||||
endDate != null ? endDate + " 23:59:59" : null);
|
|
||||||
giveCusNum = giveCusIdList.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
rtnMap.put("workingNum", workingNum);
|
|
||||||
rtnMap.put("workingIdList", workingIdList);
|
|
||||||
rtnMap.put("inCompanyNum", inCompanyNum);
|
|
||||||
rtnMap.put("inCompanyIdList", inCompanyIdList);
|
|
||||||
rtnMap.put("newOrderNum", newOrderNum);
|
|
||||||
rtnMap.put("newOrderIdList", newOrderIdList);
|
|
||||||
rtnMap.put("overNum", overNum);
|
|
||||||
rtnMap.put("overIdList", overIdList);
|
|
||||||
rtnMap.put("giveCusNum", giveCusNum);
|
|
||||||
rtnMap.put("giveCusIdList", giveCusIdList);
|
|
||||||
rtnMap.put("noPayNum", noPayNum);
|
|
||||||
rtnMap.put("noPayIdList", noPayIdList);
|
|
||||||
return rtnMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务顾问通知客户取车
|
* 服务顾问通知客户取车
|
||||||
* @param noticeCusVO 请求对象
|
* @param noticeCusVO 请求对象
|
||||||
|
|||||||
@ -135,16 +135,14 @@
|
|||||||
r.ticket_no AS bizNo,
|
r.ticket_no AS bizNo,
|
||||||
r.repair_type AS bizType,
|
r.repair_type AS bizType,
|
||||||
r.in_time AS bizTime,
|
r.in_time AS bizTime,
|
||||||
r.handle_name AS handleName,
|
|
||||||
'repair' AS source,
|
'repair' AS source,
|
||||||
'维修' AS sourceStr,
|
|
||||||
ROW_NUMBER() OVER (PARTITION BY c.id ORDER BY r.in_time DESC) AS rn
|
ROW_NUMBER() OVER (PARTITION BY c.id ORDER BY r.in_time DESC) AS rn
|
||||||
FROM base_customer_main c
|
FROM base_customer_main c
|
||||||
JOIN dl_repair_tickets r ON c.id = r.user_id
|
JOIN dl_repair_tickets r ON c.id = r.user_id
|
||||||
WHERE
|
WHERE
|
||||||
1 = 1 and c.deleted = 0
|
1 = 1 and c.deleted = 0
|
||||||
<if test="reqVO.dateRange != null">
|
<if test="reqVO.dateRange != null">
|
||||||
AND r.in_time BETWEEN CONCAT(#{reqVO.dateRange[0]}, ' 00:00:00') AND CONCAT(#{reqVO.dateRange[1]}, ' 23:59:59')
|
AND r.in_time BETWEEN #{reqVO.dateRange[0]} AND #{reqVO.dateRange[1]}
|
||||||
</if>
|
</if>
|
||||||
<if test="reqVO.search != null and reqVO.search != ''">
|
<if test="reqVO.search != null and reqVO.search != ''">
|
||||||
AND (c.cus_name LIKE CONCAT('%', #{reqVO.search}, '%')
|
AND (c.cus_name LIKE CONCAT('%', #{reqVO.search}, '%')
|
||||||
@ -152,7 +150,6 @@
|
|||||||
OR r.ticket_no LIKE CONCAT('%', #{reqVO.search}, '%')
|
OR r.ticket_no LIKE CONCAT('%', #{reqVO.search}, '%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
ORDER BY r.in_time DESC
|
|
||||||
<!--
|
<!--
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
@ -197,7 +194,6 @@
|
|||||||
r.repair_type AS bizType,
|
r.repair_type AS bizType,
|
||||||
r.create_time AS bizTime,
|
r.create_time AS bizTime,
|
||||||
'repair' AS source,
|
'repair' AS source,
|
||||||
'维修' AS sourceStr,
|
|
||||||
ROW_NUMBER() OVER (PARTITION BY car.id ORDER BY r.in_time DESC) AS rn
|
ROW_NUMBER() OVER (PARTITION BY car.id ORDER BY r.in_time DESC) AS rn
|
||||||
FROM base_car_main car
|
FROM base_car_main car
|
||||||
JOIN base_customer_car cc ON car.id = cc.car_id
|
JOIN base_customer_car cc ON car.id = cc.car_id
|
||||||
@ -227,7 +223,7 @@
|
|||||||
) t
|
) t
|
||||||
WHERE t.rn = 1
|
WHERE t.rn = 1
|
||||||
<if test="reqVO.dateRange != null">
|
<if test="reqVO.dateRange != null">
|
||||||
AND t.bizTime BETWEEN CONCAT(#{reqVO.dateRange[0]}, ' 00:00:00') AND CONCAT( #{reqVO.dateRange[1]}, ' 23:59:59')
|
AND t.biz_time BETWEEN #{reqVO.dateRange[0]} AND #{reqVO.dateRange[1]}
|
||||||
</if>
|
</if>
|
||||||
<if test="reqVO.search != null and reqVO.search != ''">
|
<if test="reqVO.search != null and reqVO.search != ''">
|
||||||
AND (t.customerName LIKE CONCAT('%', #{reqVO.search}, '%')
|
AND (t.customerName LIKE CONCAT('%', #{reqVO.search}, '%')
|
||||||
@ -235,20 +231,5 @@
|
|||||||
OR t.carNum LIKE CONCAT('%', #{reqVO.search}, '%')
|
OR t.carNum LIKE CONCAT('%', #{reqVO.search}, '%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
ORDER BY t.bizTime DESC
|
|
||||||
</select>
|
|
||||||
<select id="pageByCustomerOrCar" resultType="cn.iocoder.yudao.module.base.vo.QueryTableResp">
|
|
||||||
SELECT drt.*, '维修' AS sourceStr
|
|
||||||
FROM dl_repair_tickets drt
|
|
||||||
WHERE 1=1
|
|
||||||
<if test="reqVO.dateRange != null">
|
|
||||||
AND DATE(drt.create_time) BETWEEN #{reqVO.dateRange[0]} AND #{reqVO.dateRange[1]}
|
|
||||||
</if>
|
|
||||||
<if test="reqVO.phone != null and reqVO.phone != ''">
|
|
||||||
AND drt.user_mobile LIKE CONCAT('%', #{reqVO.phone}, '%')
|
|
||||||
</if>
|
|
||||||
<if test="reqVO.carNo != null and reqVO.carNo != ''">
|
|
||||||
AND drt.car_no LIKE CONCAT('%', #{reqVO.carNo}, '%')
|
|
||||||
</if>
|
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -647,23 +647,4 @@
|
|||||||
</if>
|
</if>
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<select id="selectSumAmount">
|
|
||||||
select drr.other_data as otherData, drt.pay_status as payType
|
|
||||||
FROM dl_repair_tickets drt
|
|
||||||
JOIN dl_repair_records drr ON drt.id = drr.ticket_id
|
|
||||||
<where>drt.deleted = 0 and drr.deleted = 0 and drr.type = 'jssp'
|
|
||||||
<if test="ew != null and ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
|
||||||
AND ${ew.sqlSegment}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="selectTicketIdByParamsNew" resultType="java.util.Map">
|
|
||||||
SELECT ${ew.sqlSelect}
|
|
||||||
FROM dl_repair_tickets drt
|
|
||||||
LEFT JOIN dl_repair_records drr ON drt.id = drr.ticket_id
|
|
||||||
where 1=1
|
|
||||||
<if test="ew != null and ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
|
||||||
AND ${ew.sqlSegment}
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user