Jelajahi Sumber

Merge remote-tracking branch 'origin/master'

Joburgess 5 tahun lalu
induk
melakukan
99ece401aa

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupService.java

@@ -273,7 +273,7 @@ public interface MusicGroupService extends BaseService<String, MusicGroup> {
 	 * 乐团筹备结束后,3.0乐团推送小班课缴费信息
 	 * @param musicGroupId
 	 */
-	void pushMessage(String musicGroupId, String classGroupIds) throws IOException;
+	int pushMessage(String musicGroupId, String classGroupIds) throws IOException;
 
 	/**
 	 * 补全musicGroupStudentFee表数据

+ 39 - 36
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -1124,50 +1124,53 @@ 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());
-            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;
-            }
-
-            String[] subjectIds = HighClassGroupSubjectIds.split(",");
+        if (musicGroup.getOwnershipType() == null || musicGroup.getOwnershipType() != CooperationOrgan.OwnershipType.OWN) {
+            throw new BizException("三方乐团,不推送报名信息");
+        }
+        List<HighClassGroupDto> highClassGroup = classGroupDao.findHighClassGroup(musicGroupId, classGroupIds);
+        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);
-            }
+        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());
-            }
 
-            if (studentMap.size() == 0) {
-                return;
+        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;
+        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

+ 10 - 8
mec-student/src/main/java/com/ym/mec/student/controller/ClassGroupController.java

@@ -84,14 +84,16 @@ public class ClassGroupController extends BaseController {
         }
         MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
         Map<String, Object> classGroupAndStatusMap = new HashMap<>();
-        List<HighClassGroupDto> highClassGroups = new ArrayList<>();
-        if (musicGroup.getStatus().equals(MusicGroupStatusEnum.PROGRESS)) {
-            highClassGroups = classGroupDao.findHighClassGroupByTypeAndSubjectId(musicGroupId, studentRegistration.getActualSubjectId(), "HIGH");
-            List<HighClassGroupDto> highOnlineClassGroup = classGroupDao.findHighClassGroupByTypeAndSubjectId(musicGroupId, studentRegistration.getActualSubjectId(), "HIGH_ONLINE");
-            highClassGroups.addAll(highOnlineClassGroup);
-        } else {
-            highClassGroups = classGroupService.findClassGroupByMusicGroupIdAndSubjectId(musicGroupId, studentRegistration.getActualSubjectId());
-        }
+//        List<HighClassGroupDto> highClassGroups = new ArrayList<>();
+//        if (musicGroup.getStatus().equals(MusicGroupStatusEnum.PROGRESS)) {
+//            highClassGroups = classGroupDao.findHighClassGroupByTypeAndSubjectId(musicGroupId, studentRegistration.getActualSubjectId(), "HIGH");
+//            List<HighClassGroupDto> highOnlineClassGroup = classGroupDao.findHighClassGroupByTypeAndSubjectId(musicGroupId, studentRegistration.getActualSubjectId(), "HIGH_ONLINE");
+//            highClassGroups.addAll(highOnlineClassGroup);
+//        } else {
+//            highClassGroups = classGroupService.findClassGroupByMusicGroupIdAndSubjectId(musicGroupId, studentRegistration.getActualSubjectId());
+//        }
+        List<HighClassGroupDto> highClassGroups = classGroupService.findClassGroupByMusicGroupIdAndSubjectId(musicGroupId, studentRegistration.getActualSubjectId());
+
         List<ClassGroupStudentMapper> ClassGroupStudentMapper = classGroupStudentMapperDao.findHighClassGroupHasUser(musicGroupId, userId, ClassGroupTypeEnum.HIGH);
         List<ClassGroupStudentMapper> highOnlineClassGroupStudentMapper = classGroupStudentMapperDao.findHighClassGroupHasUser(musicGroupId, userId, ClassGroupTypeEnum.HIGH_ONLINE);
         classGroupAndStatusMap.put("highClassGroups", highClassGroups);

+ 1 - 2
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupController.java

@@ -145,8 +145,7 @@ public class MusicGroupController extends BaseController {
 		if(StringUtils.isEmpty(musicGroupId)){
 			throw new BizException("参数校验错误");
 		}
-		musicGroupService.pushMessage(musicGroupId,classGroupIds);
-		return succeed();
+		return succeed(	musicGroupService.pushMessage(musicGroupId,classGroupIds));
 	}
 
 	@ApiOperation(value = "根据乐团ids获取乐团列表")