|
|
|
@ -3,28 +3,45 @@ package com.sztzjy.trade.service.impl;/**
|
|
|
|
|
* @date 2024-08-08 9:24
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import com.sztzjy.trade.entity.TeacherOpenCourseStudentSigninSetting;
|
|
|
|
|
import com.sztzjy.trade.entity.dto.TeacherOpenCourseStudentSigninSettingDTO;
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.sztzjy.trade.config.Constant;
|
|
|
|
|
import com.sztzjy.trade.entity.*;
|
|
|
|
|
import com.sztzjy.trade.entity.dto.*;
|
|
|
|
|
import com.sztzjy.trade.enums.StartStatusEnum;
|
|
|
|
|
import com.sztzjy.trade.mapper.StuUserMapper;
|
|
|
|
|
import com.sztzjy.trade.mapper.TeacherOpenCourseStudentSigninLogMapper;
|
|
|
|
|
import com.sztzjy.trade.mapper.TeacherOpenCourseStudentSigninSettingMapper;
|
|
|
|
|
import com.sztzjy.trade.service.TeacherOpenCourseStudentSigninService;
|
|
|
|
|
import com.sztzjy.trade.util.ResultEntity;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
public class TeacherOpenCourseStudentSigninServiceImpl implements TeacherOpenCourseStudentSigninService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherOpenCourseStudentSigninSettingMapper teacherOpenCourseStudentSigninSettingMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private StuUserMapper stuUserMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherOpenCourseStudentSigninLogMapper teacherOpenCourseStudentSigninLogMapper;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ResultEntity addDo(TeacherOpenCourseStudentSigninSettingDTO teacherOpenCourseStudentSigninSettingDTO) {
|
|
|
|
|
|
|
|
|
|
TeacherOpenCourseStudentSigninSetting teacherOpenCourseStudentSigninSetting = teacherOpenCourseStudentSigninSettingDTO.pojo();
|
|
|
|
|
teacherOpenCourseStudentSigninSetting.setTeacherOpenCourseStudentSigninSettingAddTime(new Date());
|
|
|
|
|
|
|
|
|
|
// 默认是未开始的状态
|
|
|
|
|
teacherOpenCourseStudentSigninSetting.setTeacherOpenCourseStudentSigninSettingStartStatus(String.valueOf(StartStatusEnum.READY));
|
|
|
|
|
//获取现在时间 只保留到分钟
|
|
|
|
@ -33,12 +50,353 @@ public class TeacherOpenCourseStudentSigninServiceImpl implements TeacherOpenCou
|
|
|
|
|
String nowTime = dateFormat.format(now);
|
|
|
|
|
try {
|
|
|
|
|
now = dateFormat.parse(nowTime);
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new RuntimeException("时间转换异常", e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
teacherOpenCourseStudentSigninSetting.setTeacherOpenCourseStudentSigninSettingSessionTime(now);
|
|
|
|
|
teacherOpenCourseStudentSigninSettingMapper.insertSelective(teacherOpenCourseStudentSigninSetting);
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK,"创建成功");
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "创建成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 教师端开始签到
|
|
|
|
|
*
|
|
|
|
|
* @param teacherOpenCourseStudentSigninSettingId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ResultEntity openStartState(Long teacherOpenCourseStudentSigninSettingId) {
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
//开始状态 teacher_open_course_student_signin_setting_start_status
|
|
|
|
|
// 签到开始日期 teacherOpenCourseStudentSigninSettingStartTime
|
|
|
|
|
|
|
|
|
|
TeacherOpenCourseStudentSigninSetting openCourseStudentSigninSetting = teacherOpenCourseStudentSigninSettingMapper.selectByPrimaryKey(teacherOpenCourseStudentSigninSettingId);
|
|
|
|
|
if (openCourseStudentSigninSetting == null) {
|
|
|
|
|
throw new RuntimeException("ID不存在!");
|
|
|
|
|
}
|
|
|
|
|
openCourseStudentSigninSetting.setTeacherOpenCourseStudentSigninSettingStartTime(new Date());
|
|
|
|
|
openCourseStudentSigninSetting.setTeacherOpenCourseStudentSigninSettingStartStatus(String.valueOf(StartStatusEnum.ING));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
teacherOpenCourseStudentSigninSettingMapper.updateByPrimaryKeySelective(openCourseStudentSigninSetting);
|
|
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 教师端结束签到
|
|
|
|
|
*
|
|
|
|
|
* @param tchEndSignDTO
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ResultEntity endSign(TchEndSignDTO tchEndSignDTO) {
|
|
|
|
|
|
|
|
|
|
//修改状态 添加结束时间
|
|
|
|
|
TeacherOpenCourseStudentSigninSetting openCourseStudentSigninSetting =
|
|
|
|
|
teacherOpenCourseStudentSigninSettingMapper.selectByPrimaryKey(tchEndSignDTO.getTeacherOpenCourseStudentSigninSettingId());
|
|
|
|
|
|
|
|
|
|
if (openCourseStudentSigninSetting == null) {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "不存在的ID");
|
|
|
|
|
}
|
|
|
|
|
openCourseStudentSigninSetting.setTeacherOpenCourseStudentSigninSettingStartStatus(String.valueOf(StartStatusEnum.END));
|
|
|
|
|
openCourseStudentSigninSetting.setTeacherOpenCourseStudentSigninSettingEndTime(new Date());
|
|
|
|
|
|
|
|
|
|
teacherOpenCourseStudentSigninSettingMapper.updateByPrimaryKeySelective(openCourseStudentSigninSetting);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 发起手动签到
|
|
|
|
|
*
|
|
|
|
|
* @param tchManualSignDTO
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ResultEntity manualSignByRandom(TchManualSignDTO tchManualSignDTO) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TchManualSignVo vo = new TchManualSignVo();
|
|
|
|
|
|
|
|
|
|
//签到表ID
|
|
|
|
|
vo.setTeacherOpenCourseStudentSigninSettingId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
|
|
|
|
|
// 定义要随机抽取的数量
|
|
|
|
|
int numberOfUsersToSelect = 6;
|
|
|
|
|
String[] split = tchManualSignDTO.getClassIds().split(".");
|
|
|
|
|
|
|
|
|
|
for (String classId : split) {
|
|
|
|
|
numberOfUsersToSelect += 2;
|
|
|
|
|
}
|
|
|
|
|
List<String> collect = Arrays.stream(split).collect(Collectors.toList());
|
|
|
|
|
//根据班级列表查询对应所有用户数据
|
|
|
|
|
StuUserExample stuUserExample = new StuUserExample();
|
|
|
|
|
stuUserExample.createCriteria().andClassIdIn(collect);
|
|
|
|
|
List<StuUser> stuUserList = stuUserMapper.selectByExample(stuUserExample);
|
|
|
|
|
if (stuUserList.isEmpty()) {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "暂无该班级");
|
|
|
|
|
}
|
|
|
|
|
// 使用 Collections.shuffle 随机打乱列表
|
|
|
|
|
Collections.shuffle(stuUserList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 检查列表大小是否大于等于要抽取的数量
|
|
|
|
|
if (stuUserList.size() < numberOfUsersToSelect) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 抽取指定数量的元素
|
|
|
|
|
List<StuUser> selectedUsers = stuUserList.subList(0, stuUserList.size());
|
|
|
|
|
vo.setUserList(selectedUsers);
|
|
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, vo);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
// 抽取指定数量的元素
|
|
|
|
|
List<StuUser> selectedUsers = stuUserList.subList(0, numberOfUsersToSelect);
|
|
|
|
|
vo.setUserList(selectedUsers);
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, vo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 手动签到确认
|
|
|
|
|
*
|
|
|
|
|
* @param tchManualSignDTO
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ResultEntity manualSignSure(TchManualSignDTO tchManualSignDTO) {
|
|
|
|
|
//查询是否为多次插入
|
|
|
|
|
TeacherOpenCourseStudentSigninSetting teacherOpenCourseStudentSigninSetting =
|
|
|
|
|
teacherOpenCourseStudentSigninSettingMapper.selectByPrimaryKey(tchManualSignDTO.getTeacherOpenCourseStudentSigninSettingId());
|
|
|
|
|
|
|
|
|
|
if (teacherOpenCourseStudentSigninSetting != null) {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请勿重复操作!");
|
|
|
|
|
} else {
|
|
|
|
|
//创建签到表
|
|
|
|
|
TeacherOpenCourseStudentSigninSetting openCourseStudentSigninSetting = new TeacherOpenCourseStudentSigninSetting();
|
|
|
|
|
openCourseStudentSigninSetting.setTeacherOpenCourseStudentSigninSettingSessionTime(tchManualSignDTO.getTeacherOpenCourseStudentSigninSettingSessionTime());
|
|
|
|
|
openCourseStudentSigninSetting.setTeacherOpenCourseStudentSigninSettingId(tchManualSignDTO.getTeacherOpenCourseStudentSigninSettingId());
|
|
|
|
|
openCourseStudentSigninSetting.setTeacherOpenCourseId(tchManualSignDTO.getTeacherOpenCourseId());
|
|
|
|
|
openCourseStudentSigninSetting.setSchoolClassIds(tchManualSignDTO.getClassIds());
|
|
|
|
|
openCourseStudentSigninSetting.setTeacherOpenCourseStudentSigninSettingAddTime((new Date()));
|
|
|
|
|
openCourseStudentSigninSetting.setTeacherOpenCourseStudentSigninSettingStatus(1);
|
|
|
|
|
openCourseStudentSigninSetting.setTeacherOpenCourseStudentSigninSettingStartStatus(String.valueOf(StartStatusEnum.END));
|
|
|
|
|
openCourseStudentSigninSetting.setTeacherOpenCourseStudentSigninSettingStartTime(tchManualSignDTO.getTeacherOpenCourseStudentSigninSettingSessionTime());
|
|
|
|
|
openCourseStudentSigninSetting.setTeacherOpenCourseStudentSigninSettingEndTime(new Date());
|
|
|
|
|
openCourseStudentSigninSetting.setTeacherOpenCourseStudentSigninSettingType(Constant.MANUAL);
|
|
|
|
|
openCourseStudentSigninSetting.setUserId(tchManualSignDTO.getUserId());
|
|
|
|
|
|
|
|
|
|
teacherOpenCourseStudentSigninSettingMapper.insertSelective(openCourseStudentSigninSetting);
|
|
|
|
|
|
|
|
|
|
//批量插入学生信息
|
|
|
|
|
|
|
|
|
|
System.out.println(tchManualSignDTO.getTchManualSignSettingDTOList().size());
|
|
|
|
|
tchManualSignDTO.getTchManualSignSettingDTOList().forEach(item -> {
|
|
|
|
|
|
|
|
|
|
//判断是否缺勤或者签到
|
|
|
|
|
TeacherOpenCourseStudentSigninLog studentSigninLog = TeacherOpenCourseStudentSigninLog.builder()
|
|
|
|
|
.teacherOpenCourseStudentSigninSettingId(tchManualSignDTO.getTeacherOpenCourseStudentSigninSettingId())
|
|
|
|
|
.teacherOpenCourseStudentSigninSettingSessionTime(tchManualSignDTO.getTeacherOpenCourseStudentSigninSettingSessionTime())
|
|
|
|
|
.studentId(item.getStudentId())
|
|
|
|
|
.teacherOpenCourseStudentSigninLogTag(item.getTeacherOpenCourseStudentSigninLogTag())
|
|
|
|
|
.teacherOpenCourseId(tchManualSignDTO.getTeacherOpenCourseId())
|
|
|
|
|
.schoolClassId(item.getSchoolClassId())
|
|
|
|
|
.teacherOpenCourseStudentSigninLogAddTime(item.getTeacherOpenCourseStudentSigninLogAddTime())
|
|
|
|
|
.teacherOpenCourseStudentSigninLogType(Constant.MANUAL)
|
|
|
|
|
.teacherOpenCourseStudentSigninLogRemark(item.getTeacherOpenCourseStudentSigninLogRemark())
|
|
|
|
|
.userId(item.getUserId()).build();
|
|
|
|
|
teacherOpenCourseStudentSigninLogMapper.insertSelective(studentSigninLog);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "操作成功!");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 课程内查询签到信息
|
|
|
|
|
@Override
|
|
|
|
|
public ResultEntity getSignInfoByTeacher(Long courseId, Long orgId, Integer page, Integer size) {
|
|
|
|
|
|
|
|
|
|
//查询签到次数,签到人数,缺勤人数 合计到课率
|
|
|
|
|
int sum = 0;
|
|
|
|
|
int signCount = 0;
|
|
|
|
|
int missStudent = 0;
|
|
|
|
|
double totalAttendRate = 0.0;
|
|
|
|
|
|
|
|
|
|
// 开启分页,确保分页在数据库查询之前
|
|
|
|
|
PageHelper.startPage(page, size);
|
|
|
|
|
//根据课程ID查询所有签到数据
|
|
|
|
|
TeacherOpenCourseStudentSigninSettingExample example = new TeacherOpenCourseStudentSigninSettingExample();
|
|
|
|
|
example.createCriteria().andOrgIdEqualTo(orgId).andTeacherOpenCourseIdEqualTo(courseId);
|
|
|
|
|
List<TeacherOpenCourseStudentSigninSetting> teacherOpenCourseStudentSigninSettingList = teacherOpenCourseStudentSigninSettingMapper.selectByExample(example);
|
|
|
|
|
|
|
|
|
|
// 包装分页后的结果
|
|
|
|
|
// PageInfo<TeacherOpenCourseStudentSigninSetting> pageInfo = new PageInfo<>(teacherOpenCourseStudentSigninSettingList);
|
|
|
|
|
|
|
|
|
|
if (teacherOpenCourseStudentSigninSettingList.isEmpty()) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TchSignInfoDTO tchSignInfoDTO = TchSignInfoDTO.builder().signCount(signCount).sum(sum).missStudent(missStudent).totalAttendRate(totalAttendRate)
|
|
|
|
|
.signinSettingList(null).build();
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, tchSignInfoDTO);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//合计老师开启签到次数
|
|
|
|
|
sum = teacherOpenCourseStudentSigninSettingList.size();
|
|
|
|
|
|
|
|
|
|
//存储记录表List
|
|
|
|
|
List<TeacherSigninSettingDTO> teacherSigninSettingDTOS = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
//合计签到人数
|
|
|
|
|
for (TeacherOpenCourseStudentSigninSetting openCourseStudentSigninSetting : teacherOpenCourseStudentSigninSettingList) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Integer countByClass = 0;
|
|
|
|
|
//班级总人数 根据班级idS查询
|
|
|
|
|
String[] split = openCourseStudentSigninSetting.getSchoolClassIds().split(",");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询每个班级人数
|
|
|
|
|
StuUserExample stuUserExample = new StuUserExample();
|
|
|
|
|
stuUserExample.createCriteria().andClassIdIn(Arrays.stream(split).collect(Collectors.toList()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//总人数
|
|
|
|
|
countByClass =+stuUserMapper.selectByExample(stuUserExample).size();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TeacherOpenCourseStudentSigninLogExample studentSigninLogExample = new TeacherOpenCourseStudentSigninLogExample();
|
|
|
|
|
|
|
|
|
|
studentSigninLogExample.createCriteria()
|
|
|
|
|
.andTeacherOpenCourseStudentSigninSettingIdEqualTo
|
|
|
|
|
(openCourseStudentSigninSetting.getTeacherOpenCourseStudentSigninSettingId());
|
|
|
|
|
|
|
|
|
|
List<TeacherOpenCourseStudentSigninLog> teacherOpenCourseStudentSigninLogList =
|
|
|
|
|
teacherOpenCourseStudentSigninLogMapper.selectByExample(studentSigninLogExample);
|
|
|
|
|
if (!teacherOpenCourseStudentSigninLogList.isEmpty()) {
|
|
|
|
|
|
|
|
|
|
//对手动签到做处理
|
|
|
|
|
if (Constant.MANUAL.equals(openCourseStudentSigninSetting.getTeacherOpenCourseStudentSigninSettingType()))
|
|
|
|
|
{
|
|
|
|
|
TeacherSigninSettingDTO teacherSigninSettingDTO = new TeacherSigninSettingDTO();
|
|
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(openCourseStudentSigninSetting, teacherSigninSettingDTO);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//缺勤签到人数
|
|
|
|
|
int missSizeManual = teacherOpenCourseStudentSigninLogList.stream()
|
|
|
|
|
.filter(item -> item.getTeacherOpenCourseStudentSigninLogType().equals(Constant.MANUAL))
|
|
|
|
|
.filter(item->item.getTeacherOpenCourseStudentSigninLogTag()==20)
|
|
|
|
|
.collect(Collectors.toList()).size();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 先转换为浮点数进行除法运算
|
|
|
|
|
double result = (double) missSizeManual / countByClass;
|
|
|
|
|
|
|
|
|
|
// 四舍五入保留两位小数
|
|
|
|
|
//总到课率
|
|
|
|
|
double roundedResult = Math.round(result * 100.0) / 100.0;
|
|
|
|
|
|
|
|
|
|
teacherSigninSettingDTO.setSum(countByClass);
|
|
|
|
|
teacherSigninSettingDTO.setSignCount(countByClass-missSizeManual);
|
|
|
|
|
teacherSigninSettingDTO.setMissStudent(missSizeManual);
|
|
|
|
|
teacherSigninSettingDTO.setTotalAttendRate(roundedResult);
|
|
|
|
|
|
|
|
|
|
teacherSigninSettingDTOS.add(teacherSigninSettingDTO);
|
|
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//签到人数
|
|
|
|
|
int size1 = teacherOpenCourseStudentSigninLogList.stream().filter(item -> item.getTeacherOpenCourseStudentSigninLogTag() == 10).collect(Collectors.toList()).size();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
signCount =+size1;
|
|
|
|
|
|
|
|
|
|
//缺勤人数
|
|
|
|
|
int info = teacherOpenCourseStudentSigninLogList.size() - size1;
|
|
|
|
|
|
|
|
|
|
missStudent =+info;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TeacherSigninSettingDTO teacherSigninSettingDTO = new TeacherSigninSettingDTO();
|
|
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(openCourseStudentSigninSetting, teacherSigninSettingDTO);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//当前签到总人数
|
|
|
|
|
teacherSigninSettingDTO.setSum(countByClass);
|
|
|
|
|
//当前签到缺勤人数
|
|
|
|
|
teacherSigninSettingDTO.setMissStudent(missStudent);
|
|
|
|
|
//当前签到签到人数
|
|
|
|
|
teacherSigninSettingDTO.setSignCount(size1);
|
|
|
|
|
|
|
|
|
|
// 先转换为浮点数进行除法运算
|
|
|
|
|
double result = (double) size1 / countByClass;
|
|
|
|
|
|
|
|
|
|
// 四舍五入保留两位小数
|
|
|
|
|
//总到课率
|
|
|
|
|
double roundedResult = Math.round(result * 100.0) / 100.0;
|
|
|
|
|
|
|
|
|
|
//合计到课率
|
|
|
|
|
totalAttendRate = +roundedResult;
|
|
|
|
|
|
|
|
|
|
teacherSigninSettingDTO.setTotalAttendRate(roundedResult);
|
|
|
|
|
|
|
|
|
|
teacherSigninSettingDTOS.add(teacherSigninSettingDTO);
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
//没人签到,未开始
|
|
|
|
|
TeacherSigninSettingDTO teacherSigninSettingDTO = new TeacherSigninSettingDTO();
|
|
|
|
|
BeanUtils.copyProperties(openCourseStudentSigninSetting, teacherSigninSettingDTO);
|
|
|
|
|
teacherSigninSettingDTO.setSum(0);
|
|
|
|
|
|
|
|
|
|
teacherSigninSettingDTO.setSignCount(0);
|
|
|
|
|
teacherSigninSettingDTO.setMissStudent(0);
|
|
|
|
|
teacherSigninSettingDTO.setTotalAttendRate(0.0);
|
|
|
|
|
|
|
|
|
|
teacherSigninSettingDTO.setSum(countByClass);
|
|
|
|
|
|
|
|
|
|
teacherSigninSettingDTOS.add(teacherSigninSettingDTO);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//开启分页
|
|
|
|
|
|
|
|
|
|
// 包装分页后的结果列表
|
|
|
|
|
PageInfo<TeacherSigninSettingDTO> teacherSigninSettingDTOPageInfo = new PageInfo<>(teacherSigninSettingDTOS);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TchSignInfoDTO tchSignInfoDTO = TchSignInfoDTO.builder().signCount(signCount).sum(sum).missStudent(missStudent).totalAttendRate(totalAttendRate)
|
|
|
|
|
.signinSettingList(teacherSigninSettingDTOPageInfo).build();
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, tchSignInfoDTO);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|