This commit is contained in:
许允枞 2025-04-02 13:44:13 +08:00
parent ef525bd909
commit b0c641fb6d
3 changed files with 84 additions and 39 deletions

View File

@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -30,8 +31,7 @@ public interface DlDriveSchoolStudentService extends IService<DlDriveSchoolStude
* 根据身份证查询学员是否已存在 * 根据身份证查询学员是否已存在
* *
* @param idCard 身份证号 * @param idCard 身份证号
* return boolean * return boolean
*
*/ */
DlDriveSchoolStudent getStudentByIdCard(String idCard); DlDriveSchoolStudent getStudentByIdCard(String idCard);
@ -122,24 +122,33 @@ public interface DlDriveSchoolStudentService extends IService<DlDriveSchoolStude
IPage<DlDriveSchoolStudentVO> queryCoachListPage(DlDriveSchoolStudentVO pageReqVO, Page<DlDriveSchoolStudentVO> page); IPage<DlDriveSchoolStudentVO> queryCoachListPage(DlDriveSchoolStudentVO pageReqVO, Page<DlDriveSchoolStudentVO> page);
/** /**
*
* @author PQZ
* @date 17:08 2025/2/19
* @param type 时间查询类型01驾校统招02教练自招03自来客户 * @param type 时间查询类型01驾校统招02教练自招03自来客户
* @param coachId 教练id * @param coachId 教练id
* @param startTime 查询时间范围--开始 * @param startTime 查询时间范围--开始
* @param endTime 查询时间范围--结束 * @param endTime 查询时间范围--结束
* @return java.util.List<cn.iocoder.yudao.module.base.vo.StudentCountVO> * @return java.util.List<cn.iocoder.yudao.module.base.vo.StudentCountVO>
**/ * @author PQZ
* @date 17:08 2025/2/19
**/
List<StudentCountVO> indexGetTrainList(String type, Long coachId, String startTime, String endTime); List<StudentCountVO> indexGetTrainList(String type, Long coachId, String startTime, String endTime);
/** /**
*查自来客户 * 查自来客户
* @author PQZ *
* @date 11:43 2025/2/20
* @param startTimeStr 查询时间范围--开始 * @param startTimeStr 查询时间范围--开始
* @param endTimeStr 查询时间范围--结束 * @param endTimeStr 查询时间范围--结束
* @return cn.iocoder.yudao.module.base.vo.DlDriveSchoolStaffVO * @return cn.iocoder.yudao.module.base.vo.DlDriveSchoolStaffVO
**/ * @author PQZ
List<DlDriveSchoolStaffVO> indexGetFormList( String startTimeStr, String endTimeStr); * @date 11:43 2025/2/20
**/
List<DlDriveSchoolStaffVO> indexGetFormList(String startTimeStr, String endTimeStr);
/**
* 更新学员拿证时间
*
* @param passTime 拿证日期
* @param userId 学员id
* @param tenantId 租户id
*/
Boolean updateStudentPassAndGradTime(Date passTime, Long userId, String tenantId);
} }

View File

@ -4,6 +4,8 @@ import cn.hutool.core.date.DateUtil;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.base.constant.SchoolBaseConstants;
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolStudent; import cn.iocoder.yudao.module.base.entity.DlDriveSchoolStudent;
import cn.iocoder.yudao.module.base.mapper.DlDriveSchoolStudentMapper; import cn.iocoder.yudao.module.base.mapper.DlDriveSchoolStudentMapper;
import cn.iocoder.yudao.module.base.service.DlDriveSchoolStudentService; import cn.iocoder.yudao.module.base.service.DlDriveSchoolStudentService;
@ -14,13 +16,16 @@ import cn.iocoder.yudao.module.course.service.ProcessService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -42,7 +47,7 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
// 插入 // 插入
DlDriveSchoolStudent dlDriveSchoolStudent = BeanUtils.toBean(createReqVO, DlDriveSchoolStudent.class); DlDriveSchoolStudent dlDriveSchoolStudent = BeanUtils.toBean(createReqVO, DlDriveSchoolStudent.class);
DlDriveSchoolStudent studentByIdCard = this.getStudentByIdCard(dlDriveSchoolStudent.getIdCard()); DlDriveSchoolStudent studentByIdCard = this.getStudentByIdCard(dlDriveSchoolStudent.getIdCard());
if(studentByIdCard == null){ if (studentByIdCard == null) {
dlDriveSchoolStudentMapper.insert(dlDriveSchoolStudent); dlDriveSchoolStudentMapper.insert(dlDriveSchoolStudent);
return dlDriveSchoolStudent.getId(); return dlDriveSchoolStudent.getId();
} }
@ -73,7 +78,7 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
public DlDriveSchoolStudentVO queryStudentById(String id) { public DlDriveSchoolStudentVO queryStudentById(String id) {
//学员基本信息 //学员基本信息
DlDriveSchoolStudent student = getById(id); DlDriveSchoolStudent student = getById(id);
DlDriveSchoolStudentVO result = BeanUtils.toBean(student,DlDriveSchoolStudentVO.class); DlDriveSchoolStudentVO result = BeanUtils.toBean(student, DlDriveSchoolStudentVO.class);
return result; return result;
} }
@ -91,7 +96,6 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
} }
@Override @Override
public DlDriveSchoolStudent getDlDriveSchoolStudent(String id) { public DlDriveSchoolStudent getDlDriveSchoolStudent(String id) {
return dlDriveSchoolStudentMapper.selectById(id); return dlDriveSchoolStudentMapper.selectById(id);
@ -108,10 +112,10 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
@Override @Override
public DlDriveSchoolStudent getStudentByUserId(Long userId) { public DlDriveSchoolStudent getStudentByUserId(Long userId) {
LambdaQueryWrapper<DlDriveSchoolStudent> queryWrapper = new LambdaQueryWrapper<DlDriveSchoolStudent>() LambdaQueryWrapper<DlDriveSchoolStudent> queryWrapper = new LambdaQueryWrapper<DlDriveSchoolStudent>()
.eq(DlDriveSchoolStudent::getUserId,userId) .eq(DlDriveSchoolStudent::getUserId, userId)
.orderByDesc(BaseDO::getCreateTime); .orderByDesc(BaseDO::getCreateTime);
List<DlDriveSchoolStudent> list = this.list(queryWrapper); List<DlDriveSchoolStudent> list = this.list(queryWrapper);
return list.isEmpty()?null:list.get(0); return list.isEmpty() ? null : list.get(0);
} }
/** /**
@ -125,7 +129,7 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
**/ **/
@Override @Override
public IPage<DlDriveSchoolStudentVO> queryListPage(DlDriveSchoolStudentVO pageReqVO, Page<DlDriveSchoolStudentVO> page) { public IPage<DlDriveSchoolStudentVO> queryListPage(DlDriveSchoolStudentVO pageReqVO, Page<DlDriveSchoolStudentVO> page) {
return dlDriveSchoolStudentMapper.queryListPage(pageReqVO,page); return dlDriveSchoolStudentMapper.queryListPage(pageReqVO, page);
} }
/** /**
@ -138,10 +142,10 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
* @date 23:16 2025/1/20 * @date 23:16 2025/1/20
**/ **/
@Override @Override
public List<DlDriveSchoolStudent> getCanExamStudentList(String courseId, Integer subject,String userName) { public List<DlDriveSchoolStudent> getCanExamStudentList(String courseId, Integer subject, String userName) {
//教练ID //教练ID
Long userId = SecurityFrameworkUtils.getLoginUserId(); Long userId = SecurityFrameworkUtils.getLoginUserId();
return dlDriveSchoolStudentMapper.selectCanExamStudentList(courseId,userId,subject,userName); return dlDriveSchoolStudentMapper.selectCanExamStudentList(courseId, userId, subject, userName);
} }
/** /**
@ -155,7 +159,7 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
**/ **/
@Override @Override
public IPage<DlDriveSchoolStaffVO> pageStaffStudent(DlDriveSchoolStaffVO staffVO, Page<DlDriveSchoolStaffVO> page) { public IPage<DlDriveSchoolStaffVO> pageStaffStudent(DlDriveSchoolStaffVO staffVO, Page<DlDriveSchoolStaffVO> page) {
return dlDriveSchoolStudentMapper.pageStaffStudent(staffVO,page); return dlDriveSchoolStudentMapper.pageStaffStudent(staffVO, page);
} }
/** /**
@ -172,28 +176,28 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
//默认查全部数据 //默认查全部数据
String startTimeStr = ""; String startTimeStr = "";
String endTimeStr = ""; String endTimeStr = "";
if("more".equals(pageReqVO.getTimeType())){ if ("more".equals(pageReqVO.getTimeType())) {
if(StringUtils.isNotEmpty(pageReqVO.getStartTime())){ if (StringUtils.isNotEmpty(pageReqVO.getStartTime())) {
startTimeStr = pageReqVO.getStartTime()+" 00:00:01"; startTimeStr = pageReqVO.getStartTime() + " 00:00:01";
} }
if(StringUtils.isNotEmpty(pageReqVO.getEndTime())) { if (StringUtils.isNotEmpty(pageReqVO.getEndTime())) {
endTimeStr = pageReqVO.getEndTime() + " 23:59:59"; endTimeStr = pageReqVO.getEndTime() + " 23:59:59";
} }
}else if("month".equals(pageReqVO.getTimeType())){ } else if ("month".equals(pageReqVO.getTimeType())) {
//当月 //当月
startTimeStr = DateUtil.format(DateUtil.beginOfMonth(DateUtil.date()),"yyyy-MM-dd")+" 00:00:01"; startTimeStr = DateUtil.format(DateUtil.beginOfMonth(DateUtil.date()), "yyyy-MM-dd") + " 00:00:01";
endTimeStr = DateUtil.format(DateUtil.endOfMonth(DateUtil.date()),"yyyy-MM-dd")+" 23:59:59"; endTimeStr = DateUtil.format(DateUtil.endOfMonth(DateUtil.date()), "yyyy-MM-dd") + " 23:59:59";
}else if("day".equals(pageReqVO.getTimeType())){ } else if ("day".equals(pageReqVO.getTimeType())) {
//当天 //当天
startTimeStr = DateUtil.formatDate(DateUtil.date())+" 00:00:01"; startTimeStr = DateUtil.formatDate(DateUtil.date()) + " 00:00:01";
endTimeStr = DateUtil.formatDate(DateUtil.date())+" 23:59:59"; endTimeStr = DateUtil.formatDate(DateUtil.date()) + " 23:59:59";
} }
pageReqVO.setStartTime(startTimeStr); pageReqVO.setStartTime(startTimeStr);
pageReqVO.setStartTime(endTimeStr); pageReqVO.setStartTime(endTimeStr);
IPage<DlDriveSchoolStudentVO> pageResult = dlDriveSchoolStudentMapper.selectByCoachId(pageReqVO,page); IPage<DlDriveSchoolStudentVO> pageResult = dlDriveSchoolStudentMapper.selectByCoachId(pageReqVO, page);
pageResult.getRecords().forEach(item->{ pageResult.getRecords().forEach(item -> {
//查每个学生的当前所处的科目 //查每个学生的当前所处的科目
item.setProcess(processService.selectByUserId(item.getUserId(),item.getCoachId())); item.setProcess(processService.selectByUserId(item.getUserId(), item.getCoachId()));
}); });
return pageResult; return pageResult;
} }
@ -209,16 +213,17 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
**/ **/
@Override @Override
public List<StudentCountVO> indexGetTrainList(String type, Long coachId, String startTime, String endTime) { public List<StudentCountVO> indexGetTrainList(String type, Long coachId, String startTime, String endTime) {
if("03".equals(type)){ if ("03".equals(type)) {
//自来的学生 //自来的学生
return dlDriveSchoolStudentMapper.indexCusStudentList(startTime,endTime); return dlDriveSchoolStudentMapper.indexCusStudentList(startTime, endTime);
}else{ } else {
return dlDriveSchoolStudentMapper.indexGetTrainList(type,coachId,startTime,endTime); return dlDriveSchoolStudentMapper.indexGetTrainList(type, coachId, startTime, endTime);
} }
} }
/** /**
* 查自来客户 * 查自来客户
*
* @param startTimeStr 查询时间范围--开始 * @param startTimeStr 查询时间范围--开始
* @param endTimeStr 查询时间范围--结束 * @param endTimeStr 查询时间范围--结束
* @return cn.iocoder.yudao.module.base.vo.DlDriveSchoolStaffVO * @return cn.iocoder.yudao.module.base.vo.DlDriveSchoolStaffVO
@ -227,7 +232,31 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
**/ **/
@Override @Override
public List<DlDriveSchoolStaffVO> indexGetFormList(String startTimeStr, String endTimeStr) { public List<DlDriveSchoolStaffVO> indexGetFormList(String startTimeStr, String endTimeStr) {
return dlDriveSchoolStudentMapper.indexGetFormList(startTimeStr,endTimeStr); return dlDriveSchoolStudentMapper.indexGetFormList(startTimeStr, endTimeStr);
}
/**
* 更新学员拿证时间
*
* @param passTime 拿证日期
* @param userId 学员id
* @param tenantId 租户id
*/
@TenantIgnore
@Override
public Boolean updateStudentPassAndGradTime(Date passTime, Long userId, String tenantId) {
if (ObjectUtils.isEmpty(passTime) || ObjectUtils.isEmpty(userId) || ObjectUtils.isEmpty(tenantId)) {
return false;
}
// 更新学员拿证时间
update(Wrappers.lambdaUpdate(DlDriveSchoolStudent.class)
.eq(DlDriveSchoolStudent::getUserId, userId)
.eq(DlDriveSchoolStudent::getTenantId, tenantId)
.set(DlDriveSchoolStudent::getPassTime, passTime)
.eq(DlDriveSchoolStudent::getDeleted, SchoolBaseConstants.COMMON_NO)
.set(DlDriveSchoolStudent::getGradTime, new Date()));
return true;
} }

View File

@ -52,6 +52,13 @@
<if test="entity.courseName != null and entity.courseName != '' "> and dsp.name like concat('%', #{entity.courseName}, '%')</if> <if test="entity.courseName != null and entity.courseName != '' "> and dsp.name like concat('%', #{entity.courseName}, '%')</if>
<if test="entity.userId != null "> and dsp.user_id = #{entity.userId}</if> <if test="entity.userId != null "> and dsp.user_id = #{entity.userId}</if>
</where> </where>
order by dsp.create_time desc ORDER BY
(CASE
WHEN exam_status = '1' AND finance_pass IS NULL THEN 1 -- 优先级最高
WHEN exam_status = '9' THEN 2
WHEN status = '1' THEN 2
ELSE 4
END),
create_time DESC; -- 再按创建时间降序
</select> </select>
</mapper> </mapper>