|
|
|
@ -1,11 +1,14 @@
|
|
|
|
|
package com.sztzjy.trade.service.impl;/**
|
|
|
|
|
package com.sztzjy.trade.service.impl;
|
|
|
|
|
/**
|
|
|
|
|
* @author 17803
|
|
|
|
|
* @date 2024-08-08 9:24
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.nimbusds.jose.util.IntegerUtils;
|
|
|
|
|
import com.sztzjy.trade.config.Constant;
|
|
|
|
|
import com.sztzjy.trade.entity.*;
|
|
|
|
|
import com.sztzjy.trade.entity.dto.*;
|
|
|
|
@ -247,7 +250,7 @@ public class TeacherOpenCourseStudentSigninServiceImpl implements TeacherOpenCou
|
|
|
|
|
List<TeacherOpenCourseStudentSigninSetting> teacherOpenCourseStudentSigninSettingList = teacherOpenCourseStudentSigninSettingMapper.selectByExample(example);
|
|
|
|
|
|
|
|
|
|
// 包装分页后的结果
|
|
|
|
|
// PageInfo<TeacherOpenCourseStudentSigninSetting> pageInfo = new PageInfo<>(teacherOpenCourseStudentSigninSettingList);
|
|
|
|
|
// PageInfo<TeacherOpenCourseStudentSigninSetting> pageInfo = new PageInfo<>(teacherOpenCourseStudentSigninSettingList);
|
|
|
|
|
|
|
|
|
|
if (teacherOpenCourseStudentSigninSettingList.isEmpty()) {
|
|
|
|
|
|
|
|
|
@ -280,7 +283,7 @@ public class TeacherOpenCourseStudentSigninServiceImpl implements TeacherOpenCou
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//总人数
|
|
|
|
|
countByClass =+stuUserMapper.selectByExample(stuUserExample).size();
|
|
|
|
|
countByClass = +stuUserMapper.selectByExample(stuUserExample).size();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TeacherOpenCourseStudentSigninLogExample studentSigninLogExample = new TeacherOpenCourseStudentSigninLogExample();
|
|
|
|
@ -294,21 +297,19 @@ public class TeacherOpenCourseStudentSigninServiceImpl implements TeacherOpenCou
|
|
|
|
|
if (!teacherOpenCourseStudentSigninLogList.isEmpty()) {
|
|
|
|
|
|
|
|
|
|
//对手动签到做处理
|
|
|
|
|
if (Constant.MANUAL.equals(openCourseStudentSigninSetting.getTeacherOpenCourseStudentSigninSettingType()))
|
|
|
|
|
{
|
|
|
|
|
if (Constant.MANUAL.equals(openCourseStudentSigninSetting.getTeacherOpenCourseStudentSigninSettingType())) {
|
|
|
|
|
TeacherSigninSettingDTO teacherSigninSettingDTO = new TeacherSigninSettingDTO();
|
|
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(openCourseStudentSigninSetting, teacherSigninSettingDTO);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//缺勤签到人数
|
|
|
|
|
int missSizeManual = teacherOpenCourseStudentSigninLogList.stream()
|
|
|
|
|
int missSizeManual = teacherOpenCourseStudentSigninLogList.stream()
|
|
|
|
|
.filter(item -> item.getTeacherOpenCourseStudentSigninLogType().equals(Constant.MANUAL))
|
|
|
|
|
.filter(item->item.getTeacherOpenCourseStudentSigninLogTag()==20)
|
|
|
|
|
.filter(item -> item.getTeacherOpenCourseStudentSigninLogTag() == 20)
|
|
|
|
|
.collect(Collectors.toList()).size();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 先转换为浮点数进行除法运算
|
|
|
|
|
double result = (double) missSizeManual / countByClass;
|
|
|
|
|
|
|
|
|
@ -317,28 +318,26 @@ public class TeacherOpenCourseStudentSigninServiceImpl implements TeacherOpenCou
|
|
|
|
|
double roundedResult = Math.round(result * 100.0) / 100.0;
|
|
|
|
|
|
|
|
|
|
teacherSigninSettingDTO.setSum(countByClass);
|
|
|
|
|
teacherSigninSettingDTO.setSignCount(countByClass-missSizeManual);
|
|
|
|
|
teacherSigninSettingDTO.setSignCount(countByClass - missSizeManual);
|
|
|
|
|
teacherSigninSettingDTO.setMissStudent(missSizeManual);
|
|
|
|
|
teacherSigninSettingDTO.setTotalAttendRate(roundedResult);
|
|
|
|
|
|
|
|
|
|
teacherSigninSettingDTOS.add(teacherSigninSettingDTO);
|
|
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//签到人数
|
|
|
|
|
int size1 = teacherOpenCourseStudentSigninLogList.stream().filter(item -> item.getTeacherOpenCourseStudentSigninLogTag() == 10).collect(Collectors.toList()).size();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
signCount =+size1;
|
|
|
|
|
signCount = +size1;
|
|
|
|
|
|
|
|
|
|
//缺勤人数
|
|
|
|
|
int info = teacherOpenCourseStudentSigninLogList.size() - size1;
|
|
|
|
|
|
|
|
|
|
missStudent =+info;
|
|
|
|
|
|
|
|
|
|
missStudent = +info;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TeacherSigninSettingDTO teacherSigninSettingDTO = new TeacherSigninSettingDTO();
|
|
|
|
@ -346,7 +345,6 @@ public class TeacherOpenCourseStudentSigninServiceImpl implements TeacherOpenCou
|
|
|
|
|
BeanUtils.copyProperties(openCourseStudentSigninSetting, teacherSigninSettingDTO);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//当前签到总人数
|
|
|
|
|
teacherSigninSettingDTO.setSum(countByClass);
|
|
|
|
|
//当前签到缺勤人数
|
|
|
|
@ -397,6 +395,171 @@ public class TeacherOpenCourseStudentSigninServiceImpl implements TeacherOpenCou
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//班级下拉框
|
|
|
|
|
@Override
|
|
|
|
|
public ResultEntity getClassListByNameOrSchoolId(String schoolId, String studentId,
|
|
|
|
|
String name, String classID,
|
|
|
|
|
Integer page, Integer size) {
|
|
|
|
|
PageHelper.startPage(page, size);
|
|
|
|
|
|
|
|
|
|
StuUserExample userExample = new StuUserExample();
|
|
|
|
|
StuUserExample.Criteria criteria = userExample.createCriteria();
|
|
|
|
|
criteria.andSchoolIdEqualTo(schoolId);
|
|
|
|
|
if (StringUtils.hasText(studentId)) {
|
|
|
|
|
criteria.andStudentIdLike("%" + studentId + "%");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (StringUtils.hasText(name)) {
|
|
|
|
|
criteria.andNameLike("%" + name + "%");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (StringUtils.hasText(classID)) {
|
|
|
|
|
criteria.andClassIdEqualTo(classID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<StuUser> stuUserList = stuUserMapper.selectByExample(userExample);
|
|
|
|
|
if (stuUserList.isEmpty()) {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PageInfo<StuUser> userPageInfo = new PageInfo<>(stuUserList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, userPageInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//签到详情
|
|
|
|
|
@Override
|
|
|
|
|
public ResultEntity getPageList(String studentId, String type,
|
|
|
|
|
String classId, Integer page,
|
|
|
|
|
Integer size, Date signTime,
|
|
|
|
|
Integer signInfo,
|
|
|
|
|
String missInfo, Long signId, String classIds
|
|
|
|
|
) {
|
|
|
|
|
//开启分页
|
|
|
|
|
PageHelper.startPage(page, size);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//开始时间,结束时间,签到情况,缺勤理由 {班级ID,签到ID(默认查询)} 根据签到方式展示老师手动签到学生信息,其他学生默认全部签到
|
|
|
|
|
TeacherOpenCourseStudentSigninLogExample openCourseStudentSigninLogExample = new TeacherOpenCourseStudentSigninLogExample();
|
|
|
|
|
TeacherOpenCourseStudentSigninLogExample.Criteria criteria = openCourseStudentSigninLogExample.createCriteria();
|
|
|
|
|
if (StringUtils.hasText(classIds)) {
|
|
|
|
|
String[] split = classIds.split(",");
|
|
|
|
|
|
|
|
|
|
List<Long> collect = Arrays.stream(split)
|
|
|
|
|
.map(Long::valueOf) // 将每个字符串转换为 Long
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
criteria.andSchoolClassIdIn(collect);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (StringUtils.hasText(studentId)) {
|
|
|
|
|
criteria.andStudentIdEqualTo(studentId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (signTime != null) {
|
|
|
|
|
criteria.andTeacherOpenCourseStudentSigninSettingSessionTimeBetween(signTime, signTime);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (signInfo != null) {
|
|
|
|
|
criteria.andTeacherOpenCourseStudentSigninLogTagEqualTo(signInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (StringUtils.hasText(missInfo)) {
|
|
|
|
|
criteria.andTeacherOpenCourseStudentSigninLogRemarkEqualTo(missInfo);
|
|
|
|
|
}
|
|
|
|
|
criteria.andTeacherOpenCourseStudentSigninSettingIdEqualTo(signId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//手动签到
|
|
|
|
|
if (StringUtils.hasText(type)) {
|
|
|
|
|
|
|
|
|
|
if (Constant.MANUAL.equals(type)) {
|
|
|
|
|
//只能查出来老师手动签到的用户数据 未抽中用户默认已经签到并且要展示出来
|
|
|
|
|
criteria.andTeacherOpenCourseStudentSigninLogTypeEqualTo(type);
|
|
|
|
|
|
|
|
|
|
//往里面加数据teacherOpenCourseStudentSigninLogList
|
|
|
|
|
|
|
|
|
|
List<TeacherOpenCourseStudentSigninLog> teacherOpenCourseStudentSigninLogList =
|
|
|
|
|
teacherOpenCourseStudentSigninLogMapper.selectByExample(openCourseStudentSigninLogExample);
|
|
|
|
|
if (teacherOpenCourseStudentSigninLogList.isEmpty()) {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK);
|
|
|
|
|
}
|
|
|
|
|
//查询班级所有用户
|
|
|
|
|
|
|
|
|
|
String[] split = classIds.split(",");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StuUserExample userExample = new StuUserExample();
|
|
|
|
|
userExample.createCriteria().andClassIdIn(Arrays.stream(split).collect(Collectors.toList()));
|
|
|
|
|
List<StuUser> stuUserList = stuUserMapper.selectByExample(userExample);
|
|
|
|
|
if (stuUserList.isEmpty()) {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK);
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
// for (StuUser stuUser : stuUserList) {
|
|
|
|
|
// for (TeacherOpenCourseStudentSigninLog studentSigninLog : teacherOpenCourseStudentSigninLogList) {
|
|
|
|
|
// if (stuUser.getStudentId().equals(studentSigninLog.getStudentId())) {
|
|
|
|
|
// continue;
|
|
|
|
|
// } else {
|
|
|
|
|
// //加入往里面加数据teacherOpenCourseStudentSigninLogList
|
|
|
|
|
// TeacherOpenCourseStudentSigninLog teacherOpenCourseStudentSigninLog = TeacherOpenCourseStudentSigninLog.builder()
|
|
|
|
|
// .studentId(stuUser.getStudentId())
|
|
|
|
|
// .teacherOpenCourseStudentSigninLogAddTime(teacherOpenCourseStudentSigninLogList.get(0).getTeacherOpenCourseStudentSigninLogAddTime())
|
|
|
|
|
// .teacherOpenCourseStudentSigninLogTag(10)
|
|
|
|
|
// .schoolClassId(Long.parseLong(stuUser.getClassId())).build();
|
|
|
|
|
// teacherOpenCourseStudentSigninLogList.add(teacherOpenCourseStudentSigninLog);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
for (StuUser stuUser : stuUserList) {
|
|
|
|
|
boolean found = false;
|
|
|
|
|
for (TeacherOpenCourseStudentSigninLog studentSigninLog : teacherOpenCourseStudentSigninLogList) {
|
|
|
|
|
if (stuUser.getStudentId().equals(studentSigninLog.getStudentId())) {
|
|
|
|
|
found = true;
|
|
|
|
|
break; // 找到匹配项,跳出内层循环
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!found) {
|
|
|
|
|
// 如果没有找到匹配项,加入新数据到 teacherOpenCourseStudentSigninLogList
|
|
|
|
|
TeacherOpenCourseStudentSigninLog teacherOpenCourseStudentSigninLog = TeacherOpenCourseStudentSigninLog.builder()
|
|
|
|
|
.studentId(stuUser.getStudentId())
|
|
|
|
|
.teacherOpenCourseStudentSigninLogAddTime(teacherOpenCourseStudentSigninLogList.get(0).getTeacherOpenCourseStudentSigninLogAddTime())
|
|
|
|
|
.teacherOpenCourseStudentSigninLogTag(10)
|
|
|
|
|
.schoolClassId(Long.parseLong(stuUser.getClassId())).build();
|
|
|
|
|
teacherOpenCourseStudentSigninLogList.add(teacherOpenCourseStudentSigninLog);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PageInfo<TeacherOpenCourseStudentSigninLog> courseStudentSigninLogPageInfo = new PageInfo<>(teacherOpenCourseStudentSigninLogList);
|
|
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, courseStudentSigninLogPageInfo);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<TeacherOpenCourseStudentSigninLog> teacherOpenCourseStudentSigninLogList =
|
|
|
|
|
teacherOpenCourseStudentSigninLogMapper.selectByExample(openCourseStudentSigninLogExample);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (teacherOpenCourseStudentSigninLogList.isEmpty()) {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PageInfo<TeacherOpenCourseStudentSigninLog> courseStudentSigninLogPageInfo = new PageInfo<>(teacherOpenCourseStudentSigninLogList);
|
|
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, courseStudentSigninLogPageInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|