Browse Source

Merge branch 'system_fee' of http://git.dayaedu.com/yonge/mec into system_fee

yonge 4 years ago
parent
commit
b47a4d5092

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupSchoolTermCourseDetailDao.java

@@ -22,6 +22,13 @@ public interface MusicGroupSchoolTermCourseDetailDao extends BaseDAO<Integer, Mu
                                                                      @Param("courseFlag") Integer courseFlag);
                                                                      @Param("courseFlag") Integer courseFlag);
 
 
     /**
     /**
+     * 获取所选时间乐团的预排课明细
+     * @param musicGroupId
+     * @return
+     */
+    List<MusicGroupSchoolTermCourseDetail> findByMusicGroupId(@Param("musicGroupId") String musicGroupId);
+
+    /**
      * 获取所有未确认的预排课数据
      * 获取所有未确认的预排课数据
      * @return
      * @return
      */
      */

+ 20 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ExtraExerciseStudentsDto.java

@@ -17,6 +17,10 @@ public class ExtraExerciseStudentsDto extends ExtracurricularExercisesReply {
 
 
     private String teacherName;
     private String teacherName;
 
 
+    private Integer musicScoreId;
+
+    private String musicScoreName;
+
     private String headUrl;
     private String headUrl;
 
 
     private String title;
     private String title;
@@ -37,6 +41,22 @@ public class ExtraExerciseStudentsDto extends ExtracurricularExercisesReply {
 
 
     private String existVipCourseStr;
     private String existVipCourseStr;
 
 
+    public Integer getMusicScoreId() {
+        return musicScoreId;
+    }
+
+    public void setMusicScoreId(Integer musicScoreId) {
+        this.musicScoreId = musicScoreId;
+    }
+
+    public String getMusicScoreName() {
+        return musicScoreName;
+    }
+
+    public void setMusicScoreName(String musicScoreName) {
+        this.musicScoreName = musicScoreName;
+    }
+
     public String getHeadUrl() {
     public String getHeadUrl() {
         return headUrl;
         return headUrl;
     }
     }

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

@@ -60,6 +60,16 @@ public class ExtracurricularExercises {
 
 
 	private Integer musicScoreId;
 	private Integer musicScoreId;
 
 
+	private String musicScoreName;
+
+	public String getMusicScoreName() {
+		return musicScoreName;
+	}
+
+	public void setMusicScoreName(String musicScoreName) {
+		this.musicScoreName = musicScoreName;
+	}
+
 	public Integer getMusicScoreId() {
 	public Integer getMusicScoreId() {
 		return musicScoreId;
 		return musicScoreId;
 	}
 	}

+ 16 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentService.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.service;
 package com.ym.mec.biz.service;
 
 
 import java.text.ParseException;
 import java.text.ParseException;
+import java.util.List;
 
 
 import com.ym.mec.biz.dal.entity.CooperationOrgan;
 import com.ym.mec.biz.dal.entity.CooperationOrgan;
 import com.ym.mec.biz.dal.entity.Student;
 import com.ym.mec.biz.dal.entity.Student;
@@ -71,5 +72,20 @@ public interface StudentService extends BaseService<Integer, Student> {
      */
      */
     void updateMemberRank(Integer userId, Integer rankSettingId, PeriodEnum periodEnum, int quantityPerPeriod);
     void updateMemberRank(Integer userId, Integer rankSettingId, PeriodEnum periodEnum, int quantityPerPeriod);
 
 
+    /**
+     * 更新学员会员信息
+     */
+    void batchUpdateMemberRank(List<Integer> studentIds, Integer rankSettingId, PeriodEnum periodEnum, int quantityPerPeriod);
+
+    /**
+     * 更新服务指标
+     * @param studentId
+     * @param studentIds
+     * @param serviceTag
+     */
+    void updateStudentServiceTag(Integer studentId,List<Integer> studentIds,Integer serviceTag);
+
+    List<String> getStudentNames(List<Integer> studentIdList);
+
     Student getLocked(Integer userId);
     Student getLocked(Integer userId);
 }
 }

+ 15 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -136,7 +136,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     @Autowired
     @Autowired
     private SysConfigService sysConfigService;
     private SysConfigService sysConfigService;
     @Autowired
     @Autowired
-    private StudentDao studentDao;
+//    private StudentDao studentDao;
+//    @Autowired
+    private StudentService studentService;
     @Autowired
     @Autowired
     private MusicGroupPaymentCalenderCourseSettingsService musicGroupPaymentCalenderCourseSettingsService;
     private MusicGroupPaymentCalenderCourseSettingsService musicGroupPaymentCalenderCourseSettingsService;
     @Autowired
     @Autowired
@@ -1351,7 +1353,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             }
             }
             if(totalCourseScheduleStudentPayments.size() > 0){
             if(totalCourseScheduleStudentPayments.size() > 0){
                 courseScheduleStudentPaymentService.batchInsert(totalCourseScheduleStudentPayments);
                 courseScheduleStudentPaymentService.batchInsert(totalCourseScheduleStudentPayments);
-                studentDao.updateStudentServiceTag(studentId, null, YesOrNoEnum.YES.getCode());
+                studentService.updateStudentServiceTag(studentId, null, YesOrNoEnum.YES.getCode());
             }
             }
 
 
             if(!CollectionUtils.isEmpty(courseScheduleList)){
             if(!CollectionUtils.isEmpty(courseScheduleList)){
@@ -1857,7 +1859,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
 
         if (classGroup4MixDtos.get(0).getType().equals(ClassGroupTypeEnum.MUSIC_NETWORK)) {
         if (classGroup4MixDtos.get(0).getType().equals(ClassGroupTypeEnum.MUSIC_NETWORK)) {
             teachMode = TeachModeEnum.ONLINE;
             teachMode = TeachModeEnum.ONLINE;
-            List<String> studentNames = studentDao.getStudentNames(studentIdList);
+            List<String> studentNames = studentService.getStudentNames(studentIdList);
             classGroup4MixDtos.get(0).setClassGroupName(subjectNames + "•" + StringUtils.join(studentNames, ","));
             classGroup4MixDtos.get(0).setClassGroupName(subjectNames + "•" + StringUtils.join(studentNames, ","));
         }
         }
 
 
@@ -2059,7 +2061,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         //学生结算表
         //学生结算表
         if (courseScheduleList.size() > 0) {
         if (courseScheduleList.size() > 0) {
             courseScheduleStudentPaymentService.createForMusicGroup(musicGroupId, courseScheduleList, studentIdList);
             courseScheduleStudentPaymentService.createForMusicGroup(musicGroupId, courseScheduleList, studentIdList);
-            studentDao.updateStudentServiceTag(null, studentIdList, YesOrNoEnum.YES.getCode());
+            studentService.updateStudentServiceTag(null, studentIdList, YesOrNoEnum.YES.getCode());
         }
         }
         //创建IM群组
         //创建IM群组
         addImGroup(classGroup, userIds, teacherIds);
         addImGroup(classGroup, userIds, teacherIds);
@@ -2605,7 +2607,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         }
         }
 
 
         if (!CollectionUtils.isEmpty(studentList)) {
         if (!CollectionUtils.isEmpty(studentList)) {
-            studentDao.updateStudentServiceTag(null, studentIds, YesOrNoEnum.YES.getCode());
+            studentService.updateStudentServiceTag(null, studentIds, YesOrNoEnum.YES.getCode());
 
 
             //学生结算表
             //学生结算表
             courseScheduleStudentPaymentService.createForMusicGroup(musicGroupId, courseScheduleList, studentIds);
             courseScheduleStudentPaymentService.createForMusicGroup(musicGroupId, courseScheduleList, studentIds);
@@ -2649,7 +2651,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         //更新学员服务指标
         //更新学员服务指标
         List<CourseScheduleStudentPayment> studentPayments = courseScheduleStudentPaymentDao.findByCourseScheduleIds(courseScheduleIds);
         List<CourseScheduleStudentPayment> studentPayments = courseScheduleStudentPaymentDao.findByCourseScheduleIds(courseScheduleIds);
         List<Integer> studentIds = studentPayments.stream().map(e -> e.getUserId()).collect(Collectors.toList());
         List<Integer> studentIds = studentPayments.stream().map(e -> e.getUserId()).collect(Collectors.toList());
-        studentDao.updateStudentServiceTag(null, studentIds, YesOrNoEnum.YES.getCode());
+        studentService.updateStudentServiceTag(null, studentIds, YesOrNoEnum.YES.getCode());
         //初始化老师考勤表
         //初始化老师考勤表
         List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaries = courseScheduleTeacherSalaryDao.findByCourseSchedules(courseScheduleIds);
         List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaries = courseScheduleTeacherSalaryDao.findByCourseSchedules(courseScheduleIds);
         List<TeacherAttendance> teacherIdByCourseSchedule = teacherAttendanceDao.findTeacherIdByCourseSchedule(courseScheduleIds);
         List<TeacherAttendance> teacherIdByCourseSchedule = teacherAttendanceDao.findTeacherIdByCourseSchedule(courseScheduleIds);
@@ -2676,6 +2678,12 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             teacherAttendanceDao.batchInsert(teacherAttendances);
             teacherAttendanceDao.batchInsert(teacherAttendances);
         }
         }
         imUserFriendService.refreshGroupImUserFriend(termCourseDetail.getMusicGroupId(),MUSIC);
         imUserFriendService.refreshGroupImUserFriend(termCourseDetail.getMusicGroupId(),MUSIC);
+        //是否是该乐团第一次会员排课
+        List<MusicGroupSchoolTermCourseDetail> termCourseDetails = musicGroupSchoolTermCourseDetailDao.findByMusicGroupId(termCourseDetail.getMusicGroupId());
+        if(termCourseDetails.size() == 1){
+            MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(termCourseDetail.getMusicGroupId());
+            studentService.batchUpdateMemberRank(studentIds,calender.getMemberRankSettingId(),PeriodEnum.MONTH,calender.getMemberValidDate());
+        }
     }
     }
 
 
     @Override
     @Override
@@ -3221,7 +3229,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         //学生结算表
         //学生结算表
         if (!CollectionUtils.isEmpty(studentIdList)) {
         if (!CollectionUtils.isEmpty(studentIdList)) {
             courseScheduleStudentPaymentService.createForMusicGroup(musicGroupId, courseScheduleList, studentIdList);
             courseScheduleStudentPaymentService.createForMusicGroup(musicGroupId, courseScheduleList, studentIdList);
-            studentDao.updateStudentServiceTag(null, studentIdList, YesOrNoEnum.YES.getCode());
+            studentService.updateStudentServiceTag(null, studentIdList, YesOrNoEnum.YES.getCode());
         }
         }
         return classGroup;
         return classGroup;
     }
     }

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

@@ -102,6 +102,10 @@ public class ExtracurricularExercisesReplyServiceImpl extends BaseServiceImpl<Lo
 		detail.setStudentName(extraExerciseReply.getStudentName());
 		detail.setStudentName(extraExerciseReply.getStudentName());
 		detail.setExpiryDate(extraExerciseReply.getExpireDate());
 		detail.setExpiryDate(extraExerciseReply.getExpireDate());
 		detail.setType("EXTRA");
 		detail.setType("EXTRA");
+		Student student = studentDao.get(extraExerciseReply.getUserId());
+		detail.setHasMember(student.getMemberRankSettingId()==null?0:1);
+		detail.setMusicScoreId(extraExerciseReply.getMusicScoreId());
+		detail.setMusicScoreName(extraExerciseReply.getMusicScoreName());
 		return detail;
 		return detail;
 	}
 	}
 
 

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

@@ -256,10 +256,6 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		musicGroupPaymentCalenderDetail.setCreateTime(date);
 		musicGroupPaymentCalenderDetail.setCreateTime(date);
 		musicGroupPaymentCalenderDetail.setExpectAmount(totalPrice);
 		musicGroupPaymentCalenderDetail.setExpectAmount(totalPrice);
 		if (musicGroupPaymentCalenderDetail.getExpectAmount().compareTo(totalPrice) == 0) {
 		if (musicGroupPaymentCalenderDetail.getExpectAmount().compareTo(totalPrice) == 0) {
-			// 添加会员有效时长
-			if(calender.getMemberRankSettingId() != null){
-				studentService.updateMemberRank(userId,calender.getMemberRankSettingId(),PeriodEnum.MONTH,6);
-			}
 			musicGroupPaymentCalenderDetail.setPaymentStatus(MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED);
 			musicGroupPaymentCalenderDetail.setPaymentStatus(MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED);
 		} else {
 		} else {
 			musicGroupPaymentCalenderDetail.setPaymentStatus(MusicGroupStudentFee.PaymentStatus.NON_PAYMENT);
 			musicGroupPaymentCalenderDetail.setPaymentStatus(MusicGroupStudentFee.PaymentStatus.NON_PAYMENT);

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

@@ -147,6 +147,12 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 
 		List<MusicGroupPaymentDateRange> musicGroupPaymentDateRangeList = musicGroupPaymentCalenderDto.getMusicGroupPaymentDateRangeList();
 		List<MusicGroupPaymentDateRange> musicGroupPaymentDateRangeList = musicGroupPaymentCalenderDto.getMusicGroupPaymentDateRangeList();
 
 
+		if(musicGroupPaymentCalenderDto.getMemberRankSettingId() != null){
+			if(paymentType != ADD_STUDENT && paymentType != MUSIC_APPLY){
+				throw new BizException("操作失败:{} 不支持会员收费",paymentType.getDesc());
+			}
+		}
+
 		if ((paymentType == PaymentType.ADD_COURSE)) {
 		if ((paymentType == PaymentType.ADD_COURSE)) {
 			if(musicGroupPaymentDateRangeList.size() > 1){
 			if(musicGroupPaymentDateRangeList.size() > 1){
 				throw new BizException("[临时加课]不支持多周期缴费");
 				throw new BizException("[临时加课]不支持多周期缴费");
@@ -554,6 +560,12 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 
 		List<MusicGroupPaymentDateRange> musicGroupPaymentDateRangeList = musicGroupPaymentCalenderDto.getMusicGroupPaymentDateRangeList();
 		List<MusicGroupPaymentDateRange> musicGroupPaymentDateRangeList = musicGroupPaymentCalenderDto.getMusicGroupPaymentDateRangeList();
 
 
+		if(musicGroupPaymentCalenderDto.getMemberRankSettingId() != null){
+			if(paymentType != ADD_STUDENT && paymentType != MUSIC_APPLY){
+				throw new BizException("操作失败:{} 不支持会员收费",paymentType.getDesc());
+			}
+		}
+
 		if ((paymentType == PaymentType.ADD_COURSE) && musicGroupPaymentDateRangeList.size() > 1) {
 		if ((paymentType == PaymentType.ADD_COURSE) && musicGroupPaymentDateRangeList.size() > 1) {
 			throw new BizException("[临时加课]不支持多周期缴费");
 			throw new BizException("[临时加课]不支持多周期缴费");
 		}
 		}

+ 57 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java

@@ -10,6 +10,7 @@ import java.util.Objects;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
@@ -325,6 +326,62 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
         this.update(student);
         this.update(student);
     }
     }
 
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void batchUpdateMemberRank(List<Integer> studentIds, Integer rankSettingId, PeriodEnum periodEnum, int quantityPerPeriod) {
+        // 添加会员有效时长
+        List<Student> studentList = studentDao.findByStudentIds(studentIds);
+        Date nowDate = new Date();
+        for (Student student : studentList) {
+            if (student.getMemberRankSettingId() == null || nowDate.after(student.getMembershipEndTime())) {
+                switch (periodEnum) {
+                    case DAY:
+                        student.setMembershipEndTime(DateUtil.addDays(nowDate, quantityPerPeriod));
+                        break;
+                    case MONTH:
+                    case YEAR_HALF:
+                        student.setMembershipEndTime(DateUtil.addMonths(nowDate, quantityPerPeriod));
+                        break;
+                    case YEAR:
+                        student.setMembershipEndTime(DateUtil.addYears(nowDate, quantityPerPeriod));
+                        break;
+                    default:
+                        break;
+                }
+                student.setMembershipStartTime(nowDate);
+            } else {
+                switch (periodEnum) {
+                    case DAY:
+                        student.setMembershipEndTime(DateUtil.addMonths(student.getMembershipEndTime(), quantityPerPeriod));
+                        break;
+                    case MONTH:
+                    case YEAR_HALF:
+                        student.setMembershipEndTime(DateUtil.addMonths(student.getMembershipEndTime(), quantityPerPeriod));
+                        break;
+                    case YEAR:
+                        student.setMembershipEndTime(DateUtil.addMonths(student.getMembershipEndTime(), quantityPerPeriod));
+                        break;
+
+                    default:
+                        break;
+                }
+            }
+            student.setMemberRankSettingId(rankSettingId);
+            student.setUpdateTime(nowDate);
+        }
+        studentDao.batchUpdate(studentList);
+    }
+
+    @Override
+    public void updateStudentServiceTag(Integer studentId,List<Integer> studentIds,Integer serviceTag) {
+        studentDao.updateStudentServiceTag(studentId, studentIds, serviceTag);
+    }
+
+    @Override
+    public List<String> getStudentNames(List<Integer> studentIdList) {
+        return studentDao.getStudentNames(studentIdList);
+    }
+
 	@Override
 	@Override
 	public Student getLocked(Integer userId) {
 	public Student getLocked(Integer userId) {
 		return studentDao.getLocked(userId);
 		return studentDao.getLocked(userId);

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

@@ -22,6 +22,7 @@
 		<result column="update_time_" property="updateTime" />
 		<result column="update_time_" property="updateTime" />
 		<result column="organ_name_" property="organName" />
 		<result column="organ_name_" property="organName" />
 		<result column="music_score_id_" property="musicScoreId" />
 		<result column="music_score_id_" property="musicScoreId" />
+		<result column="music_score_name_" property="musicScoreName"/>
 	</resultMap>
 	</resultMap>
 
 
 	<sql id="queryPageCondition">
 	<sql id="queryPageCondition">

+ 5 - 0
mec-biz/src/main/resources/config/mybatis/ExtracurricularExercisesReplyMapper.xml

@@ -34,6 +34,8 @@
 		<result column="title_" property="title"/>
 		<result column="title_" property="title"/>
 		<result column="content_" property="content"/>
 		<result column="content_" property="content"/>
 		<result column="expire_date_" property="expireDate"/>
 		<result column="expire_date_" property="expireDate"/>
+		<result column="music_score_id_" property="musicScoreId" />
+		<result column="music_score_name_" property="musicScoreName"/>
 	</resultMap>
 	</resultMap>
 
 
 	<sql id="queryPageCondition">
 	<sql id="queryPageCondition">
@@ -197,10 +199,13 @@
 			ee.content_,
 			ee.content_,
 			ee.expire_date_,
 			ee.expire_date_,
 			ee.teacher_id_,
 			ee.teacher_id_,
+			ee.music_score_id_,
+			sms.name_ music_score_name_,
 			su.username_ student_name_
 			su.username_ student_name_
 		FROM
 		FROM
 			extracurricular_exercises_reply eer
 			extracurricular_exercises_reply eer
 			LEFT JOIN extracurricular_exercises ee ON ee.id_=eer.extracurricular_exercises_id_
 			LEFT JOIN extracurricular_exercises ee ON ee.id_=eer.extracurricular_exercises_id_
+			LEFT JOIN sys_music_score sms ON sms.id_ = ee.music_score_id_
 			LEFT JOIN sys_user su ON su.id_ = eer.user_id_
 			LEFT JOIN sys_user su ON su.id_ = eer.user_id_
 		WHERE
 		WHERE
 			eer.id_ = #{extraExerciseReplyId}
 			eer.id_ = #{extraExerciseReplyId}

+ 4 - 0
mec-biz/src/main/resources/config/mybatis/MusicGroupSchoolTermCourseDetailMapper.xml

@@ -74,6 +74,10 @@
 	<select id="queryCount" resultType="int">
 	<select id="queryCount" resultType="int">
 		SELECT COUNT(*) FROM music_group_school_term_course_detail
 		SELECT COUNT(*) FROM music_group_school_term_course_detail
 	</select>
 	</select>
+	<select id="findByMusicGroupId" resultMap="MusicGroupSchoolTermCourseDetail">
+		SELECT * FROM music_group_school_term_course_detail
+		WHERE music_group_id_ = #{musicGroupId}
+	</select>
 	<select id="findByCourseDateAndMusicGroupId" resultMap="MusicGroupSchoolTermCourseDetail">
 	<select id="findByCourseDateAndMusicGroupId" resultMap="MusicGroupSchoolTermCourseDetail">
 		SELECT * FROM music_group_school_term_course_detail
 		SELECT * FROM music_group_school_term_course_detail
 		WHERE music_group_id_ = #{musicGroupId}
 		WHERE music_group_id_ = #{musicGroupId}