|
@@ -1039,35 +1039,60 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void pushMessage(String musicGroupId, String classGroupIds) throws IOException {
|
|
|
+ public int pushMessage(String musicGroupId, String classGroupIds) throws IOException {
|
|
|
MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
|
|
|
- if (musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN) {
|
|
|
- List<HighClassGroupDto> highClassGroup = classGroupDao.findHighClassGroup(musicGroupId, classGroupIds);
|
|
|
- Set<ClassGroupTypeEnum> classGroupTypeSet = highClassGroup.stream().map(HighClassGroupDto::getType).collect(Collectors.toSet());
|
|
|
+ if (musicGroup.getOwnershipType() == null || musicGroup.getOwnershipType() != CooperationOrgan.OwnershipType.OWN) {
|
|
|
+ throw new BizException("三方乐团,不推送报名信息");
|
|
|
+ }
|
|
|
+ List<HighClassGroupDto> highClassGroup = classGroupDao.findHighClassGroup(musicGroupId, classGroupIds);
|
|
|
+ if(classGroupIds != null && !classGroupIds.isEmpty()){
|
|
|
+ highClassGroup = highClassGroup.stream().filter(e->e.getTotalClassTimes().equals(0)).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ Set<ClassGroupTypeEnum> classGroupTypeSet = highClassGroup.stream().map(HighClassGroupDto::getType).collect(Collectors.toSet());
|
|
|
+ String HighClassGroupSubjectIds = highClassGroup.stream().filter(e -> e.getType().equals(ClassGroupTypeEnum.HIGH)).map(HighClassGroupDto::getSubjectIdList).collect(Collectors.joining(","));
|
|
|
+ String HighOnlineClassGroupSubjectIds = highClassGroup.stream().filter(e -> e.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE)).map(HighClassGroupDto::getMemo).collect(Collectors.joining(","));
|
|
|
+ if (!HighClassGroupSubjectIds.isEmpty() && !HighOnlineClassGroupSubjectIds.isEmpty()) {
|
|
|
+ HighClassGroupSubjectIds += "," + HighOnlineClassGroupSubjectIds;
|
|
|
+ } else {
|
|
|
+ HighClassGroupSubjectIds += HighOnlineClassGroupSubjectIds;
|
|
|
+ }
|
|
|
|
|
|
- List<StudentRegistration> students = new ArrayList<>();
|
|
|
- if (classGroupTypeSet.contains(ClassGroupTypeEnum.HIGH)) {
|
|
|
- List<StudentRegistration> noHighClassGroupStudents = studentRegistrationService.findMusicGroupStuNoClassType(musicGroupId, ClassGroupTypeEnum.HIGH, null);
|
|
|
- students.addAll(noHighClassGroupStudents);
|
|
|
- }
|
|
|
- if (classGroupTypeSet.contains(ClassGroupTypeEnum.HIGH_ONLINE)) {
|
|
|
- List<StudentRegistration> noHighOnlineClassGroupStudents = studentRegistrationService.findMusicGroupStuNoClassType(musicGroupId, ClassGroupTypeEnum.HIGH_ONLINE, null);
|
|
|
- students.addAll(noHighOnlineClassGroupStudents);
|
|
|
- }
|
|
|
- if (students.size() == 0) {
|
|
|
- return;
|
|
|
- }
|
|
|
- Map<Integer, String> studentMap = new HashMap<>();
|
|
|
- for (StudentRegistration student : students) {
|
|
|
- studentMap.put(student.getUserId(), student.getUserId().toString());
|
|
|
+ String[] subjectIds = HighClassGroupSubjectIds.split(",");
|
|
|
+
|
|
|
+ List<StudentRegistration> students = new ArrayList<>();
|
|
|
+ if (classGroupTypeSet.contains(ClassGroupTypeEnum.HIGH)) {
|
|
|
+ List<StudentRegistration> noHighClassGroupStudents = studentRegistrationService.findMusicGroupStuNoClassType(musicGroupId, ClassGroupTypeEnum.HIGH, null);
|
|
|
+ students.addAll(noHighClassGroupStudents);
|
|
|
+ }
|
|
|
+ if (classGroupTypeSet.contains(ClassGroupTypeEnum.HIGH_ONLINE)) {
|
|
|
+ List<StudentRegistration> noHighOnlineClassGroupStudents = studentRegistrationService.findMusicGroupStuNoClassType(musicGroupId, ClassGroupTypeEnum.HIGH_ONLINE, null);
|
|
|
+ students.addAll(noHighOnlineClassGroupStudents);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ Map<Integer, String> studentMap = new HashMap<>();
|
|
|
+ for (StudentRegistration student : students) {
|
|
|
+ if (!Arrays.asList(subjectIds).contains(student.getActualSubjectId().toString())) {
|
|
|
+ continue;
|
|
|
}
|
|
|
+ studentMap.put(student.getUserId(), student.getUserId().toString());
|
|
|
+ }
|
|
|
|
|
|
- String baseURL = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
|
|
|
- String url = baseURL + "/#/smallRegister?musicGroupId=" + musicGroupId;
|
|
|
- String serverPhone = sysConfigDao.findConfigValue(SysConfigService.SERVER_PHONE);
|
|
|
- sysMessageService.batchSendMessage(MessageSender.JIGUANG, MessageTypeEnum.SMS_BASICS_SKILL_APPLY_MESSAGE,
|
|
|
- studentMap, null, 0, "5?" + url, "STUDENT", musicGroup.getName(), HttpUtil.getSortUrl(url), serverPhone);
|
|
|
+ if (studentMap.size() == 0) {
|
|
|
+ throw new BizException("开启报名失败,没有可推送的学生");
|
|
|
}
|
|
|
+
|
|
|
+ String baseURL = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
|
|
|
+ String url = baseURL + "/#/smallRegister?musicGroupId=" + musicGroupId;
|
|
|
+ classGroupIds = highClassGroup.stream().map(e->e.getId().toString()).collect(Collectors.joining(","));
|
|
|
+ if(classGroupIds != null && !classGroupIds.isEmpty()){
|
|
|
+ url = baseURL + "/#/smallRegister?musicGroupId=" + musicGroupId+"&classGroupIds="+classGroupIds;
|
|
|
+ }
|
|
|
+ String serverPhone = sysConfigDao.findConfigValue(SysConfigService.SERVER_PHONE);
|
|
|
+ sysMessageService.batchSendMessage(MessageSender.JIGUANG, MessageTypeEnum.SMS_BASICS_SKILL_APPLY_MESSAGE,
|
|
|
+ studentMap, null, 0, "5?" + url, "STUDENT", musicGroup.getName(), HttpUtil.getSortUrl(url), serverPhone);
|
|
|
+
|
|
|
+ return studentMap.size();
|
|
|
}
|
|
|
|
|
|
// @Override
|