|
@ -3,25 +3,17 @@ package com.ccsens.game.util; |
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
|
import com.ccsens.game.bean.dto.ClientDto; |
|
|
import com.ccsens.game.bean.dto.ClientDto; |
|
|
import com.ccsens.game.bean.dto.message.ChangeStatusMessageDto; |
|
|
import com.ccsens.game.bean.dto.message.ChangeStatusMessageDto; |
|
|
import com.ccsens.game.bean.dto.message.GameMessageWithChangeStatusOut; |
|
|
import com.ccsens.game.bean.dto.message.GameMessageWithChangeStatusOut; |
|
|
import com.ccsens.game.bean.po.GameGroup; |
|
|
|
|
|
import com.ccsens.game.bean.po.GameGroupExample; |
|
|
|
|
|
import com.ccsens.game.bean.po.GameRecord; |
|
|
import com.ccsens.game.bean.po.GameRecord; |
|
|
import com.ccsens.game.bean.vo.ClientVo; |
|
|
import com.ccsens.game.bean.vo.ClientVo; |
|
|
import com.ccsens.game.persist.dao.GameGroupDao; |
|
|
|
|
|
import com.ccsens.game.persist.dao.GameUserJoinDao; |
|
|
|
|
|
import com.ccsens.game.service.ClientService; |
|
|
import com.ccsens.game.service.ClientService; |
|
|
import com.ccsens.util.JacksonUtil; |
|
|
import com.ccsens.util.JacksonUtil; |
|
|
import com.ccsens.util.RedisUtil; |
|
|
import com.ccsens.util.RedisUtil; |
|
|
import com.ccsens.util.WebConstant; |
|
|
import com.ccsens.util.WebConstant; |
|
|
import com.ccsens.util.bean.message.common.InMessage; |
|
|
|
|
|
import com.ccsens.util.bean.message.common.MessageConstant; |
|
|
|
|
|
import com.ccsens.util.config.RabbitMQConfig; |
|
|
import com.ccsens.util.config.RabbitMQConfig; |
|
|
import com.fasterxml.jackson.core.JsonProcessingException; |
|
|
import com.fasterxml.jackson.core.JsonProcessingException; |
|
|
import io.swagger.models.auth.In; |
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.springframework.amqp.core.AmqpTemplate; |
|
|
import org.springframework.amqp.core.AmqpTemplate; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
@ -59,18 +51,22 @@ public class SendMsg { |
|
|
} |
|
|
} |
|
|
Set<String> userIds = new HashSet<>(); |
|
|
Set<String> userIds = new HashSet<>(); |
|
|
userJoins.forEach(join -> { |
|
|
userJoins.forEach(join -> { |
|
|
// outs.add(getMsg(userJoins, gameRecord, join, status));
|
|
|
outs.add(getMsg(userJoins, gameRecord, join, status)); |
|
|
|
|
|
|
|
|
InMessage inMessage = new InMessage(); |
|
|
// InMessage inMessage = new InMessage();
|
|
|
|
|
|
//
|
|
|
userIds.add(String.valueOf(join.getUserId())); |
|
|
// userIds.add(String.valueOf(join.getUserId()));
|
|
|
inMessage.setToDomain(MessageConstant.DomainType.User); |
|
|
// inMessage.setToDomain(MessageConstant.DomainType.User);
|
|
|
inMessage.setTos(userIds); |
|
|
// inMessage.setTos(userIds);
|
|
|
inMessage.setData(JSONObject.toJSONString(getMsg(userJoins, gameRecord, join, status))); |
|
|
// inMessage.setData(JSONObject.toJSONString(getMsg(userJoins, gameRecord, join, status)));
|
|
|
rabbitTemplate.convertAndSend(RabbitMQConfig.MESSAGE_QUEUE_NAME, JSONObject.toJSONString(inMessage)); |
|
|
// rabbitTemplate.convertAndSend(RabbitMQConfig.MESSAGE_QUEUE_NAME, JSONObject.toJSONString(inMessage));
|
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
if (CollectionUtil.isNotEmpty(outs)) { |
|
|
|
|
|
rabbitTemplate.convertAndSend(RabbitMQConfig.GAME_STATUS, JacksonUtil.beanToJson(outs)); |
|
|
|
|
|
log.info("发送成功:{}", JacksonUtil.beanToJson(outs)); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|