diff --git a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/app/controller/admin/RescueInfoController.java b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/app/controller/admin/RescueInfoController.java index 1cb92ee9..40e4bd5d 100644 --- a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/app/controller/admin/RescueInfoController.java +++ b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/app/controller/admin/RescueInfoController.java @@ -11,6 +11,7 @@ import cn.iocoder.yudao.module.rescue.domain.RescueInfo; import cn.iocoder.yudao.module.rescue.dto.DriverInfo2Dto; import cn.iocoder.yudao.module.rescue.dto.DriverInfoDto; import cn.iocoder.yudao.module.rescue.service.IRescueInfoService; +import cn.iocoder.yudao.module.rescue.vo.StatisticsStaffVO; import cn.iocoder.yudao.module.system.api.permission.PermissionApi; import cn.iocoder.yudao.module.system.api.permission.RoleApi; import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO; @@ -379,4 +380,13 @@ public class RescueInfoController extends BaseController { } + /** + * 获取统计数据 + */ + @GetMapping("/statisticsAll") + public CommonResult statisticsAll(StatisticsStaffVO statisticsStaffReqVO) { + return success(rescueInfoService.statisticsAll(statisticsStaffReqVO)); + } + + } diff --git a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/mapper/RescueInfoMapper.java b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/mapper/RescueInfoMapper.java index a85911a0..211e01f9 100644 --- a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/mapper/RescueInfoMapper.java +++ b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/mapper/RescueInfoMapper.java @@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.rescue.dto.DriverInfoDto; import cn.iocoder.yudao.module.rescue.vo.BuckleVO; import cn.iocoder.yudao.module.rescue.vo.DriverInfoExportVO; import cn.iocoder.yudao.module.rescue.vo.DriverStaffSaveVO; +import cn.iocoder.yudao.module.rescue.vo.StatisticsStaffVO; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.mapper.BaseMapper; @@ -105,4 +106,8 @@ public interface RescueInfoMapper extends BaseMapper List getAll(@Param("entity") DriverInfoDto query); void revokeRescueInfo(@Param("id") Long id, @Param("userId") Long userId, @Param("userName") String userName, @Param("time") Date time); + + List driverStatistics(@Param("vo") StatisticsStaffVO statisticsStaffReqVO); + List carStatistics(@Param("vo") StatisticsStaffVO statisticsStaffReqVO); + List dispatchStatistics(@Param("vo") StatisticsStaffVO statisticsStaffReqVO); } diff --git a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/service/IRescueInfoService.java b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/service/IRescueInfoService.java index 1f3681c1..77501b3c 100644 --- a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/service/IRescueInfoService.java +++ b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/service/IRescueInfoService.java @@ -195,4 +195,6 @@ public interface IRescueInfoService extends IService List getAll(DriverInfoDto query); Long safeStringToLong(String str, Long defaultValue); + + List statisticsAll(StatisticsStaffVO statisticsStaffReqVO); } diff --git a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/service/impl/RescueInfoServiceImpl.java b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/service/impl/RescueInfoServiceImpl.java index d151083b..7e75d0af 100644 --- a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/service/impl/RescueInfoServiceImpl.java +++ b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/service/impl/RescueInfoServiceImpl.java @@ -2774,6 +2774,44 @@ public class RescueInfoServiceImpl extends ServiceImpl statisticsAll(StatisticsStaffVO statisticsStaffReqVO) { + List statisticsStaffVOS = new ArrayList<>(); + + if (statisticsStaffReqVO == null || statisticsStaffReqVO.getQueryType() == null) { + return statisticsStaffVOS; + } + + String queryType = statisticsStaffReqVO.getQueryType(); + switch (queryType) { + case "driver": + statisticsStaffVOS.addAll(this.driverStatistics(statisticsStaffReqVO)); + break; + case "car": + statisticsStaffVOS.addAll(this.carStatistics(statisticsStaffReqVO)); + break; + case "dispatch": + statisticsStaffVOS.addAll(this.dispatchStatistics(statisticsStaffReqVO)); + break; + default: + break; + } + + return statisticsStaffVOS; + } + + public List driverStatistics(StatisticsStaffVO statisticsStaffReqVO) { + return baseMapper.driverStatistics(statisticsStaffReqVO); + } + + public List carStatistics(StatisticsStaffVO statisticsStaffReqVO) { + return baseMapper.carStatistics(statisticsStaffReqVO); + } + + public List dispatchStatistics(StatisticsStaffVO statisticsStaffReqVO) { + return baseMapper.dispatchStatistics(statisticsStaffReqVO); + } + public List filterRescueInfoByDate(List rescueInfos, Date startTime, Date endTime) { return rescueInfos.stream() .filter(info -> info.getRescueTime() != null && diff --git a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/vo/StatisticsStaffVO.java b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/vo/StatisticsStaffVO.java new file mode 100644 index 00000000..3d5ab54c --- /dev/null +++ b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/vo/StatisticsStaffVO.java @@ -0,0 +1,78 @@ +package cn.iocoder.yudao.module.rescue.vo; + +import lombok.Data; + +@Data +public class StatisticsStaffVO { + + /** + * 用户id + */ + private Long userId; + + /** + * 二级调度id,查询使用 + */ + private Long secondUserId; + + /** + * 头像 + */ + private String avatar; + + /** + * 司机姓名 + */ + private String driverName; + + /** + * 司机id + */ + private Long driverId; + + /** + * 救援数量 + */ + private String rescueNum; + + /** + * 行驶里程 + */ + private String mileage; + + /** + * 金额 + */ + private String money; + + /** + * 车牌号 + */ + private String driverCarNum; + + /** + * 创建救援工单数 + */ + private String createRescueNum; + + /** + * 到场数量 + */ + private String toSceneNum; + + /** + * 转维修数量 + */ + private String toRepairNum; + + /** + * 确认完成数量 + */ + private String confirmCompleteNum; + + /** + * 查询类型 + */ + private String queryType; + +} diff --git a/dl-module-rescue/src/main/resources/mapper/rescue/RescueInfoMapper.xml b/dl-module-rescue/src/main/resources/mapper/rescue/RescueInfoMapper.xml index 8c4394d8..181d16b5 100644 --- a/dl-module-rescue/src/main/resources/mapper/rescue/RescueInfoMapper.xml +++ b/dl-module-rescue/src/main/resources/mapper/rescue/RescueInfoMapper.xml @@ -1036,4 +1036,71 @@ + + + + + +