|
@@ -9,7 +9,10 @@ import com.incubator.core.net.ws.NetHandler;
|
|
|
import com.incubator.core.net.ws.WSRequest;
|
|
|
import com.incubator.core.net.ws.WSResponse;
|
|
|
import com.incubator.game.constant.RedisKeyConstant;
|
|
|
+import com.incubator.game.data.entity.ZjClub;
|
|
|
+import com.incubator.game.data.entity.ZjClubMember;
|
|
|
import com.incubator.game.data.jedis.RedisUtil;
|
|
|
+import com.incubator.game.data.mq.RabbitMQUtil;
|
|
|
import com.incubator.game.data.po.ZjClubMemberPo;
|
|
|
import com.incubator.game.data.po.ZjClubPo;
|
|
|
import com.incubator.game.data.po.ZjUserLobbyPo;
|
|
@@ -73,6 +76,27 @@ public class CreateClub extends NetHandler {
|
|
|
newClub.setMasterScore(lobbyUser.getMasterScore());
|
|
|
newClub.setMasterName(lobbyUser.getNickName());
|
|
|
newClub.setClubMemberNum(1);
|
|
|
+
|
|
|
+ ZjClub zjClub = new ZjClub();
|
|
|
+ zjClub.setClubId(newClub.getClubId());
|
|
|
+ zjClub.setClubName(newClub.getClubName());
|
|
|
+ zjClub.setClubImg(newClub.getClubImg());
|
|
|
+ zjClub.setClubDescription(newClub.getClubDescription());
|
|
|
+ zjClub.setClubAddress(newClub.getClubAddress());
|
|
|
+ zjClub.setCreateTime(new Date());
|
|
|
+ zjClub.setClubStatus("1");
|
|
|
+ zjClub.setClubCreator(userId);
|
|
|
+ zjClub.setClubMemberNum(newClub.getClubMemberNum());
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ object.put("type","saveClub");
|
|
|
+ object.put("data",zjClub);
|
|
|
+ try {
|
|
|
+ RabbitMQUtil.sendMessage(object.toString());
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
addClubToRedis(jsonObject, clubArray, newClub);//添加俱乐部到redis
|
|
|
|
|
|
addClubMemberToRedis(userObject, newClub);//添加俱乐部成员到redis
|
|
@@ -95,6 +119,27 @@ public class CreateClub extends NetHandler {
|
|
|
c.setClubDescription(club.getClubDescription());
|
|
|
c.setClubAddress(club.getClubAddress());
|
|
|
});
|
|
|
+ ZjClubPo clubPo = existingClub.get();
|
|
|
+ ZjClub zjClub = new ZjClub();
|
|
|
+ zjClub.setClubId(clubPo.getClubId());
|
|
|
+ zjClub.setClubName(clubPo.getClubName());
|
|
|
+ zjClub.setClubImg(clubPo.getClubImg());
|
|
|
+ zjClub.setClubDescription(clubPo.getClubDescription());
|
|
|
+ zjClub.setClubAddress(clubPo.getClubAddress());
|
|
|
+ zjClub.setCreateTime(new Date());
|
|
|
+ zjClub.setClubStatus("1");
|
|
|
+ zjClub.setClubCreator(clubPo.getClubCreator());
|
|
|
+ zjClub.setClubMemberNum(clubPo.getClubMemberNum());
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ object.put("type","saveClub");
|
|
|
+ object.put("data",zjClub);
|
|
|
+ try {
|
|
|
+ RabbitMQUtil.sendMessage(object.toString());
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
jsonObject.put("clubList", clubList);
|
|
|
RedisUtil.set(RedisKeyConstant.CLUB_BASE, jsonObject.toString());
|
|
|
}
|
|
@@ -121,6 +166,26 @@ public class CreateClub extends NetHandler {
|
|
|
objects.add(zjClubMemberPo);
|
|
|
object.put("clubMember",objects);
|
|
|
RedisUtil.set(RedisKeyConstant.CLUB_MEMBER + newClub.getClubId(), object.toString());
|
|
|
+
|
|
|
+ ZjClubMember zjClubMember = new ZjClubMember();
|
|
|
+ zjClubMember.setUserId(zjClubMemberPo.getUserId());
|
|
|
+ zjClubMember.setClubId(zjClubMemberPo.getClubId());
|
|
|
+ zjClubMember.setMemberStatus(zjClubMemberPo.getMemberStatus());
|
|
|
+ zjClubMember.setRequestChannel(zjClubMemberPo.getRequestChannel()==null?"":zjClubMemberPo.getRequestChannel());
|
|
|
+ zjClubMember.setRequestExplain(zjClubMemberPo.getRequestExplain()==null?"":zjClubMemberPo.getRequestExplain());
|
|
|
+ zjClubMember.setMemberId(zjClubMemberPo.getMemberId());
|
|
|
+ JSONObject object1 = new JSONObject();
|
|
|
+ object1.put("type", "saveClubMember");
|
|
|
+ object1.put("data", zjClubMember);
|
|
|
+ try {
|
|
|
+ RabbitMQUtil.sendMessage(object1.toString());
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private JSONObject getClubListFromRedis() {
|
|
@@ -168,5 +233,16 @@ public class CreateClub extends NetHandler {
|
|
|
oldClubJO.put("clubMember",updatedClubMembers);
|
|
|
RedisUtil.set(RedisKeyConstant.CLUB_MEMBER + userClub,oldClubJO.toString());
|
|
|
}
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ object.put("type", "saveMainClub");
|
|
|
+ object.put("data", lobbyUser);
|
|
|
+ try {
|
|
|
+ RabbitMQUtil.sendMessage(object.toString());
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|