Compare commits
2 Commits
b5771bd801
...
8c3bff1b24
Author | SHA1 | Date | |
---|---|---|---|
8c3bff1b24 | |||
34c22f6240 |
@ -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.DriverInfo2Dto;
|
||||||
import cn.iocoder.yudao.module.rescue.dto.DriverInfoDto;
|
import cn.iocoder.yudao.module.rescue.dto.DriverInfoDto;
|
||||||
import cn.iocoder.yudao.module.rescue.service.IRescueInfoService;
|
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.PermissionApi;
|
||||||
import cn.iocoder.yudao.module.system.api.permission.RoleApi;
|
import cn.iocoder.yudao.module.system.api.permission.RoleApi;
|
||||||
import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO;
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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.BuckleVO;
|
||||||
import cn.iocoder.yudao.module.rescue.vo.DriverInfoExportVO;
|
import cn.iocoder.yudao.module.rescue.vo.DriverInfoExportVO;
|
||||||
import cn.iocoder.yudao.module.rescue.vo.DriverStaffSaveVO;
|
import cn.iocoder.yudao.module.rescue.vo.DriverStaffSaveVO;
|
||||||
|
import cn.iocoder.yudao.module.rescue.vo.StatisticsStaffVO;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
@ -105,4 +106,8 @@ public interface RescueInfoMapper extends BaseMapper<RescueInfo>
|
|||||||
List<DriverInfoExportVO> getAll(@Param("entity") DriverInfoDto query);
|
List<DriverInfoExportVO> getAll(@Param("entity") DriverInfoDto query);
|
||||||
|
|
||||||
void revokeRescueInfo(@Param("id") Long id, @Param("userId") Long userId, @Param("userName") String userName, @Param("time") Date time);
|
void revokeRescueInfo(@Param("id") Long id, @Param("userId") Long userId, @Param("userName") String userName, @Param("time") Date time);
|
||||||
|
|
||||||
|
List<StatisticsStaffVO> driverStatistics(@Param("vo") StatisticsStaffVO statisticsStaffReqVO);
|
||||||
|
List<StatisticsStaffVO> carStatistics(@Param("vo") StatisticsStaffVO statisticsStaffReqVO);
|
||||||
|
List<StatisticsStaffVO> dispatchStatistics(@Param("vo") StatisticsStaffVO statisticsStaffReqVO);
|
||||||
}
|
}
|
||||||
|
@ -195,4 +195,6 @@ public interface IRescueInfoService extends IService<RescueInfo>
|
|||||||
List<DriverInfoExportVO> getAll(DriverInfoDto query);
|
List<DriverInfoExportVO> getAll(DriverInfoDto query);
|
||||||
|
|
||||||
Long safeStringToLong(String str, Long defaultValue);
|
Long safeStringToLong(String str, Long defaultValue);
|
||||||
|
|
||||||
|
List<StatisticsStaffVO> statisticsAll(StatisticsStaffVO statisticsStaffReqVO);
|
||||||
}
|
}
|
||||||
|
@ -2774,6 +2774,44 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StatisticsStaffVO> statisticsAll(StatisticsStaffVO statisticsStaffReqVO) {
|
||||||
|
List<StatisticsStaffVO> 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<StatisticsStaffVO> driverStatistics(StatisticsStaffVO statisticsStaffReqVO) {
|
||||||
|
return baseMapper.driverStatistics(statisticsStaffReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<StatisticsStaffVO> carStatistics(StatisticsStaffVO statisticsStaffReqVO) {
|
||||||
|
return baseMapper.carStatistics(statisticsStaffReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<StatisticsStaffVO> dispatchStatistics(StatisticsStaffVO statisticsStaffReqVO) {
|
||||||
|
return baseMapper.dispatchStatistics(statisticsStaffReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
public List<RescueInfo> filterRescueInfoByDate(List<RescueInfo> rescueInfos, Date startTime, Date endTime) {
|
public List<RescueInfo> filterRescueInfoByDate(List<RescueInfo> rescueInfos, Date startTime, Date endTime) {
|
||||||
return rescueInfos.stream()
|
return rescueInfos.stream()
|
||||||
.filter(info -> info.getRescueTime() != null &&
|
.filter(info -> info.getRescueTime() != null &&
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
}
|
@ -1036,4 +1036,71 @@
|
|||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="driverStatistics" parameterType="cn.iocoder.yudao.module.rescue.vo.StatisticsStaffVO"
|
||||||
|
resultType="cn.iocoder.yudao.module.rescue.vo.StatisticsStaffVO">
|
||||||
|
SELECT
|
||||||
|
su.id AS userId,
|
||||||
|
su.avatar,
|
||||||
|
ri.driver_name,
|
||||||
|
ri.driver_id,
|
||||||
|
COUNT(ri.id) AS rescueNum,
|
||||||
|
SUM(ri.end_scale - ri.start_scale) AS mileage,
|
||||||
|
SUM(roi.set_money) AS money
|
||||||
|
FROM rescue_info ri
|
||||||
|
INNER JOIN driver_info di ON ri.driver_id = di.id AND di.deleted = 0
|
||||||
|
INNER JOIN system_users su ON di.user_id = su.id AND su.deleted = 0
|
||||||
|
INNER JOIN rescue_order_info roi ON roi.rescue_info_id = ri.id AND roi.deleted = 0
|
||||||
|
WHERE ri.deleted = 0
|
||||||
|
AND ri.driver_name IS NOT NULL
|
||||||
|
AND ri.driver_id IS NOT NULL
|
||||||
|
GROUP BY
|
||||||
|
su.id,
|
||||||
|
ri.driver_name,
|
||||||
|
ri.driver_id
|
||||||
|
ORDER BY rescueNum DESC
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="carStatistics" parameterType="cn.iocoder.yudao.module.rescue.vo.StatisticsStaffVO"
|
||||||
|
resultType="cn.iocoder.yudao.module.rescue.vo.StatisticsStaffVO">
|
||||||
|
SELECT
|
||||||
|
ri.driver_car_num,
|
||||||
|
COUNT( ri.id ) AS rescueNum,
|
||||||
|
SUM( ri.end_scale - ri.start_scale ) AS mileage,
|
||||||
|
SUM( roi.set_money ) AS money
|
||||||
|
FROM
|
||||||
|
rescue_info ri
|
||||||
|
INNER JOIN rescue_car_info rci ON rci.rescue_car_num = ri.driver_car_num
|
||||||
|
AND rci.deleted = 0
|
||||||
|
INNER JOIN rescue_order_info roi ON roi.rescue_info_id = ri.id
|
||||||
|
AND roi.deleted = 0
|
||||||
|
WHERE
|
||||||
|
ri.deleted = 0
|
||||||
|
GROUP BY
|
||||||
|
ri.driver_car_num
|
||||||
|
ORDER BY
|
||||||
|
rescueNum DESC
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="dispatchStatistics" parameterType="cn.iocoder.yudao.module.rescue.vo.StatisticsStaffVO"
|
||||||
|
resultType="cn.iocoder.yudao.module.rescue.vo.StatisticsStaffVO">
|
||||||
|
SELECT
|
||||||
|
u.id AS userId,
|
||||||
|
u.nickname AS driverName,
|
||||||
|
COUNT(r.id) AS createRescueNum,
|
||||||
|
SUM(CASE WHEN r.is_dispatched_to_scene = '1' THEN 1 ELSE 0 END) AS toSceneNum,
|
||||||
|
SUM(CASE WHEN r.is_wei_xiu = '1' THEN 1 ELSE 0 END) AS toRepairNum,
|
||||||
|
SUM(CASE WHEN r.rescue_status = '7' THEN 1 ELSE 0 END) AS confirmCompleteNum
|
||||||
|
FROM
|
||||||
|
rescue_info r
|
||||||
|
INNER JOIN system_users u ON u.id = r.creator AND u.deleted = 0
|
||||||
|
WHERE
|
||||||
|
r.deleted = 0
|
||||||
|
GROUP BY
|
||||||
|
u.id, u.nickname
|
||||||
|
HAVING
|
||||||
|
COUNT(r.id) > 0
|
||||||
|
ORDER BY
|
||||||
|
createRescueNum DESC;
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
Loading…
Reference in New Issue
Block a user