|
@@ -23,7 +23,6 @@ import com.ym.mec.common.page.PageInfo;
|
|
|
import com.ym.mec.common.page.QueryInfo;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.im.ImFeignService;
|
|
|
-import com.ym.mec.jiari.JiaRiFeignService;
|
|
|
import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
|
|
|
import com.ym.mec.util.collection.ListUtil;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
@@ -73,10 +72,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
private StudentAttendanceDao studentAttendanceDao;
|
|
|
@Autowired
|
|
|
private ClassGroupStudentMapperDao classGroupStudentMapperDao;
|
|
|
-
|
|
|
@Autowired
|
|
|
private TeacherDefaultPracticeGroupSalaryDao teacherDefaultPracticeGroupSalaryDao;
|
|
|
-
|
|
|
@Autowired
|
|
|
private SysMessageService sysMessageService;
|
|
|
@Autowired
|
|
@@ -110,8 +107,6 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
@Autowired
|
|
|
private PracticeGroupDao practiceGroupDao;
|
|
|
@Autowired
|
|
|
- private JiaRiFeignService jiaRiFeignService;
|
|
|
- @Autowired
|
|
|
private VipGroupService vipGroupService;
|
|
|
@Autowired
|
|
|
private MusicGroupService musicGroupService;
|
|
@@ -121,10 +116,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
private SchoolDao schoolDao;
|
|
|
@Autowired
|
|
|
private ImFeignService imFeignService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private CourseHomeworkService courseHomeworkService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private GroupDao groupDao;
|
|
|
@Autowired
|
|
@@ -133,6 +126,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
private CourseScheduleReviewDao courseScheduleReviewDao;
|
|
|
@Autowired
|
|
|
private PracticeGroupService practiceGroupService;
|
|
|
+ @Autowired
|
|
|
+ private CoursesGroupModifyLogDao coursesGroupModifyLogDao;
|
|
|
|
|
|
private final Logger LOGGER = LoggerFactory
|
|
|
.getLogger(this.getClass());
|
|
@@ -3762,6 +3757,11 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
}
|
|
|
|
|
|
PracticeGroup practiceGroup = practiceGroupDao.get(Long.parseLong(oldCourseSchedule.getMusicGroupId()));
|
|
|
+ CoursesGroupModifyLog coursesGroupModifyLog = new CoursesGroupModifyLog();
|
|
|
+ coursesGroupModifyLog.setGroupId(oldCourseSchedule.getMusicGroupId());
|
|
|
+ coursesGroupModifyLog.setGroupType(PRACTICE.getCode());
|
|
|
+ coursesGroupModifyLog.setOperatorId(user.getId());
|
|
|
+ coursesGroupModifyLog.setPreviousGroup(JSONObject.toJSONString(practiceGroup));
|
|
|
String classDate = DateUtil.format(courseSchedule.getClassDate(), DateUtil.DEFAULT_PATTERN);
|
|
|
String startClassTime = DateUtil.format(courseSchedule.getStartClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
|
|
|
Date startDateTime = DateUtil.stringToDate(classDate + " " + startClassTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
|
|
@@ -3826,6 +3826,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
practiceGroup.setCoursesExpireDate(courseScheduleDao.getLastTime(practiceGroup.getId(),PRACTICE.getCode()));
|
|
|
practiceGroup.setUpdateTime(date);
|
|
|
practiceGroupDao.update(practiceGroup);
|
|
|
+ coursesGroupModifyLog.setCurrentGroup(JSONObject.toJSONString(practiceGroup));
|
|
|
+ coursesGroupModifyLogDao.insert(coursesGroupModifyLog);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -3921,6 +3923,11 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
courseSchedules = courseSchedules.stream().filter(courseSchedule -> !courseSchedule.getActualTeacherId().equals(teacherId)).collect(Collectors.toList());
|
|
|
}
|
|
|
PracticeGroup practiceGroup = practiceGroupDao.get(Long.valueOf(practiceGroupId));
|
|
|
+ CoursesGroupModifyLog coursesGroupModifyLog = new CoursesGroupModifyLog();
|
|
|
+ coursesGroupModifyLog.setGroupId(practiceGroupId);
|
|
|
+ coursesGroupModifyLog.setGroupType(PRACTICE.getCode());
|
|
|
+ coursesGroupModifyLog.setOperatorId(user.getId());
|
|
|
+ coursesGroupModifyLog.setPreviousGroup(JSONObject.toJSONString(practiceGroup));
|
|
|
ClassGroup classGroup = classGroupDao.findByMusicGroupAndType(practiceGroupId, PRACTICE.getCode());
|
|
|
if(Objects.nonNull(educationalTeacherId)&&!educationalTeacherId.equals(practiceGroup.getEducationalTeacherId())){
|
|
|
if(Objects.nonNull(practiceGroup.getEducationalTeacherId())){
|
|
@@ -3945,10 +3952,13 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
classGroupDao.update(classGroup);
|
|
|
courseScheduleDao.updateCourseNameByGroup(practiceGroupId, PRACTICE,groupName);
|
|
|
}
|
|
|
+ practiceGroup.setUserId(teacherId);
|
|
|
practiceGroupDao.update(practiceGroup);
|
|
|
+ coursesGroupModifyLog.setCurrentGroup(JSONObject.toJSONString(practiceGroup));
|
|
|
+ coursesGroupModifyLogDao.insert(coursesGroupModifyLog);
|
|
|
classGroupTeacherMapperService.updateTeacher(practiceGroupId,teacherId, PRACTICE.getCode());
|
|
|
classGroupTeacherSalaryDao.updateTeacher(practiceGroupId,teacherId, PRACTICE.getCode());
|
|
|
- practiceGroupDao.updateUserId(practiceGroupId,teacherId);
|
|
|
+// practiceGroupDao.updateUserId(practiceGroupId,teacherId);
|
|
|
if(courseSchedules == null || courseSchedules.size() == 0){
|
|
|
return;
|
|
|
}
|
|
@@ -4199,6 +4209,10 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void updateCoursesExpireDate(String practiceGroupId, Date coursesExpireDate) {
|
|
|
+ SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
+ if (null == user) {
|
|
|
+ throw new BizException("获取用户信息失败");
|
|
|
+ }
|
|
|
if(practiceGroupId == null || coursesExpireDate == null ){
|
|
|
throw new BizException("参数校验失败");
|
|
|
}
|
|
@@ -4209,7 +4223,6 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
if(practiceGroup.getCoursesStartDate().after(coursesExpireDate)){
|
|
|
throw new BizException("课程有效时间不能早于开始时间");
|
|
|
}
|
|
|
-
|
|
|
if(Objects.nonNull(practiceGroup.getBuyMonths())){
|
|
|
LocalDate courseStartDay = LocalDateTime.ofInstant(practiceGroup.getCoursesStartDate().toInstant(), DateUtil.zoneId).toLocalDate();
|
|
|
LocalDate currentExpiredDay = courseStartDay.plusMonths(practiceGroup.getBuyMonths()).plusDays(-1);
|
|
@@ -4218,10 +4231,16 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
throw new BizException("课程结束时间不得早于,{}", DateUtil.dateToString(courseExpiredDateTemp, "yyyy年MM月dd日"));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ CoursesGroupModifyLog coursesGroupModifyLog = new CoursesGroupModifyLog();
|
|
|
+ coursesGroupModifyLog.setGroupId(practiceGroupId);
|
|
|
+ coursesGroupModifyLog.setGroupType(PRACTICE.getCode());
|
|
|
+ coursesGroupModifyLog.setOperatorId(user.getId());
|
|
|
+ coursesGroupModifyLog.setPreviousGroup(JSONObject.toJSONString(practiceGroup));
|
|
|
practiceGroup.setCoursesExpireDate(DateUtil.addSeconds(DateUtil.addDays(coursesExpireDate, 1),-1));
|
|
|
practiceGroup.setUpdateTime(new Date());
|
|
|
practiceGroupDao.update(practiceGroup);
|
|
|
+ coursesGroupModifyLog.setCurrentGroup(JSONObject.toJSONString(practiceGroup));
|
|
|
+ coursesGroupModifyLogDao.insert(coursesGroupModifyLog);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -4230,6 +4249,63 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void classGroupTeacherAdjust(String classGroupIds, Integer teacherId, Integer targetTeacherId) {
|
|
|
+ List<CourseSchedule> courseSchedules = this.queryNoStartCourseByTeacherId(classGroupIds,teacherId,"BISHOP");
|
|
|
+ if(courseSchedules.size() > 0){
|
|
|
+ courseSchedules.forEach(e->{
|
|
|
+ e.setActualTeacherId(targetTeacherId);
|
|
|
+ });
|
|
|
+ this.courseAdjust(courseSchedules);
|
|
|
+ //修改关联班级老师
|
|
|
+ List<Integer> collect = courseSchedules.stream().map(e -> e.getClassGroupId()).collect(Collectors.toList());
|
|
|
+ batchUpdateClassTeacher(collect,teacherId,targetTeacherId);
|
|
|
+ }
|
|
|
+ List<CourseSchedule> courseSchedules1 = this.queryNoStartCourseByTeacherId(classGroupIds, teacherId, "TEACHING");
|
|
|
+ if(courseSchedules1.size() > 0){
|
|
|
+ List<Integer> teachingTeacherIdList = new ArrayList<Integer>();
|
|
|
+ teachingTeacherIdList.add(targetTeacherId);
|
|
|
+ courseSchedules.forEach(e->{
|
|
|
+ e.setTeachingTeacherIdList(teachingTeacherIdList);
|
|
|
+ });
|
|
|
+ this.courseAdjust(courseSchedules1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void batchPracticeGroupTeacherAdjust(String practiceGroupId, Integer teacherId, Integer subjectId, Integer educationalTeacherId,Integer oldTeacherId) {
|
|
|
+ String[] split = practiceGroupId.split(",");
|
|
|
+ for (int i = 0; i < split.length; i++) {
|
|
|
+ this.practiceGroupTeacherAdjust(split[i],teacherId,subjectId,educationalTeacherId);
|
|
|
+ }
|
|
|
+ List<ClassGroup> classGroups = classGroupDao.queryClassGroups(practiceGroupId,"PRACTICE");
|
|
|
+ if(classGroups.size() > 0){
|
|
|
+ List<Integer> collect = classGroups.stream().map(e -> e.getId()).collect(Collectors.toList());
|
|
|
+ batchUpdateClassTeacher(collect,oldTeacherId,teacherId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void batchUpdateClassTeacher(List<Integer> classGroupIds,Integer oldTeacherId,Integer newTeacherId){
|
|
|
+ //修改班级老师
|
|
|
+ List<ClassGroup> classGroupList = classGroupDao.findByClassGroupIds(classGroupIds);
|
|
|
+ classGroupList.forEach(e->{
|
|
|
+ e.setUserIds(newTeacherId.toString());
|
|
|
+ });
|
|
|
+ classGroupTeacherMapperService.batchUpdateTeacherByClassId(classGroupIds,newTeacherId);
|
|
|
+ //旧老师退群,新老师加群
|
|
|
+ if(classGroupList != null && classGroupIds.size() > 0){
|
|
|
+ ImGroupMember[] oldImGroupMembers = {new ImGroupMember(oldTeacherId.toString())};
|
|
|
+ ImGroupMember[] imGroupMembers = {new ImGroupMember(newTeacherId.toString())};
|
|
|
+ for (ClassGroup classGroup:classGroupList) {
|
|
|
+ imFeignService.groupQuit(new ImGroupModel(classGroup.getId().toString(), oldImGroupMembers, classGroup.getName()));
|
|
|
+ imFeignService.groupJoin(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, classGroup.getName()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public Object teacherCourseHeadInfo(Long courseScheduleId) {
|
|
|
SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
if (null == user) {
|