浏览代码

1、教务端课程交换
2、vip课退课费用及相关逻辑调整

Joburgess 5 年之前
父节点
当前提交
0098fec33f

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

@@ -1706,7 +1706,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 
         courseSchedule2.setClassDate(temp.getClassDate());
         courseSchedule2.setStartClassTime(temp.getStartClassTime());
-        courseSchedule2.setEndClassTime(DateUtil.addMinutes(courseSchedule2.getStartClassTime(),course1CourseMinutes));
+        courseSchedule2.setEndClassTime(DateUtil.addMinutes(courseSchedule2.getStartClassTime(),course2CourseMinutes));
 
         List<CourseSchedule> courseSchedules = new ArrayList<>();
         courseSchedules.add(courseSchedule1);

+ 26 - 51
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -976,10 +976,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public void updateVipGroupStudentNumAndStatus(Long vipGroupId , ClassGroup classGroup, Integer num, boolean updateVipStatus) {
-		VipGroup vipGroup = vipGroupDao.getLockVipGroup(vipGroupId);
-		if(Objects.isNull(vipGroup)){
-			throw new BizException("指定的vip课程不存在");
-		}
+//		VipGroup vipGroup = vipGroupDao.getLockVipGroup(vipGroupId);
+//		if(Objects.isNull(vipGroup)){
+//			throw new BizException("指定的vip课程不存在");
+//		}
 		if(Objects.isNull(classGroup)){
 			throw new BizException("未找到关联班级");
 		}
@@ -994,9 +994,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		if(studentPaymentNum.equals(classGroup.getExpectStudentNum())&&updateVipStatus){
 			classGroup.setStudentNum(studentPaymentNum);
 			classGroup.setDelFlag(0);
-			vipGroup.setStatus(VipGroupStatusEnum.PROGRESS);
 			createVipGroupCourseScheInfo(vipGroupId,classGroup);
-			vipGroupDao.update(vipGroup);
 		}
 		if(num!=0||updateVipStatus){
 			int i = courseScheduleDao.countVipGroupCourses(vipGroupId.intValue());
@@ -1050,8 +1048,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		}
 	}
 
-	@Transactional(rollbackFor = Exception.class)
 	@Override
+	@Transactional(rollbackFor = Exception.class)
 	public Map buyVipGroup(VipGroupBuyParamsDto vipGroupBuyParams) {
 		SysUser user = sysUserFeignService.queryUserInfo();
 		if(user == null){
@@ -1292,7 +1290,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		HashSet<Integer> hashSet = new HashSet<>(organIds);
 		String organIdsString = StringUtils.join(hashSet, ",");
 		vipGroup.setOrganIdList(organIdsString);
-		vipGroupDao.update(vipGroup);
+		if(classGroup.getExpectStudentNum().equals(classGroup.getStudentNum())){
+			vipGroup.setStatus(VipGroupStatusEnum.PROGRESS);
+		}
+		update(vipGroup);
 
 		try {
 			contractService.transferVipGroupCoursesContract(userId,vipGroupId);
@@ -1351,7 +1352,14 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         if(Objects.isNull(surplusCourseFee)){
             surplusCourseFee = new BigDecimal(0);
         }
-        surplusCourseFee = surplusCourseFee.multiply(new BigDecimal(0.8)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP);
+        VipGroupCategory vipGroupCategory = vipGroupCategoryDao.get(vipGroup.getVipGroupCategoryId().intValue());
+
+        if(vipGroupCategory.getStudentNum()<=1){
+            surplusCourseFee = surplusCourseFee.multiply(new BigDecimal(0.8)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP);
+        }else{
+            surplusCourseFee = surplusCourseFee.multiply(new BigDecimal(0.7)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP);
+        }
+
 		studentApplyRefunds.setExpectAmount(surplusCourseFee);
 		studentApplyRefunds.setStatus(StudentApplyRefundsStatus.ING);
 		String orderNo=StringUtils.join(new String[]{userId.toString(),String.valueOf(System.currentTimeMillis())});
@@ -1744,52 +1752,19 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		if(Objects.isNull(bigDecimal)){
 			bigDecimal = new BigDecimal(0);
 		}
-		bigDecimal = bigDecimal.multiply(new BigDecimal(0.8)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP);
+
+        VipGroupCategory vipGroupCategory = vipGroupCategoryDao.get(vipGroup.getVipGroupCategoryId().intValue());
+
+		if(vipGroupCategory.getStudentNum()<=1){
+            bigDecimal = bigDecimal.multiply(new BigDecimal(0.8)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP);
+        }else{
+            bigDecimal = bigDecimal.multiply(new BigDecimal(0.7)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP);
+        }
+
 		result.put("suplusCourseFee", bigDecimal);
 		return result;
 	}
 
-//	@Override
-//	@Transactional(rollbackFor = Exception.class)
-//	public Map<String, BigDecimal> getStudentSurplusCourseFee(Long vipGroupId, Integer studentId) {
-//		if(Objects.isNull(vipGroupId)||Objects.isNull(studentId)){
-//			throw new BizException("请指定课程和学生");
-//		}
-//		VipGroup vipGroup = vipGroupDao.get(vipGroupId);
-//		if(Objects.isNull(vipGroup)){
-//			throw new BizException("未找到指定vip课");
-//		}
-//		if(vipGroup.getStatus().equals(VipGroupStatusEnum.CANCEL)){
-//			throw new BizException("不能对已停止的课程进行退课操作");
-//		}
-//		Map<String,BigDecimal> result=new HashMap<>();
-//		if(vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)){
-//			StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroupId, studentId, DealStatusEnum.SUCCESS.getCode());
-//			if(Objects.isNull(studentPaymentOrder)){
-//				BigDecimal surplusCourseFee = studentPaymentOrderDao.sumSurplusCourseFee(vipGroupId.toString(), studentId);
-//				if(Objects.isNull(surplusCourseFee)){
-//					result.put("suplusCourseFee",new BigDecimal(0));
-//				}else{
-//					result.put("suplusCourseFee",surplusCourseFee);
-//				}
-//			}else{
-//				result.put("suplusCourseFee",studentPaymentOrder.getActualAmount());
-//			}
-//			return result;
-//		}
-//		ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null);
-//		if(Objects.isNull(classGroup)){
-//			throw new BizException("未找到对应班级");
-//		}
-//		BigDecimal bigDecimal = courseScheduleStudentPaymentDao.countSurplusCourseFee(classGroup.getId(), studentId);
-//		if(Objects.isNull(bigDecimal)){
-//			bigDecimal = new BigDecimal(0);
-//		}
-//		bigDecimal = bigDecimal.multiply(new BigDecimal(0.8)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP);
-//		result.put("suplusCourseFee", bigDecimal);
-//		return result;
-//	}
-
 	@Transactional(rollbackFor = Exception.class)
 	@Override
 	public void applyRefundAudit(Long id, StudentApplyRefundsStatus status, String remark,BigDecimal amount) {

+ 0 - 7
mec-biz/src/main/resources/config/mybatis/VipGroupMapper.xml

@@ -38,7 +38,6 @@
         <result column="courses_start_date" property="courseStartDate"/>
         <result column="course_schedules_json_" property="courseSchedulesJson"/>
         <result column="student_id_list_" property="studentIdList"/>
-
         <result column="organ_name_" property="organName" />
         <result column="school_name_" property="schoolName" />
         <result column="subject_name_" property="subjectName" />
@@ -248,9 +247,6 @@
             <if test="auditStatus != null">
                 audit_status_ = #{auditStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>
-            <if test="organIdList != null">
-                organ_id_list_ = #{organIdList},
-            </if>
             <if test="vipGroupActivityId != null">
                 vip_group_activity_id_ = #{vipGroupActivityId},
             </if>
@@ -275,9 +271,6 @@
             <if test="stopReason!=null">
                 stop_reason_=#{stopReason},
             </if>
-            <if test="auditStatus!=null">
-                audit_status_=#{auditStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-            </if>
             <if test="courseSchedulesJson!=null">
                 course_schedules_json_=#{courseSchedulesJson},
             </if>