Browse Source

Merge remote-tracking branch 'origin/master'

周箭河 4 years ago
parent
commit
bb496e21d5
20 changed files with 544 additions and 680 deletions
  1. 1 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupDao.java
  2. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDao.java
  3. 12 3
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ContractServiceImpl.java
  4. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java
  5. 71 65
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentAttendanceServiceImpl.java
  6. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java
  7. 86 75
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherAttendanceServiceImpl.java
  8. 1 1
      mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  9. 8 1
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml
  10. 3 2
      mec-biz/src/main/resources/config/mybatis/StudentAttendanceMapper.xml
  11. 2 2
      mec-biz/src/main/resources/config/mybatis/StudentGoodsSellMapper.xml
  12. 43 57
      mec-im/src/main/java/com/ym/controller/RoomController.java
  13. 0 2
      mec-im/src/main/java/com/ym/dao/HereWhiteDao.java
  14. 5 13
      mec-im/src/main/java/com/ym/dao/RoomDao.java
  15. 17 31
      mec-im/src/main/java/com/ym/dao/RoomMemberDao.java
  16. 0 2
      mec-im/src/main/java/com/ym/dao/SpeechDao.java
  17. 2 5
      mec-im/src/main/java/com/ym/dao/UserDao.java
  18. 9 10
      mec-im/src/main/java/com/ym/dao/WhiteboardDao.java
  19. 241 374
      mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java
  20. 28 36
      mec-im/src/main/java/com/ym/service/RoomService.java

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupDao.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.dao;
 
+import com.ym.mec.biz.dal.dto.CalenderPushDto;
 import com.ym.mec.biz.dal.dto.MusicCardDto;
 import com.ym.mec.biz.dal.dto.MusicGroupRegisterDto;
 import com.ym.mec.biz.dal.dto.RegisterSubjectDto;

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDao.java

@@ -126,4 +126,6 @@ public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPa
     List<Long> queryEndIds(@Param("configValue1") String configValue1, @Param("format") String format);
 
     List<CalenderPushDto> getCalenderPushDto(@Param("calenderIds") Collection<Long> calenderIds);
+
+    List<CalenderPushDto> getMusicCalenderPushDto(@Param("configValue") String configValue, @Param("format") String format);
 }

+ 12 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ContractServiceImpl.java

@@ -12,6 +12,8 @@ import java.util.stream.Collectors;
 import com.ym.mec.biz.dal.dao.StudentDao;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.InitializingBean;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -128,6 +130,8 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 
 	private DateFormat dateFormat1 = new SimpleDateFormat("yyMMddHHmmSS");
 
+	private final Logger logger = LoggerFactory.getLogger(ContractService.class);
+
 	@Override
 	public void afterPropertiesSet() throws Exception {
 		// 注册企业账户
@@ -947,6 +951,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 		SysUser user = studentDao.lockUserReturnInfo(userId);
 
 		if (user == null) {
+			logger.error("用户不存在({})", userId);
 			return false;
 		}
 
@@ -956,6 +961,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 		}
 
 		if(StringUtils.isBlank(user.getRealName())||StringUtils.isBlank(user.getIdCardNo())){
+			logger.error("身份信息缺失({})", userId);
 			return false;
 		}
 
@@ -991,7 +997,8 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 		}else{
 			MusicGroup musicGroup = musicGroupService.get(musicGroupId);
 			if (musicGroup == null) {
-				throw new BizException("乐团信息没找到");
+				logger.error("乐团信息没找到({})", musicGroupId);
+				return false;
 			}
 			params.put("ownershipType", musicGroup.getOwnershipType().name());
 		}
@@ -1002,7 +1009,8 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 		try {
 			PDFUtil.renderToPDFByData(ContractServiceImpl.class.getResource("/").getFile(), FileUtils.readFileToString(srcFile), srcPdfPath, "simsun.ttc");
 		} catch (IOException e) {
-			throw new BizException("生成产品协议失败", e);
+			logger.error("生成产品协议失败", e);
+			return false;
 		}
 
 
@@ -1014,7 +1022,8 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 		}
 		SysUserTsign organTsign = sysUserTsignService.queryByCardNo(organCode);
 		if (organTsign == null) {
-			throw new BizException("甲方未创建签章");
+			logger.error("甲方未创建签章");
+			return false;
 		}
 
 		eSealPlugin.organSign(organTsign.getSealData(), srcPdfPath, srcPdfPath);

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -189,6 +189,18 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 						calenderPushDto.getPaymentValidStartDate(),calenderPushDto.getPaymentValidEndDate());
 			});
 		}
+
+		//乐团报名到期,提醒教务老师创建缴费
+		List<CalenderPushDto> calenderPushDtos = musicGroupPaymentCalenderDao.getMusicCalenderPushDto(configValue1,format);
+		if(calenderPushDtos != null && calenderPushDtos.size() > 0){
+			calenderPushDtos.forEach(e->{
+				Map<Integer, String> receivers = new HashMap<>(1);
+				receivers.put(e.getTeacherId(),e.getTeacherPhone());
+				sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI, MessageTypeEnum.SMS_PAYMENT_CREATE,
+						receivers, null, 0, null, null,e.getMusicGroupName(),
+						e.getPaymentValidStartDate(),e.getPaymentValidEndDate());
+			});
+		}
 	}
 
 	@Override

+ 71 - 65
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentAttendanceServiceImpl.java

@@ -518,13 +518,15 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 
 			}*/
         } else if (signStatusEnum == SignStatusEnum.SIGN_OUT) {
+            studentAttendance.setStatus(statusEnum);
+            studentAttendance.setSignOutTime(date);
             String classDate = DateUtil.format(courseSchedule.getClassDate(), DateUtil.DEFAULT_PATTERN);
-            String startClassTime = DateUtil.format(courseSchedule.getStartClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
+//            String startClassTime = DateUtil.format(courseSchedule.getStartClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
             String endClassTime = DateUtil.format(courseSchedule.getEndClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
             //上课时间
-            Date classStartDateTime = DateUtil.stringToDate(classDate + " " + startClassTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
+//            Date classStartDateTime = DateUtil.stringToDate(classDate + " " + startClassTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
             Date classEndDateTime = DateUtil.stringToDate(classDate + " " + endClassTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
-            if (DateUtil.minutesBetween(classEndDateTime, date) >= 0) {
+            if (DateUtil.minutesBetween(classEndDateTime, date) > 0) {
                 String continueCourseTime = sysConfigDao.findConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME);
                 if (StringUtils.isEmpty(continueCourseTime)) {
                     continueCourseTime = "5";
@@ -543,80 +545,84 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
                         break;
                     }
                 }
-                if (courseSchedules.size() > 0) {
-                    //获取总上课时长
-                    int totalMinutes = DateUtil.minutesBetween(classStartDateTime, date);
-                    //减去第一节课时长
-                    int firstMinutes = courseScheduleDao.getSingleClassMinutes(courseScheduleId.longValue());
-                    totalMinutes -= firstMinutes;
-                    if (totalMinutes > 0) {
-                        String courseClassDate;
-                        String courseStartDateTime;
-                        String courseEndDateTime;
-                        for (int i = 0; i < courseSchedules.size(); i++) {
-                            courseClassDate = DateUtil.format(courseSchedules.get(i).getClassDate(), DateUtil.DEFAULT_PATTERN);
-                            courseStartDateTime = DateUtil.format(courseSchedules.get(i).getStartClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
-                            courseEndDateTime = DateUtil.format(courseSchedules.get(i).getEndClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
-                            Date startDateTime = DateUtil.stringToDate(courseClassDate + " " + courseStartDateTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
-                            Date endDateTime = DateUtil.stringToDate(courseClassDate + " " + courseEndDateTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
-                            StudentAttendance byStatusAndCourseScheduleId = studentAttendanceDao.findByStatusAndCourseScheduleId(userId, courseSchedules.get(i).getId().intValue());
-                            Date signOutTime = date;
-                            if (date.before(startDateTime)) {
-                                continue;
-                            }
-                            if (i < courseSchedules.size() - 1 && date.after(endDateTime)) {
-                                //不是最后一节连堂课,并且签退时间大于课程结束时间,签退时间等于课程结束时间
-                                signOutTime = endDateTime;
-                            }
-                            if (byStatusAndCourseScheduleId != null) {
-                                if (byStatusAndCourseScheduleId.getSignOutTime() != null) {
-                                    continue;
+                if(courseSchedules.size() > 0){
+                    String courseClassDate;
+                    String courseStartDateTime;
+                    String courseEndDateTime;
+                    String format2 = DateUtil.format(courseSchedule.getClassDate(), DateUtil.DEFAULT_PATTERN);
+                    String format3 = DateUtil.format(courseSchedule.getEndClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
+                    Date date1 = DateUtil.stringToDate(format2 + " " + format3, DateUtil.EXPANDED_DATE_TIME_FORMAT);
+                    studentAttendance.setSignOutTime(date1);
+                    for (int i = 0; i < courseSchedules.size(); i++) {
+                        courseClassDate = DateUtil.format(courseSchedules.get(i).getClassDate(), DateUtil.DEFAULT_PATTERN);
+                        courseStartDateTime = DateUtil.format(courseSchedules.get(i).getStartClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
+                        Date startDateTime = DateUtil.stringToDate(courseClassDate + " " + courseStartDateTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
+                        //如果是接下来的第一节连堂课,并且签退时间不大于课程开始时间,那么跳出循环
+                        if(i == 0 && !date.after(startDateTime)){
+                            studentAttendance.setSignOutTime(date);
+                            break;
+                        }
+                        courseEndDateTime = DateUtil.format(courseSchedules.get(i).getEndClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
+                        Date endDateTime = DateUtil.stringToDate(courseClassDate + " " + courseEndDateTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
+
+                        //不是最后一节课
+                        if(i < courseSchedules.size() - 1){
+                            //大于课程结束时间
+                            if(date.after(endDateTime)){
+                                String format = DateUtil.format(courseSchedules.get(i + 1).getClassDate(), DateUtil.DEFAULT_PATTERN);
+                                String format1 = DateUtil.format(courseSchedules.get(i + 1).getStartClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
+                                Date stringToDate = DateUtil.stringToDate(format + " " + format1, DateUtil.EXPANDED_DATE_TIME_FORMAT);
+                                //大于下一节课开始时间
+                                if(date.after(stringToDate)){
+                                    //当前课程签退时间为课程结束时间
+                                    upsetAttendance(userId,startDateTime,endDateTime,courseSchedules.get(i));
+                                }else {
+                                    //当前课程签退时间为退出时间
+                                    upsetAttendance(userId,startDateTime,date,courseSchedules.get(i));
                                 }
-                                if (byStatusAndCourseScheduleId.getSignInTime() != null) {
-                                    startDateTime = null;
+                            }else {
+                                if(date.after(startDateTime)){
+                                    //小于课程结束时间
+                                    upsetAttendance(userId,startDateTime,date,courseSchedules.get(i));
                                 }
-                                byStatusAndCourseScheduleId.setSignInTime(startDateTime);
-                                byStatusAndCourseScheduleId.setSignOutTime(signOutTime);
-                                byStatusAndCourseScheduleId.setStatus(statusEnum);
-                                byStatusAndCourseScheduleId.setUpdateTime(date);
-                                studentAttendanceDao.update(byStatusAndCourseScheduleId);
-                            } else {
-                                byStatusAndCourseScheduleId = new StudentAttendance();
-                                byStatusAndCourseScheduleId.setSignOutTime(signOutTime);
-                                byStatusAndCourseScheduleId.setStatus(statusEnum);
-                                byStatusAndCourseScheduleId.setSignInTime(startDateTime);
-                                byStatusAndCourseScheduleId.setUpdateTime(date);
-                                byStatusAndCourseScheduleId.setUserId(userId);
-                                byStatusAndCourseScheduleId.setTeacherId(courseSchedule.getActualTeacherId());
-                                byStatusAndCourseScheduleId.setClassGroupId(courseSchedules.get(i).getClassGroupId());
-                                byStatusAndCourseScheduleId.setCourseScheduleId(courseSchedules.get(i).getId());
-                                byStatusAndCourseScheduleId.setMusicGroupId(courseSchedules.get(i).getMusicGroupId());
-                                byStatusAndCourseScheduleId.setGroupType(courseSchedules.get(i).getGroupType());
-                                byStatusAndCourseScheduleId.setCurrentClassTimes(classGroup.getCurrentClassTimes() + 1);
-                                studentAttendanceDao.insert(byStatusAndCourseScheduleId);
+                                break;
                             }
-                            if (studentAttendance.getSignOutTime() == null) {
-                                studentAttendance.setStatus(statusEnum);
-                                studentAttendance.setSignOutTime(classEndDateTime);
+                        }else {
+                            if(date.after(startDateTime)){
+                                //小于课程结束时间
+                                upsetAttendance(userId,startDateTime,date,courseSchedules.get(i));
                             }
                         }
                     }
-                } else {
-                    studentAttendance.setStatus(statusEnum);
-                    studentAttendance.setSignOutTime(date);
                 }
-                if (studentAttendance.getSignOutTime() == null) {
-                    studentAttendance.setStatus(statusEnum);
-                    studentAttendance.setSignOutTime(date);
-                }
-            } else {
-                studentAttendance.setStatus(statusEnum);
-                studentAttendance.setSignOutTime(date);
             }
         }
         studentAttendanceDao.update(studentAttendance);
     }
 
+    public void upsetAttendance(Integer userId,Date signInTime,Date signOutTime,CourseSchedule courseSchedule){
+        StudentAttendance studentAttendance = studentAttendanceDao.findByStatusAndCourseScheduleId(userId, courseSchedule.getId().intValue());
+        if(studentAttendance == null){
+            studentAttendance = new StudentAttendance();
+            studentAttendance.setSignOutTime(signOutTime);
+            studentAttendance.setStatus(StudentAttendanceStatusEnum.NORMAL);
+            studentAttendance.setSignInTime(signInTime);
+            studentAttendance.setUserId(userId);
+            studentAttendance.setTeacherId(courseSchedule.getActualTeacherId());
+            studentAttendance.setClassGroupId(courseSchedule.getClassGroupId());
+            studentAttendance.setCourseScheduleId(courseSchedule.getId());
+            studentAttendance.setMusicGroupId(courseSchedule.getMusicGroupId());
+            studentAttendance.setGroupType(courseSchedule.getGroupType());
+            studentAttendanceDao.insert(studentAttendance);
+        }else {
+            studentAttendance.setSignOutTime(signOutTime);
+            studentAttendance.setStatus(StudentAttendanceStatusEnum.NORMAL);
+            studentAttendance.setSignInTime(signInTime);
+            studentAttendanceDao.update(studentAttendance);
+        }
+
+    }
+
     @Override
     public PageInfo<StudentAttendance> findStudentAttendance(QueryInfo queryInfo) {
         PageInfo<StudentAttendance> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java

@@ -266,7 +266,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         if (StringUtils.isNotEmpty(goodsJson)) {
             List<RepairGoodsDto> repairGoodsDtos = JSONObject.parseArray(goodsJson, RepairGoodsDto.class);
             List<Integer> goodsIds = repairGoodsDtos.stream().map(e -> e.getId()).collect(Collectors.toList());
-            Map<Integer, BigDecimal> map = getMap("goods", "id_", "group_purchase_price_", goodsIds, Integer.class, BigDecimal.class);
+            Map<Integer, BigDecimal> map = getMap("goods", "id_", "market_price_", goodsIds, Integer.class, BigDecimal.class);
             repairGoodsDtos.forEach(e -> {
                 e.setGroupPurchasePrice(map.get(e.getId()));
             });

+ 86 - 75
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherAttendanceServiceImpl.java

@@ -276,13 +276,9 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 		Date classEndDateTime = DateUtil.stringToDate(classDate + " " + endClassTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
 //		Date classEndDateAdd60Minutes = DateUtil.addMinutes(classEndDateTime, 60);
 //		Date classEndDateCut10Minutes = DateUtil.addMinutes(classEndDateTime, -10);
-		Date add1Minutes = DateUtil.addMinutes(classStartDateTime, -1);
+
 //		Date add60Minutes = DateUtil.addMinutes(classStartDateTime, -60);
 		//签到
-		String continueCourseTime = sysConfigDao.findConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME);
-		if(StringUtils.isEmpty(continueCourseTime)){
-			continueCourseTime = "5";
-		}
 		if(teacherAttendance.getSignInTime() == null && SignStatusEnum.SIGN_IN.equals(signStatus)){
 			YesOrNoEnum yesOrNoEnum = courseScheduleService.enableOnlyNormalAttendance(courseSchedule.getStartClassTime(),
 					userId.longValue(),
@@ -291,33 +287,30 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 			teacherAttendance.setSignInTime(date);
 			teacherAttendance.setSignInStatus(YesOrNoEnum.YES);
 			teacherAttendance.setCurrentClassTimes(classGroup.getCurrentClassTimes() + 1);
-			boolean isSign = false;
-			if(yesOrNoEnum == YesOrNoEnum.YES){
-				isSign = true;
-			}else if(DateUtil.minutesBetween(date,add1Minutes) > 0){
-				//正常签到范围(开始之前)
-				isSign = true;
-			}else {
-				//异常签到范围(开始之后)
-				isSign = true;
+			Date add1Minutes = DateUtil.addMinutes(classStartDateTime, -1);
+			if(yesOrNoEnum != YesOrNoEnum.YES && DateUtil.minutesBetween(date,add1Minutes) <= 0){
 				teacherAttendance.setSignInStatus(YesOrNoEnum.NO);
 			}
-			if(isSign){
-				teacherAttendanceDao.update(teacherAttendance);
-				if(courseSchedule.getTeachMode() == TeachModeEnum.ONLINE){
-					//获取所有当前课程的学生列表
-					Map<Integer,String> userMap = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertMybatisMap(courseScheduleDao.findStudentMap(courseScheduleId))),HashMap.class);
-					if(userMap != null && userMap.size() > 0){
-						String name = subjectDao.findNames(classGroup.getSubjectIdList());
-						sysMessageService.batchSendMessage(MessageSender.JIGUANG,MessageTypeEnum.STUDENT_PUSH_ONLINE_COURSE_ACTION,userMap,
-								null,0,"6?sealClassId=" + courseScheduleId + "&subjectName=" + name ,"STUDENT",courseSchedule.getName());
-					}
+			teacherAttendanceDao.update(teacherAttendance);
+			if(courseSchedule.getTeachMode() == TeachModeEnum.ONLINE){
+				//获取所有当前课程的学生列表
+				Map<Integer,String> userMap = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertMybatisMap(courseScheduleDao.findStudentMap(courseScheduleId))),HashMap.class);
+				if(userMap != null && userMap.size() > 0){
+					String name = subjectDao.findNames(classGroup.getSubjectIdList());
+					sysMessageService.batchSendMessage(MessageSender.JIGUANG,MessageTypeEnum.STUDENT_PUSH_ONLINE_COURSE_ACTION,userMap,
+							null,0,"6?sealClassId=" + courseScheduleId + "&subjectName=" + name ,"STUDENT",courseSchedule.getName());
 				}
 			}
 		}
 		//签退
 		if(SignStatusEnum.SIGN_OUT.equals(signStatus)){
-			if(DateUtil.minutesBetween(classEndDateTime,date) >= 0){
+			teacherAttendance.setSignOutStatus(YesOrNoEnum.YES);
+			teacherAttendance.setSignOutTime(date);
+			if(DateUtil.minutesBetween(classEndDateTime,date) > 0){
+				String continueCourseTime = sysConfigDao.findConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME);
+				if(StringUtils.isEmpty(continueCourseTime)){
+					continueCourseTime = "5";
+				}
 				List<CourseSchedule> courseSchedules = new ArrayList<>();
 				CourseSchedule cs = courseSchedule;
 				while (true){
@@ -334,62 +327,57 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 					}
 				}
 				if(courseSchedules.size() > 0){
-					//获取总上课时长
-					int totalMinutes = DateUtil.minutesBetween(classStartDateTime, date);
-					//减去第一节课时长
-					int firstMinutes = courseScheduleDao.getSingleClassMinutes(courseScheduleId.longValue());
-					totalMinutes -= firstMinutes;
-					if(totalMinutes > 0){
-						String courseClassDate;
-						String courseStartDateTime;
-						String courseEndDateTime;
-						for (int i = 0; i < courseSchedules.size(); i++) {
-							courseClassDate = DateUtil.format(courseSchedules.get(i).getClassDate(), DateUtil.DEFAULT_PATTERN);
-							courseStartDateTime = DateUtil.format(courseSchedules.get(i).getStartClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
-							courseEndDateTime = DateUtil.format(courseSchedules.get(i).getEndClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
-							Date startDateTime = DateUtil.stringToDate(courseClassDate + " " + courseStartDateTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
-							Date endDateTime = DateUtil.stringToDate(courseClassDate + " " + courseEndDateTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
-							Date signOutTime = date;
-							if(date.before(startDateTime)){
-								continue;
-							}
-							if(i < courseSchedules.size() - 1 && date.after(endDateTime)){
-								//不是最后一节连堂课,并且签退时间大于课程结束时间,签退时间等于课程结束时间
-								signOutTime = endDateTime;
-							}
-							//如果签退时间大于课程结束时间
-							//如果当前课程没有签退记录,那么正常更新
-							TeacherAttendance personalAttendance = teacherAttendanceDao.findByTeacherAttendanceInfo(userId.longValue(),courseSchedules.get(i).getId());
-							if(personalAttendance != null && personalAttendance.getSignOutStatus() == YesOrNoEnum.NO){
-								continue;
-							}
-							//如果当前课程有签到时间,那么只更新签退时间和状态
-							if(personalAttendance.getSignInTime() != null){
-								startDateTime = null;
-							}
-							if(personalAttendance.getSignOutTime() != null){
-								continue;
-							}
+					String courseClassDate;
+					String courseStartDateTime;
+					String courseEndDateTime;
+					String format2 = DateUtil.format(courseSchedule.getClassDate(), DateUtil.DEFAULT_PATTERN);
+					String format3 = DateUtil.format(courseSchedule.getEndClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
+					Date date1 = DateUtil.stringToDate(format2 + " " + format3, DateUtil.EXPANDED_DATE_TIME_FORMAT);
+					teacherAttendance.setSignOutTime(date1);
+					for (int i = 0; i < courseSchedules.size(); i++) {
+						courseClassDate = DateUtil.format(courseSchedules.get(i).getClassDate(), DateUtil.DEFAULT_PATTERN);
+						courseStartDateTime = DateUtil.format(courseSchedules.get(i).getStartClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
+						Date startDateTime = DateUtil.stringToDate(courseClassDate + " " + courseStartDateTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
+
+						//如果是接下来的第一节连堂课,并且签退时间不大于课程开始时间,那么跳出循环
+						if(i == 0 && !date.after(startDateTime)){
+							teacherAttendance.setSignOutTime(date);
+							break;
+						}
+						courseEndDateTime = DateUtil.format(courseSchedules.get(i).getEndClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
+						Date endDateTime = DateUtil.stringToDate(courseClassDate + " " + courseEndDateTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
+						//不是最后一节课
+						if(i < courseSchedules.size() - 1){
+							//大于课程结束时间
 							if(date.after(endDateTime)){
-								teacherAttendanceDao.cuntinueCourseSign(courseSchedules.get(i).getId(),startDateTime,signOutTime,1);
-							}else if (date.equals(endDateTime)){
-								teacherAttendanceDao.cuntinueCourseSign(courseSchedules.get(i).getId(),startDateTime,signOutTime,1);
+								String format = DateUtil.format(courseSchedules.get(i + 1).getClassDate(), DateUtil.DEFAULT_PATTERN);
+								String format1 = DateUtil.format(courseSchedules.get(i + 1).getStartClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
+								Date stringToDate = DateUtil.stringToDate(format + " " + format1, DateUtil.EXPANDED_DATE_TIME_FORMAT);
+								//大于下一节课开始时间
+								if(date.after(stringToDate)){
+									//当前课程签退时间为课程结束时间
+									upsetAttendance(userId,startDateTime,endDateTime,YesOrNoEnum.YES,courseSchedules.get(i));
+								}else {
+									//当前课程签退时间为退出时间
+									upsetAttendance(userId,startDateTime,date,YesOrNoEnum.YES,courseSchedules.get(i));
+								}
 							}else {
-								teacherAttendanceDao.cuntinueCourseSign(courseSchedules.get(i).getId(),startDateTime,signOutTime,0);
+								if(date.after(startDateTime)){
+									//小于课程结束时间,异常签退
+									upsetAttendance(userId,startDateTime,date,YesOrNoEnum.NO,courseSchedules.get(i));
+								}
+								break;
 							}
-							if(teacherAttendance.getSignOutTime() == null){
-								teacherAttendance.setSignOutStatus(YesOrNoEnum.YES);
-								teacherAttendance.setSignOutTime(classEndDateTime);
+						}else {
+							if(date.after(startDateTime)){
+								if(date.after(endDateTime)){
+									upsetAttendance(userId,startDateTime,date,YesOrNoEnum.YES,courseSchedules.get(i));
+								}else {
+									upsetAttendance(userId,startDateTime,date,YesOrNoEnum.NO,courseSchedules.get(i));
+								}
 							}
 						}
 					}
-				}else {
-					teacherAttendance.setSignOutStatus(YesOrNoEnum.YES);
-					teacherAttendance.setSignOutTime(date);
-				}
-				if(teacherAttendance.getSignOutTime() == null){
-					teacherAttendance.setSignOutStatus(YesOrNoEnum.YES);
-					teacherAttendance.setSignOutTime(date);
 				}
 			}else {
 				teacherAttendance.setSignOutStatus(YesOrNoEnum.NO);
@@ -399,6 +387,29 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 		}
 	}
 
+	public void upsetAttendance(Integer userId,Date signInTime,Date signOutTime,YesOrNoEnum status,CourseSchedule courseSchedule){
+		TeacherAttendance teacherAttendance = teacherAttendanceDao.findByTeacherAttendanceInfo(userId.longValue(),courseSchedule.getId());
+		if(teacherAttendance == null){
+			teacherAttendance = new TeacherAttendance();
+			teacherAttendance.setGroupType(courseSchedule.getGroupType());
+			teacherAttendance.setTeacherId(userId);
+			teacherAttendance.setMusicGroupId(courseSchedule.getMusicGroupId());
+			teacherAttendance.setClassGroupId(courseSchedule.getClassGroupId());
+			teacherAttendance.setCourseScheduleId(courseSchedule.getId());
+			teacherAttendance.setSignInStatus(YesOrNoEnum.YES);
+			teacherAttendance.setSignOutStatus(status);
+			teacherAttendance.setSignOutTime(signOutTime);
+			teacherAttendance.setSignInTime(signInTime);
+			teacherAttendanceDao.insert(teacherAttendance);
+		}else {
+			teacherAttendance.setSignInStatus(YesOrNoEnum.YES);
+			teacherAttendance.setSignOutStatus(status);
+			teacherAttendance.setSignOutTime(signOutTime);
+			teacherAttendance.setSignInTime(signInTime);
+			teacherAttendanceDao.update(teacherAttendance);
+		}
+	}
+
 	@Override
 	public PageInfo getTeacherPersonalAttendances(TeacherCloseQueryInfo queryInfo) {
 		PageInfo<TeacherPersonalAttendanceDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -3114,7 +3114,7 @@
         WHERE cs.class_group_id_ = #{classGroupId}
         AND TIMESTAMPDIFF(MINUTE, CONCAT(cs.class_date_," ",cs.end_class_time_),#{startTime}) &lt;= #{continueCourseTime}
         AND TIMESTAMPDIFF(MINUTE, CONCAT(cs.class_date_," ",cs.end_class_time_),#{startTime}) >= 0
-        AND cs.actual_teacher_id_ = #{teacherId} AND ta.sign_in_time_ IS NOT NULL AND sa.id_ IS NOT NULL
+        AND cs.actual_teacher_id_ = #{teacherId}
         ORDER BY cs.class_date_ DESC,cs.end_class_time_ DESC
         LIMIT 1
     </select>

+ 8 - 1
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml

@@ -263,7 +263,7 @@
     </resultMap>
     <select id="getCalenderPushDto" resultMap="CalenderPushDto">
         SELECT mgpc.id_,mgpc.payment_valid_start_date_,mgpc.payment_valid_end_date_,
-        mg.educational_teacher_id_,su.real_name_,mg.name_,su.phone_
+        mg.educational_teacher_id_,mg.name_,su.phone_
         FROM music_group_payment_calender mgpc
         LEFT JOIN music_group mg ON mgpc.music_group_id_ = mg.id_
         LEFT JOIN sys_user su ON su.id_ = mg.educational_teacher_id_
@@ -272,4 +272,11 @@
             #{item}
         </foreach>
     </select>
+    <select id="getMusicCalenderPushDto" resultMap="CalenderPushDto">
+        SELECT mg.payment_valid_start_date_,mg.payment_valid_end_date_,
+        mg.educational_teacher_id_,su.phone_ FROM music_group mg
+        LEFT JOIN sys_user su ON mg.educational_teacher_id_ = su.id_
+        WHERE mg.payment_valid_end_date_ IS NOT NULL AND
+        DATEDIFF(#{format},DATE_FORMAT(mg.payment_valid_end_date_,'%Y-%m-%d')) = #{configValue}
+    </select>
 </mapper>

+ 3 - 2
mec-biz/src/main/resources/config/mybatis/StudentAttendanceMapper.xml

@@ -41,7 +41,8 @@
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.StudentAttendance" useGeneratedKeys="true"
             keyColumn="id" keyProperty="id">
         INSERT INTO student_attendance
-        (group_type_,music_group_id_,class_group_id_,course_schedule_id_,user_id_,teacher_id_,status_,create_time_,update_time_,remark_,current_class_times_,sign_in_time_,sign_out_time_)
+        (group_type_,music_group_id_,class_group_id_,course_schedule_id_,user_id_,teacher_id_,status_,create_time_,
+        update_time_,remark_,current_class_times_,sign_in_time_,sign_out_time_)
         VALUES(#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{musicGroupId},#{classGroupId},
         #{courseScheduleId},#{userId},#{teacherId},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),now(),
         #{remark},#{currentClassTimes},#{signInTime},#{signOutTime})
@@ -103,7 +104,7 @@
             <if test="currentClassTimes != null">
                 current_class_times_ = #{currentClassTimes},
             </if>
-            update_time_=NOW()
+            update_time_ = NOW()
         </set>
         WHERE id_ = #{id}
     </update>

+ 2 - 2
mec-biz/src/main/resources/config/mybatis/StudentGoodsSellMapper.xml

@@ -95,8 +95,8 @@
 			<if test="studentId != null">
 				AND sgs.user_id_ = #{studentId}
 			</if>
-			<if test="paymentStatus != null">
-				AND spo.status_ = #{paymentStatus}
+			<if test="status != null">
+				AND spo.status_ = #{status}
 			</if>
 		</where>
 	</sql>

+ 43 - 57
mec-im/src/main/java/com/ym/controller/RoomController.java

@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
 import com.ym.common.ApiException;
 import com.ym.common.BaseResponse;
 import com.ym.common.ErrorEnum;
-import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.pojo.*;
 import com.ym.service.MessageService;
 import com.ym.service.RoomService;
@@ -25,32 +24,25 @@ public class RoomController{
     RoomService roomService;
     @Autowired
     MessageService messageService;
-    @Autowired
-    SysUserFeignService sysUserFeignService;
 
     @RequestMapping(value = "/join", method = RequestMethod.POST)
-    public Object joinRoom(@RequestBody ReqUserData data)
-            throws ApiException, Exception {
-        RoomResult roomResult = roomService.joinRoom(data.getUserName(), data.getRoomId(), data.isAudience(), data.isDisableCamera(),data.isMusicMode());
-        return new BaseResponse<>(roomResult);
-    }
-
-    @RequestMapping(value = "/queryNoJoinStu", method = RequestMethod.GET)
-    public Object queryNoJoinStu(String roomId){
-        return new BaseResponse<>(roomService.queryNoJoinStu(roomId));
+    public Object joinRoom(@RequestBody ReqUserData data) throws Exception {
+        return new BaseResponse<>(roomService.joinRoom(data.getRoomId()));
     }
 
     @RequestMapping(value = "/signIn", method = RequestMethod.POST)
     public Object signIn(Long roomId){
-        roomService.signIn(roomId);
         return new BaseResponse<>();
     }
 
     @RequestMapping(value = "/leave", method = RequestMethod.POST)
-    public Object leaveRoom(@RequestBody ReqUserData data)
-            throws ApiException, Exception {
-        boolean result = roomService.leaveRoom(data.getRoomId());
-        return new BaseResponse<>(result);
+    public Object leaveRoom(@RequestBody ReqUserData data){
+        return new BaseResponse<>();
+    }
+
+    @RequestMapping(value = "/queryNoJoinStu", method = RequestMethod.GET)
+    public Object queryNoJoinStu(String roomId){
+        return new BaseResponse<>(roomService.queryNoJoinStu(roomId));
     }
 
     @RequestMapping(value = "/sendImPlayMidiMessage", method = RequestMethod.POST)
@@ -60,40 +52,34 @@ public class RoomController{
     }
 
     @RequestMapping(value = "/statusSync")
-    public Object statusSync(@RequestBody String body) throws Exception {
+    public void statusSync(@RequestBody String body) throws Exception {
         ChannelStateNotify notify = JSONObject.parseObject(body, ChannelStateNotify.class);
         log.info("statusSyncParam: {}",JSONObject.toJSON(notify));
-        boolean result = false;
-        if(notify.getEvent() == 12 || notify.getEvent() == 3){
-            result = roomService.statusSync(notify.getChannelId(), notify.getUserId());
-        }else if(notify.getEvent() == 11){
-//            Teacher teacher = teacherDao.get(Integer.parseInt(notify.getUserId()));
-//            Long roomId = Long.parseLong(notify.getChannelId().substring(1));
-//            CourseSchedule courseSchedule = courseScheduleDao.get(roomId);
-//            if(teacher != null && teacher.getId().equals(courseSchedule.getActualTeacherId())){
-//                roomService.joinRoom(teacher.getRealName(),roomId.toString(),false,false);
-//            }else {
-//                roomService.joinRoom(teacher.getUsername(),roomId.toString(),false,false);
-//            }
+        String roomId = notify.getChannelId();
+        String userId = notify.getUserId();
+        switch (notify.getEvent()){
+            case 11:
+                //成员加入
+                roomService.joinRoomSuccess(roomId, userId);
+                break;
+            case 12:
+                //成员退出
+                roomService.leaveRoomSuccess(roomId, userId);
+                break;
         }
-        return new BaseResponse<>(result);
-    }
-
-    @RequestMapping(value = "/statusImMsg")
-    public void statusImMsg(@RequestBody String body) throws Exception {
-        System.out.println("");
+//        roomService.statusSync(notify);
     }
 
     @RequestMapping(value = "/downgrade", method = RequestMethod.POST)
     public Object downRole(@RequestBody ReqChangeUserRoleData data)
-            throws ApiException, Exception {
+            throws Exception {
         boolean result = roomService.downgrade(data.getRoomId(), data.getUsers());
         return new BaseResponse<>(result);
     }
 
     @RequestMapping(value = "/kick", method = RequestMethod.POST)
     public Object kickMember(@RequestBody ReqUserData data)
-            throws ApiException, Exception {
+            throws Exception {
         boolean result = roomService.kickMember(data.getRoomId());
         return new BaseResponse<>(result);
     }
@@ -101,14 +87,14 @@ public class RoomController{
     //only teacher
     @RequestMapping(value = "/display", method = RequestMethod.POST)
     public Object display(@RequestBody ReqDisplayData data)
-            throws ApiException, Exception {
+            throws Exception {
         boolean result = roomService.display(data.getRoomId(), data.getType(), data.getUri(),data.getUserId());
         return new BaseResponse<>(result);
     }
 
     @RequestMapping(value = "/whiteboard/create", method = RequestMethod.POST)
     public Object createWhiteBoard(@RequestBody ReqWhiteboardData data)
-            throws ApiException, Exception {
+            throws Exception {
         String result = roomService.createWhiteBoard(data.getRoomId());
         return new BaseResponse<>(result);
     }
@@ -116,21 +102,21 @@ public class RoomController{
 
     @RequestMapping(value = "/whiteboard/delete", method = RequestMethod.POST)
     public Object destroyWhiteBoard(@RequestBody ReqWhiteboardData data)
-            throws ApiException, Exception {
+            throws Exception {
         boolean result = roomService.deleteWhiteboard(data.getRoomId(), data.getWhiteboardId());
         return new BaseResponse<>(result);
     }
 
     @RequestMapping(value = "/whiteboard/list", method = RequestMethod.GET)
     public Object getWhiteBoard(@RequestParam String roomId)
-            throws ApiException, Exception {
+            throws Exception {
         List<RoomResult.WhiteboardResult> whiteboards = roomService.getWhiteboard(roomId);
         return new BaseResponse<>(whiteboards);
     }
 
     @RequestMapping(value = "/device/approve", method = RequestMethod.POST)
     public Object approveControlDevice(@RequestBody ReqDeviceControlData data)
-            throws ApiException, Exception {
+            throws Exception {
         boolean result;
         result = roomService.approveControlDevice(data.getRoomId(), data.getTicket());
         return new BaseResponse<>(result);
@@ -138,7 +124,7 @@ public class RoomController{
 
     @RequestMapping(value = "/device/reject", method = RequestMethod.POST)
     public Object rejectControlDevice(@RequestBody ReqDeviceControlData data)
-            throws ApiException, Exception {
+            throws Exception {
         boolean result;
         result = roomService.rejectControlDevice(data.getRoomId(), data.getTicket());
         return new BaseResponse<>(result);
@@ -146,7 +132,7 @@ public class RoomController{
 
     @RequestMapping(value = "/device/control", method = RequestMethod.POST)
     public Object controlDevice(@RequestBody ReqDeviceControlData data)
-            throws ApiException, Exception {
+            throws Exception {
         boolean result;
         if (data.getCameraOn() != null) {
             result = roomService.controlDevice(data.getRoomId(), data.getUserId(), DeviceTypeEnum.Camera, data.getCameraOn());
@@ -171,7 +157,7 @@ public class RoomController{
 
     @RequestMapping(value = "/device/sync", method = RequestMethod.POST)
     public Object syncDeviceState(@RequestBody ReqDeviceControlData data)
-            throws ApiException, Exception {
+            throws Exception {
         boolean result;
         if (data.getCameraOn() != null) {
             result = roomService.syncDeviceState(data.getRoomId(), DeviceTypeEnum.Camera, data.getCameraOn());
@@ -189,70 +175,70 @@ public class RoomController{
 
     @RequestMapping(value = "/whiteboard/turn-page", method = RequestMethod.POST)
     public Object turnPage(@RequestBody ReqWhiteboardData data)
-            throws ApiException, Exception {
+            throws Exception {
         boolean result = roomService.turnWhiteBoardPage(data.getRoomId(), data.getWhiteboardId(), data.getPage());
         return new BaseResponse<>(result);
     }
 
     @RequestMapping(value = "/members", method = RequestMethod.GET)
     public Object getMembers(@RequestParam String roomId)
-            throws ApiException, Exception {
+            throws Exception {
         List<RoomResult.MemberResult> whiteboards = roomService.getMembers(roomId);
         return new BaseResponse<>(whiteboards);
     }
 
     @RequestMapping(value = "/speech/apply", method = RequestMethod.POST)
     public Object apply(@RequestBody ReqSpeechData data)
-            throws ApiException, Exception {
+            throws Exception {
         Boolean result = roomService.applySpeech(data.getRoomId());
         return new BaseResponse<>(result);
     }
 
     @RequestMapping(value = "/speech/approve", method = RequestMethod.POST)
     public Object approval(@RequestBody ReqSpeechData data)
-            throws ApiException, Exception {
+            throws Exception {
         Boolean result = roomService.approveSpeech(data.getRoomId(), data.getTicket());
         return new BaseResponse<>(result);
     }
 
     @RequestMapping(value = "/speech/reject", method = RequestMethod.POST)
     public Object reject(@RequestBody ReqSpeechData data)
-            throws ApiException, Exception {
+            throws Exception {
         Boolean result = roomService.rejectSpeech(data.getRoomId(), data.getTicket());
         return new BaseResponse<>(result);
     }
 
     @RequestMapping(value = "/transfer", method = RequestMethod.POST)
     public Object transfer(@RequestBody ReqUpgradeRoleData data)
-            throws ApiException, Exception {
+            throws Exception {
         Boolean result = roomService.transfer(data.getRoomId(), data.getUserId());
         return new BaseResponse<>(result);
     }
 
     @RequestMapping(value = "/upgrade/invite", method = RequestMethod.POST)
     public Object inviteUpgradeRole(@RequestBody ReqUpgradeRoleData data)
-            throws ApiException, Exception {
+            throws Exception {
         Boolean result = roomService.inviteUpgradeRole(data.getRoomId(), data.getUserId(), data.getRole());
         return new BaseResponse<>(result);
     }
 
     @RequestMapping(value = "/upgrade/approve", method = RequestMethod.POST)
     public Object approveUpgradeRole(@RequestBody ReqUpgradeRoleData data)
-            throws ApiException, Exception {
+            throws Exception {
         Boolean result = roomService.approveUpgradeRole(data.getRoomId(), data.getTicket());
         return new BaseResponse<>(result);
     }
 
     @RequestMapping(value = "/upgrade/reject", method = RequestMethod.POST)
     public Object rejectUpgradeRole(@RequestBody ReqUpgradeRoleData data)
-            throws ApiException, Exception {
+            throws Exception {
         Boolean result = roomService.rejectUpgradeRole(data.getRoomId(), data.getTicket());
         return new BaseResponse<>(result);
     }
 
     @RequestMapping(value = "/change-role", method = RequestMethod.POST)
     public Object changeRole(@RequestBody ReqChangeRole data)
-            throws ApiException, Exception {
+            throws Exception {
         Boolean result = roomService.changeRole(data.getRoomId(), data.getUserId(), data.getRole());
         return new BaseResponse<>(result);
     }
@@ -262,7 +248,7 @@ public class RoomController{
                                      @RequestParam(value = "timestamp", required = false) String timestamp,
                                      @RequestParam(value = "nonce", required = false) String nonce,
                                      @RequestParam(value = "signature", required = false) String signature)
-            throws ApiException, Exception {
+            throws Exception {
         Boolean result = roomService.memberOnlineStatus(statusList, nonce, timestamp, signature);
         return new BaseResponse<>(result);
     }

+ 0 - 2
mec-im/src/main/java/com/ym/dao/HereWhiteDao.java

@@ -7,7 +7,5 @@ import org.springframework.stereotype.Repository;
 @Repository
 public interface HereWhiteDao extends JpaRepository<HereWhite, Long> {
 
-    HereWhite findById(Integer id);
-
     HereWhite findByCourseScheduleId(Integer id);
 }

+ 5 - 13
mec-im/src/main/java/com/ym/dao/RoomDao.java

@@ -16,26 +16,18 @@ import java.util.List;
  */
 @Repository
 public interface RoomDao extends JpaRepository<Room, Long> {
-    public List<Room> findByRid(String rid);
+    Room findByRid(String rid);
 
-    @Transactional
     @Modifying
-    public int deleteByRid(String rid);
+    int deleteByRid(String rid);
 
-    public boolean existsByRid(String rid);
+    boolean existsByRid(String rid);
 
-    @Transactional
     @Modifying
     @Query(value = "update rongyun_room set display=?2 where rid=?1", nativeQuery = true)
-    public int updateDisplayByRid(String rid, String display);
+    int updateDisplayByRid(String rid, String display);
 
-    @Transactional
-    @Modifying
-    @Query(value = "update rongyun_room set play_midi_json=?2 where rid=?1", nativeQuery = true)
-    public int updatePlayMidiByRid(String rid, String playMidi);
-
-    @Transactional
     @Modifying
     @Query(value = "update rongyun_room set whiteboard_name_index=?2 where rid=?1", nativeQuery = true)
-    public int updateWhiteboardNameIndexByRid(String rid, int whiteboardNameIndex);
+    int updateWhiteboardNameIndexByRid(String rid, int whiteboardNameIndex);
 }

+ 17 - 31
mec-im/src/main/java/com/ym/dao/RoomMemberDao.java

@@ -6,7 +6,6 @@ import org.springframework.data.jpa.repository.Lock;
 import org.springframework.data.jpa.repository.Modifying;
 import org.springframework.data.jpa.repository.Query;
 import org.springframework.stereotype.Repository;
-import org.springframework.transaction.annotation.Transactional;
 
 import javax.persistence.LockModeType;
 import java.util.List;
@@ -16,64 +15,51 @@ import java.util.List;
  */
 @Repository
 public interface RoomMemberDao extends JpaRepository<RoomMember, Long> {
-    public List<RoomMember> findByRid(String rid);
+    List<RoomMember> findByRid(String rid);
 
     @Lock(value = LockModeType.PESSIMISTIC_WRITE)
-    public List<RoomMember> findByRidAndUid(String rid, String uid);
+    RoomMember findByRidAndUid(String rid, String uid);
 
-    public List<RoomMember> findByRidAndRole(String rid, int role);
+    List<RoomMember> findByRidAndRole(String rid, int role);
 
-    public List<RoomMember> findByUid(String uid);
-
-    public int countByRidAndRole(String rid, int role);
+    List<RoomMember> findByUid(String uid);
 
     @Modifying
-    @Transactional
-    public int deleteByRid(String roomId);
+    int deleteByRid(String roomId);
 
     @Query(value = "select count(*) from rongyun_room_member where rid=?1", nativeQuery = true)
-    public int countByRid(String roomId);
+    int countByRid(String roomId);
 
     @Query(value = "select count(*) from rongyun_room_member where rid=?1 and role!=?2", nativeQuery = true)
-    public int countByRidAndExcludeRole(String roomId, int excludeRole);
+    int countByRidAndExcludeRole(String roomId, int excludeRole);
 
-    @Transactional
     @Modifying
     @Query(value = "delete from rongyun_room_member where rid=?1 and uid=?2", nativeQuery = true)
-    public int deleteUserByRidAndUid(String rid, String uid);
+    int deleteUserByRidAndUid(String rid, String uid);
 
-    @Transactional
     @Modifying
     @Query(value = "update rongyun_room_member set role=?3 where rid=?1 and uid=?2", nativeQuery = true)
-    public int updateRoleByRidAndUid(String rid, String uid, int role);
-
-    @Transactional
-    @Modifying
-    @Query(value = "update rongyun_room_member set role=?3 where rid=?1 and role=?2", nativeQuery = true)
-    public int updateRoleByRidAndRole(String rid, int role);
+    int updateRoleByRidAndUid(String rid, String uid, int role);
 
-    @Transactional
     @Modifying
     @Query(value = "update rongyun_room_member set camera=?3 where rid=?1 and uid=?2", nativeQuery = true)
-    public int updateCameraByRidAndUid(String rid, String uid, boolean camera);
+    int updateCameraByRidAndUid(String rid, String uid, boolean camera);
 
-    @Transactional
     @Modifying
     @Query(value = "update rongyun_room_member set mic=?3 where rid=?1 and uid=?2", nativeQuery = true)
-    public int updateMicByRidAndUid(String rid, String uid, boolean mic);
+    int updateMicByRidAndUid(String rid, String uid, boolean mic);
 
-    @Transactional
     @Modifying
     @Query(value = "update rongyun_room_member set hand=?3 where rid=?1 and uid=?2", nativeQuery = true)
-    public int updateHandByRidAndUid(String rid, String uid, boolean hand);
+    int updateHandByRidAndUid(String rid, String uid, boolean hand);
 
-    @Transactional
     @Modifying
     @Query(value = "update rongyun_room_member set music_mode=?3 where rid=?1 and uid=?2", nativeQuery = true)
-    public int updateMusicByRidAndUid(String rid, String uid, boolean musicMode);
+    int updateMusicByRidAndUid(String rid, String uid, boolean musicMode);
 
-    public boolean existsByRidAndUid(String rid, String uid);
-
-    public boolean existsByRidAndRole(String rid, int role);
+    boolean existsByRidAndUid(String rid, String uid);
 
+    @Modifying
+    @Query(value = "DELETE FROM rongyun_room_member WHERE rid = ?1 AND uid != ?2", nativeQuery = true)
+    void deleteRoomMember(String roomId, String userId);
 }

+ 0 - 2
mec-im/src/main/java/com/ym/dao/SpeechDao.java

@@ -11,6 +11,4 @@ import java.util.List;
  */
 @Repository
 public interface SpeechDao extends CrudRepository<ScheduledTaskInfo, String> {
-
-    List<ScheduledTaskInfo> findByTicket(String ticket);
 }

+ 2 - 5
mec-im/src/main/java/com/ym/dao/UserDao.java

@@ -13,12 +13,9 @@ import java.util.List;
  */
 @Repository
 public interface UserDao extends JpaRepository<UserInfo, Long> {
-    //will query with "select * from TABLE where user_id = 'userId'"
-    public List<UserInfo> findByUid(String uid);
 
-    public List<UserInfo> findByName(String name);
+    UserInfo findByUid(String uid);
 
-    @Transactional
     @Modifying
-    public int deleteByUid(String uid);
+    int deleteByUid(String uid);
 }

+ 9 - 10
mec-im/src/main/java/com/ym/dao/WhiteboardDao.java

@@ -14,23 +14,22 @@ import java.util.List;
  */
 @Repository
 public interface WhiteboardDao extends JpaRepository<Whiteboard, Long> {
-    public List<Whiteboard> findByRid(String rid);
-    public List<Whiteboard> findByRidAndCreator(String rid, String creator);
-    public List<Whiteboard> findByRidAndWbid(String rid, String wbid);
+    List<Whiteboard> findByRid(String rid);
 
-    public int deleteByRid(String rid);
+    List<Whiteboard> findByRidAndCreator(String rid, String creator);
+
+    List<Whiteboard> findByRidAndWbid(String rid, String wbid);
+
+    int deleteByRid(String rid);
 
-    @Transactional
     @Modifying
-    public int deleteByWbid(String wbid);
+    int deleteByWbid(String wbid);
 
-    @Transactional
     @Modifying
     @Query(value = "delete from rongyun_whiteboard where rid=?1 and creator=?2", nativeQuery = true)
-    public int deleteByRidAndCreator(String rid, String creator);
+    int deleteByRidAndCreator(String rid, String creator);
 
-    @Transactional
     @Modifying
     @Query(value = "update rongyun_whiteboard set cur_pg=?3 where wbid=?2 and rid=?1", nativeQuery = true)
-    public int updatePageByRidAndWbid(String rid, String wbid, int page);
+    int updatePageByRidAndWbid(String rid, String wbid, int page);
 }

File diff suppressed because it is too large
+ 241 - 374
mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java


+ 28 - 36
mec-im/src/main/java/com/ym/service/RoomService.java

@@ -1,7 +1,5 @@
 package com.ym.service;
 
-import com.ym.common.ApiException;
-import com.ym.mec.biz.dal.dto.BasicUserDto;
 import com.ym.mec.biz.dal.dto.RongyunBasicUserDto;
 import com.ym.pojo.*;
 
@@ -12,62 +10,61 @@ import java.util.List;
  */
 public interface RoomService {
     //everyone
-    public RoomResult joinRoom(String userName, String roomId, boolean isAudience, boolean isDisableCamera,boolean isMusicMode) throws ApiException, Exception;
-
-    void signIn(Long roomId);
-
-    public Boolean leaveRoom(String roomId) throws ApiException, Exception;
+    RoomResult joinRoom(String roomId) throws Exception;
 
     //only host
-    public Boolean downgrade(String roomId, List<ReqChangeUserRoleData.ChangedUser> users) throws ApiException, Exception;
+    Boolean downgrade(String roomId, List<ReqChangeUserRoleData.ChangedUser> users) throws Exception;
+
+    Boolean kickMember(String roomId) throws Exception;
 
-    public Boolean kickMember(String roomId) throws ApiException, Exception;
+    public void joinRoomSuccess(String roomId,String userId) throws Exception;
 
+    public void leaveRoomSuccess(String roomId,String userId) throws Exception;
 
     //only teacher
-    public Boolean display(String roomId, int type, String uri, String userId) throws ApiException, Exception;
+    Boolean display(String roomId, int type, String uri, String userId) throws Exception;
 
-    public String createWhiteBoard(String roomId) throws ApiException, Exception;
+    String createWhiteBoard(String roomId) throws Exception;
 
-    public Boolean deleteWhiteboard(String roomId, String whiteBoardId) throws ApiException, Exception;
+    Boolean deleteWhiteboard(String roomId, String whiteBoardId) throws Exception;
 
-    public List<RoomResult.WhiteboardResult> getWhiteboard(String roomId) throws ApiException, Exception;
+    List<RoomResult.WhiteboardResult> getWhiteboard(String roomId) throws Exception;
 
-    public Boolean turnWhiteBoardPage(String roomId, String whiteBoardId, int page) throws ApiException, Exception;
+    Boolean turnWhiteBoardPage(String roomId, String whiteBoardId, int page) throws Exception;
 
-    public Boolean controlDevice(String roomId, String userId, DeviceTypeEnum type, boolean enable) throws ApiException, Exception;
+    Boolean controlDevice(String roomId, String userId, DeviceTypeEnum type, boolean enable) throws Exception;
 
     Boolean batchControlDevice(ReqDeviceControlData data) throws Exception;
 
-    public Boolean approveControlDevice(String roomId, String ticket) throws ApiException, Exception;
+    Boolean approveControlDevice(String roomId, String ticket) throws Exception;
 
-    public Boolean rejectControlDevice(String roomId, String ticket) throws ApiException, Exception;
+    Boolean rejectControlDevice(String roomId, String ticket) throws Exception;
 
 
-    public List<RoomResult.MemberResult> getMembers(String roomId) throws  ApiException, Exception;
+    List<RoomResult.MemberResult> getMembers(String roomId) throws  Exception;
 
-    public Boolean applySpeech(String roomId) throws  ApiException, Exception;
+    Boolean applySpeech(String roomId) throws  Exception;
 
-    public Boolean approveSpeech(String roomId, String requestId) throws  ApiException, Exception;
+    Boolean approveSpeech(String roomId, String requestId) throws  Exception;
 
-    public Boolean rejectSpeech(String roomId, String requestId) throws  ApiException, Exception;
+    Boolean rejectSpeech(String roomId, String requestId) throws  Exception;
 
 
-    public Boolean transfer(String roomId, String userId) throws ApiException, Exception;
+    Boolean transfer(String roomId, String userId) throws Exception;
 
-    public Boolean inviteUpgradeRole(String roomId, String userId, int role) throws  ApiException, Exception;
-    public Boolean approveUpgradeRole(String roomId, String ticket) throws ApiException, Exception;
-    public Boolean rejectUpgradeRole(String roomId, String ticket) throws ApiException, Exception;
+    Boolean inviteUpgradeRole(String roomId, String userId, int role) throws  Exception;
+    Boolean approveUpgradeRole(String roomId, String ticket) throws Exception;
+    Boolean rejectUpgradeRole(String roomId, String ticket) throws Exception;
 
-    public Boolean syncDeviceState(String roomId, DeviceTypeEnum type, boolean enable) throws ApiException, Exception;
+    Boolean syncDeviceState(String roomId, DeviceTypeEnum type, boolean enable) throws Exception;
 
-    public Boolean changeRole(String roomId, String userId, int role) throws ApiException, Exception;
+    Boolean changeRole(String roomId, String userId, int role) throws Exception;
 
-    public void destroyRoom(String roomId);
-    public Boolean memberOnlineStatus(List<ReqMemberOnlineStatus> statusList, String nonce, String timestamp, String signature) throws ApiException, Exception;
-    public void userIMOfflineKick(String userId);
+    void destroyRoom(String roomId);
+    Boolean memberOnlineStatus(List<ReqMemberOnlineStatus> statusList, String nonce, String timestamp, String signature) throws Exception;
+    void userIMOfflineKick(String userId);
 
-    boolean statusSync(String roomId,String userId) throws Exception;
+    void statusSync(ChannelStateNotify notify) throws Exception;
 
     /**
      * 发送节拍器消息
@@ -80,9 +77,4 @@ public interface RoomService {
      * @return
      */
     List<RongyunBasicUserDto> queryNoJoinStu(String roomId);
-
-    /**
-     * 发送节拍器自定义消息
-     */
-//    void sendImPlayMidiMessage(PlayMidiMessageData playMidiMessageData);
 }

Some files were not shown because too many files changed in this diff