Compare commits

...

19 Commits

Author SHA1 Message Date
xyc
b5771bd801 Merge branch 'repair' 2025-09-26 15:09:34 +08:00
xyc
865f80ff91 更新0926 2025-09-26 15:05:32 +08:00
xyc
2afe93bf6e 更新0926 2025-09-26 14:32:41 +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
xyc
9dc4e188f0 更新0919 2025-09-19 10:20:42 +08:00
xyc
4c78b8b9a2 Merge branch 'master' into repair 2025-09-11 13:47:14 +08:00
xyc
c8418efb4e Merge branch 'insp' 2025-09-11 13:24:20 +08:00
xyc
b16dca836e 更新0911 2025-09-11 10:14:08 +08:00
Lx
45b0f93886 0909 2025-09-10 09:48:53 +08:00
Lx
1615ffb3a8 0909 2025-09-09 18:31:45 +08:00
Lx
095d6a7433 Merge remote-tracking branch 'origin/master' 2025-09-09 14:55:34 +08:00
Lx
f3eb6fc93e 0908 2025-09-09 14:51:47 +08:00
xyc
79c5ac04d4 增加基础模块-业务渠道和来源 2025-09-08 13:57:14 +08:00
66 changed files with 2535 additions and 296 deletions

View File

@ -95,6 +95,7 @@ public class CarMain extends TenantBaseDO {
* 下次年检日期
*/
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY, timezone = "GMT+8")
private LocalDateTime nextInspectionDate;
/**
* 保险到期日期
@ -157,4 +158,4 @@ public class CarMain extends TenantBaseDO {
private BigDecimal shangye;
/** 车龄 */
private Double carYear;
}
}

View File

@ -22,6 +22,7 @@ import cn.iocoder.yudao.module.label.entity.BusiLabel;
import cn.iocoder.yudao.module.label.service.BusiLabelService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
@ -126,15 +127,17 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
}
//车俩品牌型号级联选择器返回值第一位是品牌第二位是型号
List<String> brandAndModel = updateReqVO.getBrandAndModel();
// 插入
CarMain carMain = BeanUtils.toBean(updateReqVO, CarMain.class);
carMain.setCarBrand(brandAndModel.get(0));
//判断是否仅填入了品牌
if (brandAndModel.size() > 1) {
//填入了型号
carMain.setCarModel(brandAndModel.get(1));
} else {
carMain.setCarModel("");
if (CollectionUtils.isNotEmpty(brandAndModel)) {
// 插入
carMain.setCarBrand(brandAndModel.get(0));
//判断是否仅填入了品牌
if (brandAndModel.size() > 1) {
//填入了型号
carMain.setCarModel(brandAndModel.get(1));
} else {
carMain.setCarModel("");
}
}
//todo 计算下次保养时间下次保养里程下次年检时间保险到期时间
baseMapper.updateById(carMain);
@ -525,4 +528,4 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
}
}
}

View File

@ -149,4 +149,4 @@
</if>
</select>
</mapper>
</mapper>

View File

@ -0,0 +1,111 @@
package cn.iocoder.yudao.module.business.controller.admin;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.business.entity.DlBusinessChannel;
import cn.iocoder.yudao.module.business.service.BusinessChannelService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/business")
@RequiredArgsConstructor
public class BusinessChannelController {
private final BusinessChannelService businessChannelService;
/**
* @Author
* @Description 获取客户来源和业务渠道
* @Date 13:54 2025/9/8
* @Param [channel]
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.util.List < cn.iocoder.yudao.module.business.entity.DlBusinessChannel>>
**/
@GetMapping("/list")
public CommonResult<List<DlBusinessChannel>> list(DlBusinessChannel channel) {
return CommonResult.success(businessChannelService.list(Wrappers.<DlBusinessChannel>lambdaQuery()
.eq(ObjectUtil.isNotEmpty(channel.getType()), DlBusinessChannel::getType, channel.getType())
.like(ObjectUtil.isNotEmpty(channel.getName()), DlBusinessChannel::getName, channel.getName())
.eq(StrUtil.isNotEmpty(channel.getSystemCode()), DlBusinessChannel::getSystemCode, channel.getSystemCode())
.orderByAsc(DlBusinessChannel::getSort)));
}
/**
* @Author
* @Description 新增业务渠道来源
* @Date 13:44 2025/9/9
* @Param [channel]
* @return boolean
**/
@PostMapping("/add")
public boolean addChannel(@RequestBody DlBusinessChannel channel) {
if (ObjectUtil.isNotEmpty(channel.getUserIdList())) {
String userIds = channel.getUserIdList().stream()
.map(String::valueOf)
.collect(Collectors.joining(","));
channel.setUserIds(userIds);
}
return businessChannelService.save(channel);
}
/**
* @Author
* @Description 获取业务来源和渠道
* @Date 13:45 2025/9/9
* @Param [id]
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<cn.iocoder.yudao.module.business.entity.DlBusinessChannel>
**/
@GetMapping("/{id}")
public CommonResult<DlBusinessChannel> getChannelById(@PathVariable("id") Long id) {
DlBusinessChannel info = businessChannelService.getById(id);
//将字符串转为集合
if (ObjectUtil.isNotEmpty(info.getUserIds())) {
List<Long> userIdList = Arrays.stream(info.getUserIds().split(","))
.filter(s -> s != null && !s.isEmpty()) // 可选避免空字符串
.map(Long::valueOf)
.collect(Collectors.toList());
info.setUserIdList(userIdList);
}
return CommonResult.success(info);
}
/**
* @Author
* @Description 修改
* @Date 13:45 2025/9/9
* @Param [channel]
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
**/
@PutMapping("/update")
public CommonResult<?> updateChannel(@RequestBody DlBusinessChannel channel) {
if (ObjectUtil.isNotEmpty(channel.getUserIdList())) {
String userIds = channel.getUserIdList().stream()
.map(String::valueOf)
.collect(Collectors.joining(","));
channel.setUserIds(userIds);
} else if (ObjectUtil.isEmpty(channel.getUserIds())) {
channel.setUserIds("");
}
return CommonResult.success(businessChannelService.updateById(channel));
}
/**
* @Author
* @Description 删除
* @Date 13:45 2025/9/9
* @Param [id]
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
**/
@DeleteMapping("/delete/{id}")
public CommonResult<?> deleteChannel(@PathVariable("id") Long id) {
return CommonResult.success(businessChannelService.removeById(id));
}
}

View File

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.business.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.List;
@Data
@TableName("inspection_business_channel")
public class DlBusinessChannel extends TenantBaseDO {
private Integer id; // 主键ID
private Integer pid; // 父ID
private String name; // 名称
private Integer type; // 0-业务渠道 1-客户来源
private String userIds; // 绑定的用户ID
private Integer sort; // 排序
private String systemCode; // 系统标识
// 子节点
@TableField(exist = false)
private List<DlBusinessChannel> children;
@TableField(exist = false)
private List<Long> userIdList;
}

View File

@ -0,0 +1,15 @@
package cn.iocoder.yudao.module.business.mapper;
import cn.iocoder.yudao.module.business.entity.DlBusinessChannel;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface BusinessChannelMapper extends BaseMapper<DlBusinessChannel> {
/**
* 获取业务渠道 客户来源
* @param userId
* @return
*/
DlBusinessChannel getBusinessChannelByUserId(Long userId);
}

View File

@ -0,0 +1,17 @@
package cn.iocoder.yudao.module.business.service;
import cn.iocoder.yudao.module.business.entity.DlBusinessChannel;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import java.util.Map;
public interface BusinessChannelService extends IService<DlBusinessChannel> {
/**
* 获取业务渠道和客户来源
*
* @param userId 用户id
* @return
*/
Map<String, Object> getBusinessChannelByUserId(Long userId);
}

View File

@ -0,0 +1,41 @@
package cn.iocoder.yudao.module.business.service.impl;
import cn.iocoder.yudao.module.business.entity.DlBusinessChannel;
import cn.iocoder.yudao.module.business.mapper.BusinessChannelMapper;
import cn.iocoder.yudao.module.business.service.BusinessChannelService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class BusinessChannelServiceImpl extends ServiceImpl<BusinessChannelMapper, DlBusinessChannel> implements BusinessChannelService {
/**
* 获取业务渠道和客户来源
*
* @param userId 用户id
* @return
*/
@Override
public Map<String, Object> getBusinessChannelByUserId(Long userId) {
Map<String, Object> map = new HashMap<>();
// 客户来源
DlBusinessChannel channel = baseMapper.getBusinessChannelByUserId(userId);
if (channel == null) {
return null;
}
map.put("channel", channel);
// 根据客户来源的父id查询业务渠道
DlBusinessChannel business = getOne(Wrappers.<DlBusinessChannel>lambdaQuery()
.eq(DlBusinessChannel::getId, channel.getPid()));
if (business != null) {
map.put("business", business);
}
return map;
}
}

View File

@ -21,6 +21,8 @@ public class InspectionBusinessChannel extends TenantBaseDO {
private Integer sort; // 排序
private String systemCode; // 系统编码
// 子节点
@TableField(exist = false)
private List<InspectionBusinessChannel> children;

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

@ -129,7 +129,28 @@
</select>
<select id="noClockInRemindByUserId" resultType="cn.iocoder.yudao.module.train.vo.NoClockInRemindVO">
SELECT coach_id,
SELECT
dst.coach_id,
dst.coach_name,
COUNT(dst.user_id) AS student_count,
GROUP_CONCAT(DISTINCT CONCAT(dst.user_name, '(', '科目', dst.subject, ')') SEPARATOR '') AS student_names
FROM drive_school_train dst
WHERE dst.coach_id = #{userId}
AND dst.car_no = #{carNo}
AND dst.end_time IS NULL
AND dst.deleted = 0
AND NOT EXISTS (
SELECT 1
FROM drive_school_process dsp
WHERE dsp.user_id = dst.user_id
AND dsp.subject = dst.subject
AND dsp.deleted = 0
AND (dsp.status = '2' OR dsp.exam_status = '1')
)
GROUP BY dst.coach_id, dst.coach_name
</select>
<!-- SELECT coach_id,
coach_name,
COUNT(user_id) AS student_count,
GROUP_CONCAT(DISTINCT CONCAT(user_name, '(', '科目', subject, ')') SEPARATOR '' ) AS student_names,
@ -141,9 +162,7 @@
AND deleted = 0
AND tenant_id = 180
GROUP BY coach_id,
coach_name
</select>
coach_name -->
<select id="selectStudentByCoachClockId" resultType="cn.iocoder.yudao.module.train.entity.Train">
SELECT
subject,

View File

@ -93,7 +93,8 @@ public enum RecordTypeEnum {
SK("sk", "收款"),
PICKCAR("pickcar", "接车"),
JSSQ("jssq", "结算申请"),
JSSP("jssp", "结算审批");
JSSP("jssp", "结算审批"),
QRSK("qrsk", "确认收款");
/**
* code

View File

@ -65,4 +65,9 @@ public class QueryBusinessResp {
* 经办人
*/
private String handleName;
/**
* 累计消费次数
*/
private Integer consumeCount;
}

View File

@ -762,6 +762,19 @@ public class DlRepairTicketsController {
return CommonResult.ok();
}
/**
* @Author
* @Description 确认收款
* @Date 11:12 2025/9/18
* @Param [repairTicketsRespVO]
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
**/
@PostMapping("/payConfirm")
public CommonResult<?> payConfirm(@RequestBody DlRepairTicketsRespVO repairTicketsRespVO) {
dlRepairTicketsService.payConfirm(repairTicketsRespVO);
return CommonResult.ok();
}
/**
* 格式化为百分比字符串
* @param value

View File

@ -124,6 +124,9 @@ public class DlTicketWaresController {
@PostMapping("/audit")
@Operation(summary = "审核")
public CommonResult<?> auditTicketWares(@RequestBody DlTicketWaresRespVO respVO){
if (CollUtil.isEmpty(respVO.getItems())) {
throw exception0(500,"请添加配件");
}
dlTicketWaresService.auditTicketWares(respVO);
return CommonResult.ok();
}

View File

@ -249,9 +249,12 @@ public class DlRepairTickets extends TenantBaseDO {
private BigDecimal jiaoqiang;
/** 商业险保费 */
private BigDecimal shangye;
/** 支付状态 字典repair_pat_status */
private String payStatus;
/** 支付确认 0:未确认 1:已确认*/
private String payConfirm;
/** 支付确认备注 */
private String payConfirmRemark;
/** 更新时上传的图片 */
@TableField(exist = false)

View File

@ -337,4 +337,12 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
* @return java.util.List<java.util.Map>
**/
Map<String, Object> getBossNumStatistics(String startDate, String endDate);
/**
* @Author
* @Description 确认收款
* @Date 11:12 2025/9/18
* @Param [repairTicketsRespVO]
**/
void payConfirm(DlRepairTicketsRespVO repairTicketsRespVO);
}

View File

@ -84,6 +84,7 @@ import com.deepoove.poi.plugin.table.HackLoopTableRenderPolicy;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
@ -593,6 +594,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
BigDecimal waresProfit = BigDecimal.ZERO;
List<JobTypeProfitDTO> resultList = new ArrayList<>();
if (CollectionUtil.isNotEmpty(items)) {
for (DlRepairTitemReqVO item : items) {
BigDecimal itemProfit = item.getItemProfit() != null ? item.getItemProfit() : BigDecimal.ZERO;
@ -610,6 +612,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
if (repairWorker != null) {
String jobType = repairWorker.getWorkType();
if (jobType == null) {
// 如果工种为空跳过处理
continue;
}
JobTypeProfitDTO dto = resultList.stream()
@ -742,6 +746,16 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
if (ObjectUtil.isEmpty(one)) {
throw exception0(500, "未找到该笔订单");
}
if ("0".equals(repairTicketsRespVO.getIsPaid())) {
// 未支付
one.setPayRemark(repairTicketsRespVO.getRemark());
//更新
repairOrderInfoService.updateById(one);
// 记录日志
repairRecordsService.saveRepairRecord(one.getGoodsId(), null, RecordTypeEnum.SK.getCode(), "未收款-"+repairTicketsRespVO.getRemark(), null);
return;
}
RepairOrderInfo repairOrderInfo = new RepairOrderInfo();
repairOrderInfo.setId(one.getId());
repairOrderInfo.setPayType(repairTicketsRespVO.getPayType());
@ -809,7 +823,17 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
* @Date 10:13 2025/8/20
* @Param [repairTicketsRespVO]
**/
@Transactional
public void setTicketsSettlement(TicketsSettlementVO vo) {
/*通过工单id查询工单配件申请表*/
List<DlTicketWares> list = ticketWaresService.list(Wrappers.<DlTicketWares>lambdaQuery()
.eq(DlTicketWares::getTicketId, vo.getTicketId()));
// 判断是否有未申领完成的
if (list.stream().anyMatch(item -> item.getStatus().equals("0"))) {
throw exception0(500, "请先完成配件申领");
}
/*添加结算数据*/
// 将vo转为json
String json = JSON.toJSONString(vo);
@ -895,7 +919,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
* @Param [startDate, endDate]
*/
@Override
public Map<String, Object> getBossNumStatistics(String startDate, String endDate) {
public Map<String, Object> getBossNumStatistics(String startDate, String endDate) {
Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> statsList = new ArrayList<>();
@ -912,38 +936,40 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
// 根据条件查询工单
List<DlRepairTickets> ticketsInRange = this.list(queryWrapper);
// 进厂数所有在范围内创建的
Map<String, Long> newOrderStats = ticketsInRange.stream()
.collect(Collectors.groupingBy(DlRepairTickets::getRepairType, Collectors.counting()));
statsList.add(createStatsNode("newOrderNum", "订单(进厂数)", newOrderStats, "jinchang"));
// 维修中 repairType 分组
Map<String, Long> workingStats = ticketsInRange.stream()
.filter(item -> TicketsStatusEnum.WORKING.getCode().equals(item.getTicketsStatus()))
.collect(Collectors.groupingBy(DlRepairTickets::getRepairType, Collectors.counting()));
statsList.add(createStatsNode("workingNum", "维修中", workingStats));
statsList.add(createStatsNode("workingNum", "维修中", workingStats, "weixiuzhong"));
// 已竣工通过 mapper 查询并按 repairType 分组
Map<String, Long> overStats = getOverStatsByRepairType(startDate, endDate);
statsList.add(createStatsNode("overNum", "已竣工", overStats, "yijungong"));
// 竣工已结算
// 竣工未结算
List<String> noPayCodeList = Arrays.asList("04", "05", "07", "01");
Map<String, Long> noPayStats = ticketsInRange.stream()
.filter(item -> noPayCodeList.contains(item.getTicketsStatus()))
.collect(Collectors.groupingBy(DlRepairTickets::getRepairType, Collectors.counting()));
statsList.add(createStatsNode("noPayNum", "未结算", noPayStats, "weijiesuan"));
// 已交车通过 mapper 查询并按 repairType 分组
Map<String, Long> giveCusStats = getGiveCusStatsByRepairType(startDate, endDate);
statsList.add(createStatsNode("giveCusNum", "已交车", giveCusStats, "yijiaoche"));
// 在厂未交车且不是已完成状态 03
Map<String, Long> inCompanyStats = ticketsInRange.stream()
.filter(item -> "0".equals(item.getIsHandover()))
.filter(item -> !"03".equals(item.getTicketsStatus()))
.collect(Collectors.groupingBy(DlRepairTickets::getRepairType, Collectors.counting()));
statsList.add(createStatsNode("inCompanyNum", "在厂", inCompanyStats));
// 未结算
List<String> noPayCodeList = Arrays.asList("04", "05", "07", "01");
Map<String, Long> noPayStats = ticketsInRange.stream()
.filter(item -> noPayCodeList.contains(item.getTicketsStatus()))
.collect(Collectors.groupingBy(DlRepairTickets::getRepairType, Collectors.counting()));
statsList.add(createStatsNode("noPayNum", "未结算", noPayStats));
// 进厂数所有在范围内创建的
Map<String, Long> newOrderStats = ticketsInRange.stream()
.collect(Collectors.groupingBy(DlRepairTickets::getRepairType, Collectors.counting()));
statsList.add(createStatsNode("newOrderNum", "进厂数", newOrderStats));
// 已完成通过 mapper 查询并按 repairType 分组
Map<String, Long> overStats = getOverStatsByRepairType(startDate, endDate);
statsList.add(createStatsNode("overNum", "已完成", overStats));
// 已交车通过 mapper 查询并按 repairType 分组
Map<String, Long> giveCusStats = getGiveCusStatsByRepairType(startDate, endDate);
statsList.add(createStatsNode("giveCusNum", "已交车", giveCusStats));
statsList.add(createStatsNode("inCompanyNum", "在厂", inCompanyStats, "zaichang"));
// 添加到结果map
resultMap.put("stats", statsList);
@ -955,6 +981,24 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
return resultMap;
}
/**
* @Author
* @Description 确认收款
* @Date 11:12 2025/9/18
* @Param [repairTicketsRespVO]
*/
@Override
public void payConfirm(DlRepairTicketsRespVO repairTicketsRespVO) {
// 修改主表 确认收款状态
update(Wrappers.<DlRepairTickets>lambdaUpdate()
.eq(DlRepairTickets::getId, repairTicketsRespVO.getId())
.set(DlRepairTickets::getPayConfirm, repairTicketsRespVO.getPayConfirm())
.set(StringUtils.isNotEmpty(repairTicketsRespVO.getPayConfirmRemark()),DlRepairTickets::getPayConfirmRemark, repairTicketsRespVO.getPayConfirmRemark()));
//添加记录
repairRecordsService.saveRepairRecord(repairTicketsRespVO.getId(), null, RecordTypeEnum.QRSK.getCode(), RecordTypeEnum.QRSK.getName(), null, null);
}
// 获取已完成工单按维修类型分组的统计优化版本
private Map<String, Long> getOverStatsByRepairType(String startDate, String endDate) {
// 直接使用 mapper 查询已完成工单并按 repairType 分组
@ -968,13 +1012,6 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
}
queryWrapper.eq("drr.type", RecordTypeEnum.ZJ.getCode());
// // 使用 group by 直接在数据库层面分组统计
// List<Map<String, Object>> result = repairTicketsMapper.selectMaps(
// queryWrapper.select("repair_type", "count(*) as count")
// .groupBy("repair_type")
// queryWrapper.getSqlSelect()
// );
// 使用 group by 直接在数据库层面分组统计
List<Map<String, Object>> result = repairTicketsMapper.selectTicketIdByParamsNew(
queryWrapper.select("repair_type", "count(*) as count")
@ -1020,11 +1057,18 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
return stats;
}
// 创建统计节点的辅助方法
private Map<String, Object> createStatsNode(String code, String name, Map<String, Long> stats) {
/**
* @Author
* @Description 创建统计节点
* @Date 11:13 2025/9/12
* @Param [code, name, stats, selectType] 统计项代码名称统计数据选择类型
* @return java.util.Map<java.lang.String, java.lang.Object>
**/
private Map<String, Object> createStatsNode(String code, String name, Map<String, Long> stats, String selectType) {
Map<String, Object> node = new HashMap<>();
node.put("code", code);
node.put("name", name);
node.put("selectType", selectType);
List<Map<String, Object>> children = stats.entrySet().stream()
.map(entry -> {
@ -1066,6 +1110,9 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
for (Map<String, Object> receivable : receivables) {
// 转换为TicketsSettlementVO
Object otherData = receivable.get("otherData");
if (ObjectUtil.isNull(otherData)) {
continue;
}
TicketsSettlementVO settlement = JSONObject.parseObject(
otherData.toString(), TicketsSettlementVO.class
);
@ -2732,6 +2779,59 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
*/
@Override
public Map<String, Object> getStatistics(DlRepairTicketsReqVO repairTicketsReqVO) {
if (!RepairCons.TICKETS_WAITING.equals(repairTicketsReqVO.getSelectType())) {
if (("jinchang".equals(repairTicketsReqVO.getTicketsStatus()) ||
"yijungong".equals(repairTicketsReqVO.getTicketsStatus()) ||
"yijiaoche".equals(repairTicketsReqVO.getTicketsStatus())) && StringUtils.isNotEmpty(repairTicketsReqVO.getStartDate())) {
//如果是查询进场已竣工已交车三个状态同时选了时间范围的需要单独处理
String startDate = repairTicketsReqVO.getStartDate() + " 00:00:00";
String endDate = repairTicketsReqVO.getEndDate() + " 23:59:59";
List<String> idList = new ArrayList<>();
if ("yijungong".equals(repairTicketsReqVO.getTicketsStatus())) {
//已竣工
idList = repairTicketsMapper.selectTicketIdByParams(null, RecordTypeEnum.ZJ.getCode(), startDate, endDate);
} else if ("yijiaoche".equals(repairTicketsReqVO.getTicketsStatus())) {
//已交车
idList = repairTicketsMapper.selectTicketIdByParams(null, RecordTypeEnum.JC.getCode(), startDate, endDate);
} else {
//进厂
repairTicketsReqVO.setStartDate(startDate);
repairTicketsReqVO.setEndDate(endDate);
}
if (null != idList && !idList.isEmpty()) {
repairTicketsReqVO.setIdList(idList);
//时间查询条件置空
repairTicketsReqVO.setStartDate(null);
repairTicketsReqVO.setEndDate(null);
}
} else {
//否则查询时间不生效按维修状态查
List<String> statusList = new ArrayList<>();
if ("weixiuzhong".equals(repairTicketsReqVO.getTicketsStatus())) {
//维修中
statusList.add(TicketsStatusEnum.WORKING.getCode());
} else if ("weijiesuan".equals(repairTicketsReqVO.getTicketsStatus())) {
//未结算
statusList = Arrays.asList("04", "05", "07", "01");
} else if ("zaichang".equals(repairTicketsReqVO.getTicketsStatus())) {
//在厂就是没交车的,且不能是已作废和已完成的
repairTicketsReqVO.setIsHandover("0");
statusList = Arrays.asList("04", "05", "07", "01", "06", "02");
} else if ("jinchang".equals(repairTicketsReqVO.getTicketsStatus())) {
//进厂
statusList.add(TicketsStatusEnum.NO_WORK.getCode());
} else if ("yijungong".equals(repairTicketsReqVO.getTicketsStatus())) {
//已竣工
statusList = Arrays.asList("07", "01", "06", "02", "08");
} else if ("yijiaoche".equals(repairTicketsReqVO.getTicketsStatus())) {
//已交车
repairTicketsReqVO.setIsHandover("1");
}
if (!statusList.isEmpty()) {
repairTicketsReqVO.setStatusList(statusList);
}
}
}
return baseMapper.getStatistics(repairTicketsReqVO);
}
}

View File

@ -58,4 +58,13 @@ public class DlRepairTicketsReqVO extends DlRepairTickets {
/** 工种 */
private String workType;
/** 时间类型 */
private String timeType = "create";
/** 业务渠道 */
private String busiFrom;
/** 支付状态 receivable应收款 receivedAmount已收款 pendingAmount代收款 */
private String payStatus;
}

View File

@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
@ -86,4 +87,11 @@ public class DlRepairTicketsRespVO extends DlRepairTickets {
private BigDecimal profitRateNo;
private List<JobTypeProfitDTO> groupByJobType;
/** 结算时间 */
private LocalDateTime settlementTime;
private String payTime;
/** 是否支付 */
private String isPaid;
}

View File

@ -123,7 +123,8 @@
GROUP BY drw.user_id,drr.ticket_id
ORDER BY value DESC
</select>
<select id="listBusinessByCustomer" resultType="cn.iocoder.yudao.module.base.vo.QueryBusinessResp"
<select id="listBusinessByCustomer"
resultType="cn.iocoder.yudao.module.base.vo.QueryBusinessResp"
parameterType="cn.iocoder.yudao.module.base.vo.QueryBusinessReqVO">
SELECT t.*
FROM (
@ -138,105 +139,72 @@
r.handle_name AS handleName,
'repair' AS source,
'维修' AS sourceStr,
ROW_NUMBER() OVER (PARTITION BY c.id ORDER BY r.in_time DESC) AS rn
ROW_NUMBER() OVER (PARTITION BY c.id ORDER BY r.in_time DESC) AS rn,
COUNT(*) OVER (PARTITION BY c.id) AS consumeCount -- 新增字段:消费次数
FROM base_customer_main c
JOIN dl_repair_tickets r ON c.id = r.user_id
LEFT JOIN dl_repair_titem t ON r.id = t.ticket_id
WHERE
1 = 1 and c.deleted = 0
1 = 1
AND c.deleted = 0
<if test="reqVO.dateRange != null">
AND r.in_time BETWEEN CONCAT(#{reqVO.dateRange[0]}, ' 00:00:00') AND CONCAT(#{reqVO.dateRange[1]}, ' 23:59:59')
AND r.in_time BETWEEN CONCAT(#{reqVO.dateRange[0]}, ' 00:00:00')
AND CONCAT(#{reqVO.dateRange[1]}, ' 23:59:59')
</if>
<if test="reqVO.search != null and reqVO.search != ''">
AND (c.cus_name LIKE CONCAT('%', #{reqVO.search}, '%')
AND (
c.cus_name LIKE CONCAT('%', #{reqVO.search}, '%')
OR c.phone_number LIKE CONCAT('%', #{reqVO.search}, '%')
OR r.ticket_no LIKE CONCAT('%', #{reqVO.search}, '%')
OR t.item_name LIKE CONCAT('%', #{reqVO.search}, '%')
)
</if>
ORDER BY r.in_time DESC
<!--
UNION ALL
SELECT
c.id AS customerId,
c.cus_name AS customerName,
c.phone_number AS customerPhone,
ri.id AS bizId,
NULL AS bizNo,
ri.rescue_type AS bizType,
ri.rescue_time AS bizTime,
'rescue' AS source,
ROW_NUMBER() OVER (PARTITION BY c.id ORDER BY ri.rescue_time DESC) AS rn
FROM base_customer_main c
JOIN rescue_info ri ON c.user_id = ri.user_id
WHERE
1 = 1 and c.deleted = 0
<if test="reqVO.dateRange != null">
AND ri.rescue_time BETWEEN #{reqVO.dateRange[0]} AND #{reqVO.dateRange[1]}
</if>
<if test="reqVO.search != null and reqVO.search != ''">
AND (c.cus_name LIKE CONCAT('%', #{reqVO.search}, '%')
OR c.phone_number LIKE CONCAT('%', #{reqVO.search}, '%')
)
</if>-->
) t
WHERE t.rn = 1;
</select>
<select id="listBusinessByCar" resultType="cn.iocoder.yudao.module.base.vo.QueryBusinessResp"
<select id="listBusinessByCar"
resultType="cn.iocoder.yudao.module.base.vo.QueryBusinessResp"
parameterType="cn.iocoder.yudao.module.base.vo.QueryBusinessReqVO">
SELECT t.*
FROM (
-- 维修工单
SELECT
car.id AS carId,
car.license_number carNum,
c.id AS customerId,
c.cus_name AS customerName,
c.phone_number AS customerPhone,
car.license_number AS carNum,
c.id AS customerId,
c.cus_name AS customerName,
c.phone_number AS customerPhone,
r.id AS bizId,
r.ticket_no AS bizNo,
r.repair_type AS bizType,
r.create_time AS bizTime,
'repair' AS source,
'维修' AS sourceStr,
ROW_NUMBER() OVER (PARTITION BY car.id ORDER BY r.in_time DESC) AS rn
ROW_NUMBER() OVER (PARTITION BY car.id ORDER BY r.in_time DESC) AS rn,
COUNT(*) OVER (PARTITION BY car.id) AS consumeCount -- 新增字段:该车辆来过的次数
FROM base_car_main car
JOIN base_customer_car cc ON car.id = cc.car_id
JOIN base_customer_main c ON cc.cus_id = c.id
JOIN dl_repair_tickets r ON c.id = r.user_id
-- UNION ALL
--
-- -- 救援单
-- SELECT
-- car.id AS car_id,
-- car.license_number,
-- c.id AS customer_id,
-- c.cus_name,
-- c.phone_number,
-- ri.id AS biz_id,
-- NULL AS biz_no,
-- ri.rescue_type AS biz_type,
-- ri.rescue_time AS biz_time,
-- 'rescue' AS source,
-- ROW_NUMBER() OVER (PARTITION BY car.id ORDER BY ri.rescue_time DESC) AS rn
-- FROM base_car_main car
-- JOIN base_customer_car cc ON car.id = cc.car_id
-- JOIN base_customer_main c ON cc.cus_id = c.id
-- JOIN rescue_info ri ON c.id = ri.user_id
-- WHERE ri.rescue_time BETWEEN '2025-01-01 00:00:00' AND '2025-01-31 23:59:59'
INNER JOIN base_customer_car cc ON car.id = cc.car_id
LEFT JOIN base_customer_main c ON cc.cus_id = c.id
INNER JOIN dl_repair_tickets r ON car.license_number = r.car_no
) t
WHERE t.rn = 1
<if test="reqVO.dateRange != null">
AND t.bizTime BETWEEN CONCAT(#{reqVO.dateRange[0]}, ' 00:00:00') AND CONCAT( #{reqVO.dateRange[1]}, ' 23:59:59')
AND t.bizTime BETWEEN CONCAT(#{reqVO.dateRange[0]}, ' 00:00:00')
AND CONCAT(#{reqVO.dateRange[1]}, ' 23:59:59')
</if>
<if test="reqVO.search != null and reqVO.search != ''">
AND (t.customerName LIKE CONCAT('%', #{reqVO.search}, '%')
AND (
t.customerName LIKE CONCAT('%', #{reqVO.search}, '%')
OR t.customerPhone LIKE CONCAT('%', #{reqVO.search}, '%')
OR t.carNum LIKE CONCAT('%', #{reqVO.search}, '%')
)
</if>
GROUP BY t.carNum
ORDER BY t.bizTime DESC
</select>
<select id="pageByCustomerOrCar" resultType="cn.iocoder.yudao.module.base.vo.QueryTableResp">
SELECT drt.*, '维修' AS sourceStr
FROM dl_repair_tickets drt

View File

@ -61,7 +61,10 @@
<result property="jiaoqiang" column="jiaoqiang" />
<result property="shangye" column="shangye" />
<result property="payStatus" column="pay_status" />
<result property="payConfirm" column="pay_confirm" />
<result property="payConfirmRemark" column="pay_confirm_remark" />
<result property="settlementStr" column="settlementStr"/>
<result property="payTime" column="pay_time"/>
</resultMap>
<resultMap id="APPBaseResultMap" type="cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO">
@ -124,6 +127,7 @@
<result property="canOperate" column="can_operate" />
<result property="handleName" column="handle_name" />
<result property="handleMobile" column="handle_mobile" />
<result property="settlementTime" column="settlementTime" />
<association property="booking" javaType="cn.iocoder.yudao.module.booking.entity.DlRepairBooking" select="selectBookingById" column="id"/>
<collection property="itemList" column="id" ofType="cn.iocoder.yudao.module.tickets.entity.DlRepairTitem" select="selectItemList" />
</resultMap>
@ -193,11 +197,12 @@
SELECT * FROM dl_repair_booking WHERE tickets_id = #{id}
</select>
<select id="getTicketsPage" resultMap="BaseResultMap">
SELECT drt.*
SELECT drt.*,rorder.pay_time AS pay_time
<if test="map.payStatus != null and map.payStatus != '' and map.payStatus == '01'">
,drr.other_data AS settlementStr
</if>
FROM dl_repair_tickets drt
LEFT JOIN repair_order_info rorder ON rorder.goods_id = drt.id
<if test="map.payStatus != null and map.payStatus != '' and map.payStatus == '01'">
LEFT JOIN dl_repair_records drr ON drt.id = drr.ticket_id AND drr.type = 'jssq'
</if>
@ -411,7 +416,7 @@
</select>
<select id="getPageTypeAll" resultMap="APPBaseResultMap">
SELECT drt.*
SELECT drt.*,drr.create_time AS settlementTime
FROM dl_repair_tickets drt
<if test="map.cusFrom != null and map.cusFrom!=''">
-- 按客户来源查,需要关联客户表 --
@ -421,9 +426,24 @@
ON drt.id = drti.ticket_id AND drti.deleted = '0' AND drti.item_type='01'
LEFT JOIN dl_repair_worker drw
ON FIND_IN_SET(drw.user_id, drti.repair_ids) > 0 AND drw.deleted = '0'
LEFT JOIN repair_order_info roi
ON drt.ticket_no = roi.order_no AND roi.deleted = '0'
LEFT JOIN dl_repair_records drr
ON drr.ticket_id = drt.id AND drr.deleted = '0' AND drr.type = 'jssp'
WHERE drt.deleted = '0' AND tickets_status!='03'
<!-- 模糊搜索 -->
<if test="map.searchTimeArray != null and map.searchTimeArray.length > 0">
<if test="map.timeType == 'create'">
AND (drt.create_time BETWEEN CONCAT(#{map.searchTimeArray[0]}, ' 00:00:00') AND CONCAT(#{map.searchTimeArray[1]}, ' 23:59:59'))
</if>
<if test="map.timeType == 'settlement'">
AND (drr.create_time BETWEEN CONCAT(#{map.searchTimeArray[0]}, ' 00:00:00') AND CONCAT(#{map.searchTimeArray[1]}, ' 23:59:59'))
</if>
</if>
<!-- 时间区间 -->
<if test="map.ticketNo != null and map.ticketNo != ''">
AND (
drt.ticket_no LIKE CONCAT('%', #{map.ticketNo}, '%')
@ -436,11 +456,6 @@
OR drti.item_name LIKE CONCAT('%', #{map.ticketNo}, '%')
)
</if>
<!-- 时间区间 -->
<if test="map.searchTimeArray != null and map.searchTimeArray.length > 0">
AND (drt.create_time BETWEEN CONCAT(#{map.searchTimeArray[0]}, ' 00:00:00') AND CONCAT(#{map.searchTimeArray[1]}, ' 23:59:59'))
</if>
<if test="map.startDate != null and map.startDate != ''">
AND (drt.create_time &gt;= #{map.startDate} AND drt.create_time &lt;= #{map.endDate})
</if>
@ -466,9 +481,31 @@
</foreach>
</if>
<!-- 收款状态 -->
<if test="map.payStatus != null and map.payStatus != ''">
<!-- -->
<!-- 应收款 -->
<if test="map.payStatus == 'receivable'">
AND drt.pay_status != '01'
</if>
<!-- 已收款 -->
<if test="map.payStatus == 'receivedAmount'">
AND drt.pay_status != '01' AND roi.pay_money IS NOT NULL
</if>
<!-- 代收款 -->
<if test="map.payStatus == 'pendingAmount'">
AND drt.pay_status != '01' AND roi.pay_money IS NULL
</if>
</if>
<!-- 客户来源 -->
<if test="map.cusFrom != null and map.cusFrom!=''">
AND bcm.data_from = #{map.cusFrom}
AND (bcm.data_from = #{map.cusFrom} OR drt.busi_from = #{map.busiFrom})
</if>
<!-- 业务渠道 -->
<if test="map.cusFrom != null and map.busiFrom!=''">
AND drt.busi_from = #{map.busiFrom}
</if>
<!-- 服务顾问 -->
@ -569,6 +606,10 @@
</if>
LEFT JOIN dl_repair_worker drw
ON FIND_IN_SET(drw.user_id, drti.repair_ids) > 0 AND drw.deleted = '0'
LEFT JOIN dl_repair_records drr
ON drr.ticket_id = drt.id AND drr.deleted = '0' AND drr.type = 'jssp'
LEFT JOIN repair_order_info roi
ON drt.ticket_no = roi.order_no AND roi.deleted = '0'
WHERE drt.deleted = '0'
AND drt.tickets_status != '03'
@ -586,8 +627,41 @@
)
</if>
<!-- 业务渠道 -->
<if test="map.cusFrom != null and map.busiFrom!=''">
AND drt.busi_from = #{map.busiFrom}
</if>
<!-- 客户来源 -->
<if test="map.cusFrom != null and map.cusFrom!=''">
AND (bcm.data_from = #{map.cusFrom} OR drt.busi_from = #{map.busiFrom})
</if>
<!-- 收款状态 -->
<if test="map.payStatus != null and map.payStatus != ''">
<!-- -->
<!-- 应收款 -->
<if test="map.payStatus == 'receivable'">
AND drt.pay_status != '01'
</if>
<!-- 已收款 -->
<if test="map.payStatus == 'receivedAmount'">
AND drt.pay_status != '01' AND roi.pay_money IS NOT NULL
</if>
<!-- 代收款 -->
<if test="map.payStatus == 'pendingAmount'">
AND drt.pay_status != '01' AND roi.pay_money IS NULL
</if>
</if>
<if test="map.searchTimeArray != null and map.searchTimeArray.length > 0">
AND (drt.create_time BETWEEN CONCAT(#{map.searchTimeArray[0]}, ' 00:00:00') AND CONCAT(#{map.searchTimeArray[1]}, ' 23:59:59'))
<if test="map.timeType == 'create'">
AND (drt.create_time BETWEEN CONCAT(#{map.searchTimeArray[0]}, ' 00:00:00') AND CONCAT(#{map.searchTimeArray[1]}, ' 23:59:59'))
</if>
<if test="map.timeType == 'settlement'">
AND (drr.create_time BETWEEN CONCAT(#{map.searchTimeArray[0]}, ' 00:00:00') AND CONCAT(#{map.searchTimeArray[1]}, ' 23:59:59'))
</if>
</if>
<if test="map.startDate != null and map.startDate != ''">
AND (drt.create_time &gt;= #{map.startDate} AND drt.create_time &lt;= #{map.endDate})

View File

@ -93,7 +93,8 @@
select 1 from dl_tw_item dti where dti.tw_id = dtw.id and dti.deleted = '0'
<choose>
<when test="map.userRole == 5 and map.isBack == false">
and (dti.wares_count > dti.wares_already_count and dti.wares_status = '1')
-- and (dti.wares_count > dti.wares_already_count and dti.wares_status = '1')
and ( dti.wares_status = '1')
</when>
<when test="map.userRole == 5 and map.isBack == true">
and (dti.wares_already_count > 0 and dti.wares_status = '1')

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

@ -78,6 +78,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 +89,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 +165,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 +183,12 @@ public class RescueInfoController extends BaseController {
return success();
}
@PutMapping("/updateRescueInfoOnHomePage")
public CommonResult updateRescueInfoOnHomePage(@RequestBody @Valid RescueInfo rescueInfo) {
rescueInfoService.updateRescueInfoOnHomePage(rescueInfo);
return success();
}
/**
* 新增道路救援发起
*/
@ -149,6 +199,12 @@ public class RescueInfoController extends BaseController {
return success();
}
@PostMapping("/editByDetails")
public CommonResult editByDetails(@RequestBody @Valid RescueInfo rescueInfo) {
rescueInfoService.updateById(rescueInfo);
return success();
}
/**
* 取消道路救援
*/
@ -172,6 +228,12 @@ public class RescueInfoController extends BaseController {
}
//
@PutMapping("/revokeRescueInfo")
public CommonResult revokeRescueInfo(Long id) {
rescueInfoService.revokeRescueInfo(id);
return success();
}
/**
* 查询请填写功能名称列表
*/
@ -181,6 +243,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 +350,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,14 +363,17 @@ 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);
}

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

@ -17,6 +17,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 +40,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 +62,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 +103,6 @@ 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);
}

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();

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

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

@ -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,9 @@
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>
</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;
}
}