|
|
|
@ -7,13 +7,19 @@ import cn.hutool.json.JSONUtil;
|
|
|
|
|
import cn.jlw.util.ToolUtils;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.ibeetl.admin.core.entity.CoreUser;
|
|
|
|
|
import com.ibeetl.admin.core.service.CoreBaseService;
|
|
|
|
|
import com.ibeetl.admin.core.util.PlatformException;
|
|
|
|
|
import com.ibeetl.admin.core.web.JsonResult;
|
|
|
|
|
import com.ibeetl.admin.core.web.JsonReturnCode;
|
|
|
|
|
import com.ibeetl.jlw.dao.StudentDao;
|
|
|
|
|
import com.ibeetl.jlw.dao.TeacherDao;
|
|
|
|
|
import com.ibeetl.jlw.dao.TeacherOpenCourseChatLogDao;
|
|
|
|
|
import com.ibeetl.jlw.entity.Student;
|
|
|
|
|
import com.ibeetl.jlw.entity.Teacher;
|
|
|
|
|
import com.ibeetl.jlw.entity.TeacherOpenCourseChatLog;
|
|
|
|
|
import com.ibeetl.jlw.entity.TeacherOpenCourseChatLogAnalysis;
|
|
|
|
|
import com.ibeetl.jlw.entity.dto.ChatLogUnReadNumDTO;
|
|
|
|
|
import com.ibeetl.jlw.entity.vo.TeacherOpenCourseChatLogGroupInfoVO;
|
|
|
|
|
import com.ibeetl.jlw.web.query.TeacherOpenCourseChatLogQuery;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
@ -23,12 +29,15 @@ import org.beetl.sql.core.engine.PageQuery;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
|
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUser;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 开课互动 Service
|
|
|
|
|
* 当分布式ID开启后请勿使用insert(*,true)
|
|
|
|
@ -40,6 +49,10 @@ import java.util.List;
|
|
|
|
|
public class TeacherOpenCourseChatLogService extends CoreBaseService<TeacherOpenCourseChatLog> implements DeleteResourcesBy{
|
|
|
|
|
|
|
|
|
|
@Autowired private TeacherOpenCourseChatLogDao teacherOpenCourseChatLogDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherDao teacherDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private StudentDao studentDao;
|
|
|
|
|
|
|
|
|
|
public PageQuery<TeacherOpenCourseChatLog>queryByCondition(PageQuery query){
|
|
|
|
|
PageQuery ret = teacherOpenCourseChatLogDao.queryByCondition(query);
|
|
|
|
@ -216,4 +229,28 @@ public class TeacherOpenCourseChatLogService extends CoreBaseService<TeacherOpen
|
|
|
|
|
public List<TeacherOpenCourseChatLogGroupInfoVO> groupInfo(@NotNull(message = "开课ID不能为空!") Long teacherOpenCourseId) {
|
|
|
|
|
return teacherOpenCourseChatLogDao.groupInfo(teacherOpenCourseId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据登录身份,互动获取未读数
|
|
|
|
|
* @param dto
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Integer getUnReadNum(@Validated ChatLogUnReadNumDTO dto) {
|
|
|
|
|
CoreUser user = getUser();
|
|
|
|
|
// 学生或者教师身份才能看到真正的数字
|
|
|
|
|
if (user != null && user.isTeacher()) {
|
|
|
|
|
Teacher teacher = teacherDao.getByUserId(user.getId());
|
|
|
|
|
if (teacher != null) {
|
|
|
|
|
dto.setTeacherId(teacher.getTeacherId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (user != null && user.isStudent()) {
|
|
|
|
|
Student student = studentDao.getByUserId(user.getId());
|
|
|
|
|
if (student != null) {
|
|
|
|
|
dto.setStudentId(student.getStudentId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return teacherOpenCourseChatLogDao.getUnReadNum(dto);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|