学生提问,教师提问模块的未读数

beetlsql3-dev
yaodan
parent b700af2526
commit 5a81d0319d

@ -62,4 +62,12 @@ public interface TeacherOpenCourseChatLogDao extends BaseMapper<TeacherOpenCours
* @return
*/
TeacherOpenCourseChatLogAnalysisVO chatLogAnalysis(TeacherOpenCourseChatLogAnalysisDTO dto);
Integer getTeacherAskUnReadCountByTeacher(ChatLogUnReadNumDTO dto);
Integer getTeacherAskUnReadCountByStudent(ChatLogUnReadNumDTO dto);
Integer getStudentAskUnReadCountByTeacher(ChatLogUnReadNumDTO dto);
Integer getStudentAskUnReadCountByStudent(ChatLogUnReadNumDTO dto);
}

@ -99,5 +99,11 @@ public class TeacherOpenCourseChatLog extends BaseEntity{
//用户ID
private Long userId ;
//学生阅读状态 1已读 0未读
private Integer studentReadStatus;
//教师阅读状态 1已读 0未读
private Integer teacherReadStatus;
}

@ -337,4 +337,64 @@ public class TeacherOpenCourseChatLogService extends CoreBaseService<TeacherOpen
public TeacherOpenCourseChatLogAnalysisVO chatLogAnalysis(TeacherOpenCourseChatLogAnalysisDTO dto) {
return teacherOpenCourseChatLogDao.chatLogAnalysis(dto);
}
/**
*
*
* @param dto dto
* @author zhouzhao
* @date 2023/05/06 02:13:50
* @desc 0 1
*/
public Integer getTeacherAskUnReadCount(ChatLogUnReadNumDTO dto) {
CoreUser user = getUser();
Integer count = 0;
// 学生或者教师身份才能看到真正的数字
if (user != null && user.isTeacher()) {
Teacher teacher = teacherDao.getByUserId(user.getId());
if (teacher != null) {
dto.setTeacherId(teacher.getTeacherId());
count = teacherOpenCourseChatLogDao.getTeacherAskUnReadCountByTeacher(dto);
}
}else if (user != null && user.isStudent()) {
Student student = studentDao.getByUserId(user.getId());
if (student != null) {
dto.setStudentId(student.getStudentId());
count = teacherOpenCourseChatLogDao.getTeacherAskUnReadCountByStudent(dto);
}
}
return count;
}
/**
*
*
* @param dto dto
* @author zhouzhao
* @date 2023/05/06 02:14:44
* @desc 0 1
*/
public Integer getStudentAskUnReadCount(ChatLogUnReadNumDTO dto) {
CoreUser user = getUser();
Integer count = 0;
// 学生或者教师身份才能看到真正的数字
if (user != null && user.isTeacher()) {
Teacher teacher = teacherDao.getByUserId(user.getId());
if (teacher != null) {
dto.setTeacherId(teacher.getTeacherId());
count = teacherOpenCourseChatLogDao.getStudentAskUnReadCountByTeacher(dto);
}
}else if (user != null && user.isStudent()) {
Student student = studentDao.getByUserId(user.getId());
if (student != null) {
dto.setStudentId(student.getStudentId());
count = teacherOpenCourseChatLogDao.getStudentAskUnReadCountByStudent(dto);
}
}
return count;
}
}

@ -134,14 +134,15 @@ public class TeacherOpenCourseChatLogController extends BaseController {
if (result.hasErrors()) {
return JsonResult.failMessage(result);
} else {
teacherOpenCourseChatLogQuery.setUserId(coreUser.getId());
teacherOpenCourseChatLogQuery.setOrgId(coreUser.getOrgId());
if (ObjectUtil.isNotEmpty(teacher)) {
teacherOpenCourseChatLogQuery.setTeacherId(teacher.getTeacherId());
teacherOpenCourseChatLogQuery.setStudentReadStatus(0);
}
if (ObjectUtil.isNotEmpty(student)) {
teacherOpenCourseChatLogQuery.setStudentId(student.getStudentId());
teacherOpenCourseChatLogQuery.setTeacherReadStatus(0);
}
return teacherOpenCourseChatLogService.add(teacherOpenCourseChatLogQuery);
}
@ -551,12 +552,11 @@ public class TeacherOpenCourseChatLogController extends BaseController {
*
*
* @param teacherOpenCourseId ID
* @param coreUser
* @return
*/
@SneakyThrows
@GetMapping(API + "/getUnReadNum.do")
public JsonResult getUnReadNum(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId, @SCoreUser CoreUser coreUser) {
public JsonResult getUnReadNum(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId) {
ChatLogUnReadNumDTO dto = new ChatLogUnReadNumDTO();
dto.setTeacherOpenCourseId(teacherOpenCourseId);
return JsonResult.success(teacherOpenCourseChatLogService.getUnReadNum(dto));
@ -574,4 +574,34 @@ public class TeacherOpenCourseChatLogController extends BaseController {
public JsonResult chatLogAnalysis(TeacherOpenCourseChatLogAnalysisDTO dto, @SCoreUser CoreUser coreUser) {
return JsonResult.success(teacherOpenCourseChatLogService.chatLogAnalysis(dto));
}
/**
*
*
* @param teacherOpenCourseId id
* @author zhouzhao
* @date 2023/05/06 02:05:07
*/
@GetMapping(API+"/getTeacherAskUnReadCount.do")
public JsonResult getTeacherAskUnReadCount(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId){
ChatLogUnReadNumDTO dto = new ChatLogUnReadNumDTO();
dto.setTeacherOpenCourseId(teacherOpenCourseId);
return JsonResult.success(teacherOpenCourseChatLogService.getTeacherAskUnReadCount(dto));
}
/**
*
*
* @param teacherOpenCourseId id
* @author zhouzhao
* @date 2023/05/06 02:05:07
*/
@GetMapping(API+"/getStudentAskUnReadCount.do")
public JsonResult getStudentAskUnReadCount(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId){
ChatLogUnReadNumDTO dto = new ChatLogUnReadNumDTO();
dto.setTeacherOpenCourseId(teacherOpenCourseId);
return JsonResult.success(teacherOpenCourseChatLogService.getStudentAskUnReadCount(dto));
}
}

@ -2,6 +2,7 @@ package com.ibeetl.jlw.web;
import cn.jlw.Interceptor.SCoreUser;
import cn.jlw.Interceptor.TStudent;
import cn.jlw.Interceptor.TTeacher;
import cn.jlw.validate.ValidateConfig;
import com.ibeetl.admin.core.annotation.Function;
import com.ibeetl.admin.core.entity.CoreUser;
@ -262,6 +263,16 @@ public class TeacherOpenCourseController{
}
@GetMapping(MODEL + "/getMyselfValues.json")
@Function("teacherOpenCourse.query")
@ResponseBody
public JsonResult<List<TeacherOpenCourse>> getMyselfValues(TeacherOpenCourseQuery param, @TTeacher Teacher teacher) {
param.setTeacherId(teacher.getTeacherId());
List<TeacherOpenCourse>list = teacherOpenCourseService.getValuesByQuery(param);
return JsonResult.success(list);
}
@PostMapping(MODEL + "/delete.json")
@Function("teacherOpenCourse.delete")
@ResponseBody

@ -82,6 +82,9 @@ public class TeacherOpenCourseChatLogQuery extends PageParam {
@Query(name = "回复状态 1 待回复 2已回复", display = false)
private Integer replyStatus;
private Integer teacherReadStatus;
private Integer studentReadStatus;
private String teacherOpenCourseChatLogIdPlural;
private String teacherOpenCourseChatLogParentIdPlural;
private String teacherOpenCourseIdPlural;
@ -198,6 +201,8 @@ public class TeacherOpenCourseChatLogQuery extends PageParam {
pojo.setChatLogSendType(ObjectUtil.defaultIfNull(this.getChatLogSendType(), normal));
pojo.setOrgId(this.getOrgId());
pojo.setUserId(this.getUserId());
pojo.setTeacherReadStatus(this.getTeacherReadStatus());
pojo.setStudentReadStatus(this.getStudentReadStatus());
return pojo;
}
@ -292,4 +297,20 @@ public class TeacherOpenCourseChatLogQuery extends PageParam {
public void setChatLogSendTypePlural(String chatLogSendTypePlural) {
this.chatLogSendTypePlural = chatLogSendTypePlural;
}
public Integer getTeacherReadStatus() {
return teacherReadStatus;
}
public void setTeacherReadStatus(Integer teacherReadStatus) {
this.teacherReadStatus = teacherReadStatus;
}
public Integer getStudentReadStatus() {
return studentReadStatus;
}
public void setStudentReadStatus(Integer studentReadStatus) {
this.studentReadStatus = studentReadStatus;
}
}

@ -132,6 +132,10 @@ queryByConditionQuery
@pageTag(){
t.*,
tc.class_name,
ifnull((select count(1) from teacher_open_course_chat_log a
where a.teacher_open_course_chat_log_status = 1
and a.teacher_open_course_chat_log_parent_id = t.teacher_open_course_chat_log_id
), 0) as comment_count,
@// 指定提问,随机提问类型,查询学生回答的数据。只查询一级
(case when find_in_set(t.chat_log_send_type, 'specify_ask,random_ask') then
(select chat_content
@ -686,4 +690,80 @@ chatLogAnalysis
@if(isNotEmpty(teacherOpenCourseId)) {
AND t.teacher_open_course_id = #teacherOpenCourseId#
@}
AND t.teacher_open_course_chat_log_status = 1
AND t.teacher_open_course_chat_log_status = 1
getTeacherAskUnReadCountByTeacher
===
* 获取老师提问模块未读数量,对于老师来说
SELECT IFNULL(sum(
(select count(*)
from teacher_open_course_chat_log t2
where t2.teacher_open_course_chat_log_parent_id = t.teacher_open_course_chat_log_id
and t2.teacher_read_status = 0)
),0)
FROM teacher_open_course_chat_log t
WHERE 1
AND t.teacher_open_course_id = #teacherOpenCourseId#
AND t.teacher_id = #teacherId#
AND t.chat_log_send_type in ('specify_ask', 'random_ask')
getTeacherAskUnReadCountByStudent
===
* 获取老师提问模块未读数量,对于学生来说
SELECT count(*)
FROM teacher_open_course_chat_log t
WHERE 1
AND t.teacher_open_course_id = #teacherOpenCourseId#
AND t.student_id = #studentId#
AND t.chat_log_send_type in ('specify_ask','random_ask')
@//这里的未读我们可以认为就是不存在回复
AND NOT EXISTS(
SELECT 1
FROM teacher_open_course_chat_log ta
WHERE 1
and t.student_id = #studentId#
AND t.teacher_open_course_id = #teacherOpenCourseId#
AND ta.teacher_open_course_chat_log_parent_id = t.teacher_open_course_chat_log_id
)
getStudentAskUnReadCountByTeacher
===
* 获取学生提问模块未读数量,对于老师来说
SELECT count(*)
FROM teacher_open_course_chat_log t
WHERE 1
AND t.teacher_open_course_id = #teacherOpenCourseId#
AND t.chat_log_send_type = 'student_ask'
AND NOT EXISTS(
SELECT 1
FROM teacher_open_course_chat_log ta
WHERE 1
and t.teacher_id = #teacherId#
AND t.teacher_open_course_id = #teacherOpenCourseId#
AND ta.teacher_open_course_chat_log_parent_id = t.teacher_open_course_chat_log_id
)
getStudentAskUnReadCountByStudent
===
* 获取学生提问模块未读数量,对于学生来说
SELECT IFNULL(sum(
(select count(*)
from teacher_open_course_chat_log t2
where t2.teacher_open_course_chat_log_parent_id = t.teacher_open_course_chat_log_id
and t2.teacher_read_status = 0)
),0)
FROM teacher_open_course_chat_log t
WHERE 1
AND t.student_id = #studentId#
AND t.teacher_open_course_id = #teacherOpenCourseId#
AND t.chat_log_send_type = 'student_ask'
Loading…
Cancel
Save