|
@@ -20,9 +20,7 @@ import com.yonge.cooleshow.biz.dal.service.ImUserFriendService;
|
|
|
import com.yonge.cooleshow.biz.dal.wrapper.im.CustomerService;
|
|
|
import com.yonge.toolset.base.exception.BizException;
|
|
|
import io.rong.messages.BaseMessage;
|
|
|
-import io.rong.messages.FileMessage;
|
|
|
import io.rong.messages.ImgMessage;
|
|
|
-import io.rong.messages.ImgTextMessage;
|
|
|
import io.rong.messages.TxtMessage;
|
|
|
import io.rong.models.message.PrivateMessage;
|
|
|
import io.rong.models.message.PushExt;
|
|
@@ -68,6 +66,8 @@ public class ImUserFriendServiceImpl extends ServiceImpl<ImUserFriendDao, ImUser
|
|
|
private CustomerServiceConfig customerServiceConfig;
|
|
|
@Autowired
|
|
|
private SysUserMapper sysUserMapper;
|
|
|
+ @Autowired
|
|
|
+ private ImUserFriendService imUserFriendService;
|
|
|
|
|
|
@Override
|
|
|
public ImUserFriendDao getDao() {
|
|
@@ -152,19 +152,27 @@ public class ImUserFriendServiceImpl extends ServiceImpl<ImUserFriendDao, ImUser
|
|
|
*
|
|
|
* @param userId 新用户ID
|
|
|
* @param friendIds 好友ID
|
|
|
+ * @param clientType 客户端类型
|
|
|
* @return Integer
|
|
|
*/
|
|
|
@Override
|
|
|
- public Integer registerUserBindCustomerService(Long userId, List<Long> friendIds) {
|
|
|
+ public Integer registerUserBindCustomerService(Long userId, List<Long> friendIds, ClientEnum clientType) {
|
|
|
|
|
|
// 添加新用户好友,客服默认为老师身份
|
|
|
for (Long teacherId : friendIds) {
|
|
|
|
|
|
saveUserFriend(teacherId, Sets.newHashSet(userId));
|
|
|
- }
|
|
|
|
|
|
- // 新注册用户为老师身份时,更新好友关系为老师身份
|
|
|
+ // 新注册用户为老师身份时,更新好友关系为老师身份
|
|
|
+ if (ClientEnum.TEACHER == clientType) {
|
|
|
|
|
|
+ imUserFriendService.lambdaUpdate()
|
|
|
+ .eq(ImUserFriend::getUserId, teacherId)
|
|
|
+ .eq(ImUserFriend::getFriendId, userId)
|
|
|
+ .eq(ImUserFriend::getFriendType, ClientEnum.STUDENT)
|
|
|
+ .set(ImUserFriend::getFriendType, ClientEnum.TEACHER);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
try {
|
|
|
|