فهرست منبع

1.学生新增修改接口添加好友

yuanliang 1 سال پیش
والد
کامیت
8927fcbb7e

+ 1 - 1
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/StudentController.java

@@ -230,7 +230,7 @@ public class StudentController extends BaseController {
         if (sysUser != null && sysUser.getUserType().contains(ClientEnum.STUDENT.getCode())) {
             throw new BizException("学生账号已经存在");
         }
-        studentService.addStudent(student);
+        studentService.save(student);
         return succeed();
     }
 }

+ 3 - 4
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/StudentServiceImpl.java

@@ -591,7 +591,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,sysUser.getAvatar())
+                    .set(StringUtils.isNotEmpty(studentInfo.getAvatar()), Student::getAvatar, studentInfo.getAvatar())
                     .eq(Student::getUserId, studentInfo.getId())
                     .update();
         } else {
@@ -605,7 +605,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
         }
         com.yonge.cooleshow.biz.dal.entity.SysUser sysUser = sysUserMapper.selectById(studentInfo.getId());
         sysUser.setGender(studentInfo.getGender());
-        sysUser.setAvatar(student.getAvatar());
+        sysUser.setAvatar(studentInfo.getAvatar());
         sysUser.setUsername(studentInfo.getName());
         sysUser.setBirthdate(studentInfo.getBirthdate());
         sysUserMapper.updateById(sysUser);
@@ -650,8 +650,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
         com.yonge.cooleshow.biz.dal.entity.SysUser sysUser;
         if (!sysUsers.isEmpty()) {
             sysUser = sysUsers.get(0);
-            if (!sysUser.getId().equals(studentInfo.getId()) &&
-                    this.getBaseMapper().selectById(sysUser.getId()) != null) {
+            if (sysUser.getUserType().contains(ClientEnum.STUDENT.getCode())) {
                 throw new BizException("手机号已经注册学生账号");
             }
             sysUser.setAvatar(studentInfo.getAvatar());

+ 2 - 1
cooleshow-user/user-tenant/src/main/java/com/yonge/cooleshow/tenant/controller/StudentController.java

@@ -10,6 +10,7 @@ import com.yonge.cooleshow.biz.dal.entity.Student;
 import com.yonge.cooleshow.biz.dal.entity.Teacher;
 import com.yonge.cooleshow.biz.dal.entity.TenantActivationCode;
 import com.yonge.cooleshow.biz.dal.entity.TenantInfo;
+import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.service.ImUserFriendService;
 import com.yonge.cooleshow.biz.dal.service.StudentService;
 import com.yonge.cooleshow.biz.dal.service.TeacherService;
@@ -142,7 +143,7 @@ public class StudentController extends BaseController {
 
         if (studentId == null) {
             SysUser sysUser = sysUserFeignService.queryUserByMobile(student.getPhone());
-            if (sysUser != null) {
+            if (sysUser != null && sysUser.getUserType().contains(ClientEnum.STUDENT.getCode())) {
                 studentId = sysUser.getId();
             }
         }