Pārlūkot izejas kodu

feat:vip课活动课配置是否允许线上调线下

Joburgess 4 gadi atpakaļ
vecāks
revīzija
0b7bdf1ce9

+ 13 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/VipGroupActivity.java

@@ -90,13 +90,23 @@ public class VipGroupActivity {
 	private Integer studentMaxUsedTimes;
 
 	@ApiModelProperty(value = "适用学生类型:-1:所有;0:老用户;1:新用户")
-	private int  applyToStudentType = -1;
+	private Integer  applyToStudentType = -1;
 
-	public int getApplyToStudentType() {
+	private Boolean allowOnlineToOffline = false;
+
+	public Boolean getAllowOnlineToOffline() {
+		return allowOnlineToOffline;
+	}
+
+	public void setAllowOnlineToOffline(Boolean allowOnlineToOffline) {
+		this.allowOnlineToOffline = allowOnlineToOffline;
+	}
+
+	public Integer getApplyToStudentType() {
 		return applyToStudentType;
 	}
 
-	public void setApplyToStudentType(int applyToStudentType) {
+	public void setApplyToStudentType(Integer applyToStudentType) {
 		this.applyToStudentType = applyToStudentType;
 	}
 

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

@@ -18,6 +18,7 @@ import java.util.stream.Stream;
 
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.*;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.service.*;
 import com.ym.mec.common.controller.BaseController;
@@ -42,36 +43,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.entity.SysUserRole;
-import com.ym.mec.biz.dal.entity.ClassGroup;
-import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
-import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
-import com.ym.mec.biz.dal.entity.ClassGroupTeacherSalary;
-import com.ym.mec.biz.dal.entity.CourseGenerateDto;
-import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
-import com.ym.mec.biz.dal.entity.CourseScheduleAuditDetailDto;
-import com.ym.mec.biz.dal.entity.CourseScheduleComplaints;
-import com.ym.mec.biz.dal.entity.CourseScheduleEvaluate;
-import com.ym.mec.biz.dal.entity.CourseScheduleModifyLog;
-import com.ym.mec.biz.dal.entity.CourseScheduleReview;
-import com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment;
-import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
-import com.ym.mec.biz.dal.entity.CoursesGroup;
-import com.ym.mec.biz.dal.entity.CoursesGroupModifyLog;
-import com.ym.mec.biz.dal.entity.Group;
-import com.ym.mec.biz.dal.entity.MusicGroup;
-import com.ym.mec.biz.dal.entity.PracticeGroup;
-import com.ym.mec.biz.dal.entity.School;
-import com.ym.mec.biz.dal.entity.StudentAttendance;
-import com.ym.mec.biz.dal.entity.StudentCourseScheduleRecordDto;
-import com.ym.mec.biz.dal.entity.Subject;
-import com.ym.mec.biz.dal.entity.SysConfig;
-import com.ym.mec.biz.dal.entity.Teacher;
-import com.ym.mec.biz.dal.entity.TeacherAttendance;
-import com.ym.mec.biz.dal.entity.TeacherDefaultMusicGroupSalary;
-import com.ym.mec.biz.dal.entity.TeacherDefaultPracticeGroupSalary;
-import com.ym.mec.biz.dal.entity.TeacherDefaultVipGroupSalary;
-import com.ym.mec.biz.dal.entity.VipGroup;
 import com.ym.mec.biz.dal.page.CourseScheduleQueryInfo;
 import com.ym.mec.biz.dal.page.EndCourseScheduleQueryInfo;
 import com.ym.mec.biz.dal.page.StudentCourseScheduleRecordQueryInfo;
@@ -180,6 +152,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 	private StudentServeService studentServeService;
     @Autowired
 	private EmployeeDao employeeDao;
+    @Autowired
+	private VipGroupActivityDao vipGroupActivityDao;
 
     private final Logger LOGGER = LoggerFactory
             .getLogger(this.getClass());
@@ -2652,6 +2626,21 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         Date coursesExpireDate = null;
         Date coursesStartDate = null;
         GroupType groupType = vipGroupCourseAdjustInfo.getGroupType();
+
+		VipGroup vipGroup=null;
+		VipGroupActivity vipGroupActivity = null;
+
+		if(groupType == VIP) {
+			vipGroup = vipGroupDao.get(vipGroupCourseAdjustInfo.getVipGroupId().longValue());
+			if(Objects.isNull(vipGroup)){
+				throw new BizException("课程组信息不存在");
+			}
+			vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupActivityId());
+			if(Objects.isNull(vipGroupActivity)){
+				throw new BizException("课程组信息异常");
+			}
+		}
+
         switch (vipGroupCourseAdjustInfo.getGroupType()){
             case PRACTICE:
                 PracticeGroup practiceGroup = practiceGroupDao.get(vipGroupCourseAdjustInfo.getVipGroupId().longValue());
@@ -2664,7 +2653,6 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
                 coursesStartDate = practiceGroup.getCoursesStartDate();
                 break;
             default:
-                VipGroup vipGroup = vipGroupDao.get(vipGroupCourseAdjustInfo.getVipGroupId().longValue());
                 if (Objects.isNull(vipGroup)) {
                     throw new BizException("指定课程不存在");
                 }
@@ -2764,10 +2752,14 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
                     courseSchedules.get(courseStartDates.size() - 1).setStartClassTime(courseStartTime);
                     courseSchedules.get(courseStartDates.size() - 1).setEndClassTime(courseEndTime);
                     if (Objects.nonNull(vipGroupCourseAdjustInfo.getTeachMode())) {
-                        if(courseSchedules.get(courseStartDates.size() - 1).getTeachMode().equals(TeachModeEnum.ONLINE)
-                            &&vipGroupCourseAdjustInfo.getTeachMode().equals(TeachModeEnum.OFFLINE)){
+                    	boolean onlineToOffline = courseSchedules.get(courseStartDates.size() - 1).getTeachMode().equals(TeachModeEnum.ONLINE)
+								&&vipGroupCourseAdjustInfo.getTeachMode().equals(TeachModeEnum.OFFLINE);
+                        if(onlineToOffline&&!vipGroupActivity.getAllowOnlineToOffline()){
                             throw new BizException("VIP课不支持从线上调整到线下");
                         }
+						if(onlineToOffline&&Objects.isNull(vipGroupCourseAdjustInfo.getSchoolId())){
+							throw new BizException("请选择教学点");
+						}
                         courseSchedules.get(courseStartDates.size() - 1).setTeachMode(vipGroupCourseAdjustInfo.getTeachMode());
                         if (vipGroupCourseAdjustInfo.getTeachMode().equals(TeachModeEnum.OFFLINE)) {
                             if(Objects.nonNull(vipGroupCourseAdjustInfo.getSchoolId())){
@@ -2809,8 +2801,6 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
             }
         }
 		if(groupType == VIP){
-			VipGroup vipGroup = vipGroupDao.get(vipGroupCourseAdjustInfo.getVipGroupId().longValue());
-
 			CourseSchedule courseSchedule = courseSchedules.stream().max(Comparator.comparing(CourseSchedule::getEndClassTime)).get();
 //
 //			BigDecimal teacherSalary=BigDecimal.ZERO;
@@ -3380,7 +3370,15 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			}
 
 			if (VIP.equals(newCourseSchedule.getGroupType())){
-				if(TeachModeEnum.OFFLINE.equals(newCourseSchedule.getTeachMode())&&TeachModeEnum.ONLINE.equals(oldCourseSchedule.getTeachMode())){
+				VipGroup vipGroup = vipGroupDao.get(Long.valueOf(oldCourseSchedule.getMusicGroupId()));
+				if(Objects.isNull(vipGroup)){
+					throw new BizException("课程组信息不存在");
+				}
+				VipGroupActivity vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupActivityId());
+				if(Objects.isNull(vipGroupActivity)){
+					throw new BizException("课程组信息异常");
+				}
+				if(TeachModeEnum.OFFLINE.equals(newCourseSchedule.getTeachMode())&&TeachModeEnum.ONLINE.equals(oldCourseSchedule.getTeachMode())&&!vipGroupActivity.getAllowOnlineToOffline()){
 					throw new BizException("VIP课不支持从线上调整到线下");
 				}
 			}

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

@@ -35,6 +35,7 @@
 		<result property="maxCourseNum" column="max_course_num_"/>
 		<result property="studentMaxUsedTimes" column="student_max_used_times_"/>
 		<result property="applyToStudentType" column="apply_to_student_type_"/>
+		<result property="allowOnlineToOffline" column="allow_online_to_offline_"/>
 	</resultMap>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -57,10 +58,10 @@
 		INSERT INTO vip_group_activity (id_,name_,description_,vip_group_category_id_list_,start_time_,end_time_,organ_id_,courses_start_time_,courses_end_time_,type_,
 		                                attribute1_,attribute2_,attribute3_,salary_readonly_flag_,give_class_pay_salary_flag_,create_time_,update_time_,salary_settlement_json_,del_flag_,
 		                                payment_readonly_flag_,online_class_join_gradient_rewards_,offline_class_join_gradient_rewards_,min_course_num_,max_course_num_,
-										student_max_used_times_, apply_to_student_type_)
+										student_max_used_times_, apply_to_student_type_,allow_online_to_offline_)
 		VALUES(#{id},#{name},#{description},#{vipGroupCategoryIdList},#{startTime},#{endTime},#{organId},#{coursesStartTime},#{coursesEndTime},#{type},#{attribute1},#{attribute2},#{attribute3},
 		       #{salaryReadonlyFlag},#{giveClassPaySalaryFlag},now(),now(),#{salarySettlementJson},#{delFlag},#{paymentReadonlyFlag},#{onlineClassJoinGradientRewards},
-		       #{offlineClassJoinGradientRewards},#{minCourseNum},#{maxCourseNum},#{studentMaxUsedTimes},#{applyToStudentType})
+		       #{offlineClassJoinGradientRewards},#{minCourseNum},#{maxCourseNum},#{studentMaxUsedTimes},#{applyToStudentType},#{allowOnlineToOffline})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -142,6 +143,9 @@
 			<if test="applyToStudentType!=null">
 				apply_to_student_type_=#{applyToStudentType},
 			</if>
+			<if test="allowOnlineToOffline!=null">
+				allow_online_to_offline_=#{allowOnlineToOffline},
+			</if>
 			update_time_ = NOW(),
 		</set>WHERE id_ = #{id}
 	</update>