Jelajahi Sumber

Merge remote-tracking branch 'origin/master'

zouxuan 4 tahun lalu
induk
melakukan
affd00a8dc

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/VipGroupDao.java

@@ -376,4 +376,7 @@ public interface VipGroupDao extends BaseDAO<Long, VipGroup> {
      */
     int countStudentUserActivityNum(@Param("vipGroupActivityId") Integer vipGroupActivityId,
                                     @Param("studentId") Integer studentId);
+
+    int countStudentUseingActivityNum(@Param("vipGroupActivityId") Integer vipGroupActivityId,
+                                    @Param("studentId") Integer studentId);
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/TeacherAttendancesDto.java

@@ -79,6 +79,17 @@ public class TeacherAttendancesDto {
     @ApiModelProperty(value = "申述处理状态",required = false)
     private ComplaintsStatusEnum complaintsStatus;
 
+    /** 结算时间 */
+    private java.util.Date settlementTime;
+
+    public Date getSettlementTime() {
+        return settlementTime;
+    }
+
+    public void setSettlementTime(Date settlementTime) {
+        this.settlementTime = settlementTime;
+    }
+
     public String getDisposeContent() {
         return disposeContent;
     }

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

@@ -666,11 +666,18 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 							}else if (practiceGroup.getType() == TRIAL){
 								courseScheduleTeacherSalary.setExpectSalary(new BigDecimal(0));
 							}else {
-								BigDecimal salary = teacherPracticeSalaryMap.get(cgtm.getUserId());
-								if (salary == null) {
-									throw new BizException("请设置老师网管课课酬");
+								SysConfig practiceCourseSalaryConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_COURSE_SALARY);
+								BigDecimal freeTeacherSalary = new BigDecimal(practiceCourseSalaryConfig.getParanValue());
+
+								if(Objects.nonNull(oldCourseMainTeacherSalary)&&freeTeacherSalary.compareTo(oldCourseMainTeacherSalary.getExpectSalary())==0){
+									courseScheduleTeacherSalary.setExpectSalary(freeTeacherSalary);
+								}else{
+									BigDecimal salary = teacherPracticeSalaryMap.get(cgtm.getUserId());
+									if (salary == null) {
+										throw new BizException("请设置老师网管课课酬");
+									}
+									courseScheduleTeacherSalary.setExpectSalary(salary);
 								}
-								courseScheduleTeacherSalary.setExpectSalary(salary);
 							}
 						} else if (type == CourseScheduleType.VIP) {
 
@@ -3015,6 +3022,13 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 				throw new BizException("上课时间不得早于当前时间");
 			}
 
+			List<CourseScheduleTeacherSalary> oldCourseSalarys = courseSalaryListMap.get(oldCourses.get(i).getId());
+			CourseScheduleTeacherSalary oldMainTeacherSalary = null;
+			if(!CollectionUtils.isEmpty(oldCourseSalarys)){
+				List<CourseScheduleTeacherSalary> mainTeachSalarys = oldCourseSalarys.stream().filter(c -> TeachTypeEnum.BISHOP.equals(c.getTeacherRole())).collect(Collectors.toList());
+				oldMainTeacherSalary = CollectionUtils.isEmpty(mainTeachSalarys)?null:mainTeachSalarys.get(0);
+			}
+
 			for (ClassGroupTeacherMapper classGroupTeacherMapper : courseAdjustInfo.getClassGroupTeacherMapperList()) {
 				if(!changeSalaryTeachTypes.contains(classGroupTeacherMapper.getTeacherRole())){
 					continue;
@@ -3028,10 +3042,17 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 				courseScheduleTeacherSalary.setClassGroupId(oldCourses.get(i).getClassGroupId());
 				courseScheduleTeacherSalary.setCreateTime(now);
 				courseScheduleTeacherSalary.setUpdateTime(now);
-				if(CourseScheduleType.PRACTICE.equals(oldCourses.get(i).getType())&&courseSalaryListMap.containsKey(oldCourses.get(i).getId())){
-					courseScheduleTeacherSalary.setExpectSalary(courseSalaryListMap.get(oldCourses.get(i).getId()).get(0).getExpectSalary());
+
+				if(TeachTypeEnum.BISHOP.equals(classGroupTeacherMapper.getTeacherRole())&&!oldMainTeacherSalary.getEnableChangeSalary()){
+					courseScheduleTeacherSalary.setExpectSalary(oldMainTeacherSalary.getExpectSalary());
+					courseScheduleTeacherSalary.setSubsidy(oldMainTeacherSalary.getSubsidy());
+					courseScheduleTeacherSalary.setEnableChangeSalary(oldMainTeacherSalary.getEnableChangeSalary());
+				}else{
+					if(CourseScheduleType.PRACTICE.equals(oldCourses.get(i).getType())&&courseSalaryListMap.containsKey(oldCourses.get(i).getId())){
+						courseScheduleTeacherSalary.setExpectSalary(courseSalaryListMap.get(oldCourses.get(i).getId()).get(0).getExpectSalary());
+					}
+					courseScheduleTeacherSalaryService.updateSingleCourseTeacherSalary(oldCourses.get(i), courseScheduleTeacherSalary);
 				}
-				courseScheduleTeacherSalaryService.updateSingleCourseTeacherSalary(oldCourses.get(i), courseScheduleTeacherSalary);
 				courseScheduleTeacherSalaries.add(courseScheduleTeacherSalary);
 
 				if (courseAdjustInfo.getConfirmGenerate() && !courseAdjustInfo.getAllowZeroSalary() && BigDecimal.ZERO.compareTo(courseScheduleTeacherSalary.getExpectSalary()) == 0) {

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

@@ -1480,6 +1480,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
             t.setTeacherId(courseScheduleTeacherSalary.getUserId());
             t.setTeacherName(idUserMap.containsKey(t.getTeacherId())?idUserMap.get(t.getTeacherId()).getUserName():"");
             t.setTeacherRole(courseScheduleTeacherSalary.getTeacherRole());
+            t.setSettlementTime(courseScheduleTeacherSalary.getSettlementTime());
             if(idTeacherAttendanceMap.containsKey(t.getTeacherId())){
                 TeacherAttendance teacherAttendance = idTeacherAttendanceMap.get(t.getTeacherId());
                 t.setTeacherAttendance(teacherAttendance);

+ 11 - 9
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -242,12 +242,13 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
 		//获取活动信息
 		VipGroupActivity vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupApplyBaseInfo().getVipGroupActivityId());
-		if(Objects.nonNull(vipGroupActivity)&&Objects.nonNull(vipGroupActivity.getStudentMaxUsedTimes())&&StringUtils.isNotBlank(vipGroupApplyBaseInfoDto.getStudentIdList())){
+		if(Objects.nonNull(vipGroupActivity)&&Objects.nonNull(vipGroupActivity.getStudentMaxUsedTimes())&&vipGroupActivity.getStudentMaxUsedTimes()!=-1&&StringUtils.isNotBlank(vipGroupApplyBaseInfoDto.getStudentIdList())){
 			List<String> tempStudentIds = Arrays.asList(vipGroupApplyBaseInfoDto.getStudentIdList().split(","));
 			for (String studentIdStr : tempStudentIds) {
 				int useNum = vipGroupDao.countStudentUserActivityNum(vipGroup.getVipGroupApplyBaseInfo().getVipGroupActivityId(), Integer.valueOf(studentIdStr));
 				if(useNum>=vipGroupActivity.getStudentMaxUsedTimes()){
-					throw new BizException("创建失败:当前活动可购买次数为{}次", vipGroupActivity.getStudentMaxUsedTimes());
+					SysUser student = teacherDao.getUser(Integer.valueOf(studentIdStr));
+					throw new BizException("{}学员已超过该活动购买次数限制", student.getUsername());
 				}
 			}
 		}
@@ -268,7 +269,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			}
 		}
 
-		if(Objects.nonNull(vipGroupActivity)&&Objects.nonNull(vipGroupActivity.getMinCourseNum())&&Objects.nonNull(vipGroupActivity.getMaxCourseNum())){
+		if(Objects.nonNull(vipGroupActivity)&&Objects.nonNull(vipGroupActivity.getMinCourseNum())&&vipGroupActivity.getMinCourseNum()!=-1&&Objects.nonNull(vipGroupActivity.getMaxCourseNum())&&vipGroupActivity.getMaxCourseNum()!=-1){
 			Integer requestCourseNum = vipGroupApplyBaseInfoDto.getOnlineClassesNum() + vipGroupApplyBaseInfoDto.getOfflineClassesNum();
 			if(requestCourseNum.compareTo(vipGroupActivity.getMinCourseNum())<0||requestCourseNum.compareTo(vipGroupActivity.getMaxCourseNum())>0){
 				throw new BizException("该活动课时数为{}节~{}节", vipGroupActivity.getMinCourseNum(), vipGroupActivity.getMaxCourseNum());
@@ -1512,10 +1513,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupActivityId().intValue());
 		}
 
-		if(Objects.nonNull(vipGroupActivity)&&Objects.nonNull(vipGroupActivity.getStudentMaxUsedTimes())){
-			int useNum = vipGroupDao.countStudentUserActivityNum(vipGroup.getVipGroupActivityId(), Integer.valueOf(user.getId()));
+		if(Objects.nonNull(vipGroupActivity)&&Objects.nonNull(vipGroupActivity.getStudentMaxUsedTimes())&&vipGroupActivity.getStudentMaxUsedTimes()!=-1){
+			int useNum = vipGroupDao.countStudentUseingActivityNum(vipGroup.getVipGroupActivityId(), Integer.valueOf(user.getId()));
 			if(useNum>vipGroupActivity.getStudentMaxUsedTimes()){
-				throw new BizException("当前活动可购买次数为{}次", vipGroupActivity.getStudentMaxUsedTimes());
+				throw new BizException("您已超过该活动购买次数限制", vipGroupActivity.getStudentMaxUsedTimes());
 			}
 		}
 
@@ -2909,11 +2910,12 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupActivityId().intValue());
 		}
 
-		if(Objects.nonNull(vipGroupActivity)&&Objects.nonNull(vipGroupActivity.getStudentMaxUsedTimes())&&!CollectionUtils.isEmpty(studentIds)){
+		if(Objects.nonNull(vipGroupActivity)&&Objects.nonNull(vipGroupActivity.getStudentMaxUsedTimes())&&vipGroupActivity.getStudentMaxUsedTimes()!=-1&&!CollectionUtils.isEmpty(studentIds)){
 			for (Integer studentId : studentIds) {
-				int useNum = vipGroupDao.countStudentUserActivityNum(vipGroup.getVipGroupActivityId(), Integer.valueOf(studentId));
+				int useNum = vipGroupDao.countStudentUseingActivityNum(vipGroup.getVipGroupActivityId(), Integer.valueOf(studentId));
 				if(useNum>vipGroupActivity.getStudentMaxUsedTimes()){
-					throw new BizException("当前活动可购买次数为{}次", vipGroupActivity.getStudentMaxUsedTimes());
+					SysUser student = teacherDao.getUser(studentId);
+					throw new BizException("{}学员已超过该活动购买次数限制", student.getUsername());
 				}
 			}
 		}

+ 0 - 6
mec-biz/src/main/resources/config/mybatis/StudentExtracurricularExercisesSituationMapper.xml

@@ -564,9 +564,6 @@
 		FROM
 			student_extracurricular_exercises_situation_ sees
 			LEFT JOIN teacher tea ON tea.id_=sees.teacher_id_
-			<if test="unDone!=null and unDone==1">
-				LEFT JOIN teacher_remind tm ON sees.monday_=tm.monday_ AND sees.teacher_id_=tm.teacher_id_
-			</if>
 			LEFT JOIN organization organ ON organ.id_=tea.organ_id_
 			LEFT JOIN sys_user su ON tea.id_=su.id_
 		<include refid="queryTeacherServeInfoCondition" />
@@ -616,9 +613,6 @@
 			FROM
 				student_extracurricular_exercises_situation_ sees
 				LEFT JOIN teacher tea ON tea.id_=sees.teacher_id_
-				<if test="unDone!=null and unDone==1">
-					LEFT JOIN teacher_remind tm ON sees.monday_=tm.monday_ AND sees.teacher_id_=tm.teacher_id_
-				</if>
 			<include refid="queryTeacherServeInfoCondition" />
 			GROUP BY sees.monday_,sees.sunday_,sees.teacher_id_
 			<trim prefix="HAVING" prefixOverrides="AND">

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

@@ -1044,4 +1044,12 @@
         WHERE vg.vip_group_activity_id_=#{vipGroupActivityId}
             AND ((vg.group_status_=1 AND FIND_IN_SET(#{studentId}, vg.student_id_list_)) OR cgsm.user_id_=#{studentId});
     </select>
+
+    <select id="countStudentUseingActivityNum" resultType="int">
+        SELECT COUNT(DISTINCT vg.id_)
+        FROM vip_group vg
+                 LEFT JOIN class_group_student_mapper cgsm ON vg.id_=cgsm.music_group_id_ AND cgsm.group_type_='VIP'
+        WHERE vg.vip_group_activity_id_=#{vipGroupActivityId}
+          AND cgsm.user_id_=#{studentId}
+    </select>
 </mapper>