Browse Source

连堂课规则调整

zouxuan 3 years ago
parent
commit
bf6f18bbbe

+ 4 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/SysConfigService.java

@@ -46,6 +46,10 @@ public interface SysConfigService extends BaseService<Long, SysConfig> {
     String LABOUR_TEACHER_SALARY = "labour_teacher_salary";
     //劳务考勤申诉时间限制方式(1、固定时间、2、固定日期)
     String LABOUR_TEACHER_SALARY_TYPE = "labour_teacher_salary_type";
+    //线上连堂课间隔时间
+    String ONLINE_CONTINUE_COURSE_TIME = "online_continue_course_time";
+    //线上连堂课间隔时间
+    String OFFLINE_CONTINUE_COURSE_MINUTES = "offline_continue_course_minutes";
 
     public static final String BASE_API_URL = "base_api_url";
 
@@ -176,10 +180,6 @@ public interface SysConfigService extends BaseService<Long, SysConfig> {
      */
     String SMS_MAX_TIMES = "sms_max_times";
 
-    /**
-     * 连堂课间隔时间
-     */
-    String ONLINE_CONTINUE_COURSE_TIME = "online_continue_course_time";
 
     /**
      * 连堂课间隔时间

+ 4 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/SysTenantConfigService.java

@@ -6,15 +6,16 @@ import com.ym.mec.common.service.BaseService;
 
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 public interface SysTenantConfigService extends BaseService<Integer, SysTenantConfig> {
-    void setTenantConfig(Map<Integer,Map<String,String>> tenantConfig);
+    void setTenantConfig(ConcurrentHashMap<Integer,ConcurrentHashMap<String,String>> tenantConfig);
 
-    Map<String,String> getTenantConfig(Integer tenantId);
+    ConcurrentHashMap<String,String> getTenantConfig(Integer tenantId);
 
     String getTenantConfigValue(Integer tenantId,String paramName);
 
-    Map<Integer,Map<String,String>> getAllTenantConfig();
+    ConcurrentHashMap<Integer,ConcurrentHashMap<String,String>> getAllTenantConfig();
 
     List<SysConfig> queryAll(Map<String, Object> params);
 

+ 16 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentAttendanceServiceImpl.java

@@ -582,7 +582,12 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
     public void addStudentAttendanceSignOut(Long firstCourseId, Integer userId) {
         Date date = new Date();
         CourseSchedule courseSchedule = courseScheduleDao.get(firstCourseId);
-        String continueCourseTime = sysConfigDao.findConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME);
+        String continueCourseTime = null;
+        if(courseSchedule.getTeachMode() == TeachModeEnum.OFFLINE){
+            continueCourseTime = sysTenantConfigService.getConfigValue(SysConfigService.OFFLINE_CONTINUE_COURSE_MINUTES,courseSchedule.getTenantId());
+        }else {
+            continueCourseTime = sysTenantConfigService.getConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME,courseSchedule.getTenantId());
+        }
         if (StringUtils.isEmpty(continueCourseTime)) {
             continueCourseTime = "5";
         }
@@ -692,8 +697,17 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
     public void repairStudentAttendance(Integer month) {
         //获取所有有老师考勤的课程记录,正常签退,当月线上课,有学员签到记录
         List<CourseSchedule> courseScheduleList = courseScheduleDao.queryScheduleByAttendance(month);
+        if(courseScheduleList == null || courseScheduleList.size() == 0){
+            return;
+        }
         //是否是连堂课
-        String continueCourseTime = sysConfigDao.findConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME);
+        String continueCourseTime = null;
+        CourseSchedule schedule = courseScheduleList.get(0);
+        if(schedule.getTeachMode() == TeachModeEnum.OFFLINE){
+            continueCourseTime = sysTenantConfigService.getConfigValue(SysConfigService.OFFLINE_CONTINUE_COURSE_MINUTES,schedule.getTenantId());
+        }else {
+            continueCourseTime = sysTenantConfigService.getConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME,schedule.getTenantId());
+        }
         if (StringUtils.isEmpty(continueCourseTime)) {
             continueCourseTime = "5";
         }

+ 9 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysTenantConfigServiceImpl.java

@@ -16,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.Collectors;
 
 @Service
@@ -29,7 +30,7 @@ public class SysTenantConfigServiceImpl extends BaseServiceImpl<Integer, SysTena
 		return sysTenantConfigDao;
 	}
 
-	Map<Integer,Map<String,String>> tenantConfig;
+	ConcurrentHashMap<Integer,ConcurrentHashMap<String,String>> tenantConfig;
 	private ApplicationEventPublisher applicationEventPublisher;
 
 	@Override
@@ -39,18 +40,18 @@ public class SysTenantConfigServiceImpl extends BaseServiceImpl<Integer, SysTena
 	}
 
 	@Override
-	public void setTenantConfig(Map<Integer, Map<String, String>> tenantConfig) {
+	public void setTenantConfig(ConcurrentHashMap<Integer, ConcurrentHashMap<String, String>> tenantConfig) {
 		this.tenantConfig = tenantConfig;
 	}
 
 	@Override
-	public Map<String, String> getTenantConfig(Integer tenantId) {
+	public ConcurrentHashMap<String, String> getTenantConfig(Integer tenantId) {
 		return tenantConfig.get(tenantId);
 	}
 
 	@Override
 	public String getTenantConfigValue(Integer tenantId,String paramName) {
-		Map<String, String> map = tenantConfig.get(tenantId);
+		ConcurrentHashMap<String, String> map = tenantConfig.get(tenantId);
 		if(map != null){
 			return map.get(paramName);
 		}
@@ -58,7 +59,7 @@ public class SysTenantConfigServiceImpl extends BaseServiceImpl<Integer, SysTena
 	}
 
 	@Override
-	public Map<Integer, Map<String, String>> getAllTenantConfig() {
+	public ConcurrentHashMap<Integer, ConcurrentHashMap<String, String>> getAllTenantConfig() {
 		return tenantConfig;
 	}
 
@@ -81,6 +82,9 @@ public class SysTenantConfigServiceImpl extends BaseServiceImpl<Integer, SysTena
 
 	@Override
 	public String getConfigValue(String paramName, Integer tenantId) {
+		if(tenantId == null){
+			return null;
+		}
 		return sysTenantConfigDao.getConfigValue(paramName, tenantId);
 	}
 

+ 8 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherAttendanceServiceImpl.java

@@ -362,8 +362,14 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 		List<CourseSchedule> courseSchedules = new ArrayList<>();
 		courseSchedules.add(courseSchedule);
 		CourseSchedule cs = courseSchedule;
-		String continueCourseTime = sysConfigDao.findConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME);
-		if(StringUtils.isEmpty(continueCourseTime)){
+		//是否是连堂课
+		String continueCourseTime = null;
+		if(courseSchedule.getTeachMode() == TeachModeEnum.OFFLINE){
+			continueCourseTime = sysTenantConfigService.getConfigValue(SysConfigService.OFFLINE_CONTINUE_COURSE_MINUTES,courseSchedule.getTenantId());
+		}else {
+			continueCourseTime = sysTenantConfigService.getConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME,courseSchedule.getTenantId());
+		}
+		if (StringUtils.isEmpty(continueCourseTime)) {
 			continueCourseTime = "5";
 		}
 		while (true){

+ 10 - 5
mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java

@@ -22,6 +22,7 @@ import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.TeachModeEnum;
 import com.ym.mec.biz.service.StudentAttendanceService;
 import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.biz.service.SysTenantConfigService;
 import com.ym.mec.biz.service.TeacherAttendanceService;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.im.IMHelper;
@@ -96,15 +97,18 @@ public class RoomServiceImpl implements RoomService {
     @Autowired
     private SysMusicScoreAccompanimentDao sysMusicScoreAccompanimentDao;
     @Autowired
+    private SysTenantConfigService sysTenantConfigService;
+    @Autowired
     private RedisTemplate<String,String> redisTemplate;
 
     @Override
     public Integer getCurrentCourseId(String roomId){
-        String continueCourseTime = sysConfigDao.findConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME);
-        if(StringUtils.isEmpty(continueCourseTime)){
+        CourseSchedule courseSchedule = courseScheduleDao.get(Long.parseLong(roomId));
+        //是否是连堂课
+        String continueCourseTime = sysTenantConfigService.getConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME,courseSchedule.getTenantId());
+        if (StringUtils.isEmpty(continueCourseTime)) {
             continueCourseTime = "5";
         }
-        CourseSchedule courseSchedule = courseScheduleDao.get(Long.parseLong(roomId));
         CourseSchedule schedule = courseSchedule;
         //如果当前课程是连堂课,那么获取第一节课的课程编号
         while (true){
@@ -135,8 +139,9 @@ public class RoomServiceImpl implements RoomService {
             throw new ApiException(ErrorEnum.JOIN_ROOM_ERROR);
         }
 
-        String continueCourseTime = sysConfigDao.findConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME);
-        if(StringUtils.isEmpty(continueCourseTime)){
+        //是否是连堂课
+        String continueCourseTime = sysTenantConfigService.getConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME,courseSchedule.getTenantId());
+        if (StringUtils.isEmpty(continueCourseTime)) {
             continueCourseTime = "5";
         }