Merge remote-tracking branch 'origin/driver' into driver
# Conflicts: # dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/service/ProcessService.java # dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/service/impl/ProcessServiceImpl.java # dl-module-jx/src/main/resources/mapper/course/SchoolCourseOrderMapper.xml
This commit is contained in:
commit
06c861bf0f
@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -30,8 +31,7 @@ public interface DlDriveSchoolStudentService extends IService<DlDriveSchoolStude
|
||||
* 根据身份证查询学员是否已存在
|
||||
*
|
||||
* @param idCard 身份证号
|
||||
* return boolean
|
||||
*
|
||||
* return boolean
|
||||
*/
|
||||
DlDriveSchoolStudent getStudentByIdCard(String idCard);
|
||||
|
||||
@ -122,24 +122,33 @@ public interface DlDriveSchoolStudentService extends IService<DlDriveSchoolStude
|
||||
IPage<DlDriveSchoolStudentVO> queryCoachListPage(DlDriveSchoolStudentVO pageReqVO, Page<DlDriveSchoolStudentVO> page);
|
||||
|
||||
/**
|
||||
*
|
||||
* @author PQZ
|
||||
* @date 17:08 2025/2/19
|
||||
* @param type 时间查询类型(01驾校统招,02教练自招,03自来客户)
|
||||
* @param coachId 教练id
|
||||
* @param startTime 查询时间范围--开始
|
||||
* @param endTime 查询时间范围--结束
|
||||
* @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);
|
||||
|
||||
/**
|
||||
*查自来客户
|
||||
* @author PQZ
|
||||
* @date 11:43 2025/2/20
|
||||
* 查自来客户
|
||||
*
|
||||
* @param startTimeStr 查询时间范围--开始
|
||||
* @param endTimeStr 查询时间范围--结束
|
||||
* @return cn.iocoder.yudao.module.base.vo.DlDriveSchoolStaffVO
|
||||
**/
|
||||
List<DlDriveSchoolStaffVO> indexGetFormList( String startTimeStr, String endTimeStr);
|
||||
* @author PQZ
|
||||
* @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);
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
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.mapper.DlDriveSchoolStudentMapper;
|
||||
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.QueryWrapper;
|
||||
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.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -42,7 +47,7 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
|
||||
// 插入
|
||||
DlDriveSchoolStudent dlDriveSchoolStudent = BeanUtils.toBean(createReqVO, DlDriveSchoolStudent.class);
|
||||
DlDriveSchoolStudent studentByIdCard = this.getStudentByIdCard(dlDriveSchoolStudent.getIdCard());
|
||||
if(studentByIdCard == null){
|
||||
if (studentByIdCard == null) {
|
||||
dlDriveSchoolStudentMapper.insert(dlDriveSchoolStudent);
|
||||
return dlDriveSchoolStudent.getId();
|
||||
}
|
||||
@ -73,7 +78,7 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
|
||||
public DlDriveSchoolStudentVO queryStudentById(String id) {
|
||||
//学员基本信息
|
||||
DlDriveSchoolStudent student = getById(id);
|
||||
DlDriveSchoolStudentVO result = BeanUtils.toBean(student,DlDriveSchoolStudentVO.class);
|
||||
DlDriveSchoolStudentVO result = BeanUtils.toBean(student, DlDriveSchoolStudentVO.class);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -91,7 +96,6 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public DlDriveSchoolStudent getDlDriveSchoolStudent(String id) {
|
||||
return dlDriveSchoolStudentMapper.selectById(id);
|
||||
@ -108,10 +112,10 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
|
||||
@Override
|
||||
public DlDriveSchoolStudent getStudentByUserId(Long userId) {
|
||||
LambdaQueryWrapper<DlDriveSchoolStudent> queryWrapper = new LambdaQueryWrapper<DlDriveSchoolStudent>()
|
||||
.eq(DlDriveSchoolStudent::getUserId,userId)
|
||||
.eq(DlDriveSchoolStudent::getUserId, userId)
|
||||
.orderByDesc(BaseDO::getCreateTime);
|
||||
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
|
||||
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
|
||||
**/
|
||||
@Override
|
||||
public List<DlDriveSchoolStudent> getCanExamStudentList(String courseId, Integer subject,String userName) {
|
||||
public List<DlDriveSchoolStudent> getCanExamStudentList(String courseId, Integer subject, String userName) {
|
||||
//教练ID
|
||||
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
|
||||
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 endTimeStr = "";
|
||||
if("more".equals(pageReqVO.getTimeType())){
|
||||
if(StringUtils.isNotEmpty(pageReqVO.getStartTime())){
|
||||
startTimeStr = pageReqVO.getStartTime()+" 00:00:01";
|
||||
if ("more".equals(pageReqVO.getTimeType())) {
|
||||
if (StringUtils.isNotEmpty(pageReqVO.getStartTime())) {
|
||||
startTimeStr = pageReqVO.getStartTime() + " 00:00:01";
|
||||
}
|
||||
if(StringUtils.isNotEmpty(pageReqVO.getEndTime())) {
|
||||
if (StringUtils.isNotEmpty(pageReqVO.getEndTime())) {
|
||||
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";
|
||||
endTimeStr = DateUtil.format(DateUtil.endOfMonth(DateUtil.date()),"yyyy-MM-dd")+" 23:59:59";
|
||||
}else if("day".equals(pageReqVO.getTimeType())){
|
||||
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";
|
||||
} else if ("day".equals(pageReqVO.getTimeType())) {
|
||||
//当天
|
||||
startTimeStr = DateUtil.formatDate(DateUtil.date())+" 00:00:01";
|
||||
endTimeStr = DateUtil.formatDate(DateUtil.date())+" 23:59:59";
|
||||
startTimeStr = DateUtil.formatDate(DateUtil.date()) + " 00:00:01";
|
||||
endTimeStr = DateUtil.formatDate(DateUtil.date()) + " 23:59:59";
|
||||
}
|
||||
pageReqVO.setStartTime(startTimeStr);
|
||||
pageReqVO.setStartTime(endTimeStr);
|
||||
IPage<DlDriveSchoolStudentVO> pageResult = dlDriveSchoolStudentMapper.selectByCoachId(pageReqVO,page);
|
||||
pageResult.getRecords().forEach(item->{
|
||||
IPage<DlDriveSchoolStudentVO> pageResult = dlDriveSchoolStudentMapper.selectByCoachId(pageReqVO, page);
|
||||
pageResult.getRecords().forEach(item -> {
|
||||
//查每个学生的当前所处的科目
|
||||
item.setProcess(processService.selectByUserId(item.getUserId(),item.getCoachId()));
|
||||
item.setProcess(processService.selectByUserId(item.getUserId(), item.getCoachId()));
|
||||
});
|
||||
return pageResult;
|
||||
}
|
||||
@ -209,16 +213,17 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
|
||||
**/
|
||||
@Override
|
||||
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);
|
||||
}else{
|
||||
return dlDriveSchoolStudentMapper.indexGetTrainList(type,coachId,startTime,endTime);
|
||||
return dlDriveSchoolStudentMapper.indexCusStudentList(startTime, endTime);
|
||||
} else {
|
||||
return dlDriveSchoolStudentMapper.indexGetTrainList(type, coachId, startTime, endTime);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查自来客户
|
||||
*
|
||||
* @param startTimeStr 查询时间范围--开始
|
||||
* @param endTimeStr 查询时间范围--结束
|
||||
* @return cn.iocoder.yudao.module.base.vo.DlDriveSchoolStaffVO
|
||||
@ -227,7 +232,31 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
|
||||
**/
|
||||
@Override
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -120,8 +120,24 @@ public class ProcessController {
|
||||
@PostMapping("/saveProcess")
|
||||
@Operation(summary = "保存学员课程进度")
|
||||
public CommonResult<Boolean> saveProcess(@RequestBody ProcessAddVO request) {
|
||||
// 订单id和科目集合不能为空
|
||||
if (request.getOrderId() == null || request.getProcessList() == null) {
|
||||
throw new RuntimeException("订单和科目不能为空");
|
||||
}
|
||||
processService.saveProcess(request);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过学员id和课程id查询学员课程进度
|
||||
*
|
||||
* @param userId 学员id
|
||||
* @param courseId 课程id
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.util.List < cn.iocoder.yudao.module.course.vo.ProcessVO>>
|
||||
*/
|
||||
@GetMapping("/getAllByUserIdAndCourseId")
|
||||
public CommonResult<?> getAllByUserIdAndCourseId(Long userId, String courseId) {
|
||||
return success(processService.getAllByUserIdAndCourseId(userId, courseId));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -95,4 +95,16 @@ public class SchoolCourseOrderController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 快速创建订单
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 订单号
|
||||
*/
|
||||
@PostMapping("/fastCreate")
|
||||
@Operation(summary = "快速创建驾照报名订单")
|
||||
public CommonResult<String> fastCreateSchoolCourseOrder(@Valid @RequestBody SchoolCourseOrderVO createReqVO) {
|
||||
return success(schoolCourseOrderService.fastCreateSchoolCourseOrder(createReqVO));
|
||||
}
|
||||
|
||||
}
|
@ -108,6 +108,10 @@ public class SchoolCourseOrder extends TenantBaseDO {
|
||||
* 是否分配教练 0:否 1:是
|
||||
*/
|
||||
private Integer ifAssignmentCoach;
|
||||
/**
|
||||
* 旧订单id
|
||||
*/
|
||||
private String oldOrderId;
|
||||
|
||||
|
||||
}
|
@ -103,7 +103,7 @@ public interface ProcessService extends IService<Process> {
|
||||
/**
|
||||
* 保存学员课程进度
|
||||
*
|
||||
* @param processes {@link Process}
|
||||
* @param request {@link Process}
|
||||
*/
|
||||
void saveProcess(ProcessAddVO request);
|
||||
|
||||
@ -111,4 +111,12 @@ public interface ProcessService extends IService<Process> {
|
||||
* 修改学院课程进度
|
||||
*/
|
||||
void updateProcess(Process process);
|
||||
|
||||
/**
|
||||
* 根据用户id和课程id查询所有进度
|
||||
* @param userId 用户id
|
||||
* @param courseId 课程id
|
||||
* @return java.util.List<cn.iocoder.yudao.module.course.vo.ProcessVO>
|
||||
*/
|
||||
List<ProcessVO> getAllByUserIdAndCourseId(Long userId, String courseId);
|
||||
}
|
||||
|
@ -63,9 +63,18 @@ public interface SchoolCourseOrderService extends IService<SchoolCourseOrder> {
|
||||
|
||||
/**
|
||||
* 终止订单
|
||||
* @param orderNo 订单号
|
||||
*
|
||||
* @param orderNo 订单号
|
||||
* @param endReason 终止原因
|
||||
* @param endTime 终止时间
|
||||
* @param endTime 终止时间
|
||||
*/
|
||||
void endOrder(String orderNo, String endReason, LocalDateTime endTime);
|
||||
|
||||
/**
|
||||
* 快速创建订单
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
String fastCreateSchoolCourseOrder(SchoolCourseOrderVO createReqVO);
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.course.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
@ -282,8 +283,27 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
||||
* @param request {@link ProcessAddVO}
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveProcess(ProcessAddVO request) {
|
||||
List<Process> processes = BeanUtil.copyToList(request.getProcessList(), Process.class);
|
||||
// 获取学生id和课程id
|
||||
String courseId = processes.get(0).getCourseId();
|
||||
Long userId = processes.get(0).getUserId();
|
||||
// 根据课程id和学生id查询进度
|
||||
List<Process> list = list(Wrappers.lambdaQuery(Process.class)
|
||||
.eq(Process::getCourseId, courseId)
|
||||
.eq(Process::getUserId, userId));
|
||||
|
||||
//判断传递进来的进度集合中的课程id和教练id和课程id是否与查询出来的一致,如果一致在processes集合中删除
|
||||
for (Process process : list) {
|
||||
processes.removeIf(process1 -> process.getCourseId().equals(process1.getCourseId())
|
||||
&& process.getCoachId().equals(process1.getCoachId())
|
||||
&& process.getSubject().equals(process1.getSubject()));
|
||||
}
|
||||
|
||||
if (CollUtil.isEmpty(processes)) {
|
||||
return;
|
||||
}
|
||||
// 校验详细信息
|
||||
verify(processes);
|
||||
// 保存信息
|
||||
@ -314,6 +334,24 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户id和课程id查询所有进度
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param courseId 课程id
|
||||
* @return java.util.List<cn.iocoder.yudao.module.course.vo.ProcessVO>
|
||||
*/
|
||||
@Override
|
||||
public List<ProcessVO> getAllByUserIdAndCourseId(Long userId, String courseId) {
|
||||
if (null != userId && null != courseId) {
|
||||
List<Process> processList = processMapper.selectList(Wrappers.lambdaQuery(Process.class)
|
||||
.eq(Process::getUserId, userId)
|
||||
.eq(Process::getCourseId, courseId));
|
||||
return BeanUtil.copyToList(processList, ProcessVO.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void verify(List<Process> processes) {
|
||||
for (Process process : processes) {
|
||||
// 校验状态
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.course.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.base.constant.SchoolBaseConstants;
|
||||
@ -20,6 +21,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* 驾照报名订单 Service 实现类
|
||||
@ -110,4 +112,53 @@ public class SchoolCourseOrderServiceImpl extends ServiceImpl<SchoolCourseOrderM
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 快速创建订单
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
@Override
|
||||
public String fastCreateSchoolCourseOrder(SchoolCourseOrderVO createReqVO) {
|
||||
// 根据订单id查询旧订单信息
|
||||
SchoolCourseOrder oldOrder = baseMapper.selectById(createReqVO.getId());
|
||||
|
||||
if (oldOrder == null) {
|
||||
throw new RuntimeException("订单不存在");
|
||||
}
|
||||
|
||||
//判断新订单课程与旧订单课程是否一致
|
||||
if (!oldOrder.getCourseId().equals(createReqVO.getCourseId())) {
|
||||
// 删除学习记录表中的课程记录
|
||||
processService.remove(Wrappers.lambdaQuery(Process.class)
|
||||
.eq(Process::getUserId, oldOrder.getUserId())
|
||||
.eq(Process::getCourseId, oldOrder.getCourseId()));
|
||||
}
|
||||
|
||||
SchoolCourseOrder schoolCourseOrder = BeanUtil.copyProperties(oldOrder, SchoolCourseOrder.class);
|
||||
schoolCourseOrder.setOldOrderId(oldOrder.getId());
|
||||
//生成订单号
|
||||
schoolCourseOrder.setOrderNo(generateOrderNumber());
|
||||
schoolCourseOrder.setCourseId(createReqVO.getCourseId());
|
||||
schoolCourseOrder.setCourseName(createReqVO.getCourseName());
|
||||
schoolCourseOrder.setCourseType(createReqVO.getCourseType());
|
||||
schoolCourseOrder.setCoachUserId(createReqVO.getCoachUserId());
|
||||
schoolCourseOrder.setCoachUserName(createReqVO.getCoachUserName());
|
||||
|
||||
schoolCourseOrder.setId(null);
|
||||
schoolCourseOrder.setCreateTime(null);
|
||||
schoolCourseOrder.setUpdateTime(null);
|
||||
schoolCourseOrder.setDeleted(SchoolBaseConstants.COMMON_NO);
|
||||
schoolCourseOrder.setIfAssignmentCoach(SchoolBaseConstants.SCHOOL_COURSE_ORDER_IS_ASSIGN_COACH);
|
||||
schoolCourseOrder.setIfEnd(SchoolBaseConstants.COMMON_NO);
|
||||
schoolCourseOrder.setEndReason(null);
|
||||
schoolCourseOrder.setEndTime(null);
|
||||
schoolCourseOrderMapper.insert(schoolCourseOrder);
|
||||
return null;
|
||||
}
|
||||
|
||||
public String generateOrderNumber() {
|
||||
return "ORDER" + UUID.randomUUID().toString().replace("-", "").substring(0, 10);
|
||||
}
|
||||
|
||||
}
|
@ -10,4 +10,5 @@ import lombok.Data;
|
||||
@ExcelIgnoreUnannotated
|
||||
public class SchoolCourseOrderVO extends SchoolCourseOrder {
|
||||
|
||||
private Boolean isCreated;
|
||||
}
|
@ -53,6 +53,13 @@
|
||||
<if test="entity.userId != null "> and dsp.user_id = #{entity.userId}</if>
|
||||
<if test="entity.courseId != null and entity.courseId != '' "> and dsp.course_id = #{entity.courseId}</if>
|
||||
</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>
|
||||
</mapper>
|
||||
|
@ -11,9 +11,16 @@
|
||||
|
||||
<select id="queryPage" resultType="cn.iocoder.yudao.module.course.vo.SchoolCourseOrderVO">
|
||||
SELECT
|
||||
main.*
|
||||
main.*,
|
||||
CASE
|
||||
WHEN EXISTS (SELECT 1
|
||||
FROM drive_school_course_order dsc
|
||||
WHERE dsc.old_order_id = main.id and dsc.deleted = 0 and main.deleted = 0)
|
||||
THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS isCreated
|
||||
FROM
|
||||
drive_school_course_order main
|
||||
drive_school_course_order main
|
||||
<where>
|
||||
main.deleted = 0
|
||||
<if test="entity.orderNo!= null and entity.orderNo != ''"> and main.order_no = #{entity.orderNo}</if>
|
||||
@ -21,7 +28,17 @@
|
||||
<if test="entity.userId != null and entity.userId != ''"> and main.user_id = #{entity.userId}</if>
|
||||
<if test="entity.paymentStatus != null and entity.paymentStatus != ''"> and main.payment_status = #{entity.paymentStatus}</if>
|
||||
<if test="entity.ifEnd != null and entity.ifEnd != ''"> and main.if_end = #{entity.ifEnd}</if>
|
||||
main.deleted = 0
|
||||
<if test="entity.orderNo!= null and entity.orderNo != ''">and main.order_no = #{entity.orderNo}</if>
|
||||
<if test="entity.userName != null and entity.userName != ''">and main.user_name like concat('%',
|
||||
#{entity.userName}, '%')
|
||||
</if>
|
||||
<if test="entity.userId != null and entity.userId != ''">and main.user_id = #{entity.userId}</if>
|
||||
<if test="entity.paymentStatus != null and entity.paymentStatus != ''">and main.payment_status =
|
||||
#{entity.paymentStatus}
|
||||
</if>
|
||||
</where>
|
||||
order by main.create_time desc
|
||||
</select>
|
||||
<select id="selectByCoachUserId" resultType="java.lang.Double">
|
||||
SELECT
|
||||
|
Loading…
Reference in New Issue
Block a user