Merge branch 'driver'

This commit is contained in:
Lx 2025-08-05 14:52:16 +08:00
commit 479fd66535
24 changed files with 336 additions and 154 deletions

View File

@ -93,12 +93,14 @@ public class WorkReportServiceImpl extends ServiceImpl<WorkReportMapper, WorkRep
String message = "向您进行了工作汇报,请在内部管理中查阅!";
String text = userName + message;
// 发送消息给汇报对象
this.sendMessage(createReqVO.getReportTos(), text, createReqVO.getServicePackageId());
// 根据服务套餐id进行发送
if("jiaxiao".equals(createReqVO.getServicePackageId())){
/*if("jiaxiao".equals(createReqVO.getServicePackageId())){
this.sendMessage(createReqVO.getReportTos(), text, createReqVO.getServicePackageId());
}else if("jiance".equals(createReqVO.getServicePackageId())){
this.sendMessage(createReqVO.getReportTos(), text, createReqVO.getServicePackageId());
}
}*/
// 返回
return report.getId();
}
@ -187,7 +189,6 @@ public class WorkReportServiceImpl extends ServiceImpl<WorkReportMapper, WorkRep
/**
* 查询汇报对象数量
*
* @param userId
* @return
*/
@Override

View File

@ -14,6 +14,8 @@ public enum InspectionFileEnum {
FILE("equipment", "设备文件夹"),
COACH("coach", "驾校员工文件夹"),
student("student","驾校学员文件夹"),
WX_EQUIPMENT("wx_equipment","维修设备文件夹"),
JY_EQUIPMENT("jy_equipment","救援设备文件夹"),
INSPECTION_CUSTOMER("small_inspection_member_folder", "检测客户资料夹"),
;

View File

@ -174,6 +174,11 @@ public class InspectionEquInfoController extends BaseController {
return success(inspectionEquInfoService.addFolder(id));
}
@PostMapping("/addDeviceFolder")
public CommonResult<?> addDeviceFolder(@RequestParam Long id, @RequestParam String servicePackageId, @RequestParam String defaultKey) {
return success(inspectionEquInfoService.addDeviceFolder(id, servicePackageId, defaultKey));
}
/**
* 查询设备数量根据分类
*
@ -184,4 +189,9 @@ public class InspectionEquInfoController extends BaseController {
return success(inspectionEquInfoService.queryEquipmentCountByCategory());
}
@GetMapping("/queryEquipmentCountByPackageId")
public CommonResult<?> queryEquipmentCountByPackageId(@RequestParam String servicePackageId, @RequestParam String dictType) {
return success(inspectionEquInfoService.queryEquipmentCountByPackageId(servicePackageId, dictType));
}
}

View File

@ -96,4 +96,7 @@ public class InspectionEquInfo extends TenantBaseDO
@TableField(exist = false)
private List<FileDO> fileList;
/** 服务套餐id */
private String servicePackageId;
}

View File

@ -36,4 +36,5 @@ public interface InspectionEquInfoMapper extends BaseMapper<InspectionEquInfo>
public IPage<InspectionEquInfo> selectInspectionEquInfoList(Page page, @Param("inspectionEquInfo") InspectionEquInfo inspectionEquInfo);
List<EquipmentCountVo> queryEquipmentCountByCategory();
List<EquipmentCountVo> queryEquipmentCountByPackageId(@Param("servicePackageId") String servicePackageId, @Param("dictType") String dictType);
}

View File

@ -80,6 +80,7 @@ public interface IInspectionEquInfoService extends IService<InspectionEquInfo> {
* @return 文件夹id
*/
Long addFolder(Long id);
Long addDeviceFolder(Long id, String servicePackageId, String defaultKey);
/**
* 查询设备统计信息
@ -87,4 +88,5 @@ public interface IInspectionEquInfoService extends IService<InspectionEquInfo> {
* @return
*/
List<EquipmentCountVo> queryEquipmentCountByCategory();
List<EquipmentCountVo> queryEquipmentCountByPackageId(String servicePackageId, String dictType);
}

View File

@ -115,6 +115,7 @@ public interface IInspectionFileService extends IService<InspectionFile> {
* @return 文件夹id
*/
Long addFolder(String folderName, String key);
Long addFolderForDevice(String folderName, String key, String servicePackageId);
Long addFolderForJx(String folderName, String key);
Long addFolderForJy(String folderName, String key);

View File

@ -210,6 +210,18 @@ public class InspectionEquInfoServiceImpl extends ServiceImpl<InspectionEquInfoM
return resultMap;
}
@Override
public Long addDeviceFolder(Long id, String servicePackageId, String defaultKey) {
InspectionEquInfo inspectionEquInfo = this.getById(id);
if (ObjectUtil.isNotEmpty(inspectionEquInfo)) {
Long folderId = inspectionFileService.addFolderForDevice(inspectionEquInfo.getEquName(), defaultKey, servicePackageId);
//修改文件夹id
this.update(Wrappers.<InspectionEquInfo>lambdaUpdate().eq(InspectionEquInfo::getId, id).set(InspectionEquInfo::getFolderId, folderId));
return folderId;
}
return null;
}
/**
* 添加设备文件夹
*
@ -238,6 +250,11 @@ public class InspectionEquInfoServiceImpl extends ServiceImpl<InspectionEquInfoM
return baseMapper.queryEquipmentCountByCategory();
}
@Override
public List<EquipmentCountVo> queryEquipmentCountByPackageId(String servicePackageId, String dictType) {
return baseMapper.queryEquipmentCountByPackageId(servicePackageId, dictType);
}
/**
* 保存导入的设备信息
*

View File

@ -498,6 +498,36 @@ public class InspectionFileServiceImpl extends ServiceImpl<InspectionFileMapper,
return resultFiles;
}
@Override
public Long addFolderForDevice(String folderName, String key, String servicePackageId) {
//根据key找到对应的文件夹id
InspectionFile fatherFolder = baseMapper.selectOne(new LambdaQueryWrapper<InspectionFile>().eq(InspectionFile::getDefaultKey, key));
//如果默认文件夹为空就新建
if (fatherFolder == null) {
fatherFolder = new InspectionFile();
fatherFolder.setFileName(InspectionFileEnum.getDescByType(key));
fatherFolder.setType(InspectionConstants.INSPECTION_FOLDER);
fatherFolder.setDefaultKey(key);
fatherFolder.setServicePackageId(servicePackageId);
baseMapper.insert(fatherFolder);
fatherFolder.setFileCode(fatherFolder.getId() + ",");
baseMapper.updateById(fatherFolder);
}
InspectionFile inspectionFile = new InspectionFile();
inspectionFile.setFatherId(fatherFolder.getId());
inspectionFile.setFileName(folderName + InspectionConstants.INSPECTION_FOLDER_SUFFIX);
inspectionFile.setType(InspectionConstants.INSPECTION_FOLDER);
inspectionFile.setIsStaffFile(InspectionConstants.INSPECTION_IS_STAFF_FILE);
inspectionFile.setServicePackageId(servicePackageId);
baseMapper.insert(inspectionFile);
inspectionFile.setFileCode(inspectionFile.getId() + ",");
baseMapper.updateById(inspectionFile);
return inspectionFile.getId();
}
/**
* 新增文件夹
*

View File

@ -27,6 +27,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="inspectionEquInfo.type != null and inspectionEquInfo.type != ''">
and `type` = #{inspectionEquInfo.type}
</if>
<if test="inspectionEquInfo.servicePackageId != null and inspectionEquInfo.servicePackageId != ''">
and service_package_id = #{inspectionEquInfo.servicePackageId}
</if>
</where>
</select>
@ -48,4 +51,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY sd.value, sd.label;
</select>
<select id="queryEquipmentCountByPackageId" resultType="cn.iocoder.yudao.module.inspection.vo.EquipmentCountVo">
SELECT
sd.value AS categoryId,
COUNT(iei.id) AS count,
sd.label AS categoryName
FROM system_dict_data sd
LEFT JOIN inspection_equ_info iei
ON iei.type = sd.value AND iei.deleted = 0 AND iei.service_package_id = #{servicePackageId}
WHERE sd.dict_type = #{dictType}
AND sd.deleted = 0
GROUP BY sd.value, sd.label;
</select>
</mapper>

View File

@ -112,8 +112,8 @@ public class TrainController {
@RequestParam(value = "sort",required = false) String sort,
@RequestParam(value = "startTime",required = false) String startTime,
@RequestParam(value = "endTime",required = false) String endTime,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
//默认查全部数据
String startTimeStr = "";
String endTimeStr = "";
@ -304,7 +304,7 @@ public class TrainController {
* 当日正在训练学员统计
*/
@GetMapping("getTodayTrainSituation")
public CommonResult<CloakAndTrainCountVO> getTodayTrainSituation(Train train){
public CommonResult<CloakAndTrainCountVO> getTodayTrainSituation(TodayTrainVO train){
return success(trainService.getTodayTrainSituation(train));
}
@ -312,10 +312,10 @@ public class TrainController {
* 获取当前正在训练的学员列表
*/
@GetMapping("getTodayStudentTrainSituation")
public CommonResult<IPage<Train>> getTodayStudentTrainSituation(Train train,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
public CommonResult<IPage<TodayTrainVO>> getTodayStudentTrainSituation(TodayTrainVO train,
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize){
Page<Train> page = new Page<>(pageNo, pageSize);
Page<TodayTrainVO> page = new Page<>(pageNum, pageSize);
return success(trainService.getTodayStudentTrainSituation(train,page));
}
}

View File

@ -44,10 +44,10 @@ public interface TrainMapper extends BaseMapper<Train> {
/**
* 获取当日实时训练情况
*/
CloakAndTrainCountVO getTodayTrainSituation(@Param("entity") Train train);
CloakAndTrainCountVO getTodayTrainSituation(@Param("entity") TodayTrainVO train);
/**
* 获取正在训练的学员信息
*/
IPage<Train> getTodayStudentTrainSituation(@Param("entity") Train train, Page<Train> page);
IPage<TodayTrainVO> getTodayStudentTrainSituation(@Param("entity") TodayTrainVO train, Page<TodayTrainVO> page);
}

View File

@ -2,10 +2,7 @@ package cn.iocoder.yudao.module.train.service;
import cn.iocoder.yudao.module.course.vo.CommissionExportVO;
import cn.iocoder.yudao.module.train.entity.Train;
import cn.iocoder.yudao.module.train.vo.CloakAndTrainCountVO;
import cn.iocoder.yudao.module.train.vo.NoClockInRemindVO;
import cn.iocoder.yudao.module.train.vo.TrainExportVO;
import cn.iocoder.yudao.module.train.vo.TrainVO;
import cn.iocoder.yudao.module.train.vo.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
@ -118,10 +115,10 @@ public interface TrainService extends IService<Train> {
/**
* 当日正在训练学员统计
*/
CloakAndTrainCountVO getTodayTrainSituation(Train train);
CloakAndTrainCountVO getTodayTrainSituation(TodayTrainVO train);
/**
* 获取当前正在训练的学员信息列表
*/
IPage<Train> getTodayStudentTrainSituation(Train train, Page<Train> page);
IPage<TodayTrainVO> getTodayStudentTrainSituation(TodayTrainVO train, Page<TodayTrainVO> page);
}

View File

@ -11,10 +11,7 @@ import cn.iocoder.yudao.module.course.vo.CommissionExportVO;
import cn.iocoder.yudao.module.train.entity.Train;
import cn.iocoder.yudao.module.train.mapper.TrainMapper;
import cn.iocoder.yudao.module.train.service.TrainService;
import cn.iocoder.yudao.module.train.vo.CloakAndTrainCountVO;
import cn.iocoder.yudao.module.train.vo.NoClockInRemindVO;
import cn.iocoder.yudao.module.train.vo.TrainExportVO;
import cn.iocoder.yudao.module.train.vo.TrainVO;
import cn.iocoder.yudao.module.train.vo.*;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -258,7 +255,7 @@ public class TrainServiceImpl extends ServiceImpl<TrainMapper, Train> implements
* 当日正在训练学员统计
*/
@Override
public CloakAndTrainCountVO getTodayTrainSituation(Train train) {
public CloakAndTrainCountVO getTodayTrainSituation(TodayTrainVO train) {
return trainMapper.getTodayTrainSituation(train);
}
@ -266,7 +263,7 @@ public class TrainServiceImpl extends ServiceImpl<TrainMapper, Train> implements
* 获取当前正在训练的学员信息列表
*/
@Override
public IPage<Train> getTodayStudentTrainSituation(Train train, Page<Train> page) {
public IPage<TodayTrainVO> getTodayStudentTrainSituation(TodayTrainVO train, Page<TodayTrainVO> page) {
return trainMapper.getTodayStudentTrainSituation(train, page);
}

View File

@ -0,0 +1,11 @@
package cn.iocoder.yudao.module.train.vo;
import cn.iocoder.yudao.module.train.entity.Train;
import lombok.Data;
@Data
public class TodayTrainVO extends Train {
// 课程类型
private String courseType;
}

View File

@ -331,7 +331,7 @@
AND dscc.end_time IS NULL
AND dscc.deleted = 0
<if test="entity.subject != null and entity.subject != '' ">
AND subject = #{entity.subject}
AND dscc.subject = #{entity.subject}
</if>
GROUP BY
dscc.id

View File

@ -213,38 +213,46 @@
<select id="getTodayTrainSituation" resultType="cn.iocoder.yudao.module.train.vo.CloakAndTrainCountVO">
SELECT
COALESCE ( COUNT(*), 0 ) AS totalStudentCount,
COALESCE ( SUM( CASE WHEN SUBJECT = 2 THEN 1 ELSE 0 END ), 0 ) AS subject2StudentCount,
COALESCE ( SUM( CASE WHEN SUBJECT = 3 THEN 1 ELSE 0 END ), 0 ) AS subject3StudentCount
COALESCE ( SUM( CASE WHEN dst.subject = 2 THEN 1 ELSE 0 END ), 0 ) AS subject2StudentCount,
COALESCE ( SUM( CASE WHEN dst.subject = 3 THEN 1 ELSE 0 END ), 0 ) AS subject3StudentCount
FROM
drive_school_train
drive_school_train dst
LEFT JOIN drive_school_course dsc ON dst.course_id = dsc.id AND dsc.deleted = 0
WHERE
DATE ( create_time ) = CURDATE()
AND DATE ( start_time ) = CURDATE()
AND end_time IS NULL
AND user_id IS NOT NULL
AND deleted = 0
DATE ( dst.create_time ) = CURDATE()
AND DATE ( dst.start_time ) = CURDATE()
AND dst.end_time IS NULL
AND dst.user_id IS NOT NULL
AND dst.deleted = 0
<if test="entity.userName != null and entity.userName != '' ">
AND user_name like concat('%',#{entity.userName},'%')
AND dst.user_name like concat('%',#{entity.userName},'%')
</if>
<if test="entity.subject != null">
AND subject = #{entity.subject}
AND dst.subject = #{entity.subject}
</if>
<if test="entity.courseType != null and entity.courseType != ''">
AND dsc.type = #{entity.courseType}
</if>
</select>
<select id="getTodayStudentTrainSituation" resultType="cn.iocoder.yudao.module.train.entity.Train">
SELECT *
FROM drive_school_train
<select id="getTodayStudentTrainSituation" resultType="cn.iocoder.yudao.module.train.vo.TodayTrainVO">
SELECT dst.*
FROM drive_school_train dst
LEFT JOIN drive_school_course dsc ON dst.course_id = dsc.id AND dsc.deleted = 0
WHERE
DATE (create_time) = CURDATE()
AND DATE (start_time) = CURDATE()
AND end_time IS NULL
AND user_id IS NOT NULL
AND deleted = 0
DATE (dst.create_time) = CURDATE()
AND DATE (dst.start_time) = CURDATE()
AND dst.end_time IS NULL
AND dst.user_id IS NOT NULL
AND dst.deleted = 0
<if test="entity.userName != null and entity.userName != ''">
AND user_name like concat('%',#{entity.userName},'%')
AND dst.user_name like concat('%',#{entity.userName},'%')
</if>
<if test="entity.subject != null">
AND subject = #{entity.subject}
AND dst.subject = #{entity.subject}
</if>
<if test="entity.courseType != null and entity.courseType != ''">
AND dsc.type = #{entity.courseType}
</if>
</select>
</mapper>

View File

@ -18,6 +18,7 @@ import cn.iocoder.yudao.module.rescue.service.IRescueOrderInfoService;
import cn.iocoder.yudao.module.rescue.utils.ExcelUtil;
import cn.iocoder.yudao.module.rescue.utils.StringUtils;
import cn.iocoder.yudao.module.rescue.vo.BuckleVO;
import cn.iocoder.yudao.module.rescue.vo.DriverInfoExportVO;
import cn.iocoder.yudao.module.rescue.vo.MoneyManagement;
import cn.iocoder.yudao.module.rescue.vo.ReturnCarVO;
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
@ -542,7 +543,7 @@ public class RescueInfoSystem extends BaseController {
*/
@GetMapping("/get-import-template")
public void importTemplate(HttpServletResponse response) throws IOException {
String[] head = {"员工姓名", "岗位", "年龄", "电话号码", "性别"};
String[] head = {"员工姓名", "年龄", "电话号码", "性别"};
// 下拉框列及选项列索引 -> 下拉框选项
Map<Integer, String[]> dropdownColumns = new HashMap<>();
@ -562,7 +563,7 @@ public class RescueInfoSystem extends BaseController {
dropdownColumns.put(5, genders);
List<List<String>> exampleDataList = Arrays.asList(
Arrays.asList("测试员工", "岗位是下拉框选择", "年龄", "电话号码", "性别")
Arrays.asList("测试员工", "年龄", "电话号码", "性别")
);
List<Integer> textColumns = Collections.singletonList(3);
@ -570,4 +571,16 @@ public class RescueInfoSystem extends BaseController {
// 导出空白模板到Excel
exportBlankTemplate(response, "staff_template.xlsx", "员工信息", head, dropdownColumns, true, exampleDataList, textColumns);
}
/**
* 导出
*/
@GetMapping("/drviceExport")
public void exportUserList(DriverInfoDto query,
HttpServletResponse response) throws IOException {
List<DriverInfoExportVO> list = rescueInfoService.getAll(query);
// 输出 Excel
ExcelUtils.write(response, "员工数据.xls", "数据", DriverInfoExportVO.class,
list);
}
}

View File

@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.rescue.domain.RescueInfo;
import cn.iocoder.yudao.module.rescue.dto.DriverInfo2Dto;
import cn.iocoder.yudao.module.rescue.dto.DriverInfoDto;
import cn.iocoder.yudao.module.rescue.vo.BuckleVO;
import cn.iocoder.yudao.module.rescue.vo.DriverInfoExportVO;
import cn.iocoder.yudao.module.rescue.vo.DriverStaffSaveVO;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@ -90,4 +91,6 @@ public interface RescueInfoMapper extends BaseMapper<RescueInfo>
List<Map<String, Object>> selectRescueOrderByRoad(String dictType);
DriverStaffSaveVO getOnInternal(Long id);
List<DriverInfoExportVO> getAll(@Param("entity") DriverInfoDto query);
}

View File

@ -6,10 +6,7 @@ import cn.iocoder.yudao.module.rescue.domain.DriverInfo;
import cn.iocoder.yudao.module.rescue.domain.RescueInfo;
import cn.iocoder.yudao.module.rescue.dto.DriverInfo2Dto;
import cn.iocoder.yudao.module.rescue.dto.DriverInfoDto;
import cn.iocoder.yudao.module.rescue.vo.BuckleVO;
import cn.iocoder.yudao.module.rescue.vo.DriverStaffSaveVO;
import cn.iocoder.yudao.module.rescue.vo.MoneyManagement;
import cn.iocoder.yudao.module.rescue.vo.ReturnCarVO;
import cn.iocoder.yudao.module.rescue.vo.*;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -175,4 +172,6 @@ public interface IRescueInfoService extends IService<RescueInfo>
DriverStaffSaveVO getOnInternal(Long id);
List<DriverInfoExportVO> getAll(DriverInfoDto query);
}

View File

@ -25,10 +25,7 @@ import cn.iocoder.yudao.module.rescue.utils.DateUtils;
import cn.iocoder.yudao.module.rescue.utils.RedisUtil;
import cn.iocoder.yudao.module.rescue.utils.RedissonDelayQueue;
import cn.iocoder.yudao.module.rescue.utils.StringUtils;
import cn.iocoder.yudao.module.rescue.vo.BuckleVO;
import cn.iocoder.yudao.module.rescue.vo.DriverStaffSaveVO;
import cn.iocoder.yudao.module.rescue.vo.MoneyManagement;
import cn.iocoder.yudao.module.rescue.vo.ReturnCarVO;
import cn.iocoder.yudao.module.rescue.vo.*;
import cn.iocoder.yudao.module.staff.service.CompanyStaffService;
import cn.iocoder.yudao.module.staff.vo.CompanyStaffRespVO;
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
@ -1547,6 +1544,10 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
return driverStaffSaveVo;
}
@Override
public List<DriverInfoExportVO> getAll(DriverInfoDto query) {
return baseMapper.getAll(query);
}
public List<RescueInfo> filterRescueInfoByDate(List<RescueInfo> rescueInfos, Date startTime, Date endTime) {
return rescueInfos.stream()
.filter(info -> info.getRescueTime() != null &&

View File

@ -0,0 +1,41 @@
package cn.iocoder.yudao.module.rescue.vo;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
@Data
public class DriverInfoExportVO {
@ExcelProperty("员工账号")
private String username;
@ExcelProperty("员工姓名")
private String nickname;
@ExcelProperty("手机号")
private String mobile;
@ExcelIgnore
private String sex;
@ExcelProperty("性别")
private String sexStr;
@ExcelProperty("岗位")
private String roleNames;
public void setSex(String sex) {
this.sex = sex;
// 设置转换后的性别字符串
if ("0".equals(sex)) {
this.sexStr = "";
} else if ("1".equals(sex)) {
this.sexStr = "";
} else {
this.sexStr = "未知";
}
}
}

View File

@ -6,13 +6,13 @@
<select id="selectRescueInfoList" 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.order_status,
roi.set_money
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
<where>
1 = 1
and ri.deleted = '0'
and ri.deleted = '0'
<if test="map.rescueStatus != null">
<choose>
<when test="map.rescueStatus == '1'.toString()">
@ -49,9 +49,10 @@
and ri.license_num like concat('%', #{map.licenseNum}, '%')
</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>
and ri.dept_id in
<foreach collection="map.deptList" separator="," item="item" open="(" close=")">
#{item}
</foreach>
</if>
</where>
order by ri.create_time desc
@ -59,13 +60,13 @@
<select id="selectRescueListSystem2" resultType="cn.iocoder.yudao.module.rescue.domain.RescueInfo">
SELECT ri.*,
roi.order_status,
roi.set_money,
roi.id as rescueOrderId,
roi.pay_money,
roi.pay_time
roi.order_status,
roi.set_money,
roi.id as rescueOrderId,
roi.pay_money,
roi.pay_time
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
where ri.deleted = '0'
<if test="map.orderStatus != null and map.orderStatus != ''">
and roi.order_status = #{map.orderStatus}
@ -96,7 +97,7 @@
</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')
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})
@ -107,15 +108,15 @@
<select id="listData" resultType="com.alibaba.fastjson.JSONObject">
SELECT sum(set_money / 100) as allMoney,
count(1) as allNum,
sum(case
when ri.car_type = '1' then (set_money / 100) *
${rescueTcBig}
when ri.car_type = '2' then (set_money / 100) * ${rescueTcMid}
when ri.car_type = '3' then (set_money / 100) * ${rescueTcSmall}
else 0 end) as tcAll
count(1) as allNum,
sum(case
when ri.car_type = '1' then (set_money / 100) *
${rescueTcBig}
when ri.car_type = '2' then (set_money / 100) * ${rescueTcMid}
when ri.car_type = '3' then (set_money / 100) * ${rescueTcSmall}
else 0 end) as tcAll
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
<where>
<if test="driverName != null">
and ri.driver_name like concat('%', #{driverName}, '%')
@ -135,10 +136,10 @@
<select id="selectRescueInfoListApp" 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.order_status,
roi.set_money
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
<where>
(ri.user_id = #{map.userId} or connection_phone = #{map.connectionPhone})
<if test="map.rescueStatus != null">
@ -223,12 +224,12 @@
from rescue_info ri
<where>
dept_id = #{map.deptId}
and rescue_type = '5'
and rescue_type = '5'
<if test="map.connectionName != null and map.connectionName != ''">
and (connection_name like concat('%', #{map.connectionName}, '%') or connection_phone like concat('%',
#{map.connectionPhone},
'%') or
license_num like concat('%', #{map.licenseNum}, '%'))
#{map.connectionPhone},
'%') or
license_num like concat('%', #{map.licenseNum}, '%'))
</if>
<if test="map.rescueStatus != null">
<choose>
@ -247,15 +248,15 @@
</select>
<select id="driverList" resultType="cn.iocoder.yudao.module.rescue.domain.DriverInfo">
SELECT su.id AS userId,
su.nickname AS nickName,
su.mobile AS phonenumber,
su.sex as sex,
su.avatar as avatar,
di.*
SELECT su.id AS userId,
su.nickname AS nickName,
su.mobile AS phonenumber,
su.sex as sex,
su.avatar as avatar,
di.*
FROM driver_info di
INNER JOIN system_users su ON di.user_id = su.id
AND su.deleted = '0'
INNER JOIN system_users su ON di.user_id = su.id
AND su.deleted = '0'
WHERE 1 = 1
<if test="map.nickName != null and map.nickName != ''">
and su.nickname like concat('%', #{map.nickName}, '%')
@ -280,17 +281,17 @@
<select id="driverListApp" resultType="cn.iocoder.yudao.module.rescue.dto.DriverInfo2Dto">
SELECT di.*,
su.nickname as real_name,
rci.rescue_car_num
su.nickname as real_name,
rci.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
inner join rescue_car_info rci on rci.possessor_id = di.id
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
inner join rescue_car_info rci on rci.possessor_id = di.id
WHERE di.auth_status = '2'
<if test="searchValue != null and searchValue != ''">
and (su.nickname like concat('%', #{searchValue}, '%') or
di.phonenumber like concat('%', #{searchValue}, '%')
or rci.rescue_car_num like concat('%', #{searchValue}, '%'))
di.phonenumber like concat('%', #{searchValue}, '%')
or rci.rescue_car_num like concat('%', #{searchValue}, '%'))
</if>
order by di.create_time desc
</select>
@ -312,8 +313,8 @@
WHERE need_system = '0'
AND driver_id IS NULL
AND TIMESTAMPDIFF(
MINUTE, rescue_time,
NOW()) > 5
MINUTE, rescue_time,
NOW()) > 5
AND rescue_status = '2'
</update>
<select id="getOverTimeRescue" resultType="cn.iocoder.yudao.module.rescue.domain.RescueInfo">
@ -325,15 +326,15 @@
AND ri.rescue_status = '2'
GROUP BY ri.id
HAVING TIMESTAMPDIFF(
MINUTE, MAX(rdi.create_time),
NOW()) <![CDATA[>]]> 3
MINUTE, MAX(rdi.create_time),
NOW()) <![CDATA[>]]> 3
</select>
<select id="getRescueStatistics" resultType="java.util.Map">
SELECT IFNULL(sum(ri.rescue_status = '2' or ri.rescue_status = '3'), 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(sum(ri.is_wei_xiu = '1'), 0) as zwxNum
FROM rescue_info ri
left join rescue_order_info roi on roi.rescue_info_id = ri.id
where ri.user_id = #{userId}
@ -341,17 +342,18 @@
</select>
<select id="getRescueStatisticsByAdmin" resultType="java.util.Map">
SELECT IFNULL(sum(ri.rescue_status = '2' or ri.rescue_status = '3'), 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(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
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
where 1 = 1
<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>
and ri.dept_id in
<foreach collection="map.deptList" separator="," item="item" open="(" close=")">
#{item}
</foreach>
</if>
</select>
<delete id="deleteOtherInfo1">
@ -378,17 +380,17 @@
</select>
<select id="getRescueInfoByDriver" resultType="cn.iocoder.yudao.module.rescue.domain.RescueInfo">
SELECT ri.*,
roi.order_status,
roi.set_money,
roi.id as rescueOrderId,
roi.pay_money,
roi.pay_time
roi.order_status,
roi.set_money,
roi.id as rescueOrderId,
roi.pay_money,
roi.pay_time
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
where driver_id is not null
<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')
and concat(#{map.rescueEnd}, ' 23:59:59')
</if>
<if test="map.licenseNum != null">
and ri.license_num like concat('%', #{map.licenseNum}, '%')
@ -401,7 +403,7 @@
</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')
and concat(#{map.rescueEnd}, ' 23:59:59')
</if>
<if test="map.driverName != null">
@ -442,53 +444,55 @@
ORDER BY sd.id desc
</select>
<select id="selectManageAnalyze" resultType="java.util.Map">
WITH rescue_types AS (
SELECT '1' AS rescue_type, '拖车' AS rescue_type_desc
UNION ALL SELECT '2', '送油'
UNION ALL SELECT '3', '搭电'
UNION ALL SELECT '4', '换台'
UNION ALL SELECT '5', '扣车'
)
SELECT
rt.rescue_type_desc AS rescueType,
COUNT(ri.rescue_type) AS typeCount,
ROUND((COUNT(ri.rescue_type) * 100.0 / NULLIF((SELECT COUNT(*) FROM rescue_info WHERE deleted = b'0' AND rescue_time BETWEEN #{startTime} AND #{endTime} AND tenant_id = #{tenantId}), 0)), 2) AS percentage
FROM
rescue_types rt
LEFT JOIN
rescue_info ri ON rt.rescue_type = ri.rescue_type
AND ri.rescue_time BETWEEN #{startTime} AND #{endTime}
AND ri.tenant_id = #{tenantId}
GROUP BY
rt.rescue_type_desc
ORDER BY
rt.rescue_type;
WITH rescue_types AS (SELECT '1' AS rescue_type, '拖车' AS rescue_type_desc
UNION ALL
SELECT '2', '送油'
UNION ALL
SELECT '3', '搭电'
UNION ALL
SELECT '4', '换台'
UNION ALL
SELECT '5', '扣车')
SELECT rt.rescue_type_desc AS rescueType,
COUNT(ri.rescue_type) AS typeCount,
ROUND((COUNT(ri.rescue_type) * 100.0 / NULLIF((SELECT COUNT(*)
FROM rescue_info
WHERE deleted = b'0'
AND rescue_time BETWEEN #{startTime} AND #{endTime}
AND tenant_id = #{tenantId}), 0)), 2) AS percentage
FROM rescue_types rt
LEFT JOIN
rescue_info ri ON rt.rescue_type = ri.rescue_type
AND ri.rescue_time BETWEEN #{startTime} AND #{endTime}
AND ri.tenant_id = #{tenantId}
GROUP BY rt.rescue_type_desc
ORDER BY rt.rescue_type;
</select>
<select id="selectDriverSort" resultType="java.util.Map">
SELECT
ROW_NUMBER() OVER (ORDER BY COALESCE(SUM(roi.pay_money), 0) DESC) AS sort,
su.nickname,
COALESCE(SUM(roi.set_money), 0) AS money,
COALESCE(COUNT(roi.id), 0) AS count
SELECT ROW_NUMBER() OVER (ORDER BY COALESCE(SUM(roi.pay_money), 0) DESC) AS sort, su.nickname,
COALESCE(SUM(roi.set_money), 0) AS money,
COALESCE(COUNT(roi.id), 0) AS count
FROM
driver_info di
LEFT JOIN
system_users su ON di.user_id = su.id
LEFT JOIN
LEFT JOIN
system_users su
ON di.user_id = su.id
LEFT JOIN
rescue_info ri ON di.id = ri.driver_id
LEFT JOIN
LEFT JOIN
rescue_order_info roi ON ri.id = roi.rescue_info_id
WHERE roi.pay_time BETWEEN #{startTime} AND #{endTime}
WHERE roi.pay_time BETWEEN #{startTime}
AND #{endTime}
GROUP BY
su.nickname,
di.id
ORDER BY
COALESCE(SUM(roi.set_money), 0) DESC;
COALESCE (SUM (roi.set_money), 0) DESC;
</select>
<select id="selectRescueOrderByRoad" resultType="java.util.Map">
select
COALESCE((select value from system_dict_data where dict_type = #{dictType} and id = ri.section_road),'其他') name,
count(1) as count
select COALESCE((select value from system_dict_data where dict_type = #{dictType} and id = ri.section_road),
'其他') name,
count(1) as count
from rescue_info ri
group by name;
</select>
@ -520,5 +524,27 @@
</where>
</select>
<select id="getAll" resultType="cn.iocoder.yudao.module.rescue.vo.DriverInfoExportVO">
SELECT su.username,
su.nickname,
su.mobile,
su.sex,
GROUP_CONCAT(DISTINCT sr2.name SEPARATOR ',') AS roleNames
FROM driver_info di
INNER JOIN system_users su ON di.user_id = su.id AND su.deleted = 0
LEFT JOIN system_user_role sr ON su.id = sr.user_id AND sr.deleted = 0
INNER JOIN system_role role ON role.id = sr.role_id AND role.deleted = 0 AND role.code = 'jysj'
LEFT JOIN system_role sr2 ON sr.role_id = sr2.id AND sr2.service_package_id = 'jiuyuan'
<if test="entity.status != null">
AND su.status = #{entity.status}
</if>
<if test="entity.nickname != null">
AND (su.nickname like CONCAT('%',#{entity.nickname},'%') OR su.username like
CONCAT('%',#{entity.nickname},'%'))
</if>
GROUP BY su.username, su.nickname, su.mobile, su.sex
ORDER BY su.nickname
</select>
</mapper>

View File

@ -104,6 +104,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="role.nickname != null">
AND (su.nickname like CONCAT('%',#{role.nickname},'%') OR su.username like CONCAT('%',#{role.nickname},'%'))
</if>
<if test="role.status != null">
AND su.status = #{role.status}
</if>
</where>
GROUP BY
su.id, su.username, su.nickname, su.user_type, su.remark,