Przeglądaj źródła

Merge remote-tracking branch 'origin/master'

周箭河 5 lat temu
rodzic
commit
843b52b07c

+ 21 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentPaymentDao.java

@@ -76,4 +76,25 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
      * @return java.math.BigDecimal
      */
     BigDecimal countAllCourseFee(@Param("classGroupId") Integer classGroupId);
+
+    /**
+     * @describe 删除用户在指定班级上的课程
+     * @author Joburgess
+     * @date 2019/12/3
+     * @param ids: 学生课程缴费信息编号
+     * @return int
+     */
+    int batchDeleteWithID(@Param("ids") List<Integer> ids);
+
+    /**
+     * @describe 获取用户在指定班级上缴费记录编号
+     * @author Joburgess
+     * @date 2019/12/3
+     * @param classGroupId:
+     * @param userId:
+     * @return java.util.List<java.lang.Integer>
+     */
+    List<Integer> findNotStartCourseStudentPaymentIdsWithClassGroupAndStudent(@Param("classGroupId") Integer classGroupId,
+                                                                              @Param("userId") Integer userId);
+
 }

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleTeacherSalaryDao.java

@@ -77,10 +77,11 @@ public interface CourseScheduleTeacherSalaryDao extends BaseDAO<Long, CourseSche
 	 * @param userId       老师编号
 	 * @param salary       课酬
 	 * @param subsidy      补贴
+	 * @param startDateTime      开始时间
 	 * @return
 	 */
 	int batchUpdateWages(@Param("classGroupId") Integer classGroupId, @Param("userId") Integer userId, @Param("salary") BigDecimal salary,
-						 @Param("subsidy") BigDecimal subsidy);
+			@Param("subsidy") BigDecimal subsidy, @Param("startDateTime") String startDateTime);
 
 	/**
 	 * @param courseScheduleId: 课程编号

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

@@ -41,7 +41,7 @@ public interface SysConfigService extends BaseService<Long, SysConfig> {
 	public static final String ATTENDANCE_RANGE = "attendance_range";
 
 	/**
-	 * 学生VIP课,允许请假的时间,为开课前{}小时
+	 * 学生允许请假的时间,为开课前{}小时
 	 */
 	public static final String ADVANCE_LEAVE_HOURS = "advance_leave_hours";
 

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

@@ -21,6 +21,7 @@ import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.http.HttpUtil;
+
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
@@ -30,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.io.IOException;
 import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -134,6 +136,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
     private MusicGroupSubjectGoodsGroupService musicGroupSubjectGoodsGroupService;
     @Autowired
     private GoodsService goodsService;
+    
+    private SimpleDateFormat sdf_ymd = new SimpleDateFormat("yyyy-MM-dd");
+    
+    private SimpleDateFormat sdf_hms=new SimpleDateFormat("HH:mm:ss");
 
     @Override
     public BaseDAO<String, MusicGroup> getDAO() {
@@ -1255,9 +1261,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         }
 
         if ("all".equals(scope)) {
-            Integer classGrpupId = courseSchedule.getClassGroupId();
+			Integer classGrpupId = courseSchedule.getClassGroupId();
+			String startDateTime = sdf_ymd.format(courseSchedule.getClassDate()) + " " + sdf_hms.format(courseSchedule.getStartClassTime());
             // 未结算的课酬都修改
-            courseScheduleTeacherSalaryDao.batchUpdateWages(classGrpupId, teacherId, salary, subsidy);
+            courseScheduleTeacherSalaryDao.batchUpdateWages(classGrpupId, teacherId, salary, subsidy, startDateTime);
         } else {
             CourseScheduleTeacherSalary courseScheduleTeacherSalary = courseScheduleTeacherSalaryDao.queryByCourseScheduleIdAndUserId(courseScheduleId,
                     teacherId);

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

@@ -52,7 +52,7 @@ public class MusicGroupStudentFeeServiceImpl extends BaseServiceImpl<Long, Music
 		List<MusicGroupStudentFee> musicGroupStudentFeeList = musicGroupStudentFeeDao.queryWillRenewList(days);
 
 		for (MusicGroupStudentFee musicGroupStudentFee : musicGroupStudentFeeList) {
-			if (musicGroupStudentFee.getPaymentStatus() == PaymentStatus.PAID_COMPLETED) {
+			if (musicGroupStudentFee.getPaymentStatus() == PaymentStatus.PAID_COMPLETED && musicGroupStudentFee.getCourseFee().doubleValue() > 0) {
 				musicGroupStudentFee.setPaymentStatus(PaymentStatus.NON_PAYMENT);
 				musicGroupStudentFee.setUpdateTime(date);
 				updateList.add(musicGroupStudentFee);

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

@@ -203,7 +203,7 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 
 		Date date = new Date();
 		
-		int days = 24;
+		int days = 1;
 		String str = sysConfigDao.findConfigValue(SysConfigService.ADVANCE_LEAVE_HOURS);
 		if (StringUtils.isNotBlank(str)) {
 			days = Integer.parseInt(str);

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

@@ -863,13 +863,13 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 throw new BizException("减去缴费人数失败");
             }
             //发送缴费成功通知(短信 + push)
-            String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL + studentRegistration.getMusicGroupId());
+            String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL) + studentRegistration.getMusicGroupId();
 
             Map<Integer, String> map = new HashMap<>(1);
             map.put(studentPaymentOrder.getUserId(), studentRegistration.getParentsPhone());
             sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI,
                     MessageTypeEnum.STUDENT_SMS_PAYMENT_FAILED, map, null, 0, "1",
-                    studentApplyUrl);
+                    HttpUtil.getSortUrl(studentApplyUrl));
 //            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG,
 //                    MessageTypeEnum.STUDENT_SMS_PAYMENT_FAILED,map,null,0,"1",
 //                    studentApplyUrl);

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

@@ -1172,6 +1172,11 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
 		courseScheduleService.batchDeleteMusicGroupCourseWithStudent(vipGroupId.toString(),studentId,GroupType.VIP);
 
+        List<Integer> studentPaymentIds = courseScheduleStudentPaymentDao.findNotStartCourseStudentPaymentIdsWithClassGroupAndStudent(classGroup.getId(), studentId);
+        if(!CollectionUtils.isEmpty(studentPaymentIds)){
+            courseScheduleStudentPaymentDao.batchDeleteWithID(studentPaymentIds);
+        }
+
 //		classGroup.setStudentNum(classGroupStudentMapperDao.countClassGroupStudentNum(classGroup.getId()));
 //		classGroupDao.update(classGroup);
 
@@ -1262,6 +1267,11 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 //				classGroup.setStudentNum(classGroupStudentMapperDao.countClassGroupStudentNum(classGroup.getId()));
 //				classGroupDao.update(classGroup);
 
+                List<Integer> studentPaymentIds = courseScheduleStudentPaymentDao.findNotStartCourseStudentPaymentIdsWithClassGroupAndStudent(classStudentMapperByUserIdAndClassGroupId.getClassGroupId(), studentApplyRefunds.getUserId());
+                if(!CollectionUtils.isEmpty(studentPaymentIds)){
+                    courseScheduleStudentPaymentDao.batchDeleteWithID(studentPaymentIds);
+                }
+
 				courseScheduleService.batchDeleteMusicGroupCourseWithStudent(studentPaymentOrder.getMusicGroupId(),studentApplyRefunds.getUserId(),GroupType.VIP);
 
 				//学员退出班级群
@@ -1564,7 +1574,12 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		}
 		ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null);
 
-		Integer exitStudentNum = classGroupStudentMapperDao.countClassGroupExitStudentNum(classGroup.getId(), studentIds);
+        Integer studentNum = classGroupStudentMapperDao.countClassGroupStudentNum(classGroup.getId());
+        if(studentNum.compareTo(classGroup.getExpectStudentNum())>=0){
+            throw new BizException("该班级人数已达上限");
+        }
+
+        Integer exitStudentNum = classGroupStudentMapperDao.countClassGroupExitStudentNum(classGroup.getId(), studentIds);
 		if(exitStudentNum>0){
 			throw new BizException("选择的学生中存在此课程中已存在的学生");
 		}
@@ -1584,11 +1599,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 				surplusCoursesPrice=surplusCoursesPrice.add(vipGroup.getOnlineClassesUnitPrice());
 			}
 		}
-		List<CourseSchedule> vipGroupCourseSchedules=courseScheduleDao.findVipGroupCourseSchedules(vipGroupId);
-
-		if(CollectionUtils.isEmpty(vipGroupCourseSchedules)){
-			throw new BizException("此vip课不存在课程");
-		}
 
 		List<ImGroupMember> imGroupMemberList = new ArrayList<>();
 		List<ClassGroupStudentMapper> classGroupStudentMappers=new ArrayList<>();
@@ -1601,7 +1611,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 //			courseScheduleStudentPaymentService.createCourseScheduleStudentPaymentForVipGroup(vipGroupId,studentId);
 
 			List<CourseScheduleStudentPayment> courseScheduleStudentPayments=new ArrayList<>();
-			for (CourseSchedule vipGroupCourseSchedule : vipGroupCourseSchedules) {
+			for (CourseSchedule vipGroupCourseSchedule : surplusCourses) {
 				CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
 				courseScheduleStudentPayment.setGroupType(GroupType.VIP);
 				courseScheduleStudentPayment.setMusicGroupId(vipGroupId.toString());
@@ -1703,22 +1713,31 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		List<VipGroup> normalVipGroupList = vipGroupDao.queryNormalStatusList();
 		if (!CollectionUtils.isEmpty(normalVipGroupList)){
             Date now = new Date();
+            List<VipGroup> needUpdateVipGroups = new ArrayList<>();
             for (VipGroup vipGroup : normalVipGroupList) {
-                if(now.before(vipGroup.getRegistrationStartTime())){
-                    vipGroup.setStatus(VipGroupStatusEnum.NOT_START);
-                }
-                if(vipGroup.getRegistrationStartTime().before(now)&&vipGroup.getCoursesExpireDate().after(now)){
-                    vipGroup.setStatus(VipGroupStatusEnum.APPLYING);
-                }
-                if(vipGroup.getCoursesExpireDate().before(now)&&vipGroup.getCourseStartDate().after(now)){
-                    vipGroup.setStatus(VipGroupStatusEnum.APPLYING_END);
-                }
-                if(vipGroup.getCourseStartDate().before(now)&&vipGroup.getCoursesExpireDate().after(now)){
-                    vipGroup.setStatus(VipGroupStatusEnum.PROGRESS);
+                try {
+                    if(now.before(vipGroup.getRegistrationStartTime())){
+                        vipGroup.setStatus(VipGroupStatusEnum.NOT_START);
+                    }
+                    if(vipGroup.getRegistrationStartTime().before(now)&&vipGroup.getCoursesExpireDate().after(now)){
+                        vipGroup.setStatus(VipGroupStatusEnum.APPLYING);
+                    }
+                    if(vipGroup.getCoursesExpireDate().before(now)&&vipGroup.getCourseStartDate().after(now)){
+                        vipGroup.setStatus(VipGroupStatusEnum.APPLYING_END);
+                    }
+                    if(vipGroup.getCourseStartDate().before(now)&&vipGroup.getCoursesExpireDate().after(now)){
+                        vipGroup.setStatus(VipGroupStatusEnum.PROGRESS);
+                    }
+                    VipGroup vipGroup1 = new VipGroup();
+                    vipGroup1.setId(vipGroup.getId());
+                    vipGroup1.setStatus(vipGroup.getStatus());
+                    vipGroup1.setUpdateTime(now);
+                    needUpdateVipGroups.add(vipGroup1);
+                } catch (Exception e) {
+                    e.printStackTrace();
                 }
-                vipGroup.setUpdateTime(now);
             }
-            vipGroupDao.batchUpdate(normalVipGroupList);
+            vipGroupDao.batchUpdate(needUpdateVipGroups);
         }
 	}
 

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

@@ -134,10 +134,11 @@
         FROM
             course_schedule_student_payment cssp
             LEFT JOIN sys_user su ON cssp.user_id_ = su.id_
-            LEFT JOIN student_attendance sa ON cssp.course_schedule_id_ = sa.course_schedule_id_
-            AND cssp.user_id_ = sa.user_id_
+            LEFT JOIN student_attendance sa ON cssp.course_schedule_id_ = sa.course_schedule_id_ AND cssp.user_id_ = sa.user_id_
+            LEFT JOIN class_group_student_mapper cgsm ON cssp.user_id_=cgsm.user_id_ AND cssp.class_group_id_=cgsm.class_group_id_
         WHERE
             cssp.course_schedule_id_ =#{courseScheduleId}
+            AND cgsm.status_!='QUIT'
     </select>
 
     <update id="deleteStudentByMusicGroupId" parameterType="map">

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

@@ -974,7 +974,6 @@
             (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL)
             AND cs.class_group_id_ = #{classGroupId}
             AND csts.user_id_ = #{userId}
-            AND csts.expect_salary_ != 0
             <if test="onlyHistory!=null and onlyHistory==1">
                 AND CONCAT( cs.class_date_, ' ', cs.end_class_time_ )&lt;now()
             </if>
@@ -1333,6 +1332,8 @@
     <select id="findByClassGroupAndStatus" resultMap="CourseSchedule">
       select
         cs.id_,
+        cs.group_type_,
+        cs.music_group_id_,
         cs.class_group_id_,
         cs.status_,
         cs.subsidy_,

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

@@ -162,8 +162,11 @@
 		(cs.del_flag_ != 1 OR cs.del_flag_ IS NULL)
 		AND cs.class_group_id_ = #{classGroupId}
     </select>
+	<select id="findNotStartCourseStudentPaymentIdsWithClassGroupAndStudent" resultType="int">
+		SELECT id_ FROM course_schedule_student_payment WHERE class_group_id_=#{classGroupId} AND user_id_=#{userId}
+	</select>
 
-    <delete id="deleteStudentCourseSchedule">
+	<delete id="deleteStudentCourseSchedule">
 		DELETE FROM course_schedule_student_payment WHERE user_id_ = #{userId} AND course_schedule_id_ IN
 		<foreach collection="courseScheduleList" item="courseSchedule" index="index" open="(" close=")" separator=",">
 			#{courseSchedule.id}
@@ -175,4 +178,10 @@
 			#{courseScheduleId}
 		</foreach>
 	</delete>
+    <delete id="batchDeleteWithID">
+		DELETE FROM course_schedule_student_payment WHERE id_ IN
+		<foreach collection="ids" item="id" open="(" close=")" separator=",">
+			#{id}
+		</foreach>
+    </delete>
 </mapper>

+ 6 - 5
mec-biz/src/main/resources/config/mybatis/CourseScheduleTeacherSalaryMapper.xml

@@ -312,11 +312,12 @@
     </select>
 
 	<update id="batchUpdateWages" parameterType="map">
-		UPDATE course_schedule_teacher_salary set
-			subsidy_ = #{subsidy},
-			expect_salary_ = #{salary},
-			update_time_ = now()
-		WHERE user_id_ = #{userId} and class_group_id_ = #{classGroupId}
+		UPDATE course_schedule_teacher_salary csts left join course_schedule cs on csts.course_schedule_id_ = cs.id_ 
+		set
+			csts.subsidy_ = #{subsidy},
+			csts.expect_salary_ = #{salary},
+			csts.update_time_ = now()
+		WHERE csts.user_id_ = #{userId} and csts.class_group_id_ = #{classGroupId} and csts.settlement_time_ is null and CONCAT(cs.class_date_,' ',cs.start_class_time_) &gt; #{startDateTime}
 	</update>
     <update id="batchUpdateTeacherExpectSalary">
 		UPDATE course_schedule_teacher_salary

+ 0 - 6
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherController.java

@@ -58,12 +58,6 @@ public class TeacherController extends BaseController {
         return succeed(teacherService.getDetail(id));
     }
 
-    @ApiOperation(value = "分页查询教师列表")
-    @GetMapping("/queryPage")
-    public Object queryPage(TeacherQueryInfo queryInfo) {
-        return succeed(teacherService.queryPageDetail(queryInfo));
-    }
-
     @ApiOperation(value = "根据教师编号查询教师课程班列表")
     @GetMapping("/getClass")
     @ApiParam(value = "教师编号", required = true)