浏览代码

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

Joburgess 5 年之前
父节点
当前提交
7336d266e8

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentAttendanceDao.java

@@ -45,6 +45,17 @@ public interface StudentAttendanceDao extends BaseDAO<Long, StudentAttendance> {
     int deleteByCourseSchedules(@Param("courseScheduleIds") List<Long> courseScheduleIds);
 
     /**
+     * @describe 删除学生签到记录
+     * @author Joburgess
+     * @date 2020/1/17
+     * @param courseScheduleIds:
+     * @param userID:
+     * @return int
+     */
+    int deleteByCourseAndUser(@Param("courseScheduleIds") List<Long> courseScheduleIds,
+                              @Param("userId") Integer userID);
+
+    /**
      * @describe 根据课程和学生删除考情记录
      * @author Joburgess
      * @date 2020/1/17

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

@@ -66,6 +66,17 @@ public class MusicGroupCourseScheduleDto {
     @ApiModelProperty(value = "老师人数",required = false)
     private Integer teacherNum;
 
+    @ApiModelProperty(value = "签到备注")
+    private String remark;
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
     public Date getSettlementTime() {
         return settlementTime;
     }

+ 3 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherAttendanceServiceImpl.java

@@ -443,9 +443,9 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 		teacherAttendance.setSignOutStatus(teacherAttendanceInfo.getSignOutStatus());
 
 		SysUser sysUser = sysUserFeignService.queryUserInfo();
-		StringBuilder remak=new StringBuilder(DateUtil.dateToString(date,DateUtil.ISO_EXPANDED_DATE_FORMAT));
-		remak.append(",补签到,").append(sysUser.getRealName());
-		teacherAttendance.setRemark(remak.toString());
+		StringBuilder remark=new StringBuilder("补签到,");
+		remark.append(sysUser.getRealName());
+		teacherAttendance.setRemark(remark.toString());
 
 		if(Objects.isNull(teacherAttendance.getId())){
 			teacherAttendanceDao.insert(teacherAttendance);

+ 24 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -115,6 +115,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 	private StudentPauseInfoDao studentPauseInfoDao;
 	@Autowired
 	private IdGeneratorService idGeneratorService;
+	@Autowired
+	private StudentAttendanceDao studentAttendanceDao;
 
 	private static final Logger LOGGER = LoggerFactory
 			.getLogger(VipGroup.class);
@@ -1519,6 +1521,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		classStudentMapperByUserIdAndClassGroupId.setStatus(ClassGroupStudentStatusEnum.QUIT_SCHOOL);
 		classGroupStudentMapperDao.update(classStudentMapperByUserIdAndClassGroupId);
 
+		if(!CollectionUtils.isEmpty(courseScheduleIds)){
+			studentAttendanceDao.deleteByCourseAndUser(courseScheduleIds,studentId);
+		}
+
 		List<Integer> studentPaymentIds = courseScheduleStudentPaymentDao.findNotStartCourseStudentPaymentIdsWithClassGroupAndStudent(classGroup.getId(), studentId);
 		if(!CollectionUtils.isEmpty(studentPaymentIds)){
 			courseScheduleStudentPaymentDao.batchDeleteWithID(studentPaymentIds);
@@ -1960,10 +1966,16 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
     	if(vipGroup.getStatus()==VipGroupStatusEnum.CANCEL){
     		throw new BizException("该课程已结束或者已被停止,无法进行此操作");
 		}
+		ClassGroup classGroup = classGroupDao.findByMusicGroupAndType(vipGroupId.toString(), "VIP");
+    	if(Objects.isNull(classGroup)){
+    		throw new BizException("班级不存在");
+		}
 		List<Long> courseScheduleIds = courseScheduleDao.findVipGroupNotStartCourseScheduleIds(vipGroupId.toString(),GroupType.VIP.getCode());
     	if(vipGroup.getStatus()==VipGroupStatusEnum.NOT_START){
 			vipGroup.setStatus(VipGroupStatusEnum.CANCEL);
     		vipGroupDao.update(vipGroup);
+    		classGroup.setDelFlag(1);
+    		classGroupDao.update(classGroup);
     		if(courseScheduleIds != null && courseScheduleIds.size() > 0){
 				courseScheduleDao.batchDeleteCourseSchedules(courseScheduleIds);
 				courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds);
@@ -1979,6 +1991,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			}
 			vipGroup.setStatus(VipGroupStatusEnum.CANCEL);
 			vipGroupDao.update(vipGroup);
+			classGroup.setDelFlag(1);
+			classGroupDao.update(classGroup);
 			stopVipPush(vipGroup.getId(),vipGroup.getName());
 			return;
 		}
@@ -2003,6 +2017,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		vipGroup.setStatus(VipGroupStatusEnum.CANCEL);
     	vipGroup.setStopReason(stopReason);
 		vipGroupDao.update(vipGroup);
+		classGroup.setDelFlag(1);
+		classGroupDao.update(classGroup);
 
 		courseScheduleDao.batchDeleteCourseSchedules(courseScheduleIds);
 		courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds);
@@ -2280,8 +2296,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		if(Objects.isNull(vipGroup)){
 			throw new BizException("未找到指定的vip课程");
 		}
-		if(vipGroup.getStatus().equals(VipGroupStatusEnum.NOT_START)){
-			throw new BizException("此课程还未开始");
+		if(!vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)
+				&&!vipGroup.getStatus().equals(VipGroupStatusEnum.NOT_START)){
+			throw new BizException("此课程不处于报名状态");
 		}
 		ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null);
 
@@ -2298,7 +2315,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		Date now=new Date();
         List<ImGroupMember> imGroupMemberList = new ArrayList<>();
 
-		if(vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)){
+		if(vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)||vipGroup.getStatus().equals(VipGroupStatusEnum.NOT_START)){
 			List<CourseSchedule> courseSchedules = JSON.parseArray(vipGroup.getCourseSchedulesJson(),CourseSchedule.class);
 			int courseNum = courseScheduleDao.countVipGroupCourses(vipGroupId.intValue());
 			if(courseNum==0){
@@ -2535,6 +2552,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		//用户账户资金变动信息列表
 		List<SysUserCashAccountDetail> userCashAccountDetails = new ArrayList<>();
 		for (VipGroup noCreateSuccessVipGroup : noCreateSuccessVipGroups) {
+			int i = courseScheduleStudentPaymentDao.countStudentCourseNumWithGroup(GroupType.VIP, noCreateSuccessVipGroup.getId().toString());
+			if(i>0){
+				break;
+			}
 			noCreateSuccessVipGroup.setStatus(VipGroupStatusEnum.CANCEL);
 			List<StudentPaymentOrder> studentPaymentOrders = studentPaymentOrderDao.queryByDealStatus(noCreateSuccessVipGroup.getId().toString(),
 					OrderTypeEnum.SMALL_CLASS_TO_BUY, DealStatusEnum.SUCCESS);

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

@@ -605,6 +605,7 @@
         <result property="signInStatus" column="sign_in_status_"/>
         <result property="signOutStatus" column="sign_out_status_"/>
         <result property="settlementTime" column="settlement_time_"/>
+        <result property="remark" column="remark_"/>
     </resultMap>
     <select id="queryMusicGroupCourseSchedule" resultMap="MusicGroupCourseScheduleDto">
         SELECT cs.id_ course_schedule_id_,cs.class_date_,cs.start_class_time_,cs.end_class_time_,cs.class_group_id_,
@@ -628,7 +629,8 @@
         cs.type_ course_schedule_type_,cs.status_ course_schedule_status_,cg.name_ course_schedule_name_,
         IF(ta.sign_in_status_ IS NULL,3,ta.sign_in_status_) sign_in_status_,
         IF(ta.sign_out_status_ IS NULL,3,ta.sign_out_status_) sign_out_status_,
-        csts.settlement_time_
+        csts.settlement_time_,
+        ta.remark_
         FROM course_schedule cs
         LEFT JOIN class_group cg ON cg.id_ = cs.class_group_id_
         LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = cs.id_

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

@@ -138,6 +138,13 @@
             #{courseScheduleId}
         </foreach>
     </delete>
+    <delete id="deleteByCourseAndUser">
+        DELETE FROM student_attendance WHERE course_schedule_id_ IN
+        <foreach collection="courseScheduleIds" item="courseScheduleId" open="(" close=")" separator=",">
+            #{courseScheduleId}
+        </foreach>
+        AND user_id_=#{userId}
+    </delete>
     <delete id="deleteStudentAttendancesByCourseAndUsers">
         DELETE FROM student_attendance WHERE course_schedule_id_ = #{courseScheduleId}
         AND user_id_ IN