|
|
@ -3,6 +3,7 @@ package com.ccsens.tall.service; |
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
import cn.hutool.core.lang.Snowflake; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.ccsens.tall.bean.dto.RingDto; |
|
|
|
import com.ccsens.tall.bean.dto.message.BaseMessageDto; |
|
|
|
import com.ccsens.tall.bean.dto.message.RingMessageWithReadDto; |
|
|
@ -10,11 +11,14 @@ import com.ccsens.tall.bean.dto.message.RingMessageWithSendDto; |
|
|
|
import com.ccsens.tall.bean.po.SysRingMsg; |
|
|
|
import com.ccsens.tall.bean.po.SysRingSend; |
|
|
|
import com.ccsens.tall.bean.po.SysRingSendExample; |
|
|
|
import com.ccsens.tall.bean.po.SysUser; |
|
|
|
import com.ccsens.tall.bean.vo.RingVo; |
|
|
|
import com.ccsens.tall.persist.dao.SysRingMsgDao; |
|
|
|
import com.ccsens.tall.persist.dao.SysRingSendDao; |
|
|
|
import com.ccsens.tall.persist.dao.SysUserDao; |
|
|
|
import com.ccsens.util.CodeEnum; |
|
|
|
import com.ccsens.util.JacksonUtil; |
|
|
|
import com.ccsens.util.PropUtil; |
|
|
|
import com.ccsens.util.config.RabbitMQConfig; |
|
|
|
import com.ccsens.util.exception.BaseException; |
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException; |
|
|
@ -22,7 +26,6 @@ import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.amqp.rabbit.core.RabbitTemplate; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
@ -46,6 +49,8 @@ public class RingService implements IRingService { |
|
|
|
@Resource |
|
|
|
private IUserService userService; |
|
|
|
@Resource |
|
|
|
private SysUserDao userDao; |
|
|
|
@Resource |
|
|
|
private RabbitTemplate rabbitTemplate; |
|
|
|
|
|
|
|
|
|
|
@ -112,8 +117,18 @@ public class RingService implements IRingService { |
|
|
|
List<RingVo.RingInfo> ringInfoList = sysRingMsgDao.selectRingInfoByProject(currentUserId, getRingDto.getProjectId()); |
|
|
|
if (CollectionUtil.isNotEmpty(ringInfoList)) { |
|
|
|
ringInfoList.forEach(ringInfo -> { |
|
|
|
//添加接收角色的信息
|
|
|
|
List<RingVo.MsgReceiveRole> msgReceiveRole = sysRingMsgDao.ringReceiveRole(ringInfo.getMessageId()); |
|
|
|
ringInfo.setRoleList(msgReceiveRole); |
|
|
|
//添加发送者的头像
|
|
|
|
if(ObjectUtil.isNotNull(ringInfo.getSender())) { |
|
|
|
SysUser user = userDao.selectByPrimaryKey(ringInfo.getSender().getId()); |
|
|
|
if(ObjectUtil.isNotNull(user) && StrUtil.isNotEmpty(user.getAvatarUrl())){ |
|
|
|
ringInfo.getSender().setAvatarUrl(user.getAvatarUrl()); |
|
|
|
}else { |
|
|
|
ringInfo.getSender().setAvatarUrl(PropUtil.notGatewayUrl + "staticrec/logo.png"); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
@ -170,8 +185,18 @@ public class RingService implements IRingService { |
|
|
|
List<RingVo.RingInfo> ringInfos = sysRingMsgDao.selectRingInfoByRingMsgId(currentUserId, message.getProjectId(),msgId); |
|
|
|
if (CollectionUtil.isNotEmpty(ringInfos)) { |
|
|
|
ringInfos.forEach(ringInfo -> { |
|
|
|
//添加接收角色的信息
|
|
|
|
List<RingVo.MsgReceiveRole> msgReceiveRole = sysRingMsgDao.ringReceiveRole(msgId); |
|
|
|
ringInfo.setRoleList(msgReceiveRole); |
|
|
|
//添加发送者的头像
|
|
|
|
if(ObjectUtil.isNotNull(ringInfo.getSender())) { |
|
|
|
SysUser user = userDao.selectByPrimaryKey(ringInfo.getSender().getId()); |
|
|
|
if(ObjectUtil.isNotNull(user) && StrUtil.isNotEmpty(user.getAvatarUrl())){ |
|
|
|
ringInfo.getSender().setAvatarUrl(user.getAvatarUrl()); |
|
|
|
}else { |
|
|
|
ringInfo.getSender().setAvatarUrl(PropUtil.notGatewayUrl + "staticrec/logo.png"); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
ringInfoList.addAll(ringInfos); |
|
|
|