|
@@ -518,16 +518,23 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Override
|
|
@Override
|
|
public void addStudent(StudentWrapper.Student student) {
|
|
public void addStudent(StudentWrapper.Student student) {
|
|
|
|
+ // 更新头像
|
|
|
|
+ if (StringUtils.isEmpty(student.getAvatar())) {
|
|
|
|
+ String avatar;
|
|
|
|
+ if (student.getGender().equals(1)) {
|
|
|
|
+ avatar = sysConfigService.findConfigValue(SysConfigConstant.DEFAULT_HEARD_BOY);
|
|
|
|
+ } else {
|
|
|
|
+ avatar = sysConfigService.findConfigValue(SysConfigConstant.DEFAULT_HEARD_GIRL);
|
|
|
|
+ }
|
|
|
|
+ student.setAvatar(avatar);
|
|
|
|
+ }
|
|
SysUser sysUser = employeeDao.querySysUserByPhone(student.getPhone());
|
|
SysUser sysUser = employeeDao.querySysUserByPhone(student.getPhone());
|
|
if (sysUser == null) {
|
|
if (sysUser == null) {
|
|
sysUser = new SysUser();
|
|
sysUser = new SysUser();
|
|
sysUser.setUserType(ClientEnum.STUDENT.getCode());
|
|
sysUser.setUserType(ClientEnum.STUDENT.getCode());
|
|
sysUser.setGender(student.getGender());
|
|
sysUser.setGender(student.getGender());
|
|
//设置默认头像
|
|
//设置默认头像
|
|
- if (StringUtil.isEmpty(sysUser.getAvatar())) {
|
|
|
|
- String defaultHeard = sysConfigService.findConfigValue(SysConfigConstant.DEFAULT_HEARD);
|
|
|
|
- sysUser.setAvatar(defaultHeard);
|
|
|
|
- }
|
|
|
|
|
|
+ sysUser.setAvatar(student.getAvatar());
|
|
|
|
|
|
sysUser.setUsername(student.getName());
|
|
sysUser.setUsername(student.getName());
|
|
sysUser.setPhone(student.getPhone());
|
|
sysUser.setPhone(student.getPhone());
|
|
@@ -548,20 +555,6 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
|
|
|
|
|
|
student.setId(sysUser.getId());
|
|
student.setId(sysUser.getId());
|
|
Long tenantId = student.getTenantId();
|
|
Long tenantId = student.getTenantId();
|
|
- // 更新头像
|
|
|
|
- if (StringUtils.isEmpty(student.getAvatar())) {
|
|
|
|
- String avatar;
|
|
|
|
- if (tenantId != -1L) {
|
|
|
|
- if (student.getGender().equals(1)) {
|
|
|
|
- avatar = sysConfigService.findConfigValue(SysConfigConstant.TENANT_STUDENT_BOY_AVATAR);
|
|
|
|
- } else {
|
|
|
|
- avatar = sysConfigService.findConfigValue(SysConfigConstant.TENANT_STUDENT_GIRL_AVATAR);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- avatar = sysConfigService.findConfigValue(SysConfigConstant.DEFAULT_HEARD);
|
|
|
|
- }
|
|
|
|
- student.setAvatar(avatar);
|
|
|
|
- }
|
|
|
|
this.save(student);
|
|
this.save(student);
|
|
|
|
|
|
// 加好友
|
|
// 加好友
|
|
@@ -582,10 +575,14 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
|
|
if (student == null) {
|
|
if (student == null) {
|
|
throw new BizException("学生信息不存在");
|
|
throw new BizException("学生信息不存在");
|
|
}
|
|
}
|
|
- String avatar = student.getAvatar();
|
|
|
|
|
|
+ String avatar = studentInfo.getAvatar();
|
|
if (StringUtils.isEmpty(avatar)) {
|
|
if (StringUtils.isEmpty(avatar)) {
|
|
- avatar = sysConfigService.findConfigValue(SysConfigConstant.TENANT_STUDENT_AVATAR);
|
|
|
|
- student.setAvatar(avatar);
|
|
|
|
|
|
+ if (studentInfo.getGender().equals(1)) {
|
|
|
|
+ avatar = sysConfigService.findConfigValue(SysConfigConstant.DEFAULT_HEARD_BOY);
|
|
|
|
+ } else {
|
|
|
|
+ avatar = sysConfigService.findConfigValue(SysConfigConstant.DEFAULT_HEARD_GIRL);
|
|
|
|
+ }
|
|
|
|
+ studentInfo.setAvatar(avatar);
|
|
}
|
|
}
|
|
// 解绑
|
|
// 解绑
|
|
// if (Boolean.FALSE.equals(studentInfo.getBindTenant())) {
|
|
// if (Boolean.FALSE.equals(studentInfo.getBindTenant())) {
|
|
@@ -614,23 +611,29 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
|
|
}
|
|
}
|
|
com.yonge.cooleshow.biz.dal.entity.SysUser sysUser = sysUserMapper.selectById(studentInfo.getId());
|
|
com.yonge.cooleshow.biz.dal.entity.SysUser sysUser = sysUserMapper.selectById(studentInfo.getId());
|
|
sysUser.setGender(studentInfo.getGender());
|
|
sysUser.setGender(studentInfo.getGender());
|
|
|
|
+ sysUser.setAvatar(student.getAvatar());
|
|
sysUserMapper.updateById(sysUser);
|
|
sysUserMapper.updateById(sysUser);
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
private Boolean createStudent(StudentWrapper.Student studentInfo) {
|
|
private Boolean createStudent(StudentWrapper.Student studentInfo) {
|
|
|
|
+ String avatar = studentInfo.getAvatar();
|
|
|
|
+ if (StringUtils.isEmpty(avatar)) {
|
|
|
|
+ if (studentInfo.getGender().equals(1)) {
|
|
|
|
+ avatar = sysConfigService.findConfigValue(SysConfigConstant.DEFAULT_HEARD_BOY);
|
|
|
|
+ } else {
|
|
|
|
+ avatar = sysConfigService.findConfigValue(SysConfigConstant.DEFAULT_HEARD_GIRL);
|
|
|
|
+ }
|
|
|
|
+ studentInfo.setAvatar(avatar);
|
|
|
|
+ }
|
|
com.yonge.cooleshow.biz.dal.entity.SysUser sysUser = getOrCreateAccount(studentInfo);
|
|
com.yonge.cooleshow.biz.dal.entity.SysUser sysUser = getOrCreateAccount(studentInfo);
|
|
Student student = new Student();
|
|
Student student = new Student();
|
|
student.setUserId(sysUser.getId());
|
|
student.setUserId(sysUser.getId());
|
|
student.setTenantId(studentInfo.getTenantId());
|
|
student.setTenantId(studentInfo.getTenantId());
|
|
student.setSubjectId(studentInfo.getSubjectId());
|
|
student.setSubjectId(studentInfo.getSubjectId());
|
|
|
|
+ student.setAvatar(studentInfo.getAvatar());
|
|
student.setCreateTime(new Date());
|
|
student.setCreateTime(new Date());
|
|
student.setLockFlag(UserLockFlag.NORMAL);
|
|
student.setLockFlag(UserLockFlag.NORMAL);
|
|
- String avatar = studentInfo.getAvatar();
|
|
|
|
- if (StringUtils.isEmpty(avatar)) {
|
|
|
|
- avatar = sysConfigService.findConfigValue(SysConfigConstant.TENANT_STUDENT_AVATAR);
|
|
|
|
- student.setAvatar(avatar);
|
|
|
|
- }
|
|
|
|
|
|
|
|
save(student);
|
|
save(student);
|
|
return true;
|
|
return true;
|
|
@@ -663,7 +666,14 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
|
|
com.yonge.cooleshow.biz.dal.entity.SysUser.class);
|
|
com.yonge.cooleshow.biz.dal.entity.SysUser.class);
|
|
sysUser.setPhone(studentInfo.getPhone());
|
|
sysUser.setPhone(studentInfo.getPhone());
|
|
if (StringUtils.isEmpty(studentInfo.getAvatar())) {
|
|
if (StringUtils.isEmpty(studentInfo.getAvatar())) {
|
|
- sysUser.setAvatar(sysConfigService.findConfigValue(SysConfigConstant.DEFAULT_HEARD));
|
|
|
|
|
|
+ //设置默认头像
|
|
|
|
+ String avatar;
|
|
|
|
+ if (studentInfo.getGender().equals(1)) {
|
|
|
|
+ avatar = sysConfigService.findConfigValue(SysConfigConstant.DEFAULT_HEARD_BOY);
|
|
|
|
+ } else {
|
|
|
|
+ avatar = sysConfigService.findConfigValue(SysConfigConstant.DEFAULT_HEARD_GIRL);
|
|
|
|
+ }
|
|
|
|
+ sysUser.setAvatar(avatar);
|
|
} else {
|
|
} else {
|
|
sysUser.setAvatar(studentInfo.getAvatar());
|
|
sysUser.setAvatar(studentInfo.getAvatar());
|
|
}
|
|
}
|