谷歌包-moli-清理话题WorId

This commit is contained in:
khalil
2024-04-12 17:19:44 +08:00
parent fd7751d5fe
commit 3a2b669e03
127 changed files with 111 additions and 8402 deletions

View File

@@ -1,6 +1,6 @@
package com.accompany.admin.vo;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
import lombok.Data;
@Data
@@ -16,7 +16,7 @@ public class GiftCompoundRewardAdminVo {
private Integer serviceNotice;
@I18nPartition(className = "Gift")
@I18n(className = "Gift")
private String giftName;
private Long goldPrice;

View File

@@ -1,122 +0,0 @@
package com.accompany.admin.vo;
import java.util.Date;
/**
* {这里添加描述}
*
* @author fangchengyan
* @date 2019-07-08 20:15
*/
public class WorldMemberAdminVo {
private Long id;
/**
* 平台号
*/
private Long erbanNo;
private String nick;
/**
* 世界id
*/
private Long worldId;
/**
* 世界名称
*/
private String worldName;
/**
* 状态
*/
private Integer status;
/**
* 消息提醒: 0.屏蔽消息 1.开启提醒
*/
private Integer promtFlag;
/**
* 是否禁言: 0.不禁言 1.禁言
*/
private Integer muteFlag;
/**
* 创建时间
*/
private Date createTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNick() {
return nick;
}
public void setNick(String nick) {
this.nick = nick;
}
public String getWorldName() {
return worldName;
}
public void setWorldName(String worldName) {
this.worldName = worldName;
}
public Long getErbanNo() {
return erbanNo;
}
public void setErbanNo(Long erbanNo) {
this.erbanNo = erbanNo;
}
public Long getWorldId() {
return worldId;
}
public void setWorldId(Long worldId) {
this.worldId = worldId;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getPromtFlag() {
return promtFlag;
}
public void setPromtFlag(Integer promtFlag) {
this.promtFlag = promtFlag;
}
public Integer getMuteFlag() {
return muteFlag;
}
public void setMuteFlag(Integer muteFlag) {
this.muteFlag = muteFlag;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

View File

@@ -6,9 +6,6 @@ import com.accompany.admin.util.I18NMessageSourceUtil;
import com.accompany.admin.vo.WorldAdminVo;
import com.accompany.business.sensitvienew.SensitiveFilterUtil;
import com.accompany.business.service.user.UsersService;
import com.accompany.business.service.world.WorldGroupChatService;
import com.accompany.business.service.world.WorldMemberService;
import com.accompany.business.service.world.WorldMessageService;
import com.accompany.business.service.world.WorldService;
import com.accompany.common.redis.RedisKey;
import com.accompany.common.status.BusiStatus;
@@ -20,7 +17,6 @@ import com.accompany.world.common.ParamUtils;
import com.accompany.world.common.WorldException;
import com.accompany.world.constant.WorldConstant;
import com.accompany.world.entity.World;
import com.accompany.world.entity.WorldGroupChat;
import com.accompany.world.entity.WorldType;
import com.accompany.world.service.IWorldService;
import com.accompany.world.service.IWorldTypeService;
@@ -62,13 +58,7 @@ public class WorldAdminService extends BaseService {
@Autowired
private WorldService worldService;
@Autowired
private WorldMemberService worldMemberService;
@Autowired
private WorldMessageService worldMessageService;
@Autowired
private JedisLockService jedisLockService;
@Autowired
private WorldGroupChatService worldGroupChatService;
public PageInfo<WorldAdminVo> queryForPages(WorldSearchDto search) {
@@ -192,9 +182,6 @@ public class WorldAdminService extends BaseService {
//将创建人添加到世界中
if(result > 0) {
worldMemberService.addNewMember(record.getId(), record.getOwnerUid(), false);
// 发送一条创建世界的秘书消息
worldMessageService.sendCreateWorldMessage(record.getOwnerUid(), record.getId());
// 处理最热标签
if(StringUtils.isNotBlank(record.getWorldTag())
&& Arrays.asList(record.getWorldTag().split(",")).contains(String.valueOf(WorldConstant.WorldTag.HOT))) {
@@ -228,14 +215,6 @@ public class WorldAdminService extends BaseService {
record.setDescription(SensitiveFilterUtil.getStringSensitiveFilter(record.getDescription()));
}
//修改了创建人且新的创建人不在该世界中,把创建人加入到世界中
boolean changeOwner = oldOwnerUid != record.getOwnerUid();
boolean needAddOwner = changeOwner && !iWorldService.isInWorld(record.getOwnerUid(), record.getId());
if (needAddOwner) {
ParamUtils.isTrue(world.getMemberNum() < WorldConstant.MAX_WORLD_MEMBER_NUM,
"编辑失败,话题成员数已达上限");
}
//修改了世界名, 添加世界名称锁
boolean worldNameChange = false;
String nameLockKey = RedisKey.world_name_lock.getKey();
@@ -256,9 +235,6 @@ public class WorldAdminService extends BaseService {
if (worldNameChange && SensitiveFilterUtil.getBooleanSensitiveFilter(record.getName())) {
record.setName(SensitiveFilterUtil.getStringSensitiveFilter(record.getName()));
}
if(needAddOwner) {
worldMemberService.addNewMember(record.getId(), record.getOwnerUid(), true);
}
// 国际化
List<String> messageSourceList = new ArrayList<>();
@@ -277,20 +253,6 @@ public class WorldAdminService extends BaseService {
if (result > 0) {
//最新的世界数据
World newWorld = iWorldService.getByIdFromCache(record.getId());
//修改了世界的创建人
if(changeOwner) {
//开启了群,修改群主
WorldGroupChat worldGroupChat = worldGroupChatService.getOneByWorldId(world.getId());
if (null != worldGroupChat) {
worldGroupChatService.changeGroupChatOwner(record.getId(), worldGroupChat.getId(),
oldOwnerUid, record.getOwnerUid());
}
//原创建人: 发送取消创建人消息
Users oldUser = usersService.getUsersByUid(world.getOwnerUid());
worldMessageService.sendCancelWorldOwnerMsg(newWorld, oldUser);
//新创建人: 发送设置创建人消息
worldMessageService.sendSetWorldOwnerMsg(newWorld, users);
}
//修改了话题的标签
String newTag = newWorld.getWorldTag();
String oldTag = world.getWorldTag();
@@ -345,7 +307,6 @@ public class WorldAdminService extends BaseService {
vo.setEndTime(world.getEndTime());
vo.setIcon(world.getIcon());
vo.setId(world.getId());
vo.setMemberNum(world.getMemberNum());
vo.setName(world.getName());
vo.setNotice(world.getNotice());
vo.setSeqNo(world.getSeqNo());

View File

@@ -1,177 +0,0 @@
package com.accompany.admin.service.world;
import com.accompany.admin.dto.WorldMemberSearchDto;
import com.accompany.admin.vo.WorldMemberAdminVo;
import com.accompany.business.service.user.UsersService;
import com.accompany.business.service.world.WorldMemberService;
import com.accompany.business.service.world.WorldService;
import com.accompany.common.redis.RedisKey;
import com.accompany.common.status.BusiStatus;
import com.accompany.core.model.Users;
import com.accompany.core.service.common.JedisLockService;
import com.accompany.world.common.WorldException;
import com.accompany.world.constant.WorldConstant;
import com.accompany.world.entity.World;
import com.accompany.world.entity.WorldMember;
import com.accompany.world.service.IWorldMemberService;
import com.accompany.world.service.IWorldService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* {这里添加描述}
*O
* @author fangchengyan
* @date 2019-07-05 16:42
*/
@Service
public class WorldMemberAdminService {
private final Logger logger = LoggerFactory.getLogger(WorldMemberAdminService.class);
@Autowired
private IWorldService iWorldService;
@Autowired
private WorldService worldService;
@Autowired
private IWorldMemberService iWorldMemberService;
@Autowired
private WorldMemberService worldMemberService;
@Autowired
private UsersService usersService;
@Autowired
private JedisLockService jedisLockService;
public PageInfo<WorldMemberAdminVo> queryForPages(WorldMemberSearchDto search, int pageNumber, int pageSize) {
QueryWrapper<WorldMember> queryWrapper = new QueryWrapper<>();
if(null != search.getErbanNo()) {
Users user = usersService.getUserByErbanNo(search.getErbanNo());
if(null == user) {
return new PageInfo<>(new ArrayList<>());
}
queryWrapper.eq("uid", user.getUid());
}
if(null != search.getWorldId()) {
queryWrapper.eq("world_id", search.getWorldId());
}
if(null != search.getStatus()) {
queryWrapper.eq("`status`", search.getStatus());
}
PageHelper.startPage(pageNumber, pageSize);
PageInfo<WorldMember> pageInfo = new PageInfo(iWorldMemberService.list(queryWrapper));
PageInfo<WorldMemberAdminVo> result = new PageInfo<>();
result.setTotal(pageInfo.getTotal());
if(CollectionUtils.isNotEmpty(pageInfo.getList())) {
result.setList(pageInfo.getList().stream().map(worldMember -> convertVo(worldMember)).collect(Collectors.toList()));
} else {
result.setList(new ArrayList<>());
}
return result;
}
public int saveBatch(Long worldId, List<Long> erbanNoList) throws Exception {
String lockKey = RedisKey.world_lock.getKey(String.valueOf(worldId));
//批量添加时,耗时会有点久,因此加锁时间略长
String lockVal = jedisLockService.lock(lockKey, 1000, 60 * 1000);
if (StringUtils.isEmpty(lockVal)) {
throw new WorldException(BusiStatus.SERVERBUSY.getReasonPhrase());
}
try {
int result = 0;
World world = iWorldService.getByIdFromCache(worldId);
if (null == world || world.getStatus() != WorldConstant.STATUS_VALID) {
logger.warn("批量添加成员失败,话题{}不存在,或已解散", worldId);
throw new WorldException("话题不存在,或已解散");
}
Set<Long> uidSet = new HashSet<>(erbanNoList.size());
for (Long erbanNo : erbanNoList) {
Users users = usersService.getUserByErbanNo(erbanNo);
if (null == users) {
logger.warn("批量添加成员失败erbanNo为{}的成员不存在!", erbanNo);
continue;
}
//当前成员是否已在该话题中
if (!iWorldService.isInWorld(users.getUid(), worldId)) {
uidSet.add(users.getUid());
}
}
if (CollectionUtils.isEmpty(uidSet)) {
logger.warn("批量添加成员失败,成员不存在,或已删除,或已在该世界中!成员:{}", erbanNoList);
throw new WorldException("批量添加成员失败,用户不存在,或已加入该世界!");
}
//添加成员到世界中
for (Long uid : uidSet) {
if(iWorldService.getJoinWorldNum(uid) >= WorldConstant.MAX_JOIN_WORLD) {
logger.warn("添加用户失败,用户{}加入世界数已达上限!", uid);
continue;
}
result += worldMemberService.addNewMember(worldId, uid, false);
}
if(result <= 0) {
throw new WorldException("添加用户失败,用户加入世界数已达上限!");
}
return result;
} finally {
jedisLockService.unlock(lockKey, lockVal);
}
}
public int deleteBatch(List<Long> idList) throws Exception {
int result = 0;
for(Long id : idList) {
int line = deleteById(id);
result += line;
}
return result;
}
public int deleteById(Long id) throws Exception {
WorldMember worldMember = iWorldMemberService.getById(id);
if(null == worldMember || !WorldConstant.WorldMemberStatus.normal.equals(worldMember.getStatus())) {
logger.warn("删除失败,该用户不在此世界中");
return 0;
}
return worldService.exit(worldMember.getWorldId(), worldMember.getUid(), WorldConstant.LeaveGroupChatType.admin);
}
public WorldMember getById(Long id) {
return iWorldMemberService.getById(id);
}
private WorldMemberAdminVo convertVo(WorldMember worldMember) {
if(null == worldMember) {
return null;
}
WorldMemberAdminVo vo = new WorldMemberAdminVo();
vo.setId(worldMember.getId());
vo.setCreateTime(worldMember.getCreateTime());
vo.setMuteFlag(worldMember.getMuteFlag());
vo.setPromtFlag(worldMember.getPromtFlag());
vo.setStatus(worldMember.getStatus());
vo.setWorldId(worldMember.getWorldId());
Users users = usersService.getUsersByUid(worldMember.getUid());
if(null != users) {
vo.setErbanNo(users.getErbanNo());
vo.setNick(users.getNick());
}
World world = iWorldService.getByIdFromCache(worldMember.getWorldId());
if(null != world) {
vo.setWorldName(world.getName());
}
return vo;
}
}

View File

@@ -9,11 +9,10 @@ import com.alibaba.fastjson.JSONObject;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.MessageSource;
import java.lang.reflect.Field;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@@ -30,6 +29,16 @@ import java.util.concurrent.TimeUnit;
@Slf4j
public class I18NMessageSourceUtil {
public static Map<String, String> getMessageMap(String i18nId, Object[] params){
MessageSource messageSource = SpringContextHolder.getBean(MessageSource.class);
Map<String, String> i18nMap = new HashMap<>();
for (Locale locale : WebLocaleConfig.locales) {
String message = messageSource.getMessage(i18nId, params, locale);
i18nMap.put(locale.getLanguage(), message);
}
return i18nMap;
}
/**
* 将需要国际化的数据进行反序列化并进行修改
*

View File

@@ -13,7 +13,6 @@ import com.accompany.business.model.RoomTag;
import com.accompany.business.service.room.RobotUsingService;
import com.accompany.business.service.room.RoomService;
import com.accompany.business.service.user.UsersService;
import com.accompany.business.service.world.WorldMessageService;
import com.accompany.business.vo.message.MessageLayout;
import com.accompany.common.constant.MessageConstant;
import com.accompany.common.netease.util.NetEaseConstant;
@@ -59,8 +58,6 @@ public class RoomAdminController extends BaseController {
@Autowired
private UsersBaseService usersBaseService;
@Autowired
private WorldMessageService worldMessageService;
@Autowired
private RobotUsingService robotUsingService;
@Autowired
private RoomService roomService;
@@ -268,12 +265,6 @@ public class RoomAdminController extends BaseController {
int result = roomSearchAdminService.resetRoomTitleAndIntro(uid, title, roomDesc, introduction);
if (result > 0) {
usersService.updateUserTime(uid);
if (sendMsg && StringUtils.isNotBlank(msg)) {
//发送系统通知(格式和类型走之前话题普通格式)
Object[] args = {DateTimeUtil.convertDate(new Date(), DateTimeUtil.DEFAULT_DATE_MINUTE_PATTERN), msg};
worldMessageService.sendAsyncMessage(MessageConstant.WORLD, MessageConstant.WORLD_NOMAL, msgContent, args, uid,
null, null, null, null);
}
return new BusiResult<>(BusiStatus.SUCCESS);
}
} catch (Exception e) {

View File

@@ -6,7 +6,6 @@ import com.accompany.admin.service.UserCheckAdminService;
import com.accompany.admin.vo.UsersAdminVo;
import com.accompany.business.model.PrivatePhoto;
import com.accompany.business.service.user.PrivatePhotoService;
import com.accompany.business.service.world.WorldMessageService;
import com.accompany.business.vo.message.MessageLayout;
import com.accompany.common.constant.Constant;
import com.accompany.common.constant.MessageConstant;
@@ -39,8 +38,6 @@ public class UserCheckAdminController extends BaseController {
@Autowired
private TencentCosUploadService uploadService;
@Autowired
private WorldMessageService worldMessageService;
@Autowired
private AccountService accountService;
public static final MessageLayout msgContent = new MessageLayout().
@@ -78,12 +75,6 @@ public class UserCheckAdminController extends BaseController {
BusiResult busiResult = null;
try {
busiResult = userCheckAdminService.saveUser(nick, gender, avatar, uid, phone, alipayAccount, alipayAccountName, photoUrls, userDesc);
if (sendMsg && StringUtils.isNotBlank(msg) && busiResult.getCode() == BusiStatus.SUCCESS.value()) {
//发送系统通知(格式和类型走之前话题普通格式)
Object[] args = {DateTimeUtil.convertDate(new Date(), DateTimeUtil.DEFAULT_DATE_MINUTE_PATTERN), msg};
worldMessageService.sendAsyncMessage(MessageConstant.WORLD, MessageConstant.WORLD_NOMAL, msgContent, args, uid,
null, null, null, null);
}
} catch (Exception e) {
logger.error("saveUser error..uid=" + uid, e);
return new BusiResult(BusiStatus.BUSIERROR);

View File

@@ -1,156 +0,0 @@
package com.accompany.admin.controller.world;
import com.alibaba.fastjson.JSONObject;
import com.accompany.admin.controller.BaseController;
import com.accompany.admin.dto.WorldMemberSearchDto;
import com.accompany.admin.service.world.WorldMemberAdminService;
import com.accompany.admin.vo.WorldMemberAdminVo;
import com.accompany.core.exception.ServiceException;
import com.accompany.core.util.StringUtils;
import com.github.pagehelper.PageInfo;
import com.accompany.world.common.WorldException;
import com.accompany.world.entity.WorldMember;
import com.accompany.common.result.BusiResult;
import com.accompany.common.status.BusiStatus;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.List;
/**
* {这里添加描述}
*O
* @author fangchengyan
* @date 2019-07-05 16:42
*/
@Controller
@RequestMapping("/admin/world/member")
public class WorldMemberAdminController extends BaseController {
private Logger logger = LoggerFactory.getLogger(WorldMemberAdminController.class);
@Autowired
private WorldMemberAdminService worldMemberAdminService;
@ResponseBody
@RequestMapping(value = "list", method = RequestMethod.GET)
public void list(WorldMemberSearchDto search){
PageInfo<WorldMemberAdminVo> pageInfo = worldMemberAdminService.queryForPages(search, getPageNumber(), getPageSize());
JSONObject jsonObject = new JSONObject();
jsonObject.put("total", pageInfo.getTotal());
jsonObject.put("rows", pageInfo.getList());
writeJson(jsonObject.toJSONString());
}
@ResponseBody
@RequestMapping(value = "saveBatch", method = RequestMethod.POST)
public BusiResult save(Long worldId, String erbanNos){
if (worldId == null || StringUtils.isBlank(erbanNos)) {
return new BusiResult(BusiStatus.PARAMERROR);
}
String[] erbanNoArray = erbanNos.split(",");
List<Long> erbanNoList = new ArrayList<>(erbanNoArray.length);
for(String erbanNoStr : erbanNoArray) {
Long erbanNo = NumberUtils.toLong(erbanNoStr, 0);
if(null == erbanNo || erbanNo <= 0) {
continue;
}
erbanNoList.add(erbanNo);
}
if(erbanNoList.size() <= 0) {
logger.warn("批量保存失败,平台号不正确:{}", erbanNos);
return new BusiResult(BusiStatus.PARAMERROR);
}
try {
worldMemberAdminService.saveBatch(worldId, erbanNoList);
return new BusiResult(BusiStatus.SUCCESS);
} catch (WorldException e) {
return new BusiResult(BusiStatus.SERVERERROR, e.getMessage(),null);
} catch (ServiceException e){
return new BusiResult(e.getBusiStatus());
} catch (Exception e) {
logger.error(e.getMessage(), e);
return new BusiResult(BusiStatus.SERVERERROR);
}
}
@ResponseBody
@RequestMapping(value = "delete", method = RequestMethod.POST)
public BusiResult delete(Long id){
if(null == id || id <= 0) {
return new BusiResult(BusiStatus.PARAMERROR);
}
try {
int result = worldMemberAdminService.deleteById(id);
if(result <= 0) {
return new BusiResult(BusiStatus.UNKNOWN);
}
return new BusiResult(BusiStatus.SUCCESS);
} catch (WorldException e){
return new BusiResult(BusiStatus.SERVERERROR, e.getMessage(),null);
} catch (ServiceException e){
return new BusiResult(e.getBusiStatus());
} catch (Exception e){
logger.error(e.getMessage(), e);
return new BusiResult(BusiStatus.SERVERERROR);
}
}
@ResponseBody
@RequestMapping(value = "deleteBatch", method = RequestMethod.POST)
public BusiResult deleteBatch(String ids){
if(StringUtils.isBlank(ids)) {
return new BusiResult(BusiStatus.PARAMERROR);
}
String[] idArray = ids.split(",");
List<Long> idList = new ArrayList<>(idArray.length);
for(String idStr : idArray) {
Long id = NumberUtils.toLong(idStr, 0);
if(null != id && id > 0) {
idList.add(id);
}
}
if(CollectionUtils.isEmpty(idList)) {
return new BusiResult(BusiStatus.PARAMERROR);
}
try {
int result = worldMemberAdminService.deleteBatch(idList);
if(result <= 0) {
return new BusiResult(BusiStatus.UNKNOWN);
}
return new BusiResult(BusiStatus.SUCCESS);
} catch (WorldException e){
return new BusiResult(BusiStatus.SERVERERROR, e.getMessage(),null);
} catch (ServiceException e){
return new BusiResult(e.getBusiStatus());
} catch (Exception e){
logger.error(e.getMessage(), e);
return new BusiResult(BusiStatus.SERVERERROR);
}
}
@ResponseBody
@RequestMapping(value = "getById", method = RequestMethod.GET)
public BusiResult getById(Long id){
try {
WorldMember record = worldMemberAdminService.getById(id);
return new BusiResult(BusiStatus.SUCCESS, record);
} catch (WorldException e) {
return new BusiResult(BusiStatus.SERVERERROR, e.getMessage(),null);
} catch (ServiceException e){
return new BusiResult(e.getBusiStatus());
} catch (Exception e) {
logger.error(e.getMessage(), e);
return new BusiResult(BusiStatus.SERVERERROR);
}
}
}

View File

@@ -94,8 +94,6 @@ public class Room {
private Boolean leaveMode;
private Long worldId;
private Byte hideFlag;
private Byte closeScreenFlag;
@@ -548,14 +546,6 @@ public class Room {
this.leaveMode = leaveMode;
}
public Long getWorldId() {
return worldId;
}
public void setWorldId(Long worldId) {
this.worldId = worldId;
}
public Byte getHideFlag() {
return hideFlag;
}

View File

@@ -1,7 +1,7 @@
package com.accompany.core.vo.car;
import com.accompany.common.annotation.ReplaceAppDomain;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
import java.util.Date;
@@ -9,7 +9,7 @@ public class CarportVo implements Comparable<CarportVo> {
private Long uid;
private Integer id;
@I18nPartition(className="CarGoods")
@I18n(className="CarGoods")
private String name;
@ReplaceAppDomain
private String pic; // 预览图

View File

@@ -1,7 +1,7 @@
package com.accompany.core.vo.headwear;
import com.accompany.common.annotation.ReplaceAppDomain;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
import com.alibaba.fastjson.JSON;
import java.math.BigDecimal;
@@ -18,7 +18,7 @@ public class UserHeadwearVo implements Comparable<UserHeadwearVo> {
private Integer headwearId;
@I18nPartition(className = "Headwear")
@I18n(className = "Headwear")
private String headwearName;
private Boolean used;

View File

@@ -1,7 +1,7 @@
package com.accompany.core.vo.user;
import com.accompany.common.annotation.ReplaceAppDomain;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
import lombok.Data;
import java.io.Serializable;
@@ -20,7 +20,7 @@ public class UserNameplateVo implements Serializable {
private Date createTime;
private Date updateTime;
@I18nPartition(className = "Nameplate")
@I18n(className = "Nameplate")
private String nameplateName;
@ReplaceAppDomain
private String nameplateImage;

View File

@@ -34,9 +34,6 @@
<result column="def_backpic" property="defBackpic" jdbcType="VARCHAR" />
<result column="has_animation_effect" property="hasAnimationEffect" jdbcType="BIT" />
<result column="audio_quality" property="audioQuality" jdbcType="TINYINT" />
<result column="has_dragon_game" property="hasDragonGame" jdbcType="BIT" />
<result column="has_ktv_priv" property="hasKTVPriv" jdbcType="BIT" />
<result column="is_open_ktv" property="isOpenKTV" jdbcType="BIT" />
<result column="is_open_game" property="isOpenGame" jdbcType="BIT" />
<result column="is_close_screen" property="isCloseScreen" jdbcType="BIT" />
<result column="room_mode_type" property="roomModeType" jdbcType="INTEGER" />
@@ -119,7 +116,7 @@
`type`, official_room, ab_channel_type, reward_id, reward_money, serv_dura, operator_status,
avatar, room_desc, back_pic, open_time, is_permit_room, online_num, create_time,
update_time, is_exception_close, exception_close_time, recom_seq, can_show, def_backpic,
has_animation_effect, audio_quality, has_dragon_game, has_ktv_priv, is_open_ktv,
has_animation_effect, audio_quality,
is_close_screen, room_mode_type, is_open_game, limit_type, introduction, is_pure_mode,
show_gift_value, close_box, leave_mode, world_id, hide_flag, close_screen_flag, gift_rate,
audio_sdk_type, fixed_audio_sdk, blind_date_vip_uid, single_room_sort_id, partition_id
@@ -174,8 +171,7 @@
is_permit_room, online_num, create_time,
update_time, is_exception_close, exception_close_time,
recom_seq, can_show, def_backpic,
has_animation_effect, audio_quality, has_dragon_game,
has_ktv_priv, is_open_ktv, is_open_game, is_close_screen,
has_animation_effect, audio_quality, is_open_game, is_close_screen,
room_mode_type, limit_type, introduction, is_pure_mode, show_gift_value,
close_box, world_id, hide_flag, close_screen_flag, blind_date_vip_uid
)
@@ -189,8 +185,7 @@
#{isPermitRoom,jdbcType=TINYINT}, #{onlineNum,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{isExceptionClose,jdbcType=BIT}, #{exceptionCloseTime,jdbcType=TIMESTAMP},
#{recomSeq,jdbcType=BIGINT}, #{canShow,jdbcType=TINYINT}, #{defBackpic,jdbcType=VARCHAR},
#{hasAnimationEffect,jdbcType=BIT}, #{audioQuality,jdbcType=TINYINT}, #{hasDragonGame,jdbcType=BIT},
#{hasKTVPriv,jdbcType=BIT}, #{isOpenKTV,jdbcType=BIT}, #{isOpenGame,jdbcType=BIT},#{isCloseScreen,jdbcType=BIT},
#{hasAnimationEffect,jdbcType=BIT}, #{audioQuality,jdbcType=TINYINT}, #{isOpenGame,jdbcType=BIT},#{isCloseScreen,jdbcType=BIT},
#{roomModeType,jdbcType=INTEGER}, #{limitType,jdbcType=VARCHAR}, #{introduction,jdbcType=VARCHAR}, #{isPureMode,jdbcType=BIT},
#{showGiftValue,jdbcType=BIT}, #{closeBox,jdbcType=BIT}, #{leaveMode,jdbcType=BIT}, #{worldId,jdbcType=BIGINT},#{hideFlag,jdbcType=TINYINT},
#{closeScreenFlag,jdbcType=TINYINT},#{blindDateVipUid,jdbcType=BIGINT}
@@ -230,7 +225,7 @@
valid,
</if>
<if test="type != null" >
type,
`type`,
</if>
<if test="officialRoom != null" >
official_room,
@@ -295,15 +290,6 @@
<if test="audioQuality != null" >
audio_quality,
</if>
<if test="hasDragonGame != null" >
has_dragon_game,
</if>
<if test="hasKTVPriv != null" >
has_ktv_priv,
</if>
<if test="isOpenKTV != null" >
is_open_ktv,
</if>
<if test="isOpenGame != null" >
is_open_game,
</if>
@@ -608,15 +594,6 @@
<if test="record.audioQuality != null" >
audio_quality = #{record.audioQuality,jdbcType=TINYINT},
</if>
<if test="record.hasDragonGame != null" >
has_dragon_game = #{record.hasDragonGame,jdbcType=BIT},
</if>
<if test="record.hasKTVPriv != null" >
has_ktv_priv = #{record.hasKTVPriv,jdbcType=BIT},
</if>
<if test="record.isOpenKTV != null" >
is_open_ktv = #{record.isOpenKTV,jdbcType=BIT},
</if>
<if test="record.isOpenGame != null" >
is_open_game = #{record.isOpenGame,jdbcType=BIT},
</if>
@@ -645,7 +622,7 @@
leave_mode = #{record.leaveMode,jdbcType=BIT},
</if>
<if test="record.worldId != null" >
world_id = #{record.worldId,jdbcType=BIGINT},
world_id = #{record.worldId,jdbcType=BIGINT},
</if>
<if test="record.hideFlag != null">
hide_flag = #{record.hideFlag,jdbcType=TINYINT},
@@ -695,9 +672,6 @@
def_backpic = #{record.defBackpic,jdbcType=VARCHAR},
has_animation_effect = #{record.hasAnimationEffect,jdbcType=BIT},
audio_quality = #{record.audioQuality,jdbcType=TINYINT},
has_dragon_game = #{record.hasDragonGame,jdbcType=BIT},
has_ktv_priv = #{record.hasKTVPriv,jdbcType=BIT},
is_open_ktv = #{record.isOpenKTV,jdbcType=BIT},
is_open_game = #{record.isOpenGame,jdbcType=BIT},
is_close_screen = #{record.isCloseScreen,jdbcType=BIT},
room_mode_type = #{record.roomModeType,jdbcType=INTEGER},
@@ -746,7 +720,7 @@
valid = #{valid,jdbcType=BIT},
</if>
<if test="type != null" >
type = #{type,jdbcType=TINYINT},
`type` = #{type,jdbcType=TINYINT},
</if>
<if test="officialRoom != null" >
official_room = #{officialRoom,jdbcType=TINYINT},
@@ -811,15 +785,6 @@
<if test="audioQuality != null" >
audio_quality = #{audioQuality,jdbcType=TINYINT},
</if>
<if test="hasDragonGame != null" >
has_dragon_game = #{hasDragonGame,jdbcType=BIT},
</if>
<if test="hasKTVPriv != null" >
has_ktv_priv = #{hasKTVPriv,jdbcType=BIT},
</if>
<if test="isOpenKTV != null" >
is_open_ktv = #{isOpenKTV,jdbcType=BIT},
</if>
<if test="isOpenGame != null" >
is_open_game = #{isOpenGame,jdbcType=BIT},
</if>
@@ -848,7 +813,7 @@
leave_mode = #{leaveMode,jdbcType=BIT},
</if>
<if test="worldId != null" >
world_id = #{worldId,jdbcType=BIGINT},
world_id = #{worldId,jdbcType=BIGINT},
</if>
<if test="hideFlag != null">
hide_flag = #{hideFlag,jdbcType=TINYINT},
@@ -901,9 +866,6 @@
def_backpic = #{defBackpic,jdbcType=VARCHAR},
has_animation_effect = #{hasAnimationEffect,jdbcType=BIT},
audio_quality = #{audioQuality,jdbcType=TINYINT},
has_dragon_game = #{hasDragonGame,jdbcType=BIT},
has_ktv_priv = #{hasKTVPriv,jdbcType=BIT},
is_open_ktv = #{isOpenKTV,jdbcType=BIT},
is_open_game = #{isOpenGame,jdbcType=BIT},
is_close_screen = #{isCloseScreen,jdbcType=BIT},
room_mode_type = #{roomModeType,jdbcType=INTEGER},

View File

@@ -101,10 +101,7 @@ public enum BusiStatus {
INVALID_LOGIN_TYPE_ERROR(3004, "該賬號只允許通過ID登錄"),
PHONE_BIND_TOO_MANY_ACCOUNT(3005, "該手機號存在多個ID的綁定關係聯繫公會運營處理"),
PHONE_BIND_TOO_MANY_ACCOUNT2(25002, "該手機號存在多個ID的綁定關係請輸入用戶ID進行登錄"),
PHONE_BIND_TOO_MANY_ACCOUNT(25002, "該手機號存在多個ID的綁定關係輸入用戶ID進行登錄"),
PHONE_BE_INTERCEPTED(3006, "This phone number has violated regulations"),

View File

@@ -571,16 +571,6 @@ public enum RedisKey {
**/
lock_joinpay_notify,
/**
* 话题成员
*/
world_member_num,
/**
* 我加入的世界
*/
my_join_world,
/**
* 话题缓存
*/

View File

@@ -1,7 +1,7 @@
package com.accompany.common.result;
import com.accompany.common.status.BusiStatus;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -22,7 +22,7 @@ public class BusiResult<T> {
@JsonIgnore
private String codeName;
@I18nPartition(className = "BusiStatus", fieldName = "codeName")
@I18n(className = "BusiStatus", fieldName = "codeName")
@ApiModelProperty("响应消息")
private String message;

View File

@@ -11,7 +11,7 @@ import java.lang.annotation.*;
@Target(ElementType.FIELD)
@JacksonAnnotationsInside
@JsonSerialize(using = MessageSourcePartitionSerialize.class)
public @interface I18nPartition {
public @interface I18n {
String className();

View File

@@ -18,16 +18,6 @@ public class WebLocaleConfig implements WebMvcConfigurer {
public static List<Locale> locales = Arrays.asList(Chinese, English, Arabic);
public static List<Locale> partitionLocales = Arrays.asList(Chinese, Arabic);
public static Map<Locale, Locale> partitionLocaleMaps = new HashMap<>();
static {
partitionLocaleMaps.put(Chinese, Chinese);
partitionLocaleMaps.put(English, Chinese);
partitionLocaleMaps.put(Arabic, Arabic);
}
/**
* 国际化默认解析器,默认设置为汉语
*/

View File

@@ -4,285 +4,19 @@ package com.accompany.core.enumeration;
public enum BusinessStatusCodeEnum {
SUCCESS(200 , " Success "),
NOTEXISTS(404 , " Not present "),
NOAUTHORITY(401 , " No permission "),
ACCOUNT_ERROR(407 , " User account abnormality, please contact official customer service "),
SERVERERROR(500 , " Server error "),
SERVERBUSY(503 , " The server is under maintenance "),
BAD_REQUEST(400 , " Request error "),
SERVICE_LIMIT(503 , " Interface call exceeds limit "),
ACTIVITYNOTSTART(3100 , " The activity has not started yet "),
ACTIVITYNOTEND(3200 , " The activity has ended "),
GET_GOLD_REPEAT(3300 , " I have already received the spirit stone "),
INVALID_SERVICE(199 , " Invalid service "),
SERVEXCEPTION(5000 , " Service exception "),
UNKNOWN(999 , " Unknown "),
BUSIERROR(4000 , " Server maintenance in progress, please wait "),
PARAMETERILLEGAL(1444 , " Parameter Illegal "),
USERNOTEXISTS(1404 , " user does not exist "),
USERINFONOTEXISTS(1405 , " You can only open a room after completing your personal information! "),
NICKTOOLONG(1406 , " Nickname too long "),
NEEDLOGIN(1407 , " Login required "),
USER_INCORRECT_PAYMENT_PASS(1408 , " The payment password is incorrect "),
USER_INCORRECT_LOGIN_PASS(1409 , " Incorrect login password "),
USER_SHARE_CODE_INCORRECT(1410 , " The invitation code is incorrect "),
NICK_IS_ALREADY_EXISTS(1411 , " The username already exists "),
VIDEONOTEXISTS(1604 , " The video does not exist "),
COLLECTEXISTS(1605 , " Collect exists "),
NOTLIKEONESELF(1500 , " Unable to like oneself "),
ALIAPYACCOUNTNOTEXISTS(16001 , " Please fill in the Alipay account first "),
PRIVATEPHOTOSUPMAX(1700 , " The number of images in a personal album cannot exceed 8 "),
ROOMRUNNING(1500 , " The living room is in operation "),
ROOMRCLOSED(1501 , " The living room has been closed "),
ROOMNOTEXIST(1502 , " The living room does not exist "),
NOTHAVINGLIST(1600 , " no data "),
AUCTCURDOING(2100 , " It's already in the auction "),
AUCTCURLESSTHANMAXMONEY(2101 , " The bid is lower than the current highest price "),
AUCTCURYOURSELFERROR(2102 , " You can't audit yourself "),
PURSEMONEYNOTENOUGH(2103 , " Insufficient account balance, please recharge "),
DIAMONDNUMNOTENOUGH(2104 , " Insufficient crystal balance "),
REDPACKETNUMNOTENOUGH(2105 , " Insufficient amount of red envelope "),
RED_PACKET_RATE_NOT_ENOUGH(2106 , " Insufficient proportion of red envelope sharing "),
DEDUCTION_FAIL(2105 , " Deduction failed "),
ORDERNOTEXISTS(3404 , " Secret chat does not exist "),
ORDERFINISHED(3100 , " The secret conversation has ended "),
SMSSENDERROR(4001 , " SMS sending failed "),
PHONEINVALID(4002 , " Please enter the correct phone number "),
PHONE_NO_BIND(30001 , " Unbound phone number "),
SMSCODEERROR(4003 , " SMS verification code error, please re-enter! "),
MICRONOTININVIATEDLIST(6000 , " You are not in the invited list "),
MICRONUMLIMIT(60001 , " Micro number limit "),
GOLODEXCHANGEDIAMONDNOTENOUGH(70001 , " Insufficient crystal balance "),
EXCHANGEINPUTERROR(70002 , " Input error, please enter an integer multiple of 10 "),
GIFTDOWNORNOTEXISTS(8000 , " The gift has been taken off the shelves, please look forward to more gifts~ "),
GIFT_IS_NOT_ALLOWED_TO_BE_SENT(8000 , " This gift cannot be given out~ "),
GIFTISEMPTY(8001 , " The number of gifts is not enough~ "),
GIFTNOAUTHORITY(8401 , " The noble level is not enough~ "),
NOBLENORECOMCOUNT(3401 , " This nobleman has no chance of recommendation "),
NOBLENOAUTH(3402 , " This nobleman has this privilege "),
NOBLENOTEXISTS(3404 , " Nobility does not exist "),
NOBLEUSEREXIST(3301 , " This level of nobility has been activated "),
NOBLEOPENERROR(3500 , " Failed to activate nobles "),
NOBLEEXPIRE(3501 , " The noble level has expired "),
SMSIPTOOFTEN(302 , " Getting text messages too frequently "),
PRETTYNOERROR(1200 , " The beautiful account already exists "),
HASPRETTYNOERROR(1300 , " The user already has a good account "),
iSPROVING(1400 , " Under review "),
PARAMERROR(1900 , " Parameter error "),
NORIGHT(1401 , " You do not have this privilege "),
ISUNBANGSTATUS(1901 , " It is already in unbound state "),
NOMORECHANCE(9000 , " There is no chance for a lottery anymore. Recharging or sharing will give you a chance to draw! "),
USER_DRAW_TO_MORE(9001 , " The lottery is too frequent "),
VERSIONISNULL(80001 , " Version is empty, please check the version number "),
VERSIONTOLOW(80002 , " The version is too low, please upgrade to the latest version "),
GIFT_WORK_REPEAT_UPLOAD(47571 , " You have already uploaded your work "),
GIFT_WORK_NOT_FOUND(47572 , " No works found for this user "),
GIFT_WORK_NOT_VERIFY(47573 , " The work has not yet passed the review "),
GIFT_WORK_FREE_VOTE_USED(47474 , " Today's free voting has been used "),
CARPORTHADEXPIRE(6405 , " The vehicle has expired "),
CARPORTNOTEXIST(6406 , " The vehicle does not exist "),
CANOTUSEAPPLEPAY(7500 , " Currently unable to use Apple Pay, please click on the discount to recharge "),
CARGOODSEXIST(6301 , " The user already owns the vehicle "),
CAR_GOODS_NOT_EXISTS(6201 , " The vehicle does not exist "),
CAR_GOODS_EXPIRED(6202 , " The vehicle has been taken off the shelves "),
CAR_GOODS_LIMIT(6203 , " Restricted vehicles are not available for purchase "),
WEEK_STAR_CONFIG(8200 , " The star ranking configuration for this week already exists "),
ILLEGAL_TRANSFER_REQUEST(1700 , " Illegal transfer request "),
TRANSFER_COMPLETED(1701 , " Transaction completed, no need for duplicate requests "),
DUPLICATE_TRANSFER_REQUEST(1702 , " Repeated transfer request "),
HEADWEAR_NOT_EXISTS(1800 , " Headwear does not exist "),
HEADWEAR_SOLD_OUT(1801 , " The headwear has been removed from the shelves "),
HEADWEAR_EXPIRED(1802 , " The headwear has expired "),
HEADWEAR_LIMIT_NOBLE(1803 , " Exclusive products for the nobility "),
HEADWEAR_LIMIT_ACTIVITY(1804 , " Event limited products "),
HEADWEAR_LIMIT_WEEK_STAR(1805 , " Limited products on the weekly star list "),
HEADWEAR_LIMIT_MONSTER(1806 , " Monster Reward Limited Product "),
HEADWEAR_NOT_BUY(1807 , " The user did not purchase the headwear "),
BACKGROUND_NOT_EXISTS(66710 , " Background item does not exist "),
BACKGROUND_SOLD_OUT(66711 , " The product has been delisted "),
BACKGROUND_NOT_BUY(66712 , " The user did not purchase the product "),
SEARCH_NOT_SUPPORT(9502 , " Currently only supports searching for the Dream Island account "),
SMS_NOT_EXPIRED(2001 , " The verification code text message has been sent. Please wait for one minute and try again "),
SMS_DEVICE_LIMIT(2002 , " The current device has exceeded the SMS limit "),
SMS_SENDING_FREQUENCY_TOO_HIGH(2003 , " The SMS sending frequency is too high. Please try again later "),
OPEN_BOX_POOL_NEED_THANKS_PRODUCT(9999 , " Default prizes have not been configured yet "),
OPEN_BOX_KEY_NOT_ENOUGH(10000 , " Not enough tickets "),
OPEN_BOX_USER_TO_MORE(10001 , " There are too many people in the lottery, please try again later "),
WHITE_USER_PRIZE_FAILED(10002 , " Invalid lottery whitelist setting "),
OPEN_BOX_BAD_POOL_CONFIG(10003 , " The operation swallowed up the prize "),
LOTTERY_RECORD_NOT_EXIST(10004 , " The lottery record does not exist "),
PRICE_POOL_JOB_RULE_OVERLAP(10005 , " The lottery rules overlap with other existing rules "),
PRIZE_CAN_NOT_CONFIG_LUCKY_BAG(10005 , " Lucky bags cannot be configured as prizes "),
DIAMOND_BOX_NOT_OPEN(10005 , " Please open the treasure chest during the event and look forward to your participation "),
NO_SUPPORT_BOX_TYPE(10006 , " Unsupported Treasure Box Type "),
OPEN_BOX_KEY_UPDATE_FAIL(10007 , " Failed to update ticket quantity "),
MUSIC_NOT_EXISTS(10100 , " The song does not exist "),
ROOM_IS_NOT_KTV(10101 , " The current living room is not a KTV room~ "),
ROOM_IS_KTV(10102 , " The current living room is already a KTV room~ "),
CHOOSE_MUSIC_STATION_IS_FULL(10103 , " The current song platform is full. Let's listen to other Mac performers for a while first~ "),
CHOOSE_MUSIC_RECORD_IS_EMPTY(10104 , " The selected song is empty~ "),
MUSIC_IS_CHOOSE_BY_USER(10105 , " Cannot select duplicate songs~ "),
MUSIC_IS_SINGING(10106 , " The current song is playing and cannot be deleted~ "),
NO_KTV_PRIV(10107 , " Baby, you don't have the permission to activate KTV mode. Let's go play in someone else's karaoke room first~ "),
PRETTY_NUMBER_NOT_EXIST(80781 , " The beautiful account was not found "),
PRETTY_NUMBER_NOT_VALID(80782 , " The beautiful account has been taken down from the shelves "),
PRETTY_NUMBER_ALREADY_USED(80783 , " The beautiful account has been used "),
PRETTY_NUMBER_NOT_USED(80784 , " This beautiful account is currently not in use "),
PRETTY_NUMBER_ALREADY_BIND(80785 , " The user has already bound a beautiful account "),
PRETTY_NUMBER_ALREADY_OCCUPY(80786 , " The user is already occupied "),
PRETTY_NUMBER_NOT_OCCUPY(80787 , " The user is not occupied "),
ACT_LIKE_RECORD_EXIST(9100 , " The like activity record already exists "),
ACT_LIKE_RECORD_TIME_ERROR(9101 , " Wrong time interval for like activity "),
ACT_LIKE_RANK_KEY_NOT_EXIST(9404 , " The like activity leaderboard does not exist "),
ACT_LIKE_RECORD_IP_REPEAT(9501 , " The IP address for liking is duplicate "),
ACT_GIFT_NOT_EXITST(9102 , " This gift is not a designated gift for the event "),
FAMILY_NOT_EXISTS(7000 , " Family does not exist or has been disabled "),
HAVE_JOIN_IN_FAMILY(7001 , " You need to exit the current family to join it "),
HAVE_JOIN_IN_THIS_FAMILY(7002 , " You have joined the family "),
YOU_HAVE_BEEN_REJECT(7003 , " You were rejected by the family "),
FAMILY_HAVE_APPLY(7004 , " You have already applied for the family "),
FAMILY_MESSAGE_EXPIRE(7005 , " Message has expired "),
FAMILY_PERMISSION_DENIED(7006 , " No operation permission "),
FAMILY_LEADER_NOT_ALLOW_QUIT(7007 , " The clan leader is not allowed to leave the family "),
FAMILY_QUIT_LIMIT_TIME(7008 , " Joining the family for 7 days before exiting the family "),
FAMILY_NOT_JOIN(7009 , " Not joined the family "),
FAMILY_TARGET_NOT_JOIN(7010 , " The other party did not join the family "),
FAMILY_NOT_SAME(7010 , " The other party is not from the same family as you "),
FAMILY_MONEY_NOT_ENOUGH(7011 , " Insufficient family coins "),
FAMILY_MONEY_TRADE_IN_FAILED(7011 , " Family coin failed to be credited, please continue with official secretary "),
FAMILY_INVITE_FREQUENCY_TO_MUCH(7012 , " Too many invitations "),
FAMILY_INVITE_NOT_EXISTS(7013 , " Invitation does not exist "),
FAMILY_INVITE_EXPIRE(7013 , " Invitation has expired "),
ROOM_IS_ALREADY_ASSIGNED_TO_FAMILY(7014 , " The hall has been designated to the family "),
ASSIGN_ROOM_NOT_EXISTS(7015 , " The designated hall does not exist "),
ASSIGN_ROOM_CAN_ONLY_CONFIG_WITH_FIVE(7016 , " The designated hall can only be equipped with 5 "),
FAMILY_RED_PACKGE_COUNT_ERROR(7014 , " The minimum number of red envelopes is 1, and the maximum number of red envelopes is 500 "),
FAMILY_RED_PACKGE_AMOUNT_NOT_ENOUGH(7015 , " The total amount of red envelopes is insufficient "),
RED_PACKET_NOT_EXISTS(7017 , " The red envelope does not exist "),
RED_PACKET_PARAM_ILLEGAL(7016 , " Illegal amount or number of red envelopes "),
RED_PACKET_NOT_EXSIST(7016 , " The red envelope does not exist "),
RED_PACKET_NOT_IN_SAME_GROUP(7017 , " Unable to receive red envelopes for this group "),
RED_PACKET_HAS_RECEVICED(7018 , " The red envelope has already been claimed "),
RED_PACKET_RECEVICED_OVER(7019 , " The red envelope has been collected completely "),
FAMILY_NAME_IS_SENSITIVE(7020 , " Family names contain sensitive words "),
FAMILY_LEADER_CANT_CONTRIBUTE(7021 , " The clan leader cannot contribute family coins "),
RED_PACKET_EXPIRE(7022 , " The red envelope has expired "),
MODIFY_FAILD(7023 , " Modification failed "),
FAMILY_APPLY_RECORD_NOT_EXISTS(7024 , " Family application record does not exist "),
FAMILY_APPLY_AGREED(7025 , " Agreed to join the family "),
FAMILY_NAME_REPEAT(7026 , " Family name duplication "),
FAMILY_NAME_TOO_LONG(7027 , " Family name cannot exceed 15 words "),
FAMILY_MONEY_NAME_REPEAT(7028 , " Family coin names are duplicated "),
FAMILY_MONEY_NAME_TOO_LONG(7029 , " Family coin names cannot exceed three characters "),
ALREADY_IN_FAMILY(7030 , " The user has already joined another family "),
FAMILY_GROUP_REMOVE_FAILED(7031 , " Failed to disband group chat "),
KICK_OUT_GROUP_FAILED(7032 , " Failed to kick out group chat "),
LEAVE_GROUP_FAILED(7033 , " Failed to leave group chat "),
LEAVE_FAMILY_FAILED(7034 , " Failed to leave the family "),
LESS_THAN_MINIMUM_AMOUT(7036 , " The minimum transaction amount shall not be less than 0.01 yuan "),
FAMILY_REJECT_TOO_MUCH_TIMES(7037 , " You were rejected multiple times by the family on that day and cannot apply to join the family "),
GROUP_REJECT_TOO_MUCH_TIMES(7038 , " You were rejected multiple times by the group on that day and cannot apply to join the group chat "),
MANAGE_COUNT_TOO_MANY(7039 , " The number of administrators cannot exceed 6 "),
GROUP_NAME_IS_SENSITIVE(7040 , " The group name contains sensitive words "),
HAS_LEAVED_CHAT(7041 , " You have exited the group chat "),
HAS_JOINED_FAMILY(7042 , " You have joined the family and need to leave the current family in order to apply to join another family "),
HAS_CLOSE_FAMILY_MONEY(7043 , " The family coin function has been disabled "),
GROUP_MEMBER_LIMIT(7044 , " The maximum number of group chats has been reached, and we are unable to apply to join the group chat "),
HAS_JOINED_OTHER_FAMILY_GROUP(7045 , " You have already joined another family's group chat and cannot join the current group chat "),
GROUP_APPLY_TOO_MUCH_TIMES(7046 , " You applied for this group chat multiple times on the same day and cannot apply to join the group chat "),
MUST_JOIN_IN_FAMILY(7047 , " You must be a member of the current family to apply for joining the group chat "),
LIMIT_MAX_CHAT(7071671 , " Exceeded group chat creation limit "),
NOT_FOUND_CHAT(7071672 , " The group chat was not found "),
LIMIT_MAX_MEMBER(7071673 , " Joining the group failed, the maximum number of group members is 200 "),
ALREADY_EXISTS_MEMBER(7071674 , " The user already exists in this group chat "),
NO_PERMIT_OPERATOR(7071675 , " No operation permission "),
MEMBER_NOT_IN_CHAT(7071676 , " The user does not exist in this group chat "),
MEMBER_ALREADY_MANAGER(7071677 , " The user is already the administrator of this group chat "),
MEMBER_NOT_MANAGER(7071677 , " The user is not the administrator of this group chat "),
MEMBER_ALREADY_DISABLE(7071678 , " The user has been banned from speaking "),
MEMBER_NOT_DISABLE(7071679 , " The user has not been banned from speaking "),
HAS_GIVED(10108 , " It has already been claimed and cannot be claimed again "),
COUNT_LIMIT_GIVE(10113 , " Not meeting the specified conditions for the activity, claim failed "),
OUT_OF_ACTIVITY_DATE(10109 , " Not within the activity time "),
REQUEST_PARAM_ERROR(1000 , " Parameter error, please try again "),
GIVE_DAY_OUT_OF_ACTIVITY_DATE(10109 , " The collection date is not within the activity time "),
ACT_CONFIG_ERROR(1799 , " Activity configuration exception "),
ACT_OPEN_BOX_NOT_ENOUGH(1899 , " Insufficient opening of treasure chest, failed to claim "),
ACT_NOT_FIND_GIFT(1999 , " Failed to receive gift, no corresponding gift found "),
VKISS_PRIZE_ACTIVITY_ERROR(9588 , " Abnormal configuration of vkiss secret code reward collection activity "),
VKISS_API_ERROR(9688 , " Vkiss interface exception "),
VKISS_BUSINESS_ERROR(9788 , " Error "),
VKISS_BUSINESS_ALREADY_GET(9888 , " You have already claimed it, you cannot claim it again "),
ACCOUNT_NOT_EXISTS(6616 , " Account does not exist "),
ACT_NATIONAL_TIME_OUT(10007 , " Not within the activity time "),
WEIXIN_USER_NOT_EXITSTS(6618 , " WeChat user does not exist "),
NEED_CERTIFICATION(10108 , " Real name authentication is required first "),
ID_CARD_BIND_LIMIT(10109 , " There are too many accounts bound to your ID card "),
USER_HAS_BIND_ID(10110 , " The user has already undergone identity authentication "),
WITHDRAW_NEED_CERTIFICATION(10111 , " The withdrawal amount is too large and requires identity authentication "),
USER_POST_LIMIT(10112 , " User submitted too many verification attempts "),
PACK_NOT_EXIST(8500 , " The gift package does not exist "),
PACK_NOT_OPEN(8501 , " The gift package is not yet available for purchase "),
PACK_UNDER_STOCK(8502 , " The number of gift packages sold today has exceeded the limit "),
PACK_REACH_BUY_LIMIT(8503 , " Exceeded today's purchase limit "),
PACK_OVERCROWDED(8504 , " There are too many people rushing to purchase, please try again later~ "),
BANNER_ROOM_NOT_EXISTS(20000 , " Room ID does not exist "),
RECOMMEND_STOCK_NOT_ENOUGH(7567001 , " Insufficient inventory of recommended positions "),
NOT_FOUND_AVAILABLE_RECOMMEND_CARD(7567002 , " No available recommendation cards "),
RECOMMEND_ALREADY_APPLY(7567002 , " Recommended slots for this time period have been applied for "),
GIFT_IS_ONLY_USED_IN_ROOM(8000 , " This gift can only be given in the living room or private chat "),
USER_LEVEL_NOT_ENOUGH(8090001 , " Not reaching the level of published works "),
WORKS_NOT_FOUND(8090002 , " The work was not found "),
WORKS_ALREADY_SHARE(8090003 , " The user has already shared this work "),
ONLY_SUCCESS_VERIFY_WORKS_CAN_BE_LIKED(8090004 , " Work review in progress, unable to like temporarily~ "),
ONLY_SUCCESS_VERIFY_WORKS_CAN_BE_COMMENT(8090005 , " The work is currently under review and cannot be commented on~ "),
USER_LEVEL_NOT_ENOUGH_COMMENT(8090006 , " User level must reach two or more levels "),
H5_EXCHANGE_OUT_OF_LIMIT(6619 , " Too many people have exchanged it "),
H5_LOVE_EXCHANGE_NO_COUNT(6620 , " Your love value is insufficient "),
H5_LOVE_EXCHANGE_COUNT_NONE(6621 , " Insufficient remaining quantity of exchange items "),
H5_ACCOUNT_ERROR(6622 , " User login has expired, please log in again "),
H5_POST_TOO_MORE(6623 , " Request too frequently, may I take a break "),
LOVER_ACTIVITY_TO_MORE(5201 , " Frequent operation "),
LOVER_ACTIVITY_TASK_NOT_EXIST(5202 , " Task does not exist "),
LOVER_ACTIVITY_TASK_NOT_FINISH(5203 , " The task is not completed and cannot be claimed temporarily "),
USERNAME_IS_FORBIDDEN(5204 , " User nickname contains illegal characters "),
DEFAULT_PRIZE_EXIST(5205 , " The default prize already exists in this prize pool "),
DEFAULT_PRIZE_NOT_EXIST(5206 , " The default prize configured for this prize pool does not exist "),
CODE_DUPLICATE(5207 , " Code duplication "),
PAY_BLOCK(5208 , " The recharge function is temporarily unavailable "),
USED_GOLD_ONBOX_LIMIT(5209,"Today, the consumption limit for opening treasure chests has been reached"),
AT_LEAST_ONE_CARD(5210 , " Please select at least one tarot card "),
CHARGE_PROD_NOT_ALLOWED(5211 , " The product has been taken down and cannot be recharged "),
TAROT_CHARGE_LIMIT(5212 , " Today, Lucky Tarot recharge consumption has reached its limit "),
FUNCTION_CLOSED(5213 , " This feature has been disabled, please upgrade to the latest version "),
DUPLICATE_SEQ(5214 , " Duplicate serial number "),
WRONG_PHONE(5215 , " The phone number cannot be the same as the current person "),
WRONG_MIGRATE_TYPE(5216 , " The original account does not support migration "),
DRAW_HAS_NO_CHANCE(5217 , " There's no chance for a lottery anymore "),
GOLD_GIVE_EVERY_DAT_LIMIT(5218 , " Exceeded the daily transfer limit "),
NOT_SET_PAY_PASSWORD(5219 , " No payment password set "),
GOLD_GIVE_CLOSE(5220 , " The gift transfer function is temporarily not enabled "),
GOLD_GIVE_SINGLE_LIMIT(5221 , " The current transfer limit has been exceeded "),
GOLD_GIVE_RECEIVE_LIMIT(5222 , " The maximum limit for the user to receive gifts on the same day has been exceeded "),
UNKNOWN_DEVICE(5223 , " unknown device "),
IOS_PAY_LIMIT(5224 , " Exceeded today's internal purchase recharge limit "),
CONTAIN_SENSITIVE_WORD(5225 , " Contains sensitive words "),
PYQ_PUBLISH_SENSITIVE(5226 , " Contains sensitive vocabulary, please modify and publish "),
USER_NO_INROOM(5227 , " Broadcast can only be sent within the living room "),
TOP_BROAD_ERROR(5228 , " The number of seeds must be a multiple of 50 "),
TOP_BROAD_HAS_BEEN(5229 , " Sending failed, currently in progress broadcast is in protection time "),
TOP_BROAD_NO_MONET_ERROR(5230 , " The number of seeds is not higher than the current ceiling price "),
TOP_BROAD_NO_HAVE(5231 , " There is currently no top broadcast available "),
NO_SEND_TOPBROAD(5232 , " National Day of Mourning, Top Broadcast Service Suspended "),
ALREADY_GET_PIG(5233 , " You have already adopted a pig "),
ALREADY_GET_FEED(5234 , " I have already received the feed today "),
NO_FINISH_TASK(5235 , " Not meeting the requirements of the task "),
NO_FEED(5236 , " At least 500g needs to be fed each time "),
NO_WEIGHT(5237 , " The weight of the piglet is not enough to 100kg, continue feeding it "),
NO_HAVE_PIG(5238 , " You don't have any pigs to sell yet "),
NO_HAVE_FEED_PIG(5239 , " You don't have any pigs to feed yet~ "),
NO_USER_SHARE(5240 , " Follow the official account of Dream Island Sauce Assistant, download the app and participate in the event immediately "),
GOLD_GIVE_NO_10(5241 , " The transfer amount must be a multiple of 10 "),
HAVE_TOP_BROAD_(5242 , " There are currently broadcasts being topped "),
;
private final int value;

View File

@@ -39,7 +39,7 @@ public class MessageSourceAdminSerialize extends JsonSerializer<String> implemen
String i18nId = className + "." + (StringUtils.isNoneBlank(fieldName) ? getFieldNameValue(jsonGenerator.getCurrentValue()) : str);
Map<String, String> i18nMap = new HashMap<>();
for (Locale locale : WebLocaleConfig.partitionLocales) {
for (Locale locale : WebLocaleConfig.locales) {
String message = messageSource.getMessage(i18nId, null, str, locale);
i18nMap.put(locale.getLanguage(), message);
}

View File

@@ -1,8 +1,7 @@
package com.accompany.core.serialize;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
import com.accompany.core.base.SpringContextHolder;
import com.accompany.core.config.WebLocaleConfig;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.BeanProperty;
import com.fasterxml.jackson.databind.JsonSerializer;
@@ -33,9 +32,8 @@ public class MessageSourcePartitionSerialize extends JsonSerializer<String> impl
}
Locale locale = LocaleContextHolder.getLocale();
Locale partitionLocale = WebLocaleConfig.partitionLocaleMaps.get(locale);
String i18nId = className + "." + (StringUtils.isNoneBlank(fieldName) ? getFieldNameValue(jsonGenerator.getCurrentValue()) : str);
String abc = SpringContextHolder.getBean(MessageSource.class).getMessage(i18nId, null, str, partitionLocale);
String abc = SpringContextHolder.getBean(MessageSource.class).getMessage(i18nId, null, str, locale);
jsonGenerator.writeString(abc);
}
@@ -49,7 +47,7 @@ public class MessageSourcePartitionSerialize extends JsonSerializer<String> impl
@Override
public JsonSerializer<?> createContextual(SerializerProvider serializerProvider, BeanProperty beanProperty) {
I18nPartition annotation = beanProperty.getAnnotation(I18nPartition.class);
I18n annotation = beanProperty.getAnnotation(I18n.class);
if (null != annotation && StringUtils.isNoneBlank(annotation.className())) {
MessageSourcePartitionSerialize serialize = new MessageSourcePartitionSerialize();
serialize.setClassName(annotation.className());

View File

@@ -85,9 +85,6 @@ public class DynamicInfoVo {
/** 话题名称 */
private String worldName;
/** 当前用户是否在该话题中 */
private Boolean inWorld;
/** -- 新增 -- */
private String experLevelPic; // 财富等级
private String charmLevelPic; // 魅力等级

View File

@@ -22,11 +22,6 @@ public class DynamicSquareWorldVo {
*/
private String worldName;
/**
* 当前用户是否在话题中
*/
private Boolean inWorld;
/**
* 头像 必填具体尺寸限制按UI稿
*/

View File

@@ -21,7 +21,6 @@ public class MyDynamicInfoVo {
private Long worldId;
private Long worldUid;
private String worldName;
private Boolean inWorld;
private String content;

View File

@@ -1,6 +1,6 @@
package com.accompany.business.vo;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
import lombok.Data;
import java.math.BigDecimal;
@@ -20,7 +20,7 @@ public class BillSearchVo {
private Integer giftId;
private Integer giftNum;
private String giftPict;
@I18nPartition(className = "Gift")
@I18n(className = "Gift")
private String giftName;
private BigDecimal amount;
private BigDecimal actualAmount;

View File

@@ -1,7 +1,7 @@
package com.accompany.business.vo;
import com.accompany.common.annotation.ReplaceAppDomain;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -52,7 +52,7 @@ public class DiamondGiveHistoryVo {
@ReplaceAppDomain
private String giftUrl;
@ApiModelProperty("礼物名称")
@I18nPartition(className = "Gift")
@I18n(className = "Gift")
private String giftName;
}

View File

@@ -1,7 +1,7 @@
package com.accompany.business.vo;
import com.accompany.common.annotation.ReplaceAppDomain;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
import com.accompany.core.vo.vip.VipBaseInfoVO;
import com.google.common.collect.Lists;
@@ -13,7 +13,7 @@ import java.util.List;
*/
public class GiftVo implements Comparable<GiftVo> {
private Integer giftId;
@I18nPartition(className = "Gift")
@I18n(className = "Gift")
private String giftName;
private Long goldPrice;
@ReplaceAppDomain

View File

@@ -1,6 +1,6 @@
package com.accompany.business.vo;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
/**
* Created by PaperCut on 2018/4/20.
@@ -8,10 +8,10 @@ import com.accompany.core.annotation.I18nPartition;
public class RoomTagVo {
private Integer id;
@I18nPartition(className = "RoomTag")
@I18n(className = "RoomTag")
private String name;
@I18nPartition(className = "RoomTag", fieldName = "name")
@I18n(className = "RoomTag", fieldName = "name")
private String pict;
private Integer seq;

View File

@@ -4,7 +4,7 @@ import com.accompany.business.vo.box.BoxSwitchVo;
import com.accompany.business.vo.findlove.FindLoveDrawSwitchVo;
import com.accompany.business.vo.treasure.SeizeTreasureSwitchConfig;
import com.accompany.common.annotation.ReplaceAppDomain;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
@@ -60,11 +60,11 @@ public class RoomVo implements Comparable<RoomVo> {
private Integer tagId;
@ReplaceAppDomain
@I18nPartition(className = "RoomTag")
@I18n(className = "RoomTag")
private String roomTag;
@ReplaceAppDomain
@I18nPartition(className = "RoomTag")
@I18n(className = "RoomTag")
private String tagPict;
private Byte officialRoom;
@@ -109,11 +109,6 @@ public class RoomVo implements Comparable<RoomVo> {
private Boolean leaveMode;//离开模式
/**
* 话题id
**/
private Long worldId;
private Byte hideFlag;
private Byte closeScreenFlag;
@@ -712,14 +707,6 @@ public class RoomVo implements Comparable<RoomVo> {
this.isPureMode = isPureMode;
}
public Long getWorldId() {
return worldId;
}
public void setWorldId(Long worldId) {
this.worldId = worldId;
}
public Byte getHideFlag() {
return hideFlag;
}

View File

@@ -1,7 +1,7 @@
package com.accompany.business.vo;
import com.accompany.common.annotation.ReplaceAppDomain;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
/**
* 用户背包展示实体
@@ -21,7 +21,7 @@ public class UserBackpackVo {
/**
* 礼物名称
*/
@I18nPartition(className = "Gift")
@I18n(className = "Gift")
private String giftName;
/**
* 价格

View File

@@ -1,7 +1,7 @@
package com.accompany.business.vo.car;
import com.accompany.common.annotation.ReplaceAppDomain;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
import java.util.Date;
@@ -13,7 +13,7 @@ public class CarGoodsVo {
private Integer nobleId;
@I18nPartition(className = "CarGoods")
@I18n(className = "CarGoods")
private String name;
@ReplaceAppDomain

View File

@@ -1,11 +1,11 @@
package com.accompany.business.vo.car;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
public class CarRecordVo {
private Long uid; // 账单用户
@I18nPartition(className = "CarGoods")
@I18n(className = "CarGoods")
private String optStr; // 如:续费
private String payStr; // 如:-2000元
private long recordTime;// 记录的时间

View File

@@ -1,7 +1,7 @@
package com.accompany.business.vo.dress;
import com.accompany.business.model.dress.UserChatBubble;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -16,7 +16,7 @@ import lombok.Data;
@Data
@ApiModel
public class UserChatBubbleVO extends UserChatBubble {
@I18nPartition(className = "ChatBubble")
@I18n(className = "ChatBubble")
@ApiModelProperty("气泡名称")
private String name;
@ApiModelProperty("来源1购买 2官方赠送")

View File

@@ -1,7 +1,7 @@
package com.accompany.business.vo.dress;
import com.accompany.common.annotation.ReplaceAppDomain;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -20,7 +20,7 @@ import java.util.Date;
public class UserInfoCardVO {
@ApiModelProperty(value = "资料卡id")
private Long cardId;
@I18nPartition(className = "InfoCard")
@I18n(className = "InfoCard")
@ApiModelProperty(value = "资料卡名称")
private String name;
@ApiModelProperty(value = "资料卡图片")

View File

@@ -1,6 +1,6 @@
package com.accompany.business.vo.gift;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -18,7 +18,7 @@ public class CompoundGiftVo {
@ApiModelProperty("礼物id")
private Integer giftId;
@ApiModelProperty("礼物名称")
@I18nPartition(className = "Gift")
@I18n(className = "Gift")
private String giftName;
@ApiModelProperty("礼物排序序号")
private Integer orderNo;

View File

@@ -1,7 +1,7 @@
package com.accompany.business.vo.gift;
import com.accompany.business.vo.GiftVo;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -17,7 +17,7 @@ public class NewUserGift {
/**
* 礼物名称
*/
@I18nPartition(className = "Gift")
@I18n(className = "Gift")
private String giftName;
/**
*礼物图片

View File

@@ -1,7 +1,7 @@
package com.accompany.business.vo.headwear;
import com.accompany.common.annotation.ReplaceAppDomain;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
import com.alibaba.fastjson.JSON;
import java.math.BigDecimal;
@@ -16,7 +16,7 @@ public class HeadwearVo {
private Integer headwearId;
@I18nPartition(className = "Headwear")
@I18n(className = "Headwear")
private String name;
@ReplaceAppDomain

View File

@@ -1,13 +1,13 @@
package com.accompany.business.vo.nameplate;
import com.accompany.business.model.Nameplate;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
import lombok.Data;
@Data
public class NameplateVo extends Nameplate {
@I18nPartition(className = "Nameplate")
@I18n(className = "Nameplate")
private String name;
}

View File

@@ -1,6 +1,6 @@
package com.accompany.business.vo.room;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
import lombok.Data;
import java.util.Date;
@@ -9,7 +9,7 @@ import java.util.Date;
public class RoomFreeGiftUserVo {
private Long uid;
private Integer giftId;
@I18nPartition(className = "Gift")
@I18n(className = "Gift")
private String giftName;
private Long goldPrice;
private String giftUrl;

View File

@@ -1,6 +1,6 @@
package com.accompany.business.vo.roomtab;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -16,7 +16,7 @@ public class HomeRoomTabVo {
@ApiModelProperty(value = "tab id")
private Long id;
@ApiModelProperty(value = "tab名称")
@I18nPartition(className = "RoomTab")
@I18n(className = "RoomTab")
private String name;
@ApiModelProperty(value = "tab排序")
private Integer seq;

View File

@@ -1,6 +1,6 @@
package com.accompany.business.vo.roomtab;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -14,7 +14,7 @@ public class RoomTabMapVo implements Serializable {
private Long erbanNo; // 房主靓号
private Long roomUid; // 房主uid
private String roomTitle; // 房间标题
@I18nPartition(className = "RoomTag")
@I18n(className = "RoomTag")
private String roomTag; // 房间标签
private Integer tabId; // 房间tab id
private Integer seq; // 排序

View File

@@ -1,6 +1,6 @@
package com.accompany.business.vo.roomtab;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
import lombok.Data;
import java.io.Serializable;
@@ -10,7 +10,7 @@ import java.util.Date;
public class RoomTabVo implements Serializable {
private Long id; // 主键ID
@I18nPartition(className = "RoomTab")
@I18n(className = "RoomTab")
private String name; // 名称
private Integer status; // 状态
private Integer seq; // 排序

View File

@@ -1,43 +0,0 @@
package com.accompany.business.event.listener;
import com.accompany.business.event.RoomCloseEvent;
import com.accompany.business.service.world.WorldRoomService;
import com.accompany.core.model.Room;
import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.scheduling.annotation.Async;
/**
* @Author: chucheng
* @Date: 2019/7/4 16:47
* @Description: 关闭话题房间
*/
//@Component
public class CloseWorldRoomListener implements ApplicationListener<RoomCloseEvent> {
private static final transient Logger logger = LoggerFactory.getLogger(CloseWorldRoomListener.class);
@Autowired
private WorldRoomService worldRoomService;
@Override
@Async
public void onApplicationEvent(RoomCloseEvent event) {
try {
Object object = event.getSource();
if (object instanceof Room) {
Room room = (Room)object;
logger.info("call.closeWorldRoom room={}", JSON.toJSONString(room));
worldRoomService.closeWorldRoom(room.getUid(),room.getRoomId());
}
}catch (Exception e){
logger.error("call.closeWorldRoom error,error:{}",e);
}
}
}

View File

@@ -72,17 +72,6 @@ public class CommunityBaseService extends BaseService {
return dynamic;
}
/**
* 根据动态id获取资源
* @param dynamicId
* @return
*/
public List<DynamicRes> getDynamicRes(Long dynamicId){
DynamicResCondition condition = new DynamicResCondition();
condition.setDynamicId(dynamicId);
condition.setOrderByAsc("id");
return iDynamicResService.selectDynamicResList(condition);
}
/**
* 验证动态是否合法
@@ -104,20 +93,6 @@ public class CommunityBaseService extends BaseService {
}
}
/**
* 判断是否绑定手机号
* @param uid
*/
public void validPhoneBind(Long uid) {
Users users = usersService.getUsersByUid(uid);
if(users == null){
throw new ServiceException(BusiStatus.USERNOTEXISTS);
}
if(users.getPhone() == null || users.getPhone().length() != 11) {
throw new ServiceException(BusiStatus.PHONE_NO_BIND);
}
}
/**
* 根据dynamicId查询评论列表
* @param dynamicId

View File

@@ -412,7 +412,6 @@ public class DynamicService extends CommunityBaseService {
if (null != world) {
dynamic.setWorldUid(world.getOwnerUid());
dynamic.setWorldName(world.getName());
dynamic.setInWorld(worldService.isInWorld(request.getUid(), dynamic.getWorldId()));
}
}
});
@@ -433,11 +432,16 @@ public class DynamicService extends CommunityBaseService {
*/
public int publish(DynamicPublishReq req) throws Exception {
Users u = usersService.getUsersByUid(req.getUid());
//判断是否绑定手机号
// validPhoneBind(req.getUid());
// 验证动态资源
validateDynamic(req.getType(), req.getContent(), req.getResList());
if(StringUtils.isNotBlank(req.getContent())) {
boolean hasSensitiveWord = YidunCheckUtil.checkHasSensitiveWord(StringEscapeUtils.escapeHtml4(req.getContent()));
if (hasSensitiveWord) {
throw new ServiceException(BusiStatus.HAS_SENSITIVE, "當前文本內容不符合規範,請修改后重試哦~");
}
}
String lockKey = RedisKey.lock_community_dynamic_publish.getKey(String.valueOf(req.getWorldId()),
String.valueOf(req.getUid()));
String lockVal = jedisLockService.lock(lockKey, 1000, 10000);
@@ -463,16 +467,7 @@ public class DynamicService extends CommunityBaseService {
dynamic.setUid(u.getUid());
dynamic.setPartitionId(u.getPartitionId());
dynamic.setType(req.getType());
if(StringUtils.isNotBlank(req.getContent())) {
// dynamic.setContent(dfaService.filterWord(
// SensitiveFilterUtil.getStringSensitiveFilter(
// StringEscapeUtils.escapeHtml4(req.getContent()))));
boolean hasSensitiveWord = YidunCheckUtil.checkHasSensitiveWord(StringEscapeUtils.escapeHtml4(req.getContent()));
if (hasSensitiveWord) {
throw new ServiceException(BusiStatus.HAS_SENSITIVE, "當前文本內容不符合規範,請修改后重試哦~");
}
dynamic.setContent(StringEscapeUtils.escapeHtml4(req.getContent()));
}
dynamic.setContent(StringEscapeUtils.escapeHtml4(req.getContent()));
return iDynamicService.insertDynamicAndRes(dynamic, req.getResList());
} finally {
if(StringUtils.isNotBlank(lockVal)) {
@@ -880,7 +875,6 @@ public class DynamicService extends CommunityBaseService {
if (null != world) {
vo.setWorldUid(world.getOwnerUid());
vo.setWorldName(world.getName());
vo.setInWorld(worldService.isInWorld(currentUid, record.getWorldId()));
}
// 等级
UserLevelExperience expLevel = levelService.getUserExper(record.getUid());

View File

@@ -376,9 +376,6 @@ public class DynamicSquareService extends CommunityBaseService {
if(type == TYPE_ALL_WORLD) {
return getAllWorld(uid, page, pageSize);
}
if(type == TYPE_MY_JOIN_WORLD) {
return getMyJoinWorld(uid, page, pageSize);
}
if(type == TYPE_RECOMMEND_WORLD) {
return getRecommendingWorlds(uid, page, pageSize);
}
@@ -410,7 +407,7 @@ public class DynamicSquareService extends CommunityBaseService {
if(null == world || world.getStatus() != WorldConstant.STATUS_VALID) {
continue;
}
result.add(convertWorldVo(world, worldService.isInWorld(uid, world.getId())));
result.add(convertWorldVo(world));
}
return result;
}
@@ -430,26 +427,10 @@ public class DynamicSquareService extends CommunityBaseService {
if(CollectionUtils.isEmpty(list)) {
return new ArrayList<>();
}
return list.stream().map(world -> convertWorldVo(world, worldService.isInWorld(uid, world.getId())))
return list.stream().map(world -> convertWorldVo(world))
.collect(Collectors.toList());
}
/**
* 获取我加入的世界
* @param uid
* @return
*/
private List<DynamicSquareWorldVo> getMyJoinWorld(Long uid, int page, int pageSize) {
IPage<World> iPage = iWorldService.queryMyJoinWorlds(uid, page, pageSize);
List<World> list = iPage.getRecords();
if(CollectionUtils.isEmpty(list)) {
return new ArrayList<>();
}
return list.stream().map(world -> convertWorldVo(world, true))
.collect(Collectors.toList());
}
/**
* 转换动态内容
* @param record
@@ -521,10 +502,9 @@ public class DynamicSquareService extends CommunityBaseService {
/**
* 对象转换
* @param world
* @param inWorld
* @return
*/
private DynamicSquareWorldVo convertWorldVo(World world, boolean inWorld) {
private DynamicSquareWorldVo convertWorldVo(World world) {
if(null == world) {
return null;
}
@@ -533,7 +513,6 @@ public class DynamicSquareService extends CommunityBaseService {
vo.setWorldName(world.getName());
vo.setDescription(world.getDescription());
vo.setIcon(world.getIcon());
vo.setInWorld(inWorld);
return vo;
}

View File

@@ -43,7 +43,6 @@ import com.accompany.business.service.miniGame.MiniGameSwitchRecordService;
import com.accompany.business.service.redenvelope.RedEnvelopeServerNotifySwitchService;
import com.accompany.business.service.redenvelope.RoomRedEnvelopeService;
import com.accompany.business.service.user.UsersService;
import com.accompany.business.service.world.WorldRoomService;
import com.accompany.business.util.TLSSigAPIv2;
import com.accompany.business.vo.*;
import com.accompany.business.vo.home.PlayRoomVo;
@@ -150,8 +149,6 @@ public class RoomService extends BaseService {
@Autowired
private ApplicationContext applicationContext;
@Autowired
private WorldRoomService worldRoomService;
@Autowired
private SuperAdminWebService superAdminWebService;
@Autowired
private LevelService levelService;
@@ -596,10 +593,6 @@ public class RoomService extends BaseService {
if (room.getShowGiftValue() != null && room.getShowGiftValue()) {
roomGiftValueService.cleanGiftValueCache(uid);
}
//如果是世界派对,则清除对应关系
if (room.getWorldId() != null && !Objects.equals(room.getWorldId(), 0L)) {
room.setWorldId(0L);
}
//通知云信房间信息变更
RoomNotifyVo roomNotifyVo = new RoomNotifyVo();
roomNotifyVo.setRoomInfo(gson.toJson(room));
@@ -1536,7 +1529,6 @@ public class RoomService extends BaseService {
roomVo.setIsPureMode(room.getIsPureMode() == null ? false : room.getIsPureMode());
roomVo.setShowGiftValue(room.getShowGiftValue() == null ? false : room.getShowGiftValue());
roomVo.setLeaveMode(room.getLeaveMode() == null ? false : room.getLeaveMode());
roomVo.setWorldId(room.getWorldId());
roomVo.setHideFlag(room.getHideFlag() != null ? room.getHideFlag() : (byte) 0);
roomVo.setCloseScreenFlag(room.getCloseScreenFlag() != null ? room.getCloseScreenFlag() : Constant.ScreenOperateRole.owner);
roomVo.setBlindDateState(room.getBlindDateState());
@@ -2605,75 +2597,6 @@ public class RoomService extends BaseService {
jedisService.hwrite(RedisKey.room.getKey(), room.getUid().toString(), roomStr);
}
/**
* 获取房间在线人数
*
* @param uid
* @return
*/
public Integer getOnlineNum(Long uid) {
String runningRoomStr = jedisService.hget(RedisKey.room_running.getKey(), uid.toString());
RunningRoomVo runningRoomVo = JSONObject.parseObject(runningRoomStr, RunningRoomVo.class);
if (runningRoomVo != null && runningRoomVo.getOnlineNum() != 0) {
return runningRoomVo.getOnlineNum();
}
return 0;
}
/**
* 关联世界,标识为世界派对
*
* @param roomUid
* @param worldId
* @throws Exception
*/
public JSONObject openWorldMode(Long roomUid, Long worldId) throws Exception {
Assert.notNull(roomUid, "roomUid is null");
Assert.notNull(worldId, "worldId is null");
Room room = getRoomByUid(roomUid);
if (room == null) {
throw new ServiceException(BusiStatus.ROOMNOTEXIST);
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("warn", "");
if (room.getWorldId() != null && !Objects.equals(room.getWorldId(), 0L) && !Objects.equals(room.getWorldId(), worldId)) {
jsonObject.put("warn", "创建成功 上个派对已解散");
}
// 创建世界派对关联表
worldRoomService.createWorldRoom(worldId, roomUid, room.getRoomId());
// 更新房间信息
room.setUpdateTime(new Date());
room.setWorldId(worldId);
updateRoomNeteaseAndDB(room);
worldRoomService.asyncScanRoomOnline(roomUid);
worldRoomService.asyncSendNotifyMsg(worldId);
worldRoomService.asyncUpdateUserInRoom(room.getRoomId(), worldId);
return jsonObject;
}
/**
* 取消关联世界,标识为普通房间
*
* @param roomUid
* @throws Exception
*/
public void closeWorldMode(Long roomUid) throws Exception {
Assert.notNull(roomUid, "roomUid is null");
Room room = getRoomByUid(roomUid);
if (room == null) {
throw new ServiceException(BusiStatus.ROOMNOTEXIST);
}
if (room.getWorldId() == null || Objects.equals(room.getWorldId(), 0L)) {
throw new ServiceException(BusiStatus.PARAMETERILLEGAL);
}
// 更新房间信息
room.setUpdateTime(new Date());
room.setWorldId(0L);
updateRoomNeteaseAndDB(room);
// 更新世界派对关联表
worldRoomService.closeWorldRoom(room.getUid(), room.getRoomId());
}
/**
* 刷新房间在线人数
*

View File

@@ -1,181 +0,0 @@
package com.accompany.business.service.world;
import com.accompany.business.service.level.LevelService;
import com.accompany.business.service.user.UserInRoomService;
import com.accompany.business.service.user.UsersService;
import com.accompany.business.vo.RoomVo;
import com.accompany.business.vo.WorldGroupChatMemberInfoVo;
import com.accompany.common.redis.RedisKey;
import com.accompany.core.base.BeanMapper;
import com.accompany.core.model.Users;
import com.accompany.core.service.base.BaseService;
import com.accompany.core.util.StringUtils;
import com.accompany.core.vo.UserLevelVo;
import com.accompany.world.constant.WorldConstant;
import com.accompany.world.entity.WorldGroupChat;
import com.accompany.world.entity.WorldGroupChatMember;
import com.accompany.world.query.WorldGroupChatMemberQuery;
import com.accompany.world.query.WorldGroupChatMemberSearchQuery;
import com.accompany.world.service.IWorldGroupChatMemberService;
import com.accompany.world.service.IWorldGroupChatService;
import com.accompany.world.vo.WorldGroupChatMemberVo;
import com.accompany.world.vo.WorldRoomVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* @Author fangchengyan
* @Date: 2019/7/1 14:06
* @Description:
*/
@Slf4j
@Service
public class WorldGroupChatMemberService extends BaseService {
@Autowired
private IWorldGroupChatMemberService iWorldGroupChatMemberService;
@Autowired
private UsersService usersService;
@Autowired
private IWorldGroupChatService iworldGroupChatService;
@Autowired
private WorldRoomService worldRoomService;
@Autowired
private UserInRoomService userInRoomService;
@Autowired
private LevelService levelService;
public Object getChatMemberByPage(Long chatId, String searchKey, int page, int pageSize){
Map<String,Object> result = Maps.newHashMap();
List<WorldGroupChatMemberVo> queryList = null;
List<WorldGroupChatMemberInfoVo> resultList = Lists.newArrayList();
WorldGroupChat worldGroupChat = iworldGroupChatService.getById(chatId);
if(null == worldGroupChat) {
log.warn("chatId为{}的群聊不存在!", chatId);
return resultList;
}
// 客户端要求搜索不带分页
if(StringUtils.isNotBlank(searchKey)){
WorldGroupChatMemberSearchQuery query = new WorldGroupChatMemberSearchQuery();
query.setChatId(chatId);
query.setSearchKey(searchKey);
queryList = iWorldGroupChatMemberService.getChatMemberVoBySearchKey(query);
result.put("total", queryList != null ? queryList.size() : 0);
}else{
WorldGroupChatMemberQuery query = new WorldGroupChatMemberQuery();
query.setChatId(chatId);
query.setPage(page);
query.setPageSize(pageSize);
IPage<WorldGroupChatMember> chatMemberPage = iWorldGroupChatMemberService.queryForPage(query);
if(CollectionUtils.isNotEmpty(chatMemberPage.getRecords())) {
queryList = chatMemberPage.getRecords().stream().map(member -> {
WorldGroupChatMemberVo vo = new WorldGroupChatMemberVo();
vo.setId(member.getId());
vo.setRole(member.getRole());
vo.setWorldId(member.getWorldId());
vo.setChatId(member.getChatId());
vo.setUid(member.getUid());
Users users = usersService.getUsersByUid(member.getUid());
if(users != null) {
vo.setAvatar(users.getAvatar());
vo.setGender(users.getGender());
vo.setNick(users.getNick());
}
return vo;
}).collect(Collectors.toList());
} else {
queryList = new ArrayList<>();
}
result.put("total", chatMemberPage.getTotal());
result.put("records", queryList);
}
if(CollectionUtils.isEmpty(queryList)){
return result;
}
for(WorldGroupChatMemberVo vo : queryList){
WorldGroupChatMemberInfoVo infoVo = BeanMapper.map(vo, WorldGroupChatMemberInfoVo.class);
infoVo.setOwnerFlag(WorldConstant.WorldGroupChatRole.creator == vo.getRole());
resultList.add(infoVo);
}
// 获取在房情况
setUserInRoomInfo(worldGroupChat.getWorldId(), resultList);
// 获取在线情况
setOnlineStatus(resultList);
// 获取等级,魅力
setUserLevel(resultList);
result.put("records",resultList);
return result;
}
/**
* 获取唯一的记录
* @param chatId
* @param uid
* @return
*/
public WorldGroupChatMember getUniqueChatMember(Long chatId, Long uid) {
return iWorldGroupChatMemberService.getUniqueChatMember(chatId, uid);
}
/**
* 设置在派对情况
* @param worldId
* @param list
*/
private void setUserInRoomInfo(Long worldId, List<WorldGroupChatMemberInfoVo> list){
// 获取当前正在进行的世界派对
List<WorldRoomVo> worldRoomVos = worldRoomService.getWorldRoomList(worldId);
if(CollectionUtils.isEmpty(worldRoomVos) ){
return;
}
List<String> uids = list.stream().map(vo ->vo.getUid().toString()).collect(Collectors.toList());
List<String> roomVos = userInRoomService.batchGetUserInRoomCache(uids.toArray(new String[uids.size()]));
roomVos = Optional.ofNullable(roomVos).orElse(Lists.newArrayList())
.stream().filter(item->item!=null).collect(Collectors.toList());
if(CollectionUtils.isEmpty(roomVos)){
return;
}
RoomVo room = null;
// key=roomUid
Map<Long,WorldRoomVo> worldRoomVoMap = worldRoomVos.stream().collect(Collectors.toMap(WorldRoomVo::getRoomUid, a -> a,(k1, k2)->k1));
for(WorldGroupChatMemberInfoVo vo : list){
room = userInRoomService.getUserInRoomInfoCache(vo.getUid());
if(room == null){
continue;
}
if(worldRoomVoMap.containsKey(room.getUid())){
vo.setCurrentRoomUid(room.getUid());
}
}
}
/**
* 设置等级、魅力
* @param list
*/
private void setUserLevel(List<WorldGroupChatMemberInfoVo> list){
List<String> uids = list.stream().map(vo ->vo.getUid().toString()).collect(Collectors.toList());
Map<Long, UserLevelVo> userLevelVoMap = levelService.getUserLevelVoMap(uids.toArray(new String[uids.size()]));
for(WorldGroupChatMemberInfoVo vo : list){
vo.setUserLevelVo(userLevelVoMap.get(vo.getUid()));
}
}
private void setOnlineStatus(List<WorldGroupChatMemberInfoVo> list){
for(WorldGroupChatMemberInfoVo vo : list){
String value = jedisService.hget(RedisKey.user_online_status.getKey(), vo.getUid().toString());
vo.setOnlineFlag(value!=null);
}
}
}

View File

@@ -1,831 +0,0 @@
package com.accompany.business.service.world;
import com.accompany.business.param.GroupChatParam;
import com.accompany.business.param.neteasepush.NeteasePushParam;
import com.accompany.business.sensitvienew.SensitiveFilterUtil;
import com.accompany.business.service.ErBanNetEaseService;
import com.accompany.business.service.SendSysMsgService;
import com.accompany.business.service.room.RoomService;
import com.accompany.business.service.user.UserInRoomService;
import com.accompany.business.service.user.UsersService;
import com.accompany.business.vo.*;
import com.accompany.common.config.SystemConfig;
import com.accompany.common.constant.Attach;
import com.accompany.common.constant.Constant;
import com.accompany.common.netease.neteaseacc.constant.NetEaseCode;
import com.accompany.common.redis.RedisKey;
import com.accompany.common.status.BusiStatus;
import com.accompany.common.utils.StringUtils;
import com.accompany.core.exception.ServiceException;
import com.accompany.core.model.Users;
import com.accompany.core.service.SysConfService;
import com.accompany.core.service.base.BaseService;
import com.accompany.world.constant.WorldConstant;
import com.accompany.world.entity.World;
import com.accompany.world.entity.WorldGroupChat;
import com.accompany.world.entity.WorldMember;
import com.accompany.world.query.WorldGroupChatQuery;
import com.accompany.world.query.WorldMemberQuery;
import com.accompany.world.service.IWorldGroupChatMemberService;
import com.accompany.world.service.IWorldGroupChatService;
import com.accompany.world.service.IWorldMemberService;
import com.accompany.world.service.IWorldService;
import com.accompany.world.vo.SimpleTopicVo;
import com.accompany.world.vo.WorldGroupChatVo;
import com.accompany.world.vo.WorldRoomVo;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.RateLimiter;
import lombok.SneakyThrows;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors;
/**
* @Author: chucheng
* @Date: 2019/7/1 14:06
* @Description: 话题群聊
*/
@Service
public class WorldGroupChatService extends BaseService {
@Autowired
private IWorldGroupChatService iWorldGroupChatService;
@Autowired
private IWorldGroupChatMemberService iWorldGroupChatMemberService;
@Autowired
private IWorldService iWorldService;
@Autowired
private IWorldMemberService iWorldMemberService;
@Autowired
private WorldMemberService worldMemberService;
@Autowired
private WorldRoomService worldRoomService;
@Autowired
private WorldService worldService;
@Autowired
private WorldGroupChatTopicService worldGroupChatTopicService;
@Resource(name = "bizExecutor")
private ThreadPoolExecutor bizExecutor;
@Autowired
private SendSysMsgService sendSysMsgService;
@Autowired
private UserInRoomService userInRoomService;
@Autowired
private ErBanNetEaseService erBanNetEaseService;
@Autowired
private SysConfService sysConfService;
@Autowired
private RoomService roomService;
@Autowired
private WorldGroupChatService worldGroupChatService;
@Autowired
private UsersService usersService;
@Autowired
private WorldMessageService messageService;
private RateLimiter limiter = RateLimiter.create(20);
/**
* 获取群聊信息
* @param tid
* @param uid
* @return
*/
public WorldGroupChatVo getGroupChatInfo(String tid,Long uid) {
WorldGroupChatVo groupChatVo = iWorldGroupChatService.getGroupChatInfo(tid);
if(groupChatVo == null){
throw new ServiceException(BusiStatus.PARAMETERILLEGAL);
}
//获取派对以及人数
summaryMemberInWorldRoomInfo(groupChatVo);
return groupChatVo;
}
public WorldGroupChat getByTid(String tid) {
return iWorldGroupChatService.getByTid(tid);
}
/**
* 更新群聊名称、话题
* @param inParam
*/
public void updateGroupChat(WorldGroupChatQuery inParam) throws Exception {
boolean lock = this.jedisService.setnx(RedisKey.world_group_chat_update_lock.getKey(inParam.getChatId().toString()),"1",10);
if (!lock) {
throw new ServiceException(BusiStatus.REQUEST_FAST);
}
logger.info("world-group-chat updateGroupChat,inParam={}",gson.toJson(inParam));
try {
WorldGroupChat groupChat = getById(inParam.getChatId());
if (groupChat == null || !Objects.equals(groupChat.getUid(),inParam.getUid())) {
throw new ServiceException(BusiStatus.PARAMETERILLEGAL);
}
boolean updateName = StringUtils.isNotBlank(inParam.getName());
boolean updateTopic = StringUtils.isNotBlank(inParam.getTopic());
boolean updateIcon = StringUtils.isNotBlank(inParam.getIcon());
if (updateName) {
checkString(inParam.getName());
groupChat.setName(inParam.getName());
groupChat.setUpdateTime(new Date());
// 通知云信更新群资料
if (updateNetEaseGroupChatName(groupChat)) {
int count = iWorldGroupChatService.updateWorldGroupChat(groupChat);
if (count == 0) {
throw new ServiceException(BusiStatus.REQUEST_PARAM_ERROR);
}
}
}
if (updateTopic) {
checkString(inParam.getTopic());
groupChat.setTopic(inParam.getTopic());
groupChat.setUpdateTime(new Date());
int count = iWorldGroupChatService.updateWorldGroupChat(groupChat);
if (count == 0) {
throw new ServiceException(BusiStatus.REQUEST_PARAM_ERROR);
}
// 发送自定义系统通知更新群聊话题
NeteasePushParam param = buildGroupChatTopicMsg(groupChat.getWorldId(), groupChat.getTid(), groupChat.getTopic());
// 发送消息
sendSysMsgService.sendSysAttachMsg(param);
}
if(updateIcon) {
GroupChatParam param = new GroupChatParam();
param.setTid(groupChat.getTid());
param.setOwner(groupChat.getUid().toString());
param.setIcon(inParam.getIcon());
NetEaseResult ret = erBanNetEaseService.updateGroupChat(param);
if(null == ret || !ret.isSuccess()) {
throw new ServiceException(BusiStatus.REQUEST_PARAM_ERROR);
}
}
}finally {
this.jedisService.del(RedisKey.world_group_chat_update_lock.getKey(inParam.getChatId().toString()));
}
}
public WorldGroupChat getById(Long chatId){
return iWorldGroupChatService.getById(chatId);
}
public List<WorldGroupChat> getByWorldId(Long worldId){
// 话题可以有多个群聊
List<WorldGroupChat> list = iWorldGroupChatService.getByWorldId(worldId);
if(CollectionUtils.isEmpty(list)){
return null;
}
return list;
}
/**
* 打开/关闭消息提醒
* @param chatId
* @param uid
* @param ope
* @throws Exception
*/
public void mute(Long chatId,Long uid,boolean ope)throws Exception{
logger.info("world-group-chat mute,chatId={},uid={},ope={}",chatId,uid,ope);
WorldGroupChat groupChat = getById(chatId);
if(groupChat == null || !Objects.equals(groupChat.getStatus(),WorldConstant.WorldGroupChatStatus.normal)){
return;
}
NetEaseResult ret = erBanNetEaseService.muteTeam(groupChat.getTid(), uid.toString(), ope?2:1);
if(!ret.isSuccess()) {
logger.error("world-group-chat mute error,chatId={},uid={},ope={},NetEaseResult={}",chatId,uid,ope,gson.toJson(ret));
throw new ServiceException(BusiStatus.SERVEXCEPTION);
}
this.iWorldMemberService.updateMemberToMute(groupChat.getWorldId(),uid,ope);
}
/**
* 解散群聊
* @param worldId
* @param uid
* @throws Exception
*/
public void removeGroupChat(Long worldId,Long uid) {
List<WorldGroupChat> groupChats = getByWorldId(worldId);
if(groupChats == null){
// 没有群聊
return;
}
for (WorldGroupChat groupChat : groupChats) {
if( !Objects.equals(groupChat.getStatus(),WorldConstant.WorldGroupChatStatus.normal)
|| !Objects.equals(groupChat.getUid(),uid)){
continue;
}
removeGroupChat(groupChat.getWorldId(), groupChat.getId(), groupChat.getTid(), groupChat.getUid());
}
}
/**
* 退出群聊
* @param worldId
* @param uid
* @param leaveType {@link com.accompany.world.constant.WorldConstant.LeaveGroupChatType}
* @param needNotify 是否发送退出群聊通知
* @throws Exception
*/
public void leaveGroupChat(Long worldId, Long uid, int leaveType, boolean needNotify)throws Exception {
List<WorldGroupChat> groupChats = getByWorldId(worldId);
if(groupChats == null){
// 没有群聊
return;
}
for (WorldGroupChat groupChat : groupChats) {
leaveGroupChatByChatId(groupChat.getId(), uid, leaveType, needNotify);
}
}
/**
* 退出群聊
* @param chatId
* @param uid
* @param leaveType {@link com.accompany.world.constant.WorldConstant.LeaveGroupChatType}
* @param needNotify 是否发送退出群聊通知
* @throws Exception
*/
public boolean leaveGroupChatByChatId(Long chatId, Long uid, int leaveType, boolean needNotify)throws Exception {
WorldGroupChat groupChat = getById(chatId);
if(groupChat == null){
// 没有群聊
return false;
}
boolean result = leaveGroupChat(leaveType, groupChat.getTid(), groupChat.getUid(), uid.toString());
if(result) {
iWorldGroupChatMemberService.deleteChatMember(chatId, uid);
if(needNotify) {
// 发送消息提醒
World world = iWorldService.getByIdFromCache(groupChat.getWorldId());
Users user = usersService.getUsersByUid(uid);
Users owner = usersService.getUsersByUid(world.getOwnerUid());
messageService.sendExitGroupChatMessage(world, groupChat, user, owner, leaveType);
}
}
return result;
}
/**
* 解散群聊
* @param chatId 服务端群聊id
* @param tid 云信群聊id
* @param ownerUid 群主id
* @throws Exception
*/
@SneakyThrows
private void removeGroupChat(Long worldId,Long chatId,String tid,Long ownerUid) {
NetEaseResult ret = erBanNetEaseService.removeGroupChat(tid, ownerUid.toString());
if(!ret.isSuccess()){
logger.error("world-group-chat removeGroupChat error,tid={},ownerUid={},NetEaseResult={}",tid,ownerUid,gson.toJson(ret));
throw new ServiceException(BusiStatus.SERVEXCEPTION);
}
// 改变群聊状态
WorldGroupChat groupChat = getById(chatId);
groupChat.setStatus(WorldConstant.WorldGroupChatStatus.delete);
groupChat.setUpdateTime(new Date());
iWorldGroupChatService.updateWorldGroupChat(groupChat);
// 更新当前世界所有正在派对标识
cleanAllRoomWorldFlag(worldId);
}
/**
* 退出群聊
* @param type 移除类型0.被动出群 1.主动出群
* @param tid 云信群聊tid
* @param ownerUid 群主uid
* @param uid 被移除人uid
*/
private boolean leaveGroupChat(int type, String tid, Long ownerUid, String uid) throws Exception {
boolean resultFlag = false;
NetEaseResult ret = erBanNetEaseService.leave(tid, uid);
if(ret.isSuccess()) {
resultFlag = true;
} else {
// 当用户不在群里时退群会报414此时可看作用户退群成功: {"desc":"accid not team member","code":414}
if(ret.getCode() == NetEaseCode.PARAM_ERROR.value()) {
resultFlag = true;
} else {
logger.error("world-group-chat leaveGroupChat error,NetEaseResult={},type={},tid={},ownerUid={},uids={}",
gson.toJson(ret), type, tid, ownerUid, uid);
}
}
if(resultFlag){
// 更新当前被踢出者的世界派对标识
cleanRoomWorldFlag(uid);
}
return resultFlag;
}
/**
* 处理群聊
* @param worldId
* @param uid
* @return
* @throws Exception
*/
public Long handleGroupChat(Long worldId, Long uid) throws Exception {
String lockVal = this.jedisLockService.lock(RedisKey.world_group_chat_create_lock.getKey(worldId.toString()));
try {
if (StringUtils.isEmpty(lockVal)) {
throw new ServiceException(BusiStatus.REQUEST_FAST);
}
// 群聊是否存在
WorldGroupChat groupChat = iWorldGroupChatService.getOneByWorldId(worldId);
if(groupChat != null){
if(iWorldGroupChatMemberService.countChatMember(groupChat.getId()) >= WorldConstant.MAX_GROUP_CHAT_MEMBER_NUM) {
throw new ServiceException(BusiStatus.GROUP_CHAT_IS_FULL);
}
// 加入群聊
joinToGroupChat(groupChat.getTid(), worldId, uid, groupChat.getId(),"加入群聊");
return groupChat.getId();
}else{
int count = iWorldService.getWorldMemberNum(worldId);
// 默认人数大于3人创建群聊
int num = 3;
String createGroupChatNum = sysConfService.getSysConfValueById(Constant.SysConfId.WORLD_GROUP_CHAT_CREATE_NUM);
if(NumberUtils.isDigits(createGroupChatNum)) {
num = NumberUtils.toInt(createGroupChatNum);
}
if(count >= num){
return createGroupChat(worldId);
} else {
throw new ServiceException(BusiStatus.WORLD_MEMBER_NOT_ENOUGH);
}
}
} finally {
this.jedisLockService.unlock(RedisKey.world_group_chat_create_lock.getKey(worldId.toString()), lockVal);
}
}
/**
* 处理群聊
* @param chatId
* @return
* @throws Exception
*/
public Long handleGroupChatByChatId(Long chatId, Long uid) throws Exception {
WorldGroupChat groupChat = iWorldGroupChatService.getById(chatId);
if(null == groupChat) {
logger.warn("chatId为{}的群不存在!", chatId);
return 0L;
}
String lockVal = this.jedisLockService.lock(RedisKey.world_group_chat_create_lock.getKey(groupChat.getWorldId().toString()));
try {
if (StringUtils.isEmpty(lockVal)) {
throw new ServiceException(BusiStatus.REQUEST_FAST);
}
if(iWorldGroupChatMemberService.countChatMember(groupChat.getId()) >= WorldConstant.MAX_GROUP_CHAT_MEMBER_NUM) {
throw new ServiceException(BusiStatus.GROUP_CHAT_IS_FULL);
}
// 加入群聊
joinToGroupChat(groupChat.getTid(), groupChat.getWorldId(), uid, chatId,"加入群聊");
return groupChat.getId();
} finally {
if(StringUtils.isNotEmpty(lockVal)) {
this.jedisLockService.unlock(RedisKey.world_group_chat_create_lock.getKey(chatId.toString()), lockVal);
}
}
}
/**
* 移交群主
* @param worldId 世界Id
* @param chatId 群聊id
* @param ownerUid 原群主uid
* @param newownerUid 新群主uid
* @throws Exception
*/
public void changeGroupChatOwner(Long worldId,Long chatId,Long ownerUid,Long newownerUid)throws Exception {
World world = iWorldService.getByIdFromCache(worldId);
if(world.getMemberNum() == WorldConstant.MAX_GROUP_CHAT_MEMBER_NUM
&& !iWorldService.isInWorld(newownerUid, worldId)){
throw new ServiceException(BusiStatus.WORLD_IS_FULL);
}
WorldGroupChat groupChat = this.getById(chatId);
if(null == groupChat || !WorldConstant.WorldGroupChatStatus.normal.equals(groupChat.getStatus())
|| !groupChat.getUid().equals(ownerUid)){
throw new ServiceException(BusiStatus.REQUEST_PARAM_ERROR);
}
logger.info("world-group-chat changeGroupChatOwner chatId={},ownerUid={},newownerUid={}",chatId,ownerUid,newownerUid);
NetEaseResult result = erBanNetEaseService.changeOwner(groupChat.getTid(), groupChat.getUid().toString(),newownerUid.toString(),2);
if (!result.isSuccess()) {
logger.error("world-group-chat changeGroupChatOwner error: cause by NetEaseResult={},chatId={},ownerUid={},newownerUid={}",
gson.toJson(result),chatId,ownerUid,newownerUid);
throw new ServiceException(BusiStatus.SERVEXCEPTION);
}
this.iWorldGroupChatService.changeGroupChatOwner(chatId, ownerUid, newownerUid);
//个性群聊成员角色
this.iWorldGroupChatMemberService.updateMemberRole(worldId, ownerUid, WorldConstant.WorldGroupChatRole.normal);
this.iWorldGroupChatMemberService.updateMemberRole(worldId, newownerUid, WorldConstant.WorldGroupChatRole.creator);
}
/**
* 根据worldId查询一个话题群聊
* @param worldId
* @return
*/
public WorldGroupChat getOneByWorldId(Long worldId) {
return iWorldGroupChatService.getOneByWorldId(worldId);
}
/**
* 加入群聊
* @param worldId
* @param uid
*/
private void joinToGroupChat(String tid, Long worldId, Long uid, Long chatId, String msg) throws Exception {
World world = worldService.getByIdFromCache(worldId);
if(null == world || world.getStatus() != WorldConstant.STATUS_VALID){
logger.warn("用户【{}】加入群聊【{}】失败,原因:话题【{}】不存在或状态非有效状态", uid, chatId, worldId);
throw new ServiceException(BusiStatus.REQUEST_PARAM_ERROR);
}
WorldMemberQuery creatorQuery = new WorldMemberQuery();
creatorQuery.setWorldId(worldId);
creatorQuery.setUid(uid);
creatorQuery.setStatus(WorldConstant.WorldMemberStatus.normal);
creatorQuery.setLimit(1);
List<WorldMember> members = worldMemberService.getWorldMember(creatorQuery);
if(CollectionUtils.isEmpty(members)){
logger.warn("用户【{}】加入群聊【{}】失败,原因:该用户非话题【{}】有效成员!", uid, chatId, worldId);
throw new ServiceException(BusiStatus.REQUEST_PARAM_ERROR);
}
// 当数据库中的数据与云信的数据不一致时,该校验会导致用户永远也无法加入群聊
// WorldGroupChatMember chatMember = iWorldGroupChatMemberService.getUniqueChatMember(chatId, uid);
// ParamUtils.isNull(chatMember, "您已加入了该群聊,请勿重复加入!");
NetEaseResult result = erBanNetEaseService.addMember(tid, world.getOwnerUid().toString(),
JSON.toJSONString(Arrays.asList(uid.toString())), 0, msg);
if (!result.isSuccess()) {
logger.error("world-group-chat joinToGroupChat error: cause by NetEaseResult={}",gson.toJson(result));
if(result.getCode() == NetEaseCode.NUM_LIMIT.value()) {
throw new ServiceException(BusiStatus.GROUP_CHAT_IS_FULL);
} else if(result.getCode() == NetEaseCode.GROUP_NOTEXISTS.value()) {
throw new ServiceException(NetEaseCode.GROUP_NOTEXISTS.getMsg());
} else if(result.getCode() == NetEaseCode.GROUPMEM_ERROR.value()) {
throw new ServiceException(NetEaseCode.GROUPMEM_ERROR.getMsg());
} else if(result.getCode() == NetEaseCode.ALREADY_INGROUP.value()) {
// 这种时候,可以看作是添加成功了
iWorldGroupChatMemberService.insertOrUpdate(members.get(0), world.getOwnerUid(), chatId, tid);
return;
}
throw new ServiceException(BusiStatus.SERVEXCEPTION);
} else {
iWorldGroupChatMemberService.insertOrUpdate(members.get(0), world.getOwnerUid(), chatId, tid);
}
}
/**
* 创建群聊
* @param worldId
* @return
* @throws Exception
*/
private Long createGroupChat(Long worldId) throws Exception {
World world = worldService.getByIdFromCache(worldId);
if(null == world || world.getStatus() != WorldConstant.STATUS_VALID){
throw new ServiceException(BusiStatus.REQUEST_PARAM_ERROR);
}
WorldMemberQuery query = new WorldMemberQuery();
query.setWorldId(worldId);
query.setStatus(WorldConstant.WorldMemberStatus.normal);
// 获取世界成员,初次创建时,将世界成员全部加入到群聊中
List<WorldMember> allMemberList = worldMemberService.getWorldMember(query);
List<String> members = allMemberList.stream().map(member->member.getUid().toString()).collect(Collectors.toList());
GroupChatParam param = this.buildGroupChatParam(world.getOwnerUid(), world.getIcon(), world.getName(), members, null);
CreateChatResult ret = erBanNetEaseService.createGroupChat(param);
if (!ret.isSuccess()) {
logger.error("world-group-chat createGroupChat error.CreateChatResult={}",gson.toJson(ret));
throw new ServiceException(BusiStatus.SERVEXCEPTION);
}
// 随机获取话题
SimpleTopicVo topicVo = worldGroupChatTopicService.getRandomOne();
WorldGroupChat chat = this.buildGroupChat(world,ret.getTid(), topicVo!=null?topicVo.getTopic():null);
//插入群聊表
int result = this.iWorldGroupChatService.insertWorldGroupChat(chat);
if (result > 0) {
// 添加群聊成员
iWorldGroupChatMemberService.insertOrUpdateBatch(allMemberList, world.getOwnerUid(), chat.getId(), ret.getTid());
// 初始化消息提醒状态
initGroupChatMemberMute(chat,allMemberList);
return chat.getId();
}
return null;
}
/**
* 创建群聊时初始化用户消息提醒状态,云信默认是打开状态
* @param chat
* @param memberList
*/
private void initGroupChatMemberMute(WorldGroupChat chat,List<WorldMember> memberList){
bizExecutor.execute(() -> {
if(CollectionUtils.isEmpty(memberList)){
return;
}
for(WorldMember member : memberList){
if(Objects.equals(member.getPromtFlag(),WorldConstant.WorldMemberPromtFlag.close)){
try {
this.mute(chat.getId(),member.getUid(),false);
}catch (Exception e){
logger.error("world-group-chat initGroupChatMemberMute error.chatId={},uid={}",chat.getId(),member.getUid());
}
}
}
});
}
/**
* 构建创建群聊参数
* @param uid
* @param icon
* @param name
* @param members
* @param notice
* @return
*/
private GroupChatParam buildGroupChatParam(Long uid, String icon, String name, List<String> members, String notice) {
GroupChatParam param = new GroupChatParam();
param.setTname(name);
param.setOwner(uid.toString());
param.setMagree(0);
param.setJoinmode(0);
param.setIcon(icon);
param.setMsg(name);
param.setAnnouncement(notice);
param.setMembers(JSON.toJSONString(members));
JSONObject jsonObject = new JSONObject();//自定义字段,定义群聊类型
jsonObject.put("type", Constant.GroupChatType.world);
param.setCustom(JSON.toJSONString(jsonObject));
return param;
}
private WorldGroupChat buildGroupChat(World world,String tid,String topic) {
WorldGroupChat chat = new WorldGroupChat();
chat.setTid(tid);
chat.setWorldId(world.getId());
chat.setUid(world.getOwnerUid());
chat.setName(world.getName());
chat.setTopic(topic);
chat.setStatus(WorldConstant.WorldGroupChatStatus.normal);
chat.setCreateTime(new Date());
return chat;
}
/**
* 云信更新群聊名称
* @param groupChat
* @return
* @throws Exception
*/
private boolean updateNetEaseGroupChatName(WorldGroupChat groupChat) throws Exception {
GroupChatParam param = new GroupChatParam();
param.setTid(groupChat.getTid());
param.setOwner(groupChat.getUid().toString());
param.setTname(groupChat.getName());
logger.info("world-group-chat updateNetEaseGroupChatName before:param={}",gson.toJson(param));
NetEaseResult ret = erBanNetEaseService.updateGroupChat(param);
logger.info("world-group-chat updateNetEaseGroupChatName after:param={},result={}",gson.toJson(param),gson.toJson(ret));
return ret.isSuccess();
}
/**
* 检测字符串是否合法
* @param str
* @throws Exception
*/
private void checkString(String str) throws Exception {
// 敏感词检验
boolean isSensitive = SensitiveFilterUtil.getBooleanSensitiveFilter(str.trim());
if (isSensitive) {
throw new ServiceException(BusiStatus.WORLD_WORD_SENSITIVE);
}
//不能超过16个字
if (str.length() > 16) {
throw new ServiceException(BusiStatus.WORLD_WORD_TOO_LONG);
}
}
/**
* 异步发送群聊派对人数消息
* @param worldId
*/
public void asyncSendNotifyMsg(Long worldId){
WorldGroupChat groupChat = iWorldGroupChatService.getOneByWorldId(worldId);
if(groupChat == null){
return;
}
// 同个世界该操作限制7秒钟
boolean lock = this.jedisService.setnx(RedisKey.world_group_chat_push_lock.getKey(worldId.toString()),"1",7);
if (!lock) {
return;
}
if(!limiter.tryAcquire()){
// 限流
logger.error("world-group-chat asyncSendNotifyMsg,Fail to acquire token.worldId={}",worldId);
return;
}
// 查询当前在派对中的总人数及其房间uid此处通过查询缓存的方式筛选
List<WorldRoomVo> worldRoomVos = worldRoomService.getWorldRoomList(worldId);
if(CollectionUtils.isEmpty(worldRoomVos)){
return;
}
List<Long> roomUids = Optional.ofNullable(worldRoomVos).orElse(Lists.newArrayList())
.stream().map(worldRoomVo->worldRoomVo.getRoomUid()).collect(Collectors.toList());
WorldMemberQuery query = new WorldMemberQuery();
query.setWorldId(worldId);
query.setStatus(WorldConstant.WorldMemberStatus.normal);
// 获取世界成员,世界成员即群聊成员
List<WorldMember> allMemberList = worldMemberService.getWorldMember(query);
List<String> uids = Optional.ofNullable(allMemberList).orElse(Lists.newArrayList())
.stream().map(member->member.getUid().toString()).collect(Collectors.toList());
int count = countMemberInWorldRoom(worldRoomVos,uids);
if(count > 0){
// 构建消息体
NeteasePushParam param = buildGroupChatRoomMemberMsg(worldId,groupChat.getTid(),count,roomUids);
// 发送消息
sendSysMsgService.sendSysAttachMsg(param);
}
logger.info("world-group-chat asyncSendNotifyMsg: worldId={}",worldId);
}
/**
* 统计房间及人数
* @param groupChatVo
*/
private void summaryMemberInWorldRoomInfo(WorldGroupChatVo groupChatVo){
// 查询当前在派对中的总人数及其房间uid此处通过查询缓存的方式筛选
List<WorldRoomVo> worldRoomVos = worldRoomService.getWorldRoomList(groupChatVo.getWorldId());
if(CollectionUtils.isEmpty(worldRoomVos)){
groupChatVo.setCount(0);
return;
}
List<Long> roomUids = Optional.ofNullable(worldRoomVos).orElse(Lists.newArrayList())
.stream().map(worldRoomVo->worldRoomVo.getRoomUid()).collect(Collectors.toList());
WorldMemberQuery query = new WorldMemberQuery();
query.setWorldId(groupChatVo.getWorldId());
query.setStatus(WorldConstant.WorldMemberStatus.normal);
// 获取世界成员,世界成员即群聊成员
List<WorldMember> allMemberList = worldMemberService.getWorldMember(query);
List<String> uids = Optional.ofNullable(allMemberList).orElse(Lists.newArrayList())
.stream().map(member->member.getUid().toString()).collect(Collectors.toList());
logger.info("world-group-chat summaryMemberInWorldRoomInfo,roomUids={},uids={}",roomUids,uids);
groupChatVo.setCount(countMemberInWorldRoom(worldRoomVos,uids));
groupChatVo.setRoomUids(roomUids);
}
/**
* 统计群员在世界派对人数
* @param worldRoomVos
* @param uids
* @return
*/
private int countMemberInWorldRoom(List<WorldRoomVo> worldRoomVos,List<String> uids){
int count = 0;
if(CollectionUtils.isEmpty(worldRoomVos)){
return count;
}
// 获取所有群员在房情况 一个群最多大概200人
List<String> roomVos = userInRoomService.batchGetUserInRoomCache(uids.toArray(new String[uids.size()]));
roomVos = Optional.ofNullable(roomVos).orElse(Lists.newArrayList())
.stream().filter(item->item!=null).collect(Collectors.toList());
if(CollectionUtils.isEmpty(roomVos)){
return count;
}
RoomVo room = null;
// key=roomUid
Map<Long,WorldRoomVo> worldRoomVoMap = worldRoomVos.stream().collect(Collectors.toMap(WorldRoomVo::getRoomUid, a -> a,(k1, k2)->k1));
for(String roomStr : roomVos){
room = gson.fromJson(roomStr, RoomVo.class);
count += worldRoomVoMap.containsKey(room.getUid())?1:0;
}
logger.info("world-group-chat countMemberInWorldRoom: roomCount={},memberCount={}",worldRoomVos.size(),count);
return count;
}
/**
* 构建群聊系统通知消息体 (更新派对人数)
* @param worldId
* @param tid
* @param count
* @param roomUids
* @return
*/
private NeteasePushParam buildGroupChatRoomMemberMsg(long worldId,String tid,int count,List<Long> roomUids){
NeteasePushParam param = createNeteaseGroupChatPush(tid);
// 通知内容
GroupChatNotifyRoomNumVo notifyVo = new GroupChatNotifyRoomNumVo();
notifyVo.setWorldId(worldId);
notifyVo.setCount(count);
notifyVo.setRoomUids(roomUids);
Attach attach = new Attach();
attach.setFirst(Constant.DefineProtocol.WORLD_HEAD);
attach.setSecond(Constant.DefineProtocol.WORLD_SUB_ROOM_MEMBER_COUNT);
attach.setData(notifyVo);
param.setAttach(attach);
logger.info("world-group-chat buildGroupChatRoomMemberMsg:{}",gson.toJson(param));
return param;
}
/**
* 构建群聊系统通知消息体 (更新群聊话题)
* @param worldId
* @param tid
* @param topic
* @return
*/
private NeteasePushParam buildGroupChatTopicMsg(long worldId,String tid,String topic){
NeteasePushParam param = createNeteaseGroupChatPush(tid);
// 通知内容
GroupChatNotifyTopicVo notifyVo = new GroupChatNotifyTopicVo();
notifyVo.setWorldId(worldId);
notifyVo.setTopic(topic);
Attach attach = new Attach();
attach.setFirst(Constant.DefineProtocol.WORLD_HEAD);
attach.setSecond(Constant.DefineProtocol.WORLD_SUB_GROUP_CHAT_TOPIC);
attach.setData(notifyVo);
param.setAttach(attach);
logger.info("world-group-chat buildGroupChatTopicMsg:{}",gson.toJson(param));
return param;
}
private NeteasePushParam createNeteaseGroupChatPush(String tid){
NeteasePushParam param = new NeteasePushParam();
param.setFrom(SystemConfig.secretaryUid);
// 1群消息自定义通知
param.setMsgtype(1);
// 云信群聊tid
param.setTo(tid);
//只发在线
param.setSave(1);
return param;
}
/**
* 更新该世界所有正在进行派对的房间信息
* @param worldId
*/
private void cleanAllRoomWorldFlag(Long worldId){
bizExecutor.execute(() -> {
List<WorldRoomVo> allRoomList = this.worldRoomService.getRoomListIncludeZeroOnline(worldId);
if(CollectionUtils.isEmpty(allRoomList)){
return;
}
for(WorldRoomVo roomVo : allRoomList){
try {
this.roomService.closeWorldMode(roomVo.getRoomUid());
}catch (Exception e){
// 报错不做处理
logger.error("world-group-chat cleanAllRoomWorldFlag error,roomVo={}",gson.toJson(roomVo));
}
}
});
}
/**
* 更新指定房间的世界标识
* @param uids
*/
private void cleanRoomWorldFlag(String... uids){
bizExecutor.execute(() -> {
for(String uid : uids){
try {
this.roomService.closeWorldMode(Long.parseLong(uid));
}catch (Exception e){
// 报错不做处理
logger.error("world-group-chat cleanRoomWorldFlag error,uid={}",uid);
}
}
});
}
}

View File

@@ -1,63 +0,0 @@
package com.accompany.business.service.world;
import com.accompany.core.exception.ServiceException;
import com.accompany.core.service.base.BaseService;
import com.google.common.collect.Collections2;
import com.accompany.world.entity.WorldGroupChatTopic;
import com.accompany.world.service.IWorldGroupChatTopicService;
import com.accompany.world.vo.SimpleTopicVo;
import com.accompany.common.redis.RedisKey;
import com.accompany.common.status.BusiStatus;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.List;
/**
* @Author: chucheng
* @Date: 2019/7/3 11:10
* @Description:
*/
@Service
public class WorldGroupChatTopicService extends BaseService {
@Autowired
private IWorldGroupChatTopicService iWorldGroupChatTopicService;
/**
* 随机获取一页
* @param pageSize
* @return
*/
public Collection<SimpleTopicVo> getTopicByRandom(int pageSize,String deviceId){
boolean lock = this.jedisService.setnx(RedisKey.world_group_chat_topic_lock.getKey(deviceId),"1",2);
if (!lock) {
throw new ServiceException(BusiStatus.REQUEST_FAST);
}
return convertToSimpleTopicVo(iWorldGroupChatTopicService.getTopicByRandom(pageSize));
}
public SimpleTopicVo getRandomOne(){
Collection<SimpleTopicVo> coll = convertToSimpleTopicVo(iWorldGroupChatTopicService.getTopicByRandom(1));
if(CollectionUtils.isEmpty(coll)){
return null;
}else{
return coll.stream().findFirst().get();
}
}
private Collection<SimpleTopicVo> convertToSimpleTopicVo(List<WorldGroupChatTopic> list){
if(list == null){
return null;
}
Collection<SimpleTopicVo> voList = Collections2.transform(list,(item) -> {
SimpleTopicVo vo = new SimpleTopicVo();
vo.setTopic(item.getTopic());
return vo;
});
return voList;
}
}

View File

@@ -1,203 +0,0 @@
package com.accompany.business.service.world;
import com.accompany.common.status.BusiStatus;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.accompany.business.constant.OsEnum;
import com.accompany.core.exception.ServiceException;
import com.accompany.core.model.Account;
import com.accompany.business.service.AppVersionService;
import com.accompany.core.service.account.AccountService;
import com.accompany.core.service.base.BaseService;
import com.accompany.core.util.StringUtils;
import com.accompany.world.constant.WorldConstant;
import com.accompany.world.entity.World;
import com.accompany.world.entity.WorldGroupChat;
import com.accompany.world.entity.WorldGroupChatMember;
import com.accompany.world.entity.WorldMember;
import com.accompany.world.entity.WorldMemberActiveRecord;
import com.accompany.world.query.WorldMemberActiveRecordQuery;
import com.accompany.world.query.WorldMemberQuery;
import com.accompany.world.query.WorldQuery;
import com.accompany.world.service.IWorldMemberActiveRecordService;
import com.accompany.world.service.IWorldMemberService;
import com.accompany.world.service.IWorldService;
import com.accompany.common.constant.AppEnum;
import com.accompany.common.utils.DateTimeUtil;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Date;
import java.util.List;
/**
* @Author: chucheng
* @Date: 2019/7/1 14:06
* @Description:
*/
@Service
public class WorldMemberActiveRecordService extends BaseService {
@Autowired
private IWorldMemberActiveRecordService iworldMemberActiveRecordService;
@Autowired
private IWorldService iWorldService;
@Autowired
private IWorldMemberService iWorldMemberService;
@Autowired
private WorldGroupChatService worldGroupChatService;
@Autowired
private AccountService accountService;
@Autowired
private AppVersionService appVersionService;
@Autowired
private WorldService worldService;
@Autowired
private WorldGroupChatMemberService worldGroupChatMemberService;
/**
* 保存一条记录
* @param entity
* @return
*/
public boolean save(WorldMemberActiveRecord entity) {
World world = iWorldService.getByIdFromCache(entity.getWorldId());
if(null == world) {
logger.error("id为{}的话题不存在!", entity.getWorldId());
throw new ServiceException(BusiStatus.TOPIC_DOES_NOT_EXIST);
}
if(world.getStatus() != WorldConstant.STATUS_VALID) {
logger.warn("id为{}的话题状态为{},非有效状态!", entity.getWorldId(), world.getStatus());
throw new ServiceException(BusiStatus.TOPIC_DOES_NOT_EXIST);
}
if(!WorldConstant.WorldMemberActiveType.activeTypeList.contains(entity.getActiveType())) {
logger.warn("活跃类型不正确,传入的活跃类型为:{},已有的活跃类型为:{}", entity.getActiveType(),
WorldConstant.WorldMemberActiveType.activeTypeList);
throw new ServiceException(BusiStatus.THE_ACTIVE_TYPE_OF_TOPIC_MEMBERS_IS_INCORRECT);
}
boolean isInWorld = iWorldService.isInWorld(entity.getUid(), entity.getWorldId());
if(!isInWorld) {
logger.warn("用户{}不在话题{}中", entity.getUid(), entity.getWorldId());
throw new ServiceException(BusiStatus.USER_NOT_IN_THE_TOPIC);
}
entity.setCreateTime(new Date());
return iworldMemberActiveRecordService.save(entity);
}
/**
* 清理非活跃的世界成员
*
* @param days
* @param uid 方便测试人员验证可以指定uid
*
*/
public void cleanInactiveMember(int days, Long uid) {
int page = 1;
int pageSize = 200;
WorldQuery worldQuery = new WorldQuery();
worldQuery.setStatus(WorldConstant.STATUS_VALID);
worldQuery.setPage(page);
worldQuery.setPageSize(pageSize);
Date now = new Date();
IPage<World> worldPage = iWorldService.queryForPage(worldQuery);
long totalPage = worldPage.getPages();
while(page <= totalPage) {
List<World> worldList = worldPage.getRecords();
worldList.forEach(world -> {
WorldMemberQuery memberQuery = new WorldMemberQuery();
memberQuery.setWorldId(world.getId());
memberQuery.setStatus(WorldConstant.STATUS_VALID);
List<WorldMember> members = iWorldMemberService.getWorldMember(memberQuery);
for (WorldMember member : members) {
// 如果指定了用户,则只更新指定用户,方便测试验证指定用户
if(null != uid && !member.getUid().equals(uid)) {
continue;
}
//世界的所有者不处理
if(member.getUid().equals(world.getOwnerUid())) {
continue;
}
//处理旧版本用户:旧版本用户直接退出话题
Account account = accountService.getById(member.getUid());
if(null == account) {
continue;
}
boolean isOldAppVersion = false;
String app = account.getApp();
String os = account.getOs();
String appVersion = account.getAppVersion();
isOldAppVersion = (StringUtils.equalsIgnoreCase(os, OsEnum.ANDROID.getName()) && appVersionService.compareVersion(appVersion, "1.3.0") < 0)
|| (StringUtils.equalsIgnoreCase(os, OsEnum.IOS.getName()) && appVersionService.compareVersion(appVersion, "1.3.0") < 0);
if(isOldAppVersion) {
//旧版加入话题未超过5天不处理
int subDays = DateTimeUtil.compareDay(now, member.getCreateTime());
if(subDays < days) {
continue;
}
WorldMemberActiveRecordQuery query = new WorldMemberActiveRecordQuery();
query.setUid(member.getUid());
query.setWorldId(world.getId());
query.setStartTime(DateTimeUtil.getBeginTimeOfDay(DateTimeUtil.addDays(now, -days)));
query.setEndTime(now);
int count = iworldMemberActiveRecordService.count(query);
if(count <= 0) {
//无活跃记录,需要移出话题群聊
try {
worldService.exit(world.getId(), member.getUid(), WorldConstant.LeaveGroupChatType.autoClean);
logger.info("自动清理未活跃的话题成员成功话题id:{}, uid:{}", world.getId(), member.getUid());
} catch (Exception e) {
logger.error("清理话题成员异常:{}", ExceptionUtils.getStackTrace(e));
}
}
} else {
//新版:加入话题群聊时间
List<WorldGroupChat> list = worldGroupChatService.getByWorldId(world.getId());
if(CollectionUtils.isEmpty(list)) {
// 用户未加入群聊
continue;
}
WorldMemberActiveRecordQuery query = new WorldMemberActiveRecordQuery();
query.setUid(member.getUid());
query.setWorldId(world.getId());
query.setStartTime(DateTimeUtil.getBeginTimeOfDay(DateTimeUtil.addDays(now, -days)));
query.setEndTime(now);
int count = iworldMemberActiveRecordService.count(query);
if(count <= 0) {
//无活跃记录,需要移出话题群聊
try {
for(WorldGroupChat groupChat : list) {
WorldGroupChatMember chatMember = worldGroupChatMemberService
.getUniqueChatMember(groupChat.getId(), member.getUid());
if(null == chatMember) {
continue;
}
int subDays = DateTimeUtil.compareDay(now, chatMember.getCreateTime());
if(subDays < days) {
continue;
}
worldGroupChatService.leaveGroupChat(world.getId(), member.getUid(), WorldConstant.LeaveGroupChatType.autoClean, true);
logger.info("自动清理未活跃的话题群聊成员成功话题id:{}, uid:{}", world.getId(), member.getUid());
}
} catch (Exception e) {
logger.error("清理话题成员异常:{}", ExceptionUtils.getStackTrace(e));
}
}
}
}
});
page++;
}
}
public int countByUidAndTypeToday(Long uid, int activeType) {
Date date = new Date();
LambdaQueryWrapper<WorldMemberActiveRecord> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(WorldMemberActiveRecord::getActiveType, activeType)
.eq(WorldMemberActiveRecord::getUid, uid)
.between(WorldMemberActiveRecord::getCreateTime, DateTimeUtil.getBeginTimeOfDay(date), DateTimeUtil.getEndTimeOfDay(date));
return iworldMemberActiveRecordService.count(wrapper);
}
}

View File

@@ -1,152 +0,0 @@
package com.accompany.business.service.world;
import com.accompany.business.service.user.UsersService;
import com.accompany.common.utils.DateTimeUtil;
import com.accompany.core.model.Users;
import com.accompany.core.service.base.BaseService;
import com.accompany.world.common.ParamUtils;
import com.accompany.world.constant.WorldConstant;
import com.accompany.world.entity.World;
import com.accompany.world.entity.WorldMemberApplyRecord;
import com.accompany.world.service.IWorldMemberApplyRecordService;
import com.accompany.world.service.IWorldService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* {这里添加描述}
*
* @author fangchengyan
* @date 2019-07-05 16:42
*/
@Service
public class WorldMemberApplyRecordService extends BaseService {
@Autowired
private IWorldMemberApplyRecordService iWorldMemberApplyRecordService;
@Autowired
private WorldMessageService messageService;
@Autowired
private IWorldService iWorldService;
@Autowired
private UsersService usersService;
/**
* 添加一条申请记录
* @param worldId
* @param uid
* @return
*/
public int addApplyRecord(Long worldId, Long uid) {
ParamUtils.isNotTrue(iWorldMemberApplyRecordService.existApplyRecord(worldId, uid),
"12小时内请勿重新申请");
int result = iWorldMemberApplyRecordService.saveToDbAndCache(worldId, uid);
if(result > 0) {
//从缓存中获取刚刚添加的记录
WorldMemberApplyRecord record = iWorldMemberApplyRecordService.getExistInCache(worldId, uid);
//发放审核信息
World world = iWorldService.getByIdFromCache(worldId);
Users users = usersService.getUsersByUid(uid);
messageService.sendWorldApplyNotifyMessage(world, users, record.getId());
}
return result;
}
/**
* 获取缓存中存在的记录
* @param worldId
* @param uid
* @return
*/
public WorldMemberApplyRecord getExistInCache(Long worldId, Long uid) {
return iWorldMemberApplyRecordService.getExistInCache(worldId, uid);
}
/**
* 更新一条记录
* @param newStatus
* @return
*/
public int updateById(Long recordId, Integer newStatus, String reason, Integer existStatus) {
WorldMemberApplyRecord entity = new WorldMemberApplyRecord();
entity.setStatus(newStatus);
entity.setUpdateTime(new Date());
entity.setRemark(reason);
UpdateWrapper<WorldMemberApplyRecord> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", recordId).eq("`status`", existStatus);
boolean result = iWorldMemberApplyRecordService.update(entity, updateWrapper);
if(result) {
//移除缓存中的信息
WorldMemberApplyRecord applyRecord = iWorldMemberApplyRecordService.getById(recordId);
iWorldMemberApplyRecordService.removeFromCache(applyRecord.getWorldId(), applyRecord.getUid());
return 1;
}
return 0;
}
/**
* 清理过期的申请
* @return
*/
public int cleanExpireApplyRecord() {
int result = 0;
int current = 1;
int pageSize = 100;
Date now = new Date();
Date startTime = DateTimeUtil.addDays(now, -1);
Date endTime = DateTimeUtil.addHours(now, -12);
QueryWrapper<WorldMemberApplyRecord> queryWrapper = new QueryWrapper();
queryWrapper.ge("create_time", startTime)
.le("create_time", endTime)
.eq("`status`", WorldConstant.ApproveStatus.STATUS_NOT_APPROVE);
Page<WorldMemberApplyRecord> page = new Page(current, pageSize);
IPage<WorldMemberApplyRecord> ipage = iWorldMemberApplyRecordService.page(page, queryWrapper);
List<WorldMemberApplyRecord> records = ipage.getRecords();
if(CollectionUtils.isEmpty(records)) {
logger.info("清理话题过期申请记录完成,清理数:{}", result);
return 0;
}
for (WorldMemberApplyRecord record : records) {
int line = updateById(record.getId(), (int) WorldConstant.ApproveStatus.STATUS_APPROVE_EXPIRED,
"申请记录已过期", (int) WorldConstant.ApproveStatus.STATUS_NOT_APPROVE);
if(line > 0) {
logger.info("话题申请记录{}过期", record.getId());
World world = iWorldService.getByIdFromCache(record.getWorldId());
messageService.sendApplyExpireNotifyMessage(world, record);
}
result += line;
}
//继续下一页,更新再查询,记录始终在第一页
while(ipage.getTotal() >= pageSize) {
page = new Page(current, pageSize);
ipage = iWorldMemberApplyRecordService.page(page, queryWrapper);
records = ipage.getRecords();
if(CollectionUtils.isNotEmpty(records)) {
for (WorldMemberApplyRecord record : records) {
int line = updateById(record.getId(), (int) WorldConstant.ApproveStatus.STATUS_APPROVE_EXPIRED,
"申请记录已过期", (int) WorldConstant.ApproveStatus.STATUS_NOT_APPROVE);
if(line > 0) {
logger.info("话题申请记录{}过期", record.getId());
World world = iWorldService.getByIdFromCache(record.getWorldId());
messageService.sendApplyExpireNotifyMessage(world, record);
}
result += line;
}
}
}
logger.info("清理话题过期申请记录完成,清理数:{}", result);
return result;
}
public WorldMemberApplyRecord getById(Long recordId) {
return iWorldMemberApplyRecordService.getById(recordId);
}
}

View File

@@ -1,209 +0,0 @@
package com.accompany.business.service.world;
import com.accompany.business.service.level.LevelService;
import com.accompany.business.service.user.UserInRoomService;
import com.accompany.business.service.user.UsersService;
import com.accompany.business.vo.RoomVo;
import com.accompany.business.vo.WorldMemberInfoVo;
import com.accompany.common.redis.RedisKey;
import com.accompany.core.base.BeanMapper;
import com.accompany.core.model.Users;;
import com.accompany.core.service.base.BaseService;
import com.accompany.core.util.StringUtils;
import com.accompany.core.vo.UserLevelVo;
import com.accompany.world.common.PageContainer;
import com.accompany.world.entity.World;
import com.accompany.world.entity.WorldMember;
import com.accompany.world.query.WorldMemberPageQuery;
import com.accompany.world.query.WorldMemberQuery;
import com.accompany.world.query.WorldMemberSearchQuery;
import com.accompany.world.service.IWorldMemberService;
import com.accompany.world.service.IWorldService;
import com.accompany.world.vo.MemberInWorldVo;
import com.accompany.world.vo.WorldMemberSimpleInfoVo;
import com.accompany.world.vo.WorldMemberVo;
import com.accompany.world.vo.WorldRoomVo;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* @Author: chucheng
* @Date: 2019/7/1 14:06
* @Description:
*/
@Service
public class WorldMemberService extends BaseService {
@Autowired
private IWorldMemberService iWorldMemberService;
@Autowired
private WorldRoomService worldRoomService;
@Autowired
private WorldGroupChatService worldGroupChatService;
@Autowired
private UserInRoomService userInRoomService;
@Autowired
private LevelService levelService;
@Autowired
private IWorldService iWorldService;
@Autowired
private WorldMessageService messageService;
@Autowired
private UsersService usersService;
public Object getWorldMemberByPage(Long worldId, String searchKey, int page, int pageSize){
Map<String,Object> result = Maps.newHashMap();
List<WorldMemberVo> queryList = null;
List<WorldMemberInfoVo> resultList = Lists.newArrayList();
// 客户端要求搜索不带分页
if(StringUtils.isNotBlank(searchKey)){
WorldMemberSearchQuery query = new WorldMemberSearchQuery();
query.setWorldId(worldId);
query.setSearchKey(searchKey);
queryList = iWorldMemberService.getWorldMemberVoBySearchKey(query);
result.put("total",queryList!=null?queryList.size():0);
}else{
WorldMemberPageQuery query = new WorldMemberPageQuery();
query.setWorldId(worldId);
query.setPage(page);
query.setPageSize(pageSize);
PageContainer<WorldMemberVo> pageContainer = iWorldMemberService.getWorldMemberVoByPage(query);
queryList = pageContainer.getRecords();
result.put("total",pageContainer.getTotal());
}
if(CollectionUtils.isEmpty(queryList)){
result.put("records",queryList);
return result;
}
for(WorldMemberVo vo : queryList){
WorldMemberInfoVo infoVo = BeanMapper.map(vo, WorldMemberInfoVo.class);
resultList.add(infoVo);
}
// 获取在房情况
setUserInRoomInfo(worldId,resultList);
// 获取在线情况
setOnlineStatus(resultList);
// 获取等级,魅力
setUserLevel(resultList);
result.put("records",resultList);
return result;
}
public List<WorldMember> getWorldMember(WorldMemberQuery query){
return iWorldMemberService.getWorldMember(query);
}
private void setOnlineStatus(List<WorldMemberInfoVo> list){
for(WorldMemberInfoVo vo : list){
String value = jedisService.hget(RedisKey.user_online_status.getKey(), vo.getUid().toString());
vo.setOnlineFlag(value!=null);
}
}
/**
* 向话题中加入一个成员
* @param worldId
* @param uid
* @param addGroupChat 是否加入群聊
* @return
*/
@Transactional(rollbackFor = Exception.class)
public int addNewMember(Long worldId, Long uid, boolean addGroupChat) throws Exception {
int result = iWorldMemberService.insertOrUpdate(worldId, uid);
if(result > 0) {
//访问我加入世界的时间
iWorldService.visitMyJoinWorldForCache(uid, worldId);
//添加世界的成员数
iWorldService.incrWorldMemberNum(worldId, 1);
if(addGroupChat) {
worldGroupChatService.handleGroupChat(worldId, uid);
}
//发送消息
World world = iWorldService.getByIdFromCache(worldId);
Users users = usersService.getUsersByUid(uid);
Users owner = usersService.getUsersByUid(world.getOwnerUid());
messageService.sendSuccessJoinWorldMessage(users, owner, world);
}
return result;
}
/**
* 获取某人在某世界的简单信息(无视世界状态、成员状态)
* @param worldId
* @param uid
*/
public WorldMemberSimpleInfoVo getWorldMemberInfoByAlways(Long worldId , Long uid){
return this.iWorldMemberService.getWorldMemberInfoByAlways(worldId,uid);
}
/**
* 查询用户是否在世界中,返回世界信息
* @param worldId
* @param uid
* @return
*/
public MemberInWorldVo getMemberFlag(Long worldId , Long uid){
return this.iWorldMemberService.getMemberFlag(worldId,uid);
}
/**
* 设置等级、魅力
* @param list
*/
private void setUserLevel(List<WorldMemberInfoVo> list){
List<String> uids = list.stream().map(vo ->vo.getUid().toString()).collect(Collectors.toList());
Map<Long, UserLevelVo> userLevelVoMap = levelService.getUserLevelVoMap(uids.toArray(new String[uids.size()]));
for(WorldMemberInfoVo vo : list){
vo.setUserLevelVo(userLevelVoMap.get(vo.getUid()));
}
}
/**
* 设置在派对情况
* @param worldId
* @param list
*/
private void setUserInRoomInfo(Long worldId,List<WorldMemberInfoVo> list){
// 获取当前正在进行的世界派对
List<WorldRoomVo> worldRoomVos = worldRoomService.getWorldRoomList(worldId);
if(CollectionUtils.isEmpty(worldRoomVos) ){
return;
}
List<String> uids = list.stream().map(vo ->vo.getUid().toString()).collect(Collectors.toList());
List<String> roomVos = userInRoomService.batchGetUserInRoomCache(uids.toArray(new String[uids.size()]));
roomVos = Optional.ofNullable(roomVos).orElse(Lists.newArrayList())
.stream().filter(item->item!=null).collect(Collectors.toList());
if(CollectionUtils.isEmpty(roomVos)){
return;
}
RoomVo room = null;
// key=roomUid
Map<Long,WorldRoomVo> worldRoomVoMap = worldRoomVos.stream().collect(Collectors.toMap(WorldRoomVo::getRoomUid, a -> a,(k1, k2)->k1));
for(WorldMemberInfoVo vo : list){
room = userInRoomService.getUserInRoomInfoCache(vo.getUid());
if(room == null){
continue;
}
if(worldRoomVoMap.containsKey(room.getUid())){
vo.setCurrentRoomUid(room.getUid());
}
}
}
}

View File

@@ -1,441 +0,0 @@
package com.accompany.business.service.world;
import com.accompany.business.param.neteasepush.NeteaseSendMsgParam;
import com.accompany.business.service.ErBanNetEaseService;
import com.accompany.business.service.SendSysMsgService;
import com.accompany.business.service.room.RoomService;
import com.accompany.business.service.user.UsersService;
import com.accompany.business.vo.JoinWorldRoomNotifyVo;
import com.accompany.business.vo.message.MessageLayout;
import com.accompany.business.vo.message.SysMessageData;
import com.accompany.business.vo.message.WorldMessage;
import com.accompany.common.config.SystemConfig;
import com.accompany.common.constant.Attach;
import com.accompany.common.constant.Constant;
import com.accompany.common.constant.MessageConstant;
import com.accompany.common.utils.DateTimeUtil;
import com.accompany.common.utils.StringUtils;
import com.accompany.common.utils.UUIDUtil;
import com.accompany.core.model.Room;
import com.accompany.core.model.Users;
import com.accompany.core.service.base.BaseService;
import com.accompany.world.constant.WorldConstant;
import com.accompany.world.entity.World;
import com.accompany.world.entity.WorldGroupChat;
import com.accompany.world.entity.WorldMember;
import com.accompany.world.entity.WorldMemberApplyRecord;
import com.google.common.collect.Maps;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ThreadPoolExecutor;
;
/**
* 话题消息发送
*
* @author Administrator
*/
@Service
public class WorldMessageService extends BaseService {
@Autowired
private SendSysMsgService sendSysMsgService;
@Resource(name = "bizExecutor")
private ThreadPoolExecutor bizExecutor;
@Autowired
private RoomService roomService;
@Autowired
private ErBanNetEaseService erBanNetEaseService;
@Autowired
private UsersService usersService;
/**
* 发送退出世界消息
* @param world
* @param user
* @param owner
* @param leaveType
*/
public void sendExitWorldMessage(World world, Users user, Users owner, int leaveType) {
String formatTime = DateTimeUtil.convertDate(new Date(), DateTimeUtil.DEFAULT_DATE_MINUTE_PATTERN);
//主动退出世界
if(leaveType == WorldConstant.LeaveGroupChatType.active) {
Object[] args = {formatTime, user.getNick(), world.getName()};
Map<String, Object> params = Maps.newHashMap();
params.put(WorldConstant.ParamsKey.ACTION_TYPE, WorldConstant.ActionType.QUIT_WORLD);
params.put(WorldConstant.ParamsKey.WORLD_ID, world.getId());
// 通知创建人
this.sendSysMessage(MessageConstant.WORLD, MessageConstant.WORLD_NOMAL,
WorldMessage.EXIT_WORLD_NOTIFY_OWNER, args, world.getOwnerUid(), null, params);
// 通知成员
Object[] args2 = {formatTime, user.getNick(), world.getName()};
this.sendSysMessage(MessageConstant.WORLD, MessageConstant.WORLD_NOMAL,
WorldMessage.EXIT_WORLD_NOTIFY_USER, args2, user.getUid(), null, params);
} else {
Map<String, Object> params = Maps.newHashMap();
params.put(WorldConstant.ParamsKey.ACTION_TYPE, WorldConstant.ActionType.KICK_OUT_WORLD);
params.put(WorldConstant.ParamsKey.WORLD_ID, world.getId());
//踢出世界:创建人移除
if(leaveType == WorldConstant.LeaveGroupChatType.passive) {
// 通知创建人
Object[] args = {formatTime, user.getNick(), owner.getNick()};
this.sendSysMessage(MessageConstant.WORLD, MessageConstant.WORLD_NOMAL,
WorldMessage.CLICK_OUT_WORLD_NOTIFY_OWNER, args, owner.getUid(), null, params);
// 通知成员
Object[] args2 = {formatTime, user.getNick(), world.getName(), user.getNick()};
this.sendSysMessage(MessageConstant.WORLD, MessageConstant.WORLD_NOMAL,
WorldMessage.CLICK_OUT_WORLD_NOTIFY_USER, args2, user.getUid(), null, params);
//踢出世界:管理后台操作
} else if(leaveType == WorldConstant.LeaveGroupChatType.admin) {
// 通知创建人
Object[] args = {formatTime, user.getNick()};
this.sendSysMessage(MessageConstant.WORLD, MessageConstant.WORLD_NOMAL,
WorldMessage.ADMIN_CLICK_OUT_WORLD_NOTIFY_OWNER, args, owner.getUid(), null, params);
// 通知成员
Object[] args2 = {formatTime, user.getNick(), world.getName()};
this.sendSysMessage(MessageConstant.WORLD, MessageConstant.WORLD_NOMAL,
WorldMessage.ADMIN_CLICK_OUT_WORLD_NOTIFY_USER, args2, user.getUid(), null, params);
//自动清理5天未发言的用户
} else if(leaveType == WorldConstant.LeaveGroupChatType.autoClean) {
// 通知创建人
Object[] args = {formatTime, user.getNick()};
this.sendSysMessage(MessageConstant.WORLD, MessageConstant.WORLD_NOMAL,
WorldMessage.ADMIN_CLICK_OUT_WORLD_NOTIFY_OWNER, args, owner.getUid(), null, params);
// 通知成员
Object[] args2 = {formatTime, world.getName()};
this.sendSysMessage(MessageConstant.WORLD_NEW, MessageConstant.WORLD_NOMAL,
WorldMessage.AUTO_CLEAN_USER_NOTIFY_USER, args2, user.getUid(), null, params);
}
}
}
public void sendExitGroupChatMessage(World world, WorldGroupChat worldGroupChat, Users user, Users owner, int leaveType) {
String formatTime = DateTimeUtil.convertDate(new Date(), DateTimeUtil.DEFAULT_DATE_MINUTE_PATTERN);
Map<String, Object> params = Maps.newHashMap();
params.put(WorldConstant.ParamsKey.ACTION_TYPE, WorldConstant.ActionType.QUIT_GROUP);
params.put(WorldConstant.ParamsKey.WORLD_ID, world.getId());
if(leaveType == WorldConstant.LeaveGroupChatType.active) {
//通知创建人
Object[] args = {formatTime, user.getNick(), world.getName(), worldGroupChat.getName()};
this.sendSysMessage(MessageConstant.WORLD, MessageConstant.WORLD_NOMAL,
WorldMessage.EXIT_GROUP_CHAT_NOTIFY_OWNER, args, owner.getUid(), null, params);
} else if(leaveType == WorldConstant.LeaveGroupChatType.autoClean) {
//通知成员人
Object[] args = {formatTime, world.getName(), worldGroupChat.getName()};
this.sendSysMessage(MessageConstant.WORLD_NEW, MessageConstant.WORLD_NOMAL,
WorldMessage.AUTO_CLEAR_FROM_GROUP_CHAT_NOTIFY_OWNER, args, user.getUid(), null, params);
}
}
public void sendDismissMessage(World world, List<WorldMember> members, byte dismissType) {
switch (dismissType) {
case 1:
sendDismissMessage(world, members);
break;
case 2:
sendAdminDismissMessage(world, members);
break;
case 3:
sendAutoDismissMessage(world, members);
break;
default:
return;
}
}
/**
* 发送世界解散消息
* @param world
* @param members
*/
public void sendDismissMessage(World world, List<WorldMember> members) {
String formatTime = DateTimeUtil.convertDate(new Date(), DateTimeUtil.DEFAULT_DATE_MINUTE_PATTERN);
//通知创建人
Object[] args = {formatTime};
Map<String, Object> params = Maps.newHashMap();
params.put(WorldConstant.ParamsKey.ACTION_TYPE, WorldConstant.ActionType.DISMISS_WORLD);
params.put(WorldConstant.ParamsKey.WORLD_ID, world.getId());
this.sendSysMessage(MessageConstant.WORLD, MessageConstant.WORLD_NOMAL, WorldMessage.WORLD_DISS_NOTIFY_OWNER,
args, world.getOwnerUid(), null, params);
//通知成员
Object[] args2 = {formatTime, world.getName()};
Map<String, Object> params2 = Maps.newHashMap();
params2.put(WorldConstant.ParamsKey.ACTION_TYPE, WorldConstant.ActionType.DISMISS_WORLD);
params2.put(WorldConstant.ParamsKey.WORLD_ID, world.getId());
for(WorldMember member : members) {
if(member.getUid().equals(world.getOwnerUid())) {
continue;
}
this.sendSysMessage(MessageConstant.WORLD, MessageConstant.WORLD_NOMAL, WorldMessage.WORLD_DISS_NOTIFY_MEMBER,
args2, member.getUid(), null, params2);
}
}
/**
* 话题自动解散通知
* @param world
* @param members
*/
public void sendAutoDismissMessage(World world, List<WorldMember> members) {
String formatTime = DateTimeUtil.convertDate(new Date(), DateTimeUtil.DEFAULT_DATE_MINUTE_PATTERN);
Object[] args = {formatTime, world.getName()};
Map<String, Object> params = Maps.newHashMap();
params.put(WorldConstant.ParamsKey.ACTION_TYPE, WorldConstant.ActionType.DISMISS_WORLD);
params.put(WorldConstant.ParamsKey.WORLD_ID, world.getId());
this.sendSysMessage(MessageConstant.WORLD, MessageConstant.WORLD_NOMAL,
WorldMessage.WORLD_AUTO_DISS_NOTIFY, args, world.getOwnerUid(), null, params);
for(WorldMember member : members) {
if(!member.getUid().equals(world.getOwnerUid())) {
this.sendSysMessage(MessageConstant.WORLD, MessageConstant.WORLD_NOMAL, WorldMessage.WORLD_DISS_NOTIFY_MEMBER,
args, member.getUid(), null, params);
}
}
}
/**
* 话题自动解散预警
* @param world
*/
public void sendDismissAlarmMessage(World world) {
String formatTime = DateTimeUtil.convertDate(new Date(), DateTimeUtil.DEFAULT_DATE_MINUTE_PATTERN);
Object[] args = {formatTime, world.getName()};
Map<String, Object> params = Maps.newHashMap();
params.put(WorldConstant.ParamsKey.WORLD_ID, world.getId());
this.sendSysMessage(MessageConstant.WORLD, MessageConstant.WORLD_NOMAL,
WorldMessage.WORLD_DISS_ALARM, args, world.getOwnerUid(), null, params);
}
/**
* 管理后台页面解散话题通知
* @param world
* @param members
*/
public void sendAdminDismissMessage(World world, List<WorldMember> members) {
String formatTime = DateTimeUtil.convertDate(new Date(), DateTimeUtil.DEFAULT_DATE_MINUTE_PATTERN);
Object[] args = {formatTime, world.getName()};
Map<String, Object> params = Maps.newHashMap();
params.put(WorldConstant.ParamsKey.ACTION_TYPE, WorldConstant.ActionType.DISMISS_WORLD);
params.put(WorldConstant.ParamsKey.WORLD_ID, world.getId());
for(WorldMember member : members) {
this.sendSysMessage(MessageConstant.WORLD, MessageConstant.WORLD_NOMAL,
WorldMessage.WORLD_ADMIN_DISS_NOTIFY, args, member.getUid(), null, params);
}
}
/**
* 发送拒绝消息
* @param world
* @param owner
*/
public void sendJoinWorldFailMessage(World world, Long uid, Users owner) {
String formatTime = DateTimeUtil.convertDate(new Date(), DateTimeUtil.DEFAULT_DATE_MINUTE_PATTERN);
Object[] args = {formatTime, world.getName(), owner.getNick()};
Map<String, Object> params = Maps.newHashMap();
params.put(WorldConstant.ParamsKey.WORLD_ID, world.getId());
this.sendSysMessage(MessageConstant.WORLD, MessageConstant.WORLD_NOMAL,
WorldMessage.JOIN_WORLD_FAILD, args, uid, null, params);
}
/**
* 成功加入话题,发送提醒消息
* @param user
* @param owner
* @param world
*/
public void sendSuccessJoinWorldMessage(Users user, Users owner, World world) {
//只给非创建人发消息
if(user.getUid().equals(owner.getUid())) {
return;
}
//给用户发信息
String formatTime = DateTimeUtil.convertDate(new Date(), DateTimeUtil.DEFAULT_DATE_MINUTE_PATTERN);
Object[] args = {formatTime, world.getName()};
Map<String, Object> params = Maps.newHashMap();
params.put(WorldConstant.ParamsKey.ACTION_TYPE, WorldConstant.ActionType.JOIN_WORLD);
params.put(WorldConstant.ParamsKey.WORLD_ID, world.getId());
//给用户发消息
this.sendAsyncMessage(MessageConstant.WORLD, MessageConstant.WORLD_NOMAL, WorldMessage.JOIN_WORLD_SUCCESS,
args, user.getUid(), null, params, MessageConstant.RouterType.WORLD, String.valueOf(world.getId()));
//给创建人发通知
Object[] leaderArgs = {formatTime, user.getNick(), world.getName()};
this.sendSysMessage(MessageConstant.WORLD, MessageConstant.WORLD_NOMAL,
WorldMessage.JOIN_WORLD_SUCCESS_FOR_OWNER, leaderArgs, world.getOwnerUid(), null, params);
}
/**
* 发送审核记录给创建人
* @param world
* @param user
* @param recordId
*/
public void sendWorldApplyNotifyMessage(World world, Users user, Long recordId) {
// 发系统消息
String formatTime = DateTimeUtil.convertDate(new Date(), DateTimeUtil.DEFAULT_DATE_MINUTE_PATTERN);
Object[] args = {formatTime, user.getNick(), world.getName()};
String url = MessageConstant.WORLD_HANDLE_APPLY;
Map<String, Object> params = Maps.newHashMap();
params.put(WorldConstant.ParamsKey.RECORD_ID, recordId);
params.put(WorldConstant.ParamsKey.WORLD_ID, world.getId());
params.put(WorldConstant.ParamsKey.TARGET_UID, user.getUid());
// 发送申请消息给世界创建人
this.sendSysMessage(MessageConstant.WORLD, MessageConstant.WORLD_CHOICE,
WorldMessage.APPLY_JOIN_WORLD_TO_OWNER, args, world.getOwnerUid(), url, params);
}
/**
* 创建话题系统消息
*/
public void sendCreateWorldMessage(Long uid, Long worldId) {
Object[] args = {DateTimeUtil.convertDate(new Date(), DateTimeUtil.DEFAULT_DATE_MINUTE_PATTERN)};
Map<String, Object> params = Maps.newHashMap();
params.put(WorldConstant.ParamsKey.ACTION_TYPE, WorldConstant.ActionType.CREATE_WORLD);
params.put(WorldConstant.ParamsKey.WORLD_ID, worldId);
this.sendAsyncMessage(MessageConstant.WORLD, MessageConstant.WORLD_NOMAL, WorldMessage.CREATE_WORLD, args, uid,
null, params, MessageConstant.RouterType.WORLD, String.valueOf(worldId));
}
/**
* 取消世界创建人消息
* @param world
* @param user
*/
public void sendCancelWorldOwnerMsg(World world, Users user) {
//管理员消息 {时间} {家族名称}
String formatTime = DateTimeUtil.convertDate(new Date(), DateTimeUtil.DEFAULT_DATE_MINUTE_PATTERN);
Object[] args = { formatTime, world.getName() };
Map<String, Object> params = Maps.newHashMap();
params.put(WorldConstant.ParamsKey.WORLD_ID, world.getId());
this.sendSysMessage(MessageConstant.WORLD, MessageConstant.WORLD_NOMAL,
WorldMessage.CANCEL_OWNER, args, user.getUid(), null, params);
}
/**
* 设置世界创建人消息
* @param world
* @param user
*/
public void sendSetWorldOwnerMsg(World world, Users user) {
//管理员消息 {时间} {家族名称}
String formatTime = DateTimeUtil.convertDate(new Date(), DateTimeUtil.DEFAULT_DATE_MINUTE_PATTERN);
Object[] args = { formatTime, world.getName() };
Map<String, Object> params = Maps.newHashMap();
params.put(WorldConstant.ParamsKey.WORLD_ID, world.getId());
this.sendSysMessage(MessageConstant.WORLD, MessageConstant.WORLD_NOMAL,
WorldMessage.SET_OWNER, args, user.getUid(), null, params);
}
/**
* 发送申请过期提醒消息
* @param world
* @param record
*/
public void sendApplyExpireNotifyMessage(World world, WorldMemberApplyRecord record) {
String formatTime = DateTimeUtil.convertDate(new Date(), DateTimeUtil.DEFAULT_DATE_MINUTE_PATTERN);
String createTime = DateTimeUtil.convertDate(record.getCreateTime(), DateTimeUtil.DEFAULT_DATE_MINUTE_PATTERN);
//发送消息
Object[] args = {formatTime, createTime, world.getName()};
this.sendSysMessage(MessageConstant.WORLD, MessageConstant.WORLD_NOMAL,
WorldMessage.WORLD_APPLY_EXPIRED_NOTIFY, args, record.getUid(), null, null);
}
/**
* 发送系统消息
*/
public void sendSysMessage(Integer templateId, Integer second, MessageLayout layout, Object[] args, Long uid, String url, Map<String, Object> params) {
this.sendAsyncMessage(templateId, second, layout, args, uid, url, params, null, null);
}
public void sendAsyncMessage(Integer templateId, Integer second, MessageLayout layout, Object[] args, Long uid, String url,
Map<String, Object> params, Byte routerType, String routerValue){
NeteaseSendMsgParam neteaseSendMsgParam = new NeteaseSendMsgParam();
neteaseSendMsgParam.setFrom(SystemConfig.systemMessageUid);
neteaseSendMsgParam.setTo(String.valueOf(uid));
neteaseSendMsgParam.setOpe(0);
//100自定义消息
neteaseSendMsgParam.setType(100);
String layoutFormat = gson.toJson(layout);
String layoutString = layoutFormat;
if (args != null) {
args = StringUtils.escapeChar(args);
layoutString = String.format(layoutFormat, args);
}
SysMessageData data = new SysMessageData();
data.setParams(params);
data.setUrl(url);
data.setLayout(layoutString);
data.setRouterType(routerType);
data.setRouterValue(routerValue);
Attach attach = new Attach();
attach.setFirst(templateId);
attach.setSecond(templateId * 10 + second);
attach.setData(data);
neteaseSendMsgParam.setAttach(attach);
bizExecutor.execute(() -> sendSysMsgService.sendMsg(neteaseSendMsgParam));
}
/**
* 加入成功发送房间公屏消息
* @param roomUid
* @param uid
* @param world
*/
public void sendJoinSuccessChatRoomMsg(Long roomUid,Long uid,World world) {
Room room = roomService.getRoomByUid(roomUid);
Users users = usersService.getUsersByUid(uid);
if(room == null || !room.getValid() || users == null){
return;
}
JoinWorldRoomNotifyVo notifyVo = new JoinWorldRoomNotifyVo();
notifyVo.setWorldId(world.getId());
notifyVo.setWorldName(world.getName());
notifyVo.setUid(users.getUid());
notifyVo.setNick(users.getNick());
Attach attach = new Attach();
attach.setFirst(Constant.DefineProtocol.WORLD_HEAD);
attach.setSecond(Constant.DefineProtocol.WORLD_SUB_JOIN_ROOM_NOTIFY);
attach.setData(notifyVo);
bizExecutor.execute(() -> {
try {
logger.info("sendJoinSuccessChatRoomMsg notifyVo:{}",gson.toJson(notifyVo));
erBanNetEaseService.sendChatRoomMsg(room.getRoomId(),
UUIDUtil.get(), room.getUid().toString(), Constant.DefineProtocol.CUSTOM_MESS_DEFINE, gson.toJson(attach), null);
} catch (Exception e) {
// 报错不做处理
logger.error("sendJoinSuccessChatRoomMsg error.roomUid:{},uid:{},world:{}",roomUid,uid,gson.toJson(world));
}
});
}
}

View File

@@ -1,99 +0,0 @@
package com.accompany.business.service.world;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.accompany.core.service.base.BaseService;
import com.accompany.world.constant.WorldConstant;
import com.accompany.world.entity.World;
import com.accompany.world.entity.WorldPreCleanRecord;
import com.accompany.world.service.IWorldPreCleanRecordService;
import com.accompany.world.service.IWorldService;
import com.accompany.common.utils.DateTimeUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* {这里添加描述}
*
* @author fangchengyan
* @date 2019-07-16 21:37
*/
@Service
public class WorldPreCleanRecordService extends BaseService {
@Autowired
private WorldService worldService;
@Autowired
private IWorldService iWorldService;
@Autowired
private IWorldPreCleanRecordService iWorldPreCleanRecordService;
public int autoCleanWorld() throws Exception {
int result = 0;
int current = 1;
int pageSize = 100;
Date now = new Date();
Date endTime = DateTimeUtil.addDays(now, -3);
QueryWrapper<WorldPreCleanRecord> queryWrapper = new QueryWrapper<>();
queryWrapper.le("create_time", endTime)
.eq("clean_status", WorldConstant.WorldCleanStatus.NORMAL);
Page<WorldPreCleanRecord> page = new Page(current, pageSize);
IPage<WorldPreCleanRecord> ipage = iWorldPreCleanRecordService.page(page, queryWrapper);
List<WorldPreCleanRecord> records = ipage.getRecords();
if(CollectionUtils.isEmpty(records)) {
logger.info("清理人数不足3的话题完成清理数{}", result);
return 0;
}
for (WorldPreCleanRecord record : records) {
result += doClean(record.getWorldId());
}
//继续下一页,更新再查询,记录始终在第一页
while(ipage.getTotal() >= pageSize) {
page = new Page(current, pageSize);
ipage = iWorldPreCleanRecordService.page(page, queryWrapper);
records = ipage.getRecords();
if(CollectionUtils.isNotEmpty(records)) {
for (WorldPreCleanRecord record : records) {
result += doClean(record.getWorldId());
}
}
}
logger.info("预清理人数不足3的话题完成清理数{}", result);
return result;
}
public int doClean(Long worldId) throws Exception {
World world = worldService.getByIdFromCache(worldId);
if(null == world) {
return 0;
}
if(world.getStatus() == WorldConstant.STATUS_DELETE) {
iWorldPreCleanRecordService.updateStatus(worldId, WorldConstant.WorldCleanStatus.CLEAN);
return 0;
}
if(world.getMemberNum() >= 3) {
World updateRecord = new World();
updateRecord.setId(worldId);
world.setRemark("");
updateRecord.setPreCleanStatus(WorldConstant.WorldCleanStatus.NORMAL);
int line = iWorldService.updateWorldById(updateRecord);
if(line > 0) {
iWorldPreCleanRecordService.removeById(worldId);
}
return 0;
}
int line = worldService.dismiss(world.getId(), world.getOwnerUid(), WorldConstant.DismissType.AUTO_CLEAN);
if(line > 0) {
iWorldPreCleanRecordService.updateStatus(worldId, WorldConstant.WorldCleanStatus.CLEAN);
logger.info("清理世界成功世界id:{},创建时间:{},人数:{}", world.getId(),
world.getCreateTime(), world.getMemberNum());
}
return line;
}
}

View File

@@ -1,392 +0,0 @@
package com.accompany.business.service.world;
import com.accompany.business.param.neteasepush.NeteaseSendMsgParam;
import com.accompany.business.service.ErBanNetEaseService;
import com.accompany.business.service.room.RoomCleanService;
import com.accompany.business.service.room.RoomService;
import com.accompany.business.service.user.UserInRoomService;
import com.accompany.business.vo.RoomVo;
import com.accompany.common.config.SystemConfig;
import com.accompany.common.constant.Attach;
import com.accompany.common.constant.Constant;
import com.accompany.common.netease.neteaseacc.result.RoomUserListRet;
import com.accompany.common.netease.neteaseacc.result.RubbishRet;
import com.accompany.common.status.BusiStatus;
import com.accompany.core.exception.ServiceException;
import com.accompany.core.model.Room;
import com.accompany.core.service.base.BaseService;
import com.accompany.world.common.PageContainer;
import com.accompany.world.constant.WorldConstant;
import com.accompany.world.entity.World;
import com.accompany.world.entity.WorldGroupChat;
import com.accompany.world.entity.WorldRoom;
import com.accompany.world.query.BaseQuery;
import com.accompany.world.query.WorldRoomCreateQuery;
import com.accompany.world.query.WorldRoomQuery;
import com.accompany.world.service.IWorldRoomService;
import com.accompany.world.service.IWorldService;
import com.accompany.world.vo.WorldRoomListVo;
import com.accompany.world.vo.WorldRoomVo;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors;
/**
* @Author: chucheng
* @Date: 2019/7/2 11:16
* @Description:
*/
@Service
public class WorldRoomService extends BaseService {
@Autowired
private IWorldRoomService iWorldRoomService;
@Autowired
private WorldGroupChatService worldGroupChatService;
@Resource(name = "bizExecutor")
private ThreadPoolExecutor bizExecutor;
@Autowired
private RoomService roomService;
@Autowired
private RoomCleanService roomCleanService;
@Autowired
private ErBanNetEaseService erBanNetEaseService;
@Autowired
private UserInRoomService userInRoomService;
@Autowired
private IWorldService iWorldService;
/**
* 获取世界派对列表,创始人派对排在第一位
* @param inParam
* @return
*/
public WorldRoomListVo getWorldRoomListByPage(WorldRoomQuery inParam){
WorldRoomListVo worldRoomListVo = new WorldRoomListVo();
List<WorldRoomVo> worldRoomVoList = iWorldRoomService.getWorldRoomListByPage(inParam);
for(WorldRoomVo worldRoomVo:worldRoomVoList){
World world = iWorldService.getByIdFromCache(worldRoomVo.getWorldId());
if(null != world) {
worldRoomVo.setWorldName(world.getName());
}
}
worldRoomListVo.setWorldRoomVoList(worldRoomVoList);
worldRoomListVo.setHasCurrentUserRoom(iWorldRoomService.existsInWorldList(inParam.getWorldId(),inParam.getUid()));
return worldRoomListVo;
}
public List<WorldRoomVo> getWorldRoomList(Long worldId){
return iWorldRoomService.getWorldRoomList(worldId);
}
/**
* 获取嗨玩派对, 排序
* @param worldId
* @return
* @throws Exception
*/
public List<WorldRoomVo> getWorldRoomListV2(Long worldId) throws Exception{
List<WorldRoomVo> worldRoomVoList = iWorldRoomService.getWorldRoomList(worldId);
for(WorldRoomVo worldRoomVo:worldRoomVoList){
int fixedNum = getOnlineUserNum(worldRoomVo.getRoomId(), 2);//固定在线人员
int notFixedNum = getOnlineUserNum(worldRoomVo.getRoomId(), 1);//非固定人员
worldRoomVo.setRealOnlineNum(fixedNum + notFixedNum); //真实在线人数
worldRoomVo.setTotalFlow(0); //半个小时房间流水
}
//排序
//人气:房间在线人数,不包括机器人
//流水:就是那个礼物流水啊
worldRoomVoList = worldRoomVoList.stream().sorted(Comparator.comparing(WorldRoomVo::getTotalFlow).reversed()).collect(Collectors.toList());
worldRoomVoList = worldRoomVoList.stream().sorted(Comparator.comparing(WorldRoomVo::getRealOnlineNum).reversed()).collect(Collectors.toList());
return worldRoomVoList;
}
public List<WorldRoomVo> getRoomListIncludeZeroOnline(Long worldId){
return iWorldRoomService.getRoomListIncludeZeroOnline(worldId);
}
public PageContainer<WorldRoom> getAllWorldRoomByPage(int page,int pageSize){
BaseQuery baseQuery = new BaseQuery();
baseQuery.setPage(page);
baseQuery.setPageSize(pageSize);
return this.iWorldRoomService.getAllWorldRoomByPage(baseQuery);
}
/**
* 创建世界派对关联
* @param worldId
* @param roomUid
* @param roomId
* @throws Exception
*/
public void createWorldRoom(Long worldId,Long roomUid,Long roomId){
WorldRoomCreateQuery inParam = new WorldRoomCreateQuery();
inParam.setWorldId(worldId);
inParam.setRoomUid(roomUid);
inParam.setRoomId(roomId);
// 更新派对列表
boolean success = iWorldRoomService.createWorldRoom(inParam);
if(!success){
throw new ServiceException(BusiStatus.SERVERBUSY);
}
}
/**
* 关闭世界派对
* @param roomUid
* @param roomId
*/
public void closeWorldRoom(Long roomUid,Long roomId){
this.iWorldRoomService.closeWorldRoom(roomId,roomUid);
}
/**
* 异步发送自定义消息告知客户端当前正在进行派对的人数
* @param worldId
*/
public void asyncSendNotifyMsg(Long worldId){
bizExecutor.execute(() -> {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
logger.error("asyncSendNotifyMsg error.sleep.worldId={}", worldId);
}
worldGroupChatService.asyncSendNotifyMsg(worldId);
});
}
/**
* 异步调起扫描房间在线人数。定时器也会调起
* @param roomUid
*/
public void asyncScanRoomOnline(Long roomUid){
bizExecutor.execute(() -> {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
logger.error("asyncScanRoomOnline error.sleep.roomUid={}",roomUid);
}
Room room = roomService.getRoomByUid(roomUid);
RoomVo roomVo = new RoomVo();
roomVo.setValid(room.getValid());
roomVo.setRoomId(room.getRoomId());
roomVo.setIsPermitRoom(room.getIsPermitRoom());
roomVo.setUid(room.getUid());
try {
logger.info("asyncScanRoomOnline info.roomUid={}",roomUid);
this.roomService.scanRoomOnline(roomVo);
} catch (Exception e) {
logger.error("asyncScanRoomOnline error.roomUid={}",roomUid);
}
});
}
/**
* 异步更新房间内用户user_in_room缓存
* @param roomId
* @param worldId
*/
public void asyncUpdateUserInRoom(Long roomId,Long worldId){
bizExecutor.execute(() -> {
updateUserInRoom(roomId,worldId);
});
}
private void updateUserInRoom(Long roomId,Long worldId){
logger.info("updateUserInRoom info, roomId:{},worldId:{}" , roomId,worldId);
Long curTime = System.currentTimeMillis();
try {
// 获取所有在线的固定成员
for(int i = 0 ; i<8 ;i++){
if(curTime == null){
break;
}
curTime = updateUserInRoom(roomId,worldId,2,curTime);
}
curTime = System.currentTimeMillis();
// 获取所有的非固定成员
for(int i = 0 ; i<8 ;i++){
if(curTime == null){
break;
}
curTime = updateUserInRoom(roomId,worldId,1,curTime);
}
} catch (Exception e) {
logger.error("updateUserInRoom error, roomId:{},worldId:{} " , roomId,worldId, e);
}
}
private Long updateUserInRoom(Long roomId,Long worldId,int type,long time) throws Exception {
logger.info("updateUserInRoom,roomId={},worldId={},type={},time={}",roomId,worldId,type,time);
String result = erBanNetEaseService.getMembersByPage(roomId, type, time, 100);
RubbishRet rubbishRet = gson.fromJson(result, RubbishRet.class);
if (rubbishRet.getCode() != 200) {
return null;
}
RoomUserListRet roomUserListRet = gson.fromJson(result, RoomUserListRet.class);
List<Map<String, Object>> list = roomUserListRet.getDesc().get("data");
if (CollectionUtils.isEmpty(list)) {
return null;
}
Long retTime = list.size()>=100?(Long)list.get(list.size()-1).get("enterTime"):null;
for (Map<String, Object> userMap : list) {
Object isRobot = userMap.get("isRobot");
if (isRobot == null || !(boolean) isRobot) {
Long uid = Long.parseLong((String) userMap.get("accid"));
RoomVo roomVo = this.userInRoomService.getUserInRoomInfoCache(uid);
if (roomVo == null) {
continue;
}
if (roomVo.getWorldId() != null && !Objects.equals(roomVo.getWorldId(), worldId)) {
roomVo.setWorldId(worldId);
this.userInRoomService.saveUserInRoomCache(uid, roomVo);
}
}
}
return retTime;
}
/**
* 是否存在世界派对
* @param worldId
* @return
*/
public boolean existsWorldRoom(Long worldId){
return this.iWorldRoomService.existsWorldRoom(worldId);
}
public void filterWorldRoom() {
PageContainer<WorldRoom> rooms = this.getAllWorldRoomByPage(1,1);
if(rooms == null || CollectionUtils.isEmpty(rooms.getRecords())){
return;
}
long toatalPage = rooms.getTotal()/100L+1;
// world_room表idcorpse_flag状态
Map<Long,Integer> resultMap = Maps.newHashMap();
for(int page = 1 ; page <= toatalPage ;page++){
rooms = this.getAllWorldRoomByPage(page,100);
if(rooms == null || CollectionUtils.isEmpty(rooms.getRecords())){
break;
}
for(WorldRoom worldRoom : rooms.getRecords()){
Room room = this.roomService.getRoomByUid(worldRoom.getRoomUid());
if (room == null || !room.getValid()){
this.closeWorldRoom(worldRoom.getRoomUid(),worldRoom.getRoomId());
continue;
}
if(!roomCleanService.hasRealUserInRoom(room.getRoomId())){
if(worldRoom.getCorpseFlag()!=null
&& Objects.equals(worldRoom.getCorpseFlag(), WorldConstant.WorldRoomCorpseFlag.notcorpse)){
resultMap.put(worldRoom.getId(),WorldConstant.WorldRoomCorpseFlag.corpse);
}
}else {
if(worldRoom.getCorpseFlag()!=null
&& Objects.equals(worldRoom.getCorpseFlag(), WorldConstant.WorldRoomCorpseFlag.corpse)){
resultMap.put(worldRoom.getId(),WorldConstant.WorldRoomCorpseFlag.notcorpse);
}
}
}
}
if(resultMap.size()>0){
for(Map.Entry<Long, Integer> entry : resultMap.entrySet()){
try{
this.iWorldRoomService.updateCorpseById(entry.getKey(),entry.getValue());
}catch (Exception e){
logger.error("filterWorldRoom updateCorpseById error.id={},corpseFlag={}",entry.getKey(),entry.getValue());
}
}
}
}
/**
* 发送群聊创建派对通知消息
* @param chatId
* @param roomId
* @param roomUid
*/
@Deprecated
private void sendGroupChatRoomNotifyMsg(Long chatId,Long roomId,Long roomUid){
bizExecutor.execute(() -> {
WorldGroupChat groupChat = worldGroupChatService.getById(chatId);
buildGroupChatRoomNotifyMsg(groupChat.getTid(),roomId,roomUid, Objects.equals(roomUid,groupChat.getUid()));
});
}
/**
* 构建群聊创建派对通知消息
* @param tid
* @param roomId
* @param roomUid
* @param ownerFlag
* @return
*/
@Deprecated
private NeteaseSendMsgParam buildGroupChatRoomNotifyMsg(String tid,Long roomId,Long roomUid,boolean ownerFlag){
NeteaseSendMsgParam neteaseSendMsgParam = new NeteaseSendMsgParam();
neteaseSendMsgParam.setFrom(SystemConfig.systemMessageUid);
// 云信群聊tid
neteaseSendMsgParam.setTo(tid);
// 1.高级群消息
neteaseSendMsgParam.setOpe(1);
//100自定义消息
neteaseSendMsgParam.setType(Constant.DefineProtocol.CUSTOM_MESS_DEFINE);
JSONObject jsonObject = new JSONObject();
jsonObject.put("roomId", roomId);
jsonObject.put("roomUid", roomUid);
jsonObject.put("ownerFlag", ownerFlag);
Attach attach = new Attach();
attach.setFirst(Constant.DefineProtocol.WORLD_HEAD);
attach.setSecond(Constant.DefineProtocol.WORLD_SUB_GROUP_CHAT_ROOM_NOTIFY);
attach.setData(jsonObject);
neteaseSendMsgParam.setAttach(attach);
return neteaseSendMsgParam;
}
/**
* 查询房间真是在线人数
* @param roomId
* @param type
* @return
* @throws Exception
*/
public int getOnlineUserNum(Long roomId, int type) throws Exception{
String result = erBanNetEaseService.getMembersByPage(roomId, type, System.currentTimeMillis(), 100);
RubbishRet rubbishRet = gson.fromJson(result, RubbishRet.class);
if (rubbishRet.getCode() != 200) {
return 0;
}
RoomUserListRet roomUserListRet = gson.fromJson(result, RoomUserListRet.class);
List<Map<String, Object>> list = roomUserListRet.getDesc().get("data");
if (CollectionUtils.isEmpty(list)) {
return 0;
}
int count = 0;
for (Map<String, Object> userMap : list) {
Object isRobot = userMap.get("isRobot");
if (isRobot == null || !(boolean) isRobot) {
count ++;
}
}
return count;
}
}

View File

@@ -2,7 +2,6 @@ package com.accompany.business.service.world;
import com.accompany.business.sensitvienew.SensitiveFilterUtil;
import com.accompany.business.service.user.UsersService;
import com.accompany.common.constant.MessageConstant;
import com.accompany.common.redis.RedisKey;
import com.accompany.common.status.BusiStatus;
import com.accompany.common.utils.DateTimeUtil;
@@ -14,8 +13,6 @@ import com.accompany.world.common.ParamUtils;
import com.accompany.world.common.WorldException;
import com.accompany.world.constant.WorldConstant;
import com.accompany.world.entity.*;
import com.accompany.world.query.WorldGroupChatQuery;
import com.accompany.world.query.WorldMemberQuery;
import com.accompany.world.query.WorldQuery;
import com.accompany.world.service.*;
import com.accompany.world.vo.*;
@@ -46,34 +43,12 @@ import java.util.stream.Collectors;
@Service
public class WorldService extends BaseService {
private Logger logger = LoggerFactory.getLogger(WorldService.class);
private final int CACHE_EXPIRE_TIME = 60;
@Autowired
private IWorldService iWorldService;
@Autowired
private UsersService usersService;
@Autowired
private WorldTypeService worldTypeService;
@Autowired
private IWorldMemberService iWorldMemberService;
@Autowired
private WorldMemberService worldMemberService;
@Autowired
private WorldMemberApplyRecordService worldMemberApplyRecordService;
@Autowired
private WorldGroupChatService worldGroupChatService;
@Autowired
private IWorldGroupChatService iWorldGroupChatService;
@Autowired
private WorldRoomService worldRoomService;
@Autowired
private WorldMessageService messageService;
@Autowired
private IWorldPreCleanRecordService iWorldPreCleanRecordService;
@Resource(name = "bizExecutor")
private ThreadPoolExecutor bizExecutor;
/**
* 话题首页
@@ -163,148 +138,6 @@ public class WorldService extends BaseService {
return vo;
}
/**
* 加入话题
*
* @param worldId
* @param uid
* @param addGroupChat 加入话题时,是否同时加入群聊
* @return
*/
public int join(Long worldId, Long uid,Long roomUid, boolean addGroupChat) throws Exception {
String lockKey = RedisKey.world_lock.getKey(String.valueOf(worldId));
String lockVal = jedisLockService.lock(lockKey, 1000, 10 * 1000);
if (StringUtils.isEmpty(lockVal)) {
throw new WorldException(BusiStatus.SERVERBUSY.getReasonPhrase());
}
try {
World world = iWorldService.getByIdFromCache(worldId);
ParamUtils.isNotTrue(null == world || world.getStatus() != WorldConstant.STATUS_VALID,
"加入世界失败,世界不存在或已解散");
ParamUtils.isNotTrue(iWorldService.getJoinWorldNum(uid) >= WorldConstant.MAX_JOIN_WORLD,
String.format("世界超过%s个 不可以再加入咯", WorldConstant.MAX_JOIN_WORLD));
if(addGroupChat) {
WorldGroupChat groupChat = iWorldGroupChatService.getOneByWorldId(worldId);
if(groupChat != null) {
ParamUtils.isNotTrue(world.getMemberNum() >= WorldConstant.MAX_WORLD_MEMBER_NUM,
"哎呀,世界人满,换个试试吧~");
}
}
//是否已在话题中
ParamUtils.isNotTrue(iWorldService.isInWorld(uid, worldId), "加入失败,您已在该世界中,请勿重复加入");
//需要审核才能加入话题
if (world.getAgreeFlag() != null && world.getAgreeFlag()) {
return worldMemberApplyRecordService.addApplyRecord(worldId, uid);
} else {
int result = worldMemberService.addNewMember(worldId, uid, addGroupChat);
if(result > 0 && roomUid != null){
// 发送房间公屏消息
this.messageService.sendJoinSuccessChatRoomMsg(roomUid,uid,world);
}
return result;
}
} finally {
jedisLockService.unlock(lockKey, lockVal);
}
}
/**
* 处理审核
* 审核时,直接加入话题群聊中
* @param worldId
* @param ownerUid
* @param recordId
* @param result
* @return
*/
public Map<String, Object> approve(Long worldId, Long ownerUid, Long recordId, Byte result, Long targetUid,
boolean addGroupChat) throws Exception {
String lockKey = RedisKey.world_lock.getKey(String.valueOf(worldId));
String lockVal = jedisLockService.lock(lockKey, 1000, 10 * 1000);
if (StringUtils.isEmpty(lockVal)) {
throw new WorldException(BusiStatus.SERVERBUSY.getReasonPhrase());
}
Map<String, Object> resultMap = new HashMap<>(4);
try {
WorldMemberApplyRecord recordWithId = worldMemberApplyRecordService.getById(recordId);
ParamUtils.isTrue(null != recordWithId, "审核失败,申请记录不存在!");
if(recordWithId.getStatus() != WorldConstant.ApproveStatus.STATUS_NOT_APPROVE) {
switch (recordWithId.getStatus()) {
case (int)WorldConstant.ApproveStatus.STATUS_APPROVE_PASS:
resultMap.put("status", MessageConstant.AGREE);
break;
case (int)WorldConstant.ApproveStatus.STATUS_APPROVE_NOT_PASS:
resultMap.put("status", MessageConstant.REJECT);
break;
case (int)WorldConstant.ApproveStatus.STATUS_APPROVE_FAIL:
resultMap.put("status", MessageConstant.REJECT);
break;
case (int)WorldConstant.ApproveStatus.STATUS_APPROVE_EXPIRED:
resultMap.put("status", MessageConstant.EXPIRE);
break;
default:
resultMap.put("status", MessageConstant.REJECT);
break;
}
return resultMap;
}
WorldMemberApplyRecord applyRecord = worldMemberApplyRecordService.getExistInCache(worldId, targetUid);
ParamUtils.isTrue(null != applyRecord, "审核失败,申请已过期,或已审核完成");
ParamUtils.isTrue(recordId.equals(applyRecord.getId()), "审核失败,申请已过期,或已审核完成");
World world = iWorldService.getByIdFromCache(worldId);
ParamUtils.isNotTrue(null == world || world.getStatus() != WorldConstant.STATUS_VALID,
"审核失败,世界不存在或已解散", () -> worldMemberApplyRecordService.updateById(recordId,
(int) WorldConstant.ApproveStatus.STATUS_APPROVE_FAIL, "审核失败,世界不存在或已解散",
(int) WorldConstant.ApproveStatus.STATUS_NOT_APPROVE));
ParamUtils.isTrue(world.getOwnerUid().equals(ownerUid), "审核失败,当前用户不是该世界创建人");
ParamUtils.isNotTrue(iWorldService.isInWorld(targetUid, worldId),
"审核失败,用户已在话题中", () -> worldMemberApplyRecordService.updateById(recordId,
(int) WorldConstant.ApproveStatus.STATUS_APPROVE_FAIL, "审核失败,用户已在话题中",
(int) WorldConstant.ApproveStatus.STATUS_NOT_APPROVE));
ParamUtils.isNotTrue(iWorldService.getJoinWorldNum(targetUid) >= WorldConstant.MAX_JOIN_WORLD,
"审核失败,用户加入世界数已达上限", () -> worldMemberApplyRecordService.updateById(recordId,
(int) WorldConstant.ApproveStatus.STATUS_APPROVE_FAIL, "审核失败,用户加入世界数已达上限",
(int) WorldConstant.ApproveStatus.STATUS_NOT_APPROVE));
if(addGroupChat) {
ParamUtils.isNotTrue(world.getMemberNum() >= WorldConstant.MAX_WORLD_MEMBER_NUM,
"审核失败,世界人数已达上限", () -> worldMemberApplyRecordService.updateById(recordId,
(int) WorldConstant.ApproveStatus.STATUS_APPROVE_FAIL, "审核失败,世界人数已达上限",
(int) WorldConstant.ApproveStatus.STATUS_NOT_APPROVE));
}
if (result == WorldConstant.ApproveStatus.STATUS_APPROVE_PASS) {
int line = worldMemberApplyRecordService.updateById(recordId,
(int) WorldConstant.ApproveStatus.STATUS_APPROVE_PASS, "",
(int) WorldConstant.ApproveStatus.STATUS_NOT_APPROVE);
if(line > 0) {
worldMemberService.addNewMember(worldId, targetUid, addGroupChat);
resultMap.put("status", MessageConstant.AGREE);
}
return resultMap;
} else {
int line = worldMemberApplyRecordService.updateById(recordId,
(int) WorldConstant.ApproveStatus.STATUS_APPROVE_NOT_PASS, "",
(int) WorldConstant.ApproveStatus.STATUS_NOT_APPROVE);
if(line > 0) {
//发送拒绝消息
Users owner = usersService.getUsersByUid(world.getOwnerUid());
messageService.sendJoinWorldFailMessage(world, targetUid, owner);
resultMap.put("status", MessageConstant.REJECT);
}
return resultMap;
}
} finally {
jedisLockService.unlock(lockKey, lockVal);
}
}
/**
* 解散话题
* @param worldId
@@ -323,255 +156,15 @@ public class WorldService extends BaseService {
"解散世界失败,未查到世界信息,或世界已解散");
ParamUtils.isTrue(ownerUid.equals(world.getOwnerUid()), "解散世界失败,用户不是世界创建者");
//自动清理时如果话题成员数大于3则不清理
if (dismissType == WorldConstant.DismissType.AUTO_CLEAN && world.getMemberNum() > 3) {
return 0;
}
// 解除群聊
this.worldGroupChatService.removeGroupChat(worldId, ownerUid);
//1. 查出世界的成员将每个成员加入的世界数减1
WorldMemberQuery query = new WorldMemberQuery();
query.setWorldId(worldId);
query.setStatus(WorldConstant.STATUS_VALID);
List<WorldMember> members = iWorldMemberService.getWorldMember(query);
for (WorldMember worldMember : members) {
// 减少每个成员的加入世界
iWorldService.exitWorldForCache(worldMember.getUid(), worldId);
}
//删除所有世界成员
iWorldMemberService.deleteAllWorldMember(worldId);
//2. 更新世界数据:更新为删除状态
String remark = "";
if(dismissType == WorldConstant.DismissType.AUTO_CLEAN) {
remark = "话题自动清理:清理完成";
}
int result = iWorldService.deleteWorld(worldId, remark);
int result = iWorldService.deleteWorld(worldId, "");
//3. 删除最热标签
iWorldService.removeHotWorld(worldId);
//4. 发送通知消息
messageService.sendDismissMessage(world, members, dismissType);
return result;
} finally {
jedisLockService.unlock(lockKey, lockVal);
}
}
/**
* 退出话题
* @see WorldConstant.LeaveGroupChatType about leaveType
* @param worldId
* @param uid
* @param leaveType
* @return
*/
public int exit(Long worldId, Long uid, int leaveType) throws Exception{
String lockKey = RedisKey.world_lock.getKey(String.valueOf(worldId));
String lockVal = jedisLockService.lock(lockKey, 1000, 10 * 1000);
if (StringUtils.isEmpty(lockVal)) {
throw new WorldException(BusiStatus.SERVERBUSY.getReasonPhrase());
}
try {
World world = iWorldService.getByIdFromCache(worldId);
ParamUtils.isNotTrue(null == world, "退出世界失败,未查到世界信息,或世界已解散");
if(world.getStatus() == WorldConstant.STATUS_VALID) {
ParamUtils.isNotTrue(world.getOwnerUid().equals(uid), "退出世界失败,创建人不能退出世界");
}
//1. 退出群聊
worldGroupChatService.leaveGroupChat(worldId, uid, leaveType, false);
//2. 删除话题成员
int result = iWorldMemberService.deleteWorldMember(worldId, uid);
if(result > 0) {
//3. 减少当前用户加入的话题数
iWorldService.exitWorldForCache(uid, worldId);
//4. 减少话题的用户数
iWorldService.incrWorldMemberNum(worldId, -1);
}
// 发送消息提醒
Users user = usersService.getUsersByUid(uid);
Users owner = usersService.getUsersByUid(world.getOwnerUid());
messageService.sendExitWorldMessage(world, user, owner, leaveType);
return result;
} finally {
jedisLockService.unlock(lockKey, lockVal);
}
}
/**
* 编辑话题
* @param worldBo
* @return
*/
public int edit(WorldBo worldBo) throws Exception {
ParamUtils.isTrue(StringUtils.length(worldBo.getName()) <= 16,
"编辑失败,话题名称过长");
ParamUtils.isTrue(StringUtils.length(worldBo.getDescription()) <= 36,
"编辑失败,话题描述过长");
World oldWorld = iWorldService.getByIdFromCache(worldBo.getWorldId());
ParamUtils.isTrue(null != oldWorld,"编辑失败,世界不存在或已解散");
ParamUtils.isTrue(oldWorld.getStatus() == WorldConstant.STATUS_VALID, "编辑失败,该世界已解散!");
ParamUtils.isTrue(worldBo.getUid().equals(oldWorld.getOwnerUid()), "编辑失败,当前用户不是该世界创建人!");
int result = 0;
World entity = new World();
entity.setId(worldBo.getWorldId());
//处理描述
if(StringUtils.isBlank(worldBo.getDescription())) {
entity.setDescription(WorldConstant.WORLD_DEFAULT_DESC);
} else if(!StringUtils.equalsIgnoreCase(oldWorld.getDescription(), worldBo.getDescription())) {
entity.setDescription(SensitiveFilterUtil.getStringSensitiveFilter(worldBo.getDescription()));
}
entity.setIcon(worldBo.getIcon());
entity.setWorldTypeId(worldBo.getWorldTypeId());
entity.setAgreeFlag(worldBo.getAgreeFlag());
entity.setUpdateTime(new Date());
//更新了公告
if (!StringUtils.equals(oldWorld.getNotice(), entity.getNotice())) {
entity.setNoticeUpdateTime(new Date());
if(StringUtils.isNotBlank(worldBo.getNotice())) {
entity.setNotice(SensitiveFilterUtil.getStringSensitiveFilter(worldBo.getNotice()));
} else {
entity.setNotice(worldBo.getNotice());
}
}
//是否更新了图像
boolean updateIcon = StringUtils.equalsIgnoreCase(worldBo.getIcon(), oldWorld.getIcon());
//修改了世界名, 添加世界名称锁
boolean worldNameChange = false;
String lockKey = RedisKey.world_name_lock.getKey();
String lockVal = "";
if(!StringUtils.equalsIgnoreCase(worldBo.getName(), oldWorld.getName())) {
worldNameChange = true;
lockVal = jedisLockService.lock(lockKey, 1000, 10 * 1000);
if (StringUtils.isEmpty(lockVal)) {
throw new WorldException(BusiStatus.SERVERBUSY.getReasonPhrase());
}
}
try {
if (worldNameChange && iWorldService.hasSameName(worldBo.getName())) {
throw new WorldException("编辑失败,话题名称重复!");
}
//修改了世界名-敏感词过滤
if (worldNameChange) {
if(SensitiveFilterUtil.getBooleanSensitiveFilter(worldBo.getName())) {
entity.setName(SensitiveFilterUtil.getStringSensitiveFilter(worldBo.getName()));
} else {
entity.setName(worldBo.getName());
}
}
result = iWorldService.updateWorldById(entity);
//更新了头像且结果值大于0
if(!updateIcon && result > 0) {
WorldGroupChat groupChat = iWorldGroupChatService.getOneByWorldId(oldWorld.getId());
if(null != groupChat && WorldConstant.WorldGroupChatStatus.normal.equals(groupChat.getStatus())) {
bizExecutor.execute(()-> {
WorldGroupChatQuery inParam = new WorldGroupChatQuery();
inParam.setChatId(groupChat.getId());
inParam.setUid(groupChat.getUid());
inParam.setIcon(worldBo.getIcon());
try {
worldGroupChatService.updateGroupChat(inParam);
} catch (Exception e) {
logger.error("修改话题群聊头像出错!", e);
}
});
}
}
} finally {
if(worldNameChange) {
jedisLockService.unlock(lockKey, lockVal);
}
}
return result;
}
/**
* 踢出世界
* @param worldId
* @param kickUid 被踢出者uid
* @param uid 操作人uid
* @return
* @throws Exception
*/
public int kick(Long worldId,Long kickUid, Long uid) throws Exception {
World world = iWorldService.getByIdFromCache(worldId);
ParamUtils.isNotTrue(null == world || world.getStatus() != WorldConstant.STATUS_VALID,
"退出世界失败,未查到世界信息,或世界已解散");
if(!Objects.equals(world.getOwnerUid(),uid)){
logger.warn("踢出世界失败,用户不是{}不是世界{}创建人!", uid, worldId);
return 0;
}
return this.exit(worldId, kickUid, WorldConstant.LeaveGroupChatType.passive);
}
/**
*
* @return
*
* 世界成员人数少于3人3天后会被关闭关闭前会有小秘书通知
*
*/
public int preCleanWorld() throws Exception {
int result = 0;
int current = 1;
int pageSize = 100;
Date now = new Date();
Date endTime = DateTimeUtil.addDays(now, -3);
QueryWrapper<World> queryWrapper = new QueryWrapper<>();
queryWrapper.le("create_time", endTime)
.lt("member_num", 3)
.eq("`status`", WorldConstant.STATUS_VALID)
.eq("pre_clean_status", WorldConstant.WorldCleanStatus.NORMAL);
Page<World> page = new Page(current, pageSize);
IPage<World> ipage = iWorldService.page(page, queryWrapper);
List<World> records = ipage.getRecords();
if(CollectionUtils.isEmpty(records)) {
logger.info("预清理人数不足3的话题完成计划清理数{}", result);
return 0;
}
for (World record : records) {
int line = iWorldPreCleanRecordService.add(record.getId());
if(line > 0) {
World world = new World();
world.setId(record.getId());
world.setRemark("话题自动清理:进入预清理阶段");
world.setPreCleanStatus(WorldConstant.WorldCleanStatus.CLEAN);
iWorldService.updateWorldById(world);
messageService.sendDismissAlarmMessage(record);
logger.info("预清理世界成功世界id:{},创建时间:{},人数:{}", record.getId(),
record.getCreateTime(), record.getMemberNum());
}
result += line;
}
//继续下一页,更新再查询,记录始终在第一页
while(ipage.getTotal() >= pageSize) {
page = new Page(current, pageSize);
ipage = iWorldService.page(page, queryWrapper);
records = ipage.getRecords();
if(CollectionUtils.isNotEmpty(records)) {
for (World record : records) {
int line = iWorldPreCleanRecordService.add(record.getId());
if(line > 0) {
World world = new World();
world.setId(world.getId());
world.setRemark("话题自动清理:进入预清理阶段");
world.setPreCleanStatus(WorldConstant.WorldCleanStatus.CLEAN);
iWorldService.updateWorldById(world);
messageService.sendDismissAlarmMessage(record);
logger.info("预清理世界成功世界id:{},创建时间:{},人数:{}", record.getId(),
record.getCreateTime(), record.getMemberNum());
}
result += line;
}
}
}
logger.info("预清理人数不足3的话题完成清理数{}", result);
return result;
}
/**
* 从缓存中获取内容
* @param worldId
@@ -584,16 +177,6 @@ public class WorldService extends BaseService {
return iWorldService.getByIdFromCache(worldId);
}
/**
* 用户是否在话题中
* @param uid
* @param worldId
* @return
*/
public boolean isInWorld(Long uid, Long worldId) {
// return iWorldService.isInWorld(uid, worldId);
return false;
}
/**
* 重建hot标签缓存
@@ -602,30 +185,6 @@ public class WorldService extends BaseService {
return iWorldService.rebuildHotTagSet();
}
/**
* 重建话题人数缓存
*/
public int rebuildWorldMemberNum() {
return iWorldService.rebuildWorldMemberNum();
}
/**
* 重建加入世界缓存
* @param uids
*/
public int rebuildJoinWorldCache(String uids) {
String[] uidArray = uids.split(",");
List<Long> uidList = new ArrayList<>(uidArray.length);
for(String uidStr : uidArray) {
long uid = NumberUtils.toLong(uidStr, 0);
if(uid != 0) {
uidList.add(uid);
}
}
uidList.stream().forEach(uid -> iWorldService.rebuildJoinWorldCache(uid));
return uidList.size();
}
/**
* 获取最热的世界
* @param size
@@ -638,15 +197,6 @@ public class WorldService extends BaseService {
return gson.fromJson(val, new TypeToken<List<World>>() {}.getType());
}
Set<Long> ids = iWorldService.listHotWorld();
if(ids.size() < size) {
Collection<Long> collection = iWorldService.listRevRankByMemberNum(0, size);
for(Long rankWorldId : collection) {
if(ids.size() >= size) {
break;
}
ids.add(rankWorldId);
}
}
if(CollectionUtils.isEmpty(ids)) {
return new ArrayList<>();
}
@@ -663,25 +213,6 @@ public class WorldService extends BaseService {
return worlds;
}
/**
* 获取用户加入的世界数
* @param uid
* @return
*/
public int getJoinWorldNum(Long uid) {
return iWorldService.getJoinWorldNum(uid);
}
/**
* 查询我加入的话题
* @param uid
* @param page
* @param pageSize
* @return
*/
public IPage<World> queryMyJoinWorlds(Long uid, int page, int pageSize) {
return iWorldService.queryMyJoinWorlds(uid, page, pageSize);
}
/**
* world转换为worldVo
* @param world
@@ -706,8 +237,6 @@ public class WorldService extends BaseService {
} else {
worldDetailVo.setNoticeUpdateTime(world.getCreateTime().getTime());
}
worldDetailVo.setMembers(new ArrayList<>());
worldDetailVo.setMemberNum(world.getMemberNum());
//worldType
WorldType worldType = worldTypeService.queryByIdFromCache(world.getWorldTypeId());
@@ -717,43 +246,10 @@ public class WorldService extends BaseService {
}
//当前用户是否在话题中
worldDetailVo.setInWorld(false);
// 默认人数大于3人创建群聊
int num = 3;
//多少人自动创建群聊
worldDetailVo.setCreateGroupChatNum(num);
// 统计在线人数
worldDetailVo.setOnlineNum(0);
return worldDetailVo;
}
/**
* 获取群聊
* @param worldId
* @return
*/
private WorldGroupChat getGroupChat(Long worldId) {
List<WorldGroupChat> worldGroupChats = iWorldGroupChatService.getByWorldId(worldId);
WorldGroupChat worldGroupChat = CollectionUtils.isNotEmpty(worldGroupChats) ? worldGroupChats.get(0) : null;
return worldGroupChat;
}
/**
* 获取成员信息
* @param worldId
* @param uid
* @return
*/
private WorldMember getMembers(Long worldId, Long uid) {
//查询当前用户的信息
WorldMemberQuery query = new WorldMemberQuery();
query.setUid(uid);
query.setWorldId(worldId);
query.setStatus(WorldConstant.WorldMemberStatus.normal);
List<WorldMember> list = iWorldMemberService.getWorldMember(query);
return CollectionUtils.isNotEmpty(list) ? list.get(0) : null;
}
/**
* world转换为worldVo
* @param world
@@ -772,87 +268,9 @@ public class WorldService extends BaseService {
worldVo.setOwnerUid(world.getOwnerUid());
worldVo.setSeqNo(world.getSeqNo());
worldVo.setAgreeFlag(world.getAgreeFlag());
worldVo.setMemberNum(world.getMemberNum());
worldVo.setMembers(new ArrayList<>());
return worldVo;
}
/**
* 获取世界成员
* @param worldId
* @param ownerUid
* @return
*/
private List<WorldMemberVo> getWorldMember(Long worldId, Long ownerUid) {
String key = RedisKey.world_member_cache.getKey(String.valueOf(worldId));
String val = jedisService.get(key);
if(StringUtils.isNotBlank(val)) {
return gson.fromJson(val, new TypeToken<List<WorldMemberVo>>() {}.getType());
}
//添加成员:包括创建人在内的三个人
List<WorldMemberVo> memberVos = new ArrayList<>();
//1. 创建人
if(null != ownerUid) {
WorldMemberQuery creatorQuery = new WorldMemberQuery();
creatorQuery.setWorldId(worldId);
creatorQuery.setUid(ownerUid);
creatorQuery.setStatus(WorldConstant.STATUS_VALID);
creatorQuery.setLimit(1);
List<WorldMember> owners = iWorldMemberService.getWorldMember(creatorQuery);
if (CollectionUtils.isNotEmpty(owners)) {
WorldMember owner = owners.get(0);
memberVos.add(convertMemberVo(owner, ownerUid));
}
}
//2. 其他人
int otherCount = 3;
WorldMemberQuery otherMemberQuery = new WorldMemberQuery();
otherMemberQuery.setWorldId(worldId);
otherMemberQuery.setStatus(WorldConstant.STATUS_VALID);
otherMemberQuery.setLimit(otherCount);
List<WorldMember> worldMembers = iWorldMemberService.getWorldMember(otherMemberQuery);
if(CollectionUtils.isNotEmpty(worldMembers)) {
for(WorldMember member : worldMembers) {
if(memberVos.size() > otherCount) {
break;
}
if(member.getUid().equals(ownerUid)) {
continue;
}
memberVos.add(convertMemberVo(member, ownerUid));
}
}
if(CollectionUtils.isNotEmpty(memberVos)) {
//缓存一分钟
jedisService.set(key, gson.toJson(memberVos), CACHE_EXPIRE_TIME);
}
return memberVos;
}
/**
* 对象转换
*
* @param member
* @return
*/
private WorldMemberVo convertMemberVo(WorldMember member, Long ownerUid) {
WorldMemberVo worldMemberVo = new WorldMemberVo();
worldMemberVo.setUid(member.getUid());
worldMemberVo.setStatus(member.getStatus());
worldMemberVo.setPromtFlag(member.getPromtFlag());
worldMemberVo.setMuteFlag(member.getMuteFlag());
worldMemberVo.setOwnerFlag(ownerUid.equals(member.getUid()));
Users user = usersService.getUsersByUid(member.getUid());
if (null != user) {
worldMemberVo.setAvatar(user.getAvatar());
worldMemberVo.setGender(user.getGender());
worldMemberVo.setNick(user.getNick());
}
return worldMemberVo;
}
/**
* 根据类型获取首页世界
* @param worldTypeId
@@ -860,17 +278,7 @@ public class WorldService extends BaseService {
* @return
*/
private WorldHomeDataVo getHomeDateVo(long worldTypeId, long uid) {
if(worldTypeId == WorldConstant.ExtraWorldType.ID_MY_WORLD) {
//查询我加入的世界,需要实时查询
WorldHomeDataVo myJoinWorlds = new WorldHomeDataVo();
IPage<World> myJoinWorldPage = iWorldService.queryMyJoinWorlds(uid, 1, 5);
myJoinWorlds.setId(WorldConstant.ExtraWorldType.ID_MY_WORLD);
myJoinWorlds.setTypeName(WorldConstant.ExtraWorldType.NAME_MY_WORLDS);
myJoinWorlds.setWorlds(myJoinWorldPage.getRecords().stream()
.map(world -> convertHomeVo(world))
.collect(Collectors.toList()));
return myJoinWorlds;
} else if(worldTypeId == WorldConstant.ExtraWorldType.ID_RECOMMEND_WORLD) {
if(worldTypeId == WorldConstant.ExtraWorldType.ID_RECOMMEND_WORLD) {
//查询推荐的世界,已加缓存
WorldHomeDataVo recommendWorlds = new WorldHomeDataVo();
IPage<World> recommendWorldPage = iWorldService.queryRecommendWorlds(1, 21);
@@ -953,7 +361,6 @@ public class WorldService extends BaseService {
homeVo.setOwnerUid(world.getOwnerUid());
homeVo.setName(world.getName());
homeVo.setIcon(world.getIcon());
homeVo.setMemberNum(world.getMemberNum());
//话题分类
WorldType worldType = worldTypeService.queryByIdFromCache(world.getWorldTypeId());
if(worldType != null) {
@@ -972,14 +379,6 @@ public class WorldService extends BaseService {
}
long createTime = world.getCreateTime().getTime();
// 2. 世界人数最多的前5个有最热标签
int rank = iWorldService.getRevRankByMemberNum(world.getId());
if(rank >= 0 && rank < 5) {
tagSet.add(WorldConstant.WorldTag.HOT);
}
//3. 是否派对中
if(worldRoomService.existsWorldRoom(world.getId())) {
tagSet.add(WorldConstant.WorldTag.PARTY);
}
if(tagSet.size() > 3) {
tagSet.remove(WorldConstant.WorldTag.NEW);
} else if(tagSet.size() < 3) {
@@ -1001,56 +400,4 @@ public class WorldService extends BaseService {
return homeVo;
}
/**
* 统计在线人数,结果缓存一分钟
* @param worldId
* @return
*/
private int countOnlineNumWithCache(Long worldId){
String cacheKey = RedisKey.world_group_chat_online_num_cache.getKey(String.valueOf(worldId));
String cacheVal = jedisService.get(cacheKey);
if(StringUtils.isNotBlank(cacheVal)) {
return NumberUtils.toInt(cacheVal);
}
WorldMemberQuery query = new WorldMemberQuery();
query.setStatus(WorldConstant.WorldMemberStatus.normal);
query.setWorldId(worldId);
List<WorldMember> memberList = iWorldMemberService.getWorldMember(query);
if(CollectionUtils.isEmpty(memberList)){
return 0;
}
List<String> uids = memberList.stream().map(item -> item.getUid().toString()).collect(Collectors.toList());
List<String> onlineStatusList = jedisService.hmread(RedisKey.user_online_status.getKey(),uids.toArray(new String[uids.size()]));
long count = Optional.ofNullable(onlineStatusList).orElse(Lists.newArrayList())
.stream().filter(val -> val != null).count();
//设置缓存一分钟
jedisService.set(cacheKey, String.valueOf(count), CACHE_EXPIRE_TIME);
return (int)count;
}
/**
* uid在该worldId中为第几位成员
* 结果缓存一分钟
* @param worldId
* @param uid
* @return
*/
private Long getMemberNoWithCache(Long worldId, Long uid) {
String cacheKey = RedisKey.world_member_number_cache.getKey(String.valueOf(worldId));
String cacheVal = jedisService.get(cacheKey);
if(StringUtils.isNotBlank(cacheVal)) {
return NumberUtils.toLong(cacheVal);
}
Long result = iWorldMemberService.getMemberNo(worldId, uid);
if(null != result) {
//设置缓存一分钟
jedisService.set(cacheKey, String.valueOf(result), CACHE_EXPIRE_TIME);
}
return result;
}
public List<Long> getWorldIdByTypeId(Long worldTypeID){
return iWorldService.getWorldIdByTypeId(worldTypeID);
}
}

View File

@@ -700,22 +700,6 @@ public class RoomController extends BaseController {
}
@RequestMapping(value = "world/mode/open", method = RequestMethod.POST)
@ResponseBody
@Authorization
public BusiResult openWorldMode(@RequestParam(value = "roomUid") Long roomUid,
@RequestParam(value = "worldId") Long worldId) throws Exception {
return new BusiResult(BusiStatus.SUCCESS, roomService.openWorldMode(roomUid, worldId));
}
@RequestMapping(value = "world/mode/close", method = RequestMethod.POST)
@ResponseBody
@Authorization
public BusiResult closeWorldMode(@RequestParam(value = "roomUid") Long roomUid) throws Exception {
roomService.closeWorldMode(roomUid);
return new BusiResult(BusiStatus.SUCCESS);
}
/**
* 最小化房间后重新打开判断是否可以进房
*

View File

@@ -192,21 +192,6 @@ public class UsersController extends BaseController {
bizExecutor.execute(() -> {
try {
//处理话题
IPage<World> worldIPage = worldService.queryMyJoinWorlds(uid, 1, 20);
if (CollectionUtils.isNotEmpty(worldIPage.getRecords())) {
List<WorldInfo> list = worldIPage.getRecords().stream().map(
world -> {
WorldInfo worldInfo = new WorldInfo();
worldInfo.setWorldId(world.getId());
worldInfo.setName(world.getName());
worldInfo.setIcon(world.getIcon());
return worldInfo;
}
).collect(Collectors.toList());
userVo.setJoinWorlds(list);
}
// 用户资料卡
String infoCardStr = jedisService.hget(RedisKey.user_using_info_card.getKey(), uid.toString());
if (StringUtils.isNotBlank(infoCardStr)) {

View File

@@ -10,7 +10,6 @@ import com.accompany.common.status.BusiStatus;
import com.accompany.core.exception.ServiceException;
import com.accompany.core.util.StringUtils;
import com.accompany.core.vo.UserVo;
import com.accompany.world.bo.WorldBo;
import com.accompany.world.common.WorldException;
import com.accompany.world.constant.WorldConstant;
import com.accompany.world.query.BaseQuery;
@@ -26,7 +25,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.HashMap;
@@ -113,214 +111,6 @@ public class WorldController {
return new BusiResult<>(worldVo);
}
/**
* 解散世界
* @param worldId世界id
* @param uid当前用户id必须为创建id
* @return
*/
@RequestMapping(value = "/dismiss")
@ResponseBody
public BusiResult dismiss(Long worldId, Long uid) {
logger.info("解散话题worldId:{}, uid:{}", worldId, uid);
if (worldId == null || uid == null) {
return new BusiResult<UserVo>(BusiStatus.PARAMETERILLEGAL);
}
BusiResult busiResult = new BusiResult(BusiStatus.SUCCESS);
try {
int result = worldService.dismiss(worldId, uid, WorldConstant.DismissType.CREATOR);
if(result <= 0) {
busiResult = new BusiResult(BusiStatus.REQUEST_PARAM_ERROR);
}
} catch (WorldException e) {
logger.warn("解散话题异常:{}", e.getMessage());
return new BusiResult(BusiStatus.SERVERERROR,e. getMessage(),null);
} catch (ServiceException e){
return new BusiResult(e.getBusiStatus());
} catch (Exception e) {
logger.error("解散话题异常", e);
busiResult.setCode(BusiStatus.SERVEXCEPTION.value());
busiResult.setMessage("系统错误,请稍候再试");
}
return busiResult;
}
/**
* 加入话题
* @param worldId
* @param uid
* @return
*/
@RequestMapping(value = "/join")
@ResponseBody
public BusiResult join(Long worldId, Long uid,Long roomUid,
@RequestParam(value = "addGroupChat", defaultValue = "true") boolean addGroupChat) {
logger.info("加入话题worldId:{}, uid:{}, roomUid:{}", worldId, uid,roomUid);
if (worldId == null || uid == null) {
return new BusiResult<UserVo>(BusiStatus.PARAMETERILLEGAL);
}
BusiResult busiResult = new BusiResult(BusiStatus.SUCCESS);
try {
int result = worldService.join(worldId, uid,roomUid, addGroupChat);
if(result <= 0) {
busiResult = new BusiResult(BusiStatus.REQUEST_PARAM_ERROR);
}
} catch (WorldException e) {
logger.warn("加入话题异常:{}", e.getMessage());
return new BusiResult(BusiStatus.SERVERERROR,e. getMessage(),null);
} catch (ServiceException e){
return new BusiResult(e.getBusiStatus());
} catch (Exception e) {
logger.error("加入话题异常", e);
busiResult.setCode(BusiStatus.SERVEXCEPTION.value());
busiResult.setMessage("系统错误,请稍候再试");
}
return busiResult;
}
/**
* 加入话题
*
* 本版本加入话题,不加入群聊
* 群聊需另外加入
* @param worldId
* @param uid
* @return
*/
@RequestMapping(value = "/join/v2")
@ResponseBody
public BusiResult joinV2(Long worldId, Long uid,Long roomUid) {
return this.join(worldId, uid, roomUid, false);
}
/**
* 退出话题
* @param worldId
* @param uid
* @return
*/
@RequestMapping(value = "/exit")
@ResponseBody
public BusiResult exit(Long worldId, Long uid) {
logger.info("退出话题worldId:{}, uid:{}", worldId, uid);
if (worldId == null || uid == null) {
return new BusiResult<UserVo>(BusiStatus.PARAMETERILLEGAL);
}
BusiResult busiResult = new BusiResult(BusiStatus.SUCCESS);
try {
int result = worldService.exit(worldId, uid, WorldConstant.LeaveGroupChatType.active);
if(result <= 0) {
busiResult = new BusiResult(BusiStatus.REQUEST_PARAM_ERROR);
}
} catch (WorldException e) {
logger.warn("退出话题异常:{}", e.getMessage());
return new BusiResult(BusiStatus.SERVERERROR, e.getMessage(), null);
} catch (ServiceException e){
return new BusiResult(e.getBusiStatus());
} catch (Exception e) {
logger.error("退出话题异常", e);
busiResult.setCode(BusiStatus.SERVEXCEPTION.value());
busiResult.setMessage("系统错误,请稍候再试");
}
return busiResult;
}
/**
* 编辑话题
* @param worldBo
* @return
*/
@RequestMapping(value = "/edit")
@ResponseBody
public BusiResult edit(WorldBo worldBo) {
logger.info("编辑话题,参数:{}", JSON.toJSONString(worldBo));
if (worldBo.getWorldId() == null || worldBo.getUid() == null) {
return new BusiResult<UserVo>(BusiStatus.PARAMETERILLEGAL);
}
BusiResult busiResult = new BusiResult(BusiStatus.SUCCESS);
try {
int result = worldService.edit(worldBo);
if(result <= 0) {
busiResult = new BusiResult(BusiStatus.REQUEST_PARAM_ERROR);
}
} catch (WorldException e) {
logger.warn("编辑话题异常:{}", e.getMessage());
return new BusiResult(BusiStatus.SERVERERROR, e. getMessage(),null);
} catch (ServiceException e){
return new BusiResult(e.getBusiStatus());
} catch (Exception e) {
logger.error("编辑话题异常", e);
busiResult.setCode(BusiStatus.SERVEXCEPTION.value());
busiResult.setMessage("系统错误,请稍候再试");
}
return busiResult;
}
/**
* 踢出话题
* @param worldId
* @param kickUid 被踢出者uid
* @param uid 操作人uid
* @return
*/
@RequestMapping(value = "/kick", method = RequestMethod.POST)
@ResponseBody
public BusiResult kick(Long worldId, Long kickUid, Long uid) {
logger.info("踢出话题worldId:{}, kickUid:{},uid:{}", worldId, kickUid,uid);
if (worldId == null || uid == null) {
return new BusiResult<UserVo>(BusiStatus.PARAMETERILLEGAL);
}
BusiResult busiResult = new BusiResult(BusiStatus.SUCCESS);
try {
int result = worldService.kick(worldId, kickUid, uid);
if(result <= 0) {
busiResult = new BusiResult(BusiStatus.REQUEST_PARAM_ERROR);
}
} catch (WorldException e) {
logger.warn("踢出话题异常:{}", e.getMessage());
return new BusiResult(BusiStatus.SERVERERROR,e. getMessage(),null);
} catch (ServiceException e){
return new BusiResult(e.getBusiStatus());
} catch (Exception e) {
logger.error("踢出话题异常,worldId:{}, kickUid:{},uid:{}", worldId, kickUid,uid,e);
busiResult.setCode(BusiStatus.SERVEXCEPTION.value());
busiResult.setMessage("系统错误,请稍候再试");
}
return busiResult;
}
/**
* 审核话题加入请求
* @param worldId
* @param uid
* @param type审核结果1-通过2-不通过
* @param addGroupChat审核通过后加入时话题时是否同时加入群聊
* @return
*/
@RequestMapping(value = "/approve")
@ResponseBody
public BusiResult approve(Long worldId, Long uid, Long recordId, Byte type, Long targetUid,
@RequestParam(value = "addGroupChat", defaultValue = "true") boolean addGroupChat) {
if (worldId == null || uid == null || recordId == null || null == type || null == targetUid) {
return new BusiResult<UserVo>(BusiStatus.PARAMETERILLEGAL);
}
BusiResult busiResult = new BusiResult(BusiStatus.SUCCESS);
try {
busiResult.setData(worldService.approve(worldId, uid, recordId, type, targetUid, addGroupChat));
} catch (WorldException e) {
logger.warn("审核加入话题请求异常:{}", e.getMessage());
return new BusiResult(BusiStatus.SERVERERROR,e. getMessage(),null);
} catch (ServiceException e){
return new BusiResult(e.getBusiStatus());
} catch (Exception e) {
logger.error("审核加入话题请求异常", e);
busiResult.setCode(BusiStatus.SERVEXCEPTION.value());
busiResult.setMessage("系统错误,请稍候再试");
}
return busiResult;
}
/**
* 重建话题最热标签缓存
* @param key
@@ -339,43 +129,6 @@ public class WorldController {
return busiResult;
}
/**
* 重建话题人数缓存
* @param key
* @return
*/
@RequestMapping(value = "/rebuildWorldMemberNum")
@ResponseBody
public BusiResult rebuildWorldMemberNum(String key) {
logger.info("重建话题最热标签列表key{}", key);
if (!StringUtils.equalsIgnoreCase(key, "mYEBYSXl9H5C")) {
return new BusiResult<UserVo>(BusiStatus.PARAMETERILLEGAL);
}
BusiResult busiResult = new BusiResult(BusiStatus.SUCCESS);
int result = worldService.rebuildWorldMemberNum();
logger.info("重建话题人数缓存完成,影响记录数:{}", result);
return busiResult;
}
/**
* 重建用户加入的世界缓存
* @param uids
* @param key
* @return
*/
@RequestMapping(value = "/rebuildJoinWorldCache")
@ResponseBody
public BusiResult rebuildJoinWorldCache(String uids, String key) {
logger.info("重建用户加入的世界缓存, uids:{}, key{}", uids, key);
if (!StringUtils.equalsIgnoreCase(key, "mYEBYSXl9H5C")) {
return new BusiResult<UserVo>(BusiStatus.PARAMETERILLEGAL);
}
BusiResult busiResult = new BusiResult(BusiStatus.SUCCESS);
int result = worldService.rebuildJoinWorldCache(uids);
logger.info("重建用户加入的世界完成,影响记录数:{}", result);
return busiResult;
}
/**
* 查询话题推荐列表 (接口白名单)
* @param baseQuery

View File

@@ -1,168 +0,0 @@
package com.accompany.business.controller.world;
import com.accompany.business.service.world.WorldGroupChatMemberService;
import com.accompany.business.service.world.WorldGroupChatService;
import com.accompany.common.annotation.Authorization;
import com.accompany.common.result.BusiResult;
import com.accompany.common.status.BusiStatus;
import com.accompany.world.common.ParamUtils;
import com.accompany.world.constant.WorldConstant;
import com.accompany.world.entity.WorldGroupChat;
import com.accompany.world.entity.WorldGroupChatMember;
import com.accompany.world.query.WorldGroupChatQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
/**
* <p>
* 话题群聊表 前端控制器
* </p>
*
* @author Administrator
* @since 2019-06-28
*/
@RestController
@RequestMapping("/world/group/chat")
public class WorldGroupChatController {
@Autowired
private WorldGroupChatService worldGroupChatService;
@Autowired
private WorldGroupChatMemberService worldGroupChatMemberService;
/**
* 获取话题群聊信息
* @param tid 云信群聊tid
* @param uid 用户Uid
* @return
*/
@Authorization
@RequestMapping(value = "/get", method = RequestMethod.GET)
public BusiResult getGroupChat(@RequestParam String tid, @RequestParam Long uid) {
return new BusiResult(BusiStatus.SUCCESS,worldGroupChatService.getGroupChatInfo(tid,uid));
}
/**
* 更新群聊名称、话题
* @param inParam [id,uid,name,topic]
* @return
*/
@Authorization
@RequestMapping(value = "/update", method = RequestMethod.POST)
public BusiResult getGroupChat(@Valid WorldGroupChatQuery inParam) throws Exception {
worldGroupChatService.updateGroupChat(inParam);
return new BusiResult(BusiStatus.SUCCESS);
}
/**
* 打开/关闭消息提醒
* @param chatId
* @param uid
* @param ope
* @return
* @throws Exception
*/
@Authorization
@RequestMapping(value = "/mute", method = RequestMethod.POST)
public BusiResult mute(@RequestParam("chatId")Long chatId,
@RequestParam("uid")Long uid,
@RequestParam("ope")boolean ope) throws Exception{
worldGroupChatService.mute(chatId, uid, ope);
return new BusiResult(BusiStatus.SUCCESS);
}
/**
* 加入群聊
* @param worldId
* @param uid
* @return
*/
@Authorization
@RequestMapping(value = "/joinByWorldId", method = RequestMethod.POST)
public BusiResult joinByWorldId(Long worldId, Long uid) throws Exception {
Long result = worldGroupChatService.handleGroupChat(worldId, uid);
if(result != null && result > 0) {
return new BusiResult(BusiStatus.SUCCESS);
} else {
return new BusiResult(BusiStatus.SERVERBUSY);
}
}
/**
* 加入群聊
* @param chatId
* @param uid
* @return
*/
@Authorization
@RequestMapping(value = "/joinByChatId", method = RequestMethod.POST)
public BusiResult addGroupChat(Long chatId, Long uid) throws Exception {
Long result = worldGroupChatService.handleGroupChatByChatId(chatId, uid);
if(result != null && result > 0) {
return new BusiResult(BusiStatus.SUCCESS);
} else {
return new BusiResult(BusiStatus.SERVERBUSY);
}
}
/**
* 主动退出群聊
* @param chatId
* @param uid
* @return
* @throws Exception
*/
@Authorization
@RequestMapping(value = "/exit", method = RequestMethod.POST)
public BusiResult exit(Long chatId, String tid, Long uid) throws Exception {
ParamUtils.isNotNull(uid, "退出群聊失败,参数不正确");
if(null == chatId) {
ParamUtils.isNotNull(tid, "退出群聊失败,参数不正确");
WorldGroupChat worldGroupChat = worldGroupChatService.getByTid(tid);
ParamUtils.isNotNull(worldGroupChat, "退出群聊失败,群聊不存在!");
chatId = worldGroupChat.getId();
}
WorldGroupChatMember chatMember = worldGroupChatMemberService.getUniqueChatMember(chatId, uid);
ParamUtils.isNotNull(chatMember, "退出群聊失败,用户不在该群聊中!");
boolean result = worldGroupChatService.leaveGroupChatByChatId(chatId, uid,
WorldConstant.LeaveGroupChatType.active, true);
if(result) {
return new BusiResult(BusiStatus.SUCCESS);
} else {
return new BusiResult(BusiStatus.REQUEST_PARAM_ERROR);
}
}
/**
* 管理员踢出群聊
* @param chatId
* @param toUid
* @return
* @throws Exception
*/
@Authorization
@RequestMapping(value = "/kick", method = RequestMethod.POST)
public BusiResult kick(Long chatId, Long uid, Long toUid) throws Exception {
WorldGroupChatMember chatMember = worldGroupChatMemberService.getUniqueChatMember(chatId, toUid);
ParamUtils.isNotNull(chatMember, "踢出失败,被踢用户不在该群聊中!");
WorldGroupChatMember ownerMember = worldGroupChatMemberService.getUniqueChatMember(chatId, uid);
ParamUtils.isNotNull(ownerMember, "踢出失败,当前用户不在该群聊中!");
// 当前用户是否为群主或管理员
if(ownerMember.getRole() != WorldConstant.WorldGroupChatRole.creator
&& ownerMember.getRole() != WorldConstant.WorldGroupChatRole.admin) {
return new BusiResult(BusiStatus.PARAMERROR, "当前用户不是该群群主或管理员", null);
}
boolean result = worldGroupChatService.leaveGroupChatByChatId(chatId, toUid,
WorldConstant.LeaveGroupChatType.passive, true);
if(result) {
return new BusiResult(BusiStatus.SUCCESS);
} else {
return new BusiResult(BusiStatus.REQUEST_PARAM_ERROR);
}
}
}

View File

@@ -1,46 +0,0 @@
package com.accompany.business.controller.world;
import com.accompany.business.service.world.WorldGroupChatMemberService;
import com.accompany.common.result.BusiResult;
import com.accompany.common.status.BusiStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 世界成员表 前端控制器
* </p>
*
* @author Administrator
* @since 2019-06-28
*/
@RestController
@RequestMapping("/world/group/chat/member")
public class WorldGroupChatMemberController {
@Autowired
private WorldGroupChatMemberService worldGroupChatMemberService;
/**
* 话题成员列表
* @param chatId
* @param searchKey
* @param page
* @param pageSize
* @return
*/
// @Authorization
@RequestMapping(value = "/list", method = RequestMethod.POST)
public BusiResult list(@RequestParam Long chatId,
String searchKey,
@RequestParam(defaultValue = "1") int page,
@RequestParam(defaultValue = "10") int pageSize) {
return new BusiResult(BusiStatus.SUCCESS, worldGroupChatMemberService.getChatMemberByPage(chatId, searchKey, page, pageSize));
}
}

View File

@@ -1,39 +0,0 @@
package com.accompany.business.controller.world;
import com.accompany.business.service.world.WorldGroupChatTopicService;
import com.accompany.common.annotation.Authorization;
import com.accompany.common.result.BusiResult;
import com.accompany.common.status.BusiStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 话题群聊话题表 前端控制器
* </p>
*
* @author Administrator
* @since 2019-06-28
*/
@RestController
@RequestMapping("/world/group/chat/topic")
public class WorldGroupChatTopicController {
@Autowired
private WorldGroupChatTopicService worldGroupChatTopicService;
/**
* 话题 随机获取其中一页数据
* @param pageSize
* @return
*/
@Authorization
@RequestMapping(value = "/list", method = RequestMethod.GET)
public BusiResult list(@RequestParam(defaultValue = "10") int pageSize, String deviceId) {
return new BusiResult(BusiStatus.SUCCESS,worldGroupChatTopicService.getTopicByRandom(pageSize,deviceId));
}
}

View File

@@ -1,57 +0,0 @@
package com.accompany.business.controller.world;
import com.accompany.business.service.world.WorldMemberActiveRecordService;
import com.accompany.common.annotation.Authorization;
import com.accompany.common.result.BusiResult;
import com.accompany.common.status.BusiStatus;
import com.accompany.world.entity.WorldMemberActiveRecord;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 世界成员表 前端控制器
* </p>
*
* @author Administrator
* @since 2019-06-28
*/
@Slf4j
@RestController
@RequestMapping("/world/member/active/record")
public class WorldMemberActiveRecordController {
@Autowired
private WorldMemberActiveRecordService worldMemberActiveRecordService;
/**
* 话题成员活跃记录上报
* @param record
* @return
*/
@Authorization
@RequestMapping(value = "/report", method = RequestMethod.POST)
public BusiResult list(WorldMemberActiveRecord record) {
log.info("话题成员活跃记录上报, record:{}", record);
if(null == record.getUid() || null == record.getWorldId() || record.getActiveType() == null) {
log.info("话题成员活跃记录上报失败,参数为空:{}", record);
return new BusiResult(BusiStatus.PARAMETERILLEGAL);
}
worldMemberActiveRecordService.save(record);
return new BusiResult(BusiStatus.SUCCESS);
}
@RequestMapping(value = "/clean", method = RequestMethod.POST)
public BusiResult clean(Integer days, Long uid) {
if(null == days) {
return new BusiResult(BusiStatus.PARAMERROR);
}
worldMemberActiveRecordService.cleanInactiveMember(days, uid);
return new BusiResult(BusiStatus.SUCCESS);
}
}

View File

@@ -1,68 +0,0 @@
package com.accompany.business.controller.world;
import com.accompany.business.service.world.WorldMemberService;
import com.accompany.common.annotation.Authorization;
import com.accompany.common.result.BusiResult;
import com.accompany.common.status.BusiStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 世界成员表 前端控制器
* </p>
*
* @author Administrator
* @since 2019-06-28
*/
@RestController
@RequestMapping("/world/member")
public class WorldMemberController {
@Autowired
private WorldMemberService worldMemberService;
/**
* 话题成员列表
* @param worldId
* @param searchKey
* @param page
* @param pageSize
* @return
*/
@Authorization
@RequestMapping(value = "/list", method = RequestMethod.POST)
public BusiResult list(@RequestParam Long worldId,
String searchKey,
@RequestParam(defaultValue = "1") int page,
@RequestParam(defaultValue = "10") int pageSize) {
return new BusiResult(BusiStatus.SUCCESS,worldMemberService.getWorldMemberByPage(worldId,searchKey,page,pageSize));
}
/**
* 获取某成员信息(无视世界状态、成员状态) (接口白名单)
* @param worldId
* @param uid
* @return
*/
@RequestMapping(value = "/always/get", method = RequestMethod.POST)
public BusiResult alwaysGetMember(@RequestParam Long worldId, @RequestParam Long uid) {
return new BusiResult(BusiStatus.SUCCESS,worldMemberService.getWorldMemberInfoByAlways(worldId,uid));
}
/**
* 查询用户是否在世界中
* @param worldId
* @param uid
* @return
*/
@Authorization
@RequestMapping(value = "/get/flag", method = RequestMethod.POST)
public BusiResult getMemberFlag(@RequestParam Long worldId, @RequestParam Long uid) {
return new BusiResult(BusiStatus.SUCCESS,worldMemberService.getMemberFlag(worldId,uid));
}
}

View File

@@ -1,54 +0,0 @@
package com.accompany.business.controller.world;
import com.accompany.business.service.world.WorldRoomService;
import com.accompany.common.result.BusiResult;
import com.accompany.common.status.BusiStatus;
import com.accompany.world.query.WorldRoomQuery;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
/**
* <p>
* 话题房间表 前端控制器
* </p>
*
* @author Administrator
* @since 2019-06-28
*/
@RestController
@RequestMapping("/world/room")
@Slf4j
public class WorldRoomController {
@Autowired
private WorldRoomService service;
/**
* 获取话题派对列表,创始人排第一位
* @param inParam
* @return
*/
@RequestMapping(value = "/list", method = RequestMethod.POST)
public BusiResult list(@Valid WorldRoomQuery inParam) {
return new BusiResult(BusiStatus.SUCCESS,service.getWorldRoomListByPage(inParam));
}
@RequestMapping(value = "/query", method = RequestMethod.POST)
public BusiResult query(Long worldId) {
try {
if (worldId == null || worldId == 0){
return new BusiResult(BusiStatus.PARAMERROR);
}
return new BusiResult(BusiStatus.SUCCESS,service.getWorldRoomListV2(worldId));
}catch (Exception e){
log.error("get world room list failed", e);
return new BusiResult(BusiStatus.BUSIERROR);
}
}
}

View File

@@ -40,14 +40,6 @@ spring:
codec: !<org.redisson.codec.JsonJacksonCodec> {}
transportMode: "NIO"
##activemq 配置
activemq:
brokerUrl: tcp://129.226.216.54:61619
user: system
password: manager
maxConnections: 50
idleTimeout: 30000
## rocketmq 配置
rocketmq:
name-server: 129.226.216.54:9876

View File

@@ -1,8 +1,5 @@
package com.accompany.world.constant;
import java.util.Arrays;
import java.util.List;
/**
* @Author: chucheng
* @Date: 2019/7/1 15:25
@@ -23,72 +20,6 @@ public class WorldConstant {
public static Integer delete = 0;
}
public static class WorldMemberPromtFlag {
/**
* 屏蔽消息
*/
public static Integer close = 0;
/**
* 开启提醒
*/
public static Integer open = 1;
}
public static class WorldMemberMuteFlag {
/**
* 不禁言
*/
public static Integer forbidden = 0;
/**
* 禁言
*/
public static Integer allow = 1;
}
public static class WorldGroupChatTopicStatus {
/**
* 下架
*/
public static Integer invalid = 0;
/**
* 上架
*/
public static Integer valid = 1;
}
public static class WorldGroupChatStatus {
/**
* 已解散
*/
public static Integer delete = 0;
/**
* 正常
*/
public static Integer normal = 1;
}
public static class WorldRoomStatus {
/**
* 关闭
*/
public static Integer close = 0;
/**
* 开启
*/
public static Integer open = 1;
}
public static class WorldRoomCorpseFlag {
/**
* 非僵尸房
*/
public static Integer notcorpse = 0;
/**
* 僵尸房
*/
public static Integer corpse = 1;
}
public static class LeaveGroupChatType {
/**
* 创建人移除:被动退群
@@ -136,72 +67,6 @@ public class WorldConstant {
public static final String NAME_RECOMMEND_WORLDS = "推荐";
}
/**
* 审核状态
*/
public static class ApproveStatus {
/** 未审核状态 */
public static final byte STATUS_NOT_APPROVE = 0;
/** 审核通过状态 */
public static final byte STATUS_APPROVE_PASS = 1;
/** 审核不通过状态 */
public static final byte STATUS_APPROVE_NOT_PASS = 2;
/** 审核失败 */
public static final byte STATUS_APPROVE_FAIL = -1;
/** 申请已过期 */
public static final byte STATUS_APPROVE_EXPIRED = -2;
}
/**
* 参数Key
*/
public static class ParamsKey {
public static final String UID = "uid";
public static final String TARGET_UID = "targetUid";
public static final String ACTION_TYPE = "actionType";
public static final String WORLD_ID = "worldId";
public static final String RECORD_ID = "recordId";
}
/**
* 世界消息动作类型
*/
public static class ActionType {
/**
* 创建世界
*/
public static final byte CREATE_WORLD = 1;
/**
* 加入世界
*/
public static final byte JOIN_WORLD = 2;
/**
* 退出世界
*/
public static final byte QUIT_WORLD = 3;
/**
* 踢出世界
*/
public static final byte KICK_OUT_WORLD = 4;
/**
* 解散世界
*/
public static final byte DISMISS_WORLD = 5;
/**
* 加入群聊
*/
public static final byte JOIN_GROUP = 6;
/**
* 退出群聊
*/
public static final byte QUIT_GROUP = 7;
/**
* 加入世界并加入群
*/
public static final byte JOIN_WORLD_GROUP = 8;
}
/**
* 话题解散类型
*/
@@ -214,46 +79,8 @@ public class WorldConstant {
* 管理后台页面
*/
public static final byte ADMIN_PAGE = 2;
/**
* 自动清理话题
*/
public static final byte AUTO_CLEAN = 3;
}
/**
* 话题清理状态
*/
public static class WorldCleanStatus {
/**
* 正常
*/
public static final int NORMAL = 0;
/**
* 已清理/清理中
*/
public static final int CLEAN = 1;
}
/**
* 话题成员活跃状态
*/
public static class WorldMemberActiveType {
/** 消息 */
public static final int MSG = 1;
/** 送礼物 */
public static final int GIFT_OUT = 2;
/** 创建语音派对 */
public static final int CREATE_VOICE_PARTY = 3;
/** 加入语音派对 */
public static final int JOIN_VOICE_PARTY = 4;
public static final List<Integer> activeTypeList
= Arrays.asList(MSG, GIFT_OUT, CREATE_VOICE_PARTY, JOIN_VOICE_PARTY);
}
/** 删除/已解散 */
public static final int STATUS_DELETE = 0;
@@ -264,29 +91,10 @@ public class WorldConstant {
/** 每个用户最多加入的世界数 */
public static final int MAX_JOIN_WORLD = 20;
/** 每个世界最多的用户数 */
public static final int MAX_WORLD_MEMBER_NUM = 200;
/** 群聊用户数上限 */
public static final int MAX_GROUP_CHAT_MEMBER_NUM = 200;
/**
* 话题默认描述
*/
public static final String WORLD_DEFAULT_DESC = "最優話題,最熱時事,盡在話題!快與兔友們分享身邊有趣的靈魂吧~";
/**
* 话题群聊成员角色
* int 0-创建人1-管理员2-普通成员
*/
public static class WorldGroupChatRole {
public static final int creator = 0;
public static final int admin = 1;
public static final int normal = 2;
}
}

View File

@@ -106,16 +106,6 @@ public class World implements Serializable {
*/
private Date noticeUpdateTime;
/**
* 话题人数
*/
private Integer memberNum;
/**
* 预清理状态0-正常1-计划清理三天后若人数依然小于3就清理
*/
private Integer preCleanStatus;
/**
* 备注
*/

View File

@@ -1,71 +0,0 @@
package com.accompany.world.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 话题群聊表
* </p>
*
* @author Administrator
* @since 2019-06-28
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class WorldGroupChat implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 世界id
*/
private Long worldId;
/**
* 群主uid
*/
private Long uid;
/**
* 云信的群聊唯一id
*/
private String tid;
/**
* 群聊名称
*/
private String name;
/**
* 群聊话题
*/
private String topic;
/**
* 状态
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
}

View File

@@ -1,64 +0,0 @@
package com.accompany.world.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 话题群聊成员表
* </p>
*
* @author fangchengyan
* @since 2019-11-02
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class WorldGroupChatMember implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 话题id
*/
private Long worldId;
/**
* 群聊id
*/
private Long chatId;
/**
* 云信群聊id
*/
private String tid;
/**
* 成员uid
*/
private Long uid;
/**
* 群聊角色(0-创建人1-管理员2-普通成员)
*/
private Integer role;
/**
* 加入群聊时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
}

View File

@@ -1,51 +0,0 @@
package com.accompany.world.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 话题群聊话题表
* </p>
*
* @author Administrator
* @since 2019-06-28
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class WorldGroupChatTopic implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 话题
*/
private String topic;
/**
* 状态
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
}

View File

@@ -1,66 +0,0 @@
package com.accompany.world.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 世界成员表
* </p>
*
* @author Administrator
* @since 2019-06-28
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class WorldMember implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 用户uid
*/
private Long uid;
/**
* 世界id
*/
private Long worldId;
/**
* 状态
*/
private Integer status;
/**
* 消息提醒: 0.屏蔽消息 1.开启提醒
*/
private Integer promtFlag;
/**
* 是否禁言: 0.不禁言 1.禁言
*/
private Integer muteFlag;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
}

View File

@@ -1,51 +0,0 @@
package com.accompany.world.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 话题成员活跃记录表
* </p>
*
* @author Administrator
* @since 2019-10-25
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class WorldMemberActiveRecord implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 话题id
*/
private Long worldId;
/**
* uid
*/
private Long uid;
/**
* 1-消息2-送礼物3-创建语音派对4-加入语音派对
*/
private Integer activeType;
/**
* 创建时间
*/
private Date createTime;
}

View File

@@ -1,61 +0,0 @@
package com.accompany.world.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 话题成员申请记录表
* </p>
*
* @author Administrator
* @since 2019-06-28
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class WorldMemberApplyRecord implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 世界id
*/
private Long worldId;
/**
* 申请者uid
*/
private Long uid;
/**
* 审核状态
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
/**
* 审核结果说明
*/
private String remark;
}

View File

@@ -1,49 +0,0 @@
package com.accompany.world.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 话题预清理表
* </p>
*
* @author Administrator
* @since 2019-07-16
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class WorldPreCleanRecord implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 话题id
*/
@TableId(value = "world_id", type = IdType.INPUT)
private Long worldId;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
/**
* 清理状态: 0.未清理1.已清理
*/
private Integer cleanStatus;
}

View File

@@ -1,64 +0,0 @@
package com.accompany.world.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 话题房间表
* </p>
*
* @author Administrator
* @since 2019-06-28
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class WorldRoom implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 世界id
*/
private Long worldId;
/**
* 房间id
*/
private Long roomId;
/**
* 房间uid
*/
private Long roomUid;
/**
* 状态
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
/**
* 僵尸房标识0.非僵尸房 1.僵尸房
*/
private Integer corpseFlag;
}

View File

@@ -1,42 +0,0 @@
package com.accompany.world.query;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <p>
* 话题群聊成员表
* </p>
*
* @author fangchengyan
* @since 2019-11-02
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class WorldGroupChatMemberQuery extends BaseQuery {
/**
* 话题id
*/
private Long worldId;
/**
* 群聊id
*/
private Long chatId;
/**
* 云信群聊id
*/
private String tid;
/**
* 成员uid
*/
private Long uid;
}

View File

@@ -1,20 +0,0 @@
package com.accompany.world.query;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @Author: chucheng
* @Date: 2019/7/1 18:07
* @Description:
*/
@Data
public class WorldGroupChatMemberSearchQuery {
@NotNull(message = "群聊不能為空")
private Long chatId;
private String searchKey;
}

View File

@@ -1,29 +0,0 @@
package com.accompany.world.query;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @Author: chucheng
* @Date: 2019/7/1 18:07
* @Description:
*/
@Data
public class WorldGroupChatQuery {
@NotNull(message = "群聊不能为空")
private Long chatId;
@NotNull(message = "操作人不能为空")
private Long uid;
private String name;
private String topic;
/** 群聊图像 */
private String icon;
}

View File

@@ -1,27 +0,0 @@
package com.accompany.world.query;
import lombok.Data;
import java.util.Date;
/**
* @author Administrator
* @Date: 2019/10/25 18:07
* @Description:
*/
@Data
public class WorldMemberActiveRecordQuery extends BaseQuery {
/** 记录的创建时间:开始时间 */
private Date startTime;
/** 记录的创建时间:结束时间*/
private Date endTime;
/** 话题id */
private Long worldId;
/** 用户uid */
private Long uid;
}

View File

@@ -1,18 +0,0 @@
package com.accompany.world.query;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @Author: chucheng
* @Date: 2019/7/1 18:07
* @Description:
*/
@Data
public class WorldMemberPageQuery extends BaseQuery {
@NotNull(message = "世界不能为空")
private Long worldId;
}

View File

@@ -1,28 +0,0 @@
package com.accompany.world.query;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @Author: chucheng
* @Date: 2019/7/1 18:07
* @Description:
*/
@Data
public class WorldMemberQuery {
@NotNull(message = "世界不能为空")
private Long worldId;
private Integer status;
private Integer promtFlag;
private Integer muteFlag;
private Long uid;
private Integer limit;
}

View File

@@ -1,20 +0,0 @@
package com.accompany.world.query;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @Author: chucheng
* @Date: 2019/7/1 18:07
* @Description:
*/
@Data
public class WorldMemberSearchQuery {
@NotNull(message = "世界不能为空")
private Long worldId;
private String searchKey;
}

View File

@@ -1,23 +0,0 @@
package com.accompany.world.query;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @Author: chucheng
* @Date: 2019/7/1 18:07
* @Description:
*/
@Data
public class WorldRoomCreateQuery {
@NotNull(message = "世界不能為空")
private Long worldId;
@NotNull(message = "房間uid不能為空")
private Long roomUid;
private Long roomId;
}

View File

@@ -1,21 +0,0 @@
package com.accompany.world.query;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @Author: chucheng
* @Date: 2019/7/1 18:07
* @Description:
*/
@Data
public class WorldRoomQuery extends BaseQuery {
@NotNull(message = "世界不能为空")
private Long worldId;
@NotNull(message = "uid不能为空")
private Long uid;
}

View File

@@ -1,28 +0,0 @@
package com.accompany.world.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @Author: chucheng
* @Date: 2019/7/3 11:08
* @Description:
*/
@Data
public class MemberInWorldVo implements Serializable {
/**
* 世界Id
*/
private Long worldId;
/**
* 世界名称
*/
private String worldName;
/**
* 成员标识true该世界成员false非该世界成员
*/
private boolean inWorld;
}

View File

@@ -1,16 +0,0 @@
package com.accompany.world.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @Author: chucheng
* @Date: 2019/7/3 11:08
* @Description:
*/
@Data
public class SimpleTopicVo implements Serializable {
private String topic;
}

View File

@@ -1,11 +1,10 @@
package com.accompany.world.vo;
import com.accompany.common.annotation.ReplaceAppDomain;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* {这里添加描述}
@@ -26,7 +25,7 @@ public class WorldDetailVo {
/**
* 名称 必填限16个字世界标题不能重复
*/
@I18nPartition(className = "World")
@I18n(className = "World")
private String name;
/**
@@ -38,13 +37,13 @@ public class WorldDetailVo {
/**
* 描述
*/
@I18nPartition(className = "World")
@I18n(className = "World")
private String description;
/**
* 公告
*/
@I18nPartition(className = "World")
@I18n(className = "World")
private String notice;
/**
@@ -57,11 +56,6 @@ public class WorldDetailVo {
*/
private Date createTime;
/**
* 成员数量
*/
private Integer memberNum;
/**
* 话题公告更新时间
*/
@@ -77,15 +71,6 @@ public class WorldDetailVo {
*/
private Boolean inWorld;
/**
* 当前用户是否在群聊中
*/
private Boolean inGroupChat;
/**
* 当前用户
*/
private WorldMemberVo currentMember;
/**
* 分类名
@@ -96,33 +81,4 @@ public class WorldDetailVo {
* 名称
*/
private String typeName;
/**
* 云信群聊tid
*/
private String tid;
/**
* 服务端群聊id
*/
private Long chatId;
/**
* 群聊名称
*/
private String groupChatName;
/** 自动创建群聊的人数 */
private Integer createGroupChatNum;
/**
* 话题成员
*/
private List<WorldMemberVo> members;
/**
* 在线成员数量
*/
private Integer onlineNum;
}

View File

@@ -1,61 +0,0 @@
package com.accompany.world.vo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
* 话题群聊成员
* </p>
*
* @author fangchengyan
* @since 2019-11-02
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class WorldGroupChatMemberVo implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
/**
* 话题id
*/
private Long worldId;
/**
* 群聊id
*/
private Long chatId;
/**
* 成员uid
*/
private Long uid;
/**
* 昵称
*/
private String nick;
/**
* 性别
*/
private Byte gender;
/**
* 头像
*/
private String avatar;
/**
* 群聊角色(0-创建人1-管理员2-普通成员)
*/
private Integer role;
}

View File

@@ -1,56 +0,0 @@
package com.accompany.world.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author: chucheng
* @Date: 2019/6/28 18:09
* @Description:
*/
@Data
public class WorldGroupChatVo implements Serializable {
private static final long serialVersionUID = -316835454279384883L;
/**
* 群聊id
*/
private Long chatId;
/**
* 世界id
*/
private Long worldId;
/**
* 群主uid
*/
private Long uid;
/**
* 云信的群聊唯一id
*/
private String tid;
/**
* 群聊名称
*/
private String name;
/**
* 群聊话题
*/
private String topic;
/**
* 当前派对中总人数
*/
private int count;
/**
* 房间Uid列表
*/
private List<Long> roomUids;
}

View File

@@ -1,48 +0,0 @@
package com.accompany.world.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @Author: chucheng
* @Date: 2019/7/3 11:08
* @Description:
*/
@Data
public class WorldMemberSimpleInfoVo implements Serializable {
/**
* 世界Id
*/
private Long worldId;
/**
* 世界名称
*/
private String worldName;
/**
* 世界图标
*/
private String worldIcon;
/**
* 世界描述
*/
private String worldDesc;
/**
* 用户uid
*/
private Long uid;
/**
* 用户昵称
*
*/
private String nick;
/**
* 用户头像
*/
private String avatar;
/**
* uid在该worldId中为第几位成员
*/
private Long memberNo;
}

View File

@@ -1,59 +0,0 @@
package com.accompany.world.vo;
import com.accompany.common.annotation.ReplaceAppDomain;
import lombok.Data;
import java.io.Serializable;
/**
* @Author: chucheng
* @Date: 2019/6/28 18:09
* @Description:
*/
@Data
public class WorldMemberVo implements Serializable {
private static final long serialVersionUID = -1019012910559769718L;
private String nick;
private Byte gender;
@ReplaceAppDomain
private String avatar;
/**
* 用户uid
*/
private Long uid;
/**
* 状态
*/
private Integer status;
/**
* 消息提醒: 0.屏蔽消息 1.开启提醒
*/
private Integer promtFlag;
/**
* 是否禁言: 0.不禁言 1.禁言
*/
private Integer muteFlag;
/**
* 是否创始人
*/
private boolean ownerFlag;
/**
* 当前所在派对
*/
private Long currentRoomUid;
/**
* uid在该worldId中为第几位成员
*/
private Long memberNo;
}

View File

@@ -1,24 +0,0 @@
package com.accompany.world.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author: chucheng
* @Date: 2019/7/15 16:54
* @Description:
*/
@Data
public class WorldRoomListVo implements Serializable {
/**
* 是否存在当前用户的派对
*/
private boolean hasCurrentUserRoom;
/**
* 派对列表
*/
private List<WorldRoomVo> worldRoomVoList;
}

View File

@@ -1,64 +0,0 @@
package com.accompany.world.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @Author: chucheng
* @Date: 2019/6/28 18:09
* @Description:
*/
@Data
public class WorldRoomVo implements Serializable {
private static final long serialVersionUID = -7377321575260994449L;
/**
* 世界id
*/
private Long worldId;
/** 话题名称 */
private String worldName;
/**
* 房间id
*/
private Long roomId;
/**
* 房间uid
*/
private Long roomUid;
/**
* 房主性别
*/
private Byte gender;
/**
* 状态
*/
private Integer status;
private String title;
private String avatar;
private String roomDesc;
private String roomTag;
private Integer tagId;
private String tagPict;
private String badge;
private Integer onlineNum;
private boolean ownerFlag;
private Integer realOnlineNum;
private Integer TotalFlow;
}

View File

@@ -1,11 +1,10 @@
package com.accompany.world.vo;
import com.accompany.common.annotation.ReplaceAppDomain;
import com.accompany.core.annotation.I18nPartition;
import com.accompany.core.annotation.I18n;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* {这里添加描述}
@@ -26,7 +25,7 @@ public class WorldVo {
/**
* 名称 必填限16个字世界标题不能重复
*/
@I18nPartition(className = "World")
@I18n(className = "World")
private String name;
/**
@@ -38,7 +37,7 @@ public class WorldVo {
/**
* 描述
*/
@I18nPartition(className = "World")
@I18n(className = "World")
private String description;
/**
@@ -51,19 +50,8 @@ public class WorldVo {
*/
private Date createTime;
/**
* 成员数量
*/
private Integer memberNum;
/**
* 进入时是否需要同意, 1:true,0:false
*/
private Boolean agreeFlag;
/**
* 话题成员
*/
private List<WorldMemberVo> members;
}

View File

@@ -1,16 +0,0 @@
package com.accompany.world.mapper;
import com.accompany.world.entity.WorldGroupChat;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 话题群聊表 Mapper 接口
* </p>
*
* @author Administrator
* @since 2019-06-28
*/
public interface WorldGroupChatMapper extends BaseMapper<WorldGroupChat> {
}

View File

@@ -1,41 +0,0 @@
package com.accompany.world.mapper;
import com.accompany.world.entity.WorldGroupChatMember;
import com.accompany.world.query.WorldGroupChatMemberSearchQuery;
import com.accompany.world.vo.WorldGroupChatMemberVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 话题群聊成员表 Mapper 接口
* </p>
*
* @author fangchengyan
* @since 2019-11-02
*/
public interface WorldGroupChatMemberMapper extends BaseMapper<WorldGroupChatMember> {
/**
* 按 条件 查询话题群聊成员
* @param query
* @return
*/
List<WorldGroupChatMemberVo> getChatMemberVoBySearchKey(@Param("query") WorldGroupChatMemberSearchQuery query);
/**
* 插入或更新
* @param member
* @return
*/
int insertOrUpdate(WorldGroupChatMember member);
/**
* 批量插入或更新
* @param list
* @return
*/
int insertOrUpdateBatch(List<WorldGroupChatMember> list);
}

View File

@@ -1,21 +0,0 @@
package com.accompany.world.mapper;
import com.accompany.world.entity.WorldGroupChatTopic;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 话题群聊话题表 Mapper 接口
* </p>
*
* @author Administrator
* @since 2019-06-28
*/
public interface WorldGroupChatTopicMapper extends BaseMapper<WorldGroupChatTopic> {
List<WorldGroupChatTopic> getTopicByRandom(@Param("pageSize") int pageSize);
}

View File

@@ -23,10 +23,4 @@ public interface WorldMapper extends BaseMapper<World> {
*/
IPage<World> searchWorld(Page page, @Param("name") String name, @Param("erbanNo") Long erbanNo, @Param("status") Integer status);
/**
* 添加/减少话题人数
* @param worldId
* @param val
*/
int incrMemberNum(@Param("worldId") Long worldId, @Param("val") int val);
}

Some files were not shown because too many files have changed in this diff Show More