This commit is contained in:
Lx 2025-09-30 10:10:33 +08:00
parent 8c3bff1b24
commit 6e3f274688
12 changed files with 852 additions and 35 deletions

View File

@ -388,5 +388,78 @@ public class RescueInfoController extends BaseController {
return success(rescueInfoService.statisticsAll(statisticsStaffReqVO));
}
@GetMapping("/statisticsAllSecond")
public CommonResult statisticsAllSecond(StatisticsStaffVO statisticsStaffReqVO) {
return success(rescueInfoService.statisticsAllSecond(statisticsStaffReqVO));
}
/**
* App首页数据统计工单列表数据
*/
@GetMapping("/getRescueStatisticsInfoList")
public CommonResult getRescueStatisticsInfoList(RescueInfo rescueInfo,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
Page<RescueInfo> page = new Page<>(pageNum, pageSize);
//获取当前登录用户
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
AdminUserRespDTO user = userService.getUser(loginUser.getId());
List<Long> roleIds = permissionApi.getRoleIdsByUserId(user.getId());
List<RoleReqDTO> roleList = roleApi.getRoleList();
List<RoleReqDTO> roles = roleList.stream().filter(item -> roleIds.contains(item.getId())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(roles)) {
for (RoleReqDTO role : roles) {
//如果是调度中心
if (role.getCode().equals("admin") || role.getCode().equals("ddzx") || role.getCode().equals("qt") || role.getCode().equals("kj") || role.getCode().equals("cn") || role.getCode().equals("car_safekeeping")) {
IPage<RescueInfo> rescueInfos = rescueInfoService.selectRescueStatisticsInfoListByAdmin(rescueInfo, page);
return success(rescueInfos);
}
}
}
if (CollectionUtil.isNotEmpty(roles)) {
for (RoleReqDTO role : roles) {
//如果是二级调度
if (role.getCode().equals("second_dispatcher")) {
rescueInfo.setUserId(user.getId());
IPage<RescueInfo> rescueInfos = rescueInfoService.selectRescueStatisticsInfoListBySecondDispatcher(rescueInfo, page);
return success(rescueInfos);
}
}
}
IPage<RescueInfo> rescueInfos = rescueInfoService.selectRescueInfoList(rescueInfo, page);
return success(rescueInfos);
}
@GetMapping("/getRescueStatisticsInfoNum")
public CommonResult getRescueStatisticsInfoNum(RescueInfo rescueInfo) {
//获取当前登录用户
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
AdminUserRespDTO user = userService.getUser(loginUser.getId());
List<Long> roleIds = permissionApi.getRoleIdsByUserId(user.getId());
List<RoleReqDTO> roleList = roleApi.getRoleList();
List<RoleReqDTO> roles = roleList.stream().filter(item -> roleIds.contains(item.getId())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(roles)) {
for (RoleReqDTO role : roles) {
//如果是调度中心
if (role.getCode().equals("admin") || role.getCode().equals("ddzx") || role.getCode().equals("qt") || role.getCode().equals("kj") || role.getCode().equals("cn") || role.getCode().equals("car_safekeeping")) {
Map<String, Object> rescueInfoNum = rescueInfoService.getRescueStatisticsInfoNum(rescueInfo);
return success(rescueInfoNum);
}
}
}
if (CollectionUtil.isNotEmpty(roles)) {
for (RoleReqDTO role : roles) {
//如果是二级调度
if (role.getCode().equals("second_dispatcher")) {
rescueInfo.setUserId(user.getId());
Map<String, Object> rescueInfoNum = rescueInfoService.getRescueStatisticsInfoNumSecondDispatcher(rescueInfo);
return success(rescueInfoNum);
}
}
}
return success(null);
}
}

View File

@ -1,11 +1,57 @@
package cn.iocoder.yudao.module.rescue.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.rescue.core.controller.BaseController;
import cn.iocoder.yudao.module.rescue.domain.DriverInfo;
import cn.iocoder.yudao.module.rescue.domain.RescueCarInfo;
import cn.iocoder.yudao.module.rescue.service.IDriverInfoService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping("/system/DriverInfo")
public class DriverInfoController extends BaseController {
@Resource
private IDriverInfoService driverInfoService;
/**
* 获取司机完整列表
*/
@GetMapping("/listDriverInfo")
public CommonResult listDriverInfo() {
List<DriverInfo> driverInfoList = driverInfoService.listDriverInfo();
return success(driverInfoList);
}
/**
* 获取司机完整列表
*/
@GetMapping("/listCarInfo")
public CommonResult listCarInfo() {
List<RescueCarInfo> carInfoList = driverInfoService.listCarInfo();
return success(carInfoList);
}
/**
* 二级调度获取司机列表
*/
@GetMapping("/listDriverInfoSecond")
public CommonResult listDriverInfoSecond() {
List<DriverInfo> driverInfoList = driverInfoService.listDriverInfoSecond();
return success(driverInfoList);
}
/**
* 二级调度获取车辆列表
*/
@GetMapping("/listCarInfoSecond")
public CommonResult listCarInfoSecond() {
List<RescueCarInfo> carInfoList = driverInfoService.listCarInfoSecond();
return success(carInfoList);
}
}

View File

@ -3,8 +3,10 @@ package cn.iocoder.yudao.module.rescue.mapper;
import cn.iocoder.yudao.module.rescue.domain.DriverInfo;
import cn.iocoder.yudao.module.rescue.domain.RescueCarInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -12,7 +14,7 @@ import java.util.List;
/**
* 请填写功能名称Mapper接口
*
*
* @author ruoyi
* @date 2023-07-18
*/
@ -21,7 +23,7 @@ public interface DriverInfoMapper extends BaseMapper<DriverInfo>
{
/**
* 查询请填写功能名称
*
*
* @param id 请填写功能名称主键
* @return 请填写功能名称
*/
@ -29,7 +31,7 @@ public interface DriverInfoMapper extends BaseMapper<DriverInfo>
/**
* 查询请填写功能名称列表
*
*
* @param driverInfo 请填写功能名称
* @return 请填写功能名称集合
*/
@ -37,7 +39,7 @@ public interface DriverInfoMapper extends BaseMapper<DriverInfo>
/**
* 新增请填写功能名称
*
*
* @param driverInfo 请填写功能名称
* @return 结果
*/
@ -45,7 +47,7 @@ public interface DriverInfoMapper extends BaseMapper<DriverInfo>
/**
* 修改请填写功能名称
*
*
* @param driverInfo 请填写功能名称
* @return 结果
*/
@ -53,7 +55,7 @@ public interface DriverInfoMapper extends BaseMapper<DriverInfo>
/**
* 删除请填写功能名称
*
*
* @param id 请填写功能名称主键
* @return 结果
*/
@ -61,9 +63,33 @@ public interface DriverInfoMapper extends BaseMapper<DriverInfo>
/**
* 批量删除请填写功能名称
*
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteDriverInfoByIds(Long[] ids);
/**
* 获取司机列表
* @return
*/
List<DriverInfo> listDriverInfo();
/**
* 获取车辆列表
* @return
*/
List<RescueCarInfo> listCarInfo();
/**
* 二级调度获取司机
* @return
*/
List<DriverInfo> listDriverInfoSecond(@Param("userId") Long userId);
/**
* 二级调度获取车辆
* @return
*/
List<RescueCarInfo> listCarInfoSecond(@Param("userId") Long userId);
}

View File

@ -110,4 +110,20 @@ public interface RescueInfoMapper extends BaseMapper<RescueInfo>
List<StatisticsStaffVO> driverStatistics(@Param("vo") StatisticsStaffVO statisticsStaffReqVO);
List<StatisticsStaffVO> carStatistics(@Param("vo") StatisticsStaffVO statisticsStaffReqVO);
List<StatisticsStaffVO> dispatchStatistics(@Param("vo") StatisticsStaffVO statisticsStaffReqVO);
IPage<RescueInfo> selectRescueStatisticsInfoList(@Param("map") RescueInfo rescueInfo, Page<RescueInfo> page);
IPage<RescueInfo> selectRescueStatisticsInfoListSecondDispatcher(@Param("map") RescueInfo rescueInfo, Page<RescueInfo> page);
/**
* 数据统计中使用
* @param rescueInfo
* @return
*/
Map<String,Object> getRescueStatisticsInfoNum(@Param("map") RescueInfo rescueInfo);
Map<String,Object> getRescueStatisticsInfoNumSecondDispatcher(@Param("map") RescueInfo rescueInfo);
List<StatisticsStaffVO> driverStatisticsSecond(@Param("vo") StatisticsStaffVO statisticsStaffReqVO);
List<StatisticsStaffVO> carStatisticsSecond(@Param("vo") StatisticsStaffVO statisticsStaffReqVO);
}

View File

@ -1,13 +1,14 @@
package cn.iocoder.yudao.module.rescue.service;
import cn.iocoder.yudao.module.rescue.domain.DriverInfo;
import cn.iocoder.yudao.module.rescue.domain.RescueCarInfo;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* 请填写功能名称Service接口
*
*
* @author ruoyi
* @date 2023-07-18
*/
@ -15,7 +16,7 @@ public interface IDriverInfoService extends IService<DriverInfo>
{
/**
* 查询请填写功能名称
*
*
* @param id 请填写功能名称主键
* @return 请填写功能名称
*/
@ -23,7 +24,7 @@ public interface IDriverInfoService extends IService<DriverInfo>
/**
* 查询请填写功能名称列表
*
*
* @param driverInfo 请填写功能名称
* @return 请填写功能名称集合
*/
@ -31,7 +32,7 @@ public interface IDriverInfoService extends IService<DriverInfo>
/**
* 新增请填写功能名称
*
*
* @param driverInfo 请填写功能名称
* @return 结果
*/
@ -39,7 +40,7 @@ public interface IDriverInfoService extends IService<DriverInfo>
/**
* 修改请填写功能名称
*
*
* @param driverInfo 请填写功能名称
* @return 结果
*/
@ -47,7 +48,7 @@ public interface IDriverInfoService extends IService<DriverInfo>
/**
* 批量删除请填写功能名称
*
*
* @param ids 需要删除的请填写功能名称主键集合
* @return 结果
*/
@ -55,7 +56,7 @@ public interface IDriverInfoService extends IService<DriverInfo>
/**
* 删除请填写功能名称信息
*
*
* @param id 请填写功能名称主键
* @return 结果
*/
@ -69,4 +70,25 @@ public interface IDriverInfoService extends IService<DriverInfo>
**/
void syncData();
/**
* 获取司机完整列表
*/
List<DriverInfo> listDriverInfo();
/**
* 获取救援车辆完整列表
*/
List<RescueCarInfo> listCarInfo();
/**
* 二级调度获取司机列表
*/
List<DriverInfo> listDriverInfoSecond();
/**
* 二级调度获取车辆列表
*/
List<RescueCarInfo> listCarInfoSecond();
}

View File

@ -62,4 +62,5 @@ public interface IRescueDriverInfoService extends IService<RescueDriverInfo>
* 根据救援工单id获取指派司机列表
*/
List<DriverInfo> listDispatchDriverByRescueId(Long rescueId);
}

View File

@ -197,4 +197,11 @@ public interface IRescueInfoService extends IService<RescueInfo>
Long safeStringToLong(String str, Long defaultValue);
List<StatisticsStaffVO> statisticsAll(StatisticsStaffVO statisticsStaffReqVO);
List<StatisticsStaffVO> statisticsAllSecond(StatisticsStaffVO statisticsStaffReqVO);
IPage<RescueInfo> selectRescueStatisticsInfoListByAdmin(RescueInfo rescueInfo, Page<RescueInfo> page);
IPage<RescueInfo> selectRescueStatisticsInfoListBySecondDispatcher(RescueInfo rescueInfo, Page<RescueInfo> page);
Map<String, Object> getRescueStatisticsInfoNum(RescueInfo rescueInfo);
Map<String, Object> getRescueStatisticsInfoNumSecondDispatcher(RescueInfo rescueInfo);
}

View File

@ -3,7 +3,9 @@ package cn.iocoder.yudao.module.rescue.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.common.CommonErrorCodeConstants;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.rescue.domain.DriverInfo;
import cn.iocoder.yudao.module.rescue.domain.RescueCarInfo;
import cn.iocoder.yudao.module.rescue.service.IDriverInfoService;
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
import cn.iocoder.yudao.module.staff.service.CompanyStaffService;
@ -23,6 +25,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@ -186,4 +189,41 @@ public class DriverInfoServiceImpl extends ServiceImpl<DriverInfoMapper, DriverI
}
staffService.save(staff);
}
/**
* 获取司机完整列表
*/
@Override
public List<DriverInfo> listDriverInfo() {
return baseMapper.listDriverInfo();
}
/**
* 获取车辆完整列表
*/
@Override
public List<RescueCarInfo> listCarInfo() {
return baseMapper.listCarInfo();
}
/**
* 二级调度获取司机
* @return
*/
@Override
public List<DriverInfo> listDriverInfoSecond() {
Long userId = SecurityFrameworkUtils.getLoginUserId();
return baseMapper.listDriverInfoSecond(userId);
}
/**
* 二级调度获取车辆
* @return
*/
@Override
public List<RescueCarInfo> listCarInfoSecond() {
Long userId = SecurityFrameworkUtils.getLoginUserId();
return baseMapper.listCarInfoSecond(userId);
}
}

View File

@ -1004,4 +1004,5 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
}
}

View File

@ -2260,9 +2260,15 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
moneyManagement.setUpMoney(tempSetMoney - tempCheckpointMoney);
moneyManagement.setEmptyingDistance(info.getEmptyNum());
String carType = "3";
if (StringUtils.isNotEmpty(info.getDriverCarNum())) {
/*if (StringUtils.isNotEmpty(info.getDriverCarNum())) {
RescueCarInfo carInfo = carInfoService.selectRescueCarInfoByNum(info.getDriverCarNum());
carType = carInfo.getRescueCarType();
}*/
if (StringUtils.isNotEmpty(info.getDriverCarNum())) {
RescueCarInfo carInfo = carInfoService.selectRescueCarInfoByNum(info.getDriverCarNum());
if (carInfo != null && StringUtils.isNotEmpty(carInfo.getRescueCarType())) {
carType = carInfo.getRescueCarType();
}
}
if (carType.equals("1")) {
@ -2800,6 +2806,96 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
return statisticsStaffVOS;
}
@Override
public List<StatisticsStaffVO> statisticsAllSecond(StatisticsStaffVO statisticsStaffReqVO) {
List<StatisticsStaffVO> statisticsStaffVOS = new ArrayList<>();
if (statisticsStaffReqVO == null || statisticsStaffReqVO.getQueryType() == null) {
return statisticsStaffVOS;
}
Long userId = SecurityFrameworkUtils.getLoginUserId();
statisticsStaffReqVO.setSecondUserId(userId);
String queryType = statisticsStaffReqVO.getQueryType();
switch (queryType) {
case "driver":
statisticsStaffVOS.addAll(this.driverStatisticsSecond(statisticsStaffReqVO));
break;
case "car":
statisticsStaffVOS.addAll(this.carStatisticsSecond(statisticsStaffReqVO));
break;
default:
break;
}
return statisticsStaffVOS;
}
@Override
public IPage<RescueInfo> selectRescueStatisticsInfoListByAdmin(RescueInfo rescueInfo, Page<RescueInfo> page) {
LoginUser user = getLoginUser();
AdminUserRespDTO adminUser = userService.getUser(user.getId());
rescueInfo.setDeptList(buildDeptList(adminUser.getDeptId()));
String startTime = "";
String endTime = "";
if ("more".equals(rescueInfo.getTimeType())) {
if (org.apache.commons.lang3.StringUtils.isNotEmpty(rescueInfo.getStartTimeStr())) {
startTime = rescueInfo.getStartTimeStr() + " 00:00:01";
}
if (org.apache.commons.lang3.StringUtils.isNotEmpty(rescueInfo.getEndTimeStr())) {
endTime = rescueInfo.getEndTimeStr() + " 23:59:59";
}
} else if ("month".equals(rescueInfo.getTimeType())) {
//当月
startTime = DateUtil.format(DateUtil.beginOfMonth(DateUtil.date()), "yyyy-MM-dd") + " 00:00:01";
endTime = DateUtil.format(DateUtil.endOfMonth(DateUtil.date()), "yyyy-MM-dd") + " 23:59:59";
} else if ("day".equals(rescueInfo.getTimeType())) {
//当天
startTime = DateUtil.formatDate(DateUtil.date()) + " 00:00:01";
endTime = DateUtil.formatDate(DateUtil.date()) + " 23:59:59";
}
rescueInfo.setStartTimeStr(startTime);
rescueInfo.setEndTimeStr(endTime);
IPage<RescueInfo> rescueInfos = baseMapper.selectRescueStatisticsInfoList(rescueInfo, page);
processRescueInfoRecords(rescueInfos, user, false);
return rescueInfos;
}
@Override
public IPage<RescueInfo> selectRescueStatisticsInfoListBySecondDispatcher(RescueInfo rescueInfo, Page<RescueInfo> page) {
LoginUser user = getLoginUser();
AdminUserRespDTO adminUser = userService.getUser(user.getId());
rescueInfo.setUserId(adminUser.getId());
rescueInfo.setDeptList(buildDeptList(adminUser.getDeptId()));
String startTime = "";
String endTime = "";
if ("more".equals(rescueInfo.getTimeType())) {
if (org.apache.commons.lang3.StringUtils.isNotEmpty(rescueInfo.getStartTimeStr())) {
startTime = rescueInfo.getStartTimeStr() + " 00:00:01";
}
if (org.apache.commons.lang3.StringUtils.isNotEmpty(rescueInfo.getEndTimeStr())) {
endTime = rescueInfo.getEndTimeStr() + " 23:59:59";
}
} else if ("month".equals(rescueInfo.getTimeType())) {
//当月
startTime = DateUtil.format(DateUtil.beginOfMonth(DateUtil.date()), "yyyy-MM-dd") + " 00:00:01";
endTime = DateUtil.format(DateUtil.endOfMonth(DateUtil.date()), "yyyy-MM-dd") + " 23:59:59";
} else if ("day".equals(rescueInfo.getTimeType())) {
//当天
startTime = DateUtil.formatDate(DateUtil.date()) + " 00:00:01";
endTime = DateUtil.formatDate(DateUtil.date()) + " 23:59:59";
}
rescueInfo.setStartTimeStr(startTime);
rescueInfo.setEndTimeStr(endTime);
IPage<RescueInfo> rescueInfos = baseMapper.selectRescueStatisticsInfoListSecondDispatcher(rescueInfo, page);
processRescueInfoRecords(rescueInfos, user, false);
return rescueInfos;
}
public List<StatisticsStaffVO> driverStatistics(StatisticsStaffVO statisticsStaffReqVO) {
return baseMapper.driverStatistics(statisticsStaffReqVO);
}
@ -2819,4 +2915,79 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
!info.getRescueTime().after(endTime))
.collect(Collectors.toList());
}
@Override
public Map<String, Object> getRescueStatisticsInfoNum(RescueInfo rescueInfo) {
LoginUser user = getLoginUser();
AdminUserRespDTO adminUser = userService.getUser(user.getId());
List<DeptRespDTO> childDeptList = deptService.getChildDeptList(adminUser.getDeptId());
List<Long> deptList = childDeptList.stream().map(DeptRespDTO::getId).collect(Collectors.toList());
deptList.add(adminUser.getDeptId());
rescueInfo.setDeptList(deptList);
String startTime = "";
String endTime = "";
if ("more".equals(rescueInfo.getTimeType())) {
if (org.apache.commons.lang3.StringUtils.isNotEmpty(rescueInfo.getStartTimeStr())) {
startTime = rescueInfo.getStartTimeStr() + " 00:00:01";
}
if (org.apache.commons.lang3.StringUtils.isNotEmpty(rescueInfo.getEndTimeStr())) {
endTime = rescueInfo.getEndTimeStr() + " 23:59:59";
}
} else if ("month".equals(rescueInfo.getTimeType())) {
//当月
startTime = DateUtil.format(DateUtil.beginOfMonth(DateUtil.date()), "yyyy-MM-dd") + " 00:00:01";
endTime = DateUtil.format(DateUtil.endOfMonth(DateUtil.date()), "yyyy-MM-dd") + " 23:59:59";
} else if ("day".equals(rescueInfo.getTimeType())) {
//当天
startTime = DateUtil.formatDate(DateUtil.date()) + " 00:00:01";
endTime = DateUtil.formatDate(DateUtil.date()) + " 23:59:59";
}
rescueInfo.setStartTimeStr(startTime);
rescueInfo.setEndTimeStr(endTime);
Map<String, Object> res = baseMapper.getRescueStatisticsInfoNum(rescueInfo);
return res;
}
@Override
public Map<String, Object> getRescueStatisticsInfoNumSecondDispatcher(RescueInfo rescueInfo) {
LoginUser user = getLoginUser();
AdminUserRespDTO adminUser = userService.getUser(user.getId());
List<DeptRespDTO> childDeptList = deptService.getChildDeptList(adminUser.getDeptId());
List<Long> deptList = childDeptList.stream().map(DeptRespDTO::getId).collect(Collectors.toList());
deptList.add(adminUser.getDeptId());
rescueInfo.setDeptList(deptList);
rescueInfo.setUserId(adminUser.getId());
String startTime = "";
String endTime = "";
if ("more".equals(rescueInfo.getTimeType())) {
if (org.apache.commons.lang3.StringUtils.isNotEmpty(rescueInfo.getStartTimeStr())) {
startTime = rescueInfo.getStartTimeStr() + " 00:00:01";
}
if (org.apache.commons.lang3.StringUtils.isNotEmpty(rescueInfo.getEndTimeStr())) {
endTime = rescueInfo.getEndTimeStr() + " 23:59:59";
}
} else if ("month".equals(rescueInfo.getTimeType())) {
//当月
startTime = DateUtil.format(DateUtil.beginOfMonth(DateUtil.date()), "yyyy-MM-dd") + " 00:00:01";
endTime = DateUtil.format(DateUtil.endOfMonth(DateUtil.date()), "yyyy-MM-dd") + " 23:59:59";
} else if ("day".equals(rescueInfo.getTimeType())) {
//当天
startTime = DateUtil.formatDate(DateUtil.date()) + " 00:00:01";
endTime = DateUtil.formatDate(DateUtil.date()) + " 23:59:59";
}
rescueInfo.setStartTimeStr(startTime);
rescueInfo.setEndTimeStr(endTime);
Map<String, Object> res = baseMapper.getRescueStatisticsInfoNumSecondDispatcher(rescueInfo);
return res;
}
public List<StatisticsStaffVO> driverStatisticsSecond(StatisticsStaffVO statisticsStaffReqVO) {
return baseMapper.driverStatisticsSecond(statisticsStaffReqVO);
}
public List<StatisticsStaffVO> carStatisticsSecond(StatisticsStaffVO statisticsStaffReqVO) {
return baseMapper.carStatisticsSecond(statisticsStaffReqVO);
}
}

View File

@ -96,4 +96,44 @@
#{id}
</foreach>
</delete>
<select id="listDriverInfo" resultType="cn.iocoder.yudao.module.rescue.domain.DriverInfo">
SELECT su.id AS userId,
su.nickname AS nickName,
di.id
FROM driver_info di
INNER JOIN system_users su ON di.user_id = su.id
AND su.deleted = '0'
WHERE 1 = 1
AND di.deleted = '0'
AND di.staff_type = 'jysj'
order by di.create_time desc
</select>
<select id="listCarInfo" resultType="cn.iocoder.yudao.module.rescue.domain.RescueCarInfo">
SELECT id, rescue_car_num, car_category
FROM `rescue_car_info`
WHERE deleted = 0
order by create_time desc
</select>
<select id="listDriverInfoSecond" resultType="cn.iocoder.yudao.module.rescue.domain.DriverInfo">
SELECT su.id AS userId,
su.nickname AS nickName,
di.id
FROM driver_info di
INNER JOIN system_users su ON di.user_id = su.id AND su.deleted = 0
WHERE FIND_IN_SET(#{userId}, di.second_dispatcher_id) > 0
AND di.deleted = 0;
</select>
<select id="listCarInfoSecond" resultType="cn.iocoder.yudao.module.rescue.domain.RescueCarInfo">
SELECT DISTINCT
rci.*
FROM rescue_car_info rci
INNER JOIN rescue_driver_car_relation rdcr ON rci.id = rdcr.car_id AND rdcr.deleted = 0
INNER JOIN driver_info di ON rdcr.driver_id = di.id AND di.deleted = 0
WHERE FIND_IN_SET(#{userId}, di.second_dispatcher_id) > 0
AND rci.deleted = 0
</select>
</mapper>

View File

@ -742,6 +742,8 @@
di.create_time DESC;
</select>
<select id="driverInMap2" resultType="java.util.Map">
SELECT IFNULL(sum(di.driver_status = '1'), 0) as kxNum,
IFNULL(sum(di.driver_status = '2'), 0) as ztNum,
@ -1042,41 +1044,56 @@
su.id AS userId,
su.avatar,
ri.driver_name,
ri.driver_id,
di.id AS 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
COALESCE(SUM(
CASE
WHEN ri.end_scale IS NOT NULL
AND ri.start_scale IS NOT NULL
AND ri.end_scale > ri.start_scale
THEN ri.end_scale - ri.start_scale
ELSE 0
END
), 0) AS mileage,
COALESCE(SUM(roi.set_money), 0) AS money
FROM driver_info di
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
LEFT JOIN rescue_info ri ON di.id = ri.driver_id AND ri.deleted = 0
LEFT JOIN rescue_order_info roi ON roi.rescue_info_id = ri.id AND roi.deleted = 0
WHERE di.deleted = 0
AND ri.driver_id IS NOT NULL
AND ri.driver_name IS NOT NULL
GROUP BY
su.id,
su.avatar,
ri.driver_name,
ri.driver_id
di.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
rci.rescue_car_num AS driver_car_num,
COUNT(ri.id) AS rescueNum,
COALESCE(SUM(
CASE
WHEN ri.end_scale IS NOT NULL
AND ri.start_scale IS NOT NULL
AND ri.end_scale > ri.start_scale
THEN ri.end_scale - ri.start_scale
ELSE 0
END
), 0) AS mileage,
COALESCE(SUM(roi.set_money), 0) 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
rescue_car_info rci
LEFT JOIN rescue_info ri ON rci.rescue_car_num = ri.driver_car_num AND ri.deleted = 0
LEFT JOIN rescue_order_info roi ON roi.rescue_info_id = ri.id AND roi.deleted = 0
WHERE
ri.deleted = 0
rci.deleted = 0
GROUP BY
ri.driver_car_num
rci.rescue_car_num
ORDER BY
rescueNum DESC
</select>
@ -1103,4 +1120,361 @@
createRescueNum DESC;
</select>
<select id="selectRescueStatisticsInfoList" parameterType="cn.iocoder.yudao.module.rescue.domain.RescueInfo"
resultType="cn.iocoder.yudao.module.rescue.domain.RescueInfo">
SELECT ri.*,
roi.order_status,
roi.set_money,
roi.id AS orderId,
roi.order_signing_person_id AS orderSigningPersonId,
roi.order_signing_person_name AS orderSigningPersonName,
roi.order_signing_charge_id AS orderSigningChargeId,
roi.order_signing_charge_name AS orderSigningChargeName,
roi.validation_real_name AS orderSigningRealName,
roi.payment_name AS paymentName,
roi.payment_time AS paymentTime,
roi.order_signing_remark AS orderSigningRemark
FROM rescue_info ri
left join rescue_order_info roi on roi.rescue_info_id = ri.id and roi.deleted = '0'
<where>
1 = 1
and ri.deleted = '0' AND ri.is_revoke = '0'
<if test="map.connectionName!=null and map.connectionName!='' ">
and (ri.connection_name like concat('%', #{map.connectionName}, '%')
or ri.car_owner like concat('%', #{map.connectionName}, '%'))
</if>
<if test="map.connectionPhone!=null and map.connectionPhone!='' ">
and (ri.connection_phone like concat('%', #{map.connectionPhone}, '%')
or ri.car_owner_phone like concat('%', #{map.connectionPhone}, '%'))
</if>
<if test="map.driverCarNum != null and map.driverCarNum != '' ">
and ri.driver_car_num = #{map.driverCarNum}
</if>
<if test="map.faultType != null and map.faultType != '' ">
and ri.fault_type = #{map.faultType}
</if>
<if test="map.licenseNum != null and map.licenseNum != '' ">
and ri.license_num = #{map.licenseNum}
</if>
<if test="map.phenomenon != null and map.phenomenon != '' ">
and ri.phenomenon = #{map.phenomenon}
</if>
<if test="map.rescueStatus != null and map.rescueStatus != '' ">
and ri.rescue_status = #{map.rescueStatus}
</if>
<if test="map.rescueType != null and map.rescueType != '' ">
and ri.rescue_type = #{map.rescueType}
</if>
<if test="map.rescuePosition!=null and map.rescuePosition!='' ">
and ri.rescue_position like concat('%', #{map.rescuePosition}, '%')
</if>
<if test="map.driverId != null">
and ri.driver_id = #{map.driverId}
</if>
<if test="map.secondDispatchId != null">
and ri.second_dispatch_id = #{map.secondDispatchId}
</if>
<if test="map.startTimeStr!=null and map.startTimeStr!='' ">
AND ri.rescue_time &gt;= #{map.startTimeStr}
</if>
<if test="map.endTimeStr!=null and map.endTimeStr!='' ">
AND ri.rescue_time &lt;= #{map.endTimeStr}
</if>
</where>
order by ri.create_time desc
</select>
<select id="selectRescueStatisticsInfoListSecondDispatcher" parameterType="cn.iocoder.yudao.module.rescue.domain.RescueInfo"
resultType="cn.iocoder.yudao.module.rescue.domain.RescueInfo">
SELECT ri.*,
roi.order_status,
roi.set_money,
roi.id AS orderId,
roi.order_signing_person_id AS orderSigningPersonId,
roi.order_signing_person_name AS orderSigningPersonName,
roi.order_signing_charge_id AS orderSigningChargeId,
roi.order_signing_charge_name AS orderSigningChargeName,
roi.validation_real_name AS orderSigningRealName,
roi.payment_name AS paymentName,
roi.payment_time AS paymentTime,
roi.order_signing_remark AS orderSigningRemark
FROM rescue_info ri
left join rescue_order_info roi on roi.rescue_info_id = ri.id and roi.deleted = '0'
<where>
1 = 1
and ri.deleted = '0' AND ri.is_revoke = '0'
and ri.second_dispatch_id = #{map.userId}
<if test="map.connectionName!=null and map.connectionName!='' ">
and (ri.connection_name like concat('%', #{map.connectionName}, '%')
or ri.car_owner like concat('%', #{map.connectionName}, '%'))
</if>
<if test="map.connectionPhone!=null and map.connectionPhone!='' ">
and (ri.connection_phone like concat('%', #{map.connectionPhone}, '%')
or ri.car_owner_phone like concat('%', #{map.connectionPhone}, '%'))
</if>
<if test="map.driverCarNum != null and map.driverCarNum != '' ">
and ri.driver_car_num = #{map.driverCarNum}
</if>
<if test="map.faultType != null and map.faultType != '' ">
and ri.fault_type = #{map.faultType}
</if>
<if test="map.licenseNum != null and map.licenseNum != '' ">
and ri.license_num = #{map.licenseNum}
</if>
<if test="map.phenomenon != null and map.phenomenon != '' ">
and ri.phenomenon = #{map.phenomenon}
</if>
<if test="map.rescueStatus != null and map.rescueStatus != '' ">
and ri.rescue_status = #{map.rescueStatus}
</if>
<if test="map.rescueType != null and map.rescueType != '' ">
and ri.rescue_type = #{map.rescueType}
</if>
<if test="map.rescuePosition!=null and map.rescuePosition!='' ">
and ri.rescue_position like concat('%', #{map.rescuePosition}, '%')
</if>
<if test="map.driverId != null">
and ri.driver_id = #{map.driverId}
</if>
<if test="map.secondDispatchId != null">
and ri.second_dispatch_id = #{map.secondDispatchId}
</if>
<if test="map.startTimeStr!=null and map.startTimeStr!='' ">
AND ri.rescue_time &gt;= #{map.startTimeStr}
</if>
<if test="map.endTimeStr!=null and map.endTimeStr!='' ">
AND ri.rescue_time &lt;= #{map.endTimeStr}
</if>
</where>
order by ri.create_time desc
</select>
<select id="getRescueStatisticsInfoNum" resultType="java.util.Map" parameterType="cn.iocoder.yudao.module.rescue.domain.RescueInfo">
SELECT
IFNULL(sum(ri.rescue_status = '3' or ri.rescue_status = '4'), 0) as jyzNum,
IFNULL(sum(roi.order_status = '1'), 0) as dzfNum,
IFNULL(sum(ri.rescue_status = '6'), 0) as dqcNum,
IFNULL(sum(ri.rescue_status <![CDATA[>=]]> '5'), 0) as ywcNum,
IFNULL(sum(ri.is_wei_xiu = '1'), 0) as zwxNum,
IFNULL(count(ri.id), 0) as yjdNum,
IFNULL(sum(roi.set_money), 0) as yingskNum,
IFNULL(sum(CASE WHEN roi.if_confirm_pay = '1' THEN roi.pay_money ELSE 0 END), 0) as yiskNum,
IFNULL(sum(CASE WHEN roi.if_confirm_pay = '0' THEN roi.set_money ELSE 0 END), 0) as dskNum
FROM rescue_info ri
left join rescue_order_info roi on roi.rescue_info_id = ri.id and roi.deleted = '0'
<where>
1 = 1
and ri.deleted = '0' AND ri.is_revoke = '0'
<if test="map.connectionName!=null and map.connectionName!='' ">
and (ri.connection_name like concat('%', #{map.connectionName}, '%')
or ri.car_owner like concat('%', #{map.connectionName}, '%'))
</if>
<if test="map.connectionPhone!=null and map.connectionPhone!='' ">
and (ri.connection_phone like concat('%', #{map.connectionPhone}, '%')
or ri.car_owner_phone like concat('%', #{map.connectionPhone}, '%'))
</if>
<if test="map.driverCarNum != null and map.driverCarNum != '' ">
and ri.driver_car_num = #{map.driverCarNum}
</if>
<if test="map.faultType != null and map.faultType != '' ">
and ri.fault_type = #{map.faultType}
</if>
<if test="map.licenseNum != null and map.licenseNum != '' ">
and ri.license_num = #{map.licenseNum}
</if>
<if test="map.phenomenon != null and map.phenomenon != '' ">
and ri.phenomenon = #{map.phenomenon}
</if>
<if test="map.rescueStatus != null and map.rescueStatus != '' ">
and ri.rescue_status = #{map.rescueStatus}
</if>
<if test="map.rescueType != null and map.rescueType != '' ">
and ri.rescue_type = #{map.rescueType}
</if>
<if test="map.rescuePosition!=null and map.rescuePosition!='' ">
and ri.rescue_position like concat('%', #{map.rescuePosition}, '%')
</if>
<if test="map.driverId != null">
and ri.driver_id = #{map.driverId}
</if>
<if test="map.secondDispatchId != null">
and ri.second_dispatch_id = #{map.secondDispatchId}
</if>
<if test="map.startTimeStr!=null and map.startTimeStr!='' ">
AND ri.rescue_time &gt;= #{map.startTimeStr}
</if>
<if test="map.endTimeStr!=null and map.endTimeStr!='' ">
AND ri.rescue_time &lt;= #{map.endTimeStr}
</if>
</where>
</select>
<select id="getRescueStatisticsInfoNumSecondDispatcher" resultType="java.util.Map" parameterType="cn.iocoder.yudao.module.rescue.domain.RescueInfo">
SELECT
IFNULL(sum(ri.rescue_status = '3' or ri.rescue_status = '4'), 0) as jyzNum,
IFNULL(sum(roi.order_status = '1'), 0) as dzfNum,
IFNULL(sum(ri.rescue_status = '6'), 0) as dqcNum,
IFNULL(sum(ri.rescue_status <![CDATA[>=]]> '5'), 0) as ywcNum,
IFNULL(sum(ri.is_wei_xiu = '1'), 0) as zwxNum,
IFNULL(count(ri.id), 0) as yjdNum,
IFNULL(sum(roi.set_money), 0) as yingskNum,
IFNULL(sum(CASE WHEN roi.if_confirm_pay = '1' THEN roi.pay_money ELSE 0 END), 0) as yiskNum,
IFNULL(sum(CASE WHEN roi.if_confirm_pay = '0' THEN roi.set_money ELSE 0 END), 0) as dskNum
FROM rescue_info ri
left join rescue_order_info roi on roi.rescue_info_id = ri.id and roi.deleted = '0'
<where>
1 = 1
and ri.deleted = '0' AND ri.is_revoke = '0'
and ri.second_dispatch_id = #{map.userId}
<if test="map.connectionName!=null and map.connectionName!='' ">
and (ri.connection_name like concat('%', #{map.connectionName}, '%')
or ri.car_owner like concat('%', #{map.connectionName}, '%'))
</if>
<if test="map.connectionPhone!=null and map.connectionPhone!='' ">
and (ri.connection_phone like concat('%', #{map.connectionPhone}, '%')
or ri.car_owner_phone like concat('%', #{map.connectionPhone}, '%'))
</if>
<if test="map.driverCarNum != null and map.driverCarNum != '' ">
and ri.driver_car_num = #{map.driverCarNum}
</if>
<if test="map.faultType != null and map.faultType != '' ">
and ri.fault_type = #{map.faultType}
</if>
<if test="map.licenseNum != null and map.licenseNum != '' ">
and ri.license_num = #{map.licenseNum}
</if>
<if test="map.phenomenon != null and map.phenomenon != '' ">
and ri.phenomenon = #{map.phenomenon}
</if>
<if test="map.rescueStatus != null and map.rescueStatus != '' ">
and ri.rescue_status = #{map.rescueStatus}
</if>
<if test="map.rescueType != null and map.rescueType != '' ">
and ri.rescue_type = #{map.rescueType}
</if>
<if test="map.rescuePosition!=null and map.rescuePosition!='' ">
and ri.rescue_position like concat('%', #{map.rescuePosition}, '%')
</if>
<if test="map.driverId != null">
and ri.driver_id = #{map.driverId}
</if>
<if test="map.secondDispatchId != null">
and ri.second_dispatch_id = #{map.secondDispatchId}
</if>
<if test="map.startTimeStr!=null and map.startTimeStr!='' ">
AND ri.rescue_time &gt;= #{map.startTimeStr}
</if>
<if test="map.endTimeStr!=null and map.endTimeStr!='' ">
AND ri.rescue_time &lt;= #{map.endTimeStr}
</if>
</where>
</select>
<select id="driverStatisticsSecond" parameterType="cn.iocoder.yudao.module.rescue.vo.StatisticsStaffVO"
resultType="cn.iocoder.yudao.module.rescue.vo.StatisticsStaffVO">
SELECT
su.id AS userId,
su.avatar,
di.id AS driver_id,
su.nickname AS driver_name,
COALESCE(COUNT(ri.id), 0) AS rescueNum,
COALESCE(SUM(
CASE
WHEN ri.end_scale IS NOT NULL
AND ri.start_scale IS NOT NULL
AND ri.end_scale > ri.start_scale
THEN ri.end_scale - ri.start_scale
ELSE 0
END
), 0) AS mileage,
COALESCE(SUM(roi.set_money), 0) AS money
FROM driver_info di
INNER JOIN system_users su ON di.user_id = su.id AND su.deleted = 0
LEFT JOIN rescue_info ri ON ri.driver_id = di.id
AND ri.deleted = 0
AND ri.driver_name IS NOT NULL
AND ri.driver_id IS NOT NULL
AND ri.second_dispatch_id = #{vo.secondUserId}
LEFT JOIN rescue_order_info roi ON roi.rescue_info_id = ri.id AND roi.deleted = 0
WHERE di.deleted = 0
AND FIND_IN_SET(#{vo.secondUserId}, di.second_dispatcher_id) > 0
GROUP BY
su.id,
di.id,
su.nickname
ORDER BY rescueNum DESC
</select>
<select id="carStatisticsSecond" parameterType="cn.iocoder.yudao.module.rescue.vo.StatisticsStaffVO"
resultType="cn.iocoder.yudao.module.rescue.vo.StatisticsStaffVO">
SELECT
rci.rescue_car_num AS driverCarNum,
COALESCE(COUNT(ri.id), 0) AS rescueNum,
COALESCE(SUM(
CASE
WHEN ri.end_scale IS NOT NULL
AND ri.start_scale IS NOT NULL
AND ri.end_scale > ri.start_scale
THEN ri.end_scale - ri.start_scale
ELSE 0
END
), 0) AS mileage,
COALESCE(SUM(roi.set_money), 0) AS money
FROM rescue_car_info rci
INNER JOIN rescue_driver_car_relation rdcr ON rci.id = rdcr.car_id AND rdcr.deleted = 0
INNER JOIN driver_info di ON rdcr.driver_id = di.id AND di.deleted = 0
LEFT JOIN rescue_info ri ON ri.driver_car_num = rci.rescue_car_num
AND ri.deleted = 0
AND ri.second_dispatch_id = #{vo.secondUserId}
LEFT JOIN rescue_order_info roi ON roi.rescue_info_id = ri.id AND roi.deleted = 0
WHERE rci.deleted = 0
AND FIND_IN_SET(#{vo.secondUserId}, di.second_dispatcher_id) > 0
GROUP BY
rci.rescue_car_num
ORDER BY rescueNum DESC
</select>
</mapper>