Browse Source

课程规则设置

zouxuan 3 years ago
parent
commit
2011f258ca
31 changed files with 286 additions and 588 deletions
  1. 0 247
      cms/src/main/java/com/ym/mec/cms/service/SysConfigService.java
  2. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/DemoGroup.java
  3. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/PracticeGroup.java
  4. 3 3
      mec-biz/src/main/java/com/ym/mec/biz/event/listener/TenantConfigListener.java
  5. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleService.java
  6. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/EduPracticeGroupService.java
  7. 5 5
      mec-biz/src/main/java/com/ym/mec/biz/service/PracticeGroupService.java
  8. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentAttendanceService.java
  9. 14 30
      mec-biz/src/main/java/com/ym/mec/biz/service/SysConfigService.java
  10. 2 6
      mec-biz/src/main/java/com/ym/mec/biz/service/SysTenantConfigService.java
  11. 0 11
      mec-biz/src/main/java/com/ym/mec/biz/service/TeacherCourseScheduleService.java
  12. 35 14
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java
  13. 4 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleTeacherSalaryServiceImpl.java
  14. 8 5
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/DemoGroupServiceImpl.java
  15. 9 3
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/EduPracticeGroupServiceImpl.java
  16. 4 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/OnlineMusicGroupServiceImpl.java
  17. 57 94
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java
  18. 9 9
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentAttendanceServiceImpl.java
  19. 6 18
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysTenantConfigServiceImpl.java
  20. 9 9
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherAttendanceServiceImpl.java
  21. 5 92
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherCourseScheduleServiceImpl.java
  22. 7 7
      mec-biz/src/main/resources/config/mybatis/DemoGroupMapper.xml
  23. 12 2
      mec-biz/src/main/resources/config/mybatis/PracticeGroupMapper.xml
  24. 2 2
      mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java
  25. 14 11
      mec-student/src/main/java/com/ym/mec/student/controller/PracticeGroupController.java
  26. 4 1
      mec-student/src/main/java/com/ym/mec/student/controller/StudentCourseScheduleController.java
  27. 20 3
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/DemoGroupController.java
  28. 17 4
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherCourseScheduleController.java
  29. 1 1
      mec-util/src/main/java/com/ym/mec/util/collection/MapUtil.java
  30. 8 1
      mec-web/src/main/java/com/ym/mec/web/controller/PracticeGroupManageController.java
  31. 8 2
      mec-web/src/main/java/com/ym/mec/web/controller/education/EduPracticeGroupController.java

+ 0 - 247
cms/src/main/java/com/ym/mec/cms/service/SysConfigService.java

@@ -6,253 +6,6 @@ import com.ym.mec.common.service.BaseService;
 
 public interface SysConfigService extends BaseService<Long, SysConfig> {
 
-    public static final String BASE_API_URL = "base_api_url";
-
-    /**
-     * 缴费状态提前{}天刷新
-     */
-    public static final String REFRESH_PAYMENT_STATUS_EARLY_DAYS = "refresh_payment_status_early_days";
-
-    /**
-     * VIP课结束后,用户可申诉时间,为课程结束后的{}天
-     */
-    public static final String VIP_APPEAL_DAYS_RANGE = "vip_appeal_days_range";
-
-    /**
-     * 线下课最早打卡时间可提前分钟数
-     */
-    String OFFLINE_SIGN_IN_EARLY_FORWARD_TIME = "offline_sign_in_early_forward_time";
-
-    /**
-     * 老师正常打卡时间,为课程当天,距离开课时间前{}分钟
-     */
-    public static final String ADVANCE_SIGN_IN_MINUTES = "advance_sign_in_minutes";
-
-    String ADVANCE_SIGN_OUT_MINUTES = "advance_sign_out_minutes";
-
-    /**
-     * 老师可以打卡范围,为教学定位方圆{}米
-     */
-    public static final String ATTENDANCE_RANGE = "attendance_range";
-
-    /**
-     * 学生允许请假的时间,为开课前{}小时
-     */
-    public static final String ADVANCE_LEAVE_HOURS = "advance_leave_hours";
-
-    /**
-     * 最早请假提前时间
-     */
-    String EARLIEST_TIME_FOR_LEAVE="earliest_time_for_leave";
-
-    String ENABLE_TEACHER_COURSE_ADJUST_DEFAULT_HOURS = "enable_teacher_course_adjust_default_hours";
-
-    /**
-     * 单技课梯度结算规则设置
-     */
-    public static final String SIGLE_GRADIENT_SETTLEMENT_RULE = "sigle_gradient_settlement_rule";
-
-    /**
-     * 合奏课梯度结算规则设置
-     */
-    public static final String MAX_GRADIENT_SETTLEMENT_RULE = "max_gradient_settlement_rule";
-
-    /**
-     * 小班课梯度结算规则设置
-     */
-    public static final String HIGH_GRADIENT_SETTLEMENT_RULE = "high_gradient_settlement_rule";
-
-    /**
-     * 如果没有签退,{}分钟后自动发送推送信息
-     */
-    public static final String SIGN_OUT_MESSAGE_PUSH_MINUTE = "sign_out_message_push_minute";
-
-    /**
-     * 试听课默认单节课时长
-     */
-    String DEMO_GROUP_SINGLE_CLASS_MINUTES_ = "demo_group_single_class_minutes_";
-    String USER_DEFAULT_HEAD_URL = "user_default_head_url";
-    String STUDENT_APPLY_URL = "student_apply_url";
-    String SERVER_PHONE = "server_phone";
-
-    String MUSIC_GROUP_SETTLEMENT_CLASS_MINUTES = "music_group_settlement_class_minutes";
-
-    String MUSIC_GROUP_SETTLEMENT_DAY = "music_group_settlement_day";
-
-    String MUSIC_GROUP_SETTLEMENT_SINGLE_CLASS_MINUTES = "music_group_settlement_single_class_minutes";
-
-    String REFUND_PERIOD = "refund_period";
-
-    /**
-     * 可签退时间限制(自然天)
-     */
-    String ENABLE_SIGN_OUT_TIME_RANGE = "enable_sign_out_time_range";
-
-    /**
-     * 可更新学生签到状态时间限制,课程结束后{}分钟
-     */
-    String ENABLE_STUDENT_ATTENDANCE_TIME_RANGE = "enable_student_attendance_time_range";
-
-    /**
-     * vip课程可更新学生签到状态时间限制,课程结束后{}分钟
-     */
-    String ENABLE_STUDENT_ATTENDANCE_TIME_RANGE_VIP = "enable_student_attendance_time_range_vip";
-
-    String ENABLE_STUDENT_ATTENDANCE_BEFOR_COURSE_START_TIME_RANGE_VIP = "enable_student_attendance_befor_course_start_time_range_vip";
-
-    /**
-     * @describe 陪练课课酬
-     */
-    String PRACTICE_COURSE_SALARY = "practice_course_salary";
-
-    /**
-     * @describe 陪练课时长
-     */
-    String PRACTICE_COURSE_MINUTES = "practice_course_minutes";
-
-    /**
-     * @describe 陪练课预约开始时间
-     */
-    String PRACTICE_APPLY_START_TIME = "practice_apply_start_time";
-
-    /**
-     * @describe 陪练课预约结束时间
-     */
-    String PRACTICE_APPLY_END_TIME = "practice_apply_end_time";
-
-    /**
-     * @describe 陪练课预约时间间隔
-     */
-    String PRACTICE_APPLY_INTERVAL_TIME = "practice_apply_interval_time";
-
-    /**
-     * @describe 陪练课可预约声部列表
-     */
-    String PRACTICE_SUBJECT_ID_LIST = "practice_subject_id_list";
-
-    /**
-     * @describe 教师请假数据
-     */
-    String TEACHER_LEAVE_DATA = "teacher_leave_data";
-
-    /**
-     * 十分钟内最大可发送的短信次数
-     */
-    String SMS_MAX_TIMES = "sms_max_times";
-
-    /**
-     * 连堂课间隔时间
-     */
-    String ONLINE_CONTINUE_COURSE_TIME = "online_continue_course_time";
-
-    /**
-     * 连堂课间隔时间
-     */
-    String AUTO_CLOSE_NETWORK_ROOM = "auto_close_network_room";
-
-    /**
-     * @describe 付费陪练课可购买最大月数
-     */
-    String PRACTICE_PAY_MAX_MONTH = "practice_pay_max_month";
-
-    /**
-     * @describe 付费陪练课单月上课数量
-     */
-    String PRACTICE_PAY_DRILL_TIMES_ON_ONE_WEEK = "practice_pay_drill_times_on_one_week";
-
-    /**
-     * @describe 付费陪练课活动截至日期
-     */
-    String PRACTICE_BUY_ACTIVITY_EXPIRE_DATE = "practice_buy_activity_expire_date";
-
-    /**
-     * 陪练老师端入口地址
-     */
-    String TEACHER_STUDY_REPORT_URL = "teacher_study_report_url";
-
-    /**
-     * 陪练课报告地址
-     */
-    String STUDENT_STUDY_REPORT_URL = "student_study_report_url";
-
-    /**
-     * @describe 陪练课续费地址
-     */
-    String PRACTICE_RENEW_URL = "practice_renew_url";
-
-    /**
-     * @describe 老师端baseUrl
-     */
-    String TEACHER_BASE_URL = "teacher_base_url";
-
-    String COURSE_BEFORE_BUFFER_TIME = "course_before_buffer_time";
-
-    String COURSE_AFTER_BUFFER_TIME = "course_after_buffer_time";
-
-    String PRACTICE_PROMOTION_ACTIVITY_START_DATE = "practice_promotion_activity_start_date";
-
-    String NEW_MSG_PUSH = "您收到一条训练回复,请点击查看";
-
-    /**
-     * @describe 教务端baseUrl
-     */
-    String EDU_TEACHER_BASE_URL = "edu_teacher_base_url";
-
-    String HOLIDAY_SETTING = "holiday_setting";
-
-    String PRACTICE_FREE_APPLY_EXPIRE_DATE = "practice_free_apply_expire_date";
-    
-    String START_TIME_OF_1111 = "start_time_of_1111";
-    
-    String END_TIME_OF_1111 = "end_time_of_1111";
-
-    String VIP_SPECIAL_ACTIVITY_IDS = "vip_special_activity_ids";
-
-    String DAYA_BASE_SALARY_AMOUNT = "daya_base_salary_amount";
-
-    String WARNING_MIN_COURSE_SALARY = "warning_min_course_salary";
-
-    //提醒乐团主管排下学期的课程的时间节点(默认提前14天)
-    String REMIND_COURSE_TIME = "remind_course_time";
-
-    //会员结束前15天提醒学员续费(默认提前15天)
-    String PUSH_MEMBER_RENEW = "push_member_renew";
-
-    //试用会员结束前3天提醒学员续费(默认提前3天)
-    String EXPERIENCE_PUSH_MEMBER_RENEW = "experience_push_member_renew";
-
-    //会员结束前15天自动创建乐团续费(默认提前15天)
-    String AUTO_CREATE_MEMBER_RENEW = "auto_create_member_renew";
-
-    //会员结束前15天提醒学员续费(默认提前5天)
-    String PUSH_MEMBER_RENEW_AGAIN = "push_member_renew_again";
-
-    //会员结束前5天提醒学员续费(退团提醒)(默认提前5天)
-    String PUSH_MEMBER_RENEW_QUIT = "push_member_renew_quit";
-
-    String CHILDREN_DAY_VIP_ACTIVITY_IDS = "children_day_vip_activity_ids";
-
-    //云教练作业开关0关1开
-    String HOMEWORK_OPEN_FLAG = "homework_open_flag";
-
-    //云教练免费体验开关0关1开
-    String FREE_CLOUD_OPEN_FLAG = "free_cloud_open_flag";
-
-    //乐团问卷调查编号
-    String MUSIC_GROUP_TOPIC_ID = "music_group_topic_id";
-
-    //云教练试用时间最晚截止时间
-    String EXPERIENCE_MEMBERSHIP_END_TIME = "experience_membership_end_time";
-
-    //云教练训练时长小于80分钟需要回访
-    String STUDENT_CLOUD_TEACHER_TOTAL_PLAY_TIME = "student_cloud_teacher_total_play_time";
-
-    //云教练训练次数小于4次需要回访
-    String STUDENT_CLOUD_TEACHER_TRAIN_NUM = "student_cloud_teacher_train_num";
-
-    //云教练活动分部目标JSON
-    String CLOUD_TEACHER_ACTIVE_TARGET = "cloud_teacher_active_target";
-
     //云教练活动开屏广告编号
     String CLOUD_TEACHER_ACTIVE_BANNER_IDS = "cloud_teacher_active_banner_ids";
 

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/DemoGroup.java

@@ -42,6 +42,16 @@ public class DemoGroup {
 	@ApiModelProperty(value = "科目名称")
 	private String subjectName;
 
+	private Integer tenantId;
+
+	public Integer getTenantId() {
+		return tenantId;
+	}
+
+	public void setTenantId(Integer tenantId) {
+		this.tenantId = tenantId;
+	}
+
 	public String getSubjectName() {
 		return subjectName;
 	}

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/PracticeGroup.java

@@ -93,6 +93,16 @@ public class PracticeGroup {
 	@ApiModelProperty(value = "总金额",required = false)
 	private BigDecimal totalPrice = BigDecimal.ZERO;
 
+	private Integer tenantId;
+
+	public Integer getTenantId() {
+		return tenantId;
+	}
+
+	public void setTenantId(Integer tenantId) {
+		this.tenantId = tenantId;
+	}
+
 	public Integer getActivityUserMapperId() {
 		return activityUserMapperId;
 	}

+ 3 - 3
mec-biz/src/main/java/com/ym/mec/biz/event/listener/TenantConfigListener.java

@@ -5,13 +5,13 @@ import com.ym.mec.biz.dal.entity.TenantInfo;
 import com.ym.mec.biz.event.TenantConfigChangeEvent;
 import com.ym.mec.biz.service.SysTenantConfigService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationEvent;
 import org.springframework.context.ApplicationListener;
 import org.springframework.stereotype.Component;
 
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 @Component
 public class TenantConfigListener implements ApplicationListener<TenantConfigChangeEvent> {
@@ -26,7 +26,7 @@ public class TenantConfigListener implements ApplicationListener<TenantConfigCha
         if(event.getTenantId() != null){
             TenantInfo tenantInfo = tenantInfoDao.selectByPrimaryKey(event.getTenantId());
             if(tenantInfo != null){
-                Map<Integer, Map<String, String>> allTenantConfig = sysTenantConfigService.getAllTenantConfig();
+                ConcurrentHashMap<Integer, ConcurrentHashMap<String, String>> allTenantConfig = sysTenantConfigService.getAllTenantConfig();
                 allTenantConfig.put(tenantInfo.getId(),sysTenantConfigService.queryAllMap(tenantInfo.getId()));
                 sysTenantConfigService.setTenantConfig(allTenantConfig);
             }
@@ -35,7 +35,7 @@ public class TenantConfigListener implements ApplicationListener<TenantConfigCha
             paramMap.put("state",1);
             List<TenantInfo> tenantInfos = tenantInfoDao.queryList(paramMap);
             if(tenantInfos != null && tenantInfos.size() > 0){
-                Map<Integer,Map<String,String>> tenantConfig = new HashMap<>(tenantInfos.size());
+                ConcurrentHashMap<Integer,ConcurrentHashMap<String,String>> tenantConfig = new ConcurrentHashMap<>(tenantInfos.size());
                 for (TenantInfo tenantInfo : tenantInfos) {
                     tenantConfig.put(tenantInfo.getId(),sysTenantConfigService.queryAllMap(tenantInfo.getId()));
                 }

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

@@ -153,7 +153,7 @@ public interface CourseScheduleService extends BaseService<Long, CourseSchedule>
 	 * @Date: 2019/9/17
 	 * 根据日期获取当日排课信息
 	 */
-	List<CourseScheduleDto> getTeacherCourseSchedulesWithDate(Integer userId, Date classDate, String type);
+	List<CourseScheduleDto> getTeacherCourseSchedulesWithDate(Integer userId, Date classDate, String type,Integer tenantId);
 
 	/**
 	 * @describe 根据日期获取

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

@@ -51,7 +51,7 @@ public interface EduPracticeGroupService {
      * @param userId: 用户编号
      * @return java.util.Map
      */
-    Map getTrialPracticeApplyParams(Integer userId);
+    Map getTrialPracticeApplyParams(Integer userId,Integer tenantId);
 
     /**
      * @describe 获取可以指派试听课的老师列表

+ 5 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/PracticeGroupService.java

@@ -59,7 +59,7 @@ public interface PracticeGroupService extends BaseService<Long, PracticeGroup> {
      * @param userId: 用户编号
      * @return java.util.Map
      */
-    Map getPracticeApplyParams(Integer userId);
+    Map getPracticeApplyParams(Integer userId,Integer tenantId);
 
     /**
      * @describe 获取陪练课可预约声部
@@ -68,7 +68,7 @@ public interface PracticeGroupService extends BaseService<Long, PracticeGroup> {
      * @param :
      * @return com.ym.mec.common.entity.HttpResponseResult
      */
-	Object getPracticeApplySubjects();
+	Object getPracticeApplySubjects(Integer tenantId);
 
     /**
      * @describe 获取可以预约的教师
@@ -110,10 +110,10 @@ public interface PracticeGroupService extends BaseService<Long, PracticeGroup> {
      * @param endDay: 天数
      * @return java.util.Map
      */
-	List<Date> getEnableApplyDates(Date startDay,Date endDay);
+	List<Date> getEnableApplyDates(Date startDay,Date endDay,Integer tenantId);
 
 
-	List<Date> getEnableApplyDatesIncludeAllTimes(Date startDay,Date endDay);
+	List<Date> getEnableApplyDatesIncludeAllTimes(Date startDay,Date endDay,Integer tenantId);
 
 	/**
 	 * @describe 陪练课预约
@@ -163,7 +163,7 @@ public interface PracticeGroupService extends BaseService<Long, PracticeGroup> {
      * @param userId: 用户编号
      * @return java.util.Map
      */
-    Map getPayPracticeApplyParams(Integer userId, Integer organId);
+    Map getPayPracticeApplyParams(Integer userId, Integer organId, Integer tenantId);
 
 	/**
 	 * @describe 获取可以预约的教师——付费

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

@@ -56,7 +56,7 @@ public interface StudentAttendanceService extends BaseService<Long, StudentAtten
 	 * @param remark 请假理由
 	 * @return
 	 */
-	boolean leave(Integer userId, Long courseScheduleId, String remark);
+	boolean leave(Integer userId, Long courseScheduleId, String remark,Integer tenantId);
 
 	/**
 	 * @describe 历史考勤详情

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

@@ -50,6 +50,20 @@ public interface SysConfigService extends BaseService<Long, SysConfig> {
     String ONLINE_CONTINUE_COURSE_TIME = "online_continue_course_time";
     //线上连堂课间隔时间
     String OFFLINE_CONTINUE_COURSE_MINUTES = "offline_continue_course_minutes";
+    //陪练课可选老师的分部
+    String PRACTICE_TEACHER_ORGAN_RANGE = "practice_teacher_organ_range";
+    //陪练课可预约声部列表
+    String PRACTICE_SUBJECT_ID_LIST = "practice_subject_id_list";
+    //陪练课预约开始时间
+    String PRACTICE_APPLY_START_TIME = "practice_apply_start_time";
+    //陪练课预约结束时间
+    String PRACTICE_APPLY_END_TIME = "practice_apply_end_time";
+    //试听课默认单节课时长
+    String DEMO_GROUP_SINGLE_CLASS_MINUTES_ = "demo_group_single_class_minutes_";
+    //学生允许请假的时间,为开课前{}小时
+    String ADVANCE_LEAVE_HOURS = "advance_leave_hours";
+    //教师可调整课程默认时间,开课前{}小时
+    String ENABLE_TEACHER_COURSE_ADJUST_DEFAULT_HOURS = "enable_teacher_course_adjust_default_hours";
 
     public static final String BASE_API_URL = "base_api_url";
 
@@ -76,16 +90,10 @@ public interface SysConfigService extends BaseService<Long, SysConfig> {
     String ADVANCE_SIGN_OUT_MINUTES = "advance_sign_out_minutes";
 
     /**
-     * 学生允许请假的时间,为开课前{}小时
-     */
-    public static final String ADVANCE_LEAVE_HOURS = "advance_leave_hours";
-
-    /**
      * 最早请假提前时间
      */
     String EARLIEST_TIME_FOR_LEAVE="earliest_time_for_leave";
 
-    String ENABLE_TEACHER_COURSE_ADJUST_DEFAULT_HOURS = "enable_teacher_course_adjust_default_hours";
 
     /**
      * 单技课梯度结算规则设置
@@ -107,10 +115,6 @@ public interface SysConfigService extends BaseService<Long, SysConfig> {
      */
     public static final String SIGN_OUT_MESSAGE_PUSH_MINUTE = "sign_out_message_push_minute";
 
-    /**
-     * 试听课默认单节课时长
-     */
-    String DEMO_GROUP_SINGLE_CLASS_MINUTES_ = "demo_group_single_class_minutes_";
     String USER_DEFAULT_HEAD_URL = "user_default_head_url";
     String STUDENT_APPLY_URL = "student_apply_url";
     String SERVER_PHONE = "server_phone";
@@ -149,21 +153,6 @@ public interface SysConfigService extends BaseService<Long, SysConfig> {
      * @describe 陪练课时长
      */
     String PRACTICE_COURSE_MINUTES = "practice_course_minutes";
-    
-    /**
-     * 陪练课可选老师的分部
-     */
-    String PRACTICE_TEACHER_ORGAN_RANGE = "practice_teacher_organ_range";
-
-    /**
-     * @describe 陪练课预约开始时间
-     */
-    String PRACTICE_APPLY_START_TIME = "practice_apply_start_time";
-
-    /**
-     * @describe 陪练课预约结束时间
-     */
-    String PRACTICE_APPLY_END_TIME = "practice_apply_end_time";
 
     /**
      * @describe 陪练课预约时间间隔
@@ -171,11 +160,6 @@ public interface SysConfigService extends BaseService<Long, SysConfig> {
     String PRACTICE_APPLY_INTERVAL_TIME = "practice_apply_interval_time";
 
     /**
-     * @describe 陪练课可预约声部列表
-     */
-    String PRACTICE_SUBJECT_ID_LIST = "practice_subject_id_list";
-
-    /**
      * @describe 教师请假数据
      */
     String TEACHER_LEAVE_DATA = "teacher_leave_data";

+ 2 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/SysTenantConfigService.java

@@ -11,9 +11,7 @@ import java.util.concurrent.ConcurrentHashMap;
 public interface SysTenantConfigService extends BaseService<Integer, SysTenantConfig> {
     void setTenantConfig(ConcurrentHashMap<Integer,ConcurrentHashMap<String,String>> tenantConfig);
 
-    ConcurrentHashMap<String,String> getTenantConfig(Integer tenantId);
-
-    String getTenantConfigValue(Integer tenantId,String paramName);
+    String getTenantConfigValue(String paramName, Integer tenantId);
 
     ConcurrentHashMap<Integer,ConcurrentHashMap<String,String>> getAllTenantConfig();
 
@@ -21,7 +19,5 @@ public interface SysTenantConfigService extends BaseService<Integer, SysTenantCo
 
     void batchUpSet(List<SysConfig> sysConfigs, Integer tenantId);
 
-    String getConfigValue(String paramName, Integer tenantId);
-
-    Map<String, String> queryAllMap(Integer tenantId);
+    ConcurrentHashMap<String, String> queryAllMap(Integer tenantId);
 }

+ 0 - 11
mec-biz/src/main/java/com/ym/mec/biz/service/TeacherCourseScheduleService.java

@@ -24,17 +24,6 @@ public interface TeacherCourseScheduleService {
     List<Date> findTeacherHaveClassesDates(Integer teacherId, Date month, String groupId, GroupType groupType);
 
     /**
-     * @describe 获取老师在指定日期的课程列表
-     * @author Joburgess
-     * @date 2020/3/10
-     * @param teacherId: 教师编号
-     * @param classDate: 上课日期
-     * @param groupType: 课程组类型
-     * @return java.util.List<com.ym.mec.biz.dal.dto.CourseScheduleDto>
-     */
-    List<CourseScheduleDto> findCourseSchedulesWithDate(Integer teacherId, Date classDate, String groupId, GroupType groupType);
-
-    /**
      * @describe 根据课程编号获取课程所在课程组的课程
      * @author Joburgess
      * @date 2020/3/10

+ 35 - 14
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -231,7 +231,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         currentCourseDetail.setNormalRemind(normalRemindNum<=0?0:1);
 		currentCourseDetail.setCurrentTime(new Date());
         currentCourseDetail.setAdvanceSignInMinutes(Integer.parseInt(sysConfigDao.findConfigValue(SysConfigService.ADVANCE_SIGN_IN_MINUTES)));
-		String gpsRange = sysTenantConfigService.getConfigValue(SysConfigService.ATTENDANCE_RANGE,user.getTenantId());
+		String gpsRange = sysTenantConfigService.getTenantConfigValue(SysConfigService.ATTENDANCE_RANGE,user.getTenantId());
 		Integer attendanceRange = 0;
 		if(StringUtils.isNotEmpty(gpsRange)){
 			attendanceRange = Integer.parseInt(gpsRange);
@@ -1042,13 +1042,21 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         if (null == user) {
             throw new BizException("请登录");
         }
+        if (null == user.getTenantId()) {
+            throw new BizException("用户机构信息异常");
+        }
         Date now = new Date();
         SysConfig studentAttendanceAfterTimeConfig = sysConfigService.findByParamName(SysConfigService.ENABLE_STUDENT_ATTENDANCE_BEFOR_COURSE_START_TIME_RANGE_VIP);
 		SysConfig courseBeforeBufferTime = sysConfigService.findByParamName(SysConfigService.COURSE_BEFORE_BUFFER_TIME);
 		SysConfig courseAfterBufferTime = sysConfigService.findByParamName(SysConfigService.COURSE_AFTER_BUFFER_TIME);
         Map<String, Object> result = new HashMap<>(3);
         result.put("vipAppealDaysRange", sysConfigDao.findConfigValue(SysConfigService.VIP_APPEAL_DAYS_RANGE));
-        result.put("advanceLeaveHours", Integer.parseInt(sysConfigDao.findConfigValue(SysConfigService.ADVANCE_LEAVE_HOURS)));
+		String tenantConfigValue = sysTenantConfigService.getTenantConfigValue(SysConfigService.ADVANCE_LEAVE_HOURS, user.getTenantId());
+		Integer advanceLeaveHours = 0;
+		if(StringUtils.isNotEmpty(tenantConfigValue)){
+			advanceLeaveHours = Integer.parseInt(tenantConfigValue);
+		}
+		result.put("advanceLeaveHours", advanceLeaveHours);
         result.put("earliestTimeForLeave", Integer.parseInt(sysConfigDao.findConfigValue(SysConfigService.EARLIEST_TIME_FOR_LEAVE)));
         result.put("joinRoomBeforeTime",studentAttendanceAfterTimeConfig.getParanValue(Integer.class));
 		result.put("courseBeforeBufferTime", courseBeforeBufferTime.getParanValue(Integer.class));
@@ -1198,7 +1206,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
     }
 
     @Override
-    public List<CourseScheduleDto> getTeacherCourseSchedulesWithDate(Integer userId, Date classDate, String type) {
+    public List<CourseScheduleDto> getTeacherCourseSchedulesWithDate(Integer userId, Date classDate, String type,Integer tenantId) {
         if (Objects.isNull(classDate)) {
             throw new BizException("请选择上课日期!");
         }
@@ -1237,8 +1245,11 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         List<Map<Integer, Integer>> classGroupStudentNumMaps = classGroupStudentMapperDao.countClassGroupsStudentNum(classGroupIds, ClassGroupStudentStatusEnum.NORMAL);
         Map<Integer, Long> classGroupStudentNumMap = MapUtil.convertIntegerMap(classGroupStudentNumMaps);
 
-        SysConfig advanceLeaveHoursConfig = sysConfigService.findByParamName(SysConfigService.ADVANCE_LEAVE_HOURS);
-        Integer advanceLeaveHours=advanceLeaveHoursConfig.getParanValue(Integer.class);
+		String tenantConfigValue = sysTenantConfigService.getTenantConfigValue(SysConfigService.ADVANCE_LEAVE_HOURS,tenantId);
+		Integer advanceLeaveHours = 0;
+		if(StringUtils.isNotEmpty(tenantConfigValue)){
+			advanceLeaveHours = Integer.parseInt(tenantConfigValue);
+		}
         List<Map<Long, Integer>> courseLeaveStudentNumMaps = studentAttendanceDao.countCourseLeaveStudentNumWithFourHoursAgo(allCourseScheduleIds, advanceLeaveHours);
         Map<Long,Long> courseLeaveStudentNumMap = MapUtil.convertIntegerMap((courseLeaveStudentNumMaps));
 
@@ -3930,6 +3941,9 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         if (null == sysUser) {
             throw new BizException("获取用户信息失败");
         }
+        if (null == sysUser.getTenantId()) {
+            throw new BizException("获取用户机构信息失败");
+        }
         List<Long> newCourseScheduleIds = newCourseSchedules.stream().map(CourseSchedule::getId).collect(Collectors.toList());
         //获取对应未修改的课程列表
         List<CourseSchedule> oldCourseScheduleList = courseScheduleDao.findByCourseScheduleIds(newCourseScheduleIds);
@@ -3959,19 +3973,20 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         Map<Long, CourseSchedule> oldCourseSchedules = new HashMap<>();
 
         List<Integer> classGroupIds = oldCourseScheduleList.stream().map(CourseSchedule::getClassGroupId).collect(Collectors.toList());
-//        List<ClassGroup> classGroups = classGroupDao.findByClassGroupIds(classGroupIds);
-//        Map<Integer, ClassGroup> idClassGroupMap = classGroups.stream().collect(Collectors.toMap(ClassGroup::getId, classGroup -> classGroup));
 
-        SysConfig advanceLeaveHoursConfig = sysConfigService.findByParamName(SysConfigService.ENABLE_TEACHER_COURSE_ADJUST_DEFAULT_HOURS);
-        Integer advanceLeaveHours=advanceLeaveHoursConfig.getParanValue(Integer.class);
+        String advanceLeaveHoursConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.ENABLE_TEACHER_COURSE_ADJUST_DEFAULT_HOURS,sysUser.getTenantId());
+		Integer advanceLeaveHours = 0;
+        if(StringUtils.isNotEmpty(advanceLeaveHoursConfig)){
+			advanceLeaveHours = Integer.parseInt(advanceLeaveHoursConfig);
+		}
         List<Map<Long, Integer>> courseLeaveStudentNumMaps = studentAttendanceDao.countCourseLeaveStudentNumWithFourHoursAgo(newCourseScheduleIds, advanceLeaveHours);
         Map<Long,Long> courseLeaveStudentNumMap = MapUtil.convertIntegerMap((courseLeaveStudentNumMaps));
 
         List<Map<Integer, Integer>> classGroupStudentNumMaps = classGroupStudentMapperDao.countClassGroupsStudentNum(classGroupIds, ClassGroupStudentStatusEnum.NORMAL);
         Map<Integer, Long> classGroupStudentNumMap = MapUtil.convertIntegerMap(classGroupStudentNumMaps);
 
-
-        newCourseSchedules.forEach(newCourseSchedule -> {
+		for (int i = 0; i < newCourseSchedules.size(); i++) {
+			CourseSchedule newCourseSchedule = newCourseSchedules.get(i);
             CourseSchedule oldCourseSchedule = oldCourseScheduleMap.get(newCourseSchedule.getId()).get(0);
             if (!sysUser.getUserType().contains("SYSTEM") && sysUser.getUserType().contains("TEACHER")) {
                 Long normalStudentNum = classGroupStudentNumMap.get(oldCourseSchedule.getClassGroupId());
@@ -4142,7 +4157,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
                 teacherAttendanceDao.batchDeleteByCourseAndUsers(newCourseSchedule.getId().intValue(), beReplaceTeacherIds);
             }
             classGroupService.updateClassGroupInfo(oldCourseSchedule.getClassGroupId());
-        });
+        }
         //生成修改后的教师课酬
         if (!CollectionUtils.isEmpty(needCreateCourseScheduleTeacherSalaryCourse)) {
             classGroupTeacherMapperService.createCourseScheduleTeacherSalary(needCreateCourseScheduleTeacherSalaryCourse, oldCourseSchedules);
@@ -4592,6 +4607,9 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		if (null == user) {
 			throw new BizException("请登录");
 		}
+		if (null == user.getTenantId()) {
+			throw new BizException("用户机构信息异常");
+		}
 		if(!queryInfo.getFindTotal()){
 			queryInfo.setUserId(user.getId().longValue());
 		}
@@ -4625,8 +4643,11 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			Map<Integer, Long> classGroupStudentNumMap = MapUtil.convertIntegerMap(classGroupStudentNumMaps);
 
 			List<Long> allCourseScheduleIds = dataList.stream().map(TeacherClassCourseSchudeleDto::getCourseScheduleId).collect(Collectors.toList());
-			SysConfig advanceLeaveHoursConfig = sysConfigService.findByParamName(SysConfigService.ADVANCE_LEAVE_HOURS);
-			Integer advanceLeaveHours=advanceLeaveHoursConfig.getParanValue(Integer.class);
+			String tenantConfigValue = sysTenantConfigService.getTenantConfigValue(SysConfigService.ADVANCE_LEAVE_HOURS,user.getTenantId());
+			Integer advanceLeaveHours = 0;
+			if(StringUtils.isNotEmpty(tenantConfigValue)){
+				advanceLeaveHours = Integer.parseInt(tenantConfigValue);
+			}
 			List<Map<Long, Integer>> courseLeaveStudentNumMaps = studentAttendanceDao.countCourseLeaveStudentNumWithFourHoursAgo(allCourseScheduleIds, advanceLeaveHours);
 			Map<Long,Long> courseLeaveStudentNumMap = MapUtil.convertIntegerMap((courseLeaveStudentNumMaps));
 

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

@@ -239,7 +239,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         }
 
         //试用期课酬规则
-        String configValue2 = sysTenantConfigService.getConfigValue(SysConfigService.PROBATION_TEACHER_SALARY,tenantId);
+        String configValue2 = sysTenantConfigService.getTenantConfigValue(SysConfigService.PROBATION_TEACHER_SALARY,tenantId);
         Integer probationTeacherSalary = 100;
         if(StringUtils.isNotEmpty(configValue2)){
             probationTeacherSalary = Integer.parseInt(configValue2);
@@ -366,7 +366,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         }
 
         //试用期课酬规则
-        String configValue2 = sysTenantConfigService.getConfigValue(SysConfigService.PROBATION_TEACHER_SALARY,tenantId);
+        String configValue2 = sysTenantConfigService.getTenantConfigValue(SysConfigService.PROBATION_TEACHER_SALARY,tenantId);
         Integer probationTeacherSalary = 100;
         if(StringUtils.isNotEmpty(configValue2)){
             probationTeacherSalary = Integer.parseInt(configValue2);
@@ -527,7 +527,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         }
 
         //定位范围
-        String gpsRange = sysTenantConfigService.getConfigValue(SysConfigService.ATTENDANCE_RANGE,tenantId);
+        String gpsRange = sysTenantConfigService.getTenantConfigValue(SysConfigService.ATTENDANCE_RANGE,tenantId);
         double attendanceRange = 0;
         if(StringUtils.isNotEmpty(gpsRange)){
             attendanceRange = Double.valueOf(gpsRange);
@@ -545,7 +545,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 //            unitEnum = UnitEnum.valueOf(configValue1);
 //        }
           //试用期课酬规则
-        String configValue2 = sysTenantConfigService.getConfigValue(SysConfigService.PROBATION_TEACHER_SALARY,tenantId);
+        String configValue2 = sysTenantConfigService.getTenantConfigValue(SysConfigService.PROBATION_TEACHER_SALARY,tenantId);
         Integer probationTeacherSalary = 100;
         if(StringUtils.isNotEmpty(configValue2)){
             probationTeacherSalary = Integer.parseInt(configValue2);

+ 8 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/DemoGroupServiceImpl.java

@@ -13,10 +13,7 @@ import com.ym.mec.biz.dal.enums.TeachTypeEnum;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import com.ym.mec.biz.dal.page.StudentDemoGroupQueryInfo;
 import com.ym.mec.biz.dal.page.TeacherManageDemoGroupQueryInfo;
-import com.ym.mec.biz.service.CourseScheduleService;
-import com.ym.mec.biz.service.DemoGroupService;
-import com.ym.mec.biz.service.SysConfigService;
-import com.ym.mec.biz.service.TeacherAttendanceService;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
@@ -59,6 +56,8 @@ public class DemoGroupServiceImpl extends BaseServiceImpl<Long, DemoGroup>  impl
 	@Autowired
 	private SysConfigDao sysConfigDao;
 	@Autowired
+	private SysTenantConfigService sysTenantConfigService;
+	@Autowired
 	private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
 	@Autowired
 	private CourseScheduleTeacherSalaryDao courseScheduleTeacherSalaryDao;
@@ -84,7 +83,11 @@ public class DemoGroupServiceImpl extends BaseServiceImpl<Long, DemoGroup>  impl
 		//当前教师下周的试听课计划
 		List<DemoGroupCoursesPlan> nextWeekDemoGroupCoursePlan = demoGroupCoursesPlanDao.findByDateZone(nextMonday, nextSunday, demoGroupApplyDto.getUserId());
 
-		demoGroupApplyDto.setSingleClassMinutes(Integer.parseInt(sysConfigDao.findConfigValue(SysConfigService.DEMO_GROUP_SINGLE_CLASS_MINUTES_)));
+		String configValue = sysTenantConfigService.getTenantConfigValue(SysConfigService.DEMO_GROUP_SINGLE_CLASS_MINUTES_, demoGroupApplyDto.getTenantId());
+		if(StringUtils.isEmpty(configValue)){
+			throw new BizException("请配置试听课单课时时长");
+		}
+		demoGroupApplyDto.setSingleClassMinutes(Integer.parseInt(configValue));
 
 		if(CollectionUtils.isEmpty(nextWeekDemoGroupCoursePlan)){
 			demoGroupDao.insert(demoGroupApplyDto);

+ 9 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/EduPracticeGroupServiceImpl.java

@@ -43,6 +43,7 @@ import java.time.*;
 import java.time.format.DateTimeFormatter;
 import java.time.temporal.WeekFields;
 import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.Collectors;
 
 /**
@@ -57,6 +58,8 @@ public class EduPracticeGroupServiceImpl implements EduPracticeGroupService{
     @Autowired
     private SysConfigService sysConfigService;
     @Autowired
+    private SysTenantConfigService sysTenantConfigService;
+    @Autowired
     private SubjectDao subjectDao;
     @Autowired
     private TeacherService teacherService;
@@ -1006,13 +1009,16 @@ public class EduPracticeGroupServiceImpl implements EduPracticeGroupService{
     }
 
     @Override
-    public Map getTrialPracticeApplyParams(Integer userId) {
+    public Map getTrialPracticeApplyParams(Integer userId,Integer tenantId) {
         Map result = new HashMap();
-        SysConfig practiceSubjectIdListConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_SUBJECT_ID_LIST);
+        String practiceSubjectIdListConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_SUBJECT_ID_LIST,tenantId);
+        if(StringUtils.isEmpty(practiceSubjectIdListConfig)){
+            throw new BizException("请配置陪练课可预约声部");
+        }
         SysConfig practiceApplyIntervalTimeConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_APPLY_INTERVAL_TIME);
         SysConfig practiceCourseMinutesConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
 
-        List<Subject> subjects = subjectDao.findBySubjectByIdList(practiceSubjectIdListConfig.getParanValue());
+        List<Subject> subjects = subjectDao.findBySubjectByIdList(practiceSubjectIdListConfig);
         Integer userDefaultSubjectId = practiceGroupDao.findLastPracticeSubject(userId);
 
         Collections.swap(subjects,6,7);

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

@@ -396,6 +396,9 @@ public class OnlineMusicGroupServiceImpl implements OnlineMusicGroupService {
         if (Objects.isNull(student.getOrganId())) {
             throw new BizException("未找到用户分部属性");
         }
+        if (Objects.isNull(student.getTenantId())) {
+            throw new BizException("未找到用户机构属性");
+        }
         Teacher teacher = teacherDao.get(teacherId);
         if (Objects.isNull(teacher)) {
             throw new BizException("教师不存在");
@@ -486,7 +489,7 @@ public class OnlineMusicGroupServiceImpl implements OnlineMusicGroupService {
         Date firstMonday = DateUtil.getWeekDayWithDate(applyStartDate, Calendar.MONDAY);
         Date secondSunday = DateUtil.getWeekDayWithDate(applyEndDate, Calendar.SUNDAY);
 
-        List<Date> enableApplyDates = practiceGroupService.getEnableApplyDatesIncludeAllTimes(applyStartDate, applyEndDate);
+        List<Date> enableApplyDates = practiceGroupService.getEnableApplyDatesIncludeAllTimes(applyStartDate, applyEndDate,student.getTenantId());
         List<CourseSchedule> allTeacherCourses = courseScheduleDao.findTeacherCoursesWithDateRange(teacherId, firstMonday, secondSunday);
         allTeacherCourses.sort(Comparator.comparing(CourseSchedule::getStartClassTime));
 

+ 57 - 94
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java

@@ -114,6 +114,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
     @Autowired
     private SysConfigDao sysConfigDao;
     @Autowired
+    private SysTenantConfigService sysTenantConfigService;
+    @Autowired
     private StudentPaymentOrderDao studentPaymentOrderDao;
     @Autowired
     private GroupClassService groupService;
@@ -776,17 +778,20 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
     }
 
     @Override
-    public Map getPracticeApplyParams(Integer userId) {
-        Map result = new HashMap();
-        SysConfig practiceSubjectIdListConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_SUBJECT_ID_LIST);
-        SysConfig practiceApplyStartTimeConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_APPLY_START_TIME);
-        SysConfig practiceApplyEndTimeConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_APPLY_END_TIME);
+    public Map getPracticeApplyParams(Integer userId,Integer tenantId) {
+        Map result = new HashMap(7);
+        String practiceSubjectIdListConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_SUBJECT_ID_LIST,tenantId);
+        if(StringUtils.isEmpty(practiceSubjectIdListConfig)){
+            throw new BizException("请配置陪练课可预约声部");
+        }
+        String practiceApplyStartTimeConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_START_TIME,tenantId);
+        String practiceApplyEndTimeConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_END_TIME,tenantId);
         SysConfig practiceApplyIntervalTimeConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_APPLY_INTERVAL_TIME);
         SysConfig practiceCourseMinutesConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
         SysConfig practiceFreeApplyExpireDateConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_FREE_APPLY_EXPIRE_DATE);
         Student student = studentDao.get(userId);
-        List<Subject> subjects = subjectDao.findBySubjectByIdList(practiceSubjectIdListConfig.getParanValue());
-        List<Integer> subjectIds = Arrays.asList(practiceSubjectIdListConfig.getParanValue().split(",")).stream().mapToInt(idStr -> Integer.valueOf(idStr)).boxed().collect(Collectors.toList());
+        List<Subject> subjects = subjectDao.findBySubjectByIdList(practiceSubjectIdListConfig);
+        List<Integer> subjectIds = Arrays.asList(practiceSubjectIdListConfig.split(",")).stream().mapToInt(idStr -> Integer.valueOf(idStr)).boxed().collect(Collectors.toList());
         List<Integer> userDefaultSubjectIds = Objects.isNull(student) || Objects.isNull(student.getSubjectIdList()) ? null : Arrays.asList(student.getSubjectIdList().split(",")).stream().mapToInt(idStr -> Integer.valueOf(idStr)).boxed().collect(Collectors.toList());
         if (!CollectionUtils.isEmpty(userDefaultSubjectIds) && userDefaultSubjectIds.size() <= 1) {
             userDefaultSubjectIds = userDefaultSubjectIds.stream().filter(userDefaultSubjectId -> subjectIds.contains(userDefaultSubjectId)).collect(Collectors.toList());
@@ -794,11 +799,9 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             userDefaultSubjectIds = new ArrayList<>();
         }
 
-        Integer applyTimes = practiceGroupDao.countUserPracticeApplyRecord(userId);
-
         result.put("subjects", subjects);
-        result.put("practiceApplyStartTime", practiceApplyStartTimeConfig.getParanValue());
-        result.put("practiceApplyEndTime", practiceApplyEndTimeConfig.getParanValue());
+        result.put("practiceApplyStartTime", practiceApplyStartTimeConfig);
+        result.put("practiceApplyEndTime", practiceApplyEndTimeConfig);
         result.put("userDefaultSubjectIds", StringUtils.join(userDefaultSubjectIds.toArray(), ","));
         result.put("practiceApplyIntervalMinutes", practiceApplyIntervalTimeConfig.getParanValue(Integer.class));
         result.put("practiceCourseMinutes", practiceCourseMinutesConfig.getParanValue(Integer.class));
@@ -807,10 +810,12 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
     }
 
     @Override
-    public Object getPracticeApplySubjects() {
-        SysConfig practiceSubjectIdListConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_SUBJECT_ID_LIST);
-        List<Subject> subjects = subjectDao.findBySubjectByIdList(practiceSubjectIdListConfig.getParanValue());
-        return subjects;
+    public Object getPracticeApplySubjects(Integer tenantId) {
+        String practiceSubjectIdListConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_SUBJECT_ID_LIST,tenantId);
+        if(StringUtils.isEmpty(practiceSubjectIdListConfig)){
+            throw new BizException("请配置陪练课可预约声部");
+        }
+        return subjectDao.findBySubjectByIdList(practiceSubjectIdListConfig);
     }
 
     @Override
@@ -913,6 +918,9 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         if (Objects.isNull(student.getOrganId())) {
             throw new BizException("未找到用户分部属性");
         }
+        if (Objects.isNull(student.getTenantId())) {
+            throw new BizException("未找到用户机构属性");
+        }
         Teacher teacher = teacherDao.get(teacherId);
         if (Objects.isNull(teacher)) {
             throw new BizException("教师不存在");
@@ -1012,7 +1020,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             tomorrow = tempCalendar.getTime();
         }
 
-        List<Date> enableApplyDates = getEnableApplyDates(applyStartDate, applyEndDate);
+        List<Date> enableApplyDates = getEnableApplyDates(applyStartDate, applyEndDate,student.getTenantId());
         List<CourseSchedule> allTeacherCourses = courseScheduleDao.findTeacherCoursesWithDateRange(teacherId, firstMonday, secondSunday);
         allTeacherCourses.sort(Comparator.comparing(CourseSchedule::getStartClassTime));
 
@@ -1347,6 +1355,9 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         if (Objects.isNull(sysUser.getOrganId())) {
             throw new BizException("未找到用户分部属性");
         }
+        if (Objects.isNull(sysUser.getTenantId())) {
+            throw new BizException("未找到用户机构属性");
+        }
         Map result = new HashMap();
         Set<Date> allTeacherFreeDates = new HashSet<>();
         SysConfig practiceCourseMinutesConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
@@ -1413,7 +1424,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             Date secondMonday = DateUtil.getWeekDayWithDate(applyEndDay, Calendar.MONDAY);
             Date secondSunday = DateUtil.getWeekDayWithDate(applyEndDay, Calendar.SUNDAY);
 
-            List<Date> enableApplyDates = getEnableApplyDates(applyStartDay, applyEndDay);
+            List<Date> enableApplyDates = getEnableApplyDates(applyStartDay, applyEndDay,sysUser.getTenantId());
             List<CourseSchedule> allTeacherCourses = courseScheduleDao.findTeachersCoursesWithDateRange(teacherIds, firstMonday, secondSunday);
             HashSet<Integer> excludeTeacherIds = new HashSet<>();
             if (Objects.nonNull(firstClassTime)) {
@@ -1641,19 +1652,15 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
     }
 
     @Override
-    public List<Date> getEnableApplyDates(Date startDay, Date endDay) {
+    public List<Date> getEnableApplyDates(Date startDay, Date endDay,Integer tenantId) {
         List<Date> result = new ArrayList<>();
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(startDay);
         calendar.add(Calendar.DATE, -1);
         calendar.set(Calendar.SECOND, 0);
         calendar.set(Calendar.MILLISECOND, 0);
-        SysConfig practiceApplyStartTimeConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_APPLY_START_TIME);
-        SysConfig practiceApplyEndTimeConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_APPLY_END_TIME);
-        SysConfig practiceApplyIntervalTimeConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_APPLY_INTERVAL_TIME);
-        String enableStartTimeStr = practiceApplyStartTimeConfig.getParanValue();
-        String enableEndTimeStr = practiceApplyEndTimeConfig.getParanValue();
-        Integer practiceApplyIntervalMinutes = practiceApplyIntervalTimeConfig.getParanValue(Integer.class);
+        String enableStartTimeStr = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_START_TIME,tenantId);
+        String enableEndTimeStr = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_END_TIME,tenantId);
         while (!calendar.getTime().after(endDay)) {
             calendar.add(Calendar.DATE, 1);
             calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(enableStartTimeStr.split(":")[0]));
@@ -1661,7 +1668,6 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             Date enableApplyDayStartTime = calendar.getTime();
             calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(enableEndTimeStr.split(":")[0]));
             calendar.set(Calendar.MINUTE, Integer.valueOf(enableEndTimeStr.split(":")[1]));
-            Date enableApplyDayEndTime = calendar.getTime();
             Calendar applyStartCalendar = Calendar.getInstance();
             applyStartCalendar.setTime(enableApplyDayStartTime);
             for (String applyDayTime : applyDayTimes) {
@@ -1674,18 +1680,16 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
     }
 
     @Override
-    public List<Date> getEnableApplyDatesIncludeAllTimes(Date startDay, Date endDay) {
+    public List<Date> getEnableApplyDatesIncludeAllTimes(Date startDay, Date endDay,Integer tenantId) {
         List<Date> result = new ArrayList<>();
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(startDay);
         calendar.add(Calendar.DATE, -1);
         calendar.set(Calendar.SECOND, 0);
         calendar.set(Calendar.MILLISECOND, 0);
-        SysConfig practiceApplyStartTimeConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_APPLY_START_TIME);
-        SysConfig practiceApplyEndTimeConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_APPLY_END_TIME);
+        String enableStartTimeStr = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_START_TIME,tenantId);
+        String enableEndTimeStr = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_END_TIME,tenantId);
         SysConfig practiceApplyIntervalTimeConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_APPLY_INTERVAL_TIME);
-        String enableStartTimeStr = practiceApplyStartTimeConfig.getParanValue();
-        String enableEndTimeStr = practiceApplyEndTimeConfig.getParanValue();
         Integer practiceApplyIntervalMinutes = practiceApplyIntervalTimeConfig.getParanValue(Integer.class);
         LocalTime dayStartTime = LocalTime.parse("00:00:00", DateUtil.timeFormatter);
         LocalTime dayEndTime = LocalTime.parse("00:00:00", DateUtil.timeFormatter);
@@ -1705,7 +1709,6 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             Date enableApplyDayStartTime = calendar.getTime();
             calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(enableEndTimeStr.split(":")[0]));
             calendar.set(Calendar.MINUTE, Integer.valueOf(enableEndTimeStr.split(":")[1]));
-            Date enableApplyDayEndTime = calendar.getTime();
             Calendar applyStartCalendar = Calendar.getInstance();
             applyStartCalendar.setTime(enableApplyDayStartTime);
             for (String applyDayTime : dayApplyTimes) {
@@ -1724,9 +1727,12 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             throw new BizException("请选择老师");
         }
         Map result = new HashMap();
-        SysConfig practiceSubjectIdListConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_SUBJECT_ID_LIST);
+        String practiceSubjectIdListConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_SUBJECT_ID_LIST,practiceGroup.getTenantId());
+        if(StringUtils.isEmpty(practiceSubjectIdListConfig)){
+            throw new BizException("请配置陪练课可预约声部");
+        }
         if (Objects.isNull(practiceGroup.getSubjectId())
-                || !Arrays.asList(practiceSubjectIdListConfig.getParanValue().split(",")).contains(practiceGroup.getSubjectId().toString())) {
+                || !Arrays.asList(practiceSubjectIdListConfig.split(",")).contains(practiceGroup.getSubjectId().toString())) {
             result.put("status", "DISABLE_SUBJECT");
             result.put("info", "预约失败,声部选择错误,请重试。");
             return result;
@@ -1743,43 +1749,11 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             practiceGroup.setSecondCourseTime(practiceGroup.getFirstCourseTime());
             practiceGroup.setFirstCourseTime(tmp);
         }
-//        if (practiceGroup.getFirstCourseTime().before(now)
-//                || practiceGroup.getFirstCourseTime().after(activityEndDate)) {
-//            result.put("status", "APPLY_DATE_OVERFLOW");
-//            result.put("info", "预约失败,网管课的时间超出活动时间范围(2020-5-31之前),请重试。");
-//            return result;
-//        }
-//        if (practiceGroup.getSecondCourseTime().before(now)
-//                || practiceGroup.getSecondCourseTime().after(activityEndDate)) {
-//            result.put("status", "APPLY_DATE_OVERFLOW");
-//            result.put("info", "预约失败,网管课的时间超出活动时间范围(2020-5-31之前),请重试。");
-//            return result;
-//        }
         if (DateUtil.isSameDay(practiceGroup.getFirstCourseTime(), practiceGroup.getSecondCourseTime())) {
             result.put("status", "TWO_DATE_ON_ONE_DAY");
             result.put("info", "预约失败,网管课选择时间重复,请重试。");
             return result;
         }
-
-//        int recordNum = practiceLessonApplyDao.checkUserIsApply(practiceGroup.getStudentId());
-//        if(recordNum>0){
-//            LocalDateTime nowDateTime=LocalDateTime.now();
-//            LocalDateTime applyExpireDateTime=LocalDateTime.parse("2020-02-29 00:00:00", DateUtil.dateTimeFormatter);
-//            if(nowDateTime.compareTo(applyExpireDateTime)>0){
-//                result.put("status", "APPLY_DATE_OVERFLOW");
-//                result.put("info", "预约失败,超出可预约时间范围。");
-//                return result;
-//            }
-//        }else{
-//            LocalDateTime nowDateTime=LocalDateTime.now();
-//            LocalDateTime applyExpireDateTime=LocalDateTime.parse("2020-02-22 20:00:00", DateUtil.dateTimeFormatter);
-//            if(nowDateTime.compareTo(applyExpireDateTime)>0){
-//                result.put("status", "APPLY_DATE_OVERFLOW");
-//                result.put("info", "预约失败,超出可预约时间范围。");
-//                return result;
-//            }
-//        }
-
         List<String> musicGroupIds = studentRegistrationDao.queryStudentMusicGroup(practiceGroup.getStudentId());
         if (!CollectionUtils.isEmpty(musicGroupIds) && musicGroupIds.size() <= 1) {
             MusicGroup musicGroup = musicGroupDao.get(musicGroupIds.get(0));
@@ -1803,18 +1777,6 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             allCourseDates.remove(3);
             allCourseDates.add(DateUtil.addDays(tempDate, 7));
         }
-//        if (allCourseDates.get(2).before(now)
-//                || allCourseDates.get(2).after(courseExpireDate)) {
-//            result.put("status", "APPLY_DATE_OVERFLOW");
-//            result.put("info", "预约失败,网管课的时间超出活动时间范围(2020-5-31之前),请重试。");
-//            return result;
-//        }
-//        if (allCourseDates.get(3).before(now)
-//                || allCourseDates.get(3).after(courseExpireDate)) {
-//            result.put("status", "APPLY_DATE_OVERFLOW");
-//            result.put("info", "预约失败,网管课的时间超出活动时间范围(2020-5-31之前),请重试。");
-//            return result;
-//        }
         allCourseDates.sort(Comparator.comparing(Date::getTime));
 
         studentDao.lockUser(practiceGroup.getStudentId());
@@ -2348,11 +2310,14 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
     }
 
     @Override
-    public Map getPayPracticeApplyParams(Integer userId, Integer organId) {
+    public Map getPayPracticeApplyParams(Integer userId, Integer organId,Integer tenantId) {
         Map result = new HashMap();
-        SysConfig practiceSubjectIdListConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_SUBJECT_ID_LIST);
-        SysConfig practiceApplyStartTimeConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_APPLY_START_TIME);
-        SysConfig practiceApplyEndTimeConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_APPLY_END_TIME);
+        String practiceSubjectIdListConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_SUBJECT_ID_LIST,tenantId);
+        if(StringUtils.isEmpty(practiceSubjectIdListConfig)){
+            throw new BizException("请配置陪练课可预约声部");
+        }
+        String practiceApplyStartTimeConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_START_TIME,tenantId);
+        String practiceApplyEndTimeConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_END_TIME,tenantId);
         SysConfig practiceApplyIntervalTimeConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_APPLY_INTERVAL_TIME);
         SysConfig practiceCourseMinutesConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
         SysConfig practicePayMaxMonthConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_PAY_MAX_MONTH);
@@ -2361,8 +2326,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         SysConfig practiceBuyActivityExpireDateConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_BUY_ACTIVITY_EXPIRE_DATE);
         SysUserCashAccount userCashAccount = sysUserCashAccountService.getLocked(userId);
         Student student = studentDao.get(userId);
-        List<Subject> subjects = subjectDao.findBySubjectByIdList(practiceSubjectIdListConfig.getParanValue());
-        List<Integer> subjectIds = Arrays.asList(practiceSubjectIdListConfig.getParanValue().split(",")).stream().mapToInt(idStr -> Integer.valueOf(idStr)).boxed().collect(Collectors.toList());
+        List<Subject> subjects = subjectDao.findBySubjectByIdList(practiceSubjectIdListConfig);
+        List<Integer> subjectIds = Arrays.asList(practiceSubjectIdListConfig.split(",")).stream().mapToInt(idStr -> Integer.valueOf(idStr)).boxed().collect(Collectors.toList());
         List<Integer> userDefaultSubjectIds = Objects.isNull(student) || Objects.isNull(student.getSubjectIdList()) ? null : Arrays.asList(student.getSubjectIdList().split(",")).stream().mapToInt(idStr -> Integer.valueOf(idStr)).boxed().collect(Collectors.toList());
         if (!CollectionUtils.isEmpty(userDefaultSubjectIds) && userDefaultSubjectIds.size() <= 1) {
             userDefaultSubjectIds = userDefaultSubjectIds.stream().filter(userDefaultSubjectId -> subjectIds.contains(userDefaultSubjectId)).collect(Collectors.toList());
@@ -2372,8 +2337,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         Collections.swap(subjects, 6, 7);
         PracticeGroupSellPrice practiceGroupSellPrice = practiceGroupSellPriceDao.get(organId);
         result.put("subjects", subjects);
-        result.put("practiceApplyStartTime", practiceApplyStartTimeConfig.getParanValue());
-        result.put("practiceApplyEndTime", practiceApplyEndTimeConfig.getParanValue());
+        result.put("practiceApplyStartTime", practiceApplyStartTimeConfig);
+        result.put("practiceApplyEndTime", practiceApplyEndTimeConfig);
         result.put("userDefaultSubjectIds", StringUtils.join(userDefaultSubjectIds.toArray(), ","));
         result.put("practiceApplyIntervalMinutes", practiceApplyIntervalTimeConfig.getParanValue(Integer.class));
         result.put("practiceCourseMinutes", practiceCourseMinutesConfig.getParanValue(Integer.class));
@@ -2398,25 +2363,23 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         if (Objects.isNull(sysUser.getOrganId())) {
             throw new BizException("未找到用户分部属性");
         }
-
-//        if (sysUser.getOrganId().equals(DALIAN_ORGAN_ID)) {
-//            sysUser.setOrganId(SHENYANG_ORGAN_ID);
-//        }
+        if (Objects.isNull(sysUser.getTenantId())) {
+            throw new BizException("用户机构信息异常");
+        }
 
         Integer practiceCourseMinutes = 25;
         SysConfig practiceCourseMinutesConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
         if (Objects.nonNull(practiceCourseMinutesConfig)) {
             practiceCourseMinutes = practiceCourseMinutesConfig.getParanValue(Integer.class);
         }
-        
-        SysConfig organIdConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_TEACHER_ORGAN_RANGE);
-        
-        if(organIdConfig == null || StringUtils.isBlank(organIdConfig.getParanValue())){
+        String organIdConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_TEACHER_ORGAN_RANGE,sysUser.getTenantId());
+
+        if(StringUtils.isEmpty(organIdConfig)){
         	throw new BizException("系统参数[{}]未配置", SysConfigService.PRACTICE_TEACHER_ORGAN_RANGE);
         }
 
         List<Integer> includeTeacherIds = new ArrayList<>();
-        List<ExtendTeacherBasicDto> organAndSubjectTeachers = teacherDao.findTeaTeachersByOrganAndSubject4(organIdConfig.getParanValue(), subjectId);
+        List<ExtendTeacherBasicDto> organAndSubjectTeachers = teacherDao.findTeaTeachersByOrganAndSubject4(organIdConfig, subjectId);
         if (CollectionUtils.isEmpty(organAndSubjectTeachers)) {
             return new ArrayList<>();
         }

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

@@ -382,7 +382,7 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public boolean leave(Integer userId, Long courseScheduleId, String remark) {
+    public boolean leave(Integer userId, Long courseScheduleId, String remark,Integer tenantId) {
 
         CourseSchedule courseSchedule = courseScheduleDao.get(courseScheduleId);
         if (courseSchedule == null) {
@@ -395,10 +395,10 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 
         Date date = new Date();
 
-        int hours = 4;
-        String str = sysConfigDao.findConfigValue(SysConfigService.ADVANCE_LEAVE_HOURS);
-        if (StringUtils.isNotBlank(str)) {
-            hours = Integer.parseInt(str);
+        String tenantConfigValue = sysTenantConfigService.getTenantConfigValue(SysConfigService.ADVANCE_LEAVE_HOURS,tenantId);
+        Integer hours = 0;
+        if(StringUtils.isNotEmpty(tenantConfigValue)){
+            hours = Integer.parseInt(tenantConfigValue);
         }
 
         if (DateUtil.addHours(date, hours).after(courseSchedule.getStartClassTime())) {
@@ -584,9 +584,9 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
         CourseSchedule courseSchedule = courseScheduleDao.get(firstCourseId);
         String continueCourseTime = null;
         if(courseSchedule.getTeachMode() == TeachModeEnum.OFFLINE){
-            continueCourseTime = sysTenantConfigService.getConfigValue(SysConfigService.OFFLINE_CONTINUE_COURSE_MINUTES,courseSchedule.getTenantId());
+            continueCourseTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.OFFLINE_CONTINUE_COURSE_MINUTES,courseSchedule.getTenantId());
         }else {
-            continueCourseTime = sysTenantConfigService.getConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME,courseSchedule.getTenantId());
+            continueCourseTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME,courseSchedule.getTenantId());
         }
         if (StringUtils.isEmpty(continueCourseTime)) {
             continueCourseTime = "5";
@@ -704,9 +704,9 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
         String continueCourseTime = null;
         CourseSchedule schedule = courseScheduleList.get(0);
         if(schedule.getTeachMode() == TeachModeEnum.OFFLINE){
-            continueCourseTime = sysTenantConfigService.getConfigValue(SysConfigService.OFFLINE_CONTINUE_COURSE_MINUTES,schedule.getTenantId());
+            continueCourseTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.OFFLINE_CONTINUE_COURSE_MINUTES,schedule.getTenantId());
         }else {
-            continueCourseTime = sysTenantConfigService.getConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME,schedule.getTenantId());
+            continueCourseTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME,schedule.getTenantId());
         }
         if (StringUtils.isEmpty(continueCourseTime)) {
             continueCourseTime = "5";

+ 6 - 18
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysTenantConfigServiceImpl.java

@@ -45,17 +45,13 @@ public class SysTenantConfigServiceImpl extends BaseServiceImpl<Integer, SysTena
 	}
 
 	@Override
-	public ConcurrentHashMap<String, String> getTenantConfig(Integer tenantId) {
-		return tenantConfig.get(tenantId);
-	}
-
-	@Override
-	public String getTenantConfigValue(Integer tenantId,String paramName) {
+	public String getTenantConfigValue(String paramName,Integer tenantId) {
 		ConcurrentHashMap<String, String> map = tenantConfig.get(tenantId);
 		if(map != null){
 			return map.get(paramName);
 		}
-		return null;
+		applicationEventPublisher.publishEvent(new TenantConfigChangeEvent(this,tenantId));
+		return sysTenantConfigDao.getConfigValue(paramName,tenantId);
 	}
 
 	@Override
@@ -81,19 +77,11 @@ 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);
-	}
-
-	@Override
-	public Map<String, String> queryAllMap(Integer tenantId) {
+	public ConcurrentHashMap<String, String> queryAllMap(Integer tenantId) {
 		List<Map<String, String>> maps = sysTenantConfigDao.queryAllMap(tenantId);
-		Map<String, String> resultMap = null;
+		ConcurrentHashMap<String, String> resultMap = null;
 		if(maps != null){
-			resultMap = MapUtil.convertMybatisMap(maps);
+			resultMap = new ConcurrentHashMap(MapUtil.convertMybatisMap(maps));
 		}
 		return resultMap;
 	}

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

@@ -27,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
 import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.Collectors;
 
 import static com.ym.mec.biz.dal.enums.ComplaintsStatusEnum.REPEAL;
@@ -365,9 +366,9 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 		//是否是连堂课
 		String continueCourseTime = null;
 		if(courseSchedule.getTeachMode() == TeachModeEnum.OFFLINE){
-			continueCourseTime = sysTenantConfigService.getConfigValue(SysConfigService.OFFLINE_CONTINUE_COURSE_MINUTES,courseSchedule.getTenantId());
+			continueCourseTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.OFFLINE_CONTINUE_COURSE_MINUTES,courseSchedule.getTenantId());
 		}else {
-			continueCourseTime = sysTenantConfigService.getConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME,courseSchedule.getTenantId());
+			continueCourseTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME,courseSchedule.getTenantId());
 		}
 		if (StringUtils.isEmpty(continueCourseTime)) {
 			continueCourseTime = "5";
@@ -761,18 +762,17 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 
 	//校验考勤申诉
 	void checkComplaints(JobNatureEnum jobNatureEnum,Integer tenantId,Date classDate){
-		Map<String, String> tenantConfig = sysTenantConfigService.getTenantConfig(tenantId);
 		String salary = null;
 		String type = null;
 		if(jobNatureEnum == PART_TIME){
-			salary = tenantConfig.get(SysConfigService.PARP_TEACHER_SALARY);
-			type = tenantConfig.get(SysConfigService.PARP_TEACHER_SALARY_TYPE);
+			salary = sysTenantConfigService.getTenantConfigValue(SysConfigService.PARP_TEACHER_SALARY,tenantId);
+			type = sysTenantConfigService.getTenantConfigValue(SysConfigService.PARP_TEACHER_SALARY_TYPE,tenantId);
 		}else if (jobNatureEnum == FULL_TIME){
-			salary = tenantConfig.get(SysConfigService.FULL_TEACHER_SALARY);
-			type = tenantConfig.get(SysConfigService.FULL_TEACHER_SALARY_TYPE);
+			salary = sysTenantConfigService.getTenantConfigValue(SysConfigService.FULL_TEACHER_SALARY,tenantId);
+			type = sysTenantConfigService.getTenantConfigValue(SysConfigService.FULL_TEACHER_SALARY_TYPE,tenantId);
 		}else if (jobNatureEnum == LABOUR){
-			salary = tenantConfig.get(SysConfigService.LABOUR_TEACHER_SALARY);
-			type = tenantConfig.get(SysConfigService.LABOUR_TEACHER_SALARY_TYPE);
+			salary = sysTenantConfigService.getTenantConfigValue(SysConfigService.LABOUR_TEACHER_SALARY,tenantId);
+			type = sysTenantConfigService.getTenantConfigValue(SysConfigService.LABOUR_TEACHER_SALARY_TYPE,tenantId);
 		}
 		if(StringUtils.isNotEmpty(salary) && StringUtils.isNotEmpty(type)){
 			Integer day = Integer.parseInt(salary);

+ 5 - 92
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherCourseScheduleServiceImpl.java

@@ -1,23 +1,18 @@
 package com.ym.mec.biz.service.impl;
 
-import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.dao.CourseScheduleDao;
 import com.ym.mec.biz.dal.dto.CourseScheduleDto;
-import com.ym.mec.biz.dal.dto.StudentNameAndPhoneDto;
 import com.ym.mec.biz.dal.entity.CourseSchedule;
-import com.ym.mec.biz.dal.entity.SysConfig;
-import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
-import com.ym.mec.biz.dal.enums.CourseStatusEnum;
 import com.ym.mec.biz.dal.enums.GroupType;
-import com.ym.mec.biz.service.SysConfigService;
 import com.ym.mec.biz.service.TeacherCourseScheduleService;
 import com.ym.mec.common.exception.BizException;
-import com.ym.mec.util.collection.MapUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.util.CollectionUtils;
 
-import java.util.*;
-import java.util.stream.Collectors;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
 
 /**
  * @Author Joburgess
@@ -28,14 +23,6 @@ public class TeacherCourseScheduleServiceImpl implements TeacherCourseScheduleSe
 
     @Autowired
     private CourseScheduleDao courseScheduleDao;
-    @Autowired
-    private SubjectDao subjectDao;
-    @Autowired
-    private StudentAttendanceDao studentAttendanceDao;
-    @Autowired
-    private ClassGroupStudentMapperDao classGroupStudentMapperDao;
-    @Autowired
-    private SysConfigService sysConfigService;
 
     @Override
     public List<Date> findTeacherHaveClassesDates(Integer teacherId, Date month, String groupId, GroupType type) {
@@ -43,80 +30,6 @@ public class TeacherCourseScheduleServiceImpl implements TeacherCourseScheduleSe
     }
 
     @Override
-    public List<CourseScheduleDto> findCourseSchedulesWithDate(Integer teacherId, Date classDate, String groupId, GroupType groupType) {
-        Date now = new Date();
-        if(Objects.isNull(classDate)){
-            classDate=now;
-        }
-        List<CourseScheduleDto> teacherCourseSchedulesWithDate = courseScheduleDao.findCourseSchedulesWithDate(teacherId,classDate,groupId,groupType);
-        List<Long> allCourseScheduleIds = teacherCourseSchedulesWithDate.stream().map(CourseScheduleDto::getId).collect(Collectors.toList());
-        List<Long> courseScheduleIds = teacherCourseSchedulesWithDate.stream().map(CourseScheduleDto::getId).collect(Collectors.toList());
-
-        Map<Integer, String> subjectNameCourseMap = new HashMap<>();
-        Map<Integer, String> subjectIdCourseMap = new HashMap<>();
-        if (!CollectionUtils.isEmpty(courseScheduleIds)) {
-            List<Map<Integer, String>> subjectNameCourseMaps = subjectDao.findSubjectNameCourseMaps(courseScheduleIds);
-            List<Map<Integer, String>> subjectIdCourseMaps = subjectDao.findClassGroupSubjectId(courseScheduleIds);
-            subjectNameCourseMap = MapUtil.convertMybatisMap(subjectNameCourseMaps);
-            subjectIdCourseMap = MapUtil.convertMybatisMap(subjectIdCourseMaps);
-        }
-        List<Map<Integer, Integer>> studentNumCourseMaps = null;
-        if (!CollectionUtils.isEmpty(allCourseScheduleIds)) {
-            studentNumCourseMaps = studentAttendanceDao.countStudentAttendancesByCourses(allCourseScheduleIds);
-        }
-        Map<Integer, Long> studentNumCourseMap = new HashMap<>();
-        if (Objects.nonNull(studentNumCourseMaps)) {
-            studentNumCourseMap = MapUtil.convertIntegerMap(studentNumCourseMaps);
-        }
-
-        if(CollectionUtils.isEmpty(teacherCourseSchedulesWithDate)){
-            return teacherCourseSchedulesWithDate;
-        }
-
-        List<Integer> classGroupIds = teacherCourseSchedulesWithDate.stream().map(CourseScheduleDto::getClassGroupId).collect(Collectors.toList());
-        List<Map<Integer, Integer>> classGroupStudentNumMaps = classGroupStudentMapperDao.countClassGroupsStudentNum(classGroupIds, ClassGroupStudentStatusEnum.NORMAL);
-        Map<Integer, Long> classGroupStudentNumMap = MapUtil.convertIntegerMap(classGroupStudentNumMaps);
-
-        SysConfig advanceLeaveHoursConfig = sysConfigService.findByParamName(SysConfigService.ADVANCE_LEAVE_HOURS);
-        Integer advanceLeaveHours=advanceLeaveHoursConfig.getParanValue(Integer.class);
-        List<Map<Long, Integer>> courseLeaveStudentNumMaps = studentAttendanceDao.countCourseLeaveStudentNumWithFourHoursAgo(allCourseScheduleIds, advanceLeaveHours);
-        Map<Long,Long> courseLeaveStudentNumMap = MapUtil.convertIntegerMap((courseLeaveStudentNumMaps));
-
-        for (CourseScheduleDto courseScheduleDto : teacherCourseSchedulesWithDate) {
-            Long studentNum = studentNumCourseMap.get(courseScheduleDto.getId());
-            if (Objects.nonNull(studentNum)) {
-                courseScheduleDto.setStudentAttendanceIsFirstTime(studentNum > 0 ? 0 : 1);
-            } else {
-                courseScheduleDto.setStudentAttendanceIsFirstTime(1);
-            }
-
-            if (now.before(courseScheduleDto.getStartClassTime())) {
-                courseScheduleDto.setStatus(CourseStatusEnum.NOT_START);
-            } else if (now.after(courseScheduleDto.getEndClassTime())) {
-                courseScheduleDto.setStatus(CourseStatusEnum.OVER);
-            } else {
-                courseScheduleDto.setStatus(CourseStatusEnum.UNDERWAY);
-            }
-            if (Objects.nonNull(courseScheduleDto.getClassGroupId())) {
-                List<StudentNameAndPhoneDto> courseStudentNameAndPhone = classGroupStudentMapperDao.findCourseStudentNameAndPhone(courseScheduleDto.getId().intValue());
-                if(!CollectionUtils.isEmpty(courseStudentNameAndPhone)){
-                    List<String> studentNames = courseStudentNameAndPhone.stream().map(StudentNameAndPhoneDto::getUserName).collect(Collectors.toList());
-                    courseScheduleDto.setStudentNames(org.apache.commons.lang3.StringUtils.join(studentNames, ","));
-                    courseScheduleDto.setStudents(courseStudentNameAndPhone);
-                }
-            }
-            courseScheduleDto.setSubjectName(subjectNameCourseMap.get(courseScheduleDto.getId()));
-            courseScheduleDto.setSubjectId(subjectIdCourseMap.get(courseScheduleDto.getId()));
-            Long leaveStudentNum = courseLeaveStudentNumMap.get(courseScheduleDto.getId());
-            Long normalStudentNum = classGroupStudentNumMap.get(courseScheduleDto.getClassGroupId());
-            if(Objects.nonNull(leaveStudentNum)&&Objects.nonNull(normalStudentNum)&&leaveStudentNum.intValue()==normalStudentNum.intValue()){
-                courseScheduleDto.setEnableAdjustInToday(1);
-            }
-        }
-        return teacherCourseSchedulesWithDate;
-    }
-
-    @Override
     public List<CourseScheduleDto> findGroupClassesWithCourse(Long courseScheduleId) {
         if(Objects.isNull(courseScheduleId)){
             throw new BizException("请指定课程");

+ 7 - 7
mec-biz/src/main/resources/config/mybatis/DemoGroupMapper.xml

@@ -17,6 +17,7 @@
         <result column="price_" property="price"/>
         <result column="subject_id_" property="subjectId"/>
         <result column="subject_name_" property="subjectName"/>
+        <result column="tenant_id_" property="tenantId"/>
     </resultMap>
 
     <resultMap id="studentDemoGroupListDto" type="com.ym.mec.biz.dal.dto.StudentDemoGroupListDto">
@@ -52,6 +53,7 @@
             dg.user_id_,
             dg.price_,
             dg.subject_id_,
+            dg.tenant_id_,
             s.name_ subject_name_
         FROM
             demo_group dg
@@ -62,20 +64,18 @@
     <!-- 向数据库增加一条记录 -->
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.DemoGroup" useGeneratedKeys="true" keyColumn="id"
             keyProperty="id">
-        <!--
-        <selectKey resultClass="int" keyProperty="id" >
-        SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
-        </selectKey>
-        -->
         INSERT INTO demo_group
-        (name_,single_class_minutes_,organ_id_list_,create_time_,update_time_,user_id_,price_,subject_id_)
-        VALUES(#{name},#{singleClassMinutes},#{organIdList},now(),now(),#{userId},#{price},#{subjectId})
+        (name_,single_class_minutes_,organ_id_list_,create_time_,update_time_,user_id_,price_,subject_id_,tenant_id_)
+        VALUES(#{name},#{singleClassMinutes},#{organIdList},now(),now(),#{userId},#{price},#{subjectId},#{tenantId})
     </insert>
 
     <!-- 根据主键查询一条记录 -->
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.DemoGroup">
         UPDATE demo_group
         <set>
+            <if test="tenantId != null">
+                tenant_id_ = #{tenantId},
+            </if>
             <if test="userId != null">
                 user_id_ = #{userId},
             </if>

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

@@ -35,6 +35,7 @@
         <result column="total_price_" property="totalPrice"/>
         <result column="activity_user_mapper_id_" property="activityUserMapperId"/>
         <result column="vip_group_activity_id_" property="vipGroupActivityId"/>
+        <result column="tenant_id_" property="tenantId"/>
     </resultMap>
 
     <resultMap id="PracticeCourseDto" type="com.ym.mec.biz.dal.dto.PracticeCourseDto" extends="PracticeGroup">
@@ -76,6 +77,9 @@
             <if test="vipGroupActivityId != null">
                 vip_group_activity_id_ = #{vipGroupActivityId},
             </if>
+            <if test="tenantId != null">
+                tenant_id_ = #{tenantId},
+            </if>
             <if test="activityUserMapperId != null">
                 activity_user_mapper_id_ = #{activityUserMapperId},
             </if>
@@ -169,13 +173,13 @@
          organ_id_,courses_start_date_,courses_expire_date_,create_time_,update_time_,
          memo_,buy_months_,drill_times_on_week_,drill_times_json_,group_status_,
          be_renew_group_id_,educational_teacher_id_,payment_expire_date_,registration_start_time_,
-         course_num_,total_price_,activity_user_mapper_id_,vip_group_activity_id_)
+         course_num_,total_price_,activity_user_mapper_id_,vip_group_activity_id_,tenant_id_)
         VALUES(#{name},#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
                #{subjectId},#{userId},#{studentId},#{singleClassMinutes},#{organId},#{coursesStartDate},
                #{coursesExpireDate},NOW(),NOW(),#{memo},#{buyMonths},#{drillTimesOnWeek},#{drillTimesJson},
                #{groupStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{beRenewGroupId},
                #{educationalTeacherId},#{paymentExpireDate},#{registrationStartTime},#{allCourseNum},
-               #{totalPrice},#{activityUserMapperId},#{vipGroupActivityId})
+               #{totalPrice},#{activityUserMapperId},#{vipGroupActivityId},#{tenantId})
     </insert>
 
     <select id="getUserFreePracticeGroup" resultMap="PracticeGroup">
@@ -301,6 +305,9 @@
             <if test="teacherId != null">
                 AND pg.user_id_=#{teacherId}
             </if>
+            <if test="tenantId != null">
+                AND pg.tenanr_id_ = #{tenantId}
+            </if>
             <if test="studentId != null">
                 AND pg.student_id_ = #{studentId}
             </if>
@@ -364,6 +371,9 @@
     <sql id="practiceGroupReviewsQueryCondition">
         <where>
             pg.group_status_ != 'LOCK'
+            <if test="tenantId != null">
+                AND pg.tenanr_id_ = #{tenantId}
+            </if>
             <if test="month != null">
                 AND DATE_FORMAT(cse.create_time_, '%Y-%m') = #{month}
             </if>

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

@@ -105,7 +105,7 @@ public class RoomServiceImpl implements RoomService {
     public Integer getCurrentCourseId(String roomId){
         CourseSchedule courseSchedule = courseScheduleDao.get(Long.parseLong(roomId));
         //是否是连堂课
-        String continueCourseTime = sysTenantConfigService.getConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME,courseSchedule.getTenantId());
+        String continueCourseTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME,courseSchedule.getTenantId());
         if (StringUtils.isEmpty(continueCourseTime)) {
             continueCourseTime = "5";
         }
@@ -140,7 +140,7 @@ public class RoomServiceImpl implements RoomService {
         }
 
         //是否是连堂课
-        String continueCourseTime = sysTenantConfigService.getConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME,courseSchedule.getTenantId());
+        String continueCourseTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME,courseSchedule.getTenantId());
         if (StringUtils.isEmpty(continueCourseTime)) {
             continueCourseTime = "5";
         }

+ 14 - 11
mec-student/src/main/java/com/ym/mec/student/controller/PracticeGroupController.java

@@ -102,13 +102,12 @@ public class PracticeGroupController extends BaseController {
         if (sysUser == null) {
             return failed(HttpStatus.FORBIDDEN, "请登录");
         }
-        Map<String,Object> result=practiceGroupService.getPracticeApplyParams(sysUser.getId());
-//        if(ENABLE_APPLY_ORGANIDS.contains(sysUser.getOrganId())){
-            Integer applyTimes = practiceGroupDao.countUserPracticeApplyRecord(sysUser.getId());
-            result.put("enableApply", applyTimes < 1 ? 1 : 0);
-//        }else{
-//            result.put("enableApply", 0);
-//        }
+        if (sysUser.getTenantId() == null) {
+            return failed( "用户机构信息异常");
+        }
+        Map<String,Object> result=practiceGroupService.getPracticeApplyParams(sysUser.getId(),sysUser.getTenantId());
+        Integer applyTimes = practiceGroupDao.countUserPracticeApplyRecord(sysUser.getId());
+        result.put("enableApply", applyTimes < 1 ? 1 : 0);
         return succeed(result);
     }
 
@@ -163,10 +162,11 @@ public class PracticeGroupController extends BaseController {
         if(excludeOrganIds.contains(sysUser.getOrganId())){
             throw new BizException("请联系老师确认您的所属分部");
         }
-//        if(!ENABLE_APPLY_ORGANIDS.contains(sysUser.getOrganId())){
-//            throw new BizException("陪练课预约活动已结束");
-//        }
+        if(sysUser.getTenantId() == null){
+            throw new BizException("请联系老师确认您的所属机构");
+        }
         practiceGroup.setStudentId(sysUser.getId());
+        practiceGroup.setTenantId(sysUser.getTenantId());
         return succeed(practiceGroupService.practiceApply(practiceGroup));
     }
 
@@ -177,7 +177,10 @@ public class PracticeGroupController extends BaseController {
         if (sysUser == null) {
             return failed(HttpStatus.FORBIDDEN, "请登录");
         }
-        return succeed(practiceGroupService.getPayPracticeApplyParams(sysUser.getId(), Objects.nonNull(organId)?organId:sysUser.getOrganId()));
+        if(sysUser.getTenantId() == null){
+            throw new BizException("请联系老师确认您的所属机构");
+        }
+        return succeed(practiceGroupService.getPayPracticeApplyParams(sysUser.getId(), Objects.nonNull(organId)?organId:sysUser.getOrganId(),sysUser.getTenantId()));
     }
 
     @ApiOperation("获取指定教师的空闲时间——付费")

+ 4 - 1
mec-student/src/main/java/com/ym/mec/student/controller/StudentCourseScheduleController.java

@@ -70,7 +70,10 @@ public class StudentCourseScheduleController extends BaseController {
 		if (user == null) {
 			return failed(HttpStatus.FORBIDDEN, "请登录");
 		}
-		studentAttendanceService.leave(user.getId(), courseScheduleId, reason);
+		if (user.getTenantId() == null) {
+			return failed("机构信息异常,请联系老师确认机构信息");
+		}
+		studentAttendanceService.leave(user.getId(), courseScheduleId, reason,user.getTenantId());
 		return succeed();
 	}
 

+ 20 - 3
mec-teacher/src/main/java/com/ym/mec/teacher/controller/DemoGroupController.java

@@ -8,7 +8,9 @@ import com.ym.mec.biz.dal.dto.DemoGroupApplyDto;
 import com.ym.mec.biz.dal.entity.Teacher;
 import com.ym.mec.biz.service.DemoGroupService;
 import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.biz.service.SysTenantConfigService;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.exception.BizException;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
@@ -31,11 +33,11 @@ public class DemoGroupController extends BaseController {
     @Autowired
     private DemoGroupService demoGroupService;
     @Autowired
-    private SysConfigDao sysConfigDao;
-    @Autowired
     private TeacherDao teacherDao;
     @Autowired
     private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private SysTenantConfigService sysTenantConfigService;
 
     @ApiOperation(value = "试听课申请")
     @PostMapping("/demoGroupApply")
@@ -44,6 +46,9 @@ public class DemoGroupController extends BaseController {
         if(Objects.isNull(user)){
             return failed(HttpStatus.FORBIDDEN,"请登录");
         }
+        if(Objects.isNull(user.getTenantId())){
+            return failed("机构信息异常,请联系管理员");
+        }
         Teacher teacher = teacherDao.get(user.getId());
         String organId = teacher.getTeacherOrganId().toString();
         if(StringUtils.isNotEmpty(teacher.getFlowOrganRangeId())){
@@ -51,6 +56,7 @@ public class DemoGroupController extends BaseController {
         }
         demoGroup.setUserId(user.getId());
         demoGroup.setOrganIdList(organId);
+        demoGroup.setTenantId(user.getTenantId());
         demoGroupService.demoGroupApply(demoGroup);
         return succeed();
     }
@@ -58,7 +64,18 @@ public class DemoGroupController extends BaseController {
     @ApiOperation(value = "获取试听课课程时长")
     @GetMapping("/getSingleClassMinutes")
     public Object getSingleClassMinutes(){
-        return succeed(sysConfigDao.findConfigValue(SysConfigService.DEMO_GROUP_SINGLE_CLASS_MINUTES_).split(","));
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if(Objects.isNull(user)){
+            return failed(HttpStatus.FORBIDDEN,"请登录");
+        }
+        if(Objects.isNull(user.getTenantId())){
+            return failed("机构信息异常,请联系管理员");
+        }
+        String configValue = sysTenantConfigService.getTenantConfigValue(SysConfigService.DEMO_GROUP_SINGLE_CLASS_MINUTES_, user.getTenantId());
+        if(StringUtils.isEmpty(configValue)){
+            throw new BizException("请配置试听课单课时时长");
+        }
+        return succeed(configValue.split(","));
     }
 
     @ApiOperation(value = "获取老师试听课")

+ 17 - 4
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherCourseScheduleController.java

@@ -20,6 +20,7 @@ import com.ym.mec.biz.dal.page.StudentAttendanceQueryInfo;
 import com.ym.mec.biz.service.CourseScheduleService;
 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.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
@@ -30,6 +31,7 @@ import com.yonge.log.model.AuditLogAnnotation;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.MediaType;
@@ -58,6 +60,8 @@ public class TeacherCourseScheduleController extends BaseController {
     @Autowired
     private StudentAttendanceDao studentAttendanceDao;
     @Autowired
+    private SysTenantConfigService sysTenantConfigService;
+    @Autowired
     private ClassGroupStudentMapperDao classGroupStudentMapperDao;
 
     @ApiOperation(value = "根据月份获取该月有课的日期")
@@ -78,16 +82,19 @@ public class TeacherCourseScheduleController extends BaseController {
             return failed("请指定日期!");
         }
         SysUser user = sysUserFeignService.queryUserInfo();
-        if(null==user){
+        if(null == user){
             return failed(HttpStatus.FORBIDDEN, "请登录");
         }
+        if(null == user.getTenantId()){
+            return failed("用户机构信息异常,请联系管理员");
+        }
         SysConfig sysConfig = sysConfigService.findByParamName(SysConfigService.ENABLE_STUDENT_ATTENDANCE_TIME_RANGE);
         SysConfig offlineSignInEarlyForwardTime = sysConfigService.findByParamName(SysConfigService.OFFLINE_SIGN_IN_EARLY_FORWARD_TIME);
         SysConfig sysConfigVip = sysConfigService.findByParamName(SysConfigService.ENABLE_STUDENT_ATTENDANCE_TIME_RANGE_VIP);
         SysConfig courseBeforeBufferTime = sysConfigService.findByParamName(SysConfigService.COURSE_BEFORE_BUFFER_TIME);
         SysConfig courseAfterBufferTime = sysConfigService.findByParamName(SysConfigService.COURSE_AFTER_BUFFER_TIME);
         SysConfig studentAttendanceAfterTimeConfig = sysConfigService.findByParamName(SysConfigService.ENABLE_STUDENT_ATTENDANCE_BEFOR_COURSE_START_TIME_RANGE_VIP);
-        List<CourseScheduleDto> teacherCourseSchedulesWithDate = scheduleService.getTeacherCourseSchedulesWithDate(user.getId(),date,type);
+        List<CourseScheduleDto> teacherCourseSchedulesWithDate = scheduleService.getTeacherCourseSchedulesWithDate(user.getId(),date,type,user.getTenantId());
         Map<String,Object> result = new HashMap<>();
         result.put("rows",teacherCourseSchedulesWithDate);
         result.put("appealHoursRange",4);
@@ -202,6 +209,9 @@ public class TeacherCourseScheduleController extends BaseController {
         if(Objects.isNull(oldCourseSchedule)){
             return failed("未找到指定课程");
         }
+        if(Objects.isNull(oldCourseSchedule.getTenantId())){
+            return failed("课程机构信息异常");
+        }
         if(oldCourseSchedule.getGroupType() != GroupType.VIP){
         	return failed("客户端只能调整VIP课");
         }
@@ -211,8 +221,11 @@ public class TeacherCourseScheduleController extends BaseController {
         }
         
         //默认开课前4小时内,可调整,如果全员请假,可在当天24小时前调整
-        SysConfig advanceLeaveHoursConfig = sysConfigService.findByParamName(SysConfigService.ENABLE_TEACHER_COURSE_ADJUST_DEFAULT_HOURS);
-        Integer advanceLeaveHours=advanceLeaveHoursConfig.getParanValue(Integer.class);
+        String advanceLeaveHoursConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.ENABLE_TEACHER_COURSE_ADJUST_DEFAULT_HOURS,oldCourseSchedule.getTenantId());
+        Integer advanceLeaveHours = 0;
+        if(StringUtils.isNotEmpty(advanceLeaveHoursConfig)){
+            advanceLeaveHours = Integer.parseInt(advanceLeaveHoursConfig);
+        }
         
         List<Long> newCourseScheduleIds = new ArrayList<Long>();
         newCourseScheduleIds.add(oldCourseSchedule.getId());

+ 1 - 1
mec-util/src/main/java/com/ym/mec/util/collection/MapUtil.java

@@ -126,7 +126,7 @@ public class MapUtil {
 		if(maps != null){
 			size = maps.size();
 		}
-		Map result=new HashMap(size);
+		Map result = new HashMap(size);
 		maps.forEach(stringIntegerMap -> {
 			if(Objects.isNull(stringIntegerMap)){
 				return;

+ 8 - 1
mec-web/src/main/java/com/ym/mec/web/controller/PracticeGroupManageController.java

@@ -97,7 +97,14 @@ public class PracticeGroupManageController extends BaseController {
     @GetMapping(value = "/getPracticeApplySubjects")
     @PreAuthorize("@pcs.hasPermissions('practiceGroupManage/getPracticeApplySubjects')")
     public HttpResponseResult getPracticeApplySubjects(){
-        return succeed(practiceGroupService.getPracticeApplySubjects());
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        if (sysUser.getTenantId() == null) {
+            return failed("用户机构信息异常");
+        }
+        return succeed(practiceGroupService.getPracticeApplySubjects(sysUser.getTenantId()));
     }
 
     @ApiOperation(value = "关闭课程组")

+ 8 - 2
mec-web/src/main/java/com/ym/mec/web/controller/education/EduPracticeGroupController.java

@@ -100,7 +100,10 @@ public class EduPracticeGroupController extends BaseController {
         if(Objects.isNull(student)){
             throw new BizException("指定的学生不存在");
         }
-        return succeed(practiceGroupService.getPayPracticeApplyParams(studentId, student.getOrganId()));
+        if(sysUser.getTenantId() == null){
+            throw new BizException("所属机构信息异常");
+        }
+        return succeed(practiceGroupService.getPayPracticeApplyParams(studentId, student.getOrganId(),sysUser.getTenantId()));
     }
 
     @ApiOperation("获取指定教师的空闲时间——付费")
@@ -251,11 +254,14 @@ public class EduPracticeGroupController extends BaseController {
         if(Objects.isNull(studentId)){
             throw new BizException("请指定学生");
         }
+        if(Objects.isNull(sysUser.getTenantId())){
+            throw new BizException("用户机构信息不存在");
+        }
         SysUser student = teacherDao.getUser(studentId);
         if(Objects.isNull(student)){
             throw new BizException("指定的学生不存在");
         }
-        return succeed(eduPracticeGroupService.getTrialPracticeApplyParams(studentId));
+        return succeed(eduPracticeGroupService.getTrialPracticeApplyParams(studentId,sysUser.getTenantId()));
     }
 
     @ApiOperation("获取转化失败的学员列表")