Browse Source

Merge branch 'maintenance_feature'

周箭河 4 years ago
parent
commit
54ca7f2de7

+ 13 - 7
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRegistrationDao.java

@@ -427,6 +427,7 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
 
     /**
      * 批量删除注册信息
+     *
      * @param ids
      * @return
      */
@@ -434,6 +435,7 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
 
     /**
      * 获取学员声部名称
+     *
      * @param musicGroupId
      * @param studentId
      * @return
@@ -442,42 +444,46 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
 
     /**
      * 获取学员声部名称
+     *
      * @param musicGroupId
      * @param studentIds
      * @return
      */
-    List<Map<Integer,String>> getStudentSubjectNameByStuIds(@Param("musicGroupId") String musicGroupId, @Param("studentIds") Collection<Integer> studentIds);
+    List<Map<Integer, String>> getStudentSubjectNameByStuIds(@Param("musicGroupId") String musicGroupId, @Param("studentIds") Collection<Integer> studentIds);
 
     /**
      * 将学员报名缴费状态更新至已缴费
+     *
      * @param calenderId
      */
     void updatePaymentStatusByClaenderId(Long calenderId);
 
     /**
+     * @param studentIds:
+     * @return java.util.List<com.ym.mec.biz.dal.entity.MusicGroup>
      * @describe 查询学员在读进行中乐团
      * @author Joburgess
      * @date 2021/1/29 0029
-     * @param studentIds:
-     * @return java.util.List<com.ym.mec.biz.dal.entity.MusicGroup>
      */
     List<MusicGroup> getStudentNormalMusicGroups(@Param("studentIds") Set<Integer> studentIds);
 
     /**
+     * @param userId:
+     * @return com.ym.mec.biz.dal.entity.MusicGroup
      * @describe 获取学员最后加入的在读进行中乐团
      * @author Joburgess
      * @date 2021/2/28 0028
-     * @param userId:
-     * @return com.ym.mec.biz.dal.entity.MusicGroup
      */
     MusicGroup getUserLastNormalMusicGroup(@Param("userId") Integer userId);
 
     /**
+     * @param studentIds:
+     * @return java.util.List<com.ym.mec.biz.dal.entity.StudentRegistration>
      * @describe 查询学员在读进行中乐团报名信息
      * @author Joburgess
      * @date 2021/2/25 0025
-     * @param studentIds:
-     * @return java.util.List<com.ym.mec.biz.dal.entity.StudentRegistration>
      */
     List<StudentRegistration> getStudentNormalRegistration(@Param("studentIds") Set<Integer> studentIds);
+
+    StudentRegistration getByUserIdAndMusicGroupId(@Param("musicGroupId") String musicGroupId, @Param("userId") Integer userId);
 }

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

@@ -645,6 +645,13 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 sysUser.setImToken(register.getToken());
                 teacherDao.updateUser(sysUser);
             } else {
+                StudentRegistration oldReg = studentRegistrationDao.getByUserIdAndMusicGroupId(musicGroupId, sysUser.getId());
+                if (oldReg != null && oldReg.getMusicGroupStatus() != StudentMusicGroupStatusEnum.QUIT && oldReg.getMusicGroupStatus() != StudentMusicGroupStatusEnum.APPLY) {
+                    throw new BizException("该学员已存在,原手机号为"+oldReg.getParentsPhone());
+                }
+                if(oldReg != null){
+                    phoneAndMusicGroupId = oldReg;
+                }
                 if (StringUtils.isNotEmpty(sysUser.getUsername())) {
                     if (!sysUser.getUsername().equals(studentRegistration.getName())) {
                         throw new BizException("操作失败:账户已被注册");

+ 5 - 0
mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml

@@ -832,4 +832,9 @@
             #{id}
         </foreach>
     </delete>
+
+    <!-- 根据乐团编号和手机号查询注册乐团注册信息-->
+    <select id="getByUserIdAndMusicGroupId" resultMap="StudentRegistration">
+        SELECT * FROM student_registration WHERE music_group_id_ = #{musicGroupId} AND user_id_ = #{userId}
+    </select>
 </mapper>

+ 4 - 1
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupRegisterController.java

@@ -4,6 +4,7 @@ import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.CourseScheduleDao;
 import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
+import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
 import com.ym.mec.biz.dal.entity.MusicGroup;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
@@ -48,6 +49,8 @@ public class MusicGroupRegisterController extends BaseController {
     private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
     @Autowired
     private CourseScheduleDao courseScheduleDao;
+    @Autowired
+    private StudentRegistrationDao studentRegistrationDao;
 
 
     @ApiOperation(value = "新增学生报名信息")
@@ -73,7 +76,7 @@ public class MusicGroupRegisterController extends BaseController {
             return succeed(studentRegistrationService.updateStudent(studentRegistration));
         }
 
-        StudentRegistration hasReg = studentRegistrationService.getByPhoneAndMusicGroupId(studentRegistration.getMusicGroupId(), studentRegistration.getParentsPhone());
+        StudentRegistration hasReg = studentRegistrationDao.getByUserIdAndMusicGroupId(studentRegistration.getMusicGroupId(),sysUser.getId());
         if (hasReg != null && hasReg.getMusicGroupStatus() != StudentMusicGroupStatusEnum.QUIT) {
             return succeed(hasReg);
         }