瀏覽代碼

feat:首页统计

Joburgess 4 年之前
父節點
當前提交
70791fd32d

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -1669,6 +1669,8 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      */
     int countCourseMergeTime(@Param("courseId") Long courseId);
 
+    List<CourseSchedule> findByMainMergeCourse(@Param("mainMergeCourseId") Long mainMergeCourseId);
+
     /**
      * 获取班级剩余的课程类型和课程数量
      *

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentPaymentDao.java

@@ -211,6 +211,15 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
     List<CourseScheduleStudentPayment> findByCourseSchedule(@Param("courseScheduleId") Long courseScheduleId);
 
     /**
+     * @describe 获取合并课程的学员缴费记录
+     * @author Joburgess
+     * @date 2021/1/21 0021
+     * @param mainMergeCourseId:
+     * @return java.util.List<com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment>
+     */
+    List<CourseScheduleStudentPayment> findByMainMergedCourse(@Param("mainMergeCourseId") Long mainMergeCourseId);
+
+    /**
      * @param groupId:
      * @return java.util.List<com.ym.mec.biz.dal.dto.VipGroupGiveCourseSortDto>
      * @describe 获取小课需要调整的缴费记录

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

@@ -55,6 +55,16 @@ public class CourseScheduleStudentPayment implements Comparable<CourseScheduleSt
 
 	private String examSongDownloadJson;
 
+	private Boolean beMerged = false;
+
+	public Boolean getBeMerged() {
+		return beMerged;
+	}
+
+	public void setBeMerged(Boolean beMerged) {
+		this.beMerged = beMerged;
+	}
+
 	public CourseScheduleStudentPayment() {
 	}
 

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

@@ -635,4 +635,6 @@ public interface CourseScheduleService extends BaseService<Long, CourseSchedule>
 	 * @return void
 	 */
 	void courseMerge(CourseMergeDto courseMergeInfo);
+
+	void mergeCourseSplit(Long mainCourseId);
 }

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

@@ -389,7 +389,7 @@ public interface VipGroupService extends BaseService<Long, VipGroup> {
      * @param studentIds:
      * @return void
      */
-    void addVipGroupStudents(Long vipGroupId,List<Integer> studentIds);
+    void addVipGroupStudents(Long vipGroupId,List<Integer> studentIds, Map<Integer, VipGroupStudentCoursePrice> studentCoursePriceMap);
 
     /**
      * 更新vipgroup至完成状态

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

@@ -5294,7 +5294,6 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 
 		Map<Integer, List<CourseScheduleStudentPayment>> otherStudentCourseMap = courseScheduleStudentPayments.stream().filter(c -> !courseMergeInfo.getId().equals(c.getCourseScheduleId())).collect(Collectors.groupingBy(CourseScheduleStudentPayment::getUserId));
 
-
 		List<CourseScheduleStudentPayment> newPayments = new ArrayList<>();
 		List<CourseScheduleStudentPayment> updatePayments = new ArrayList<>();
 
@@ -5306,10 +5305,10 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 				updatePayment.setExpectPrice(updatePayment.getExpectPrice().add(salary));
 				updatePayments.add(updatePayment);
 
-				for (CourseScheduleStudentPayment studentCoursePayment : studentCoursePayments) {
-					studentCoursePayment.setExpectPrice(BigDecimal.ZERO);
-					updatePayments.add(studentCoursePayment);
-				}
+//				for (CourseScheduleStudentPayment studentCoursePayment : studentCoursePayments) {
+//					studentCoursePayment.setExpectPrice(BigDecimal.ZERO);
+//					updatePayments.add(studentCoursePayment);
+//				}
 				continue;
 			}
 			CourseScheduleStudentPayment newPayment = new CourseScheduleStudentPayment();
@@ -5320,11 +5319,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			newPayment.setGroupType(courseMergeInfo.getGroupType());
 			newPayment.setExpectPrice(salary);
 			newPayment.setId(null);
+			newPayment.setBeMerged(true);
 			newPayments.add(newPayment);
-			for (CourseScheduleStudentPayment studentCoursePayment : studentCoursePayments) {
-				studentCoursePayment.setExpectPrice(BigDecimal.ZERO);
-				updatePayments.add(studentCoursePayment);
-			}
+//			for (CourseScheduleStudentPayment studentCoursePayment : studentCoursePayments) {
+//				studentCoursePayment.setExpectPrice(BigDecimal.ZERO);
+//				updatePayments.add(studentCoursePayment);
+//			}
 		}
 
 		List<CourseSchedule> courseSchedules=new ArrayList<>();
@@ -5364,4 +5364,20 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			courseScheduleModifyLogDao.batchInsert(insertCourseScheduleModifyLogList);
 		}
 	}
+
+	@Override
+	public void mergeCourseSplit(Long mainCourseId) {
+		List<CourseSchedule> courseSchedules = courseScheduleDao.findByMainMergeCourse(mainCourseId);
+		if(CollectionUtils.isEmpty(courseSchedules)){
+			throw new BizException("未找到相关合并课程信息");
+		}
+		List<CourseScheduleStudentPayment> courseScheduleStudentPayments = courseScheduleStudentPaymentDao.findByMainMergedCourse(mainCourseId);
+		Map<Integer, CourseScheduleStudentPayment> studentMainCoursePaymentMap = courseScheduleStudentPayments.stream().filter(c -> c.getCourseScheduleId().equals(mainCourseId)).collect(Collectors.toMap(CourseScheduleStudentPayment::getUserId, c -> c, (c1, c2) -> c1));
+
+		List<CourseScheduleStudentPayment> otherCoursePayments = courseScheduleStudentPayments.stream().filter(c -> c.getCourseScheduleId().equals(mainCourseId)).collect(Collectors.toList());
+
+		for (CourseScheduleStudentPayment otherCoursePayment : otherCoursePayments) {
+
+		}
+    }
 }

+ 141 - 143
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -975,16 +975,146 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			normalStudentNum = classGroupStudentMapperDao.countGroupNormalStudentNum(GroupType.VIP, vipGroup.getId().toString());
 		}
 
-		if(vipGroupCategory.getMusicTheory()){
-			vipGroup.setTotalPrice(new BigDecimal(0));
-			for (VipGroupStudentCoursePrice vscp : ((VipGroupApplyBaseInfoDto)vipGroup).getVipGroupStudentCoursePrices()) {
-				if(Objects.isNull(vscp.getOnlineClassesUnitPrice())||Objects.isNull(vscp.getOfflineClassesUnitPrice())){
-					throw new BizException("请设置课程单价");
+		if(Objects.nonNull(vipGroupActivity)){
+			VipGroupSalarySettlementDto vipGroupSalarySettlementDto = JSON.parseObject(vipGroupActivity.getSalarySettlementJson(), VipGroupSalarySettlementDto.class);
+
+			if(Objects.isNull(vipGroupSalarySettlementDto)){
+				throw new BizException("课酬结算方案错误");
+			}
+
+			BigDecimal offlineClassNum=new BigDecimal(vipGroup.getOfflineClassesNum());
+			BigDecimal onlineClassNum=new BigDecimal(vipGroup.getOnlineClassesNum());
+			BigDecimal onlineClassesUnitPrice=vipGroup.getOnlineClassesUnitPrice();
+			if(Objects.isNull(onlineClassesUnitPrice)){
+				throw new BizException("课程单价异常");
+			}
+			BigDecimal onlineVipGroupCharge = onlineClassesUnitPrice.multiply(onlineClassNum);
+
+			BigDecimal offlineClassesUnitPrice=vipGroup.getOfflineClassesUnitPrice();
+			if(Objects.isNull(offlineClassesUnitPrice)){
+				throw new BizException("课程单价异常");
+			}
+			BigDecimal offlineVipGroupCharge = offlineClassesUnitPrice.multiply(offlineClassNum);
+			BigDecimal totalClassNum=offlineClassNum.add(onlineClassNum);
+			BigDecimal teacherOnlineSalary=null,teacherOfflineSalary=null;
+
+			//课程购买费用计算
+			BigDecimal totalPrice;
+			switch (vipGroupActivity.getType()){
+				case BASE_ACTIVITY:
+					totalPrice=onlineVipGroupCharge.add(offlineVipGroupCharge);
+					break;
+				case DISCOUNT:
+					BigDecimal discount=new BigDecimal(vipGroupActivity.getAttribute1());
+					totalPrice=onlineVipGroupCharge.add(offlineVipGroupCharge);
+					totalPrice=totalPrice.multiply(discount).divide(new BigDecimal(100), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN);
+					break;
+				case GIVE_CLASS:
+					if(totalClassNum.compareTo(new BigDecimal(vipGroupActivity.getAttribute1()))<0){
+
+					}else if(vipGroup.getGiveTeachMode()==TeachModeEnum.OFFLINE){
+						if(totalClassNum.compareTo(new BigDecimal(vipGroupActivity.getAttribute1()))>-1){
+							offlineClassNum=offlineClassNum.subtract(new BigDecimal(vipGroupActivity.getAttribute2()));
+						}
+						offlineVipGroupCharge = offlineClassesUnitPrice.multiply(offlineClassNum);
+					}else if(vipGroup.getGiveTeachMode()==TeachModeEnum.ONLINE){
+						if(totalClassNum.compareTo(new BigDecimal(vipGroupActivity.getAttribute1()))>-1){
+							onlineClassNum=onlineClassNum.subtract(new BigDecimal(vipGroupActivity.getAttribute2()));
+						}
+						onlineVipGroupCharge = onlineClassesUnitPrice.multiply(onlineClassNum);
+					}else{
+						throw new BizException("请指定赠送课程类型!");
+					}
+					totalPrice=onlineVipGroupCharge.add(offlineVipGroupCharge);
+					break;
+				default:
+					throw new BizException("活动类型错误!");
+			}
+
+			results.put("totalPrice",totalPrice.setScale(0,BigDecimal.ROUND_CEILING));
+
+			if(vipGroup instanceof VipGroupApplyBaseInfoDto && !CollectionUtils.isEmpty(((VipGroupApplyBaseInfoDto)vipGroup).getVipGroupStudentCoursePrices())){
+				for (VipGroupStudentCoursePrice vscp : ((VipGroupApplyBaseInfoDto)vipGroup).getVipGroupStudentCoursePrices()) {
+					if(Objects.isNull(vscp.getOnlineClassesUnitPrice())||Objects.isNull(vscp.getOfflineClassesUnitPrice())){
+						throw new BizException("请设置课程单价");
+					}
+					vscp.setPaymentPrice(vscp.getOfflineClassesUnitPrice().multiply(new BigDecimal(vipGroup.getOfflineClassesNum())).add(vscp.getOnlineClassesUnitPrice().multiply(new BigDecimal(vipGroup.getOnlineClassesNum()))));
+					vipGroup.setTotalPrice(vipGroup.getTotalPrice().add(vscp.getPaymentPrice()));
+					results.put(vscp.getStudentId().toString(), vscp.getPaymentPrice());
 				}
-				vscp.setPaymentPrice(vscp.getOfflineClassesUnitPrice().multiply(new BigDecimal(vipGroup.getOfflineClassesNum())).add(vscp.getOnlineClassesUnitPrice().multiply(new BigDecimal(vipGroup.getOnlineClassesNum()))));
-				vipGroup.setTotalPrice(vipGroup.getTotalPrice().add(vscp.getPaymentPrice()));
-				results.put(vscp.getStudentId().toString(), vscp.getPaymentPrice());
 			}
+
+			//教师课酬线上单课酬计算
+			if(Objects.nonNull(vipGroupSalarySettlementDto.getOnlineSalarySettlement())){
+				if(Objects.isNull(teacherOnlineSalary)){
+					switch (vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSalarySettlementType()){
+						case TEACHER_DEFAULT:
+							teacherOnlineSalary=teacherDefaultVipGroupSalary.getOfflineClassesSalary();
+							results.put("onlineTeacherSalary",teacherOnlineSalary.setScale(0, BigDecimal.ROUND_HALF_UP));
+							break;
+						case RATIO_DISCOUNT:
+							results.put("onlineTeacherSalary",totalPrice.multiply(new BigDecimal(vipGroupCategory.getStudentNum()))
+									.divide(totalClassNum, CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN)
+									.multiply(vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSettlementValue())
+									.divide(new BigDecimal(100), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN)
+									.setScale(0,BigDecimal.ROUND_HALF_UP));
+
+							break;
+						case FIXED_SALARY:
+							results.put("onlineTeacherSalary",vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSettlementValue().setScale(0, BigDecimal.ROUND_HALF_UP));
+							break;
+						default:
+							throw new BizException("未指定课酬结算标准!");
+					}
+
+				}
+			}
+
+			//教师线下单课酬计算
+			if(Objects.nonNull(vipGroupSalarySettlementDto.getOfflineSalarySettlement())){
+				if(Objects.isNull(teacherOfflineSalary)){
+					switch (vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSalarySettlementType()){
+						case TEACHER_DEFAULT:
+							teacherOfflineSalary=teacherDefaultVipGroupSalary.getOfflineClassesSalary();
+							results.put("offlineTeacherSalary",teacherOfflineSalary.setScale(0, BigDecimal.ROUND_HALF_UP));
+							break;
+						case RATIO_DISCOUNT:
+							results.put("offlineTeacherSalary",totalPrice.multiply(new BigDecimal(vipGroupCategory.getStudentNum())).divide(totalClassNum, CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN).multiply(vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSettlementValue()).divide(new BigDecimal(100), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN).setScale(0,BigDecimal.ROUND_HALF_UP));
+
+							break;
+						case FIXED_SALARY:
+							results.put("offlineTeacherSalary",vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSettlementValue().setScale(0, BigDecimal.ROUND_HALF_UP));
+							break;
+						default:
+							throw new BizException("未指定课酬结算标准!");
+					}
+				}
+			}
+
+			BigDecimal ots = results.get("onlineTeacherSalary");
+			if(Objects.isNull(ots)){
+				ots = teacherDefaultVipGroupSalary.getOfflineClassesSalary();
+			}
+			if(Objects.isNull(ots)){
+				ots = BigDecimal.ZERO;
+			}
+			BigDecimal ofts = results.get("offlineTeacherSalary");
+			if(Objects.isNull(ofts)){
+				ofts = teacherDefaultVipGroupSalary.getOfflineClassesSalary();
+			}
+			if(Objects.isNull(ofts)){
+				ofts = BigDecimal.ZERO;
+			}
+			if(Objects.nonNull(vipGroup.getStatus())&&normalStudentNum!=vipGroupCategory.getStudentNum()){
+				ots = ots.divide(new BigDecimal(vipGroupCategory.getStudentNum()),CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(normalStudentNum)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP);
+				ofts = ofts.divide(new BigDecimal(vipGroupCategory.getStudentNum()),CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(normalStudentNum)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP);
+			}
+
+			results.put("onlineTeacherSalary", ots);
+			results.put("offlineTeacherSalary", ofts);
+		}
+
+		if(vipGroupCategory.getMusicTheory()){
 			BigDecimal ots = teacherDefaultVipGroupSalary.getOfflineClassesSalary();
 			BigDecimal ofts = teacherDefaultVipGroupSalary.getOfflineClassesSalary();
 			if(Objects.nonNull(vipGroup.getStatus())&&normalStudentNum!=vipGroupCategory.getStudentNum()){
@@ -997,64 +1127,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			return results;
 		}
 
-		VipGroupSalarySettlementDto vipGroupSalarySettlementDto = JSON.parseObject(vipGroupActivity.getSalarySettlementJson(), VipGroupSalarySettlementDto.class);
-
-		if(Objects.isNull(vipGroupSalarySettlementDto)){
-			throw new BizException("课酬结算方案错误");
-		}
-
-		BigDecimal offlineClassNum=new BigDecimal(vipGroup.getOfflineClassesNum());
-		BigDecimal onlineClassNum=new BigDecimal(vipGroup.getOnlineClassesNum());
-		BigDecimal onlineClassesUnitPrice=vipGroup.getOnlineClassesUnitPrice();
-		if(Objects.isNull(onlineClassesUnitPrice)){
-			throw new BizException("课程单价异常");
-		}
-		BigDecimal onlineVipGroupCharge = onlineClassesUnitPrice.multiply(onlineClassNum);
-
-		BigDecimal offlineClassesUnitPrice=vipGroup.getOfflineClassesUnitPrice();
-		if(Objects.isNull(offlineClassesUnitPrice)){
-			throw new BizException("课程单价异常");
-		}
-		BigDecimal offlineVipGroupCharge = offlineClassesUnitPrice.multiply(offlineClassNum);
-		BigDecimal totalClassNum=offlineClassNum.add(onlineClassNum);
-		BigDecimal teacherOnlineSalary=null,teacherOfflineSalary=null;
-
-		//课程购买费用计算
-		BigDecimal totalPrice;
-		switch (vipGroupActivity.getType()){
-			case BASE_ACTIVITY:
-				totalPrice=onlineVipGroupCharge.add(offlineVipGroupCharge);
-				break;
-			case DISCOUNT:
-				BigDecimal discount=new BigDecimal(vipGroupActivity.getAttribute1());
-				totalPrice=onlineVipGroupCharge.add(offlineVipGroupCharge);
-				totalPrice=totalPrice.multiply(discount).divide(new BigDecimal(100), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN);
-				break;
-			case GIVE_CLASS:
-				if(totalClassNum.compareTo(new BigDecimal(vipGroupActivity.getAttribute1()))<0){
-
-				}else if(vipGroup.getGiveTeachMode()==TeachModeEnum.OFFLINE){
-					if(totalClassNum.compareTo(new BigDecimal(vipGroupActivity.getAttribute1()))>-1){
-						offlineClassNum=offlineClassNum.subtract(new BigDecimal(vipGroupActivity.getAttribute2()));
-					}
-					offlineVipGroupCharge = offlineClassesUnitPrice.multiply(offlineClassNum);
-				}else if(vipGroup.getGiveTeachMode()==TeachModeEnum.ONLINE){
-					if(totalClassNum.compareTo(new BigDecimal(vipGroupActivity.getAttribute1()))>-1){
-						onlineClassNum=onlineClassNum.subtract(new BigDecimal(vipGroupActivity.getAttribute2()));
-					}
-					onlineVipGroupCharge = onlineClassesUnitPrice.multiply(onlineClassNum);
-				}else{
-					throw new BizException("请指定赠送课程类型!");
-				}
-				totalPrice=onlineVipGroupCharge.add(offlineVipGroupCharge);
-				break;
-			default:
-				throw new BizException("活动类型错误!");
-		}
-
-		results.put("totalPrice",totalPrice.setScale(0,BigDecimal.ROUND_CEILING));
-
-		if(vipGroup instanceof VipGroupApplyBaseInfoDto && !CollectionUtils.isEmpty(((VipGroupApplyBaseInfoDto)vipGroup).getVipGroupStudentCoursePrices())){
+		if(vipGroup instanceof VipGroupApplyBaseInfoDto&&!CollectionUtils.isEmpty(((VipGroupApplyBaseInfoDto)vipGroup).getVipGroupStudentCoursePrices())){
+			vipGroup.setTotalPrice(new BigDecimal(0));
 			for (VipGroupStudentCoursePrice vscp : ((VipGroupApplyBaseInfoDto)vipGroup).getVipGroupStudentCoursePrices()) {
 				if(Objects.isNull(vscp.getOnlineClassesUnitPrice())||Objects.isNull(vscp.getOfflineClassesUnitPrice())){
 					throw new BizException("请设置课程单价");
@@ -1065,75 +1139,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			}
 		}
 
-		//教师课酬线上单课酬计算
-		if(Objects.nonNull(vipGroupSalarySettlementDto.getOnlineSalarySettlement())){
-			if(Objects.isNull(teacherOnlineSalary)){
-				switch (vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSalarySettlementType()){
-					case TEACHER_DEFAULT:
-						teacherOnlineSalary=teacherDefaultVipGroupSalary.getOfflineClassesSalary();
-						results.put("onlineTeacherSalary",teacherOnlineSalary.setScale(0, BigDecimal.ROUND_HALF_UP));
-						break;
-					case RATIO_DISCOUNT:
-						results.put("onlineTeacherSalary",totalPrice.multiply(new BigDecimal(vipGroupCategory.getStudentNum()))
-								.divide(totalClassNum, CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN)
-								.multiply(vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSettlementValue())
-								.divide(new BigDecimal(100), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN)
-								.setScale(0,BigDecimal.ROUND_HALF_UP));
-
-						break;
-					case FIXED_SALARY:
-						results.put("onlineTeacherSalary",vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSettlementValue().setScale(0, BigDecimal.ROUND_HALF_UP));
-						break;
-					default:
-						throw new BizException("未指定课酬结算标准!");
-				}
-
-			}
-		}
-
-		//教师线下单课酬计算
-		if(Objects.nonNull(vipGroupSalarySettlementDto.getOfflineSalarySettlement())){
-			if(Objects.isNull(teacherOfflineSalary)){
-				switch (vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSalarySettlementType()){
-					case TEACHER_DEFAULT:
-						teacherOfflineSalary=teacherDefaultVipGroupSalary.getOfflineClassesSalary();
-						results.put("offlineTeacherSalary",teacherOfflineSalary.setScale(0, BigDecimal.ROUND_HALF_UP));
-						break;
-					case RATIO_DISCOUNT:
-						results.put("offlineTeacherSalary",totalPrice.multiply(new BigDecimal(vipGroupCategory.getStudentNum())).divide(totalClassNum, CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN).multiply(vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSettlementValue()).divide(new BigDecimal(100), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN).setScale(0,BigDecimal.ROUND_HALF_UP));
-
-						break;
-					case FIXED_SALARY:
-						results.put("offlineTeacherSalary",vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSettlementValue().setScale(0, BigDecimal.ROUND_HALF_UP));
-						break;
-					default:
-						throw new BizException("未指定课酬结算标准!");
-				}
-			}
-		}
-
-		BigDecimal ots = results.get("onlineTeacherSalary");
-		if(Objects.isNull(ots)){
-			ots = teacherDefaultVipGroupSalary.getOfflineClassesSalary();
-		}
-		if(Objects.isNull(ots)){
-			ots = BigDecimal.ZERO;
-		}
-		BigDecimal ofts = results.get("offlineTeacherSalary");
-		if(Objects.isNull(ofts)){
-			ofts = teacherDefaultVipGroupSalary.getOfflineClassesSalary();
-		}
-		if(Objects.isNull(ofts)){
-			ofts = BigDecimal.ZERO;
-		}
-		if(Objects.nonNull(vipGroup.getStatus())&&normalStudentNum!=vipGroupCategory.getStudentNum()){
-			ots = ots.divide(new BigDecimal(vipGroupCategory.getStudentNum()),CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(normalStudentNum)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP);
-			ofts = ofts.divide(new BigDecimal(vipGroupCategory.getStudentNum()),CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(normalStudentNum)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP);
-		}
-
-		results.put("onlineTeacherSalary", ots);
-		results.put("offlineTeacherSalary", ofts);
-
         return results;
     }
 
@@ -2801,7 +2806,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
 	@Override
 	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
-	public void addVipGroupStudents(Long vipGroupId, List<Integer> studentIds) {
+	public void addVipGroupStudents(Long vipGroupId, List<Integer> studentIds, Map<Integer, VipGroupStudentCoursePrice> studentCoursePriceMap) {
 		if(CollectionUtils.isEmpty(studentIds)){
 			throw new BizException("请选择学生");
 		}
@@ -2822,12 +2827,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			}
 		}
 
-		List<VipGroupStudentCoursePrice> vipGroupStudentCoursePrices = vipGroupStudentCoursePriceDao.getVipGroupStudentCoursePrice(vipGroupId, null);
-		Map<Integer, VipGroupStudentCoursePrice> studentCoursePriceMap = new HashMap<>();
-		if(!CollectionUtils.isEmpty(vipGroupStudentCoursePrices)){
-			studentCoursePriceMap = vipGroupStudentCoursePrices.stream().collect(Collectors.toMap(VipGroupStudentCoursePrice::getStudentId, v->v, (v1, v2)->v1));
-		}
-
 		VipGroupDefaultClassesUnitPrice vipGroupDefaultClassesUnitPrice = vipGroupDefaultClassesUnitPriceDao.getByVipGroup(vipGroup.getId());
 		if(Objects.isNull(vipGroupDefaultClassesUnitPrice)){
 			throw new BizException("课程单价设置错误");
@@ -3008,7 +3007,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			}
 
 			sysUserCashAccountService.subtractFromCourseBalanceAndBalance(studentId,surplusCoursesPrice,PlatformCashAccountDetailTypeEnum.PAY_FEE, "后台添加学员扣减账户金额");
-//			courseScheduleStudentPaymentService.createCourseScheduleStudentPaymentForVipGroup(vipGroupId,studentId);
 
 			List<CourseScheduleStudentPayment> courseScheduleStudentPayments=new ArrayList<>();
 

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

@@ -3379,6 +3379,11 @@
     <select id="countCourseMergeTime" resultType="int">
         SELECT COUNT(id_) FROM course_schedule WHERE new_course_id_=#{courseId}
     </select>
+
+    <select id="findByMainMergeCourse" resultType="int">
+        SELECT * FROM course_schedule WHERE new_course_id_=#{mainMergeCourseId}
+    </select>
+
     <select id="querySubCourseNumMap" resultType="java.util.Map">
         SELECT cs.type_ 'key',COUNT(CASE WHEN (CONCAT(cs.class_date_,' ',cs.start_class_time_) > NOW()) THEN 1 ELSE NULL END) 'value' FROM course_schedule cs
         WHERE cs.class_group_id_ = #{classGroupId}

+ 19 - 9
mec-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml

@@ -20,6 +20,7 @@
 		<result column="settlement_time_" property="settlementTime" />
 		<result column="class_group_id_" property="classGroupId" />
 		<result column="batch_no_" property="batchNo"/>
+		<result column="be_merged_" property="beMerged"/>
 	</resultMap>
 
 	<resultMap type="com.ym.mec.biz.dal.dto.StudentCourseTimesDto" id="studentCourseTimesDto">
@@ -47,23 +48,18 @@
 
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		<!--
-		<selectKey resultClass="int" keyProperty="id" >
-		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
-		</selectKey>
-		-->
 		INSERT INTO course_schedule_student_payment (id_,group_type_,music_group_id_,course_schedule_id_,user_id_,
-			original_price_,expect_price_,actual_price_,create_time_,update_time_,settlement_time_,class_group_id_,batch_no_)
+			original_price_,expect_price_,actual_price_,create_time_,update_time_,settlement_time_,class_group_id_,batch_no_,be_merged_)
 		VALUES(#{id},#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{musicGroupId},#{courseScheduleId},#{userId},
-			#{originalPrice},#{expectPrice},#{actualPrice},#{createTime},NOW(),#{settlementTime},#{classGroupId},#{batchNo})
+			#{originalPrice},#{expectPrice},#{actualPrice},#{createTime},NOW(),#{settlementTime},#{classGroupId},#{batchNo},#{beMerged})
 	</insert>
     <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id_">
 		INSERT INTO course_schedule_student_payment (id_,group_type_,music_group_id_,course_schedule_id_,user_id_,expect_price_,
-				original_price_,actual_price_,create_time_,update_time_,settlement_time_,class_group_id_,batch_no_)
+				original_price_,actual_price_,create_time_,update_time_,settlement_time_,class_group_id_,batch_no_,be_merged_)
 		VALUE
 		<foreach collection="list" item="data" separator=",">
 			(#{data.id},#{data.groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{data.musicGroupId},#{data.courseScheduleId},#{data.userId},#{data.expectPrice},
-			#{data.originalPrice},#{data.actualPrice},now(),now(),#{data.settlementTime},#{data.classGroupId},#{data.batchNo})
+			#{data.originalPrice},#{data.actualPrice},now(),now(),#{data.settlementTime},#{data.classGroupId},#{data.batchNo},#{data.beMerged})
 		</foreach>
     </insert>
 
@@ -104,6 +100,9 @@
 			<if test="originalPrice != null">
 				original_price_ = #{originalPrice},
 			</if>
+			<if test="beMerged != null">
+				be_merged_ = #{beMerged},
+			</if>
 				update_time_ = NOW()
 		</set> WHERE id_ = #{id}
 	</update>
@@ -145,6 +144,9 @@
 				<if test="courseScheduleStudentPayment.originalPrice != null">
 					original_price_ = #{courseScheduleStudentPayment.originalPrice},
 				</if>
+				<if test="courseScheduleStudentPayment.beMerged != null">
+					be_merged_ = #{courseScheduleStudentPayment.beMerged},
+				</if>
 				update_time_ = NOW()
 			</set> WHERE id_ = #{courseScheduleStudentPayment.id}
 		</foreach>
@@ -632,6 +634,7 @@
 		WHERE
 			cssp.batch_no_ IS NOT NULL
 			AND cs.id_ IS NOT NULL
+			AND (cs.new_course_id_ IS NULL OR cs.new_course_id_=cs.id_)
 			AND ((cs.status_ IN ('OVER', 'UNDERWAY') AND (cssp.actual_price_ IS NULL OR cssp.actual_price_ &lt; cssp.expect_price_))
 			OR ( cs.status_ = 'NOT_START' AND cssp.actual_price_ IS NOT NULL AND cssp.actual_price_ &gt; 0))
 			<if test="groupIds!=null and groupIds.size()>0">
@@ -700,4 +703,11 @@
 		  AND (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL)
 		ORDER BY CONCAT(cs.class_date_, ' ', cs.start_class_time_) DESC LIMIT 1
 	</select>
+
+	<select id="findByMainMergedCourse" resultMap="CourseScheduleStudentPayment">
+		SELECT cssp.*
+			FROM course_schedule_student_payment cssp
+			LEFT JOIN course_schedule cs ON cssp.course_schedule_id_=cs.id_
+		WHERE cs.new_course_id_=#{mainMergeCourseId}
+	</select>
 </mapper>

+ 1 - 1
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherVipGroupController.java

@@ -117,7 +117,7 @@ public class TeacherVipGroupController extends BaseController {
 		}
 
 		vipGroupService.createVipGroup(vipGroupApplyDto);
-		vipGroupService.addVipGroupStudents(vipGroupApplyDto.getVipGroupApplyBaseInfo().getId(), studentIds);
+		vipGroupService.addVipGroupStudents(vipGroupApplyDto.getVipGroupApplyBaseInfo().getId(), studentIds, new HashMap<>());
 		return succeed();
 	}
 

+ 3 - 0
mec-web/src/main/java/com/ym/mec/web/controller/CourseScheduleController.java

@@ -102,6 +102,9 @@ public class CourseScheduleController extends BaseController {
     @PostMapping("/batchAddCourseSchedule")
     @PreAuthorize("@pcs.hasPermissions('courseSchedule/batchAddCourseSchedule')")
     public Object batchAddCourseSchedule(@RequestBody CreateCourseScheduleDto createCourseScheduleDto){
+        if(true){
+            return failed("暂不支持此操作");
+        }
         if(Objects.isNull(createCourseScheduleDto.getMusicGroupID())){
             throw new BizException("请指定乐团");
         }

+ 8 - 9
mec-web/src/main/java/com/ym/mec/web/controller/VipGroupManageController.java

@@ -25,10 +25,12 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.ui.ModelMap;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * @Author Joburgess
@@ -166,18 +168,15 @@ public class VipGroupManageController extends BaseController {
     }
 
     @ApiOperation(value = "添加vip课学员")
-    @GetMapping(value = "/addVipGroupStudents")
+    @PostMapping(value = "/addVipGroupStudents")
     @PreAuthorize("@pcs.hasPermissions('vipGroupManage/addVipGroupStudents')")
-    public Object addVipGroupStudents(Long vipGroupId, String studentIds){
-        if(StringUtils.isBlank(studentIds)){
+    public Object addVipGroupStudents(@RequestBody List<VipGroupStudentCoursePrice> studentCoursePrices){
+        if(CollectionUtils.isEmpty(studentCoursePrices)){
             throw new BizException("请指定学员");
         }
-        List<Integer> ids=new ArrayList<>();
-        String[] split = studentIds.split(",");
-        for (String s : split) {
-            ids.add(Integer.parseInt(s));
-        }
-        vipGroupService.addVipGroupStudents(vipGroupId,ids);
+        List<Integer> ids=studentCoursePrices.stream().map(VipGroupStudentCoursePrice::getStudentId).collect(Collectors.toList());
+        Map<Integer, VipGroupStudentCoursePrice> studentCoursePriceMap = studentCoursePrices.stream().collect(Collectors.toMap(VipGroupStudentCoursePrice::getStudentId, v->v, (v1, v2)->v1));
+        vipGroupService.addVipGroupStudents(studentCoursePrices.get(0).getVipGroupId(), ids, studentCoursePriceMap);
         return succeed();
     }