소스 검색

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

zouxuan 5 년 전
부모
커밋
b4ef94929f

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

@@ -90,7 +90,7 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 							courseScheduleStudentPayment.setExpectPrice(
 									vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice().multiply(
 											new BigDecimal(vipGroupActivity.getAttribute1()))
-											.divide(new BigDecimal(100), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN)
+											.divide(new BigDecimal(100), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP)
 							);
 							break;
 						case GIVE_CLASS:
@@ -114,7 +114,7 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 							courseScheduleStudentPayment.setExpectPrice(
 									vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice().multiply(
 											new BigDecimal(vipGroupActivity.getAttribute1()))
-											.divide(new BigDecimal(100), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN)
+											.divide(new BigDecimal(100), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP)
 							);
 							break;
 						case GIVE_CLASS:

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

@@ -368,7 +368,7 @@ public class EduPracticeGroupServiceImpl implements EduPracticeGroupService{
         }
         courseScheduleDao.batchAddCourseSchedules(practiceCourses);
         TeacherDefaultPracticeGroupSalary teacherDefaultPracticeGroupSalary = teacherDefaultPracticeGroupSalaryDao.findByTeacherAndCourseMinutes(practiceGroupBuyParams.getUserId(),practiceCourseMinutes);
-        BigDecimal teacherDefaultSalary=new BigDecimal(practiceCourseSalaryConfig.getParanValue());
+        BigDecimal teacherDefaultSalary=BigDecimal.ZERO;
         if(Objects.nonNull(teacherDefaultPracticeGroupSalary)){
             teacherDefaultSalary=teacherDefaultPracticeGroupSalary.getMainTeacherSalary();
         }

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

@@ -2974,7 +2974,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         }
         courseScheduleDao.batchAddCourseSchedules(practiceCourses);
         TeacherDefaultPracticeGroupSalary teacherDefaultPracticeGroupSalary = teacherDefaultPracticeGroupSalaryDao.findByTeacherAndCourseMinutes(practiceGroupBuyParams.getUserId(),practiceCourseMinutes);
-        BigDecimal teacherDefaultSalary=new BigDecimal(practiceCourseSalaryConfig.getParanValue());
+        BigDecimal teacherDefaultSalary=BigDecimal.ZERO;
         if(Objects.nonNull(teacherDefaultPracticeGroupSalary)){
             teacherDefaultSalary=teacherDefaultPracticeGroupSalary.getMainTeacherSalary();
         }

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

@@ -956,7 +956,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			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).setScale(CommonConstants.DECIMAL_FINAL_PLACE,BigDecimal.ROUND_HALF_UP);
+				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){
@@ -979,8 +979,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			default:
 				throw new BizException("活动类型错误!");
 		}
-		totalPrice=totalPrice.setScale(0,BigDecimal.ROUND_CEILING);
-		results.put("totalPrice",totalPrice);
+
+		results.put("totalPrice",totalPrice.setScale(0,BigDecimal.ROUND_CEILING));
 
 		//教师课酬线上单课酬计算
 		if(Objects.nonNull(vipGroupSalarySettlementDto.getOnlineSalarySettlement())){
@@ -1000,7 +1000,11 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 						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));
+						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:
@@ -1564,6 +1568,12 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			throw new BizException("请确定退费金额");
 		}
 
+		Map<String, BigDecimal> studentSurplusCourseFee = getStudentSurplusCourseFee(vipGroupId, studentId);
+		BigDecimal suplusCourseFee = studentSurplusCourseFee.get("suplusCourseOriginalFee");
+		if(amount.compareTo(suplusCourseFee)>0){
+			throw new BizException("学员最大可退费金额为{}元", suplusCourseFee.toString());
+		}
+
 		sysUserCashAccountService.updateBalance(studentId, amount);
 		SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(studentId);
 		SysUserCashAccountDetail sysUserCashAccountDetail = new SysUserCashAccountDetail();
@@ -1900,6 +1910,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		if(vipGroup.getStatus().equals(VipGroupStatusEnum.CANCEL)){
 			throw new BizException("不能对已停止的课程进行退课操作");
 		}
+		Map<String,BigDecimal> result=new HashMap<>();
 		Date now = new Date();
         BigDecimal bigDecimal;
         List<StudentCourseInfoDto> userCourseInfos = courseScheduleDao.findUserCourseInfos(GroupType.VIP, vipGroupId.toString(), studentId, null);
@@ -1910,6 +1921,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             }else{
                 bigDecimal=studentPaymentOrder.getActualAmount();
             }
+
+			result.put("suplusCourseOriginalFee", bigDecimal);
         }else if(!CollectionUtils.isEmpty(userCourseInfos)){
             BigDecimal historyPrice=new BigDecimal(0);
             BigDecimal allPrice=new BigDecimal(0);
@@ -1923,10 +1936,11 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             if(bigDecimal.longValue()<0){
                 bigDecimal=new BigDecimal(0);
             }
+			result.put("suplusCourseOriginalFee", allPrice);
         }else{
 		    bigDecimal=new BigDecimal(0);
+			result.put("suplusCourseOriginalFee", bigDecimal);
         }
-        Map<String,BigDecimal> result=new HashMap<>();
 		ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null);
 		if(Objects.isNull(classGroup)){
 			throw new BizException("未找到对应班级");