Compare commits

...

18 Commits

Author SHA1 Message Date
xuyuncong
517fce52fe 更新 2025-10-10 18:05:01 +08:00
xuyuncong
a6c3fde9e1 Merge branch 'master' into insp 2025-10-10 09:35:39 +08:00
xuyuncong
900cdf2af0 更新 2025-10-09 17:55:12 +08:00
xuyuncong
8bc8314073 员工统计-员工详情 2025-10-09 17:01:03 +08:00
xyc
7c2f6c2737 更新1009 2025-10-09 09:51:37 +08:00
xyc
1982dde0d3 更新0926 2025-10-01 14:42:59 +08:00
Lx
8c3bff1b24 Merge branch 'rescue' 2025-09-27 09:45:52 +08:00
Lx
34c22f6240 0927 2025-09-27 09:45:20 +08:00
xyc
b5771bd801 Merge branch 'repair' 2025-09-26 15:09:34 +08:00
Lx
27c89e34b1 Merge branch 'rescue' 2025-09-25 15:57:46 +08:00
Lx
82749fc815 Merge remote-tracking branch 'origin/master' 2025-09-25 15:57:32 +08:00
Lx
f4bbc51fdd 0925 2025-09-25 15:56:35 +08:00
Lx
174eff8028 0924 2025-09-24 17:41:06 +08:00
Lx
3b361b8304 0924 2025-09-24 10:25:53 +08:00
Lx
2626db42e8 0924 2025-09-24 10:05:53 +08:00
Lx
7f083ab2a4 0924 2025-09-24 10:02:32 +08:00
Lx
45b0f93886 0909 2025-09-10 09:48:53 +08:00
Lx
1615ffb3a8 0909 2025-09-09 18:31:45 +08:00
59 changed files with 2378 additions and 184 deletions

View File

@ -826,6 +826,19 @@ public class PartnerOwnController extends BaseController {
return success(partnerList.staticsTable5(partners.getPartnerId(), startTime, endTime));
}
/**
* @description :待收款
* @author xyc
* @date 09:46 2025/10/10
* @param startTime {@link String}
* @param endTime {@link String}
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult
**/
@GetMapping("/channelMoneyStaticsByBusi")
public CommonResult<?> channelMoneyStaticsByBusi(String busi, String startTime, String endTime) throws Exception {
return success(partnerList.channelMoneyStaticsByBusi(busi,startTime, endTime));
}
/**
* 查询检测类型统计
*

View File

@ -757,13 +757,33 @@ public class UserClientPartnerOwnController extends BaseController {
return success(partnerList.staticsTable4(partners.getPartnerId(), startTime, endTime));
}
//统计表格5
/**
* @description :待收款
* @author xyc
* @date 09:46 2025/10/10
* @param startTime {@link String}
* @param endTime {@link String}
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult
**/
@GetMapping("/staticsTable5")
public CommonResult staticsTable5(String startTime, String endTime) throws Exception {
ShopMallPartners partners = partnerList.shopInfo();
return success(partnerList.staticsTable5(partners.getPartnerId(), startTime, endTime));
}
/**
* @description :待收款
* @author xyc
* @date 09:46 2025/10/10
* @param startTime {@link String}
* @param endTime {@link String}
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult
**/
@GetMapping("/channelMoneyStaticsByBusi")
public CommonResult<?> channelMoneyStaticsByBusi(String busi, String startTime, String endTime) throws Exception {
return success(partnerList.channelMoneyStaticsByBusi(busi,startTime, endTime));
}
/**
* 查询检测类型统计
*

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.inspection.controller.admin;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.common.SystemEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.inspection.entity.InspectionBusinessChannel;
import cn.iocoder.yudao.module.inspection.service.InspectionBusinessChannelService;
@ -27,6 +28,7 @@ public class InspectionBusinessChannelController {
return CommonResult.success(inspectionBusinessChannelService.list(Wrappers.<InspectionBusinessChannel>lambdaQuery()
.eq(ObjectUtil.isNotEmpty(channel.getType()), InspectionBusinessChannel::getType, channel.getType())
.like(ObjectUtil.isNotEmpty(channel.getName()), InspectionBusinessChannel::getName, channel.getName())
.eq(InspectionBusinessChannel::getSystemCode, SystemEnum.INSPECTION.getCode())
.orderByAsc(InspectionBusinessChannel::getSort)));
}

View File

@ -101,6 +101,8 @@ public interface AppInspectionPartnerMapper extends BaseMapper<ShopMallPartners>
List<Map<String, Object>> staticsTable4(@Param("partnerId") Long partnerId, @Param("startTime") String startTime, @Param("endTime") String endTime);
List<Map<String, Object>> staticsTable5(@Param("partnerId") Long partnerId, @Param("startTime") String startTime, @Param("endTime") String endTime);
List<Map<String, Object>> busiMoneyStatics( @Param("startTime") String startTime, @Param("endTime") String endTime);
List<Map<String, Object>> channelMoneyStaticsByBusi(@Param("busi")String busi, @Param("startTime") String startTime, @Param("endTime") String endTime);
Long dhjNum(@Param("partnerId") Long partnerId, @Param("dateStr") String dateStr);

View File

@ -72,4 +72,13 @@ public interface InspectionWorkNodeMapper extends BaseMapper<InspectionWorkNode>
* @return: java.util.Map<java.lang.String,java.lang.Object>
**/
Map<String, Object> queryStaffInspectionCount(DlInspectionProject dlInspectionProject);
/**
* @description: 获取员工项目统计
* @author:
* @date: 2025/10/9 14:07
* @param: [dlInspectionProject]
* @return: java.util.Map<java.lang.String,java.lang.Object>
**/
Map<String, Object> queryOutputMoneyStatistics(DlInspectionProject dlInspectionProject);
}

View File

@ -36,4 +36,9 @@ public class InspectionListQuery {
* 项目id
*/
private String projectId;
/**
* 类型 1=待收款
*/
private String type;
}

View File

@ -169,6 +169,15 @@ public interface AppInspectionPartnerService extends IService<ShopMallPartners>
List<Map<String, Object>> staticsTable4(Long partnerId, String startTime, String endTime);
List<Map<String, Object>> staticsTable5(Long partnerId, String startTime, String endTime);
/**
* @description : 来源待收款金额统计通过渠道
* @author xyc
* @date 10:53 2025/10/10
* @param startTime {@link String}
* @param endTime {@link String}
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
**/
List<Map<String, Object>> channelMoneyStaticsByBusi(String busi,String startTime, String endTime);
//新检测金额折线图

View File

@ -94,16 +94,17 @@ public interface IInspectionWorkNodeService extends IService<InspectionWorkNode>
/**
* 完成异常节点
*
* @param idList
*/
void updateException(Long inspectionInfoId,List<String> idList);
void updateException(Long inspectionInfoId, List<String> idList);
/**
* @description: 员工统计根据车型
* @author:
* @date: 2025/8/5 11:41
* @param: [dlInspectionProject]
* @return: java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
* @return: java.util.List<java.util.Map < java.lang.String, java.lang.Object>>
**/
List<Map<String, Object>> queryStaffCountGroupByGoods(DlInspectionProject dlInspectionProject);
@ -112,7 +113,16 @@ public interface IInspectionWorkNodeService extends IService<InspectionWorkNode>
* @author:
* @date: 2025/8/5 14:04
* @param: [dlInspectionProject]
* @return: java.util.Map<java.lang.String,java.lang.Object>
* @return: java.util.Map<java.lang.String, java.lang.Object>
**/
Map<String, Object> queryStaffInspectionCount(DlInspectionProject dlInspectionProject);
/**
* @param dlInspectionProject {@link DlInspectionProject}
* @return java.util.Map<java.lang.String, java.lang.Object>
* @description : 获取员工统计信息
* @author xyc
* @date 17:23 2025/10/9
**/
Map<String, Object> queryOutputMoneyStatistics(DlInspectionProject dlInspectionProject);
}

View File

@ -2285,6 +2285,15 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
return res;
}
/**
* @description :待收款
* @author xyc
* @date 09:47 2025/10/10
* @param partnerId {@link Long}
* @param startTime {@link String}
* @param endTime {@link String}
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
**/
@Override
public List<Map<String, Object>> staticsTable5(Long partnerId, String startTime, String endTime) {
if (StringUtils.isEmpty(startTime)) {
@ -2293,7 +2302,27 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
}
startTime = startTime + " 00:00:00";
endTime = endTime + " 23:59:59";
List<Map<String, Object>> res = baseMapper.staticsTable5(partnerId, startTime, endTime);
List<Map<String, Object>> res = baseMapper.busiMoneyStatics(startTime, endTime);
return res;
}
/**
* @description : 来源待收款金额统计通过渠道
* @author xyc
* @date 10:53 2025/10/10
* @param startTime {@link String}
* @param endTime {@link String}
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
**/
@Override
public List<Map<String, Object>> channelMoneyStaticsByBusi(String busi,String startTime, String endTime) {
if (StringUtils.isEmpty(startTime)) {
startTime = DateUtil.format(new Date(), "yyyy-MM-dd");
endTime = DateUtil.format(new Date(), "yyyy-MM-dd");
}
startTime = startTime + " 00:00:00";
endTime = endTime + " 23:59:59";
List<Map<String, Object>> res = baseMapper.channelMoneyStaticsByBusi(busi,startTime, endTime);
return res;
}

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.inspection.service.impl;
import cn.iocoder.yudao.common.SystemEnum;
import cn.iocoder.yudao.module.inspection.entity.InspectionBusinessChannel;
import cn.iocoder.yudao.module.inspection.mapper.InspectionBusinessChannelMapper;
import cn.iocoder.yudao.module.inspection.service.InspectionBusinessChannelService;
@ -18,7 +19,8 @@ public class InspectionBusinessChannelServiceImpl extends ServiceImpl<Inspection
@Override
public List<InspectionBusinessChannel> getChannelTree() {
// 查询所有业务渠道父节点
return this.list();
return this.list(Wrappers.<InspectionBusinessChannel>lambdaQuery()
.eq(InspectionBusinessChannel::getSystemCode, SystemEnum.INSPECTION.getCode()));
}
/**

View File

@ -614,6 +614,18 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
return baseMapper.queryStaffInspectionCount(dlInspectionProject);
}
/**
* @description :产值统计
* @author xyc
* @date 17:51 2025/10/9
* @param dlInspectionProject {@link DlInspectionProject}
* @return java.util.Map<java.lang.String, java.lang.Object>
**/
@Override
public Map<String, Object> queryOutputMoneyStatistics(DlInspectionProject dlInspectionProject) {
return baseMapper.queryOutputMoneyStatistics(dlInspectionProject);
}
/**
* 判断传入的 InspectionWorkNode 对象是否在集合中有后续项目
*

View File

@ -56,6 +56,10 @@ public class StatisticsServiceImpl implements StatisticsService {
/*获取员工信息*/
AdminUserRespDTO user = adminUserApi.getUser(dlInspectionProject.getUserId());
result.put("staffInfo", user);
/*产值相关统计*/
Map<String, Object> outputMoneyStatistics = inspectionWorkNodeService.queryOutputMoneyStatistics(dlInspectionProject);
result.put("outputMoneyStatistics", outputMoneyStatistics);
return result;
}

View File

@ -364,8 +364,8 @@
<if test="query.datetimeRange != null">
AND ii.create_time BETWEEN CONCAT(#{query.datetimeRange[0]}, ' 00:00:00') AND CONCAT(#{query.datetimeRange[1]}, ' 23:59:59')
</if>
<if test="query.customSource != null">
AND ii.customer_source = #{query.customSource}
<if test="query.type != null and query.type == 1">
AND (oi.pay_type = 'sz' OR oi.cashier_confirm != '1' OR oi.pay_money IS NULL)
</if>
<if test="query.bussiness != null">
AND ii.business_channel = #{query.bussiness}
@ -373,7 +373,10 @@
<if test="query.projectId != null">
AND ip.id = #{query.projectId}
</if>
AND iwn.status = '2'
<if test="query.type != 1">
AND iwn.status = '2'
</if>
AND iwn.deleted = b'0'
</where>
GROUP BY ii.id
@ -486,4 +489,36 @@
</where>
GROUP BY staff.user_id, ip.id;
</select>
<select id="queryOutputMoneyStatistics" resultType="java.util.Map">
SELECT
iw.deal_user_id,
-- 初检公示产值流程次数为1的订单公示价格
COALESCE(SUM(CASE WHEN iw.node_count = 1 THEN oi.goods_price ELSE 0 END) / 100, 0) AS initialInspectionOutputValue,
-- 复检公示产值流程次数大于1的订单公示价格总和
COALESCE(SUM(CASE WHEN iw.node_count > 1 THEN oi.goods_price ELSE 0 END) / 100, 0) AS recheckInspectionOutputValue,
-- 初检合格产值流程次数为1且status=2且type='1'的订单公示价格
COALESCE(SUM(CASE WHEN iw.node_count = 1 AND iw.status = '2' AND iw.type = '1' THEN oi.goods_price ELSE 0 END) / 100, 0) AS initialInspectionPassOutputValue,
-- 复检合格产值流程次数大于1且status=2且type='1'的订单公示价格总和
COALESCE(SUM(CASE WHEN iw.node_count > 1 AND iw.status = '2' AND iw.type = '1' THEN oi.goods_price ELSE 0 END) / 100, 0) AS recheckInspectionPassOutputValue
FROM
inspection_work_node iw
JOIN
inspection_info ii ON iw.inspection_info_id = ii.id
JOIN
order_info oi ON ii.inspection_order_id = oi.id
WHERE
iw.deal_user_id = #{userId} -- 替换为所需的处理人ID
AND iw.deleted = 0 -- 确保流程未被删除
AND ii.deleted = 0 -- 确保检测信息未被删除
<if test="datetimeRange != null and datetimeRange.size() == 2">
AND iw.create_time BETWEEN CONCAT(#{datetimeRange[0]}, ' 00:00:00') AND CONCAT(#{datetimeRange[1]}, ' 23:59:59')
</if>
GROUP BY
iw.deal_user_id;
</select>
</mapper>

View File

@ -888,6 +888,7 @@ FROM
ON oi.id = ii.inspection_order_id AND oi.deleted = '0'
WHERE
ibc.deleted = '0'
AND ibc.system_code = 'jiance'
AND ibc.type = '0'
GROUP BY
ibc.name
@ -918,5 +919,43 @@ FROM
GROUP BY
ibc.name
</select>
<select id="busiMoneyStatics" resultType="java.util.Map">
SELECT
ii.business_channel AS channel, -- 渠道
COUNT(oi.id) AS order_count, -- 台次(订单数量)
ROUND(IFNULL(SUM(oi.goods_price), 0) / 100) AS theAmount -- 金额(单位:元)
FROM
order_info oi
INNER JOIN
inspection_info ii ON oi.id = ii.inspection_order_id
WHERE
ii.create_time BETWEEN #{startTime} AND #{endTime}
AND (oi.pay_type = 'sz' OR oi.cashier_confirm != '1' OR oi.pay_money IS NULL)
GROUP BY
ii.business_channel -- 按渠道分组
ORDER BY
theAmount DESC;
</select>
<select id="channelMoneyStaticsByBusi" resultType="java.util.Map">
SELECT
cs.name AS sourceName,
COUNT(DISTINCT ii.id) AS pendingCount,
ROUND(SUM(COALESCE(oi.goods_price, 0)) / 100, 2) AS pendingAmountYuan
FROM inspection_business_channel bc
INNER JOIN inspection_business_channel cs ON cs.pid = bc.id AND cs.type = 1
INNER JOIN inspection_info ii ON ii.customer_source = cs.name AND ii.deleted = 0
INNER JOIN order_info oi ON oi.id = ii.inspection_order_id AND oi.deleted = 0
WHERE bc.type = 0
<if test="startTime != null">
AND ii.create_time BETWEEN #{startTime} AND #{endTime}
</if>
AND bc.name = #{busi}
AND (oi.pay_type = 'sz' OR oi.cashier_confirm != '1' OR oi.pay_money IS NULL)
AND bc.deleted = 0
AND cs.deleted = 0
GROUP BY cs.id, cs.name
ORDER BY pendingAmountYuan DESC;
</select>
</mapper>

View File

@ -51,7 +51,7 @@ public class DriveSchoolCourseSmallController {
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
Page<DlDriveSchoolCourseVO> page = new Page<>(pageNo, pageSize);
return success(courseService.queryListPage(pageReqVO, page));
return success(courseService.queryListPageSmall(pageReqVO, page));
}
/**

View File

@ -26,6 +26,7 @@ public interface DlDriveSchoolCourseMapper extends BaseMapper<DlDriveSchoolCours
* @date 7:10 2025/1/17
**/
IPage<DlDriveSchoolCourseVO> queryListPage(@Param("entity") DlDriveSchoolCourseVO entity, Page<DlDriveSchoolCourseVO> page);
IPage<DlDriveSchoolCourseVO> queryListPageSmall(@Param("entity") DlDriveSchoolCourseVO entity, Page<DlDriveSchoolCourseVO> page);
/**
* 删除课程时判断订单中是否存在已报名该课程的订单

View File

@ -27,6 +27,7 @@ public interface DlDriveSchoolCourseService extends IService<DlDriveSchoolCourse
* @date 22:04 2025/1/16
**/
IPage<DlDriveSchoolCourseVO> queryListPage(DlDriveSchoolCourseVO pageReqVO, Page<DlDriveSchoolCourseVO> page);
IPage<DlDriveSchoolCourseVO> queryListPageSmall(DlDriveSchoolCourseVO pageReqVO, Page<DlDriveSchoolCourseVO> page);
/**
* 不分页查询驾校课程

View File

@ -36,6 +36,8 @@ import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -78,6 +80,11 @@ public class DlDriveSchoolCourseServiceImpl extends ServiceImpl<DlDriveSchoolCou
return courseMapper.queryListPage(pageReqVO, page);
}
@Override
public IPage<DlDriveSchoolCourseVO> queryListPageSmall(DlDriveSchoolCourseVO pageReqVO, Page<DlDriveSchoolCourseVO> page) {
return courseMapper.queryListPageSmall(pageReqVO, page);
}
/**
* 不分页查询驾校课程
*
@ -97,6 +104,28 @@ public class DlDriveSchoolCourseServiceImpl extends ServiceImpl<DlDriveSchoolCou
lambdaQueryWrapper.eq(DlDriveSchoolCourse::getTenantId, courseVO.getTenantId());
}
/*// 添加当天日期在 dayStart dayEnd 之间的条件
String today = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
// 只添加日期范围条件当两个字段都不为空时
lambdaQueryWrapper.isNotNull(DlDriveSchoolCourse::getDayStart)
.isNotNull(DlDriveSchoolCourse::getDayEnd)
.le(DlDriveSchoolCourse::getDayStart, today)
.ge(DlDriveSchoolCourse::getDayEnd, today);*/
// 添加日期范围条件包含没有时间限制或者当前日期在范围内的记录
String today = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
lambdaQueryWrapper.and(wrapper -> wrapper
.isNull(DlDriveSchoolCourse::getDayStart) // dayStart 为空
.isNull(DlDriveSchoolCourse::getDayEnd) // dayEnd 为空
.or() // 或者
.isNotNull(DlDriveSchoolCourse::getDayStart) // dayStart 不为空
.isNotNull(DlDriveSchoolCourse::getDayEnd) // dayEnd 不为空
.le(DlDriveSchoolCourse::getDayStart, today) // dayStart <= today
.ge(DlDriveSchoolCourse::getDayEnd, today) // dayEnd >= today
);
return list(lambdaQueryWrapper);
}

View File

@ -477,6 +477,7 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
// 更新记录设置ID和deleted状态
schoolCommission.setId(existing.getId());
schoolCommission.setDeleted(!process.getFinancePass());
schoolCommission.setCreateTime(LocalDateTime.now());
schoolCommissionService.updateById(schoolCommission);
}else {
// 删除记录设置ID和deleted状态

View File

@ -243,8 +243,10 @@ public class SchoolCourseOrderServiceImpl extends ServiceImpl<SchoolCourseOrderM
}
// 检查是否需要更新进度记录
boolean isCourseChanged = !oldOrder.getCourseId().equals(createReqVO.getCourseId());
boolean isCoachChanged = !oldOrder.getCoachUserId().equals(createReqVO.getCoachUserId());
/*boolean isCourseChanged = !oldOrder.getCourseId().equals(createReqVO.getCourseId());
boolean isCoachChanged = !oldOrder.getCoachUserId().equals(createReqVO.getCoachUserId());*/
boolean isCourseChanged = !Objects.equals(oldOrder.getCourseId(), createReqVO.getCourseId());
boolean isCoachChanged = !Objects.equals(oldOrder.getCoachUserId(), createReqVO.getCoachUserId());
if (isCourseChanged || isCoachChanged) {
// 查询所有进度记录
List<Process> processList = processService.lambdaQuery()
@ -270,54 +272,6 @@ public class SchoolCourseOrderServiceImpl extends ServiceImpl<SchoolCourseOrderM
}
}
}
/*//判断新订单课程与旧订单课程是否一致
if (!oldOrder.getCourseId().equals(createReqVO.getCourseId())) {
// 查询所有进度
List<Process> processList = processService.lambdaQuery()
.eq(Process::getUserId, oldOrder.getUserId())
.eq(Process::getCourseId, oldOrder.getCourseId())
.list();
if (!processList.isEmpty()) {
for (Process process : processList) {
// 更新课程ID
process.setCourseId(createReqVO.getCourseId());
// 更新课程名称
process.setCourseName(createReqVO.getCourseName());
// 更新教练ID
process.setCoachId(Long.valueOf(createReqVO.getCoachUserId()));
// 更新教练名称
process.setCoachName(createReqVO.getCoachUserName());
processService.updateById(process);
}
}
}
// 如果课程一直判断教练是否一致
if (!oldOrder.getCoachUserId().equals(createReqVO.getCoachUserId())) {
// 查询所有进度
List<Process> processList = processService.lambdaQuery()
.eq(Process::getUserId, oldOrder.getUserId())
.eq(Process::getCourseId, oldOrder.getCourseId())
.list();
if (!processList.isEmpty()) {
for (Process process : processList) {
// 更新教练ID
process.setCoachId(Long.valueOf(createReqVO.getCoachUserId()));
// 更新教练名称
process.setCoachName(createReqVO.getCoachUserName());
processService.updateById(process);
}
}
}*/
//判断新订单课程与旧订单课程是否一致
// if (!oldOrder.getCourseId().equals(createReqVO.getCourseId())) {
// // 删除学习记录表中的课程记录
// processService.remove(Wrappers.lambdaQuery(Process.class)
// .eq(Process::getUserId, oldOrder.getUserId())
// .eq(Process::getCourseId, oldOrder.getCourseId()));
// }
// 查询新课程默认方案
SchoolCourseScheme courseScheme = schoolCourseSchemeService.lambdaQuery().eq(SchoolCourseScheme::getCourseId, createReqVO.getCourseId()).eq(SchoolCourseScheme::getIsDefault, true).eq(SchoolCourseScheme::getDeleted, false).one();
String schemeId = courseScheme != null ? courseScheme.getId() : null;

View File

@ -22,6 +22,28 @@
order by main.create_time desc
</select>
<select id="queryListPageSmall" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO">
SELECT
main.*
FROM
drive_school_course main
<where>
main.deleted = 0
<if test="entity.name != null and entity.name != ''">and main.name like concat('%', #{entity.name}, '%')</if>
<if test="entity.type != null and entity.type != ''">and main.type = #{entity.type}</if>
<if test="entity.tenantId != null and entity.tenantId != ''">and main.tenant_id = #{entity.tenantId}</if>
<!-- 判断课程是否在有效期内 -->
and not (
main.day_start is not null
and main.day_end is not null
and (STR_TO_DATE(main.day_start, '%Y-%m-%d') &gt; CURDATE()
or STR_TO_DATE(main.day_end, '%Y-%m-%d') &lt; CURDATE())
)
and main.if_display = '0'
</where>
order by main.create_time desc
</select>
<select id="orderCountByCourseId" resultType="java.lang.Integer">
SELECT COUNT(*) FROM drive_school_course_order WHERE course_id = #{courseId} AND deleted = 0
</select>

View File

@ -6,16 +6,11 @@ import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.rescue.core.controller.BaseController;
import cn.iocoder.yudao.module.rescue.core.page.TableDataInfo;
import cn.iocoder.yudao.module.rescue.service.IRescueInfoDetailService;
import cn.iocoder.yudao.module.rescue.domain.*;
import cn.iocoder.yudao.module.rescue.service.*;
import cn.iocoder.yudao.module.rescue.vo.SetMoneyVO;
import cn.iocoder.yudao.util.RedisCache;
import cn.iocoder.yudao.module.rescue.core.text.HttpStatus;
import cn.iocoder.yudao.module.rescue.domain.DriverInfo;
import cn.iocoder.yudao.module.rescue.domain.RescueInfo;
import cn.iocoder.yudao.module.rescue.domain.RescueInfoDetail;
import cn.iocoder.yudao.module.rescue.domain.RescueRefuelRecord;
import cn.iocoder.yudao.module.rescue.service.IDriverInfoService;
import cn.iocoder.yudao.module.rescue.service.IRescueDriverInfoService;
import cn.iocoder.yudao.module.rescue.service.IRescueInfoService;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -25,6 +20,7 @@ import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import static cn.iocoder.yudao.module.rescue.service.impl.RescueDriverInfoServiceImpl.Redis_Driver_Key;
@ -52,6 +48,9 @@ public class RescueDriverController extends BaseController {
@Autowired
private IRescueInfoDetailService rescueInfoDetailService;
@Resource
private IRescueInfoDispatchDetailService rescueInfoDispatchDetailService;
//获取司机状态
@GetMapping("/getStatus")
public CommonResult getStatus(Long driverId) {
@ -123,18 +122,35 @@ public class RescueDriverController extends BaseController {
return success("查询成功");
}
@PostMapping("/driverAcceptByAgent")
public CommonResult driverAcceptByAgent(Long rescueDriverId, String choose, String rejectReason, Long driverId) throws Exception {
rescueDriverInfoService.driverAcceptByAgent(rescueDriverId, choose, rejectReason, driverId);
return success("查询成功");
}
//救援信息详情
@GetMapping("/rescueDetail")
public CommonResult rescueDetail(Long rescueId) {
return success(rescueDriverInfoService.rescueDetail(rescueId));
}
@GetMapping("/rescueDetailByDispatch")
public CommonResult rescueDetailByDispatch(Long rescueId) {
return success(rescueDriverInfoService.rescueDetailByDispatch(rescueId));
}
@PutMapping("/updateRescueInfo")
public CommonResult updateRescueInfo(@RequestBody RescueInfo rescueInfo) throws Exception {
rescueDriverInfoService.updateRescueInfo(rescueInfo);
return success("成功");
}
@PutMapping("/updateRescueInfoAndDetails")
public CommonResult updateRescueInfoAndDetails(@RequestBody RescueInfo rescueInfo) throws Exception {
rescueDriverInfoService.updateRescueInfoAndDetails(rescueInfo);
return success("成功");
}
//救援信息详情
@PostMapping("/uploadDetailByDriver")
@ -143,6 +159,12 @@ public class RescueDriverController extends BaseController {
return success("成功");
}
@PostMapping("/uploadDispatchDetailByDriver")
public CommonResult uploadDispatchDetailByDriver(@RequestBody RescueInfoDispatchDetail rescueInfoDispatchDetail) throws Exception {
rescueDriverInfoService.uploadDispatchDetailByDriver(rescueInfoDispatchDetail);
return success("成功");
}
//设置应收金额
@PostMapping("/setOrderMoney")
public CommonResult setOrderMoney(@RequestParam("rescueId") String rescueId, @RequestParam("setMoney") Double setMoney) throws Exception {
@ -152,15 +174,8 @@ public class RescueDriverController extends BaseController {
//设置应收金额
@PostMapping("/setOrderMoneyNew")
public CommonResult setOrderMoneyNew(@RequestParam("rescueId") String rescueId,
@RequestParam("setMoney") Double setMoney,
@RequestParam("autoRemark") String autoRemark,
@RequestParam(name = "images" ,required = false) String images,
@RequestParam(name = "remark" ,required = false) String remark,
@RequestParam(name = "payType", required = false) String payType,
@RequestParam(name = "orderSigningPersonId" ,required = false) Long orderSigningPersonId,
@RequestParam(name = "orderSigningPersonName" ,required = false) String orderSigningPersonName) throws Exception {
rescueDriverInfoService.setOrderMoneyNew(Long.parseLong(rescueId), setMoney, remark, autoRemark, images, orderSigningPersonId, orderSigningPersonName, payType);
public CommonResult setOrderMoneyNew(@RequestBody SetMoneyVO setMoneyVO) throws Exception {
rescueDriverInfoService.setOrderMoneyNew(setMoneyVO);
return success("成功");
}
@ -206,4 +221,23 @@ public class RescueDriverController extends BaseController {
return success("成功");
}
/**
* 根据订单详情id更新调度流程信息
*/
@PutMapping("/updateRescueInfoDispatchDetail")
public CommonResult updateRescueInfoDispatchDetail(@RequestBody RescueInfoDispatchDetail rescueInfoDispatchDetail) throws Exception {
rescueInfoDispatchDetailService.updateRescueInfoDispatchDetail(rescueInfoDispatchDetail);
return success("成功");
}
/**
* 根据救援工单id获取指派司机列表
*/
@GetMapping("/listDispatchDriverByRescueId")
public CommonResult listDispatchDriverByRescueId(@RequestParam("rescueId") Long rescueId) {
List<DriverInfo> driverInfoList = rescueDriverInfoService.listDispatchDriverByRescueId(rescueId);
return success(driverInfoList);
}
}

View File

@ -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;
@ -78,6 +79,7 @@ public class RescueInfoController extends BaseController {
for (RoleReqDTO role : roles) {
//如果是二级调度
if (role.getCode().equals("second_dispatcher")) {
rescueInfo.setUserId(user.getId());
IPage<RescueInfo> rescueInfos = rescueInfoService.selectRescueInfoListBySecondDispatcher(rescueInfo, page);
return success(rescueInfos);
}
@ -88,6 +90,41 @@ public class RescueInfoController extends BaseController {
return success(rescueInfos);
}
@GetMapping("/getRescueRevokeList")
public CommonResult getRescueRevokeList(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.selectRescueInfoRevokeListByAdmin(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.selectRescueInfoRevokeListBySecondDispatcher(rescueInfo, page);
return success(rescueInfos);
}
}
}
/*IPage<RescueInfo> rescueInfos = rescueInfoService.selectRescueInfoList(rescueInfo, page);*/
return success(null);
}
@GetMapping("/getRescueStatistics")
public CommonResult getRescueStatistics(RescueInfo rescueInfo) {
@ -129,6 +166,14 @@ public class RescueInfoController extends BaseController {
return success(rescueInfoService.rescueInfoDetail(rescueId));
}
/**
* 获取救援订单调度流程
*/
@GetMapping("/rescueInfoDetailByDispatch")
public CommonResult rescueInfoDetailByDispatch(Long rescueId) {
return success(rescueInfoService.rescueInfoDetailByDispatch(rescueId));
}
/**
* 新增道路救援发起
*/
@ -139,6 +184,12 @@ public class RescueInfoController extends BaseController {
return success();
}
@PutMapping("/updateRescueInfoOnHomePage")
public CommonResult updateRescueInfoOnHomePage(@RequestBody @Valid RescueInfo rescueInfo) {
rescueInfoService.updateRescueInfoOnHomePage(rescueInfo);
return success();
}
/**
* 新增道路救援发起
*/
@ -149,6 +200,12 @@ public class RescueInfoController extends BaseController {
return success();
}
@PostMapping("/editByDetails")
public CommonResult editByDetails(@RequestBody @Valid RescueInfo rescueInfo) {
rescueInfoService.updateById(rescueInfo);
return success();
}
/**
* 取消道路救援
*/
@ -172,6 +229,12 @@ public class RescueInfoController extends BaseController {
}
//
@PutMapping("/revokeRescueInfo")
public CommonResult revokeRescueInfo(Long id) {
rescueInfoService.revokeRescueInfo(id);
return success();
}
/**
* 查询请填写功能名称列表
*/
@ -181,6 +244,12 @@ public class RescueInfoController extends BaseController {
return success(list);
}
@GetMapping("/driverListNew")
public CommonResult driverListAppNew(DriverInfoDto driverInfoDto) {
List<DriverInfo2Dto> list = rescueInfoService.driverListAppNew(driverInfoDto);
return success(list);
}
/**
* 查询请填写功能名称列表
*/
@ -282,10 +351,11 @@ public class RescueInfoController extends BaseController {
@PostMapping("/toRepair")
public CommonResult toRepair(@RequestBody RepairBookingRespVO repairBookingRespVO) {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
RescueInfo rescueInfo = rescueInfoService.getById(repairBookingRespVO.getRescueId());
if("1".equals(rescueInfo.getIsWeiXiu())){
/*if("1".equals(rescueInfo.getIsWeiXiu())){
return error("已转维修,请勿重复操作");
}
}*/
// 创建维修订单
RepairBookingRespVO repairBooking = new RepairBookingRespVO();
repairBooking.setUserName(repairBookingRespVO.getUserName());
@ -294,17 +364,29 @@ public class RescueInfoController extends BaseController {
repairBooking.setSource("救援转维修");
repairBooking.setChannel(rescueInfo.getChannel());
repairBooking.setRepairType("06");
repairBooking.setBookingTime(LocalDateTime.now() );
repairBooking.setBookingTime(LocalDateTime.now());
repairBooking.setAdviserId(repairBookingRespVO.getAdviserId());
repairBooking.setAdviserName(repairBookingRespVO.getAdviserName());
repairBooking.setAdviserPhone(repairBookingRespVO.getAdviserPhone());
dlRepairBookingService.updateBooking(repairBooking);
rescueInfo.setIsWeiXiu("1");
rescueInfo.setZwxUserId(rescueInfoService.safeStringToLong(repairBookingRespVO.getAdviserId(), null));
// rescueInfo.setZwxUserId(rescueInfoService.safeStringToLong(repairBookingRespVO.getAdviserId(), null));
if (loginUser != null) {
rescueInfo.setZwxUserId(loginUser.getId());
}
rescueInfoService.updateRescueInfo(rescueInfo);
return success(rescueInfo);
}
/**
* 获取统计数据
*/
@GetMapping("/statisticsAll")
public CommonResult statisticsAll(StatisticsStaffVO statisticsStaffReqVO) {
return success(rescueInfoService.statisticsAll(statisticsStaffReqVO));
}
}

View File

@ -0,0 +1,23 @@
package cn.iocoder.yudao.module.rescue.app.controller.admin;
import cn.iocoder.yudao.module.rescue.core.controller.BaseController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 救援调度流程详细信息 前端控制器
* </p>
*
* @author author
* @since 2025-09-15
*/
@RestController
@RequestMapping("/rescue-info-dispatch-detail")
public class RescueInfoDispatchDetailController extends BaseController {
}

View File

@ -119,4 +119,13 @@ public class RescueCarInfoController extends BaseController {
public CommonResult getAllCar() {
return CommonResult.success(rescueCarInfoService.getAllCar());
}
/**
* 根据司机id查询车辆列表
*/
@GetMapping("/getCarListByDriverId")
public CommonResult getCarListByDriverId(@RequestParam Long driverId) {
return CommonResult.success(rescueCarInfoService.getCarListByDriverId(driverId));
}
}

View File

@ -149,6 +149,15 @@ public class RescueInfoSystem extends BaseController {
return success(list);
}
@GetMapping("/listByRevoke")
public CommonResult<IPage<?>> listByRevoke(RescueInfo rescueInfo,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
Page<RescueInfo> page = new Page<>(pageNo, pageSize);
IPage<RescueInfo> list = rescueInfoService.selectRescueListByRevoke(rescueInfo, page);
return success(list);
}
@GetMapping("/watchImg")
public CommonResult watchImg(@RequestParam("rescueId") Long rescueId) {
List<String> resList = new ArrayList<>();

View File

@ -126,4 +126,32 @@ public class DriverInfo extends TenantBaseDO
@TableField(exist = false)
private List<RescueDriverCarRelation> driverSecondCarRelationList;
@TableField(exist = false)
private Long rescueDriverId;
/**
* 救援id
*/
@TableField(exist = false)
private Long rescueId;
/**
* 救援车id
*/
@TableField(exist = false)
private Long driverCarId;
/**
* 救援车车牌号
*/
@TableField(exist = false)
private String driverCarNum;
/**
* 救援车种类
*/
@TableField(exist = false)
private String driverCarCategory;
}

View File

@ -118,4 +118,10 @@ public class RescueCarInfo extends TenantBaseDO {
@TableField(exist = false)
private Long deptId;
/**
* 司机id
*/
@TableField(exist = false)
private Long driverId;
}

View File

@ -305,6 +305,25 @@ public class RescueInfo extends TenantBaseDO
*/
private Integer currentRecordStep;
/**
* 调度是否出发现场0为否 1为是
*/
private String isDispatchedToScene;
/**
* 调度步骤记录
*/
private Integer dispatchRecordStep;
/**
* 调度出发时的公里数
*/
private Double dispatchStartScale;
/**
* 调度到达时的公里数
*/
private Double dispatchArriveScale;
/**
* 已完成的步骤逗号分隔
*/
@ -335,6 +354,26 @@ public class RescueInfo extends TenantBaseDO
*/
private Long zwxUserId;
/**
* 是否撤销
*/
private String isRevoke;
/**
* 撤销时间
*/
private Date revokeTime;
/**
* 撤销人userId
*/
private Long revokeUserId;
/**
* 撤销人姓名
*/
private String revokeUserName;
@TableField(exist = false)
private String adviserId;
@ -382,4 +421,15 @@ public class RescueInfo extends TenantBaseDO
@TableField(exist = false)
private String confirmPaymentPersonRemark;
@TableField(exist = false)
private String paymentName;
@TableField(exist = false)
private Date paymentTime;
/**
* 调度等级
*/
private Integer dispatchLevel;
}

View File

@ -49,6 +49,12 @@ public class RescueInfoDetail extends TenantBaseDO
@TableField(exist = false)
private String handoverTitle;
/** 是否由调度代理执行流程 */
private String isDispatchAgent;
/** 代理执行流程的调度姓名 */
private String dispatchName;
public RescueInfoDetail() {
}

View File

@ -0,0 +1,89 @@
package cn.iocoder.yudao.module.rescue.domain;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
* 救援调度流程详细信息
* </p>
*
* @author author
* @since 2025-09-15
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("rescue_info_dispatch_detail")
public class RescueInfoDispatchDetail extends TenantBaseDO {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 救援主键
*/
private Long rescueInfoId;
/**
* 类型
*/
private String type;
/**
* 标题
*/
private String title;
/**
* 司机备注
*/
private String remark;
/**
* 照片
*/
private String images;
/**
* 补充照片
*/
private String supplementImages;
/**
* 自动备注
*/
private String autoRemark;
/**
* 耗时
*/
private String timeCost;
/**
* 位置主键
*/
private Long positionId;
public RescueInfoDispatchDetail() {
}
public RescueInfoDispatchDetail(Long rescueInfoId,String type,String title,String remark) {
this.type = type;
this.rescueInfoId = rescueInfoId;
this.title =title;
this.remark =remark;
}
}

View File

@ -187,4 +187,66 @@ public class RescueOrderInfo extends TenantBaseDO
/** 优惠金额 */
@Excel(name = "优惠金额")
private Long couponDiscount;
/** 司机设置的拖车费用 */
private Long towingFee;
/** 司机设置的吊车费用 */
private Long craneFee;
/** 司机设置的其他费用 */
private Long otherFee;
/** 其他费用备注 */
private String otherFeeRemark;
/** 调度设置的拖车费用 */
private Long dispatchTowingFee;
/** 调度设置的吊车费用 */
private Long dispatchCraneFee;
/** 调度设置的其他费用 */
private Long dispatchOtherFee;
/** 调度设置的其他费用备注 */
private String dispatchOtherFeeRemark;
/** 调度设置的总费用 */
private Long dispatchSumFee;
/** 调度选择的收费类型 */
private String dispatchChargeType;
/** 调度确认收费信息备注 */
private String dispatchConfirmChargeRemark;
/** 调度是否已确认应收费用信息0否 1是 */
private String dispatchIsConfirmCharge;
/** 调度填写的应付拖车费 */
private Long dispatchShouldPayTowingFee;
/** 调度填写的应付吊车费 */
private Long dispatchShouldPayCraneFee;
/** 调度填写的应付其他费用 */
private Long dispatchShouldPayOtherFee;
/** 调度填写的应付其他费用备注 */
private String dispatchShouldPayOtherFeeRemark;
/** 调度填写的应付总费用 */
private Long dispatchShouldPaySumFee;
/** 调度选择的付款类型 */
private String dispatchShouldPayType;
/** 调度确认应付费用备注 */
private String dispatchShouldPayRemark;
/** 调度是否已确认应付费用信息0否 1是 */
private String dispatchIsConfirmShouldPay;
}

View File

@ -85,4 +85,9 @@ public interface RescueCarInfoMapper extends BaseMapper<RescueCarInfo>
*/
List<RescueCarInfo> getNoAllocationCar();
List<RescueCarInfo> getAllCar();
/**
* 根据司机id查询车辆列表
*/
List<RescueCarInfo> getCarListByDriverId(Long driverId);
}

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.rescue.mapper;
import cn.iocoder.yudao.module.rescue.domain.DriverInfo;
import cn.iocoder.yudao.module.rescue.domain.RescueDriverInfo;
import cn.iocoder.yudao.module.rescue.domain.RescueInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@ -76,4 +77,9 @@ public interface RescueDriverInfoMapper extends BaseMapper<RescueDriverInfo>
int dqrList(Long driverId);
/**
* 根据救援工单id获取指派司机列表
*/
List<DriverInfo> listDispatchDriverByRescueId(Long rescueId);
}

View File

@ -0,0 +1,19 @@
package cn.iocoder.yudao.module.rescue.mapper;
import cn.iocoder.yudao.module.rescue.domain.RescueInfoDispatchDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 救援调度流程详细信息 Mapper 接口
* </p>
*
* @author author
* @since 2025-09-15
*/
@Mapper
public interface RescueInfoDispatchDetailMapper extends BaseMapper<RescueInfoDispatchDetail> {
}

View File

@ -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;
@ -17,6 +18,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -39,7 +41,11 @@ public interface RescueInfoMapper extends BaseMapper<RescueInfo>
IPage<RescueInfo> selectRescueInfoList(@Param("map") RescueInfo rescueInfo, Page<RescueInfo> page);
IPage<RescueInfo> selectRescueInfoListSecondDispatcher(@Param("map") RescueInfo rescueInfo, Page<RescueInfo> page);
IPage<RescueInfo> selectRescueInfoRevokeList(@Param("map") RescueInfo rescueInfo, Page<RescueInfo> page);
IPage<RescueInfo> selectRescueInfoRevokeListSecondDispatcher(@Param("map") RescueInfo rescueInfo, Page<RescueInfo> page);
IPage<RescueInfo> selectRescueListSystem2(@Param("map") RescueInfo rescueInfo, Page<RescueInfo> page);
IPage<RescueInfo> selectRescueListByRevoke(@Param("map") RescueInfo rescueInfo, Page<RescueInfo> page);
JSONObject listData(RescueInfo rescueInfo);
/**
@ -57,6 +63,7 @@ public interface RescueInfoMapper extends BaseMapper<RescueInfo>
List<DriverInfo2Dto> driverListApp(DriverInfoDto user);
List<DriverInfo2Dto> driverListAppNew(DriverInfoDto user);
List<DriverInfo2Dto> secondDriverListApp(DriverInfoDto user);
List<DriverInfo2Dto> secondDriverListAppNew(DriverInfoDto user);
Map<String,Integer> driverInMap2();
void dealOverTimeRescue();
List<RescueInfo> getOverTimeRescue();
@ -97,4 +104,10 @@ public interface RescueInfoMapper extends BaseMapper<RescueInfo>
DriverStaffSaveVO getOnInternal(Long id);
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);
List<StatisticsStaffVO> driverStatistics(@Param("vo") StatisticsStaffVO statisticsStaffReqVO);
List<StatisticsStaffVO> carStatistics(@Param("vo") StatisticsStaffVO statisticsStaffReqVO);
List<StatisticsStaffVO> dispatchStatistics(@Param("vo") StatisticsStaffVO statisticsStaffReqVO);
}

View File

@ -11,7 +11,7 @@ import java.util.Map;
/**
* 救援订单Mapper接口
*
*
* @author zcy
* @date 2023-09-19
*/
@ -20,15 +20,17 @@ public interface RescueOrderInfoMapper extends BaseMapper<RescueOrderInfo>
{
/**
* 查询救援订单
*
*
* @param id 救援订单主键
* @return 救援订单
*/
public RescueOrderInfo selectRescueOrderInfoById(Long id);
public RescueOrderInfo selectRescueOrderInfoByIdNew(Long id);
public RescueOrderInfo selectRescueOrderInfoByRescueInfoId(Long id);
/**
* 查询救援订单列表
*
*
* @param rescueOrderInfo 救援订单
* @return 救援订单集合
*/

View File

@ -86,4 +86,9 @@ public interface IRescueCarInfoService extends IService<RescueCarInfo>
*/
List<RescueCarInfo> getNoAllocationCar();
List<RescueCarInfo> getAllCar();
/**
* 根据司机id查询车辆列表
*/
List<RescueCarInfo> getCarListByDriverId(Long driverId);
}

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.rescue.service;
import cn.iocoder.yudao.module.rescue.domain.*;
import cn.iocoder.yudao.module.rescue.vo.SetMoneyVO;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -40,11 +41,15 @@ public interface IRescueDriverInfoService extends IService<RescueDriverInfo>
List<RescueInfo> driverRescuePage(RescueInfo rescueInfo);
void driverAccept(Long rescueDriverId,String choose,String rejectReason) throws Exception;
void driverAcceptByAgent(Long rescueDriverId,String choose,String rejectReason,Long driverId) throws Exception;
JSONObject rescueDetail(Long rescueId);
JSONObject rescueDetailByDispatch(Long rescueId);
void updateRescueInfo(RescueInfo rescueInfo) throws Exception;
void updateRescueInfoAndDetails(RescueInfo rescueInfo) throws Exception;
void uploadDetailByDriver(RescueInfoDetail rescueInfoDetail) throws Exception;
void uploadDispatchDetailByDriver(RescueInfoDispatchDetail rescueInfoDispatchDetail) throws Exception;
void setOrderMoney(Long rescueId,Double setMoney) throws Exception;
void setOrderMoneyNew(Long rescueId,Double setMoney,String remark,String autoRemark,String images,Long orderSigningPersonId,String orderSigningPersonName,String payType) throws Exception;
void setOrderMoneyNew(SetMoneyVO setMoneyVO) throws Exception;
void endRescue(Long rescueId) throws Exception;
void addRefuelRecord(RescueRefuelRecord rescueRefuelRecord) throws Exception;
IPage<RescueRefuelRecord> listRefuelRecord(RescueRefuelRecord rescueRefuelRecord, Page<RescueRefuelRecord> page);
@ -53,5 +58,8 @@ public interface IRescueDriverInfoService extends IService<RescueDriverInfo>
IPage<RescueInfo> driverRescuePage2(RescueInfo rescueInfo, Page<RescueInfo> page);
/**
* 根据救援工单id获取指派司机列表
*/
List<DriverInfo> listDispatchDriverByRescueId(Long rescueId);
}

View File

@ -0,0 +1,21 @@
package cn.iocoder.yudao.module.rescue.service;
import cn.iocoder.yudao.module.rescue.domain.RescueInfoDispatchDetail;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 救援调度流程详细信息 服务类
* </p>
*
* @author author
* @since 2025-09-15
*/
public interface IRescueInfoDispatchDetailService extends IService<RescueInfoDispatchDetail> {
/**
* 根据订单详情id更新调度流程信息
*/
void updateRescueInfoDispatchDetail(RescueInfoDispatchDetail rescueInfoDispatchDetail);
}

View File

@ -47,9 +47,14 @@ public interface IRescueInfoService extends IService<RescueInfo>
IPage<RescueInfo> selectRescueInfoListByAdmin(RescueInfo rescueInfo, Page<RescueInfo> page);
IPage<RescueInfo> selectRescueInfoListBySecondDispatcher(RescueInfo rescueInfo, Page<RescueInfo> page);
IPage<RescueInfo> selectRescueInfoRevokeListByAdmin(RescueInfo rescueInfo, Page<RescueInfo> page);
IPage<RescueInfo> selectRescueInfoRevokeListBySecondDispatcher(RescueInfo rescueInfo, Page<RescueInfo> page);
JSONObject rescueInfoDetail(Long rescueId);
JSONObject rescueInfoDetailByDispatch(Long rescueId);
IPage<RescueInfo> selectRescueListSystem(Page<RescueInfo> page,RescueInfo rescueInfo);
IPage<RescueInfo> selectRescueListSystem2(RescueInfo rescueInfo, Page<RescueInfo> page);
IPage<RescueInfo> selectRescueListByRevoke(RescueInfo rescueInfo, Page<RescueInfo> page);
JSONObject listData(RescueInfo rescueInfo);
void designateDriver(Long rescueId,Long driverId) throws Exception;
@ -61,6 +66,7 @@ public interface IRescueInfoService extends IService<RescueInfo>
* @return 结果
*/
public void insertRescueInfo(RescueInfo rescueInfo);
public void updateRescueInfoOnHomePage(RescueInfo rescueInfo);
/**
* 修改请填写功能名称
@ -85,6 +91,7 @@ public interface IRescueInfoService extends IService<RescueInfo>
* @return 结果
*/
public void deleteRescueInfoById(Long id);
void revokeRescueInfo(Long id);
IPage<DriverInfo> driverList(DriverInfoDto user, Page<DriverInfo> page);
IPage<DriverInfo> driverListNew(DriverInfoDto user, Page<DriverInfo> page);
IPage<DriverInfo> driverAndCarList(DriverInfoDto user, Page<DriverInfo> page);
@ -100,6 +107,7 @@ public interface IRescueInfoService extends IService<RescueInfo>
void delDriverNew(Long[] ids);
void delDriverStaffNew(Long[] ids);
List<DriverInfo2Dto> driverListApp(DriverInfoDto driverInfoDto);
List<DriverInfo2Dto> driverListAppNew(DriverInfoDto driverInfoDto);
List<DriverInfo2Dto> driverInMap(DriverInfoDto driverInfoDto);
List<DriverInfo2Dto> secondDriverInMap(DriverInfoDto driverInfoDto);
Map<String, Integer> driverInMap2();
@ -187,4 +195,6 @@ public interface IRescueInfoService extends IService<RescueInfo>
List<DriverInfoExportVO> getAll(DriverInfoDto query);
Long safeStringToLong(String str, Long defaultValue);
List<StatisticsStaffVO> statisticsAll(StatisticsStaffVO statisticsStaffReqVO);
}

View File

@ -12,7 +12,7 @@ import java.util.Map;
/**
* 救援订单Service接口
*
*
* @author zcy
* @date 2023-09-19
*/
@ -20,15 +20,17 @@ public interface IRescueOrderInfoService extends IService<RescueOrderInfo>
{
/**
* 查询救援订单
*
*
* @param id 救援订单主键
* @return 救援订单
*/
public RescueOrderInfo selectRescueOrderInfoById(Long id);
public RescueOrderInfo selectRescueOrderInfoByIdNew(Long id);
public RescueOrderInfo selectRescueOrderInfoByRescueInfoId(Long id);
/**
* 查询救援订单列表
*
*
* @param rescueOrderInfo 救援订单
* @return 救援订单集合
*/
@ -36,7 +38,7 @@ public interface IRescueOrderInfoService extends IService<RescueOrderInfo>
/**
* 新增救援订单
*
*
* @param rescueOrderInfo 救援订单
* @return 结果
*/
@ -44,7 +46,7 @@ public interface IRescueOrderInfoService extends IService<RescueOrderInfo>
/**
* 修改救援订单
*
*
* @param rescueOrderInfo 救援订单
* @return 结果
*/
@ -52,7 +54,7 @@ public interface IRescueOrderInfoService extends IService<RescueOrderInfo>
/**
* 批量删除救援订单
*
*
* @param ids 需要删除的救援订单主键集合
* @return 结果
*/
@ -60,7 +62,7 @@ public interface IRescueOrderInfoService extends IService<RescueOrderInfo>
/**
* 删除救援订单信息
*
*
* @param id 救援订单主键
* @return 结果
*/

View File

@ -194,4 +194,12 @@ public class RescueCarInfoServiceImpl extends ServiceImpl<RescueCarInfoMapper, R
}
/**
* 根据司机id查询车辆列表
*/
@Override
public List<RescueCarInfo> getCarListByDriverId(Long driverId) {
return baseMapper.getCarListByDriverId(driverId);
}
}

View File

@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.CoordinateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.HttpUtil;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.custom.entity.CarMain;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.service.CustomerCarService;
@ -15,6 +16,7 @@ import cn.iocoder.yudao.module.partner.service.IPartnerCustomerInfoService;
import cn.iocoder.yudao.module.rescue.domain.*;
import cn.iocoder.yudao.module.rescue.mapper.RescueDriverInfoMapper;
import cn.iocoder.yudao.module.rescue.utils.RedissonDelayQueue;
import cn.iocoder.yudao.module.rescue.vo.SetMoneyVO;
import cn.iocoder.yudao.module.shop.entity.ShopUserCar;
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
@ -65,6 +67,9 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
private IDriverInfoService driverInfoService;
@Autowired
private IRescueInfoDetailService detailService;
@Autowired
private IRescueInfoDispatchDetailService dispatchDetailService;
@Autowired
private IRescueDriverPositionService positionService;
@Autowired
@ -93,6 +98,9 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
@Resource
private IRescueDriverCarRelationService rescueDriverCarRelationService;
@Resource
private AdminUserApi userApi;
public static String Redis_Driver_Key = "Rescue:Driver:";
public static String Redis_Driver_Position_Key = "DriverPosition:";
public static Map<String, Object> driverInfoMap = new HashMap<>();
@ -133,7 +141,7 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
//已完成
LambdaQueryWrapper<RescueInfo> queryWrapper2 = new LambdaQueryWrapper<>();
queryWrapper2.eq(RescueInfo::getDriverId, driverId).and(item -> {
item.eq(RescueInfo::getRescueStatus, "5").or().eq(RescueInfo::getRescueStatus, "6");
item.eq(RescueInfo::getRescueStatus, "4").or().eq(RescueInfo::getRescueStatus, "5").or().eq(RescueInfo::getRescueStatus, "6");
});
long count2 = rescueInfoService.count(queryWrapper2);
driverInfo.setWcNum(count2);
@ -331,19 +339,19 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
RescueCarInfo firstCar = rescueDriverCarRelationService.getPrimaryCarInfo(driverInfo.getId());
List<RescueCarInfo> secondCars = rescueDriverCarRelationService.getSecondaryCarInfo(driverInfo.getId());
// 如果主车不为null使用主车信息如果主车为null使用副车信息如果都为null报错
if(firstCar != null){
if (firstCar != null) {
rescueInfo.setDriverId(rescueDriverInfo.getDriverId());
rescueInfo.setDriverName(driverUser.getNickname());
rescueInfo.setDriverPhoneNum(driverInfo.getPhonenumber());
rescueInfo.setDriverCarNum(firstCar.getRescueCarNum());
rescueInfo.setDriverCarCategory(firstCar.getCarCategory());
}else if (CollectionUtils.isNotEmpty(secondCars)){
} else if (CollectionUtils.isNotEmpty(secondCars)) {
rescueInfo.setDriverId(rescueDriverInfo.getDriverId());
rescueInfo.setDriverName(driverUser.getNickname());
rescueInfo.setDriverPhoneNum(driverInfo.getPhonenumber());
rescueInfo.setDriverCarNum(secondCars.get(0).getRescueCarNum());
rescueInfo.setDriverCarCategory(secondCars.get(0).getCarCategory());
}else {
} else {
throw exception0(500, "请联系管理员维护车辆信息开始接单");
}
/*LambdaQueryWrapper<RescueCarInfo> queryWrapper1 = new LambdaQueryWrapper<>();
@ -428,6 +436,102 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
}
@Override
@Transactional(rollbackFor = Exception.class)
public void driverAcceptByAgent(Long rescueDriverId, String choose, String rejectReason, Long driverId) throws Exception {
RescueDriverInfo rescueDriverInfo = this.getById(rescueDriverId);
RescueInfo rescueInfo = rescueInfoService.selectRescueInfoById(rescueDriverInfo.getRescueId());
AdminUserRespDTO user = userService.getUser(rescueInfo.getUserId());
Lock lock = new ReentrantLock();
lock.lock();
try {
if (!ObjectUtils.isEmpty(rescueInfo.getDriverId())) {
throw exception0(500, "订单已被抢走");
}
DriverInfo driverInfo = driverInfoService.getById(rescueDriverInfo.getDriverId());
AdminUserRespDTO driverUser = userService.getUser(driverInfo.getUserId());
Long deptId = driverInfo.getDeptId();
//接受
rescueDriverInfo.setDriverAccept("1");
this.updateById(rescueDriverInfo);
RescueCarInfo firstCar = rescueDriverCarRelationService.getPrimaryCarInfo(driverInfo.getId());
List<RescueCarInfo> secondCars = rescueDriverCarRelationService.getSecondaryCarInfo(driverInfo.getId());
// 如果主车不为null使用主车信息如果主车为null使用副车信息如果都为null报错
if (firstCar != null) {
rescueInfo.setDriverId(rescueDriverInfo.getDriverId());
rescueInfo.setDriverName(driverUser.getNickname());
rescueInfo.setDriverPhoneNum(driverInfo.getPhonenumber());
rescueInfo.setDriverCarNum(firstCar.getRescueCarNum());
rescueInfo.setDriverCarCategory(firstCar.getCarCategory());
} else if (CollectionUtils.isNotEmpty(secondCars)) {
rescueInfo.setDriverId(rescueDriverInfo.getDriverId());
rescueInfo.setDriverName(driverUser.getNickname());
rescueInfo.setDriverPhoneNum(driverInfo.getPhonenumber());
rescueInfo.setDriverCarNum(secondCars.get(0).getRescueCarNum());
rescueInfo.setDriverCarCategory(secondCars.get(0).getCarCategory());
} else {
throw exception0(500, "请联系管理员维护车辆信息开始接单");
}
//状态修改为救援中
rescueInfo.setRescueStatus("3");
rescueInfoService.updateRescueInfo(rescueInfo);
//处理别的司机的订单信息
LambdaQueryWrapper<RescueDriverInfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(RescueDriverInfo::getRescueId, rescueDriverInfo.getRescueId()).ge(RescueDriverInfo::getDriverId, rescueDriverId);
this.remove(queryWrapper);
//再更新司机当前的订单状态
//所在机构
String redisKey = Redis_Driver_Key + deptId + ":" + driverInfo.getId();
//订单开始
RescueOrderInfo rescueOrderInfo = new RescueOrderInfo();
rescueOrderInfo.setRescueInfoId(rescueInfo.getId());
rescueOrderInfo.setOrderNo("appJy" + "-" + System.currentTimeMillis() + "-" + getRandomString6());
rescueOrderInfo.setIsOnline("1");
rescueOrderInfo.setOrderStatus("0");
rescueOrderInfo.setOrderTime(new Date());
rescueOrderInfo.setOrderType("jy");
rescueOrderInfo.setPhonenumber(user.getMobile());
rescueOrderInfo.setUserId(user.getId());
rescueOrderInfo.setRealName(user.getNickname());
if (rescueInfo.getFeeType().equals("2")) {
//签单
rescueOrderInfo.setPayType("qd");
}
rescueOrderInfoService.insertRescueOrderInfo(rescueOrderInfo);
//增加司机接单次数
Long rescueNum = Optional.ofNullable(driverInfo.getRescueNum()).orElse(0L);
driverInfo.setRescueNum(++rescueNum);
driverInfo.setDriverStatus("3");
driverInfoService.updateById(driverInfo);
if (redisCache.hasKey(redisKey)) {
String rescueIds = "";
Object tmp = redisCache.getCacheMapValue(redisKey, "rescueIds");
if (ObjectUtils.isNotEmpty(tmp)) {
rescueIds = tmp.toString() + "," + rescueInfo.getId();
} else {
rescueIds = rescueInfo.getId().toString();
}
redisCache.setCacheMapValue(redisKey, "rescueIds", rescueIds);
redisCache.setCacheMapValue(redisKey, "status", "3");
} else {
JSONObject map = new JSONObject();
map.put("rescueIds", rescueInfo.getId());
redisCache.setCacheMap(redisKey, map);
}
// 删除定时任务
redissonDelayQueue.removeAllTasks(rescueInfo.getId());
} catch (Exception e) {
log.error(e.getMessage());
throw new Exception(e.getMessage());
} finally {
lock.unlock();
}
}
@Override
public JSONObject rescueDetail(Long rescueId) {
JSONObject res = new JSONObject();
@ -437,7 +541,7 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
String car_type = dictDataService.getDictDataLabel("rescue_car_type", rescueInfo.getCarType());
rescueInfo.setCarTypeStr(car_type);
String rescue_status = dictDataService.getDictDataLabel("jy_status", rescueInfo.getRescueStatus());
rescueInfo.setRescueStatus(rescue_status);
rescueInfo.setRescueStatusStr(rescue_status);
String feeStr = dictDataService.getDictDataLabel("fee_type", rescueInfo.getFeeType());
rescueInfo.setFeeTypeStr(feeStr);
if (StringUtils.isNotEmpty(rescueInfo.getRescueSceneImage())) {
@ -497,17 +601,63 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
return res;
}
@Override
public JSONObject rescueDetailByDispatch(Long rescueId) {
JSONObject res = new JSONObject();
RescueInfo rescueInfo = rescueInfoService.getById(rescueId);
String dljy_type = dictDataService.getDictDataLabel("dljy_type", rescueInfo.getRescueType());
rescueInfo.setRescueTypeStr(dljy_type);
String car_type = dictDataService.getDictDataLabel("rescue_car_type", rescueInfo.getCarType());
rescueInfo.setCarTypeStr(car_type);
String rescue_status = dictDataService.getDictDataLabel("jy_status", rescueInfo.getRescueStatus());
rescueInfo.setRescueStatusStr(rescue_status);
String feeStr = dictDataService.getDictDataLabel("fee_type", rescueInfo.getFeeType());
rescueInfo.setFeeTypeStr(feeStr);
if (StringUtils.isNotEmpty(rescueInfo.getRescueSceneImage())) {
rescueInfo.setRescueSceneImageList(rescueInfo.getRescueSceneImage().split(","));
}
LambdaQueryWrapper<RescueInfoDispatchDetail> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(RescueInfoDispatchDetail::getRescueInfoId, rescueId).orderByAsc(TenantBaseDO::getCreateTime);
List<RescueInfoDispatchDetail> list = dispatchDetailService.list(queryWrapper);
LambdaQueryWrapper<RescueOrderInfo> queryWrapper2 = new LambdaQueryWrapper<>();
queryWrapper2.eq(RescueOrderInfo::getRescueInfoId, rescueId);
// RescueOrderInfo orderInfo = rescueOrderInfoService.getOne(queryWrapper2);
List<RescueOrderInfo> orderInfoList = rescueOrderInfoService.list(queryWrapper2);
if (ObjectUtils.isNotEmpty(orderInfoList)) {
RescueOrderInfo orderInfo = orderInfoList.get(0);
if (ObjectUtils.isNotEmpty(orderInfo)) {
rescueInfo.setSetMoney(orderInfo.getSetMoney());
rescueInfo.setOrderStatus(orderInfo.getOrderStatus());
rescueInfo.setPayType(orderInfo.getPayType());
rescueInfo.setOrderId(orderInfo.getId());
}
}
RescueOrderInfo rescueOrderInfo = rescueOrderInfoService.selectRescueOrderInfoByRescueInfoId(rescueId);
if (rescueOrderInfo != null) {
res.put("orderInfo", rescueOrderInfo);
}
res.put("rescueInfo", rescueInfo);
res.put("detailList", list);
return res;
}
@Override
public void updateRescueInfo(RescueInfo rescueInfo) throws Exception {
rescueInfoService.updateById(rescueInfo);
}
@Override
public void updateRescueInfoAndDetails(RescueInfo rescueInfo) throws Exception {
detailService.save(new RescueInfoDetail(rescueInfo.getId(), "1", "救援发起,等待接单", rescueInfo.getRescueDetail()));
rescueInfoService.updateById(rescueInfo);
}
@Override
public void uploadDetailByDriver(RescueInfoDetail rescueInfoDetail) throws Exception {
//到达地点打卡
String recordType = dictDataService.getDictDataLabel("rescue_process_node_fixed", rescueInfoDetail.getType());
// String recordType = dictDataService.getDictDataLabel("rescue_driver_record_type", rescueInfoDetail.getType());
if(rescueInfoDetail.getTitle() == null){
if (rescueInfoDetail.getTitle() == null) {
rescueInfoDetail.setTitle(recordType);
}
LambdaQueryWrapper<RescueInfoDetail> queryWrapper = new LambdaQueryWrapper<>();
@ -551,10 +701,10 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
driverPosition.setPositionInfo(positionStr);
positionService.save(driverPosition);
rescueInfoDetail.setPositionId(driverPosition.getId());
if("2".equals(rescueInfoDetail.getType()) && driverPosition.getId() != null){
if ("2".equals(rescueInfoDetail.getType()) && driverPosition.getId() != null) {
rescueInfoDetail.setAutoRemark("起始地:" + positionStr);
}
if("6".equals(rescueInfoDetail.getType()) && rescueInfoDetail.getHandoverTitle() != null){
if ("6".equals(rescueInfoDetail.getType()) && rescueInfoDetail.getHandoverTitle() != null) {
rescueInfoDetail.setTitle(recordType + ": " + rescueInfoDetail.getHandoverTitle());
}
} catch (Exception e) {
@ -565,6 +715,21 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
}
@Override
public void uploadDispatchDetailByDriver(RescueInfoDispatchDetail rescueInfoDispatchDetail) throws Exception {
String recordType = dictDataService.getDictDataLabel("rescue_dispatch_process", rescueInfoDispatchDetail.getType());
if (rescueInfoDispatchDetail.getTitle() == null) {
rescueInfoDispatchDetail.setTitle(recordType);
}
/*LambdaQueryWrapper<RescueInfoDispatchDetail> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(RescueInfoDispatchDetail::getRescueInfoId, rescueInfoDispatchDetail.getRescueInfoId()).eq(RescueInfoDispatchDetail::getType, rescueInfoDispatchDetail.getType());
List<RescueInfoDispatchDetail> list = dispatchDetailService.list(queryWrapper);
if (CollectionUtil.isNotEmpty(list)) {
throw new Exception("不可重复上传");
}*/
dispatchDetailService.save(rescueInfoDispatchDetail);
}
@Override
public void setOrderMoney(Long rescueId, Double setMoney) throws Exception {
Double temp = setMoney * 100;
@ -594,33 +759,50 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
}
@Override
public void setOrderMoneyNew(Long rescueId, Double setMoney, String remark, String autoRemark, String images, Long orderSigningPersonId, String orderSigningPersonName,String payType) throws Exception {
Double temp = setMoney * 100;
public void setOrderMoneyNew(SetMoneyVO setMoneyVO) throws Exception {
Long userId = SecurityFrameworkUtils.getLoginUserId();
AdminUserRespDTO loginUser = userApi.getUser(userId);
Double temp = setMoneyVO.getSetMoney() * 100;
long setMoneyRes = temp.longValue();
LambdaQueryWrapper<RescueOrderInfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(RescueOrderInfo::getRescueInfoId, rescueId);
queryWrapper.eq(RescueOrderInfo::getRescueInfoId, setMoneyVO.getRescueId());
RescueOrderInfo one = rescueOrderInfoService.getOne(queryWrapper);
if (Integer.parseInt(one.getOrderStatus()) > 1) {
throw new Exception("订单已完结不可更改");
}
one.setSetMoney(setMoneyRes);
if(orderSigningPersonId != null){
one.setOrderSigningPersonId(orderSigningPersonId);
if (setMoneyVO.getOrderSigningPersonId() != null) {
one.setOrderSigningPersonId(setMoneyVO.getOrderSigningPersonId());
}
if(orderSigningPersonName != null){
one.setOrderSigningPersonName(orderSigningPersonName);
if (setMoneyVO.getOrderSigningPersonName() != null) {
one.setOrderSigningPersonName(setMoneyVO.getOrderSigningPersonName());
}
if (payType != null){
one.setPayType(payType);
if (setMoneyVO.getPayType() != null) {
one.setPayType(setMoneyVO.getPayType());
}
one.setPaymentId(userId);
if(loginUser != null){
one.setPaymentName(loginUser.getNickname());
}
one.setPaymentTime(new Date());
one.setOrderStatus("1");
if(setMoneyVO.getTowingFee() != null){
one.setTowingFee(setMoneyVO.getTowingFee().longValue());
}
if(setMoneyVO.getCraneFee() != null){
one.setCraneFee(setMoneyVO.getCraneFee().longValue());
}
if(setMoneyVO.getOtherFee() != null){
one.setOtherFee(setMoneyVO.getOtherFee().longValue());
}
one.setOtherFeeRemark(setMoneyVO.getOtherFeeRemark());
rescueOrderInfoService.updateById(one);
RescueInfoDetail rescueInfoDetail = new RescueInfoDetail();
rescueInfoDetail.setRescueInfoId(rescueId);
rescueInfoDetail.setRescueInfoId(setMoneyVO.getRescueId());
rescueInfoDetail.setTitle("费用核算");
rescueInfoDetail.setAutoRemark("司机核算救援费用为" + setMoney + "元, " + autoRemark);
rescueInfoDetail.setRemark(remark);
rescueInfoDetail.setImages(images);
rescueInfoDetail.setAutoRemark("司机核算救援费用为" + setMoneyVO.getSetMoney() + "元, " + setMoneyVO.getAutoRemark());
rescueInfoDetail.setRemark(setMoneyVO.getRemark());
rescueInfoDetail.setImages(setMoneyVO.getImages());
detailService.save(rescueInfoDetail);
RescueOrderDetail rescueOrderDetail = new RescueOrderDetail();
rescueOrderDetail.setRecordTime(new Date());
@ -687,9 +869,9 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
// 绑定用户手机号
saveReqVO.setPhoneNumber(rescueInfo.getConnectionPhone());
// 客户名称
if(ObjectUtil.isNotEmpty(rescueInfo.getConnectionName())) {
if (ObjectUtil.isNotEmpty(rescueInfo.getConnectionName())) {
saveReqVO.setCusName(rescueInfo.getConnectionName());
}else {
} else {
saveReqVO.setCusName(rescueInfo.getConnectionPhone());
}
// 车辆信息
@ -813,5 +995,13 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
return rescueInfos;
}
/**
* 根据救援工单id获取指派司机列表
*/
@Override
public List<DriverInfo> listDispatchDriverByRescueId(Long rescueId) {
return baseMapper.listDispatchDriverByRescueId(rescueId);
}
}

View File

@ -0,0 +1,27 @@
package cn.iocoder.yudao.module.rescue.service.impl;
import cn.iocoder.yudao.module.rescue.domain.RescueInfoDispatchDetail;
import cn.iocoder.yudao.module.rescue.mapper.RescueInfoDispatchDetailMapper;
import cn.iocoder.yudao.module.rescue.service.IRescueInfoDispatchDetailService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 救援调度流程详细信息 服务实现类
* </p>
*
* @author author
* @since 2025-09-15
*/
@Service
public class RescueInfoDispatchDetailServiceImpl extends ServiceImpl<RescueInfoDispatchDetailMapper, RescueInfoDispatchDetail> implements IRescueInfoDispatchDetailService {
/**
* 根据订单详情id更新调度流程信息
*/
@Override
public void updateRescueInfoDispatchDetail(RescueInfoDispatchDetail rescueInfoDispatchDetail) {
baseMapper.updateById(rescueInfoDispatchDetail);
}
}

View File

@ -49,6 +49,7 @@ import com.baomidou.dynamic.datasource.annotation.DSTransactional;
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.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -136,6 +137,11 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
@Resource
private IRescueDriverCarRelationService driverCarRelationService;
@Resource
private AdminUserApi userApi;
@Resource
private IRescueInfoDispatchDetailService rescueInfoDispatchDetailService;
/**
@ -258,7 +264,7 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
}
@Override
/*@Override
public IPage<RescueInfo> selectRescueInfoListByAdmin(RescueInfo rescueInfo, Page<RescueInfo> page) {
LoginUser user = getLoginUser();
AdminUserRespDTO adminUser = userService.getUser(user.getId());
@ -299,9 +305,117 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
}
}
return rescueInfos;
}
}*/
@Override
/*@Override
public IPage<RescueInfo> selectRescueInfoListByAdmin(RescueInfo rescueInfo, Page<RescueInfo> page) {
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);
IPage<RescueInfo> rescueInfos = baseMapper.selectRescueInfoList(rescueInfo, page);
List<RescueInfo> records = rescueInfos.getRecords();
if (records.isEmpty()) {
return rescueInfos;
}
// 收集所有需要查询的字典值和司机ID
Set<String> rescueTypeValues = new HashSet<>();
Set<String> rescueStatusValues = new HashSet<>();
Set<String> orderStatusValues = new HashSet<>();
Set<String> carTypeValues = new HashSet<>();
Set<Long> driverIds = new HashSet<>();
for (RescueInfo info : records) {
if (StringUtils.isNotBlank(info.getRescueType())) {
rescueTypeValues.add(info.getRescueType());
}
if (StringUtils.isNotBlank(info.getRescueStatus())) {
rescueStatusValues.add(info.getRescueStatus());
}
if (StringUtils.isNotBlank(info.getOrderStatus())) {
orderStatusValues.add(info.getOrderStatus());
}
if (StringUtils.isNotBlank(info.getCarType())) {
carTypeValues.add(info.getCarType());
}
if (ObjectUtils.isNotEmpty(info.getDriverId())) {
driverIds.add(info.getDriverId());
}
}
// 批量查询字典数据
Map<String, String> rescueTypeMap = dictDataService.getDictDataLabels("dljy_type", rescueTypeValues);
Map<String, String> rescueStatusMap = dictDataService.getDictDataLabels("jy_status", rescueStatusValues);
Map<String, String> orderStatusMap = dictDataService.getDictDataLabels("jy_order_status", orderStatusValues);
Map<String, String> carTypeMap = dictDataService.getDictDataLabels("rescue_car_type", carTypeValues);
// 批量获取司机位置信息
Map<Long, JSONObject> driverLocationMap = new HashMap<>();
if (!driverIds.isEmpty()) {
String tenantPrefix = Redis_Driver_Key + user.getTenantId() + ":";
for (Long driverId : driverIds) {
String driverKey = tenantPrefix + driverId;
if (redisCache2.hasKey(driverKey)) {
try {
Object cacheMap = redisCache2.getCacheMap(driverKey);
if (cacheMap != null) {
JSONObject driverInfo = JSON.parseObject(JSON.toJSONString(cacheMap));
driverLocationMap.put(driverId, driverInfo);
}
} catch (Exception ignored) {
}
}
}
}
// 批量处理数据
for (RescueInfo info : records) {
// 设置字典标签
if (StringUtils.isNotBlank(info.getRescueType())) {
info.setRescueTypeStr(rescueTypeMap.get(info.getRescueType()));
}
if (StringUtils.isNotBlank(info.getRescueStatus())) {
info.setRescueStatusStr(rescueStatusMap.get(info.getRescueStatus()));
}
if (StringUtils.isNotBlank(info.getOrderStatus())) {
info.setOrderStatusStr(orderStatusMap.get(info.getOrderStatus()));
}
if (StringUtils.isNotBlank(info.getCarType())) {
info.setCarTypeStr(carTypeMap.get(info.getCarType()));
}
// 处理司机距离计算
if (ObjectUtils.isNotEmpty(info.getDriverId())) {
JSONObject driverInfo = driverLocationMap.get(info.getDriverId());
if (driverInfo != null) {
try {
Double longitude = driverInfo.getDouble("longitude");
Double latitude = driverInfo.getDouble("latitude");
if (longitude != null && latitude != null &&
StringUtils.isNotBlank(info.getRescueLongitude()) &&
StringUtils.isNotBlank(info.getRescueLatitude())) {
Long distanceMeter = getDistanceMeter(
Double.parseDouble(info.getRescueLongitude()),
Double.parseDouble(info.getRescueLatitude()),
longitude, latitude);
info.setDistance(Double.valueOf(distanceMeter * 1.3d).longValue());
info.setNeedTime(5 + (distanceMeter / 1000) * 2 + 5);
}
} catch (Exception ignored) {
}
}
}
}
return rescueInfos;
}*/
/*@Override
public IPage<RescueInfo> selectRescueInfoListBySecondDispatcher(RescueInfo rescueInfo, Page<RescueInfo> page) {
LoginUser user = getLoginUser();
AdminUserRespDTO adminUser = userService.getUser(user.getId());
@ -312,6 +426,47 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
rescueInfo.setUserId(adminUser.getId());
IPage<RescueInfo> rescueInfos = baseMapper.selectRescueInfoListSecondDispatcher(rescueInfo, page);
for (RescueInfo info : rescueInfos.getRecords()) {
String dljy_type = dictDataService.getDictDataLabel("dljy_type", info.getRescueType());
info.setRescueTypeStr(dljy_type);
String rescueStatus = dictDataService.getDictDataLabel("jy_status", info.getRescueStatus());
info.setRescueStatusStr(rescueStatus);
String orderStatus = dictDataService.getDictDataLabel("jy_order_status", info.getOrderStatus());
info.setOrderStatusStr(orderStatus);
String carType = dictDataService.getDictDataLabel("rescue_car_type", info.getCarType());
info.setCarTypeStr(carType);
//获取当前司机的经纬度
if (ObjectUtils.isNotEmpty(info.getDriverId())) {
//所在顶级机构
String driverKey = Redis_Driver_Key + user.getTenantId() + ":" + info.getDriverId();
if (redisCache2.hasKey(driverKey)) {
try {
JSONObject driverInfo = (JSONObject) JSONObject.parse(JSONObject.toJSONString(redisCache2.getCacheMap(driverKey)));
Double longitude = driverInfo.getDouble("longitude");
//纬度
Double latitude = driverInfo.getDouble("latitude");
Long distanceMeter = getDistanceMeter(Double.parseDouble(info.getRescueLongitude()), Double.parseDouble(info.getRescueLatitude()), longitude, latitude);
info.setDistance(Double.valueOf(distanceMeter * 1.3d).longValue());
info.setNeedTime(5 + (distanceMeter / 1000) * 2 + 5);
} catch (Exception ignored) {
}
}
}
}
return rescueInfos;
}*/
/*@Override
public IPage<RescueInfo> selectRescueInfoRevokeListByAdmin(RescueInfo rescueInfo, Page<RescueInfo> page) {
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);
IPage<RescueInfo> rescueInfos = baseMapper.selectRescueInfoRevokeList(rescueInfo, page);
for (RescueInfo info : rescueInfos.getRecords()) {
@ -343,6 +498,309 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
}
}
return rescueInfos;
}*/
/*@Override
public IPage<RescueInfo> selectRescueInfoRevokeListBySecondDispatcher(RescueInfo rescueInfo, Page<RescueInfo> page) {
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());
IPage<RescueInfo> rescueInfos = baseMapper.selectRescueInfoRevokeListSecondDispatcher(rescueInfo, page);
for (RescueInfo info : rescueInfos.getRecords()) {
String dljy_type = dictDataService.getDictDataLabel("dljy_type", info.getRescueType());
info.setRescueTypeStr(dljy_type);
String rescueStatus = dictDataService.getDictDataLabel("jy_status", info.getRescueStatus());
info.setRescueStatusStr(rescueStatus);
String orderStatus = dictDataService.getDictDataLabel("jy_order_status", info.getOrderStatus());
info.setOrderStatusStr(orderStatus);
String carType = dictDataService.getDictDataLabel("rescue_car_type", info.getCarType());
info.setCarTypeStr(carType);
//获取当前司机的经纬度
if (ObjectUtils.isNotEmpty(info.getDriverId())) {
//所在顶级机构
String driverKey = Redis_Driver_Key + user.getTenantId() + ":" + info.getDriverId();
if (redisCache2.hasKey(driverKey)) {
try {
JSONObject driverInfo = (JSONObject) JSONObject.parse(JSONObject.toJSONString(redisCache2.getCacheMap(driverKey)));
Double longitude = driverInfo.getDouble("longitude");
//纬度
Double latitude = driverInfo.getDouble("latitude");
Long distanceMeter = getDistanceMeter(Double.parseDouble(info.getRescueLongitude()), Double.parseDouble(info.getRescueLatitude()), longitude, latitude);
info.setDistance(Double.valueOf(distanceMeter * 1.3d).longValue());
info.setNeedTime(5 + (distanceMeter / 1000) * 2 + 5);
} catch (Exception ignored) {
}
}
}
}
return rescueInfos;
}*/
/**
* 查询订单列表
*/
@Override
public IPage<RescueInfo> selectRescueInfoListByAdmin(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.selectRescueInfoList(rescueInfo, page);
processRescueInfoRecords(rescueInfos, user, false);
return rescueInfos;
}
/**
* 二级调度查询自己的订单列表
*/
@Override
public IPage<RescueInfo> selectRescueInfoListBySecondDispatcher(RescueInfo rescueInfo, Page<RescueInfo> page) {
LoginUser user = getLoginUser();
AdminUserRespDTO adminUser = userService.getUser(user.getId());
rescueInfo.setDeptList(buildDeptList(adminUser.getDeptId()));
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.selectRescueInfoListSecondDispatcher(rescueInfo, page);
processRescueInfoRecords(rescueInfos, user, true);
return rescueInfos;
}
/**
* 查询已撤销订单列表
*/
@Override
public IPage<RescueInfo> selectRescueInfoRevokeListByAdmin(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.selectRescueInfoRevokeList(rescueInfo, page);
processRescueInfoRecords(rescueInfos, user, false);
return rescueInfos;
}
/**
* 二级调度查询自己撤销的订单
*/
@Override
public IPage<RescueInfo> selectRescueInfoRevokeListBySecondDispatcher(RescueInfo rescueInfo, Page<RescueInfo> page) {
LoginUser user = getLoginUser();
AdminUserRespDTO adminUser = userService.getUser(user.getId());
rescueInfo.setDeptList(buildDeptList(adminUser.getDeptId()));
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);
IPage<RescueInfo> rescueInfos = baseMapper.selectRescueInfoRevokeListSecondDispatcher(rescueInfo, page);
processRescueInfoRecords(rescueInfos, user, true);
return rescueInfos;
}
/**
* 查询工单列表数据处理抽取公共方法
*/
private void processRescueInfoRecords(IPage<RescueInfo> rescueInfos, LoginUser user, boolean includeUserId) {
List<RescueInfo> records = rescueInfos.getRecords();
if (records.isEmpty()) {
return;
}
// 收集所有需要查询的字典值和司机ID
Set<String> rescueTypeValues = new HashSet<>();
Set<String> rescueStatusValues = new HashSet<>();
Set<String> orderStatusValues = new HashSet<>();
Set<String> carTypeValues = new HashSet<>();
Set<Long> driverIds = new HashSet<>();
for (RescueInfo info : records) {
if (StringUtils.isNotBlank(info.getRescueType())) {
rescueTypeValues.add(info.getRescueType());
}
if (StringUtils.isNotBlank(info.getRescueStatus())) {
rescueStatusValues.add(info.getRescueStatus());
}
if (StringUtils.isNotBlank(info.getOrderStatus())) {
orderStatusValues.add(info.getOrderStatus());
}
if (StringUtils.isNotBlank(info.getCarType())) {
carTypeValues.add(info.getCarType());
}
if (ObjectUtils.isNotEmpty(info.getDriverId())) {
driverIds.add(info.getDriverId());
}
}
// 批量查询字典数据
Map<String, String> rescueTypeMap = dictDataService.getDictDataLabels("dljy_type", rescueTypeValues);
Map<String, String> rescueStatusMap = dictDataService.getDictDataLabels("jy_status", rescueStatusValues);
Map<String, String> orderStatusMap = dictDataService.getDictDataLabels("jy_order_status", orderStatusValues);
Map<String, String> carTypeMap = dictDataService.getDictDataLabels("rescue_car_type", carTypeValues);
// 批量获取司机位置信息
Map<Long, JSONObject> driverLocationMap = new HashMap<>();
if (!driverIds.isEmpty()) {
String tenantPrefix = Redis_Driver_Key + user.getTenantId() + ":";
for (Long driverId : driverIds) {
String driverKey = tenantPrefix + driverId;
if (redisCache2.hasKey(driverKey)) {
try {
Object cacheMap = redisCache2.getCacheMap(driverKey);
if (cacheMap != null) {
JSONObject driverInfo = JSON.parseObject(JSON.toJSONString(cacheMap));
driverLocationMap.put(driverId, driverInfo);
}
} catch (Exception ignored) {
}
}
}
}
// 批量处理数据
for (RescueInfo info : records) {
// 设置字典标签
if (StringUtils.isNotBlank(info.getRescueType())) {
info.setRescueTypeStr(rescueTypeMap.get(info.getRescueType()));
}
if (StringUtils.isNotBlank(info.getRescueStatus())) {
info.setRescueStatusStr(rescueStatusMap.get(info.getRescueStatus()));
}
if (StringUtils.isNotBlank(info.getOrderStatus())) {
info.setOrderStatusStr(orderStatusMap.get(info.getOrderStatus()));
}
if (StringUtils.isNotBlank(info.getCarType())) {
info.setCarTypeStr(carTypeMap.get(info.getCarType()));
}
// 处理司机距离计算
if (ObjectUtils.isNotEmpty(info.getDriverId())) {
JSONObject driverInfo = driverLocationMap.get(info.getDriverId());
if (driverInfo != null) {
try {
Double longitude = driverInfo.getDouble("longitude");
Double latitude = driverInfo.getDouble("latitude");
if (longitude != null && latitude != null &&
StringUtils.isNotBlank(info.getRescueLongitude()) &&
StringUtils.isNotBlank(info.getRescueLatitude())) {
Long distanceMeter = getDistanceMeter(
Double.parseDouble(info.getRescueLongitude()),
Double.parseDouble(info.getRescueLatitude()),
longitude, latitude);
info.setDistance(Double.valueOf(distanceMeter * 1.3d).longValue());
info.setNeedTime(5 + (distanceMeter / 1000) * 2 + 5);
}
} catch (Exception ignored) {
}
}
}
}
}
/**
* 构建部门列表
*/
private List<Long> buildDeptList(Long deptId) {
List<DeptRespDTO> childDeptList = deptService.getChildDeptList(deptId);
List<Long> deptList = childDeptList.stream().map(DeptRespDTO::getId).collect(Collectors.toList());
deptList.add(deptId);
return deptList;
}
@Override
@ -389,9 +847,32 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
return res;
}
@Override
public JSONObject rescueInfoDetailByDispatch(Long rescueId) {
JSONObject res = new JSONObject();
RescueInfo rescueInfo = this.getById(rescueId);
LambdaQueryWrapper<RescueOrderInfo> queryWrapperOrder = new LambdaQueryWrapper<>();
queryWrapperOrder.eq(RescueOrderInfo::getRescueInfoId, rescueId).last("limit 1");
RescueOrderInfo rescueOrderInfo = rescueOrderInfoService.getOne(queryWrapperOrder);
if (ObjectUtils.isNotEmpty(rescueOrderInfo)) {
rescueInfo.setOrderStatus(rescueOrderInfo.getOrderStatus());
rescueInfo.setCommentDesc(rescueOrderInfo.getCommentDesc());
rescueInfo.setCommentStar(rescueOrderInfo.getCommentStar());
} else {
rescueInfo.setOrderStatus("0");
}
res.put("rescueInfo", rescueInfo);
//救援详细信息
LambdaQueryWrapper<RescueInfoDispatchDetail> queryWrapper3 = new LambdaQueryWrapper<>();
queryWrapper3.eq(RescueInfoDispatchDetail::getRescueInfoId, rescueId).orderByAsc(TenantBaseDO::getCreateTime);
List<RescueInfoDispatchDetail> details = rescueInfoDispatchDetailService.list(queryWrapper3);
res.put("detail", details);
return res;
}
@Override
public IPage<RescueInfo> selectRescueListSystem(Page<RescueInfo> page, RescueInfo rescueInfo) {
return baseMapper.selectPage(page,new QueryWrapper<>());
return baseMapper.selectPage(page, new QueryWrapper<>());
}
@Override
@ -399,6 +880,11 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
return baseMapper.selectRescueListSystem2(rescueInfo, page);
}
@Override
public IPage<RescueInfo> selectRescueListByRevoke(RescueInfo rescueInfo, Page<RescueInfo> page) {
return baseMapper.selectRescueListByRevoke(rescueInfo, page);
}
@Override
public JSONObject listData(RescueInfo rescueInfo) {
rescueInfo.setFlag("1");
@ -434,7 +920,7 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
.eq(RescueDriverInfo::getDriverAccept, "2").last("limit 1");
RescueDriverInfo driverInfo = rescueDriverInfoService.getOne(queryWrapper);
if (!ObjectUtils.isEmpty(driverInfo)) {
throw new Exception("已指派,请勿重复指派");
throw new Exception("已指派该司机,请勿重复指派");
}
RescueDriverInfo rescueDriverInfo = new RescueDriverInfo();
rescueDriverInfo.setDriverId(driverId);
@ -479,11 +965,17 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
rescueInfo.setRescueStatus("1");
baseMapper.insert(rescueInfo);
detailService.save(new RescueInfoDetail(rescueInfo.getId(), "0", "预约救援", "预约救援"));
}else if("8".equals(rescueInfo.getRescueType())){
rescueInfo.setRescueStatus("1");
rescueInfo.setRescueTime(new Date());
baseMapper.insert(rescueInfo);
detailService.save(new RescueInfoDetail(rescueInfo.getId(), "0", "现场查勘,业务洽谈", rescueInfo.getRescueDetail()));
} else {
rescueInfo.setRescueStatus("2");
rescueInfo.setRescueTime(new Date());
baseMapper.insert(rescueInfo);
detailService.save(new RescueInfoDetail(rescueInfo.getId(), "1", "救援发起,等待接单", rescueInfo.getRescueDetail()));
rescueInfoDispatchDetailService.save(new RescueInfoDispatchDetail(rescueInfo.getId(), "0", "救援发起", rescueInfo.getRescueDetail()));
// TODO 暂时注掉 后面在看要不要完善
// // 自动通知对应路段司机
@ -523,6 +1015,53 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
}
/**
* 首页修改订单信息
*
* @param rescueInfo
*/
/*@Override
@Transactional(rollbackFor = Exception.class)
public void updateRescueInfoOnHomePage(RescueInfo rescueInfo) {
RescueInfo rescueInfoOld = this.selectRescueInfoById(rescueInfo.getId());
if (rescueInfoOld.getFeeType() != null && !rescueInfoOld.getFeeType().equals(rescueInfo.getFeeType())) {
RescueOrderInfo rescueOrderInfo = rescueOrderInfoService.selectRescueOrderInfoByIdNew(rescueInfo.getOrderId());
if ("2".equals(rescueInfo.getFeeType())) {
rescueOrderInfo.setPayType("qd");
} else if ("1".equals(rescueInfo.getFeeType())) {
rescueOrderInfo.setPayType(null);
rescueOrderInfo.setOrderSigningPersonId(null);
rescueOrderInfo.setOrderSigningPersonName(null);
}
rescueOrderInfoService.updateById(rescueOrderInfo);
}
baseMapper.updateById(rescueInfo);
}*/
@Override
@Transactional(rollbackFor = Exception.class)
public void updateRescueInfoOnHomePage(RescueInfo rescueInfo) {
RescueInfo rescueInfoOld = this.selectRescueInfoById(rescueInfo.getId());
if (rescueInfoOld.getFeeType() != null && !rescueInfoOld.getFeeType().equals(rescueInfo.getFeeType())) {
RescueOrderInfo rescueOrderInfo = rescueOrderInfoService.selectRescueOrderInfoByIdNew(rescueInfo.getOrderId());
// 使用UpdateWrapper强制更新null值
UpdateWrapper<RescueOrderInfo> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", rescueOrderInfo.getId());
if ("2".equals(rescueInfo.getFeeType())) {
updateWrapper.set("pay_type", "qd");
} else if ("1".equals(rescueInfo.getFeeType())) {
updateWrapper.set("pay_type", null)
.set("order_signing_person_id", null)
.set("order_signing_person_name", null);
}
rescueOrderInfoService.update(updateWrapper);
}
baseMapper.updateById(rescueInfo);
}
/**
* 修改请填写功能名称
*
@ -531,13 +1070,13 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
*/
@Override
public int updateRescueInfo(RescueInfo rescueInfo) {
if (rescueInfo.getRescueStatus().compareTo("9") > 0) {
/*if (rescueInfo.getRescueStatus().compareTo("9") > 0) {
rescueInfo.setRescueStatus(null);
}
// 取消订单时删除定时任务
if (null != rescueInfo && StringUtils.isNotEmpty(rescueInfo.getRescueStatus()) && rescueInfo.getRescueStatus().equals("0")) {
redissonDelayQueue.removeAllTasks(rescueInfo.getId());
}
}*/
return baseMapper.updateById(rescueInfo);
}
@ -568,6 +1107,61 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
baseMapper.deleteOtherInfo2(id);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void revokeRescueInfo(Long id) {
if (id == null) {
throw new IllegalArgumentException("系统异常");
}
Long userId = SecurityFrameworkUtils.getLoginUserId();
AdminUserRespDTO user = userApi.getUser(userId);
if (user == null) {
throw new IllegalArgumentException("用户不存在");
}
String userName = user.getNickname();
// 获取救援工单信息
RescueInfo rescueInfo = this.selectRescueInfoById(id);
if (rescueInfo == null) {
throw new IllegalArgumentException("救援工单不存在");
}
Date time = new Date();
String autoRemark = String.format("撤销人:%s, 撤销时间:%s", userName, DateUtil.format(time, "yyyy-MM-dd HH:mm:ss"));
RescueInfoDetail rescueInfoDetail = new RescueInfoDetail()
.setAutoRemark(autoRemark)
.setTitle("救援工单已撤销")
.setRescueInfoId(id);
// 判断是否有司机接单
if (rescueInfo.getDriverId() != null) {
if(rescueInfo.getCurrentRecordStep() < 7){
rescueInfo.setCurrentRecordStep(7);
}
} else {
rescueInfo.setCurrentRecordStep(9).setRescueStatus("7");
}
// 撤销相关的数据
rescueInfo.setIsRevoke("1")
// .setRescueStatus("7")
.setRevokeUserId(userId)
.setRevokeTime(time)
.setRevokeUserName(userName);
// 判断是否存在订单rescueOrderInfo信息如果存在需要修改订单状态
/*RescueOrderInfo rescueOrderInfo = rescueOrderInfoService.selectRescueOrderInfoByRescueInfoId(id);
if(rescueOrderInfo != null){
rescueOrderInfo.setOrderStatus("5");
rescueOrderInfoService.updateById(rescueOrderInfo);
}*/
// 流程中增加撤销信息
detailService.save(rescueInfoDetail);
// 更新工单信息
this.updateById(rescueInfo);
// baseMapper.revokeRescueInfo(id, userId, userName, time);
}
@Override
public IPage<DriverInfo> driverList(DriverInfoDto driverInfo, Page<DriverInfo> page) {
IPage<DriverInfo> driverInfos = baseMapper.driverList(driverInfo, page);
@ -584,6 +1178,7 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
}
return driverInfos;
}
@Override
public IPage<DriverInfo> driverListNew(DriverInfoDto driverInfo, Page<DriverInfo> page) {
IPage<DriverInfo> driverInfos = baseMapper.driverList(driverInfo, page);
@ -603,6 +1198,7 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
@Override
public IPage<DriverInfo> driverAndCarList(DriverInfoDto driverInfo, Page<DriverInfo> page) {
// PC端司机管理
IPage<DriverInfo> driverInfos = baseMapper.driverList(driverInfo, page);
for (DriverInfo info : driverInfos.getRecords()) {
/*LambdaQueryWrapper<RescueCarInfo> queryWrapper = new LambdaQueryWrapper<>();
@ -613,8 +1209,10 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
} else {
info.setCarInfoList(new ArrayList<>());
}*/
// 主车列表
List<RescueDriverCarRelation> firstCarList = driverCarRelationService.getFirstByDriverId(info.getId());
info.setDriverFirstCarRelationList(firstCarList);
// 副车列表
List<RescueDriverCarRelation> secondCarList = driverCarRelationService.getSecondByDriverId(info.getId());
info.setDriverSecondCarRelationList(secondCarList);
}
@ -720,12 +1318,12 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
Long driverInfoId = null;
if (!ObjectUtils.isEmpty(sysUser)) {
CompanyStaffRespVO companyStaff = staffService.selectByPhoneAndUserId(sysUser.getMobile(), sysUser.getId());
if(companyStaff == null){
if (companyStaff == null) {
CompanyStaffRespVO staffRespVO = new CompanyStaffRespVO();
staffRespVO.setLoginAccount(driverInfoDto.getPhonenumber());
staffRespVO.setPassword("123456");
List<Long> roleIds = new ArrayList<>();
if("jysj".equals(driverInfoDto.getStaffType())) {
if ("jysj".equals(driverInfoDto.getStaffType())) {
RoleReqDTO roleReqDTO = roleApi.getRoleInfo("jysj");
roleIds.add(roleReqDTO.getId());
}
@ -734,7 +1332,7 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
staffRespVO.setSex(driverInfoDto.getSex());
staffRespVO.setTel(driverInfoDto.getPhonenumber());
staffService.saveStaff(staffRespVO);
}else{
} else {
CompanyStaffRespVO staffRespVO = new CompanyStaffRespVO();
// companyStaff 复制到 staffRespVO
BeanUtils.copyProperties(companyStaff, staffRespVO);
@ -774,7 +1372,7 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
staffRespVO.setLoginAccount(driverInfoDto.getPhonenumber());
staffRespVO.setPassword("123456");
List<Long> roleIds = new ArrayList<>();
if("jysj".equals(driverInfoDto.getStaffType())) {
if ("jysj".equals(driverInfoDto.getStaffType())) {
RoleReqDTO roleReqDTO = roleApi.getRoleInfo("jysj");
roleIds.add(roleReqDTO.getId());
}
@ -1247,7 +1845,6 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
}
@Override
public List<DriverInfo2Dto> driverListApp(DriverInfoDto driverInfoDto) {
//当前登录用户
@ -1270,12 +1867,35 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
return dtos;
}
@Override
public List<DriverInfo2Dto> driverListAppNew(DriverInfoDto driverInfoDto) {
//当前登录用户
LoginUser loginUser = getLoginUser();
List<DriverInfo2Dto> dtos = baseMapper.driverListAppNew(driverInfoDto);
//处理其余信息
//获取司机所在经纬度
for (DriverInfo2Dto dto : dtos) {
String redisKey2 = Redis_Driver_Key + loginUser.getTenantId() + ":" + dto.getId();
if (redisCache2.hasKey(redisKey2)) {
Map<String, Object> cacheMap = redisCache2.getCacheMap(redisKey2);
dto.setDriverLatitude(cacheMap.get("latitude").toString());
dto.setDriverLongitude(cacheMap.get("longitude").toString());
dto.setDriverPositionInfo(cacheMap.get("positionInfo").toString());
dto.setDriverStatus(cacheMap.get("status").toString());
} else {
dto.setDriverStatus("4");
}
}
return dtos;
}
//获取司机在地图上的位置分布
@Override
public List<DriverInfo2Dto> driverInMap(DriverInfoDto driverInfoDto) {
//当前登录用户
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
List<DriverInfo2Dto> dtos = baseMapper.driverListApp(driverInfoDto);
// List<DriverInfo2Dto> dtos = baseMapper.driverListApp(driverInfoDto);
List<DriverInfo2Dto> dtos = baseMapper.driverListAppNew(driverInfoDto);
//处理其余信息
//获取司机所在经纬度
int i = 1;
@ -1311,7 +1931,8 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
//当前登录用户
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
driverInfoDto.setUserId(loginUser.getId());
List<DriverInfo2Dto> dtos = baseMapper.secondDriverListApp(driverInfoDto);
// List<DriverInfo2Dto> dtos = baseMapper.secondDriverListApp(driverInfoDto);
List<DriverInfo2Dto> dtos = baseMapper.secondDriverListAppNew(driverInfoDto);
//处理其余信息
//获取司机所在经纬度
int i = 1;
@ -1849,16 +2470,17 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
/**
* 查看单个扣车单位信息
*
* @param id 部门ID
* @author 小李
* @date 11:44 2024/9/6
* @param id 部门ID
**/
@Override
public BuckleVO getBuckle(Long id){
public BuckleVO getBuckle(Long id) {
// 直接用上方写好的去查
List<BuckleVO> buckleVOS = listBuckle();
List<BuckleVO> result = buckleVOS.stream().filter(item -> item.getId().equals(id)).collect(Collectors.toList());
if (CollectionUtil.isEmpty(result)){
if (CollectionUtil.isEmpty(result)) {
throw exception0(500, "系统异常");
}
return result.get(0);
@ -1866,19 +2488,20 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
/**
* 还车方法
*
* @param returnCarVO 订单信息
* @author 小李
* @date 14:48 2024/9/6
* @param returnCarVO 订单信息
**/
@Override
@DSTransactional
public void returnCar(ReturnCarVO returnCarVO){
public void returnCar(ReturnCarVO returnCarVO) {
// 先判断是否存在和解扣
RescueInfo flag = baseMapper.selectOne(new LambdaQueryWrapper<RescueInfo>().eq(RescueInfo::getId, returnCarVO.getId()));
if (ObjectUtil.isEmpty(flag)){
if (ObjectUtil.isEmpty(flag)) {
throw exception0(500, "订单不存在");
}
if (!flag.getRescueStatus().equals("6")){
if (!flag.getRescueStatus().equals("6")) {
throw exception0(500, "车辆未解扣");
}
// 更新插入一条工单记录因为还车也要拍照什么的
@ -1902,18 +2525,19 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
/**
* 入库方法
*
* @param returnCarVO 订单信息
* @author 小李
* @date 10:37 2024/9/7
* @param returnCarVO 订单信息
**/
@Override
public void inBase(ReturnCarVO returnCarVO){
public void inBase(ReturnCarVO returnCarVO) {
// 先判断是否存在和完成
RescueInfo flag = baseMapper.selectOne(new LambdaQueryWrapper<RescueInfo>().eq(RescueInfo::getId, returnCarVO.getId()));
if (ObjectUtil.isEmpty(flag)){
if (ObjectUtil.isEmpty(flag)) {
throw exception0(500, "订单不存在");
}
if (!flag.getRescueStatus().equals("5")){
if (!flag.getRescueStatus().equals("5")) {
throw exception0(500, "订单未完成");
}
// 更新插入一条工单记录因为扣车也要拍照什么的
@ -1948,7 +2572,7 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
Map<String, Object> map = DateUtils.getDateTimeList(timeType);
DateTime startTime = (DateTime) map.get("startTime");
DateTime endTime = (DateTime) map.get("endTime");
List<Map<String, Object>> list = baseMapper.selectManageAnalyze(startTime, endTime,loginUser.getTenantId());
List<Map<String, Object>> list = baseMapper.selectManageAnalyze(startTime, endTime, loginUser.getTenantId());
return list;
}
@ -2150,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) {
return rescueInfos.stream()
.filter(info -> info.getRescueTime() != null &&

View File

@ -74,6 +74,16 @@ public class RescueOrderInfoServiceImpl extends ServiceImpl<RescueOrderInfoMappe
return baseMapper.selectRescueOrderInfoById(id);
}
@Override
public RescueOrderInfo selectRescueOrderInfoByIdNew(Long id) {
return baseMapper.selectRescueOrderInfoByIdNew(id);
}
@Override
public RescueOrderInfo selectRescueOrderInfoByRescueInfoId(Long id) {
return baseMapper.selectRescueOrderInfoByRescueInfoId(id);
}
/**
* 查询救援订单列表
*

View File

@ -0,0 +1,44 @@
package cn.iocoder.yudao.module.rescue.vo;
import lombok.Data;
import org.springframework.web.bind.annotation.RequestParam;
@Data
public class SetMoneyVO {
/** 救援工单id */
private Long rescueId;
/** 司机设置的金额 */
private Double setMoney;
/** 流程中的备注 */
private String remark;
/** 流程中的备注 */
private String autoRemark;
/** 流程中的图片 */
private String images;
/** 支付方式 */
private String payType;
/** 挂账负责人id */
private Long orderSigningPersonId;
/** 挂账负责人姓名 */
private String orderSigningPersonName;
/** 司机设置的拖车费 */
private Double towingFee;
/** 司机设置的吊车费 */
private Double craneFee;
/** 司机设置的其他费用 */
private Double otherFee;
/** 司机设置的其他费用备注 */
private String otherFeeRemark;
}

View File

@ -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;
}

View File

@ -205,4 +205,18 @@
FROM `rescue_car_info`
WHERE deleted = 0
</select>
<select id="getCarListByDriverId" resultType="cn.iocoder.yudao.module.rescue.domain.RescueCarInfo">
SELECT
di.id AS driver_id,
rdcr.car_id,
rci.rescue_car_num AS rescueCarNum,
rci.car_category AS carCategory
FROM driver_info di
LEFT JOIN rescue_driver_car_relation rdcr ON di.id = rdcr.driver_id AND rdcr.deleted = 0
LEFT JOIN rescue_car_info rci ON rdcr.car_id = rci.id AND rci.deleted = 0
WHERE di.id = #{driverId}
AND di.deleted = 0
ORDER BY rdcr.is_primary DESC, rdcr.car_id;
</select>
</mapper>

View File

@ -97,9 +97,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ri.*,rdi.id as rescueDriverId
FROM
`rescue_info` ri
INNER JOIN rescue_driver_info rdi ON ri.id = rdi.rescue_id AND rdi.driver_accept = '2'
INNER JOIN rescue_driver_info rdi ON ri.id = rdi.rescue_id AND rdi.driver_accept = '2' AND rdi.deleted = '0'
WHERE
rdi.deleted = '0' and
ri.deleted = '0' and
ri.is_revoke = '0' and
rdi.driver_id =#{driverId} and ri.rescue_status = '2'
and ri.driver_id is null
ORDER BY rdi.create_time desc
@ -127,7 +128,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ri.*,roi.set_money
FROM
`rescue_info` ri
left join rescue_order_info roi on ri.id = roi.rescue_info_id
left join rescue_order_info roi on ri.id = roi.rescue_info_id AND roi.deleted = '0'
WHERE
ri.deleted = '0' and
ri.driver_id =#{map.driverId}
@ -135,7 +136,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and ri.rescue_status = #{map.rescueStatus}
</if>
<if test="map.rescueStatus == '5'.toString()">
and (ri.rescue_status = '5' or ri.rescue_status = '6')
and (ri.rescue_status = '4' or ri.rescue_status = '5' or ri.rescue_status = '6')
</if>
<if test="map.connectionName != null and map.connectionName != ''">
and (ri.connection_name like concat('%', #{map.connectionName}, '%')
or ri.connection_phone like concat('%', #{map.connectionName}, '%')
or ri.license_num like concat('%', #{map.connectionName}, '%')
or ri.car_owner like concat('%', #{map.connectionName}, '%')
or ri.car_owner_phone like concat('%', #{map.connectionName}, '%'))
</if>
ORDER BY ri.create_time desc
</select>
@ -145,6 +153,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM
`rescue_driver_info` rdi
INNER JOIN rescue_info ri on rdi.rescue_id = ri.id
where rdi.deleted = 0 and rdi.driver_accept ='2' and rdi.driver_id =#{driverId} and ri.rescue_status = '2' and ri.driver_id is null
where rdi.deleted = 0 and ri.is_revoke = 0 and rdi.driver_accept ='2' and rdi.driver_id =#{driverId} and ri.rescue_status = '2' and ri.driver_id is null
</select>
<select id="listDispatchDriverByRescueId" resultType="cn.iocoder.yudao.module.rescue.domain.DriverInfo">
SELECT
rdi.id AS rescueDriverId,
rdi.rescue_id AS rescueId,
di.id,
cs.name AS userName,
di.phonenumber,
COALESCE(primary_car.car_id, secondary_car.car_id) AS driverCarId,
COALESCE(primary_car.rescue_car_num, secondary_car.rescue_car_num) AS driverCarNum,
COALESCE(primary_car.car_category, secondary_car.car_category) AS driverCarCategory
FROM rescue_driver_info rdi
INNER JOIN driver_info di ON rdi.driver_id = di.id AND di.deleted = 0
INNER JOIN company_staff cs ON di.user_id = cs.user_id AND cs.deleted = 0
LEFT JOIN (
SELECT rdcr.driver_id, rdcr.car_id, rci.rescue_car_num, rci.car_category
FROM rescue_driver_car_relation rdcr
INNER JOIN rescue_car_info rci ON rdcr.car_id = rci.id AND rci.deleted = 0
WHERE rdcr.is_primary = 1 AND rdcr.deleted = 0
) primary_car ON di.id = primary_car.driver_id
LEFT JOIN (
SELECT rdcr1.driver_id, rdcr1.car_id, rci1.rescue_car_num, rci1.car_category
FROM rescue_driver_car_relation rdcr1
INNER JOIN rescue_car_info rci1 ON rdcr1.car_id = rci1.id AND rci1.deleted = 0
WHERE rdcr1.is_primary = 0 AND rdcr1.deleted = 0
AND rdcr1.id = (
SELECT MIN(rdcr2.id)
FROM rescue_driver_car_relation rdcr2
WHERE rdcr2.driver_id = rdcr1.driver_id
AND rdcr2.is_primary = 0
AND rdcr2.deleted = 0
)
) secondary_car ON di.id = secondary_car.driver_id AND primary_car.driver_id IS NULL
WHERE rdi.rescue_id = #{rescueId}
AND rdi.deleted = 0
AND (primary_car.car_id IS NOT NULL OR secondary_car.car_id IS NOT NULL)
ORDER BY rdi.rescue_id, di.id;
</select>
</mapper>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.rescue.mapper.RescueInfoDispatchDetailMapper">
</mapper>

View File

@ -14,12 +14,14 @@
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
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.deleted = '0' AND ri.is_revoke = '0'
<if test="map.rescueStatus != null">
<choose>
<when test="map.rescueStatus == '1'.toString()">
@ -44,7 +46,7 @@
</when>-->
<when test="map.rescueStatus == '5'.toString()">
<!-- 已完成 -->
and ri.rescue_status = '5' or ri.rescue_status = '8' or roi.order_status = '3'
and (ri.rescue_status = '5' or ri.rescue_status = '8' or roi.order_status = '3')
</when>
<when test="map.rescueStatus == '8'.toString()">
<!-- 已还车 -->
@ -56,8 +58,22 @@
</when>
</choose>
</if>
<if test="map.licenseNum != null">
<!-- <if test="map.licenseNum != null">
and ri.license_num like concat('%', #{map.licenseNum}, '%')
</if>-->
<if test="map.licenseNum != null and map.licenseNum != ''">
and (ri.license_num like concat('%', #{map.licenseNum}, '%')
or ri.connection_phone like concat('%', #{map.licenseNum}, '%')
or ri.connection_name like concat('%', #{map.licenseNum}, '%')
or ri.driver_name like concat('%', #{map.licenseNum}, '%')
or ri.driver_car_num like concat('%', #{map.licenseNum}, '%')
or ri.second_dispatch_name like concat('%', #{map.licenseNum}, '%'))
</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>
<!--<if test="map.deptList != null and map.deptList.size()>0">
and ri.dept_id in
@ -79,12 +95,14 @@
roi.order_signing_person_name AS orderSigningPersonName,
roi.order_signing_charge_id AS orderSigningChargeId,
roi.order_signing_charge_name AS orderSigningChargeName,
roi.payment_name AS paymentName,
roi.payment_time AS paymentTime,
roi.validation_real_name AS orderSigningRealName
FROM rescue_info ri
left join rescue_order_info roi on roi.rescue_info_id = ri.id
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.deleted = '0' AND ri.is_revoke = '0'
and ri.second_dispatch_id = #{map.userId}
<if test="map.rescueStatus != null">
<choose>
@ -107,7 +125,7 @@
<when test="map.rescueStatus == '5'.toString()">
<!-- 评价 -->
-- and roi.order_status = '3'
and ri.rescue_status = '5' or ri.rescue_status = '8' or roi.order_status = '3'
and (ri.rescue_status = '5' or ri.rescue_status = '8' or roi.order_status = '3')
</when>
<when test="map.rescueStatus == '8'.toString()">
<!-- 已还车 -->
@ -119,14 +137,96 @@
</when>
</choose>
</if>
<if test="map.licenseNum != null">
<!--<if test="map.licenseNum != null">
and ri.license_num like concat('%', #{map.licenseNum}, '%')
</if>-->
<if test="map.licenseNum != null and map.licenseNum != ''">
and (ri.license_num like concat('%', #{map.licenseNum}, '%')
or ri.connection_phone like concat('%', #{map.licenseNum}, '%')
or ri.connection_name like concat('%', #{map.licenseNum}, '%')
or ri.driver_name like concat('%', #{map.licenseNum}, '%')
or ri.driver_car_num like concat('%', #{map.licenseNum}, '%'))
</if>
<if test="map.deptList != null and map.deptList.size()>0">
<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>
<!--<if test="map.deptList != null and map.deptList.size()>0">
and ri.dept_id in
<foreach collection="map.deptList" separator="," item="item" open="(" close=")">
#{item}
</foreach>
</if>-->
</where>
order by ri.create_time desc
</select>
<select id="selectRescueInfoRevokeList" 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.order_signing_remark AS orderSigningRemark
FROM rescue_info ri
left join rescue_order_info roi on roi.rescue_info_id = ri.id
<where>
1 = 1
and ri.deleted = '0' AND ri.is_revoke = '1'
<if test="map.licenseNum != null and map.licenseNum != ''">
and (ri.license_num like concat('%', #{map.licenseNum}, '%')
or ri.connection_phone like concat('%', #{map.licenseNum}, '%')
or ri.connection_name like concat('%', #{map.licenseNum}, '%')
or ri.driver_name like concat('%', #{map.licenseNum}, '%')
or ri.driver_car_num like concat('%', #{map.licenseNum}, '%'))
</if>
<if test="map.startTimeStr!=null and map.startTimeStr!='' ">
AND ri.revoke_time &gt;= #{map.startTimeStr}
</if>
<if test="map.endTimeStr!=null and map.endTimeStr!='' ">
AND ri.revoke_time &lt;= #{map.endTimeStr}
</if>
</where>
order by ri.create_time desc
</select>
<select id="selectRescueInfoRevokeListSecondDispatcher" 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
FROM rescue_info ri
left join rescue_order_info roi on roi.rescue_info_id = ri.id
<where>
1 = 1
and ri.deleted = '0' AND ri.is_revoke = '1'
and ri.second_dispatch_id = #{map.userId}
<if test="map.licenseNum != null and map.licenseNum != ''">
and (ri.license_num like concat('%', #{map.licenseNum}, '%')
or ri.connection_phone like concat('%', #{map.licenseNum}, '%')
or ri.connection_name like concat('%', #{map.licenseNum}, '%')
or ri.driver_name like concat('%', #{map.licenseNum}, '%')
or ri.driver_car_num like concat('%', #{map.licenseNum}, '%'))
</if>
<if test="map.startTimeStr!=null and map.startTimeStr!='' ">
AND ri.revoke_time &gt;= #{map.startTimeStr}
</if>
<if test="map.endTimeStr!=null and map.endTimeStr!='' ">
AND ri.revoke_time &lt;= #{map.endTimeStr}
</if>
</where>
order by ri.create_time desc
@ -149,7 +249,65 @@
roi.confirm_payment_person_remark
FROM rescue_info ri
left join rescue_order_info roi on roi.rescue_info_id = ri.id
where ri.deleted = '0'
where ri.deleted = '0' AND ri.is_revoke = '0'
<if test="map.orderStatus != null and map.orderStatus != ''">
and roi.order_status = #{map.orderStatus}
</if>
<if test="map.rescueStatus != null and map.rescueStatus != ''">
and if(#{map.rescueStatus} = 0, ri.rescue_status not in(6,8,9), ri.rescue_status = #{map.rescueStatus})
</if>
<if test="map.licenseNum != null">
and ri.license_num like concat('%', #{map.licenseNum}, '%')
</if>
<if test="map.connectionName != null">
and ri.connection_name like concat('%', #{map.connectionName}, '%')
</if>
<if test="map.connectionPhone != null">
and ri.connection_phone like concat('%', #{map.connectionPhone}, '%')
</if>
<if test="map.driverName != null">
and ri.driver_name like concat('%', #{map.driverName}, '%')
</if>
<if test="map.driverCarNum != null">
and ri.driver_car_num like concat('%', #{map.driverCarNum}, '%')
</if>
<if test="map.rescueType != null">
and ri.rescue_type = #{map.rescueType}
</if>
<if test="map.feeType != null">
and ri.fee_type = #{map.feeType}
</if>
<if test="map.flag != null">
and ri.driver_id is not null
</if>
<if test="map.rescueStart != null and map.rescueEnd != null">
and rescue_time between
concat(#{map.rescueStart}, ' 00:00:00') and concat(#{map.rescueEnd}, ' 23:59:59')
</if>
<if test="map.deptId != null">
and if(#{map.deptId} = 0, ri.dept_id is null, ri.dept_id = #{map.deptId})
</if>
order by ri.create_time desc
</select>
<select id="selectRescueListByRevoke" resultType="cn.iocoder.yudao.module.rescue.domain.RescueInfo">
SELECT ri.*,
roi.order_status,
roi.set_money,
roi.id as rescueOrderId,
roi.pay_type,
roi.pay_money,
roi.pay_time,
roi.order_signing_person_name,
roi.order_signing_charge_name,
roi.order_signing_remark,
roi.if_confirm_pay,
roi.confirm_payment_person_name,
roi.confirm_payment_time,
roi.confirm_payment_person_remark
FROM rescue_info ri
left join rescue_order_info roi on roi.rescue_info_id = ri.id
where ri.deleted = '0' AND ri.is_revoke = '1'
<if test="map.orderStatus != null and map.orderStatus != ''">
and roi.order_status = #{map.orderStatus}
</if>
@ -339,7 +497,9 @@
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'
WHERE 1 = 1
AND di.deleted = '0'
AND di.staff_type = 'jysj'
<if test="map.nickName != null and map.nickName != ''">
and su.nickname like concat('%', #{map.nickName}, '%')
</if>
@ -378,11 +538,12 @@
order by di.create_time desc
</select>
<select id="driverListAppNew" resultType="cn.iocoder.yudao.module.rescue.dto.DriverInfo2Dto">
<!--<select id="driverListAppNew" resultType="cn.iocoder.yudao.module.rescue.dto.DriverInfo2Dto">
SELECT
di.*,
su.nickname as real_name,
car_data.rescue_car_num
car_data.rescue_car_num,
car_data.driver_car_category
FROM
driver_info di
INNER JOIN
@ -420,7 +581,56 @@
</if>
ORDER BY
di.create_time DESC;
</select>-->
<select id="driverListAppNew" resultType="cn.iocoder.yudao.module.rescue.dto.DriverInfo2Dto">
SELECT
di.*,
su.nickname as real_name,
car_data.rescue_car_num,
car_data.driver_car_category
FROM
driver_info di
INNER JOIN
system_users su ON di.user_id = su.id AND su.deleted = '0'
LEFT JOIN
system_dept sd ON sd.id = di.dept_id AND sd.deleted = 0
INNER JOIN (
SELECT
rdcr.driver_id,
COALESCE(
MAX(CASE WHEN rdcr.is_primary = 1 THEN rci.rescue_car_num END),
SUBSTRING_INDEX(GROUP_CONCAT(rci.rescue_car_num ORDER BY rdcr.is_primary DESC, rdcr.create_time SEPARATOR ','), ',', 1)
) as rescue_car_num,
COALESCE(
MAX(CASE WHEN rdcr.is_primary = 1 THEN rci.car_category END),
SUBSTRING_INDEX(GROUP_CONCAT(rci.car_category ORDER BY rdcr.is_primary DESC, rdcr.create_time SEPARATOR ','), ',', 1)
) as driver_car_category
FROM
rescue_driver_car_relation rdcr
INNER JOIN
rescue_car_info rci ON rci.id = rdcr.car_id AND rci.deleted = 0
WHERE
rdcr.deleted = 0
<if test="searchValue != null and searchValue != ''">
AND rci.rescue_car_num like concat('%', #{searchValue}, '%')
</if>
GROUP BY
rdcr.driver_id
HAVING
rescue_car_num IS NOT NULL
) car_data ON car_data.driver_id = di.id
WHERE
di.auth_status = '2'
AND di.deleted = 0
<if test="searchValue != null and searchValue != ''">
AND (su.nickname like concat('%', #{searchValue}, '%')
OR di.phonenumber like concat('%', #{searchValue}, '%')
OR car_data.rescue_car_num like concat('%', #{searchValue}, '%'))
</if>
ORDER BY
di.create_time DESC;
</select>
<select id="secondDriverListApp" resultType="cn.iocoder.yudao.module.rescue.dto.DriverInfo2Dto">
SELECT di.*,
su.nickname as real_name,
@ -438,6 +648,100 @@
</if>
order by di.create_time desc
</select>
<!--<select id="secondDriverListAppNew" resultType="cn.iocoder.yudao.module.rescue.dto.DriverInfo2Dto">
SELECT
di.*,
su.nickname as real_name,
car_data.rescue_car_num
FROM
driver_info di
INNER JOIN
system_users su ON di.user_id = su.id AND su.deleted = '0'
LEFT JOIN
system_dept sd ON sd.id = di.dept_id AND sd.deleted = 0
INNER JOIN (
SELECT
rdcr.driver_id,
COALESCE(
MAX(CASE WHEN rdcr.is_primary = 1 THEN rci.rescue_car_num END),
SUBSTRING_INDEX(GROUP_CONCAT(rci.rescue_car_num ORDER BY rdcr.is_primary DESC, rdcr.create_time SEPARATOR ','), ',', 1)
) as rescue_car_num
FROM
rescue_driver_car_relation rdcr
INNER JOIN
rescue_car_info rci ON rci.id = rdcr.car_id AND rci.deleted = 0
WHERE
rdcr.deleted = 0
<if test="searchValue != null and searchValue != ''">
AND rci.rescue_car_num like concat('%', #{searchValue}, '%')
</if>
GROUP BY
rdcr.driver_id
HAVING
rescue_car_num IS NOT NULL
) car_data ON car_data.driver_id = di.id
WHERE
di.auth_status = '2'
AND di.deleted = 0
AND FIND_IN_SET(#{userId}, di.second_dispatcher_id) > 0
<if test="searchValue != null and searchValue != ''">
AND (su.nickname like concat('%', #{searchValue}, '%')
OR di.phonenumber like concat('%', #{searchValue}, '%')
OR car_data.rescue_car_num like concat('%', #{searchValue}, '%'))
</if>
ORDER BY
di.create_time DESC;
</select>-->
<select id="secondDriverListAppNew" resultType="cn.iocoder.yudao.module.rescue.dto.DriverInfo2Dto">
SELECT
di.*,
su.nickname as real_name,
car_data.rescue_car_num,
car_data.driver_car_category
FROM
driver_info di
INNER JOIN
system_users su ON di.user_id = su.id AND su.deleted = '0'
LEFT JOIN
system_dept sd ON sd.id = di.dept_id AND sd.deleted = 0
INNER JOIN (
SELECT
rdcr.driver_id,
COALESCE(
MAX(CASE WHEN rdcr.is_primary = 1 THEN rci.rescue_car_num END),
SUBSTRING_INDEX(GROUP_CONCAT(rci.rescue_car_num ORDER BY rdcr.is_primary DESC, rdcr.create_time SEPARATOR ','), ',', 1)
) as rescue_car_num,
COALESCE(
MAX(CASE WHEN rdcr.is_primary = 1 THEN rci.car_category END),
SUBSTRING_INDEX(GROUP_CONCAT(rci.car_category ORDER BY rdcr.is_primary DESC, rdcr.create_time SEPARATOR ','), ',', 1)
) as driver_car_category
FROM
rescue_driver_car_relation rdcr
INNER JOIN
rescue_car_info rci ON rci.id = rdcr.car_id AND rci.deleted = 0
WHERE
rdcr.deleted = 0
<if test="searchValue != null and searchValue != ''">
AND rci.rescue_car_num like concat('%', #{searchValue}, '%')
</if>
GROUP BY
rdcr.driver_id
HAVING
rescue_car_num IS NOT NULL
) car_data ON car_data.driver_id = di.id
WHERE
di.auth_status = '2'
AND di.deleted = 0
AND FIND_IN_SET(#{userId}, di.second_dispatcher_id) > 0
<if test="searchValue != null and searchValue != ''">
AND (su.nickname like concat('%', #{searchValue}, '%')
OR di.phonenumber like concat('%', #{searchValue}, '%')
OR car_data.rescue_car_num like concat('%', #{searchValue}, '%'))
</if>
ORDER BY
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,
@ -484,18 +788,18 @@
or connection_phone = #{connectionPhone}
</select>
<select id="getRescueStatisticsByAdmin" resultType="java.util.Map">
SELECT IFNULL(sum(ri.rescue_status = '2' or ri.rescue_status = '3'), 0) as jyzNum,
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(roi.id), 0) as yjdNum,
IFNULL(count(ri.id), 0) as yjdNum,
IFNULL(sum(roi.set_money), 0) as yingskNum,
IFNULL(sum(roi.pay_money), 0) as yiskNum,
IFNULL(sum(CASE WHEN roi.order_status = '1' THEN roi.set_money ELSE 0 END), 0) as dskNum
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
where 1 = 1 AND ri.deleted = 0 AND ri.is_revoke = 0
<if test="map.deptList != null and map.deptList.size()>0">
and ri.dept_id in
<foreach collection="map.deptList" separator="," item="item" open="(" close=")">
@ -503,26 +807,25 @@
</foreach>
</if>
<if test="map.startTimeStr!=null and map.startTimeStr!='' ">
AND roi.create_time &gt;= #{map.startTimeStr}
AND ri.create_time &gt;= #{map.startTimeStr}
</if>
<if test="map.endTimeStr!=null and map.endTimeStr!='' ">
AND roi.create_time &lt;= #{map.endTimeStr}
AND ri.create_time &lt;= #{map.endTimeStr}
</if>
</select>
<select id="getRescueStatisticsBySecondDispatcher" resultType="java.util.Map">
SELECT IFNULL(sum(ri.rescue_status = '2' or ri.rescue_status = '3'), 0) as jyzNum,
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(roi.id), 0) as yjdNum,
IFNULL(sum(roi.set_money), 0) as yingskNum,
IFNULL(sum(roi.pay_money), 0) as yiskNum,
IFNULL(sum(CASE WHEN roi.order_status = '1' THEN roi.set_money ELSE 0 END), 0) as dskNum
IFNULL(count(ri.id), 0) as yjdNum,
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
where 1 = 1 AND ri.deleted = 0 AND ri.is_revoke = 0
AND ri.second_dispatch_id = #{map.userId}
<if test="map.deptList != null and map.deptList.size()>0">
and ri.dept_id in
@ -531,10 +834,10 @@
</foreach>
</if>
<if test="map.startTimeStr!=null and map.startTimeStr!='' ">
AND roi.create_time &gt;= #{map.startTimeStr}
AND ri.create_time &gt;= #{map.startTimeStr}
</if>
<if test="map.endTimeStr!=null and map.endTimeStr!='' ">
AND roi.create_time &lt;= #{map.endTimeStr}
AND ri.create_time &lt;= #{map.endTimeStr}
</if>
</select>
<delete id="deleteOtherInfo1">
@ -728,5 +1031,76 @@
ORDER BY su.nickname
</select>
<update id="revokeRescueInfo">
update rescue_info set is_revoke = 1,revoke_user_id = #{userId},revoke_user_name = #{userName}, revoke_time = #{time} where id = #{id}
</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>

View File

@ -6,7 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectRescueOrderInfoList" parameterType="cn.iocoder.yudao.module.rescue.domain.RescueOrderInfo" resultType="cn.iocoder.yudao.module.rescue.domain.RescueOrderInfo">
select * from rescue_order_detail
<where>
<where>
<if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="realName != null and realName != ''"> and real_name like concat('%', #{realName}, '%')</if>
@ -36,11 +36,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="couponDiscount != null "> and coupon_discount = #{couponDiscount}</if>
</where>
</select>
<select id="selectRescueOrderInfoById" parameterType="java.lang.Long" resultType="cn.iocoder.yudao.module.rescue.domain.RescueOrderInfo">
select * from rescue_order_detail
where id = #{id}
</select>
<select id="selectRescueOrderInfoByIdNew" parameterType="java.lang.Long" resultType="cn.iocoder.yudao.module.rescue.domain.RescueOrderInfo">
select * from rescue_order_info
where id = #{id}
</select>
<select id="selectRescueOrderInfoByRescueInfoId" parameterType="java.lang.Long" resultType="cn.iocoder.yudao.module.rescue.domain.RescueOrderInfo">
select * from rescue_order_info
where rescue_info_id = #{id}
</select>
<select id="avgPartnerScore" resultType="java.lang.Double">
SELECT
avg(comment_star)
@ -50,4 +59,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where ri.driver_id = #{driverId}
</select>
</mapper>
</mapper>

View File

@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
@ -124,4 +125,12 @@ public interface DictDataApi {
}
return dictData.getLabel();
}
/**
* 批量获取字典标签
* @param dictType 字典类型
* @param dictValues 字典值集合
* @return 字典值到标签的映射
*/
Map<String, String> getDictDataLabels(String dictType, Collection<String> dictValues);
}

View File

@ -12,8 +12,7 @@ import cn.iocoder.yudao.module.system.service.dict.DictTypeService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -141,4 +140,9 @@ public class DictDataApiImpl implements DictDataApi {
DictDataDO dictData = dictDataService.getDictData(id);
return BeanUtils.toBean(dictData, DictDataRespDTO.class);
}
@Override
public Map<String, String> getDictDataLabels(String dictType, Collection<String> dictValues) {
return dictDataService.selectDictLabelsByValues(dictType, dictValues);
}
}

View File

@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataPage
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Arrays;
import java.util.Collection;
@ -46,4 +47,10 @@ public interface DictDataMapper extends BaseMapperX<DictDataDO> {
.eqIfPresent(DictDataDO::getDictType, dictType));
}
default List<DictDataDO> selectDictLabelsByValues(String dictType, Collection<String> dictValues) {
return selectList(new LambdaQueryWrapperX<DictDataDO>()
.eqIfPresent(DictDataDO::getDictType, dictType)
.inIfPresent(DictDataDO::getValue, dictValues));
}
}

View File

@ -9,6 +9,7 @@ import org.springframework.lang.Nullable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* 字典数据 Service 接口
@ -128,4 +129,6 @@ public interface DictDataService {
String getValueByTypeAndLabel(String type, String label);
boolean updateValueByTypeAndLabel(String type, String label, String value);
Map<String, String> selectDictLabelsByValues(String dictType, Collection<String> dictValues);
}

View File

@ -17,10 +17,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.*;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
@ -228,4 +225,22 @@ public class DictDataServiceImpl implements DictDataService {
return dictDataMapper.updateById(dictDataDO) > 0;
}
@Override
public Map<String, String> selectDictLabelsByValues(String dictType, Collection<String> dictValues) {
if (dictValues == null || dictValues.isEmpty()) {
return Collections.emptyMap();
}
// 批量查询数据库
List<DictDataDO> dictDataList = dictDataMapper.selectDictLabelsByValues(dictType, dictValues);
// 转换为 Map
Map<String, String> result = new HashMap<>();
for (DictDataDO dictData : dictDataList) {
result.put(dictData.getValue(), dictData.getLabel());
}
return result;
}
}