zouxuan 2 年之前
父節點
當前提交
15cb054ec6

+ 2 - 176
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseScheduleStudentPayment.java

@@ -4,6 +4,7 @@ import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.JoinCourseType;
 import com.ym.mec.common.entity.BaseEntity;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
 import java.math.BigDecimal;
@@ -11,6 +12,7 @@ import java.math.BigDecimal;
 /**
  * 对应数据库表(course_schedule_student_payment):
  */
+@Data
 public class CourseScheduleStudentPayment extends BaseEntity implements Comparable<CourseScheduleStudentPayment> {
 
 	/**  */
@@ -72,46 +74,6 @@ public class CourseScheduleStudentPayment extends BaseEntity implements Comparab
 	@ApiModelProperty(value = "加入课程类型")
 	private JoinCourseType joinCourseType;
 
-	public BigDecimal getExpectPriceBak() {
-		return expectPriceBak;
-	}
-
-	public void setExpectPriceBak(BigDecimal expectPriceBak) {
-		this.expectPriceBak = expectPriceBak;
-	}
-
-	public BigDecimal getActualPriceBak() {
-		return actualPriceBak;
-	}
-
-	public void setActualPriceBak(BigDecimal actualPriceBak) {
-		this.actualPriceBak = actualPriceBak;
-	}
-
-	public Long getCalenderId() {
-		return calenderId;
-	}
-
-	public void setCalenderId(Long calenderId) {
-		this.calenderId = calenderId;
-	}
-
-	public Integer getActivityUserMapperId() {
-		return activityUserMapperId;
-	}
-
-	public void setActivityUserMapperId(Integer activityUserMapperId) {
-		this.activityUserMapperId = activityUserMapperId;
-	}
-
-	public Boolean getBeMerged() {
-		return beMerged;
-	}
-
-	public void setBeMerged(Boolean beMerged) {
-		this.beMerged = beMerged;
-	}
-
 	public CourseScheduleStudentPayment() {
 	}
 
@@ -127,142 +89,6 @@ public class CourseScheduleStudentPayment extends BaseEntity implements Comparab
 		this.courseScheduleId = courseScheduleId;
 	}
 
-	public String getExamSongDownloadJson() {
-		return examSongDownloadJson;
-	}
-
-	public void setExamSongDownloadJson(String examSongDownloadJson) {
-		this.examSongDownloadJson = examSongDownloadJson;
-	}
-
-	public String getOpenPlayMidi() {
-		return openPlayMidi;
-	}
-
-	public void setOpenPlayMidi(String openPlayMidi) {
-		this.openPlayMidi = openPlayMidi;
-	}
-
-	public void setId(Long id){
-		this.id = id;
-	}
-	
-	public Long getId(){
-		return this.id;
-	}
-			
-	public GroupType getGroupType() {
-		return groupType;
-	}
-
-	public void setGroupType(GroupType groupType) {
-		this.groupType = groupType;
-	}
-
-	public String getMusicGroupId() {
-		return musicGroupId;
-	}
-
-	public void setMusicGroupId(String musicGroupId) {
-		this.musicGroupId = musicGroupId;
-	}
-
-	public void setCourseScheduleId(Long courseScheduleId){
-		this.courseScheduleId = courseScheduleId;
-	}
-	
-	public Long getCourseScheduleId(){
-		return this.courseScheduleId;
-	}
-			
-	public void setUserId(Integer userId){
-		this.userId = userId;
-	}
-	
-	public Integer getUserId(){
-		return this.userId;
-	}
-
-	public BigDecimal getOriginalPrice() {
-		return originalPrice;
-	}
-
-	public void setOriginalPrice(BigDecimal originalPrice) {
-		this.originalPrice = originalPrice;
-	}
-
-	public void setExpectPrice(java.math.BigDecimal expectPrice){
-		this.expectPrice = expectPrice;
-	}
-	
-	public java.math.BigDecimal getExpectPrice(){
-		return this.expectPrice;
-	}
-			
-	public void setActualPrice(java.math.BigDecimal actualPrice){
-		this.actualPrice = actualPrice;
-	}
-	
-	public java.math.BigDecimal getActualPrice(){
-		return this.actualPrice;
-	}
-			
-	public void setCreateTime(java.util.Date createTime){
-		this.createTime = createTime;
-	}
-	
-	public java.util.Date getCreateTime(){
-		return this.createTime;
-	}
-			
-	public void setUpdateTime(java.util.Date updateTime){
-		this.updateTime = updateTime;
-	}
-	
-	public java.util.Date getUpdateTime(){
-		return this.updateTime;
-	}
-			
-	public void setSettlementTime(java.util.Date settlementTime){
-		this.settlementTime = settlementTime;
-	}
-	
-	public java.util.Date getSettlementTime(){
-		return this.settlementTime;
-	}
-			
-	public Integer getClassGroupId() {
-		return classGroupId;
-	}
-
-	public void setClassGroupId(Integer classGroupId) {
-		this.classGroupId = classGroupId;
-	}
-
-	public String getBatchNo() {
-		return batchNo;
-	}
-
-	public void setBatchNo(String batchNo) {
-		this.batchNo = batchNo;
-	}
-
-	public CourseSchedule getCourseSchedule() {
-		return courseSchedule;
-	}
-
-	public void setCourseSchedule(CourseSchedule courseSchedule) {
-		this.courseSchedule = courseSchedule;
-	}
-
-	public JoinCourseType getJoinCourseType() {
-		return joinCourseType;
-	}
-
-	public void setJoinCourseType(JoinCourseType joinCourseType) {
-		this.joinCourseType = joinCourseType;
-	}
-
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 21 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -3201,12 +3201,28 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
         classStudentMapperByUserIdAndClassGroupId.setStatus(ClassGroupStudentStatusEnum.QUIT);
         classGroupStudentMapperDao.update(classStudentMapperByUserIdAndClassGroupId);
+        List<CourseSchedule> musicGroupCourseSchedules = courseScheduleDao.findMusicGroupCourseSchedulesWithStudent(vipGroupId.toString(), groupType.getCode(), CourseStatusEnum.NOT_START.getCode(), studentId);
+        if (!org.apache.commons.collections.CollectionUtils.isEmpty(musicGroupCourseSchedules)) {
+            List<Long> courseScheduleIds = musicGroupCourseSchedules.stream()
+                    .map(courseSchedule -> courseSchedule.getId())
+                    .collect(Collectors.toList());
+            courseScheduleDao.deleteMusicGroupCourseSchedulesWithStudent(courseScheduleIds, studentId);
+            studentAttendanceDao.deleteByCourseAndUser(courseScheduleIds,studentId);
+            if(groupType == LIVE){
+                List<CourseScheduleStudentPayment> studentPayments = courseScheduleStudentPaymentDao.findByCourseScheduleIds(courseScheduleIds);
+                if(!CollectionUtils.isEmpty(studentPayments)){
+                    Map<Long, Integer> courseStudentNumMap = studentPayments.stream().filter(e -> e.getJoinCourseType() == JoinCourseType.PURCHASE)
+                            .collect(Collectors.groupingBy(e -> e.getCourseScheduleId(), Collectors.collectingAndThen(Collectors.toList(), v -> v.size())));
+                    for (Long courseId : courseStudentNumMap.keySet()) {
+                        Integer studentNum = courseStudentNumMap.get(courseId);
+                        if(studentNum != null && studentNum > 0){
+                            
+                        }else {
 
-        courseScheduleService.batchDeleteMusicGroupCourseWithStudent(vipGroupId.toString(), studentId, groupType);
-
-        List<Integer> studentPaymentIds = courseScheduleStudentPaymentDao.findNotStartCourseStudentPaymentIdsWithClassGroupAndStudent(classGroup.getId(), studentId);
-        if (!CollectionUtils.isEmpty(studentPaymentIds)) {
-            courseScheduleStudentPaymentDao.batchDeleteWithID(studentPaymentIds);
+                        }
+                    }
+                }
+            }
         }
 
         if (!vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING) || (Objects.nonNull(vipGroupCategory) && vipGroupCategory.getMusicTheory())) {