|
@@ -931,8 +931,27 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
|
|
|
if (!sysUsers.isEmpty()) {
|
|
|
throw new BizException("手机号已经注册账号");
|
|
|
} else {
|
|
|
- oldSysUser.setPhone(studentInfo.getPhone());
|
|
|
- com.yonge.cooleshow.biz.dal.entity.SysUser sysUser = JSON.parseObject(JSON.toJSONString(oldSysUser), com.yonge.cooleshow.biz.dal.entity.SysUser.class);
|
|
|
+ com.yonge.cooleshow.biz.dal.entity.SysUser sysUser = JSON.parseObject(JSON.toJSONString(studentInfo),
|
|
|
+ com.yonge.cooleshow.biz.dal.entity.SysUser.class);
|
|
|
+ sysUser.setId(oldSysUser.getId());
|
|
|
+ sysUser.setPhone(studentInfo.getPhone());
|
|
|
+ sysUser.setAvatar(studentInfo.getAvatar());
|
|
|
+ if (StringUtils.isEmpty(studentInfo.getAvatar())) {
|
|
|
+ //设置默认头像
|
|
|
+ String avatar = sysConfigService.findConfigValue(SysConfigConstant.STUDENT_AVATAR);
|
|
|
+ sysUser.setAvatar(avatar);
|
|
|
+ }
|
|
|
+ sysUser.setGender(studentInfo.getGender());
|
|
|
+ sysUser.setUserType("STUDENT");
|
|
|
+ sysUser.setBirthdate(studentInfo.getBirthdate());
|
|
|
+ sysUser.setUsername(studentInfo.getName());
|
|
|
+ String password = oldSysUser.getPassword();
|
|
|
+ sysUser.setPassword(password);
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(password)) {
|
|
|
+ String newPassword = MessageFormat.format("klx{0}", studentInfo.getPhone().substring(7));
|
|
|
+ sysUser.setPassword(new BCryptPasswordEncoder().encode(newPassword));
|
|
|
+ }
|
|
|
sysUserMapper.updateById(sysUser);
|
|
|
return sysUser;
|
|
|
}
|