Prechádzať zdrojové kódy

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

 Conflicts:
	mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java
zouxuan 3 rokov pred
rodič
commit
ccba502e88

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

@@ -629,7 +629,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 						courseScheduleTeacherSalary.setMusicGroupId(classGroup.getMusicGroupId());
 						courseScheduleTeacherSalary.setTeacherRole(cgtm.getTeacherRole());
 						courseScheduleTeacherSalary.setUserId(cgtm.getUserId());
-						if(TeachTypeEnum.BISHOP.equals(cgtm.getTeacherRole())&&Objects.nonNull(oldCourseMainTeacherSalary)&&!oldCourseMainTeacherSalary.getEnableChangeSalary()){
+						if(TeachTypeEnum.BISHOP.equals(cgtm.getTeacherRole()) && Objects.nonNull(oldCourseMainTeacherSalary) && !oldCourseMainTeacherSalary.getEnableChangeSalary()){
 							courseScheduleTeacherSalary.setExpectSalary(oldCourseMainTeacherSalary.getExpectSalary());
 							courseScheduleTeacherSalary.setSubsidy(oldCourseMainTeacherSalary.getSubsidy());
 							courseScheduleTeacherSalary.setEnableChangeSalary(oldCourseMainTeacherSalary.getEnableChangeSalary());

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

@@ -277,13 +277,13 @@ public class GroupClassServiceImpl implements GroupClassService {
                 if(activityUserMapper.getGiveVipFlag() == 2){
                     Long giveVipGroupId = activityUserMapper.getGiveVipGroupId();
                     VipGroup giveVipGroup = vipGroupDao.get(giveVipGroupId);
-                    ClassGroupStudentMapper giveClassGroupStudentMapper = classGroupStudentMapperDao.query(giveVipGroupId.intValue(),studentId);
+                    ClassGroup giveClassGroup = classGroupDao.findByVipGroup(giveVipGroupId, null);
+                    ClassGroupStudentMapper giveClassGroupStudentMapper = classGroupStudentMapperDao.findClassGroupStudent(giveClassGroup.getId(),studentId);
                     giveClassGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.QUIT);
                     classGroupStudentMapperDao.update(giveClassGroupStudentMapper);
 
                     courseScheduleService.batchDeleteMusicGroupCourseWithStudent(giveVipGroupId.toString(),studentId,GroupType.VIP);
 
-                    ClassGroup giveClassGroup = classGroupDao.findByVipGroup(giveVipGroupId, null);
                     List<Integer> studentPaymentIds = courseScheduleStudentPaymentDao.findNotStartCourseStudentPaymentIdsWithClassGroupAndStudent(giveClassGroup.getId(), studentId);
                     if(!CollectionUtils.isEmpty(studentPaymentIds)){
                         courseScheduleStudentPaymentDao.batchDeleteWithID(studentPaymentIds);

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

@@ -3878,7 +3878,14 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         BigDecimal divide = actualPrice.divide(new BigDecimal(courseSchedules.size()), ROUND_DOWN);
         BigDecimal firstAmount = actualPrice.subtract(divide.multiply(new BigDecimal(courseSchedules.size()))).add(divide);
 
-        BigDecimal teacherDefaultSalary = BigDecimal.ZERO;
+        SysConfig practiceCourseMinutesConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
+        Integer practiceCourseMinutes = practiceCourseMinutesConfig.getParanValue(Integer.class);
+
+        TeacherDefaultPracticeGroupSalary teacherDefaultPracticeGroupSalary = teacherDefaultPracticeGroupSalaryDao.findByTeacherAndCourseMinutes(practiceGroup.getUserId(),practiceCourseMinutes);
+        if(Objects.isNull(teacherDefaultPracticeGroupSalary)){
+            throw new BizException("请设置老师课酬");
+        }
+        BigDecimal teacherDefaultSalary = teacherDefaultPracticeGroupSalary.getMainTeacherSalary();
         if(practiceGroup.getVipGroupActivityId() != null){
             VipGroupActivity vipGroupActivity = vipGroupActivityDao.get(practiceGroup.getVipGroupActivityId());
             VipGroupSalarySettlementDto vipGroupSalarySettlementDto = JSON.parseObject(vipGroupActivity.getSalarySettlementJson(), VipGroupSalarySettlementDto.class);
@@ -3886,24 +3893,9 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
                 throw new BizException("课酬结算方案错误");
             }
             VipGroupSalarySettlementTypeDto salarySettlement = vipGroupSalarySettlementDto.getPracticeSalarySettlement();
-            switch (salarySettlement.getSalarySettlementType()){
-                case TEACHER_DEFAULT:
-                    break;
-                case FIXED_SALARY:
-                    teacherDefaultSalary = salarySettlement.getSettlementValue().setScale(0, BigDecimal.ROUND_HALF_UP);
-                    break;
-                default:
-                    throw new BizException("错误的课酬结算标准!");
-            }
-        }else {
-            SysConfig practiceCourseMinutesConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
-            Integer practiceCourseMinutes = practiceCourseMinutesConfig.getParanValue(Integer.class);
-            TeacherDefaultPracticeGroupSalary teacherDefaultPracticeGroupSalary = teacherDefaultPracticeGroupSalaryDao.findByTeacherAndCourseMinutes(practiceGroup.getUserId(),practiceCourseMinutes);
-
-            if(Objects.isNull(teacherDefaultPracticeGroupSalary)){
-                throw new BizException("请设置老师课酬");
+            if(salarySettlement.getSalarySettlementType() == SalarySettlementTypeEnum.FIXED_SALARY){
+                teacherDefaultSalary = salarySettlement.getSettlementValue().setScale(0, BigDecimal.ROUND_HALF_UP);
             }
-            teacherDefaultSalary = teacherDefaultPracticeGroupSalary.getMainTeacherSalary();
         }
 
         List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaries = new ArrayList<>();

+ 7 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -1344,7 +1344,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		ClassGroup classGroup = new ClassGroup();
 		classGroup.setSubjectIdList(applyBaseInfo.getSubjectIdList());
 		classGroup.setExpectStudentNum(vipGroupCategory.getStudentNum());
-		classGroup.setStudentNum(0);
+		classGroup.setStudentNum(1);
 		classGroup.setName(applyBaseInfo.getName());
 		classGroup.setTotalClassTimes(totalClassTimes);
 		classGroup.setType(ClassGroupTypeEnum.VIP);
@@ -2278,11 +2278,11 @@ 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;
+		int normalStudentNum = classGroupStudentMapperDao.countGroupNormalStudentNum(VIP, vipGroup.getId().toString());
 
 		//教师线下单课酬计算
 		if(vipGroupCategory.getMusicTheory()){
-			teacherOfflineSalary = teacherDefaultVipGroupSalary.getOfflineClassesSalary().multiply(new BigDecimal(studentNum>5?5:studentNum)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP);
+			teacherOfflineSalary = teacherDefaultVipGroupSalary.getOfflineClassesSalary().multiply(new BigDecimal(normalStudentNum>5?5:normalStudentNum)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP);
 		}else {
 			teacherOfflineSalary = teacherDefaultVipGroupSalary.getOfflineClassesSalary();
 		}
@@ -2295,7 +2295,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
 		//教师赠送线下单课酬计算
 		if(vipGroupCategory.getMusicTheory()){
-			giveTeacherOfflineSalary = teacherDefaultVipGroupSalary.getOfflineClassesSalary().multiply(new BigDecimal(studentNum>5?5:studentNum)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP);
+			giveTeacherOfflineSalary = teacherDefaultVipGroupSalary.getOfflineClassesSalary().multiply(new BigDecimal(normalStudentNum>5?5:normalStudentNum)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP);
 		}else {
 			giveTeacherOfflineSalary = teacherDefaultVipGroupSalary.getOfflineClassesSalary();
 		}
@@ -2321,7 +2321,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			gofts = BigDecimal.ZERO;
 		}
 		if(!vipGroupCategory.getMusicTheory()){
-			int normalStudentNum = classGroupStudentMapperDao.countGroupNormalStudentNum(VIP, vipGroup.getId().toString());
 			gofts = gofts.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);
 		}
@@ -2794,8 +2793,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			classGroupStudentMapper.setGroupType(GroupType.VIP);
 			classGroupStudentMapperDao.insert(classGroupStudentMapper);
 
+			//获取班级实际人数
+			Integer studentNum = classGroupStudentMapperDao.countGroupNormalStudentNum(VIP, classGroup.getMusicGroupId());
 			//课程组人数已满,变更状态
-			if(classGroup.getStudentNum().equals(classGroup.getExpectStudentNum())){
+			if(studentNum.equals(classGroup.getExpectStudentNum())){
 				vipGroup.setStatus(VipGroupStatusEnum.PROGRESS);
 				classGroup.setDelFlag(0);
 				VipGroupDefaultClassesUnitPrice vipGroupDefaultClassesUnitPrice = vipGroupDefaultClassesUnitPriceDao.getByVipGroupCategory(vipGroup.getVipGroupCategoryId(), vipGroup.getOrganId());

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderMapper.xml

@@ -808,7 +808,7 @@
         SELECT COUNT(*)
         FROM student_payment_order spo
         WHERE spo.music_group_id_ = #{groupId}
-          AND spo.status_ != 'FAILED'
+          AND spo.status_ NOT IN ('FAILED','CLOSE')
           AND spo.group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler }
     </select>
     <select id="countSporadicOrder" resultType="java.lang.Integer">

+ 3 - 3
mec-biz/src/main/resources/config/mybatis/VipGroupActivityMapper.xml

@@ -279,7 +279,7 @@
 	<select id="queryWaitCourseActivity" resultMap="WaitCourseActivityDto">
 		SELECT aum.id_,aum.activity_id_,vga.name_ activity_name_,COUNT(DISTINCT aum.user_id_) student_num_ FROM activity_user_mapper aum
 		LEFT JOIN vip_group_activity vga ON aum.activity_id_ = vga.id_
-		WHERE 1=1
+		WHERE aum.return_fee_ = 0
 		<if test="teacherId != null">
 			AND aum.teacher_id_ = #{teacherId}
 		</if>
@@ -307,7 +307,7 @@
 		FROM (SELECT activity_id_,MAX(vip_flag_) vip_flag_,MAX(practice_flag_) practice_flag_,
 					 MAX(give_vip_flag_) give_vip_flag_,MAX(give_practice_flag_) give_practice_flag_,user_id_,teacher_id_
 			  FROM activity_user_mapper
-			  WHERE activity_id_ = #{activityId}
+			  WHERE aum.return_fee_ = 0 AND activity_id_ = #{activityId}
 			<if test="userId != null">
 				AND teacher_id_ = #{userId}
 			</if>
@@ -326,7 +326,7 @@
 				su.username_,su.avatar_,aum.user_id_,su.phone_
 		FROM activity_user_mapper aum
 		LEFT JOIN sys_user su ON su.id_ = aum.user_id_
-		WHERE aum.activity_id_ = #{activityId}
+		WHERE aum.return_fee_ = 0 AND aum.activity_id_ = #{activityId}
 		<if test="userId != null">
 			AND aum.teacher_id_ = #{userId}
 		</if>

+ 2 - 2
mec-web/src/main/java/com/ym/mec/web/controller/education/ActivityController.java

@@ -83,12 +83,12 @@ public class ActivityController extends BaseController {
         ActivityWaitCourseStudentNumDto courseStudentNum = vipGroupActivityService.getActivityWaitCourseStudentNum(null, activityId);
         VipGroupActivity vipGroupActivity = courseStudentNum.getVipGroupActivity();
         Employee employee = employeeDao.get(sysUser.getId());
-        List<String> activityOrgans = Arrays.asList(vipGroupActivity.getOrganId().split(","));
+        List<Integer> activityOrgans = Arrays.stream(vipGroupActivity.getOrganId().split(",")).mapToInt(Integer::valueOf).boxed().collect(Collectors.toList());
         if(StringUtils.isEmpty(employee.getOrganIdList())){
             courseStudentNum.setEmployeeAndActivityOrganIds(StringUtils.join(activityOrgans,","));
             return succeed(courseStudentNum);
         }
-        List<String> employeeOrgans = Arrays.asList(employee.getOrganIdList().split(","));
+        List<Integer> employeeOrgans = Arrays.stream(employee.getOrganIdList().split(",")).mapToInt(Integer::valueOf).boxed().collect(Collectors.toList());
         employeeOrgans.retainAll(activityOrgans);
         courseStudentNum.setEmployeeAndActivityOrganIds(StringUtils.join(employeeOrgans,","));
         return succeed(courseStudentNum);