Ver código fonte

推送消息只去对应声部的学生

周箭河 5 anos atrás
pai
commit
41da92141c

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupDao.java

@@ -714,10 +714,11 @@ public interface ClassGroupDao extends BaseDAO<Integer, ClassGroup> {
      * @param type
      * @return
      */
-    List<HighClassGroupDto> findHighClassGroupByTypeAndSubjectId(@Param("musicGroupId") String musicGroupId, @Param("subjectId") Integer subjectId, @Param("type") String type);
+    List<HighClassGroupDto> findHighClassGroupByTypeAndSubjectId(@Param("musicGroupId") String musicGroupId, @Param("subjectId") Integer subjectId, @Param("type") String type, @Param("classGroupIds") String classGroupIds);
 
     /**
      * 根据班级id获取基础技能班
+     *
      * @param musicGroupId
      * @param classGroupIds
      * @return

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -1130,6 +1130,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             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(","));
@@ -1166,6 +1169,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         String baseURL = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
         String url = baseURL + "/#/smallRegister?musicGroupId=" + musicGroupId;
+        classGroupIds =  highClassGroup.stream().map(HighClassGroupDto::getId).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);

+ 4 - 2
mec-biz/src/main/resources/config/mybatis/ClassGroupMapper.xml

@@ -1281,14 +1281,16 @@
         <if test="subjectId != null and type=='HIGH_ONLINE'">
             AND FIND_IN_SET(#{subjectId},memo_)
         </if>
-        AND type_ = #{type} AND total_class_times_=0 AND del_flag_='0';
+        <if test="classGroupIds != null">
+            AND FIND_IN_SET(id_,#{classGroupIds})
+        </if>
+        AND type_ = #{type} AND del_flag_='0';
     </select>
 
     <select id="findHighClassGroup" resultMap="HighClassGroup">
         SELECT * FROM class_group WHERE music_group_id_=#{musicGroupId}
         <if test="classGroupIds != null">
             AND FIND_IN_SET(id_,#{classGroupIds})
-            AND total_class_times_ = 0
         </if>
         AND type_ IN ('HIGH','HIGH_ONLINE') AND del_flag_ = '0'
     </select>

+ 12 - 11
mec-student/src/main/java/com/ym/mec/student/controller/ClassGroupController.java

@@ -74,8 +74,10 @@ public class ClassGroupController extends BaseController {
 
     @ApiOperation(value = "用户声部小班课列表")
     @GetMapping("/highClassGroups")
-    @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团id", required = true, dataType = "String")})
-    public HttpResponseResult getHighClassGroup(String musicGroupId) {
+    @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团id", required = true, dataType = "String"),
+            @ApiImplicitParam(name = "classGroupIds", value = "班级ids", required = true, dataType = "String")}
+    )
+    public HttpResponseResult getHighClassGroup(String musicGroupId,String classGroupIds) {
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         Integer userId = sysUser.getId();
         StudentRegistration studentRegistration = studentRegistrationService.queryByUserIdAndMusicGroupId(userId, musicGroupId);
@@ -84,15 +86,14 @@ 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 = classGroupService.findClassGroupByMusicGroupIdAndSubjectId(musicGroupId, studentRegistration.getActualSubjectId());
+        List<HighClassGroupDto> highClassGroups = new ArrayList<>();
+        if (classGroupIds != null && !classGroupIds.isEmpty()) {
+            highClassGroups = classGroupDao.findHighClassGroupByTypeAndSubjectId(musicGroupId, studentRegistration.getActualSubjectId(), "HIGH",classGroupIds);
+            List<HighClassGroupDto> highOnlineClassGroup = classGroupDao.findHighClassGroupByTypeAndSubjectId(musicGroupId, studentRegistration.getActualSubjectId(), "HIGH_ONLINE",classGroupIds);
+            highClassGroups.addAll(highOnlineClassGroup);
+        } else {
+            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);