|
@@ -2,6 +2,7 @@ package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -65,6 +66,7 @@ import com.ym.mec.biz.dal.page.StudentSignQueryInfo;
|
|
|
import com.ym.mec.biz.dal.page.TeacherPaymentRecordInfo;
|
|
|
import com.ym.mec.biz.service.StudentManageService;
|
|
|
import com.ym.mec.biz.service.StudentService;
|
|
|
+import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
import com.ym.mec.common.entity.ImResult;
|
|
|
import com.ym.mec.common.entity.ImUserModel;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
@@ -134,6 +136,10 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
|
}
|
|
|
pageInfo.setRows(dataList);
|
|
|
|
|
|
+ if(dataList.size() == 0){
|
|
|
+ return pageInfo;
|
|
|
+ }
|
|
|
+
|
|
|
Set<Integer> userIds = dataList.stream().map(StudentManageListDto::getUserId).collect(Collectors.toSet());
|
|
|
|
|
|
List<StudentListCourseDto> studentListCourseDtoList = studentManageDao.queryStudentRemianCourse(userIds);
|
|
@@ -455,35 +461,39 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public int studentRegister(SysUser sysUser) {
|
|
|
- if (sysUser == null || StringUtils.isEmpty(sysUser.getPhone())) {
|
|
|
- throw new BizException("参数校验失败");
|
|
|
- }
|
|
|
- SysUser sysUser1 = sysUserFeignService.queryUserByMobile(sysUser.getPhone());
|
|
|
- if (sysUser1 != null) {
|
|
|
- if (sysUser1.getUserType().contains("STUDENT")) {
|
|
|
- throw new BizException("手机号已被占用");
|
|
|
- } else {
|
|
|
- sysUser.setId(sysUser1.getId());
|
|
|
- sysUser.setUserType(sysUser1.getUserType() + ",STUDENT");
|
|
|
- teacherDao.updateUser(sysUser);
|
|
|
- return sysUser1.getId();
|
|
|
- }
|
|
|
- }
|
|
|
- sysUser.setUserType("STUDENT");
|
|
|
- teacherDao.addSysUser(sysUser);
|
|
|
- Integer userId = sysUser.getId();
|
|
|
- ImResult register = imFeignService.register(new ImUserModel(userId.toString(), sysUser.getPhone(), null));
|
|
|
- sysUser.setImToken(register.getToken());
|
|
|
- teacherDao.updateUser(sysUser);
|
|
|
- sysUserCashAccountDao.insert(new SysUserCashAccount(userId, "CNY"));
|
|
|
- Student student = new Student(userId, studentRegistrationDao.getSubjectIds(userId));
|
|
|
- student.setOperatingTag(sysUser.getOperatingTag());
|
|
|
- student.setServiceTag(sysUser.getServiceTag());
|
|
|
- student.setTeacherId(sysUser.getTeacherId());
|
|
|
- studentService.upSet(student);
|
|
|
- return userId;
|
|
|
- }
|
|
|
+ public int studentRegister(Student student) {
|
|
|
+ if (student == null || StringUtils.isEmpty(student.getPhone())) {
|
|
|
+ throw new BizException("参数校验失败");
|
|
|
+ }
|
|
|
+ Date date = new Date();
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserByMobile(student.getPhone());
|
|
|
+ if (sysUser != null) {
|
|
|
+ if (sysUser.getUserType().contains("STUDENT")) {
|
|
|
+ throw new BizException("手机号已被占用");
|
|
|
+ } else {
|
|
|
+ student.setId(sysUser.getId());
|
|
|
+ student.setUserType(sysUser.getUserType() + ",STUDENT");
|
|
|
+ student.setUpdateTime(date);
|
|
|
+ sysUserFeignService.updateSysUser(student);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ student.setUpdateTime(date);
|
|
|
+ student.setCreateTime(date);
|
|
|
+ student.setUserType("STUDENT");
|
|
|
+ HttpResponseResult<Integer> result = sysUserFeignService.addUser(student);
|
|
|
+ student.setId(result.getData());
|
|
|
+
|
|
|
+ ImResult register = imFeignService.register(new ImUserModel(student.getId().toString(), student.getPhone(), null));
|
|
|
+ student.setImToken(register.getToken());
|
|
|
+ sysUserFeignService.updateSysUser(student);
|
|
|
+
|
|
|
+ sysUserCashAccountDao.insert(new SysUserCashAccount(student.getId(), "CNY"));
|
|
|
+ }
|
|
|
+ student.setUserId(student.getId());
|
|
|
+
|
|
|
+ studentService.upSet(student);
|
|
|
+ return student.getId();
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|