|
@@ -7,6 +7,7 @@ import java.util.Arrays;
|
|
import java.util.HashSet;
|
|
import java.util.HashSet;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Set;
|
|
import java.util.Set;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -30,6 +31,7 @@ import com.qmth.boot.tools.excel.ExcelReader;
|
|
import com.qmth.boot.tools.excel.enums.ExcelType;
|
|
import com.qmth.boot.tools.excel.enums.ExcelType;
|
|
import com.qmth.boot.tools.excel.model.DataMap;
|
|
import com.qmth.boot.tools.excel.model.DataMap;
|
|
|
|
|
|
|
|
+import cn.com.qmth.mps.bean.CourseInfo;
|
|
import cn.com.qmth.mps.bean.User;
|
|
import cn.com.qmth.mps.bean.User;
|
|
import cn.com.qmth.mps.dao.UserDao;
|
|
import cn.com.qmth.mps.dao.UserDao;
|
|
import cn.com.qmth.mps.entity.UserEntity;
|
|
import cn.com.qmth.mps.entity.UserEntity;
|
|
@@ -256,7 +258,8 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
|
vo.setSchoolId(ue.getSchoolId());
|
|
vo.setSchoolId(ue.getSchoolId());
|
|
vo.setSchoolName(schoolService.getById(ue.getSchoolId()).getName());
|
|
vo.setSchoolName(schoolService.getById(ue.getSchoolId()).getName());
|
|
if (vo.getRoleId().equals(Role.SECTION_LEADER.getId())) {
|
|
if (vo.getRoleId().equals(Role.SECTION_LEADER.getId())) {
|
|
- vo.setCourseCodes(userCourseRelationService.getCourseCodes(vo.getId()));
|
|
|
|
|
|
+ List<CourseInfo> cs=userCourseRelationService.getCourses(vo.getId());
|
|
|
|
+ vo.setCourseCodes(cs.stream().map(m->m.getCode()).collect(Collectors.toList()));
|
|
}
|
|
}
|
|
return vo;
|
|
return vo;
|
|
}
|
|
}
|
|
@@ -309,4 +312,29 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
|
lw.eq(UserEntity::getId, userId);
|
|
lw.eq(UserEntity::getId, userId);
|
|
this.update(wrapper);
|
|
this.update(wrapper);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public UserVo myInfo(User user) {
|
|
|
|
+ UserEntity ue = this.getById(user.getId());
|
|
|
|
+ if (ue == null) {
|
|
|
|
+ throw new StatusException("未找到用户信息");
|
|
|
|
+ }
|
|
|
|
+ UserVo vo = new UserVo();
|
|
|
|
+ vo.setEnable(ue.getEnable());
|
|
|
|
+ vo.setId(ue.getId());
|
|
|
|
+ vo.setRoleId(ue.getRoleId());
|
|
|
|
+ vo.setLoginName(ue.getLoginName());
|
|
|
|
+ vo.setName(ue.getName());
|
|
|
|
+ vo.setSchoolId(ue.getSchoolId());
|
|
|
|
+ vo.setSchoolName(schoolService.getById(ue.getSchoolId()).getName());
|
|
|
|
+ if (vo.getRoleId().equals(Role.SECTION_LEADER.getId())) {
|
|
|
|
+ List<CourseInfo> cs=userCourseRelationService.getCourses(vo.getId());
|
|
|
|
+ if(CollectionUtils.isNotEmpty(cs)) {
|
|
|
|
+ vo.setCourseCodes(cs.stream().map(m->m.getCode()).collect(Collectors.toList()));
|
|
|
|
+ vo.setCourseNames(cs.stream().map(m->m.getCode()+"-"+m.getName()).collect(Collectors.toList()));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return vo;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|