|
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.google.common.collect.ImmutableList;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.microsvc.toolkit.common.webportal.exception.BizException;
|
|
|
+import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
|
import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
|
import com.yonge.cooleshow.biz.dal.dao.EmployeeDao;
|
|
|
import com.yonge.cooleshow.biz.dal.dao.StudentDao;
|
|
@@ -119,6 +120,9 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
|
|
|
@Autowired
|
|
|
private ImGroupMemberService imGroupMemberService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SysUserFeignService sysUserFeignService;
|
|
|
+
|
|
|
@Override
|
|
|
public StudentDao getDao() {
|
|
|
return baseMapper;
|
|
@@ -596,7 +600,6 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
|
|
|
}
|
|
|
|
|
|
student.setId(sysUser.getId());
|
|
|
- Long tenantId = student.getTenantId();
|
|
|
this.save(student);
|
|
|
|
|
|
try {
|
|
@@ -605,17 +608,6 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
|
|
|
} catch (Exception e) {
|
|
|
log.error("学生注册IM失败:" + e.getMessage(), e);
|
|
|
}
|
|
|
- // 加好友
|
|
|
- if (tenantId != -1) {
|
|
|
- // 自动与机构老师成为好友
|
|
|
- List<Teacher> teacherList = teacherDao.selectList(Wrappers.<Teacher>lambdaQuery()
|
|
|
- .eq(Teacher::getTenantId, tenantId));
|
|
|
- if (!teacherList.isEmpty()) {
|
|
|
- teacherList.forEach(next -> imUserFriendService.saveUserFriend(next.getUserId(),
|
|
|
- new HashSet<>(ImmutableList.of(student.getId()))));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private Boolean updateStudent(StudentWrapper.Student studentInfo) {
|
|
@@ -623,17 +615,6 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
|
|
|
if (student == null) {
|
|
|
throw new BizException("学生信息不存在");
|
|
|
}
|
|
|
- String avatar = studentInfo.getAvatar();
|
|
|
- if (StringUtils.isEmpty(avatar)) {
|
|
|
- avatar = sysConfigService.findConfigValue(SysConfigConstant.STUDENT_AVATAR);
|
|
|
- studentInfo.setAvatar(avatar);
|
|
|
- }
|
|
|
- // 解绑
|
|
|
-// if (Boolean.FALSE.equals(studentInfo.getBindTenant())) {
|
|
|
-// studentInfo.setTenantId(-1L);
|
|
|
-// // 退群,删除好友
|
|
|
-// imUserFriendService.delFriendByTenantId(student.getTenantId(), student.getUserId());
|
|
|
-// }
|
|
|
// 手机号码修改
|
|
|
if (!student.getPhone().equals(studentInfo.getPhone())) {
|
|
|
com.yonge.cooleshow.biz.dal.entity.SysUser sysUser = getOrCreateAccount(studentInfo);
|
|
@@ -641,7 +622,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
|
|
|
.set(Student::getTenantId, studentInfo.getTenantId())
|
|
|
.set(Student::getUserId, sysUser.getId())
|
|
|
.set(Student::getUpdateTime, new Date())
|
|
|
- .set(Student::getAvatar,studentInfo.getAvatar())
|
|
|
+ .set(Student::getAvatar,sysUser.getAvatar())
|
|
|
.eq(Student::getUserId, studentInfo.getId())
|
|
|
.update();
|
|
|
} else {
|
|
@@ -690,6 +671,18 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
|
|
|
} catch (Exception e) {
|
|
|
log.warn("学生注册IM失败:"+e.getMessage());
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ // 加好友
|
|
|
+ if (student.getTenantId() != null && student.getTenantId() != -1L) {
|
|
|
+ // 自动与机构老师成为好友
|
|
|
+ QueryWrapper<Teacher> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().eq(Teacher::getTenantId, student.getTenantId());
|
|
|
+ List<Teacher> teacherList = teacherDao.selectList(queryWrapper);
|
|
|
+ teacherList.forEach(next -> imUserFriendService.saveUserFriend(next.getUserId(),
|
|
|
+ new HashSet<>(ImmutableList.of(sysUser.getId()))));
|
|
|
+ }
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -704,6 +697,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
|
|
|
this.getBaseMapper().selectById(sysUser.getId()) != null) {
|
|
|
throw new BizException("手机号已经注册学生账号");
|
|
|
}
|
|
|
+ sysUser.setAvatar(studentInfo.getAvatar());
|
|
|
sysUser.setGender(studentInfo.getGender());
|
|
|
sysUser.setUsername(studentInfo.getName());
|
|
|
sysUser.setBirthdate(studentInfo.getBirthdate());
|