更新
This commit is contained in:
parent
f079998e79
commit
80549d2987
@ -74,4 +74,34 @@ public interface SchoolBaseConstants {
|
|||||||
* 驾校消息模板:分配教练通知
|
* 驾校消息模板:分配教练通知
|
||||||
*/
|
*/
|
||||||
public static final String SCHOOL_NOTIFY_MESSAGE_TEMPLATE_ASSIGN_COACH= "已为您分配教练,科目一教练:%s,科目二教练:%s,科目三教练:%s,科目四教练:%s";
|
public static final String SCHOOL_NOTIFY_MESSAGE_TEMPLATE_ASSIGN_COACH= "已为您分配教练,科目一教练:%s,科目二教练:%s,科目三教练:%s,科目四教练:%s";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 驾校消息模板:课程终止
|
||||||
|
*/
|
||||||
|
public static final String SCHOOL_NOTIFY_MESSAGE_TEMPLATE_COURSE_END= "您的课程%s已终止";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 驾校消息模板:学员预约训练
|
||||||
|
*/
|
||||||
|
public static final String SCHOOL_NOTIFY_MESSAGE_TEMPLATE_MEMBER_RESERVE_TRAIN= "学员%s预约了%s %s %s%s的训练";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 驾校消息模板:教练审核预约结果
|
||||||
|
*/
|
||||||
|
public static final String SCHOOL_NOTIFY_MESSAGE_TEMPLATE_COACH_RESERVE_RESULT= "您预约的%s %s %s%s的训练教练已%s";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 驾校消息模板:学员到场打卡发送消息
|
||||||
|
*/
|
||||||
|
public static final String SCHOOL_NOTIFY_MESSAGE_TEMPLATE_MEMBER_ATTENDANCE= "您在%s已到达%s打卡%s%s的训练";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 驾校消息模板:学员结束打卡发送消息
|
||||||
|
*/
|
||||||
|
public static final String SCHOOL_NOTIFY_MESSAGE_TEMPLATE_MEMBER_END_ATTENDANCE= "您在%s已结束%s%s的训练,本次训练时长%s分钟,累计训练时长%s分钟";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 驾校消息模板:学员拿出驾驶证祝福语
|
||||||
|
*/
|
||||||
|
public static final String SCHOOL_NOTIFY_MESSAGE_TEMPLATE_MEMBER_DRIVER_LICENSE= "恭喜您在%s已领取驾驶证,祝您驾得愉快";
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,8 @@ public interface DlDriveSchoolStudentService extends IService<DlDriveSchoolStude
|
|||||||
*
|
*
|
||||||
* @param passTime 拿证日期
|
* @param passTime 拿证日期
|
||||||
* @param userId 学员id
|
* @param userId 学员id
|
||||||
|
* @param courseId 课程id
|
||||||
* @param tenantId 租户id
|
* @param tenantId 租户id
|
||||||
*/
|
*/
|
||||||
Boolean updateStudentPassAndGradTime(Date passTime, Long userId, Long tenantId);
|
Boolean updateStudentPassAndGradTime(Date passTime, Long userId, String courseId, Long tenantId);
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ public interface SchoolNotifyMessageSendService {
|
|||||||
* @param userId 用户id
|
* @param userId 用户id
|
||||||
* @param message 消息内容
|
* @param message 消息内容
|
||||||
* @param type admin为管理员 member为会员
|
* @param type admin为管理员 member为会员
|
||||||
|
* @param tenantId 租户id
|
||||||
*/
|
*/
|
||||||
void sendMessage(Long userId, String message, String type);
|
void sendMessage(Long userId, String message, String type, Long tenantId);
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,13 @@ 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;
|
||||||
|
import cn.iocoder.yudao.module.base.service.SchoolNotifyMessageSendService;
|
||||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStaffVO;
|
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStaffVO;
|
||||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO;
|
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO;
|
||||||
import cn.iocoder.yudao.module.base.vo.StudentCountVO;
|
import cn.iocoder.yudao.module.base.vo.StudentCountVO;
|
||||||
|
import cn.iocoder.yudao.module.course.entity.SchoolCourseOrder;
|
||||||
import cn.iocoder.yudao.module.course.service.ProcessService;
|
import cn.iocoder.yudao.module.course.service.ProcessService;
|
||||||
|
import cn.iocoder.yudao.module.course.service.SchoolCourseOrderService;
|
||||||
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;
|
||||||
@ -22,6 +25,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import org.apache.commons.lang3.ObjectUtils;
|
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.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@ -42,6 +46,12 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
|
|||||||
@Resource
|
@Resource
|
||||||
private ProcessService processService;
|
private ProcessService processService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SchoolCourseOrderService schoolCourseOrderService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SchoolNotifyMessageSendService schoolNotifyMessageSendService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String createDlDriveSchoolStudent(DlDriveSchoolStudentVO createReqVO) {
|
public String createDlDriveSchoolStudent(DlDriveSchoolStudentVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
@ -240,21 +250,28 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
|
|||||||
*
|
*
|
||||||
* @param passTime 拿证日期
|
* @param passTime 拿证日期
|
||||||
* @param userId 学员id
|
* @param userId 学员id
|
||||||
|
* @param courseId 课程id
|
||||||
* @param tenantId 租户id
|
* @param tenantId 租户id
|
||||||
*/
|
*/
|
||||||
@TenantIgnore
|
@TenantIgnore
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateStudentPassAndGradTime(Date passTime, Long userId, Long tenantId) {
|
@Transactional
|
||||||
|
public Boolean updateStudentPassAndGradTime(Date passTime, Long userId,String courseId, Long tenantId) {
|
||||||
if (ObjectUtils.isEmpty(passTime) || ObjectUtils.isEmpty(userId) || ObjectUtils.isEmpty(tenantId)) {
|
if (ObjectUtils.isEmpty(passTime) || ObjectUtils.isEmpty(userId) || ObjectUtils.isEmpty(tenantId)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// 更新学员拿证时间
|
// 更新学员拿证时间
|
||||||
update(Wrappers.lambdaUpdate(DlDriveSchoolStudent.class)
|
schoolCourseOrderService.update(Wrappers.lambdaUpdate(SchoolCourseOrder.class)
|
||||||
.eq(DlDriveSchoolStudent::getUserId, userId)
|
.eq(SchoolCourseOrder::getUserId, userId)
|
||||||
.eq(DlDriveSchoolStudent::getTenantId, tenantId)
|
.eq(SchoolCourseOrder::getCourseId, courseId)
|
||||||
.set(DlDriveSchoolStudent::getPassTime, passTime)
|
.set(SchoolCourseOrder::getPassTime, passTime)
|
||||||
.eq(DlDriveSchoolStudent::getDeleted, SchoolBaseConstants.COMMON_NO)
|
.set(SchoolCourseOrder::getGradTime, new Date()));
|
||||||
.set(DlDriveSchoolStudent::getGradTime, new Date()));
|
|
||||||
|
// 消息准备
|
||||||
|
String message = String.format(SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TEMPLATE_MEMBER_DRIVER_LICENSE, DateUtil.format(passTime, "yyyy-MM-dd HH:mm:ss"));
|
||||||
|
|
||||||
|
// 发送消息
|
||||||
|
schoolNotifyMessageSendService.sendMessage(userId, message, SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TYPE_MEMBER, tenantId);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ public class SchoolNotifyMessageSendServiceImpl implements SchoolNotifyMessageSe
|
|||||||
* @param message 消息内容
|
* @param message 消息内容
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void sendMessage(Long userId, String message, String type) {
|
public void sendMessage(Long userId, String message, String type, Long tenantId) {
|
||||||
NotifySendSingleToUserReqDTO dto = new NotifySendSingleToUserReqDTO();
|
NotifySendSingleToUserReqDTO dto = new NotifySendSingleToUserReqDTO();
|
||||||
dto.setUserId(userId);
|
dto.setUserId(userId);
|
||||||
dto.setSystemCode(SystemEnum.SCHOOL.getCode());
|
dto.setSystemCode(SystemEnum.SCHOOL.getCode());
|
||||||
@ -48,9 +48,9 @@ public class SchoolNotifyMessageSendServiceImpl implements SchoolNotifyMessageSe
|
|||||||
|
|
||||||
// 发送消息
|
// 发送消息
|
||||||
if (SCHOOL_NOTIFY_MESSAGE_TYPE_ADMIN.equals(type)) {
|
if (SCHOOL_NOTIFY_MESSAGE_TYPE_ADMIN.equals(type)) {
|
||||||
sendApi.sendSingleMessageToAdmin(dto);
|
sendApi.sendSingleMessageToAdmin(dto, tenantId);
|
||||||
} else if (SCHOOL_NOTIFY_MESSAGE_TYPE_MEMBER.equals(type)) {
|
} else if (SCHOOL_NOTIFY_MESSAGE_TYPE_MEMBER.equals(type)) {
|
||||||
sendApi.sendSingleMessageToMember(dto);
|
sendApi.sendSingleMessageToMember(dto, tenantId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import lombok.*;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 驾照报名订单 DO
|
* 驾照报名订单 DO
|
||||||
@ -112,6 +113,14 @@ public class SchoolCourseOrder extends TenantBaseDO {
|
|||||||
* 旧订单id
|
* 旧订单id
|
||||||
*/
|
*/
|
||||||
private String oldOrderId;
|
private String oldOrderId;
|
||||||
|
/**
|
||||||
|
* 拿证时间
|
||||||
|
*/
|
||||||
|
private Date passTime;
|
||||||
|
/**
|
||||||
|
* 毕业时间
|
||||||
|
*/
|
||||||
|
private Date gradTime;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -332,7 +332,7 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
|||||||
processes.get(3).getCoachName());
|
processes.get(3).getCoachName());
|
||||||
|
|
||||||
// 发送消息给学员
|
// 发送消息给学员
|
||||||
schoolNotifyMessageSendService.sendMessage(userId, message, SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TYPE_MEMBER);
|
schoolNotifyMessageSendService.sendMessage(userId, message, SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TYPE_MEMBER, null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -363,7 +363,7 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
|||||||
.set(Process::getStatus, 2));
|
.set(Process::getStatus, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(process.getSubject() == 1 && process.getExamStatus().equals("1")){
|
if (process.getSubject() == 1 && process.getExamStatus().equals("1")) {
|
||||||
update(Wrappers.lambdaUpdate(Process.class)
|
update(Wrappers.lambdaUpdate(Process.class)
|
||||||
.eq(Process::getUserId, process.getUserId())
|
.eq(Process::getUserId, process.getUserId())
|
||||||
.eq(Process::getSubject, 2)
|
.eq(Process::getSubject, 2)
|
||||||
@ -371,8 +371,8 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
|||||||
.eq(Process::getDeleted, SchoolBaseConstants.COMMON_NO)
|
.eq(Process::getDeleted, SchoolBaseConstants.COMMON_NO)
|
||||||
.set(Process::getStatus, SchoolBaseConstants.PROCESS_STATUS_IN_PROGRESS));
|
.set(Process::getStatus, SchoolBaseConstants.PROCESS_STATUS_IN_PROGRESS));
|
||||||
}
|
}
|
||||||
if(process.getSubject() == 4 && process.getExamStatus().equals("1")){
|
if (process.getSubject() == 4 && process.getExamStatus().equals("1")) {
|
||||||
dlDriveSchoolStudentService.updateStudentPassAndGradTime(process.getExamTime(),process.getUserId(),process.getTenantId());
|
dlDriveSchoolStudentService.updateStudentPassAndGradTime(process.getExamTime(), process.getUserId(), process.getCourseId(), process.getTenantId());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -397,6 +397,7 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据userId查询考试列表
|
* 根据userId查询考试列表
|
||||||
|
*
|
||||||
* @param userId 用户id
|
* @param userId 用户id
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -416,6 +417,7 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据userId查询考试列表
|
* 根据userId查询考试列表
|
||||||
|
*
|
||||||
* @param userId 用户id
|
* @param userId 用户id
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.module.base.constant.SchoolBaseConstants;
|
import cn.iocoder.yudao.module.base.constant.SchoolBaseConstants;
|
||||||
|
import cn.iocoder.yudao.module.base.service.SchoolNotifyMessageSendService;
|
||||||
import cn.iocoder.yudao.module.course.entity.Process;
|
import cn.iocoder.yudao.module.course.entity.Process;
|
||||||
import cn.iocoder.yudao.module.course.entity.SchoolCourseOrder;
|
import cn.iocoder.yudao.module.course.entity.SchoolCourseOrder;
|
||||||
import cn.iocoder.yudao.module.course.mapper.SchoolCourseOrderMapper;
|
import cn.iocoder.yudao.module.course.mapper.SchoolCourseOrderMapper;
|
||||||
@ -15,6 +16,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
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.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -39,6 +41,9 @@ public class SchoolCourseOrderServiceImpl extends ServiceImpl<SchoolCourseOrderM
|
|||||||
@Resource
|
@Resource
|
||||||
private ProcessService processService;
|
private ProcessService processService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SchoolNotifyMessageSendService schoolNotifyMessageSendService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String createSchoolCourseOrder(SchoolCourseOrderVO createReqVO) {
|
public String createSchoolCourseOrder(SchoolCourseOrderVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
@ -79,7 +84,7 @@ public class SchoolCourseOrderServiceImpl extends ServiceImpl<SchoolCourseOrderM
|
|||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public IPage<SchoolCourseOrderVO> queryPage(Page<SchoolCommissionVO> page, SchoolCourseOrderVO pageReqVO) {
|
public IPage<SchoolCourseOrderVO> queryPage(Page<SchoolCommissionVO> page, SchoolCourseOrderVO pageReqVO) {
|
||||||
return schoolCourseOrderMapper.queryPage(pageReqVO,page);
|
return schoolCourseOrderMapper.queryPage(pageReqVO, page);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public IPage<SchoolCourseOrderVO> queryPageNew(Page<SchoolCommissionVO> page, SchoolCourseOrderVO pageReqVO) {
|
public IPage<SchoolCourseOrderVO> queryPageNew(Page<SchoolCommissionVO> page, SchoolCourseOrderVO pageReqVO) {
|
||||||
@ -110,11 +115,18 @@ public class SchoolCourseOrderServiceImpl extends ServiceImpl<SchoolCourseOrderM
|
|||||||
// 删除学员未开始和训练中的科目
|
// 删除学员未开始和训练中的科目
|
||||||
processService.remove(Wrappers.lambdaQuery(Process.class)
|
processService.remove(Wrappers.lambdaQuery(Process.class)
|
||||||
.eq(Process::getUserId, schoolCourseOrder.getUserId())
|
.eq(Process::getUserId, schoolCourseOrder.getUserId())
|
||||||
|
.eq(Process::getCourseId, schoolCourseOrder.getCourseId())
|
||||||
.and(q -> q.eq(Process::getStatus, SchoolBaseConstants.PROCESS_STATUS_NOT_START)
|
.and(q -> q.eq(Process::getStatus, SchoolBaseConstants.PROCESS_STATUS_NOT_START)
|
||||||
.or()
|
.or()
|
||||||
.eq(Process::getStatus, SchoolBaseConstants.PROCESS_STATUS_IN_PROGRESS))
|
.eq(Process::getStatus, SchoolBaseConstants.PROCESS_STATUS_IN_PROGRESS))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 准备消息内容
|
||||||
|
String message = String.format(SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TEMPLATE_COURSE_END, schoolCourseOrder.getCourseName());
|
||||||
|
|
||||||
|
// 发送消息给学员
|
||||||
|
schoolNotifyMessageSendService.sendMessage(Long.valueOf(schoolCourseOrder.getUserId()), message, SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TYPE_MEMBER, null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.train.controller.admin;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
|
import cn.iocoder.yudao.module.base.constant.SchoolBaseConstants;
|
||||||
|
import cn.iocoder.yudao.module.base.service.SchoolNotifyMessageSendService;
|
||||||
import cn.iocoder.yudao.module.train.entity.ReservationCourse;
|
import cn.iocoder.yudao.module.train.entity.ReservationCourse;
|
||||||
import cn.iocoder.yudao.module.train.service.ReservationCourseService;
|
import cn.iocoder.yudao.module.train.service.ReservationCourseService;
|
||||||
import cn.iocoder.yudao.module.train.vo.ReservationCourseVO;
|
import cn.iocoder.yudao.module.train.vo.ReservationCourseVO;
|
||||||
@ -18,6 +20,7 @@ import javax.annotation.Resource;
|
|||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
import static cn.iocoder.yudao.module.train.controller.app.AppReservationCourseController.getSubjectStr;
|
||||||
|
|
||||||
@Tag(name = "管理后台 - 预约练车")
|
@Tag(name = "管理后台 - 预约练车")
|
||||||
@RestController
|
@RestController
|
||||||
@ -28,28 +31,40 @@ public class ReservationCourseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private ReservationCourseService reservationCourseService;
|
private ReservationCourseService reservationCourseService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SchoolNotifyMessageSendService schoolNotifyMessageSendService;
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得预约练车分页")
|
@Operation(summary = "获得预约练车分页")
|
||||||
public CommonResult<IPage<?>> getPage(ReservationCourseVO pageReqVO,
|
public CommonResult<IPage<?>> getPage(ReservationCourseVO pageReqVO,
|
||||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||||
Page<ReservationCourseVO> page = new Page<>(pageNo,pageSize);
|
Page<ReservationCourseVO> page = new Page<>(pageNo, pageSize);
|
||||||
if("my".equals(pageReqVO.getSelectType())){
|
if ("my".equals(pageReqVO.getSelectType())) {
|
||||||
//查自己的
|
//查自己的
|
||||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||||
pageReqVO.setCoachId(userId);
|
pageReqVO.setCoachId(userId);
|
||||||
}
|
}
|
||||||
//查未取消的
|
//查未取消的
|
||||||
pageReqVO.setIfCancel(false);
|
pageReqVO.setIfCancel(false);
|
||||||
return success(reservationCourseService.queryListPage(pageReqVO,page));
|
return success(reservationCourseService.queryListPage(pageReqVO, page));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
@Operation(summary = "审核预约练车")
|
@Operation(summary = "审核预约练车")
|
||||||
public CommonResult<Boolean> updateReservationCourse(@Valid @RequestBody ReservationCourseVO updateReqVO) {
|
public CommonResult<Boolean> updateReservationCourse(@RequestBody ReservationCourseVO updateReqVO) {
|
||||||
reservationCourseService.updateById(updateReqVO);
|
reservationCourseService.updateById(updateReqVO);
|
||||||
|
|
||||||
|
//通过id查询预约记录
|
||||||
|
ReservationCourse createObj = reservationCourseService.getById(updateReqVO.getId());
|
||||||
|
|
||||||
|
// 准备内容
|
||||||
|
String message = String.format(SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TEMPLATE_COACH_RESERVE_RESULT, createObj.getReservDay(), createObj.getReservTime(), createObj.getCourseName(), getSubjectStr(createObj.getSubject()), reservatStatusStr(updateReqVO.getStatus()));
|
||||||
|
|
||||||
|
// 发送消息
|
||||||
|
schoolNotifyMessageSendService.sendMessage(createObj.getUserId(), message, SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TYPE_MEMBER, createObj.getTenantId());
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,11 +87,12 @@ public class ReservationCourseController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据学生userId查询学生信息及当天的预约记录
|
* 根据学生userId查询学生信息及当天的预约记录
|
||||||
* @author vinjor-M
|
*
|
||||||
* @date 17:25 2025/1/16
|
|
||||||
* @param userId 学生userId
|
* @param userId 学生userId
|
||||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<cn.iocoder.yudao.module.train.entity.ReservationCourse>
|
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<cn.iocoder.yudao.module.train.entity.ReservationCourse>
|
||||||
**/
|
* @author vinjor-M
|
||||||
|
* @date 17:25 2025/1/16
|
||||||
|
**/
|
||||||
@GetMapping("/getUserInfoAndReservation")
|
@GetMapping("/getUserInfoAndReservation")
|
||||||
@Operation(summary = "根据学生userId查询学生信息及当天的预约记录")
|
@Operation(summary = "根据学生userId查询学生信息及当天的预约记录")
|
||||||
@Parameter(name = "id", description = "学生userId", required = true, example = "1024")
|
@Parameter(name = "id", description = "学生userId", required = true, example = "1024")
|
||||||
@ -84,7 +100,15 @@ public class ReservationCourseController {
|
|||||||
@RequestParam("courseId") String courseId,
|
@RequestParam("courseId") String courseId,
|
||||||
@RequestParam("type") String type,
|
@RequestParam("type") String type,
|
||||||
@RequestParam("subject") Integer subject) {
|
@RequestParam("subject") Integer subject) {
|
||||||
return success(reservationCourseService.getUserInfoAndReservation(userId,courseId,subject,type));
|
return success(reservationCourseService.getUserInfoAndReservation(userId, courseId, subject, type));
|
||||||
|
}
|
||||||
|
|
||||||
|
public String reservatStatusStr(Boolean status) {
|
||||||
|
if (!status) {
|
||||||
|
return "拒绝";
|
||||||
|
} else{
|
||||||
|
return "通过";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -2,6 +2,12 @@ package cn.iocoder.yudao.module.train.controller.app;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
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.service.DlDriveSchoolCoachService;
|
||||||
|
import cn.iocoder.yudao.module.base.service.SchoolNotifyMessageSendService;
|
||||||
|
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachRespVO;
|
||||||
|
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||||
import cn.iocoder.yudao.module.train.entity.ReservationCourse;
|
import cn.iocoder.yudao.module.train.entity.ReservationCourse;
|
||||||
import cn.iocoder.yudao.module.train.service.ReservationCourseService;
|
import cn.iocoder.yudao.module.train.service.ReservationCourseService;
|
||||||
import cn.iocoder.yudao.module.train.vo.ReservationCourseVO;
|
import cn.iocoder.yudao.module.train.vo.ReservationCourseVO;
|
||||||
@ -10,6 +16,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -26,22 +34,34 @@ public class AppReservationCourseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private ReservationCourseService reservationCourseService;
|
private ReservationCourseService reservationCourseService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SchoolNotifyMessageSendService schoolNotifyMessageSendService;
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得预约练车分页")
|
@Operation(summary = "获得预约练车分页")
|
||||||
|
@TenantIgnore
|
||||||
public CommonResult<IPage<?>> getPage(ReservationCourseVO pageReqVO,
|
public CommonResult<IPage<?>> getPage(ReservationCourseVO pageReqVO,
|
||||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||||
Page<ReservationCourseVO> page = new Page<>(pageNo,pageSize);
|
Page<ReservationCourseVO> page = new Page<>(pageNo, pageSize);
|
||||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||||
pageReqVO.setUserId(userId);
|
pageReqVO.setUserId(userId);
|
||||||
return success(reservationCourseService.queryListPage(pageReqVO,page));
|
return success(reservationCourseService.queryListPage(pageReqVO, page));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/create")
|
@PutMapping("/create")
|
||||||
@Operation(summary = "预约练车")
|
@Operation(summary = "预约练车")
|
||||||
public CommonResult<Boolean> createReservationCourse( @RequestBody ReservationCourse createObj) {
|
@TenantIgnore
|
||||||
|
@Transactional
|
||||||
|
public CommonResult<Boolean> createReservationCourse(@RequestBody @Validated ReservationCourse createObj) {
|
||||||
reservationCourseService.save(createObj);
|
reservationCourseService.save(createObj);
|
||||||
|
|
||||||
|
// 准备消息内容
|
||||||
|
String message = String.format(SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TEMPLATE_MEMBER_RESERVE_TRAIN, createObj.getUserName(), createObj.getReservDay(), createObj.getReservTime(), createObj.getCourseName(), getSubjectStr(createObj.getSubject()));
|
||||||
|
|
||||||
|
// 发送消息
|
||||||
|
schoolNotifyMessageSendService.sendMessage(createObj.getCoachId(), message, SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TYPE_ADMIN, createObj.getTenantId());
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,4 +91,26 @@ public class AppReservationCourseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取科目
|
||||||
|
*
|
||||||
|
* @param subject 科目
|
||||||
|
* @return 科目
|
||||||
|
*/
|
||||||
|
public static String getSubjectStr(Integer subject) {
|
||||||
|
switch (subject) {
|
||||||
|
case 1:
|
||||||
|
return "科目一";
|
||||||
|
case 2:
|
||||||
|
return "科目二";
|
||||||
|
case 3:
|
||||||
|
return "科目三";
|
||||||
|
case 4:
|
||||||
|
return "科目四";
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预约练车 DO
|
* 预约练车 DO
|
||||||
*
|
*
|
||||||
@ -51,10 +53,12 @@ public class ReservationCourse extends TenantBaseDO {
|
|||||||
/**
|
/**
|
||||||
* 预约日期 yyyy-MM-dd
|
* 预约日期 yyyy-MM-dd
|
||||||
*/
|
*/
|
||||||
|
@NotBlank(message = "预约日期不能为空")
|
||||||
private String reservDay;
|
private String reservDay;
|
||||||
/**
|
/**
|
||||||
* 时间段(字典:school_reserv_time)09:00-10:00
|
* 时间段(字典:school_reserv_time)09:00-10:00
|
||||||
*/
|
*/
|
||||||
|
@NotBlank(message = "预约时间不能为空")
|
||||||
private String reservTime;
|
private String reservTime;
|
||||||
/**
|
/**
|
||||||
* 科目(1-科目一;2-科目二;3科目三;4科目四)
|
* 科目(1-科目一;2-科目二;3科目三;4科目四)
|
||||||
|
@ -17,21 +17,23 @@ public interface ReservationCourseService extends IService<ReservationCourse> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询
|
* 分页查询
|
||||||
|
*
|
||||||
|
* @param pageReqVO TODO
|
||||||
|
* @param page TODO
|
||||||
|
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.train.vo.ReservationCourseVO>
|
||||||
* @author vinjor-M
|
* @author vinjor-M
|
||||||
* @date 15:05 2025/1/14
|
* @date 15:05 2025/1/14
|
||||||
* @param pageReqVO TODO
|
**/
|
||||||
* @param page TODO
|
|
||||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.train.vo.ReservationCourseVO>
|
|
||||||
**/
|
|
||||||
IPage<ReservationCourseVO> queryListPage(ReservationCourseVO pageReqVO, Page<ReservationCourseVO> page);
|
IPage<ReservationCourseVO> queryListPage(ReservationCourseVO pageReqVO, Page<ReservationCourseVO> page);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据学生userId查询学生信息及当天的预约记录
|
* 根据学生userId查询学生信息及当天的预约记录
|
||||||
|
*
|
||||||
|
* @param userId
|
||||||
|
* @return java.util.Map<java.lang.String, java.lang.Object>
|
||||||
* @author vinjor-M
|
* @author vinjor-M
|
||||||
* @date 17:27 2025/1/16
|
* @date 17:27 2025/1/16
|
||||||
* @param userId
|
**/
|
||||||
* @return java.util.Map<java.lang.String,java.lang.Object>
|
Map<String, Object> getUserInfoAndReservation(Long userId, String courseId, Integer subject, String type);
|
||||||
**/
|
|
||||||
Map<String,Object> getUserInfoAndReservation(Long userId,String courseId,Integer subject,String type);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.train.service.impl;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import cn.iocoder.yudao.module.base.constant.SchoolBaseConstants;
|
||||||
|
import cn.iocoder.yudao.module.base.service.SchoolNotifyMessageSendService;
|
||||||
import cn.iocoder.yudao.module.course.entity.Process;
|
import cn.iocoder.yudao.module.course.entity.Process;
|
||||||
import cn.iocoder.yudao.module.course.service.ProcessService;
|
import cn.iocoder.yudao.module.course.service.ProcessService;
|
||||||
import cn.iocoder.yudao.module.train.entity.Train;
|
import cn.iocoder.yudao.module.train.entity.Train;
|
||||||
@ -17,9 +19,12 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.module.train.controller.app.AppReservationCourseController.getSubjectStr;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预约练车 Service 实现类
|
* 预约练车 Service 实现类
|
||||||
@ -33,6 +38,8 @@ public class TrainServiceImpl extends ServiceImpl<TrainMapper, Train> implements
|
|||||||
@Autowired
|
@Autowired
|
||||||
@Lazy
|
@Lazy
|
||||||
private ProcessService processService;
|
private ProcessService processService;
|
||||||
|
@Resource
|
||||||
|
private SchoolNotifyMessageSendService schoolNotifyMessageSendService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询
|
* 分页查询
|
||||||
@ -72,6 +79,11 @@ public class TrainServiceImpl extends ServiceImpl<TrainMapper, Train> implements
|
|||||||
public void createObj(TrainVO trainVO) {
|
public void createObj(TrainVO trainVO) {
|
||||||
trainVO.setTrainDay(DateUtil.format(new Date(), "yyyy-MM-dd"));
|
trainVO.setTrainDay(DateUtil.format(new Date(), "yyyy-MM-dd"));
|
||||||
this.save(trainVO);
|
this.save(trainVO);
|
||||||
|
|
||||||
|
// 准备消息内容
|
||||||
|
String message = String.format(SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TEMPLATE_MEMBER_ATTENDANCE, DateUtil.format(trainVO.getStartTime(), "yyyy-MM-dd HH:mm:ss"), trainVO.getAddr(), trainVO.getCourseName(), getSubjectStr(trainVO.getSubject()));
|
||||||
|
|
||||||
|
schoolNotifyMessageSendService.sendMessage(trainVO.getUserId(), message, SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TYPE_MEMBER, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -92,6 +104,11 @@ public class TrainServiceImpl extends ServiceImpl<TrainMapper, Train> implements
|
|||||||
process.setId(trainVO.getProcessId());
|
process.setId(trainVO.getProcessId());
|
||||||
process.setTrainTime(allTrainTime);
|
process.setTrainTime(allTrainTime);
|
||||||
processService.updateById(process);
|
processService.updateById(process);
|
||||||
|
|
||||||
|
// 准备消息内容
|
||||||
|
String message = String.format(SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TEMPLATE_MEMBER_END_ATTENDANCE, DateUtil.format(trainVO.getEndTime(), "yyyy-MM-dd HH:mm:ss"), trainVO.getCourseName(), getSubjectStr(trainVO.getSubject()), trainVO.getTrainTime(), trainVO.getAllTrainTime());
|
||||||
|
|
||||||
|
schoolNotifyMessageSendService.sendMessage(trainVO.getUserId(), message, SchoolBaseConstants.SCHOOL_NOTIFY_MESSAGE_TYPE_MEMBER, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.train.vo;
|
package cn.iocoder.yudao.module.train.vo;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.train.entity.ReservationCourse;
|
import cn.iocoder.yudao.module.train.entity.ReservationCourse;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ -26,4 +27,16 @@ public class ReservationCourseVO extends ReservationCourse {
|
|||||||
* 用户性别-学员
|
* 用户性别-学员
|
||||||
*/
|
*/
|
||||||
private String userSex;
|
private String userSex;
|
||||||
|
/**
|
||||||
|
* 状态字符串
|
||||||
|
*/
|
||||||
|
private String statusStr;
|
||||||
|
/**
|
||||||
|
* 科目字符串
|
||||||
|
*/
|
||||||
|
private String subjectStr;
|
||||||
|
/**
|
||||||
|
* 课程类型
|
||||||
|
*/
|
||||||
|
private String courseType;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,19 @@
|
|||||||
|
|
||||||
<select id="queryListPage" resultType="cn.iocoder.yudao.module.train.vo.ReservationCourseVO">
|
<select id="queryListPage" resultType="cn.iocoder.yudao.module.train.vo.ReservationCourseVO">
|
||||||
SELECT
|
SELECT
|
||||||
dsrc.*,dsp.train_time,dss.name AS userName,dss.phone AS userMobile,dss.sex AS userSex
|
dsrc.*,dsp.train_time,dss.name AS userName,dss.phone AS userMobile,dss.sex AS userSex,dsc.type as courseType,
|
||||||
|
CASE dsrc.status
|
||||||
|
WHEN 0 THEN '已拒绝'
|
||||||
|
WHEN 1 THEN '已审核'
|
||||||
|
ELSE '待审核'
|
||||||
|
END AS statusStr,
|
||||||
|
CASE dsrc.subject
|
||||||
|
WHEN 1 THEN '科目一'
|
||||||
|
WHEN 2 THEN '科目二'
|
||||||
|
WHEN 3 THEN '科目三'
|
||||||
|
WHEN 4 THEN '科目四'
|
||||||
|
ELSE '未知'
|
||||||
|
END AS subjectStr
|
||||||
FROM
|
FROM
|
||||||
drive_school_reservation_course dsrc
|
drive_school_reservation_course dsrc
|
||||||
LEFT JOIN drive_school_process dsp ON dsrc.user_id = dsp.user_id
|
LEFT JOIN drive_school_process dsp ON dsrc.user_id = dsp.user_id
|
||||||
@ -15,6 +27,7 @@
|
|||||||
AND dsrc.`subject` = dsp.`subject`
|
AND dsrc.`subject` = dsp.`subject`
|
||||||
AND dsp.`status`='1'
|
AND dsp.`status`='1'
|
||||||
LEFT JOIN drive_school_student dss ON dsrc.user_id = dss.user_id
|
LEFT JOIN drive_school_student dss ON dsrc.user_id = dss.user_id
|
||||||
|
LEFT JOIN drive_school_course dsc ON dsrc.course_id = dsc.id
|
||||||
where
|
where
|
||||||
dsrc.deleted = 0
|
dsrc.deleted = 0
|
||||||
<if test="entity.userId != null and entity.userId != ''">
|
<if test="entity.userId != null and entity.userId != ''">
|
||||||
|
@ -27,4 +27,20 @@ public interface NotifyMessageSendApi {
|
|||||||
*/
|
*/
|
||||||
Long sendSingleMessageToMember(@Valid NotifySendSingleToUserReqDTO reqDTO);
|
Long sendSingleMessageToMember(@Valid NotifySendSingleToUserReqDTO reqDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送单条站内信给 Admin 用户
|
||||||
|
*
|
||||||
|
* @param reqDTO 发送请求
|
||||||
|
* @return 发送消息 ID
|
||||||
|
*/
|
||||||
|
Long sendSingleMessageToAdmin(@Valid NotifySendSingleToUserReqDTO reqDTO, Long tenantId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送单条站内信给 Member 用户
|
||||||
|
*
|
||||||
|
* @param reqDTO 发送请求
|
||||||
|
* @return 发送消息 ID
|
||||||
|
*/
|
||||||
|
Long sendSingleMessageToMember(@Valid NotifySendSingleToUserReqDTO reqDTO, Long tenantId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.system.api.notify;
|
package cn.iocoder.yudao.module.system.api.notify;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||||
import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
|
import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
|
||||||
import cn.iocoder.yudao.module.system.service.notify.NotifySendService;
|
import cn.iocoder.yudao.module.system.service.notify.NotifySendService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -20,13 +21,25 @@ public class NotifyMessageSendApiImpl implements NotifyMessageSendApi {
|
|||||||
@Override
|
@Override
|
||||||
public Long sendSingleMessageToAdmin(NotifySendSingleToUserReqDTO reqDTO) {
|
public Long sendSingleMessageToAdmin(NotifySendSingleToUserReqDTO reqDTO) {
|
||||||
return notifySendService.sendSingleNotifyToAdmin(reqDTO.getUserId(),
|
return notifySendService.sendSingleNotifyToAdmin(reqDTO.getUserId(),
|
||||||
reqDTO.getTemplateCode(), reqDTO.getTemplateParams(),reqDTO.getSystemCode());
|
reqDTO.getTemplateCode(), reqDTO.getTemplateParams(), reqDTO.getSystemCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long sendSingleMessageToMember(NotifySendSingleToUserReqDTO reqDTO) {
|
public Long sendSingleMessageToMember(NotifySendSingleToUserReqDTO reqDTO) {
|
||||||
return notifySendService.sendSingleNotifyToMember(reqDTO.getUserId(),
|
return notifySendService.sendSingleNotifyToMember(reqDTO.getUserId(),
|
||||||
reqDTO.getTemplateCode(), reqDTO.getTemplateParams(),reqDTO.getSystemCode());
|
reqDTO.getTemplateCode(), reqDTO.getTemplateParams(), reqDTO.getSystemCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long sendSingleMessageToAdmin(NotifySendSingleToUserReqDTO reqDTO, Long tenantId) {
|
||||||
|
return notifySendService.sendSingleNotify(reqDTO.getUserId(), UserTypeEnum.ADMIN.getValue(),
|
||||||
|
reqDTO.getTemplateCode(), reqDTO.getTemplateParams(), reqDTO.getSystemCode(), tenantId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long sendSingleMessageToMember(NotifySendSingleToUserReqDTO reqDTO, Long tenantId) {
|
||||||
|
return notifySendService.sendSingleNotify(reqDTO.getUserId(), UserTypeEnum.MEMBER.getValue(),
|
||||||
|
reqDTO.getTemplateCode(), reqDTO.getTemplateParams(), reqDTO.getSystemCode(), tenantId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.system.dal.dataobject.notify;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
@ -25,7 +26,7 @@ import java.util.Map;
|
|||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class NotifyMessageDO extends BaseDO {
|
public class NotifyMessageDO extends TenantBaseDO {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 站内信编号,自增
|
* 站内信编号,自增
|
||||||
|
@ -30,6 +30,20 @@ public interface NotifyMessageService {
|
|||||||
Long createNotifyMessage(Long userId, Integer userType,
|
Long createNotifyMessage(Long userId, Integer userType,
|
||||||
NotifyTemplateDO template, String templateContent, Map<String, Object> templateParams,String systemCode);
|
NotifyTemplateDO template, String templateContent, Map<String, Object> templateParams,String systemCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建站内信
|
||||||
|
*
|
||||||
|
* @param userId 用户编号
|
||||||
|
* @param userType 用户类型
|
||||||
|
* @param template 模版信息
|
||||||
|
* @param templateContent 模版内容
|
||||||
|
* @param templateParams 模版参数
|
||||||
|
* @param tenantId 租户id
|
||||||
|
* @return 站内信编号
|
||||||
|
*/
|
||||||
|
Long createNotifyMessage(Long userId, Integer userType,
|
||||||
|
NotifyTemplateDO template, String templateContent, Map<String, Object> templateParams,String systemCode, Long tenantId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得站内信分页
|
* 获得站内信分页
|
||||||
*
|
*
|
||||||
|
@ -29,7 +29,7 @@ public class NotifyMessageServiceImpl implements NotifyMessageService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createNotifyMessage(Long userId, Integer userType,
|
public Long createNotifyMessage(Long userId, Integer userType,
|
||||||
NotifyTemplateDO template, String templateContent, Map<String, Object> templateParams,String systemCode) {
|
NotifyTemplateDO template, String templateContent, Map<String, Object> templateParams, String systemCode) {
|
||||||
NotifyMessageDO message = new NotifyMessageDO().setUserId(userId).setUserType(userType)
|
NotifyMessageDO message = new NotifyMessageDO().setUserId(userId).setUserType(userType)
|
||||||
.setTemplateId(template.getId()).setTemplateCode(template.getCode())
|
.setTemplateId(template.getId()).setTemplateCode(template.getCode())
|
||||||
.setSystemCode(systemCode)
|
.setSystemCode(systemCode)
|
||||||
@ -39,6 +39,30 @@ public class NotifyMessageServiceImpl implements NotifyMessageService {
|
|||||||
return message.getId();
|
return message.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建站内信
|
||||||
|
*
|
||||||
|
* @param userId 用户编号
|
||||||
|
* @param userType 用户类型
|
||||||
|
* @param template 模版信息
|
||||||
|
* @param templateContent 模版内容
|
||||||
|
* @param templateParams 模版参数
|
||||||
|
* @param systemCode 系统编码
|
||||||
|
* @param tenantId 租户id
|
||||||
|
* @return 站内信编号
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Long createNotifyMessage(Long userId, Integer userType, NotifyTemplateDO template, String templateContent, Map<String, Object> templateParams, String systemCode, Long tenantId) {
|
||||||
|
NotifyMessageDO message = new NotifyMessageDO().setUserId(userId).setUserType(userType)
|
||||||
|
.setTemplateId(template.getId()).setTemplateCode(template.getCode())
|
||||||
|
.setSystemCode(systemCode)
|
||||||
|
.setTemplateType(template.getType()).setTemplateNickname(template.getNickname())
|
||||||
|
.setTemplateContent(templateContent).setTemplateParams(templateParams).setReadStatus(false);
|
||||||
|
message.setTenantId(tenantId);
|
||||||
|
notifyMessageMapper.insert(message);
|
||||||
|
return message.getId();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<NotifyMessageDO> getNotifyMessagePage(NotifyMessagePageReqVO pageReqVO) {
|
public PageResult<NotifyMessageDO> getNotifyMessagePage(NotifyMessagePageReqVO pageReqVO) {
|
||||||
return notifyMessageMapper.selectPage(pageReqVO);
|
return notifyMessageMapper.selectPage(pageReqVO);
|
||||||
@ -48,6 +72,7 @@ public class NotifyMessageServiceImpl implements NotifyMessageService {
|
|||||||
public PageResult<NotifyMessageDO> getMyMyNotifyMessagePage(NotifyMessageMyPageReqVO pageReqVO, Long userId, Integer userType) {
|
public PageResult<NotifyMessageDO> getMyMyNotifyMessagePage(NotifyMessageMyPageReqVO pageReqVO, Long userId, Integer userType) {
|
||||||
return notifyMessageMapper.selectPage(pageReqVO, userId, userType);
|
return notifyMessageMapper.selectPage(pageReqVO, userId, userType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@TenantIgnore
|
@TenantIgnore
|
||||||
public PageResult<NotifyMessageDO> getWxMyNotifyMessagePage(NotifyMessageMyPageReqVO pageReqVO, Long userId) {
|
public PageResult<NotifyMessageDO> getWxMyNotifyMessagePage(NotifyMessageMyPageReqVO pageReqVO, Long userId) {
|
||||||
@ -65,12 +90,13 @@ public class NotifyMessageServiceImpl implements NotifyMessageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getUnreadNotifyMessageCount(Long userId, Integer userType,String systemCode) {
|
public Long getUnreadNotifyMessageCount(Long userId, Integer userType, String systemCode) {
|
||||||
return notifyMessageMapper.selectUnreadCountByUserIdAndUserType(userId, userType,systemCode);
|
return notifyMessageMapper.selectUnreadCountByUserIdAndUserType(userId, userType, systemCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@TenantIgnore
|
@TenantIgnore
|
||||||
public Long getWXUnreadNotifyMessageCount(Long userId,String systemCode) {
|
public Long getWXUnreadNotifyMessageCount(Long userId, String systemCode) {
|
||||||
return notifyMessageMapper.selectUnreadCountByUserIdAndUserType(userId, 1, systemCode);
|
return notifyMessageMapper.selectUnreadCountByUserIdAndUserType(userId, 1, systemCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,6 +104,7 @@ public class NotifyMessageServiceImpl implements NotifyMessageService {
|
|||||||
public int updateNotifyMessageRead(Collection<Long> ids, Long userId, Integer userType) {
|
public int updateNotifyMessageRead(Collection<Long> ids, Long userId, Integer userType) {
|
||||||
return notifyMessageMapper.updateListRead(ids, userId, userType);
|
return notifyMessageMapper.updateListRead(ids, userId, userType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@TenantIgnore
|
@TenantIgnore
|
||||||
public int updateWXNotifyMessageRead(Collection<Long> ids, Long userId) {
|
public int updateWXNotifyMessageRead(Collection<Long> ids, Long userId) {
|
||||||
@ -88,6 +115,7 @@ public class NotifyMessageServiceImpl implements NotifyMessageService {
|
|||||||
public int updateAllNotifyMessageRead(Long userId, Integer userType) {
|
public int updateAllNotifyMessageRead(Long userId, Integer userType) {
|
||||||
return notifyMessageMapper.updateListRead(userId, userType);
|
return notifyMessageMapper.updateListRead(userId, userType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@TenantIgnore
|
@TenantIgnore
|
||||||
public int updateWXAllNotifyMessageRead(Long userId) {
|
public int updateWXAllNotifyMessageRead(Long userId) {
|
||||||
|
@ -47,6 +47,19 @@ public interface NotifySendService {
|
|||||||
Long sendSingleNotify( Long userId, Integer userType,
|
Long sendSingleNotify( Long userId, Integer userType,
|
||||||
String templateCode, Map<String, Object> templateParams,String systemCode);
|
String templateCode, Map<String, Object> templateParams,String systemCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送单条站内信给用户
|
||||||
|
*
|
||||||
|
* @param userId 用户编号
|
||||||
|
* @param userType 用户类型
|
||||||
|
* @param templateCode 站内信模板编号
|
||||||
|
* @param templateParams 站内信模板参数
|
||||||
|
* @param tenantId 租户id
|
||||||
|
* @return 发送日志编号
|
||||||
|
*/
|
||||||
|
Long sendSingleNotify( Long userId, Integer userType,
|
||||||
|
String templateCode, Map<String, Object> templateParams,String systemCode, Long tenantId);
|
||||||
|
|
||||||
default void sendBatchNotify(List<String> mobiles, List<Long> userIds, Integer userType,
|
default void sendBatchNotify(List<String> mobiles, List<Long> userIds, Integer userType,
|
||||||
String templateCode, Map<String, Object> templateParams) {
|
String templateCode, Map<String, Object> templateParams) {
|
||||||
throw new UnsupportedOperationException("暂时不支持该操作,感兴趣可以实现该功能哟!");
|
throw new UnsupportedOperationException("暂时不支持该操作,感兴趣可以实现该功能哟!");
|
||||||
|
@ -58,6 +58,33 @@ public class NotifySendServiceImpl implements NotifySendService {
|
|||||||
return notifyMessageService.createNotifyMessage(userId, userType, template, content, templateParams,systemCode);
|
return notifyMessageService.createNotifyMessage(userId, userType, template, content, templateParams,systemCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送单条站内信给用户
|
||||||
|
*
|
||||||
|
* @param userId 用户编号
|
||||||
|
* @param userType 用户类型
|
||||||
|
* @param templateCode 站内信模板编号
|
||||||
|
* @param templateParams 站内信模板参数
|
||||||
|
* @param systemCode
|
||||||
|
* @param tenantId 租户id
|
||||||
|
* @return 发送日志编号
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Long sendSingleNotify(Long userId, Integer userType, String templateCode, Map<String, Object> templateParams, String systemCode, Long tenantId) {
|
||||||
|
// 校验模版
|
||||||
|
NotifyTemplateDO template = validateNotifyTemplate(templateCode);
|
||||||
|
if (Objects.equals(template.getStatus(), CommonStatusEnum.DISABLE.getStatus())) {
|
||||||
|
log.info("[sendSingleNotify][模版({})已经关闭,无法给用户({}/{})发送]", templateCode, userId, userType);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// 校验参数
|
||||||
|
validateTemplateParams(template, templateParams);
|
||||||
|
|
||||||
|
// 发送站内信
|
||||||
|
String content = notifyTemplateService.formatNotifyTemplateContent(template.getContent(), templateParams);
|
||||||
|
return notifyMessageService.createNotifyMessage(userId, userType, template, content, templateParams,systemCode, tenantId);
|
||||||
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public NotifyTemplateDO validateNotifyTemplate(String templateCode) {
|
public NotifyTemplateDO validateNotifyTemplate(String templateCode) {
|
||||||
// 获得站内信模板。考虑到效率,从缓存中获取
|
// 获得站内信模板。考虑到效率,从缓存中获取
|
||||||
|
Loading…
Reference in New Issue
Block a user