|
@@ -2,6 +2,7 @@ package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
|
|
+import com.google.common.collect.Sets;
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
import com.ym.mec.biz.dal.dao.*;
|
|
import com.ym.mec.biz.dal.dao.*;
|
|
@@ -23,7 +24,6 @@ import com.ym.mec.im.ImFeignService;
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
import com.ym.mec.util.date.DateUtil;
|
|
import com.ym.mec.util.date.DateUtil;
|
|
import com.ym.mec.web.WebFeignService;
|
|
import com.ym.mec.web.WebFeignService;
|
|
-import io.swagger.models.auth.In;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -122,6 +122,12 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
@Autowired
|
|
@Autowired
|
|
private SubjectService subjectService;
|
|
private SubjectService subjectService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private MemberRankSettingService memberRankSettingService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private InstrumentService instrumentService;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public PageInfo<StudentManageListDto> findStudentsByOrganId(StudentManageQueryInfo queryInfo) {
|
|
public PageInfo<StudentManageListDto> findStudentsByOrganId(StudentManageQueryInfo queryInfo) {
|
|
PageInfo<StudentManageListDto> pageInfo = new PageInfo<StudentManageListDto>(queryInfo.getPage(), queryInfo.getRows());
|
|
PageInfo<StudentManageListDto> pageInfo = new PageInfo<StudentManageListDto>(queryInfo.getPage(), queryInfo.getRows());
|
|
@@ -162,9 +168,9 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
}else{
|
|
}else{
|
|
dataList.addAll(studentManageDao.findStudentsByOrganId(params));
|
|
dataList.addAll(studentManageDao.findStudentsByOrganId(params));
|
|
}
|
|
}
|
|
- Set<Integer> userIds = dataList.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
|
|
|
|
- List<Integer> organIds = dataList.stream().map(e -> e.getOrganId()).distinct().collect(Collectors.toList());
|
|
|
|
- List<Integer> courseTeacherIds = dataList.stream().map(e -> e.getCourseTeacher()).distinct().collect(Collectors.toList());
|
|
|
|
|
|
+ Set<Integer> userIds = dataList.stream().map(StudentManageListDto::getUserId).collect(Collectors.toSet());
|
|
|
|
+ List<Integer> organIds = dataList.stream().map(StudentManageListDto::getOrganId).distinct().collect(Collectors.toList());
|
|
|
|
+ List<Integer> courseTeacherIds = dataList.stream().map(StudentManageListDto::getCourseTeacher).distinct().collect(Collectors.toList());
|
|
organIds.removeAll(Collections.singleton(null));
|
|
organIds.removeAll(Collections.singleton(null));
|
|
courseTeacherIds.removeAll(Collections.singleton(null));
|
|
courseTeacherIds.removeAll(Collections.singleton(null));
|
|
List<SysUserCashAccount> accounts = sysUserCashAccountDao.findByUserIds(userIds);
|
|
List<SysUserCashAccount> accounts = sysUserCashAccountDao.findByUserIds(userIds);
|
|
@@ -177,7 +183,7 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
if(!CollectionUtils.isEmpty(accounts)){
|
|
if(!CollectionUtils.isEmpty(accounts)){
|
|
accountMap = accounts.stream().collect(Collectors.groupingBy(SysUserCashAccount::getUserId, Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0))));
|
|
accountMap = accounts.stream().collect(Collectors.groupingBy(SysUserCashAccount::getUserId, Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0))));
|
|
}
|
|
}
|
|
- List<String> subjectIds = dataList.stream().map(e -> e.getSubjectIdList()).distinct().collect(Collectors.toList());
|
|
|
|
|
|
+ List<String> subjectIds = dataList.stream().map(StudentManageListDto::getSubjectIdList).distinct().collect(Collectors.toList());
|
|
subjectIds.removeAll(Collections.singleton(null));
|
|
subjectIds.removeAll(Collections.singleton(null));
|
|
Map<String, String> subjectMap = new HashMap<>();
|
|
Map<String, String> subjectMap = new HashMap<>();
|
|
Map<Integer, String> courseTeacherNameMap = new HashMap<>();
|
|
Map<Integer, String> courseTeacherNameMap = new HashMap<>();
|
|
@@ -187,7 +193,7 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
if(!CollectionUtils.isEmpty(courseTeacherIds)){
|
|
if(!CollectionUtils.isEmpty(courseTeacherIds)){
|
|
courseTeacherNameMap = sysConfigService.getMap("sys_user", "id_", "real_name_", courseTeacherIds, queryInfo.getTenantId(), Integer.class, String.class);
|
|
courseTeacherNameMap = sysConfigService.getMap("sys_user", "id_", "real_name_", courseTeacherIds, queryInfo.getTenantId(), Integer.class, String.class);
|
|
}
|
|
}
|
|
- List<Integer> cooIds = dataList.stream().map(e -> e.getCooperationOrganId()).distinct().collect(Collectors.toList());
|
|
|
|
|
|
+ List<Integer> cooIds = dataList.stream().map(StudentManageListDto::getCooperationOrganId).distinct().collect(Collectors.toList());
|
|
cooIds.removeAll(Collections.singleton(null));
|
|
cooIds.removeAll(Collections.singleton(null));
|
|
Map<Integer, String> cooMap = new HashMap<>();
|
|
Map<Integer, String> cooMap = new HashMap<>();
|
|
if(!CollectionUtils.isEmpty(cooIds)) {
|
|
if(!CollectionUtils.isEmpty(cooIds)) {
|
|
@@ -199,7 +205,15 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
if(!CollectionUtils.isEmpty(mappers)){
|
|
if(!CollectionUtils.isEmpty(mappers)){
|
|
mappersMap = mappers.stream().collect(Collectors.groupingBy(StudentTeacherMapperDto::getStudentId));
|
|
mappersMap = mappers.stream().collect(Collectors.groupingBy(StudentTeacherMapperDto::getStudentId));
|
|
}
|
|
}
|
|
|
|
+ //获取生效中的会员详情列表
|
|
|
|
+ List<CloudTeacherOrderWrapper.StudentMemberDetail> studentMemberDetails = cloudTeacherOrderService.getEffectiveCloudTeacherOrder(new ArrayList<>(userIds));
|
|
for (StudentManageListDto dto : dataList) {
|
|
for (StudentManageListDto dto : dataList) {
|
|
|
|
+ //汇总学员会员信息
|
|
|
|
+ if (!CollectionUtils.isEmpty(studentMemberDetails)) {
|
|
|
|
+ List<CloudTeacherOrderWrapper.StudentMemberDetail> studentMemberDetailList =
|
|
|
|
+ studentMemberDetails.stream().filter(s -> s.getStudentId().equals(dto.getUserId())).collect(Collectors.toList());
|
|
|
|
+ dto.setCloudTeacherOrderList(studentMemberDetailList);
|
|
|
|
+ }
|
|
if(!CollectionUtils.isEmpty(organMap)){
|
|
if(!CollectionUtils.isEmpty(organMap)){
|
|
Organization organization = organMap.get(dto.getOrganId());
|
|
Organization organization = organMap.get(dto.getOrganId());
|
|
if(Objects.nonNull(organization)){
|
|
if(Objects.nonNull(organization)){
|
|
@@ -1251,4 +1265,159 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
resultMap.setStatistics(statistics);
|
|
resultMap.setStatistics(statistics);
|
|
return resultMap;
|
|
return resultMap;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取学员信息
|
|
|
|
+ * @param userId 学员id
|
|
|
|
+ * @param user 用户信息
|
|
|
|
+ * @param datas 附加数据
|
|
|
|
+ * @return 学员信息
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public Student getStudentUserInfo(Integer userId, SysUser user, Map<String, Object> datas) {
|
|
|
|
+
|
|
|
|
+ // 获取学员信息
|
|
|
|
+ if (Objects.isNull(user)) {
|
|
|
|
+ user = teacherDao.getUser(userId);
|
|
|
|
+
|
|
|
|
+ if (Objects.isNull(user)) {
|
|
|
|
+ throw new BizException("学员信息不存在");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 基本信息填充
|
|
|
|
+ Student student = studentService.get(user.getId());
|
|
|
|
+ student.setId(user.getId());
|
|
|
|
+ student.setUsername(user.getUsername());
|
|
|
|
+ student.setAvatar(user.getAvatar());
|
|
|
|
+ student.setPhone(user.getPhone());
|
|
|
|
+ student.setCurrentClass(user.getCurrentClass());
|
|
|
|
+ student.setCurrentGrade(user.getCurrentGrade());
|
|
|
|
+ student.setBirthdate(user.getBirthdate());
|
|
|
|
+ student.setGender(user.getGender());
|
|
|
|
+ student.setRealName(user.getRealName());
|
|
|
|
+ student.setIdCardNo(user.getIdCardNo());
|
|
|
|
+ student.setImToken(user.getImToken());
|
|
|
|
+ student.setOrganId(user.getOrganId());
|
|
|
|
+
|
|
|
|
+ // 学员其他基础信息
|
|
|
|
+ SysConfig sysConfig = sysConfigService.findByParamName(SysConfigService.HOMEWORK_OPEN_FLAG);
|
|
|
|
+ if (sysConfig == null) {
|
|
|
|
+ datas.put("homeworkOpenFlag", 0);
|
|
|
|
+ } else {
|
|
|
|
+ datas.put("homeworkOpenFlag", Integer.parseInt(sysConfig.getParanValue()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 获取会员等级图标
|
|
|
|
+ MemberRankSetting memberRankSetting = memberRankSettingService.get(student.getMemberRankSettingId());
|
|
|
|
+ if (memberRankSetting != null) {
|
|
|
|
+ student.setMemberRankImg(memberRankSetting.getIcon());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //是否是试用会员
|
|
|
|
+ if(student.getExperienceMemberRankSettingId() == null){
|
|
|
|
+ datas.put("isExperience", 0);
|
|
|
|
+ }else {
|
|
|
|
+ int i = DateUtil.daysBetween(student.getExperienceMembershipEndTime(),student.getMembershipEndTime());
|
|
|
|
+ if(i > 0){
|
|
|
|
+ datas.put("isExperience", 0);
|
|
|
|
+ }else {
|
|
|
|
+ datas.put("isExperience", 1);
|
|
|
|
+ if (memberRankSetting != null) {
|
|
|
|
+ student.setMemberRankImg(memberRankSetting.getExperienceIcon());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 学员会员信息
|
|
|
|
+ datas.put("vipInfo", cloudTeacherOrderService.getEffectiveCloudTeacherOrder(Lists.newArrayList(student.getUserId())));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 通过学生声部换乐器ID
|
|
|
|
+ if (StringUtils.isNotBlank(student.getSubjectIdList())) {
|
|
|
|
+ String subjectId = student.getSubjectIdList();
|
|
|
|
+ if ("5".equals(student.getSubjectIdList())) {
|
|
|
|
+ subjectId = "6";
|
|
|
|
+ } else if("122".equals(student.getSubjectIdList())){
|
|
|
|
+ subjectId = "122,121,113,23";
|
|
|
|
+ }
|
|
|
|
+ List<Integer> instrumentIdsBySubjectId = instrumentService.getInstrumentIdsBySubjectId(subjectId)
|
|
|
|
+ .stream().map(Instrument::getId).collect(Collectors.toList());
|
|
|
|
+ if (!CollectionUtils.isEmpty(instrumentIdsBySubjectId)) {
|
|
|
|
+ // 逗号隔开
|
|
|
|
+ datas.put("instrumentId", StringUtils.join(instrumentIdsBySubjectId, ","));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 扩展乐器
|
|
|
|
+ if (student.getExtSjectNamesMap() !=null && !student.getExtSjectNamesMap().isEmpty()) {
|
|
|
|
+ Set<Integer> integers = student.getExtSjectNamesMap().keySet();
|
|
|
|
+ Set<Integer> extInstrumentIds = Sets.newConcurrentHashSet();
|
|
|
|
+ for (Integer integer : integers) {
|
|
|
|
+ extInstrumentIds.add(integer);
|
|
|
|
+
|
|
|
|
+ if ("5".equals(integer.toString())) {
|
|
|
|
+ extInstrumentIds.add(6);
|
|
|
|
+ } else if("122".equals(integer.toString())){
|
|
|
|
+ extInstrumentIds.add(121);
|
|
|
|
+ extInstrumentIds.add(113);
|
|
|
|
+ extInstrumentIds.add(23);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 根据声部查询对应乐器信息
|
|
|
|
+ List<Instrument> instruments = instrumentService.getInstrumentIdsBySubjectId(StringUtils.join(extInstrumentIds, ","));
|
|
|
|
+ List<Map<String, Object>> extInstrumentNames = Lists.newArrayList();
|
|
|
|
+ if (!CollectionUtils.isEmpty(instruments)) {
|
|
|
|
+
|
|
|
|
+ Map<Integer, List<Instrument>> collect = instruments.stream().collect(Collectors.groupingBy(Instrument::getSubjectId, Collectors.toList()));
|
|
|
|
+ for (Map.Entry<Integer, String> entry : student.getExtSjectNamesMap().entrySet()) {
|
|
|
|
+
|
|
|
|
+ // 默认声部映射乐器ID
|
|
|
|
+ String instrumentIds = "";
|
|
|
|
+ if (collect.containsKey(entry.getKey())) {
|
|
|
|
+ instrumentIds = collect.get(entry.getKey()).stream()
|
|
|
|
+ .map(Instrument::getId).map(String::valueOf).collect(Collectors.joining(","));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 萨克斯乐器,对应中音萨克斯
|
|
|
|
+ if (entry.getKey() == 5 || entry.getKey() == 6) {
|
|
|
|
+
|
|
|
|
+ instrumentIds = collect.entrySet().stream()
|
|
|
|
+ .filter(x -> x.getKey() == 5 || x.getKey() == 6)
|
|
|
|
+ .flatMap(x -> x.getValue().stream())
|
|
|
|
+ .map(Instrument::getId)
|
|
|
|
+ .map(String::valueOf).collect(Collectors.joining(","));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 打击乐器,对应小军鼓,打击乐(键盘),打击乐(键盘+小鼓),打击乐
|
|
|
|
+ if (entry.getKey() == 122 || entry.getKey() == 121 || entry.getKey() == 113 || entry.getKey() == 23) {
|
|
|
|
+
|
|
|
|
+ instrumentIds = collect.entrySet().stream()
|
|
|
|
+ .filter(x -> x.getKey() == 122 || x.getKey() == 121 || x.getKey() == 113 || x.getKey() == 23)
|
|
|
|
+ .flatMap(x -> x.getValue().stream())
|
|
|
|
+ .map(Instrument::getId)
|
|
|
|
+ .map(String::valueOf).collect(Collectors.joining(","));
|
|
|
|
+ }
|
|
|
|
+ String finalInstrumentIds = instrumentIds;
|
|
|
|
+ extInstrumentNames.add(new HashMap<String, Object>(){{
|
|
|
|
+ put("subjectId", entry.getKey());
|
|
|
|
+ put("subjectName", entry.getValue());
|
|
|
|
+ put("instrumentIds", finalInstrumentIds);
|
|
|
|
+ }});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /*List<Integer> instrumentIdsBySubjectId = instruments.stream().map(Instrument::getId).collect(Collectors.toList());
|
|
|
|
+ Map<Integer, InstrumentWrapper.Instrument> mapByIds = instrumentService.getMapByIds(instrumentIdsBySubjectId);
|
|
|
|
+ mapByIds.forEach((k,v)->{
|
|
|
|
+ if (v !=null) {
|
|
|
|
+ extInstrumentNamesMap.put(k, v.getName());
|
|
|
|
+ }
|
|
|
|
+ });*/
|
|
|
|
+ }
|
|
|
|
+ student.setExtInstrumentNames(extInstrumentNames);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return student;
|
|
|
|
+ }
|
|
}
|
|
}
|