package cn.shentianlan.service.impl;
import cn.shentianlan.criteria.CourseSchedulingCriteria;
import cn.shentianlan.domain.dto.ClassroomSchedulingDTO;
import cn.shentianlan.domain.dto.CourseSchedulingBatchSaveDTO;
import cn.shentianlan.domain.dto.CourseSchedulingListVO;
import cn.shentianlan.domain.entity.ClassroomScheduling;
import cn.shentianlan.domain.entity.CourseScheduling;
import cn.shentianlan.mapper.CourseSchedulingMapper;
import cn.shentianlan.service.ClassroomSchedulingService;
import cn.shentianlan.service.CourseSchedulingService;
import cn.shentianlan.utils.BaseUtils;
import cn.shentianlan.utils.DataUtils;
import cn.shentianlan.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
/**
* @Author 陈俊源
* @Description TODO
* @Date 2021/5/1
* @Version 1.0
*/
@Service
public class CourseSchedulingServiceImpl implements CourseSchedulingService {
@Autowired
private CourseSchedulingMapper courseSchedulingMapper;
@Autowired
private ClassroomSchedulingService classroomSchedulingService;
/**
* 批量保存排课信息
* @param courseSchedulingBatchSaveDTO
* @return
*/
@Override
public Result batchSaveCourseScheduling(CourseSchedulingBatchSaveDTO courseSchedulingBatchSaveDTO) {
List<Integer> weekList = courseSchedulingBatchSaveDTO.getWeekList();
LocalDate startDate = courseSchedulingBatchSaveDTO.getStartDate();
LocalDate endDate = courseSchedulingBatchSaveDTO.getEndDate();
List<LocalDate> dateList = new ArrayList<>();
while (startDate.compareTo(endDate) <= 0) {
if (weekList.contains(startDate.getDayOfWeek().getValue())) {
dateList.add(startDate);
}
startDate = startDate.plusDays(1);
}
Map<String,Object> args = new HashMap<String,Object>();
args.put("classroomId",courseSchedulingBatchSaveDTO.getClassroomId());
args.put("dateList",dateList);
args.put("teacherId",courseSchedulingBatchSaveDTO.getTeacherId());
List<CourseSchedulingListVO> courseSchedulingListVOListByClassroomId = courseSchedulingMapper.selectCourseSchedulingListByClassroomId(args);
Set<String> errorSet = new HashSet<>();
//判断课室是否出现冲突情况
for (CourseSchedulingListVO vo : courseSchedulingListVOListByClassroomId) {
if (isTimeConflict(courseSchedulingBatchSaveDTO.getAttendTime(), courseSchedulingBatchSaveDTO.getFinishTime(), vo.getAttendTime(), vo.getFinishTime())) {
errorSet.add(String.format("%s %s-%s %s %s %s", vo.getDate(), vo.getAttendTime(), vo.getFinishTime(), vo.getClassroomName(), vo.getCourseName(), vo.getTeacherName()));
}
}
//判断上课教师是否出现冲突情况
List<CourseSchedulingListVO> courseSchedulingListVOListByTeacherId = courseSchedulingMapper.selectCourseSchedulingListByTeacherId(args);
for (CourseSchedulingListVO vo : courseSchedulingListVOListByTeacherId) {
if (isTimeConflict(courseSchedulingBatchSaveDTO.getAttendTime(), courseSchedulingBatchSaveDTO.getFinishTime(), vo.getAttendTime(), vo.getFinishTime())) {
errorSet.add(String.format("%s %s-%s %s %s %s", vo.getDate(), vo.getAttendTime(), vo.getFinishTime(), vo.getClassroomName(), vo.getCourseName(), vo.getTeacherName()));
}
}
if (errorSet.size() > 0) {
return Result.fail(errorSet,"检测到排课信息冲突");
}
for (LocalDate date : dateList) {
CourseScheduling courseScheduling = BaseUtils.copyProperties(courseSchedulingBatchSaveDTO, CourseScheduling.class);
courseScheduling.setDate(date);
courseScheduling.setId(DataUtils.assignId());
courseSchedulingMapper.save(courseScheduling);
ClassroomSchedulingDTO classroomSchedulingDTO = bulidClassroomSchedulingDTO(null, courseScheduling.getClassroomId(), courseScheduling.getTeacherId(), courseScheduling.getDate(), courseScheduling.getAttendTime(), courseScheduling.getFinishTime());
classroomSchedulingService.saveOrUpdate(classroomSchedulingDTO);
}
return Result.success();
}
/**
* 根据相关条件查询出排课信息
* @param courseSchedulingCriteria
* @return
*/
@Override
public Result getCourseSchedulingList(CourseSchedulingCriteria courseSchedulingCriteria) {
List<CourseSchedulingListVO> courseSchedulingListVOListByCriteria = courseSchedulingMapper.selectCourseSchedulingList(courseSchedulingCriteria);
return Result.success(courseSchedulingListVOListByCriteria);
}
/**
* 根据相关条件查询出课程数量
* @param courseSchedulingCriteria
* @return
*/
@Override
public Result getCourseSchedulingCourseCount(CourseSchedulingCriteria courseSchedulingCriteria) {
Map<String, Integer> map = new HashMap<>();
List<Map<String,Object>> list = courseSchedulingMapper.selectCourseSchedulingCourseCount(courseSchedulingCriteria);
if (list != null && list.size() > 0) {
list.forEach(item -> map.put(String.valueOf(item.get("date")), item.get("count") != null ? Integer.parseInt(String.valueOf(item.get("count"))) : 0));
}
return Result.success(map);
}
/**
* 根据id获取该节课对应的排课信息
* @param id
* @return
*/
@Override
public Result getCourseSchedulingById(Long id) {
if (id==null){
return Result.fail("id为空,无法获取相应信息");
}
CourseSchedulingListVO courseSchedulingListVO = courseSchedulingMapper.getCourseSchedulingById(id);
return Result.success(courseSchedulingListVO);
}
/**
* 保存或更新排课信息
* @param courseScheduling
* @return
*/
@Transactional
@Override
public Result saveOrUpdateCourseScheduling(CourseScheduling courseScheduling) {
//检测排课是否出现冲突
Result result = check(courseScheduling.getId(),courseScheduling.getClassroomId(),courseScheduling.getTeacherId(),
courseScheduling.getDate(),courseScheduling.getAttendTime(),courseScheduling.getFinishTime());
if (!Result.isSuccess(result)){
return result;
}
ClassroomSchedulingDTO classroomSchedulingDTO = bulidClassroomSchedulingDTO(null, courseScheduling.getClassroomId(),courseScheduling.getTeacherId(),courseScheduling.getDate(), courseScheduling.getAttendTime(), courseScheduling.getFinishTime());
if (courseScheduling.getId()==null){
courseScheduling.setId(DataUtils.assignId());
courseSchedulingMapper.save(courseScheduling);
}else{
LocalDateTime startTime = LocalDateTime.of(courseScheduling.getDate(),courseScheduling.getAttendTime());
LocalDateTime endTime = LocalDateTime.of(courseScheduling.getDate(),courseScheduling.getFinishTime());
ClassroomScheduling classroomScheduling = classroomSchedulingService.getClassrooomSchedulingByClassroomIdAndStartTimeAndEndTime(courseScheduling.getClassroomId(),startTime,endTime);
if (classroomScheduling != null){
classroomSchedulingDTO.setId(classroomScheduling.getId());
}
courseSchedulingMapper.update(courseScheduling);
}
classroomSchedulingService.saveOrUpdate(classroomSchedulingDTO);
return Result.success(courseScheduling.getId());
}
/**
* 根据id删除排课信息
* @param id
* @return
*/
@Override
public Result deleteCourseSchedulingById(Long id) {
没有合适的资源?快使用搜索试试~ 我知道了~
教育培训机构管理系统,技术栈:SpringBoot + MyBatis + MySQL + Vue + ElementUI
共573个文件
vue:130个
java:95个
class:94个
5星 · 超过95%的资源 需积分: 5 12 下载量 113 浏览量
2023-05-11
14:15:51
上传
评论
收藏 24.55MB ZIP 举报
温馨提示
教育培训机构管理系统 此系统为前后端分离方式开发的系统,技术栈为 后端: SpringBoot + MyBatis + MySQL 前端: Vue + ElementUI 此系统为前后端分离方式开发的系统,技术栈为 后端: SpringBoot + MyBatis + MySQL 前端: Vue + ElementUI 此系统为前后端分离方式开发的系统,技术栈为 后端: SpringBoot + MyBatis + MySQL 前端: Vue + ElementUI 此系统为前后端分离方式开发的系统,技术栈为 后端: SpringBoot + MyBatis + MySQL 前端: Vue + ElementUI 此系统为前后端分离方式开发的系统,技术栈为 后端: SpringBoot + MyBatis + MySQL 前端: Vue + ElementUI 此系统为前后端分离方式开发的系统,技术栈为 后端: SpringBoot + MyBatis + MySQL 前端: Vue + ElementUI
资源推荐
资源详情
资源评论
收起资源包目录
教育培训机构管理系统,技术栈:SpringBoot + MyBatis + MySQL + Vue + ElementUI (573个子文件)
4c6533e5f2db45d08b51eb5f67f4e6040b5b9621 73B
4c6533e5f2db45d08b51eb5f67f4e6040b5b9621 0B
4ddfcbab7c25af13943bd423206754fee321e864 943B
4ddfcbab7c25af13943bd423206754fee321e864 0B
4e3b4dca5259bd0919d4b13d2d8e8308b0812042 160B
4e3b4dca5259bd0919d4b13d2d8e8308b0812042 0B
71c25d82d846818c0f676987e7d8e208288dccd4 2KB
71c25d82d846818c0f676987e7d8e208288dccd4 0B
751409349e16c33996666abf9c9bf013dcbff551 325B
751409349e16c33996666abf9c9bf013dcbff551 0B
95f6363b92881afcf55ed87e1b26a2bdb2374dc6 0B
95f6363b92881afcf55ed87e1b26a2bdb2374dc6 0B
a563ed075950b1a3ab65383df313ff6c85777f7a 73B
a563ed075950b1a3ab65383df313ff6c85777f7a 0B
a6d8b8556fee0e03112ce2bf34b8cb27a7dc9e58 0B
a6d8b8556fee0e03112ce2bf34b8cb27a7dc9e58 0B
b2152dcecd37e2d080c47bfea9f04dfc0841c5bb 757B
b2152dcecd37e2d080c47bfea9f04dfc0841c5bb 0B
b62cfe936593d8127eaee5a4743a51137b072400 87B
b62cfe936593d8127eaee5a4743a51137b072400 0B
bcc00c933348fc0ee2f2f22f12135643a847abad 780B
bcc00c933348fc0ee2f2f22f12135643a847abad 0B
c428a920fbdfe48c30fae870dc1e4e606425a432 442B
c428a920fbdfe48c30fae870dc1e4e606425a432 0B
ce1fe99ab2854f3ed53f16922e282ddebd8f935b 3KB
ce1fe99ab2854f3ed53f16922e282ddebd8f935b 0B
CourseSchedulingExcelManager.class 15KB
UserDTO.class 12KB
CourseSchedulingServiceImpl.class 12KB
StudentDTO.class 10KB
TeacherDTO.class 9KB
Student.class 8KB
Teacher.class 8KB
UserServiceImpl.class 8KB
CourseSchedulingListVO.class 7KB
BaseUtils.class 6KB
TransactionProcessingDTO.class 6KB
User.class 5KB
ClassroomSchedulingServiceImpl.class 5KB
TransactionProcessingServiceImpl.class 5KB
StudentServiceImpl.class 5KB
TeacherServiceImpl.class 5KB
TransactionProcessing.class 5KB
CourseSchedulingBatchSaveDTO.class 5KB
CourseSchedulingExportDTO.class 5KB
CourseSchedulingController.class 5KB
CourseSchedulingCriteria.class 5KB
CourseDTO.class 4KB
ClassServiceImpl.class 4KB
Result.class 4KB
CourseScheduling.class 4KB
ClassroomDTO.class 4KB
Classroom.class 4KB
CourseServiceImpl.class 4KB
ClassroomServiceImpl.class 4KB
CourseSchedulingExportVO.class 4KB
ClassroomSchedulingDTO.class 4KB
Course.class 3KB
ClassroomScheduling.class 3KB
CourseSchedulingReportVO.class 3KB
ClassroomSchedulingCriteria.class 2KB
CourseCriteria.class 2KB
ClassDTO.class 2KB
Clazz.class 2KB
TeacherCourseDTO.class 2KB
StudentCourseDTO.class 2KB
TeacherCourse.class 2KB
ErrorCodeEnum.class 2KB
RoleNameCode.class 2KB
ClassroomSchedulingController.class 2KB
TeacherCourseServiceImpl.class 2KB
TransactionProcessingCriteria.class 2KB
TransactionProcessingController.class 2KB
GenderCode.class 2KB
BaseCriteria.class 2KB
SheetNaingTypeEnum.class 2KB
CourseSchedulingMapper.class 2KB
EnableStateEnum.class 2KB
UserController.class 2KB
ClassroomController.class 2KB
TeacherController.class 2KB
CourseController.class 2KB
ResultCode.class 2KB
ClassController.class 2KB
StudentCourseServiceImpl.class 2KB
StudentController.class 2KB
ClassroomCriteria.class 2KB
StudentCriteria.class 1KB
TeacherCriteria.class 1KB
ClassCriteria.class 1KB
UserCriteria.class 1KB
CollectionUtils.class 1KB
ClassroomSchedulingMapper.class 1KB
StudentCourseController.class 1KB
TeacherCourseController.class 1KB
TransactionProcessingMapper.class 879B
UserMapper.class 877B
TeachTrainManageSystemApplication.class 842B
ClassMapper.class 797B
DataUtils.class 779B
共 573 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
- 食色也2023-07-25该文件详细介绍了教育培训机构管理系统的功能模块,并提供了清晰的开发计划,有助于开发团队高效完成项目。
- 马李灵珊2023-07-25通过使用Vue和ElementUI,界面设计简洁美观,用户体验良好。
- 五月Eliy2023-07-25MySQL数据库的应用确保了数据的可靠性和存储的扩展性。
- maXZero2023-07-25技术栈的选择合理,SpringBoot和MyBatis的结合让系统的开发更加高效和灵活。
- ali-122023-07-25这个文件对教育培训机构的管理需求进行了全面而细致的分析,给出了实用的解决方案。
仅此而已丶
- 粉丝: 3771
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- (源码)基于SimPy和贝叶斯优化的流程仿真系统.zip
- (源码)基于Java Web的个人信息管理系统.zip
- (源码)基于C++和OTL4的PostgreSQL数据库连接系统.zip
- (源码)基于ESP32和AWS IoT Core的室内温湿度监测系统.zip
- (源码)基于Arduino的I2C协议交通灯模拟系统.zip
- coco.names 文件
- (源码)基于Spring Boot和Vue的房屋租赁管理系统.zip
- (源码)基于Android的饭店点菜系统.zip
- (源码)基于Android平台的权限管理系统.zip
- (源码)基于CC++和wxWidgets框架的LEGO模型火车控制系统.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功