Explorar el Código

维修技师和乐团学员通讯录关联

zouxuan hace 4 años
padre
commit
3c9bfbd2cf

+ 35 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ImUserFriendServiceImpl.java

@@ -187,6 +187,8 @@ public class ImUserFriendServiceImpl extends BaseServiceImpl<Long, ImUserFriend>
 	public List<ImUserFriend> saveImUserFriends(Set<Integer> studentIds,Set<Integer> teacherIds,GroupType groupType,String musicGroupId){
 		List<ImUserFriend> imUserFriends = new ArrayList<>();
 		Set<Integer> educationIds = new HashSet<>();
+		Integer repairUserId = null;
+		String repairUserName = null;
 		MusicGroup musicGroup = new MusicGroup();
 		//获取当前学员声部
 		Map<Integer,String> studentSubjectName = new HashMap<>();
@@ -200,6 +202,10 @@ public class ImUserFriendServiceImpl extends BaseServiceImpl<Long, ImUserFriend>
 			educationIds.add(musicGroup.getDirectorUserId());
 			educationIds.add(musicGroup.getEducationalTeacherId());
 			educationIds.add(musicGroup.getTeamTeacherId());
+			if(musicGroup.getRepairUserId() != null){
+				repairUserId = musicGroup.getRepairUserId();
+				repairUserName = teacherDao.queryNameById(repairUserId);
+			}
 			if(studentIds.size() > 0){
 				studentSubjectName = MapUtil.convertMybatisMap(studentRegistrationDao.getStudentSubjectNameByStuIds(musicGroup.getId(),studentIds));
 			}
@@ -282,7 +288,7 @@ public class ImUserFriendServiceImpl extends BaseServiceImpl<Long, ImUserFriend>
 				imUserFriends.add(imUserFriend);
 			}
 		}
-		//学员关联的老师、教务
+		//学员关联的老师、教务、维修技师
 		for (Integer studentId : studentIds) {
 			//学员关联的老师
 			for (Integer teacher : teacherIds) {
@@ -308,6 +314,34 @@ public class ImUserFriendServiceImpl extends BaseServiceImpl<Long, ImUserFriend>
 				imUserFriend.setFriendNickname(educationRealNameMap.get(education));
 				imUserFriends.add(imUserFriend);
 			}
+			//学员关联维修技师
+			if(repairUserId != null){
+				if(repairUserId == studentId){
+					continue;
+				}
+				ImUserFriend imUserFriend = new ImUserFriend();
+				imUserFriend.setUserId(studentId);
+				imUserFriend.setFriendId(repairUserId);
+				imUserFriend.setFriendNickname(repairUserName);
+				imUserFriend.setMemo(musicGroup.getName());
+				imUserFriend.setTags("维修技师");
+				imUserFriends.add(imUserFriend);
+			}
+		}
+		//维修技师关联学员
+		if(repairUserId != null){
+			for (Integer studentId : studentIds) {
+				if(repairUserId == studentId){
+					continue;
+				}
+				ImUserFriend imUserFriend = new ImUserFriend();
+				imUserFriend.setUserId(repairUserId);
+				imUserFriend.setFriendId(studentId);
+				imUserFriend.setFriendNickname(usernameMap.get(studentId));
+				imUserFriend.setMemo(musicGroup.getName());
+				imUserFriend.setTags(studentSubjectName.get(studentId));
+				imUserFriends.add(imUserFriend);
+			}
 		}
 		return imUserFriends;
 	}

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

@@ -2648,6 +2648,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             refresh = true;
             updateTeamTeacher(group, musicGroup);
         }
+        //修改了维修技师
+        if(musicGroup.getRepairUserId() != null && !musicGroup.getRepairUserId().equals(group.getRepairUserId())){
+            refresh = true;
+        }
         //不是导入的乐团
         if (musicGroupId.length() > 10) {
             //是否有预报名的群聊