소스 검색

Merge branch 'system_fee' into apply_multi_order

# Conflicts:
#	mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
yonge 4 년 전
부모
커밋
6390f3c4cb

+ 4 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/CourseViewTypeEnum.java

@@ -4,10 +4,11 @@ import com.ym.mec.common.enums.BaseEnum;
 
 public enum CourseViewTypeEnum implements BaseEnum<Integer, CourseViewTypeEnum> {
 //    COURSE_lIST(0, "课程详情", 2),
-//    AMR(1, "器乐练习系统", 4),
-//    CLOUD_TEACHER(2, "云教练收费", 4),
     COURSE_FEE(0, "课程收费", 2),
-    MEMBER_FEE(1, "会员收费", 4);
+    AMR(1, "器乐练习系统", 4),
+//    CLOUD_TEACHER(2, "云教练收费", 4),
+
+    MEMBER_FEE(2, "会员收费", 4);
 //    CLOUD_TEACHER_PLUS(3, "云教练+收费", 5);
 
     private Integer code;

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/MusicGroupQueryInfo.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.page;
 
+import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
 import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
 import com.ym.mec.common.page.QueryInfo;
 import io.swagger.annotations.ApiModelProperty;
@@ -34,6 +35,16 @@ public class MusicGroupQueryInfo extends QueryInfo {
 
     private String searchType;
 
+    private CourseViewTypeEnum courseViewType;
+
+    public CourseViewTypeEnum getCourseViewType() {
+        return courseViewType;
+    }
+
+    public void setCourseViewType(CourseViewTypeEnum courseViewType) {
+        this.courseViewType = courseViewType;
+    }
+
     public String getSearchType() {
         return searchType;
     }

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

@@ -222,11 +222,10 @@ public interface SysConfigService extends BaseService<Long, SysConfig> {
     //会员结束前5天提醒学员续费(退团提醒)(默认提前5天)
     String PUSH_MEMBER_RENEW_QUIT = "push_member_renew_quit";
 
-    //会员结束后3天学员自动退团
-    String MEMBER_END_AUTO_QUIT_MUSIC = "member_end_auto_quit_music";
-
     String CHILDREN_DAY_VIP_ACTIVITY_IDS = "children_day_vip_activity_ids";
 
+    String HOMEWORK_OPEN_FLAG = "homework_open_flag";
+
     /**
      * @return com.ym.mec.biz.dal.entity.SysConfig
      * @params paramName

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

@@ -588,6 +588,7 @@ public class CourseReviewServiceImpl extends BaseServiceImpl<Integer, CourseSche
                 if (Objects.isNull(existHomework)) {
                     studentCourseHomework.setCourseHomeworkId(courseHomework.getId());
                     studentCourseHomework.setUserId(courseScheduleStudentPayment.getUserId());
+                    studentCourseHomework.setMusicScoreId(musicScoreId);
                     studentCourseHomework.setCourseScheduleId(courseSchedule.getId());
                     studentCourseHomework.setCreateTime(date);
                     studentCourseHomework.setUpdateTime(date);

+ 15 - 8
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -220,19 +220,26 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 
         int normalRemindNum = studentAttendanceDao.countNormalRemindNum(courseID);
         currentCourseDetail.setNormalRemind(normalRemindNum<=0?0:1);
-
-		CourseSchedule courseSchedule = courseScheduleDao.get(courseID);
-		MusicGroup musicGroup = musicGroupDao.get(courseSchedule.getMusicGroupId());
-		if(musicGroup != null){
-			currentCourseDetail.setCourseViewType(musicGroup.getCourseViewType());
-		}
 		currentCourseDetail.setCurrentTime(new Date());
         currentCourseDetail.setAdvanceSignInMinutes(Integer.parseInt(sysConfigDao.findConfigValue(SysConfigService.ADVANCE_SIGN_IN_MINUTES)));
 		currentCourseDetail.setAttendanceRange(CourseScheduleType.VIP.equals(currentCourseDetail.getCourseType())?Integer.parseInt(sysConfigDao.findConfigValue(SysConfigService.ATTENDANCE_RANGE_VIP)):Integer.parseInt(sysConfigDao.findConfigValue(SysConfigService.ATTENDANCE_RANGE)));
         currentCourseDetail.setAdvanceSignOutMinutes(Integer.parseInt(sysConfigDao.findConfigValue(SysConfigService.ADVANCE_SIGN_OUT_MINUTES)));
-		List<BasicUserDto> students = courseScheduleStudentPaymentDao.findStudents(courseID);
 		//获取有会员的学员数
-		currentCourseDetail.setMemberNum(studentDao.getMemberNum(StringUtils.join(students, ",")));
+		String configValue = sysConfigDao.findConfigValue(SysConfigService.HOMEWORK_OPEN_FLAG);
+		if(StringUtils.isEmpty(configValue)){
+			configValue = "0";
+		}
+		if(configValue.equals("0")){
+			currentCourseDetail.setMemberNum(0);
+		}else {
+			CourseSchedule courseSchedule = courseScheduleDao.get(courseID);
+			MusicGroup musicGroup = musicGroupDao.get(courseSchedule.getMusicGroupId());
+			if(musicGroup != null){
+				currentCourseDetail.setCourseViewType(musicGroup.getCourseViewType());
+			}
+			List<BasicUserDto> students = courseScheduleStudentPaymentDao.findStudents(courseID);
+			currentCourseDetail.setMemberNum(studentDao.getMemberNum(StringUtils.join(students, ",")));
+		}
 		return currentCourseDetail;
     }
 

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

@@ -11,6 +11,7 @@ import com.ym.mec.biz.dal.page.ExtraExercilseReplyQueryInfo;
 import com.ym.mec.biz.dal.page.StudentCourseHomeWorkQueryInfo;
 import com.ym.mec.biz.service.ExtracurricularExercisesReplyService;
 import com.ym.mec.biz.service.StudentServeService;
+import com.ym.mec.biz.service.SysConfigService;
 import com.ym.mec.biz.service.SysMessageService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
@@ -50,6 +51,8 @@ public class ExtracurricularExercisesReplyServiceImpl extends BaseServiceImpl<Lo
 	@Autowired
 	private StudentDao studentDao;
 	@Autowired
+	private SysConfigDao sysConfigDao;
+	@Autowired
 	private CourseScheduleDao courseScheduleDao;
 	@Autowired
 	private StudentServeService studentServeService;
@@ -100,10 +103,18 @@ public class ExtracurricularExercisesReplyServiceImpl extends BaseServiceImpl<Lo
 		detail.setStudentName(extraExerciseReply.getStudentName());
 		detail.setExpiryDate(extraExerciseReply.getExpireDate());
 		detail.setType("EXTRA");
-		Student student = studentDao.get(extraExerciseReply.getUserId());
-		detail.setHasMember(student.getMemberRankSettingId()==null?0:1);
-		detail.setMusicScoreId(extraExerciseReply.getMusicScoreId());
-		detail.setMusicScoreName(extraExerciseReply.getMusicScoreName());
+		String configValue = sysConfigDao.findConfigValue(SysConfigService.HOMEWORK_OPEN_FLAG);
+		if(StringUtils.isEmpty(configValue)){
+			configValue = "0";
+		}
+		if(configValue.equals("0")){
+			detail.setHasMember(0);
+		}else {
+			detail.setMusicScoreId(extraExerciseReply.getMusicScoreId());
+			detail.setMusicScoreName(extraExerciseReply.getMusicScoreName());
+			Student student = studentDao.get(extraExerciseReply.getUserId());
+			detail.setHasMember(student.getMemberRankSettingId()==null?0:1);
+		}
 		return detail;
 	}
 

+ 11 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -1957,7 +1957,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             if (hasPaid && musicGroupSubjectPlan != null) {
                 musicGroupSubjectPlan.setUpdateTime(date);
                 //减去缴费人数(器乐收费,0元时不减缴费人数)
-                if (musicGroup.getCourseViewType().equals(CourseViewTypeEnum.MEMBER_FEE) || musicGroup.getCourseViewType().equals(CourseViewTypeEnum.MEMBER_FEE)) {
+                if (musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE) {
                     
                 	for(StudentPaymentOrder studentPaymentOrder : studentPaymentOrderList){
                 		if (studentPaymentOrder != null && "200".equals(studentPaymentOrder.getPaymentAccountNo())) {
@@ -2236,7 +2236,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         if (hasPaid && musicGroupSubjectPlan != null) {
             musicGroupSubjectPlan.setUpdateTime(date);
             //减去缴费人数(器乐收费,0元时不减缴费人数)
-            if (musicGroup.getCourseViewType().equals(CourseViewTypeEnum.MEMBER_FEE) || musicGroup.getCourseViewType().equals(CourseViewTypeEnum.MEMBER_FEE)) {
+            if (musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE) {
             	
             	for(StudentPaymentOrder studentPaymentOrder : studentPaymentOrderList){
             		if (studentPaymentOrder != null && studentPaymentOrder.getPaymentAccountNo() != null && studentPaymentOrder.getPaymentAccountNo().equals("200")) {
@@ -3016,6 +3016,15 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                 musicGroupPaymentCalenderCourseSettingsDao.deleteByMusicGroupPaymentCalenderId(calenderIds);
             }
         }
+        //课程团和amr可以互相修改,但不可以改为会员团
+        if(group.getCourseViewType() != musicGroup.getCourseViewType()){
+            if(group.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
+                throw new BizException("会员收费乐团不可更改收费模式");
+            }
+            if(musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
+                throw new BizException("当前乐团收费模式不可更改为会员收费");
+            }
+        }
         musicGroup.setUpdateTime(date);
         musicGroupDao.update(musicGroup);
         // 删除乐团付费主体列表

+ 14 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentCourseHomeworkServiceImpl.java

@@ -72,6 +72,8 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
     private PracticeGroupDao practiceGroupDao;
     @Autowired
     private ExtracurricularExercisesReplyDao extracurricularExercisesReplyDao;
+    @Autowired
+    private SysConfigDao sysConfigDao;
 
     @Override
     public BaseDAO<Long, StudentCourseHomework> getDAO() {
@@ -208,8 +210,18 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
             }
         }
         courseHomeworkStudentDetail.setType("HOMEWORK");
-        Student student = studentDao.get(userId.intValue());
-        courseHomeworkStudentDetail.setHasMember(student.getMemberRankSettingId()==null?0:1);
+        String configValue = sysConfigDao.findConfigValue(SysConfigService.HOMEWORK_OPEN_FLAG);
+        if(StringUtils.isEmpty(configValue)){
+            configValue = "0";
+        }
+        if(configValue.equals("0")){
+            courseHomeworkStudentDetail.setMusicScoreId(null);
+            courseHomeworkStudentDetail.setMusicScoreName(null);
+            courseHomeworkStudentDetail.setHasMember(0);
+        }else {
+            Student student = studentDao.get(userId.intValue());
+            courseHomeworkStudentDetail.setHasMember(student.getMemberRankSettingId()==null?0:1);
+        }
         return courseHomeworkStudentDetail;
     }
 

+ 26 - 12
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServeServiceImpl.java

@@ -45,7 +45,7 @@ public class StudentServeServiceImpl implements StudentServeService {
     @Autowired
     private StudentServeService studentServeService;
     @Autowired
-    private SysConfigService sysConfigService;
+    private SysConfigDao sysConfigDao;
     @Autowired
     private ClassGroupStudentMapperDao classGroupStudentMapperDao;
     @Autowired
@@ -311,9 +311,9 @@ public class StudentServeServiceImpl implements StudentServeService {
         Date nextMonday = Date.from(sunDayDate.plusDays(1).atStartOfDay(DateUtil.zoneId).toInstant());
 
         Set<String> holidayDays = new HashSet<>();
-        SysConfig holidaySetting = sysConfigService.findByParamName(SysConfigService.HOLIDAY_SETTING);
-        if(Objects.nonNull(holidaySetting)&&StringUtils.isNotBlank(holidaySetting.getParanValue())){
-            holidayDays = new HashSet<>(JSON.parseArray(holidaySetting.getParanValue(), String.class));
+        String holidaySetting = sysConfigDao.findConfigValue(SysConfigService.HOLIDAY_SETTING);
+        if(StringUtils.isNotEmpty(holidaySetting)){
+            holidayDays = new HashSet<>(JSON.parseArray(holidaySetting, String.class));
         }
         LocalDate everyDay=monDayDate;
         boolean weekInHoliday = true;
@@ -910,10 +910,18 @@ public class StudentServeServiceImpl implements StudentServeService {
             result.put("isAssignHomework", 0);
             return result;
         }
+        String configValue = sysConfigDao.findConfigValue(SysConfigService.HOMEWORK_OPEN_FLAG);
+        if(StringUtils.isEmpty(configValue)){
+            configValue = "0";
+        }
         List<Integer> studentIds=new ArrayList<>();
         if(StringUtils.isNotBlank(studentIdsStr)){
-            //获取有会员的学员数
-            result.put("memberNum", studentDao.getMemberNum(studentIdsStr));
+            if(configValue.equals("0")){
+                result.put("memberNum",0);
+            }else {
+                //获取有会员的学员数
+                result.put("memberNum", studentDao.getMemberNum(studentIdsStr));
+            }
             studentIds= Arrays.asList(studentIdsStr.split(",")).stream().map(id->Integer.valueOf(id)).collect(Collectors.toList());
         }
 
@@ -925,14 +933,20 @@ public class StudentServeServiceImpl implements StudentServeService {
                 result.put("isAssignHomework", 0);
                 return result;
             }
-            MusicGroup musicGroup = musicGroupDao.get(courseSchedule.getMusicGroupId());
-            if(musicGroup != null){
-                result.put("courseViewType", CourseViewTypeEnum.MEMBER_FEE);
+            if(configValue.equals("0")){
+                result.put("memberNum",0);
+                result.put("courseViewType", CourseViewTypeEnum.COURSE_FEE);
             }else {
-                List<BasicUserDto> students = courseScheduleStudentPaymentDao.findStudents(courseScheduleId);
-                Set<Integer> collect = students.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
-                result.put("memberNum", studentDao.getMemberNum(StringUtils.join(collect,",")));
+                MusicGroup musicGroup = musicGroupDao.get(courseSchedule.getMusicGroupId());
+                if(musicGroup != null){
+                    result.put("courseViewType", musicGroup.getCourseViewType());
+                }else if(result.get("memberNum") == null){
+                    List<BasicUserDto> students = courseScheduleStudentPaymentDao.findStudents(courseScheduleId);
+                    Set<Integer> collect = students.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
+                    result.put("memberNum", studentDao.getMemberNum(StringUtils.join(collect,",")));
+                }
             }
+
             localDate=LocalDateTime.ofInstant(courseSchedule.getClassDate().toInstant(), DateUtil.zoneId).toLocalDate();
             List<CourseScheduleStudentPayment> courseScheduleStudentPayments = courseScheduleStudentPaymentDao.findByCourseSchedule(courseScheduleId);
             if(CollectionUtils.isEmpty(courseScheduleStudentPayments)){

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

@@ -1371,7 +1371,7 @@
 			</foreach>
 		</if>
 		GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d')
-		UNION
+		UNION ALL
 		SELECT spo.organ_id_,SUM(CASE WHEN spo.actual_amount_ IS NULL THEN 0 ELSE spo.actual_amount_ END +
 		CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) total_num_
 		,DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') month_
@@ -1403,7 +1403,7 @@
 			</foreach>
 		</if>
 		GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d')
-		UNION
+		UNION ALL
 		SELECT spo.organ_id_,SUM(CASE WHEN spod.price_ IS NULL THEN 0 ELSE spod.price_ END) total_num_,DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') month_
 		FROM student_payment_order spo
 			   LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_

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

@@ -232,6 +232,9 @@
             <if test="transactionTeacherId!=null">
                 AND transaction_teacher_id_ = #{transactionTeacherId}
             </if>
+            <if test="courseViewType != null">
+                AND course_view_type_ = #{courseViewType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+            </if>
             <if test="musicGroupIds!=null and musicGroupIds.size()>0">
                 AND id_ IN
                 <foreach collection="musicGroupIds" item="musicGroupId" open="(" close=")" separator=",">
@@ -879,7 +882,7 @@
     </select>
     <sql id="queryMusicMemberListSql">
         <where>
-            sr.music_group_status_ = 'NORMAL' AND mg.course_view_type_ = 1
+            sr.music_group_status_ = 'NORMAL' AND mg.course_view_type_ = 2
             AND mg.status_ = 'PROGRESS'
             <if test="search != null and search != ''">
                 AND (mg.name_ LIKE CONCAT('%',#{search},'%') OR mg.id_ LIKE CONCAT('%',#{search},'%') OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.id_ = #{search})

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

@@ -1512,7 +1512,8 @@
     <select id="checkHasMemberGroup" resultType="java.lang.Boolean">
         SELECT COUNT(sr.id_) > 0 FROM student_registration sr
         LEFT JOIN music_group mg ON mg.id_ = sr.music_group_id_
-        WHERE sr.music_group_id_ != #{musicGroupId} AND sr.music_group_status_ != 'QUIT' AND sr.user_id_ = #{userId} AND mg.course_view_type_ = 1
+        WHERE sr.music_group_id_ != #{musicGroupId} AND sr.music_group_status_ != 'QUIT'
+          AND sr.user_id_ = #{userId} AND mg.course_view_type_ = 2
     </select>
 
     <!-- 获取报名相关数据 -->
@@ -1540,7 +1541,7 @@
         SELECT sr.music_group_id_,sr.user_id_ FROM student_registration sr
         LEFT JOIN music_group mg ON mg.id_ = sr.music_group_id_
         LEFT JOIN cloud_teacher_order cto ON cto.student_id_ = sr.user_id_ AND cto.status_ IN (1,2)
-        WHERE sr.music_group_status_ = 'NORMAL' AND mg.course_view_type_ = 1
+        WHERE sr.music_group_status_ = 'NORMAL' AND mg.course_view_type_ = 2
         AND mg.status_ = 'PROGRESS'
         <if test="educationUserId != null">
             AND mg.educational_teacher_id_ = #{educationUserId}