Browse Source

Merge branch 'active_course_2021-09-26~29' of http://git.dayaedu.com/yonge/mec

zouxuan 4 years ago
parent
commit
a36c06ee81

+ 5 - 5
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ReturnFeeDto.java

@@ -8,7 +8,7 @@ import java.math.BigDecimal;
 public class ReturnFeeDto {
 
     @ApiModelProperty(value = "课程组编号",required = false)
-    private Long groupId;
+    private Long vipGroupId;
 
     @ApiModelProperty(value = "退费学员",required = false)
     private Integer studentId;
@@ -29,12 +29,12 @@ public class ReturnFeeDto {
         this.groupType = groupType;
     }
 
-    public Long getGroupId() {
-        return groupId;
+    public Long getVipGroupId() {
+        return vipGroupId;
     }
 
-    public void setGroupId(Long groupId) {
-        this.groupId = groupId;
+    public void setVipGroupId(Long vipGroupId) {
+        this.vipGroupId = vipGroupId;
     }
 
     public Integer getStudentId() {

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

@@ -150,7 +150,7 @@ public class GroupClassServiceImpl implements GroupClassService {
     @Override
     @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
     public HttpResponseResult cancelGroup(ReturnFeeDto returnFeeDto) {
-        Long groupId = returnFeeDto.getGroupId();
+        Long groupId = returnFeeDto.getVipGroupId();
         if (Objects.isNull(groupId)) {
             throw new BizException("请指定课程组");
         }

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

@@ -4646,12 +4646,12 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         teacherDefaultSalary = teacherDefaultPracticeGroupSalary.getMainTeacherSalary();
         if(Objects.nonNull(salarySettlement)){
             if(salarySettlement.getSalarySettlementType() == SalarySettlementTypeEnum.FIXED_SALARY){
-                teacherDefaultSalary = salarySettlement.getSettlementValue().setScale(0, BigDecimal.ROUND_HALF_UP);
+                teacherDefaultSalary = salarySettlement.getSettlementValue();
             }
         }
 
         results.put("totalPrice",totalPrice.setScale(0,BigDecimal.ROUND_CEILING));
-        results.put("onlineTeacherSalary",teacherDefaultSalary.setScale(0, BigDecimal.ROUND_HALF_UP));
+        results.put("onlineTeacherSalary",teacherDefaultSalary.setScale(2, BigDecimal.ROUND_HALF_UP));
         return results;
     }
 

+ 32 - 39
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -2229,7 +2229,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 				teacherOnlineSalary = vipOnlineSalarySettlement.getSettlementValue();
 			}
 		}
-		results.put("onlineTeacherSalary",teacherOnlineSalary.setScale(0, BigDecimal.ROUND_HALF_UP));
+		results.put("onlineTeacherSalary",teacherOnlineSalary.setScale(2, BigDecimal.ROUND_HALF_UP));
 
 		//教师课酬赠送线上单课酬计算
 		if(vipGroupCategory.getMusicTheory()){
@@ -2242,7 +2242,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 				giveTeacherOnlineSalary = giveVipOnlineSalarySettlement.getSettlementValue();
 			}
 		}
-		results.put("giveOnlineTeacherSalary",giveTeacherOnlineSalary.setScale(0, BigDecimal.ROUND_HALF_UP));
+		results.put("giveOnlineTeacherSalary",giveTeacherOnlineSalary.setScale(2, BigDecimal.ROUND_HALF_UP));
 
 		//教师线下单课酬计算
 		if(vipGroupCategory.getMusicTheory()){
@@ -2255,7 +2255,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 				teacherOfflineSalary = vipOfflineSalarySettlement.getSettlementValue();
 			}
 		}
-		results.put("offlineTeacherSalary",teacherOfflineSalary.setScale(0, BigDecimal.ROUND_HALF_UP));
+		results.put("offlineTeacherSalary",teacherOfflineSalary.setScale(2, BigDecimal.ROUND_HALF_UP));
 
 		//教师赠送线下单课酬计算
 		if(vipGroupCategory.getMusicTheory()){
@@ -2268,7 +2268,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 				giveTeacherOfflineSalary = giveVipOfflineSalarySettlement.getSettlementValue();
 			}
 		}
-		results.put("giveOfflineTeacherSalary",giveTeacherOfflineSalary.setScale(0, BigDecimal.ROUND_HALF_UP));
+		results.put("giveOfflineTeacherSalary",giveTeacherOfflineSalary.setScale(2, BigDecimal.ROUND_HALF_UP));
 
 		BigDecimal ots = results.get("onlineTeacherSalary");
 		if(Objects.isNull(ots)){
@@ -2380,8 +2380,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		results.put("totalPrice",totalPrice.setScale(0,BigDecimal.ROUND_CEILING));
 		vipGroup.setTotalPrice(totalPrice.setScale(0,BigDecimal.ROUND_CEILING));
 
-		Integer studentNum = vipGroup.getStudentIdList().split(",").length;
-
 		//教师课酬线上单课酬计算
 		teacherOnlineSalary = teacherDefaultVipGroupSalary.getOnlineClassesSalary();
 		if(Objects.nonNull(vipOnlineSalarySettlement)){
@@ -2389,7 +2387,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 				teacherOnlineSalary = vipOnlineSalarySettlement.getSettlementValue();
 			}
 		}
-		results.put("onlineTeacherSalary",teacherOnlineSalary.setScale(0, BigDecimal.ROUND_HALF_UP));
+		results.put("onlineTeacherSalary",teacherOnlineSalary.setScale(2, BigDecimal.ROUND_HALF_UP));
 
 		//教师课酬赠送线上单课酬计算
 		giveTeacherOnlineSalary = teacherDefaultVipGroupSalary.getOnlineClassesSalary();
@@ -2398,7 +2396,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 				giveTeacherOnlineSalary = giveVipOnlineSalarySettlement.getSettlementValue();
 			}
 		}
-		results.put("giveOnlineTeacherSalary",giveTeacherOnlineSalary.setScale(0, BigDecimal.ROUND_HALF_UP));
+		results.put("giveOnlineTeacherSalary",giveTeacherOnlineSalary.setScale(2, BigDecimal.ROUND_HALF_UP));
 
 		//教师线下单课酬计算
 		teacherOfflineSalary = teacherDefaultVipGroupSalary.getOfflineClassesSalary();
@@ -2407,7 +2405,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 				teacherOfflineSalary = vipOfflineSalarySettlement.getSettlementValue();
 			}
 		}
-		results.put("offlineTeacherSalary",teacherOfflineSalary.setScale(0, BigDecimal.ROUND_HALF_UP));
+		results.put("offlineTeacherSalary",teacherOfflineSalary.setScale(2, BigDecimal.ROUND_HALF_UP));
 
 		//教师赠送线下单课酬计算
 		giveTeacherOfflineSalary = teacherDefaultVipGroupSalary.getOfflineClassesSalary();
@@ -2416,7 +2414,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 				giveTeacherOfflineSalary = giveVipOfflineSalarySettlement.getSettlementValue();
 			}
 		}
-		results.put("giveOfflineTeacherSalary",giveTeacherOfflineSalary.setScale(0, BigDecimal.ROUND_HALF_UP));
+		results.put("giveOfflineTeacherSalary",giveTeacherOfflineSalary.setScale(2, BigDecimal.ROUND_HALF_UP));
 
 		BigDecimal ots = results.get("onlineTeacherSalary");
 		if(Objects.isNull(ots)){
@@ -3202,7 +3200,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public HttpResponseResult applyRefundForStudent(ReturnFeeDto returnFeeDto) {
-		Long vipGroupId = returnFeeDto.getGroupId();
+		Long vipGroupId = returnFeeDto.getVipGroupId();
 		Integer studentId = returnFeeDto.getStudentId();
 		if(Objects.isNull(vipGroupId) || Objects.isNull(studentId)){
 			throw new BizException("请指定小课与学生");
@@ -4295,11 +4293,12 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupActivityId().intValue());
 		}
 
-		if(Objects.nonNull(vipGroupActivity)&&Objects.nonNull(vipGroupActivity.getStudentMaxUsedTimes())&&vipGroupActivity.getStudentMaxUsedTimes()!=-1&&!CollectionUtils.isEmpty(studentIds)){
+		if(Objects.nonNull(vipGroupActivity) && Objects.nonNull(vipGroupActivity.getStudentMaxUsedTimes()) &&
+				vipGroupActivity.getStudentMaxUsedTimes() != -1 && !CollectionUtils.isEmpty(studentIds)){
 			List<Integer> errStudentIds = new ArrayList<>();
 			for (Integer studentId : studentIds) {
 				int useNum = vipGroupDao.countStudentUseingActivityNum(vipGroup.getVipGroupActivityId(), Integer.valueOf(studentId));
-				if(useNum>=vipGroupActivity.getStudentMaxUsedTimes()){
+				if(useNum >= vipGroupActivity.getStudentMaxUsedTimes()){
 					errStudentIds.add(studentId);
 				}
 			}
@@ -4309,13 +4308,13 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			}
 		}
 
-		Date now=new Date();
+		Date now = new Date();
         Map<Integer,String> userRoleMap = new HashMap<Integer, String>();
 
-		if(vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)||vipGroup.getStatus().equals(VipGroupStatusEnum.NOT_START)){
+		if(vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING) || vipGroup.getStatus().equals(VipGroupStatusEnum.NOT_START)){
 			List<CourseSchedule> courseSchedules = JSON.parseArray(vipGroup.getCourseSchedulesJson(),CourseSchedule.class);
 			int courseNum = courseScheduleDao.countVipGroupCourses(vipGroupId.intValue(),"VIP");
-			if(courseNum==0){
+			if(courseNum == 0){
 				courseScheduleService.batchAddCourseSchedule(courseSchedules);
 
 				Map<String, BigDecimal> salaryMap = countVipGroupPredictFee1(vipGroup, vipGroup.getUserId(), null);
@@ -4335,7 +4334,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
 		List<CourseSchedule> surplusCourses = courseScheduleDao.findByClassGroupAndStatus(classGroup.getId(), CourseStatusEnum.NOT_START.getCode());
 
-		List<ClassGroupStudentMapper> classGroupStudentMappers=new ArrayList<>();
+		List<ClassGroupStudentMapper> classGroupStudentMappers = new ArrayList<>();
 
 		List<ClassGroupStudentMapper> classGroupStudentsList = classGroupStudentMapperDao.findByClassGroupAndStudent(classGroup.getId(), studentIds);
 		Map<Integer, List<ClassGroupStudentMapper>> classGroupStudentsMap = classGroupStudentsList.stream()
@@ -4426,36 +4425,33 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			}
 
 
-			for (int i=0;i<surplusCourses.size();i++) {
-				CourseSchedule courseSchedule=surplusCourses.get(i);
+			for (int i = 0;i < surplusCourses.size();i++) {
+				CourseSchedule courseSchedule = surplusCourses.get(i);
 				if(courseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)){
-					offlineCourseTimes+=1;
+					offlineCourseTimes += 1;
 				}else if(courseSchedule.getTeachMode().equals(TeachModeEnum.ONLINE)){
-					onlineCourseTimes+=1;
+					onlineCourseTimes += 1;
 				}
-				if(hasGiveClass
-						&&vipGroup.getGiveTeachMode() == courseSchedule.getTeachMode()){
+				if(hasGiveClass && vipGroup.getGiveTeachMode() == courseSchedule.getTeachMode()){
 					if(courseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)
-							&&offlineCourseTimes>(offlineCourseTotalTimes-giveClassTimes)){
+							&& offlineCourseTimes > (offlineCourseTotalTimes - giveClassTimes)){
 						continue;
 					}
 
-					if(hasGiveClass
-							&&vipGroup.getGiveTeachMode() == courseSchedule.getTeachMode()){
-						if(courseSchedule.getTeachMode().equals(TeachModeEnum.ONLINE)
-								&&onlineCourseTimes>(onlineCourseTotalTimes-giveClassTimes)){
+					if(hasGiveClass && vipGroup.getGiveTeachMode() == courseSchedule.getTeachMode()){
+						if(courseSchedule.getTeachMode().equals(TeachModeEnum.ONLINE) && onlineCourseTimes > (onlineCourseTotalTimes-giveClassTimes)){
 							continue;
 						}
 					}
 				}
 				if(courseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)){
-					surplusCoursesPrice=surplusCoursesPrice.add(vipGroup.getOfflineClassesUnitPrice());
+					surplusCoursesPrice = surplusCoursesPrice.add(vipGroup.getOfflineClassesUnitPrice());
 				}else if(courseSchedule.getTeachMode().equals(TeachModeEnum.ONLINE)){
-					surplusCoursesPrice=surplusCoursesPrice.add(vipGroup.getOnlineClassesUnitPrice());
+					surplusCoursesPrice = surplusCoursesPrice.add(vipGroup.getOnlineClassesUnitPrice());
 				}
 			}
 
-			BigDecimal discount=null;
+			BigDecimal discount = null;
 			if(Objects.nonNull(vipGroupActivity)){
 				discount = vipGroupActivity.getDiscount().divide(new BigDecimal(100), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN);
 				surplusCoursesPrice = surplusCoursesPrice.multiply(discount).setScale(CommonConstants.DECIMAL_FINAL_PLACE,BigDecimal.ROUND_HALF_UP);
@@ -4465,13 +4461,13 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
 			List<CourseScheduleStudentPayment> courseScheduleStudentPayments=new ArrayList<>();
 
-			offlineCourseTimes=0;
-			onlineCourseTimes=0;
+			offlineCourseTimes = 0;
+			onlineCourseTimes = 0;
 			for (CourseSchedule vipGroupCourseSchedule : surplusCourses) {
 				if(vipGroupCourseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)){
-					offlineCourseTimes+=1;
+					offlineCourseTimes += 1;
 				}else if(vipGroupCourseSchedule.getTeachMode().equals(TeachModeEnum.ONLINE)){
-					onlineCourseTimes+=1;
+					onlineCourseTimes += 1;
 				}
 				CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
 				courseScheduleStudentPayment.setGroupType(GroupType.VIP);
@@ -4486,8 +4482,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 					courseScheduleStudentPayment.setExpectPrice(vipGroup.getOnlineClassesUnitPrice());
 					courseScheduleStudentPayment.setOriginalPrice(vipGroupDefaultClassesUnitPrice.getOnlineClassesUnitPrice());
                 }
-				if(hasGiveClass
-						&&vipGroup.getGiveTeachMode() == vipGroupCourseSchedule.getTeachMode()){
+				if(hasGiveClass && vipGroup.getGiveTeachMode() == vipGroupCourseSchedule.getTeachMode()){
 					if(vipGroupCourseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)
 							&&offlineCourseTimes>(offlineCourseTotalTimes-giveClassTimes)){
 						courseScheduleStudentPayment.setExpectPrice(new BigDecimal(0));
@@ -4542,8 +4537,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
 		courseScheduleService.checkNewCourseSchedules(surplusCourses, false,false);
 
-		VipGroupStatusEnum vipGroupStatus = vipGroup.getStatus();
-
         Integer currentStudentNum = classGroupStudentMapperDao.countClassGroupStudentNum(classGroup.getId());
 		if((!vipGroup.getStatus().equals(VipGroupStatusEnum.FINISHED)
 				||!vipGroup.getStatus().equals(VipGroupStatusEnum.CANCEL))