|
@@ -2,14 +2,18 @@ package com.yonge.cooleshow.tenant.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.google.common.collect.ImmutableList;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
|
import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
|
import com.yonge.cooleshow.biz.dal.dto.search.StudentSearch;
|
|
|
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.service.ImUserFriendService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.StudentService;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.TeacherService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.TenantActivationCodeService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.TenantInfoService;
|
|
|
import com.yonge.cooleshow.biz.dal.vo.StudentVo;
|
|
@@ -42,8 +46,8 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Optional;
|
|
@@ -65,6 +69,11 @@ public class StudentController extends BaseController {
|
|
|
@Autowired
|
|
|
private TenantActivationCodeService tenantActivationCodeService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TeacherService teacherService;
|
|
|
+ @Autowired
|
|
|
+ private ImUserFriendService imUserFriendService;
|
|
|
+
|
|
|
@GetMapping("/detail/{id}")
|
|
|
@ApiOperation(value = "详情", notes = "传入id")
|
|
|
public HttpResponseResult<StudentVo> detail(@PathVariable("id") Long id) {
|
|
@@ -151,6 +160,16 @@ public class StudentController extends BaseController {
|
|
|
}
|
|
|
|
|
|
studentService.save(studentInfo);
|
|
|
+
|
|
|
+ // 加好友
|
|
|
+ if (studentInfo.getId() == null) {
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserByMobile(student.getPhone());
|
|
|
+ // 自动与机构老师成为好友
|
|
|
+ List<Teacher> teacherList = teacherService.lambdaQuery()
|
|
|
+ .eq(Teacher::getTenantId, studentInfo.getTenantId()).list();
|
|
|
+ teacherList.forEach(next -> imUserFriendService.saveUserFriend(next.getUserId(),
|
|
|
+ new HashSet<>(ImmutableList.of(sysUser.getId()))));
|
|
|
+ }
|
|
|
return succeed();
|
|
|
}
|
|
|
|