魔法小屋-房间uid
This commit is contained in:
@@ -6,13 +6,10 @@ import com.accompany.business.model.HallMember;
|
||||
import com.accompany.business.model.HallRoomChatRecord;
|
||||
import com.accompany.business.service.hall.HallRoomChatService;
|
||||
import com.accompany.business.service.hall.HallService;
|
||||
import com.accompany.common.redis.RedisKey;
|
||||
import com.accompany.business.service.room.UserInOutRoomRecordService;
|
||||
import com.accompany.common.utils.StringUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.redisson.api.RMap;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
@@ -23,15 +20,14 @@ import java.util.Date;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class RoomPersonChatListener implements ApplicationListener<CustomerConversationEvent>, InitializingBean {
|
||||
public class RoomPersonChatListener implements ApplicationListener<CustomerConversationEvent> {
|
||||
|
||||
@Autowired
|
||||
private RedissonClient redissonClient;
|
||||
@Autowired
|
||||
private HallService hallService;
|
||||
@Autowired
|
||||
private HallRoomChatService hallRoomChatService;
|
||||
private RMap<Long, Long> userInRoomCurrentMap;
|
||||
@Autowired
|
||||
private UserInOutRoomRecordService userInOutRoomRecordService;
|
||||
|
||||
@Override
|
||||
@Async
|
||||
@@ -43,8 +39,8 @@ public class RoomPersonChatListener implements ApplicationListener<CustomerConve
|
||||
}
|
||||
Long fromUid = Long.parseLong(chatMsg.getFromAccount());
|
||||
Long toUid = Long.parseLong(chatMsg.getTo());
|
||||
Long fromRoomUid = userInRoomCurrentMap.get(fromUid);
|
||||
Long toRoomUid = userInRoomCurrentMap.get(toUid);
|
||||
Long fromRoomUid = userInOutRoomRecordService.getUserCurrentRoomUid(fromUid);
|
||||
Long toRoomUid = userInOutRoomRecordService.getUserCurrentRoomUid(toUid);
|
||||
|
||||
if (null == fromRoomUid || !fromRoomUid.equals(toRoomUid)){
|
||||
return;
|
||||
@@ -76,9 +72,4 @@ public class RoomPersonChatListener implements ApplicationListener<CustomerConve
|
||||
log.info("[私聊消息记录] {} {} {} {} {}", fromUid, fromRoomUid, toUid, toRoomUid, JSON.toJSONString(chatMsg));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
userInRoomCurrentMap = redissonClient.getMap(RedisKey.user_in_room_current.getKey());
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@ import com.accompany.business.param.GiftCompoundParam;
|
||||
import com.accompany.business.service.ErBanNetEaseService;
|
||||
import com.accompany.business.service.room.RoomQueryService;
|
||||
import com.accompany.business.service.room.RoomService;
|
||||
import com.accompany.business.service.room.UserInOutRoomRecordService;
|
||||
import com.accompany.business.service.user.UserBackpackService;
|
||||
import com.accompany.business.service.user.UsersService;
|
||||
import com.accompany.business.vo.UserBackpackVo;
|
||||
@@ -68,13 +69,14 @@ public class GiftCompoundService {
|
||||
@Autowired
|
||||
private RoomQueryService roomQueryService;
|
||||
@Autowired
|
||||
RoomService roomService;
|
||||
|
||||
private RoomService roomService;
|
||||
@Autowired
|
||||
private UserInOutRoomRecordService userInOutRoomRecordService;
|
||||
@Resource(name = "bizExecutor")
|
||||
private ThreadPoolExecutor bizExecutor;
|
||||
|
||||
@Autowired
|
||||
ErBanNetEaseService erBanNetEaseService;
|
||||
private ErBanNetEaseService erBanNetEaseService;
|
||||
|
||||
@Autowired
|
||||
private SysConfService sysConfService;
|
||||
@@ -225,10 +227,14 @@ public class GiftCompoundService {
|
||||
|
||||
@Async
|
||||
public void sendServiceMsg(Users user, Gift gift) {
|
||||
String roomUidStr = jedisService.hget(RedisKey.user_in_room_current.getKey(), user.getUid().toString());
|
||||
Room roomByUid = roomService.getRoomByUid(Long.valueOf(roomUidStr));
|
||||
Long roomUid = userInOutRoomRecordService.getUserCurrentRoomUid(user.getUid());
|
||||
if (null == roomUid){
|
||||
return;
|
||||
}
|
||||
|
||||
Map map = new HashMap();
|
||||
Room roomByUid = roomService.getRoomByUid(roomUid);
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("uid", user.getUid());
|
||||
map.put("nick", user.getNick());
|
||||
map.put("msg", "在魔法小屋合成了");
|
||||
@@ -239,7 +245,7 @@ public class GiftCompoundService {
|
||||
}
|
||||
|
||||
|
||||
public long sendBatchRoomMsg(int first, int second, final Room playRoom, final Map<String, String> msg) {
|
||||
public long sendBatchRoomMsg(int first, int second, final Room playRoom, final Map<String, Object> msg) {
|
||||
Attach attach = new Attach();
|
||||
attach.setFirst(first);
|
||||
attach.setSecond(second);
|
||||
|
Reference in New Issue
Block a user