zouxuan il y a 5 ans
Parent
commit
3a4613d1a3

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

@@ -209,6 +209,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             sysUser.setRealName(studentRegistration.getParentsName());
             sysUser.setUsername(studentRegistration.getName());
             sysUser.setIdCardNo(studentRegistration.getIdCardNo());
+            sysUser.setBirthdate(studentRegistration.getBirthdate());
             teacherDao.addSysUser(sysUser);
             userId = sysUser.getId();
             //添加用户现金账户
@@ -219,18 +220,21 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             }
             ImResult register = imFeignService.register(new ImUserModel(userId.toString(), sysUser.getUsername(), sysUser.getAvatar()));
             sysUser.setImToken(register.getToken());
+        }else{
+            if(!sysUser.getUserType().equals(SysUserType.STUDENT)){
+                throw new BizException("您系统存在非学生的账户,不能注册学生");
+            }
+            sysUser.setUserType(SysUserType.STUDENT);
+            sysUser.setPhone(studentRegistration.getParentsPhone());
+            sysUser.setOrganId(studentRegistration.getOrganId());
+            sysUser.setRealName(studentRegistration.getParentsName());
+            sysUser.setUsername(studentRegistration.getName());
+            sysUser.setGender(studentRegistration.getGender());
+            sysUser.setBirthdate(studentRegistration.getBirthdate());
+            sysUser.setCreateTime(date);
+            sysUser.setUpdateTime(date);
+            teacherDao.updateUser(sysUser);
         }
-        if(!sysUser.getUserType().equals(SysUserType.STUDENT)){
-            throw new BizException("您系统存在非学生的账户,不能注册学生");
-        }
-        sysUser.setUserType(SysUserType.STUDENT);
-        sysUser.setOrganId(studentRegistration.getOrganId());
-        sysUser.setRealName(studentRegistration.getParentsName());
-        sysUser.setUsername(studentRegistration.getName());
-        sysUser.setGender(studentRegistration.getGender());
-        sysUser.setCreateTime(date);
-        sysUser.setUpdateTime(date);
-        teacherDao.updateUser(sysUser);
 
         studentRegistration.setActualSubjectId(studentRegistration.getSubjectId());
         studentRegistration.setCreateTime(date);
@@ -586,6 +590,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             }else {
                 studentRegistrationDao.insertBasic(studentRegistration);
             }
+            studentRegistrationDao.updateCurrentClass(studentRegistration);
             studentPaymentOrderService.insert(studentPaymentOrder);
             studentPaymentOrderDetails.forEach(e -> {
                 e.setPaymentOrderId(studentPaymentOrder.getId());

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

@@ -146,6 +146,9 @@
             <if test="subjectId != null">
                 subject_id_ = #{subjectId},
             </if>
+            <if test="currentGrade != null">
+                current_grade_ = #{currentGrade},
+            </if>
             <if test="currentClass != null">
                 current_class_ = #{currentClass},
             </if>