|
@@ -2,16 +2,25 @@ package com.fs.qw.service.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.http.HttpRequest;
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.utils.DateUtils;
|
|
|
+import com.fs.common.utils.StringUtils;
|
|
|
+import com.fs.company.domain.Company;
|
|
|
+import com.fs.company.domain.CompanyMiniapp;
|
|
|
+import com.fs.company.mapper.CompanyMapper;
|
|
|
+import com.fs.company.mapper.CompanyMiniappMapper;
|
|
|
+import com.fs.course.domain.FsCoursePlaySourceConfig;
|
|
|
+import com.fs.course.mapper.FsCoursePlaySourceConfigMapper;
|
|
|
import com.fs.his.config.FsSysConfig;
|
|
|
import com.fs.his.utils.ConfigUtil;
|
|
|
import com.fs.qw.Bean.MsgBean;
|
|
|
import com.fs.qw.domain.*;
|
|
|
+import com.fs.qw.enums.MsgType;
|
|
|
import com.fs.qw.mapper.QwExternalContactMapper;
|
|
|
import com.fs.qw.mapper.QwMsgMapper;
|
|
|
import com.fs.qw.mapper.QwSessionMapper;
|
|
@@ -23,6 +32,8 @@ import com.fs.qw.service.IQwUserService;
|
|
|
import com.fs.qw.vo.QwContactListVO;
|
|
|
import com.fs.qw.vo.QwMessageListVO;
|
|
|
import com.fs.qwHookApi.vo.QwHookMsgVO;
|
|
|
+import com.fs.wxwork.dto.*;
|
|
|
+import com.fs.wxwork.service.WxWorkService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -50,6 +61,12 @@ public class QwMsgServiceImpl extends ServiceImpl<QwMsgMapper, QwMsg> implements
|
|
|
|
|
|
@Autowired
|
|
|
private ConfigUtil configUtil;
|
|
|
+ @Autowired
|
|
|
+ private WxWorkService wxWorkService;
|
|
|
+ @Autowired
|
|
|
+ private CompanyMiniappMapper companyMiniappMapper;
|
|
|
+ @Autowired
|
|
|
+ private FsCoursePlaySourceConfigMapper playSourceConfigMapper;
|
|
|
|
|
|
/**
|
|
|
* 查询企微聊天记录
|
|
@@ -139,7 +156,7 @@ public class QwMsgServiceImpl extends ServiceImpl<QwMsgMapper, QwMsg> implements
|
|
|
qwSession.setQwUserId(qwuser.getId().toString());
|
|
|
qwSession.setStatus(1);
|
|
|
qwSession.setAvatar(qwExternalContact.getAvatar());
|
|
|
- qwSession.setNickName(qwExternalContact.getRemark());
|
|
|
+ qwSession.setNickName(qwExternalContact.getName());
|
|
|
qwSession.setCompanyId(qwuser.getCompanyId());
|
|
|
qwSession.setCompanyUserId(qwuser.getCompanyUserId());
|
|
|
qwSession.setCreateTime(new Date());
|
|
@@ -147,7 +164,7 @@ public class QwMsgServiceImpl extends ServiceImpl<QwMsgMapper, QwMsg> implements
|
|
|
qwSessionMapper.insertQwSession(qwSession);
|
|
|
}else {
|
|
|
qwSession.setUpdateTime(new Date());
|
|
|
- qwSession.setNickName(qwExternalContact.getRemark());
|
|
|
+ qwSession.setNickName(qwExternalContact.getName());
|
|
|
qwSessionMapper.updateQwSession(qwSession);
|
|
|
}
|
|
|
QwMsg qwMsg = new QwMsg();
|
|
@@ -161,7 +178,7 @@ public class QwMsgServiceImpl extends ServiceImpl<QwMsgMapper, QwMsg> implements
|
|
|
qwMsg.setQwUserId(qwSession.getQwUserId());
|
|
|
qwMsg.setQwExtId(qwSession.getQwExtId());
|
|
|
qwMsg.setAvatar(qwExternalContact.getAvatar());
|
|
|
- qwMsg.setNickName(qwExternalContact.getRemark());
|
|
|
+ qwMsg.setNickName(qwExternalContact.getName());
|
|
|
qwMsg.setCreateTime(new Date());
|
|
|
if (qwMsgMapper.insertQwMsg(qwMsg) > 0) {
|
|
|
//发送socket
|
|
@@ -235,7 +252,7 @@ public class QwMsgServiceImpl extends ServiceImpl<QwMsgMapper, QwMsg> implements
|
|
|
//客服发送
|
|
|
qwFromUser.setId(Long.parseLong(qwMsg.getQwUserId()));
|
|
|
qwFromUser.setDisplayName(user.getQwUserName());
|
|
|
- qwFromUser.setAvatar("https://cos.his.cdwjyyh.com/fs/20241231/22a765a96da247d1b83ea94fef438a41.png");
|
|
|
+ qwFromUser.setAvatar(user.getAvatar());
|
|
|
msg.setFromUser(qwFromUser);
|
|
|
sendSocket("receiveMsg",JSONObject.toJSONString(msg),user.getAppKey());
|
|
|
}
|
|
@@ -244,20 +261,205 @@ public class QwMsgServiceImpl extends ServiceImpl<QwMsgMapper, QwMsg> implements
|
|
|
|
|
|
@Override
|
|
|
public R sendMsg(QwMsgSendParam param) {
|
|
|
- FsSysConfig config = configUtil.getSysConfig();
|
|
|
- String domainName = config.getHookUrl();
|
|
|
- HttpRequest.post(domainName+"/app/qwmsg/sendMsg")
|
|
|
- .body(JSON.toJSONString(param),"application/json;charset=UTF-8")
|
|
|
- .execute().body();
|
|
|
- return R.ok();
|
|
|
+ if (StringUtils.isBlank(param.getContent())) {
|
|
|
+ return R.error("消息内容不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Objects.isNull(param.getSessionId())) {
|
|
|
+ return R.error("会话ID不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Objects.isNull(param.getMsgType())) {
|
|
|
+ return R.error("消息类型不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询会话
|
|
|
+ QwSession qwSession = qwSessionMapper.selectQwSessionBySessionId(param.getSessionId());
|
|
|
+ if (Objects.isNull(qwSession)) {
|
|
|
+ return R.error("会话不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 外部联系人
|
|
|
+ QwExternalContact qwExternalContact = qwExternalContactMapper.selectQwExternalContactById(Long.valueOf(qwSession.getQwExtId()));
|
|
|
+ if (Objects.isNull(qwExternalContact)) {
|
|
|
+ return R.error("联系人不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 企微用户
|
|
|
+ QwUser qwUser = qwUserMapper.selectQwUserById(Long.parseLong(qwSession.getQwUserId()));
|
|
|
+ if (Objects.isNull(qwUser)) {
|
|
|
+ return R.error("用户不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ Long serverId = qwUser.getServerId();
|
|
|
+ String uuid = qwUser.getUid();
|
|
|
+ String openId = qwExternalContact.getExternalUserId();
|
|
|
+ String sCorpId = qwUser.getCorpId();
|
|
|
+
|
|
|
+ WxWorkUserId2VidDTO params = new WxWorkUserId2VidDTO();
|
|
|
+ params.setOpenid(Collections.singletonList(openId));
|
|
|
+ params.setUuid(uuid);
|
|
|
+ params.setScorpid(sCorpId);
|
|
|
+ WxWorkResponseDTO<List<WxWorkVid2UserIdRespDTO>> listWxWorkResponseDTO = wxWorkService.UserId2Vid(params, serverId);
|
|
|
+
|
|
|
+ if (listWxWorkResponseDTO.getErrcode() != 0) {
|
|
|
+ return R.error(listWxWorkResponseDTO.getErrmsg());
|
|
|
+ }
|
|
|
+ long sendUserId = listWxWorkResponseDTO.getData().get(0).getUser_id();
|
|
|
+ String msgJson;
|
|
|
+
|
|
|
+ MsgType msgType = MsgType.getMsgType(param.getMsgType());
|
|
|
+ // 发送消息 文本
|
|
|
+ if (MsgType.TEXT == msgType) {
|
|
|
+ WxWorkSendTextMsgDTO textMsgDTO = new WxWorkSendTextMsgDTO();
|
|
|
+ textMsgDTO.setUuid(uuid);
|
|
|
+ textMsgDTO.setSend_userid(sendUserId);
|
|
|
+ textMsgDTO.setIsRoom(false);
|
|
|
+ textMsgDTO.setContent(param.getContent());
|
|
|
+ WxWorkResponseDTO<WxWorkSendTextMsgRespDTO> msgRespDTOWxWorkResponseDTO = wxWorkService.SendTextMsg(textMsgDTO, serverId);
|
|
|
+
|
|
|
+ if (msgRespDTOWxWorkResponseDTO.getErrcode() != 0) {
|
|
|
+ return R.error(msgRespDTOWxWorkResponseDTO.getErrmsg());
|
|
|
+ }
|
|
|
+ msgJson = JSONObject.toJSONString(textMsgDTO);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 图片
|
|
|
+ else if (MsgType.IMAGE == msgType) {
|
|
|
+ WxCdnUploadImgLinkDTO linkDTO = new WxCdnUploadImgLinkDTO();
|
|
|
+ linkDTO.setUuid(uuid);
|
|
|
+ linkDTO.setUrl(param.getContent());
|
|
|
+ WxWorkResponseDTO<WxCdnUploadImgLinkResp> imgLinkResp = wxWorkService.cdnUploadImgLink(linkDTO, serverId);
|
|
|
+ if (imgLinkResp.getErrcode() != 0) {
|
|
|
+ return R.error(imgLinkResp.getErrmsg());
|
|
|
+ }
|
|
|
+ WxCdnUploadImgLinkResp data = imgLinkResp.getData();
|
|
|
+
|
|
|
+ // 发送图片消息
|
|
|
+ WxwSendCDNImgMsgDTO imgMsgDTO = new WxwSendCDNImgMsgDTO();
|
|
|
+ imgMsgDTO.setUuid(uuid);
|
|
|
+ imgMsgDTO.setSend_userid(sendUserId);
|
|
|
+ imgMsgDTO.setIsRoom(false);
|
|
|
+ imgMsgDTO.setCdnkey(data.getCdn_key());
|
|
|
+ imgMsgDTO.setAeskey(data.getAes_key());
|
|
|
+ imgMsgDTO.setMd5(data.getMd5());
|
|
|
+ imgMsgDTO.setFileSize(data.getSize());
|
|
|
+ WxWorkResponseDTO<WxwSendCDNImgMsgRespDTO> imgMsgResp = wxWorkService.SendCDNImgMsg(imgMsgDTO, serverId);
|
|
|
+ if (imgMsgResp.getErrcode() != 0) {
|
|
|
+ return R.error(imgMsgResp.getErrmsg());
|
|
|
+ }
|
|
|
+ msgJson = JSONObject.toJSONString(imgMsgDTO);
|
|
|
+ }
|
|
|
+ // 小程序
|
|
|
+ else if (MsgType.MINI_PROGRAM == msgType) {
|
|
|
+ String pagepath = param.getContent();
|
|
|
+
|
|
|
+ // 查询公司对应小程序配置
|
|
|
+ CompanyMiniapp miniappParams = new CompanyMiniapp();
|
|
|
+ miniappParams.setCompanyId(qwUser.getCompanyId());
|
|
|
+ List<CompanyMiniapp> companyMiniapps = companyMiniappMapper.selectCompanyMiniappList(miniappParams);
|
|
|
+ if (companyMiniapps == null || companyMiniapps.isEmpty()) {
|
|
|
+ return R.error("用户所属销售公司主备小程序未配置");
|
|
|
+ }
|
|
|
+
|
|
|
+ FsCoursePlaySourceConfig config = null;
|
|
|
+ companyMiniapps.sort(Comparator.comparing(CompanyMiniapp::getType));
|
|
|
+ for (CompanyMiniapp companyMiniapp : companyMiniapps) {
|
|
|
+ if (config == null) {
|
|
|
+ Wrapper<FsCoursePlaySourceConfig> queryWrapper = Wrappers.<FsCoursePlaySourceConfig>lambdaQuery()
|
|
|
+ .eq(FsCoursePlaySourceConfig::getAppid, companyMiniapp.getAppId())
|
|
|
+ .eq(FsCoursePlaySourceConfig::getIsDel, 0).last("limit 1");
|
|
|
+ config = playSourceConfigMapper.selectOne(queryWrapper);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (config == null) {
|
|
|
+ return R.error("用户所属销售公司主备小程序配置错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ String img = StringUtils.isNotBlank(param.getImage()) ? param.getImage() : config.getImg();
|
|
|
+ WxCdnUploadImgLinkDTO linkDTO = new WxCdnUploadImgLinkDTO();
|
|
|
+ linkDTO.setUuid(uuid);
|
|
|
+ linkDTO.setUrl(img);
|
|
|
+ WxWorkResponseDTO<WxCdnUploadImgLinkResp> imgLinkResp = wxWorkService.cdnUploadImgLink(linkDTO, serverId);
|
|
|
+ if (imgLinkResp.getErrcode() != 0) {
|
|
|
+ return R.error(imgLinkResp.getErrmsg());
|
|
|
+ }
|
|
|
+ WxCdnUploadImgLinkResp data = imgLinkResp.getData();
|
|
|
+
|
|
|
+ // 发送小程序消息
|
|
|
+ WxWorkSendAppMsgDTO appMsgDTO = new WxWorkSendAppMsgDTO();
|
|
|
+ appMsgDTO.setUuid(uuid);
|
|
|
+ appMsgDTO.setSend_userid(sendUserId);
|
|
|
+ appMsgDTO.setDesc(param.getTitle());
|
|
|
+ appMsgDTO.setTitle(config.getName());
|
|
|
+ appMsgDTO.setWeappIconUrl(img);
|
|
|
+ appMsgDTO.setPagepath(pagepath);
|
|
|
+ appMsgDTO.setUsername(config.getOriginalId() + "@app");
|
|
|
+ appMsgDTO.setAppid(config.getAppid());
|
|
|
+ appMsgDTO.setCdnkey(data.getCdn_key());
|
|
|
+ appMsgDTO.setMd5(data.getMd5());
|
|
|
+ appMsgDTO.setAeskey(data.getAes_key());
|
|
|
+ appMsgDTO.setFileSize(data.getSize());
|
|
|
+ appMsgDTO.setIsRoom(false);
|
|
|
+ WxWorkResponseDTO<WxWorkSendAppMsgRespDTO> appMsgResp = wxWorkService.SendAppMsg(appMsgDTO, serverId);
|
|
|
+ if (appMsgResp.getErrcode() != 0) {
|
|
|
+ return R.error(appMsgResp.getErrmsg());
|
|
|
+ }
|
|
|
+
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
+ json.put("appid", config.getAppid());
|
|
|
+ json.put("appName", config.getName());
|
|
|
+ json.put("weappIconUrl", img);
|
|
|
+ json.put("desc", param.getTitle());
|
|
|
+ json.put("pagepath", pagepath);
|
|
|
+ json.put("title", param.getTitle());
|
|
|
+ json.put("thumbnail", img);
|
|
|
+
|
|
|
+ msgJson = json.toJSONString();
|
|
|
+ param.setContent(msgJson);
|
|
|
+ } else {
|
|
|
+ return R.error("暂不支持的消息类型");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 消息保存本地数据库
|
|
|
+ QwMsg qwMsg = new QwMsg();
|
|
|
+ qwMsg.setContent(param.getContent());
|
|
|
+ qwMsg.setSessionId(qwSession.getSessionId());
|
|
|
+ qwMsg.setSendType(2);
|
|
|
+ qwMsg.setCompanyId(qwUser.getCompanyId());
|
|
|
+ qwMsg.setCompanyUserId(qwUser.getCompanyUserId());
|
|
|
+ qwMsg.setMsgType(param.getMsgType());
|
|
|
+ qwMsg.setMsgJson(msgJson);
|
|
|
+ qwMsg.setStatus(0);
|
|
|
+ qwMsg.setQwUserId(qwSession.getQwUserId());
|
|
|
+ qwMsg.setQwExtId(qwSession.getQwExtId());
|
|
|
+ qwMsg.setAvatar(qwExternalContact.getAvatar());
|
|
|
+ qwMsg.setNickName(qwExternalContact.getName());
|
|
|
+ qwMsg.setCreateTime(new Date());
|
|
|
+ qwMsgMapper.insertQwMsg(qwMsg);
|
|
|
+
|
|
|
+ // 组装返回消息结构
|
|
|
+ QwMessageListVO listVO = new QwMessageListVO();
|
|
|
+ QWFromUser qwFromUser = new QWFromUser();
|
|
|
+ qwFromUser.setId(Long.parseLong(qwMsg.getQwUserId()));
|
|
|
+ qwFromUser.setDisplayName(qwUser.getQwUserName());
|
|
|
+ qwFromUser.setAvatar(qwUser.getAvatar());
|
|
|
+ listVO.setType(msgType.getValue());
|
|
|
+ listVO.setStatus("succeed");
|
|
|
+ listVO.setFromUser(qwFromUser);
|
|
|
+ listVO.setSendTime(qwMsg.getCreateTime().getTime());
|
|
|
+ listVO.setId(qwMsg.getMsgId().toString());
|
|
|
+ listVO.setContent(qwMsg.getContent());
|
|
|
+ listVO.setToContactId(String.valueOf(param.getSessionId()));
|
|
|
+ listVO.setAppKey(qwUser.getAppKey());
|
|
|
+ return R.ok().put("data", listVO);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<QwUser> qwUserList(Long userId) {
|
|
|
LambdaQueryWrapper<QwUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
lambdaQueryWrapper.eq(QwUser::getCompanyUserId, userId);
|
|
|
- lambdaQueryWrapper.eq(QwUser::getLoginStatus,1);
|
|
|
- lambdaQueryWrapper.eq(QwUser::getToolStatus,1);
|
|
|
List<QwUser> qwUsers = qwUserMapper.selectList(lambdaQueryWrapper);
|
|
|
return qwUsers;
|
|
|
}
|
|
@@ -288,23 +490,17 @@ public class QwMsgServiceImpl extends ServiceImpl<QwMsgMapper, QwMsg> implements
|
|
|
|
|
|
@Override
|
|
|
public List<QwContactListVO> selectQwConversationByUserId(Long userId) {
|
|
|
- LambdaQueryWrapper<QwSession> sessionWrapper = new LambdaQueryWrapper<>();
|
|
|
- sessionWrapper.eq(QwSession::getQwUserId, userId);
|
|
|
- sessionWrapper.orderByDesc(QwSession::getUpdateTime);
|
|
|
- List<QwSession> qwSessions = qwSessionMapper.selectList(sessionWrapper);
|
|
|
- if (CollectionUtil.isEmpty(qwSessions)){
|
|
|
- return Collections.EMPTY_LIST;
|
|
|
+ // 查询会话列表
|
|
|
+ List<QwContactListVO> contactList = qwSessionMapper.selectContactListByQwUserId(userId);
|
|
|
+ if (contactList.isEmpty()) {
|
|
|
+ return new ArrayList<>();
|
|
|
}
|
|
|
+
|
|
|
ArrayList<QwContactListVO> qwContactListVOS = new ArrayList<>();
|
|
|
- for (QwSession qwSession : qwSessions) {
|
|
|
- QwContactListVO listVO = new QwContactListVO();
|
|
|
- listVO.setId(userId);
|
|
|
- listVO.setAvatar(qwSession.getAvatar());
|
|
|
- listVO.setConversationId(qwSession.getSessionId().toString());
|
|
|
- listVO.setDisplayName(qwSession.getNickName());
|
|
|
-// listVO.setIndex(qwSession.getNickName().substring(0, 1));
|
|
|
+ for (QwContactListVO listVO : contactList) {
|
|
|
LambdaQueryWrapper<QwMsg> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- lambdaQueryWrapper.eq(QwMsg::getSessionId, qwSession.getSessionId());
|
|
|
+ lambdaQueryWrapper.select(QwMsg.class, q -> !q.getColumn().equals("remark"));
|
|
|
+ lambdaQueryWrapper.eq(QwMsg::getSessionId, Integer.parseInt(listVO.getConversationId()));
|
|
|
lambdaQueryWrapper.orderByDesc(QwMsg::getMsgId);
|
|
|
lambdaQueryWrapper.last("limit 1");
|
|
|
List<QwMsg> qwMsgs = qwMsgMapper.selectList(lambdaQueryWrapper);
|
|
@@ -314,6 +510,19 @@ public class QwMsgServiceImpl extends ServiceImpl<QwMsgMapper, QwMsg> implements
|
|
|
qwContactListVOS.add(listVO);
|
|
|
break;
|
|
|
}
|
|
|
+ QwMsg qwMsg = qwMsgs.get(0);
|
|
|
+ if (qwMsg.getMsgType() == 1) {
|
|
|
+ listVO.setType("text");
|
|
|
+ } else if (qwMsg.getMsgType() == 2) {
|
|
|
+ listVO.setType("image");
|
|
|
+ } else if (qwMsg.getMsgType() == 3) {
|
|
|
+ listVO.setType("emotionDynamic");
|
|
|
+ } else if (qwMsg.getMsgType() == 4) {
|
|
|
+ listVO.setType("voice");
|
|
|
+ } else if (qwMsg.getMsgType() == 5) {
|
|
|
+ listVO.setType("miniprogram");
|
|
|
+ }
|
|
|
+ listVO.setMsgId(qwMsg.getMsgId());
|
|
|
listVO.setLastContent(qwMsgs.get(0).getContent());
|
|
|
listVO.setLastSendTime(qwMsgs.get(0).getCreateTime().getTime());
|
|
|
listVO.setUnread(0);
|
|
@@ -325,7 +534,11 @@ public class QwMsgServiceImpl extends ServiceImpl<QwMsgMapper, QwMsg> implements
|
|
|
@Override
|
|
|
public List<QwMsg> selectQwMsgBySession(QwSessionParam param) {
|
|
|
LambdaQueryWrapper<QwMsg> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.select(QwMsg.class, q -> !q.getColumn().equals("remark"));
|
|
|
lambdaQueryWrapper.eq(QwMsg::getSessionId, param.getConversationId());
|
|
|
+ if (Objects.nonNull(param.getMsgId())) {
|
|
|
+ lambdaQueryWrapper.gt(QwMsg::getMsgId, param.getMsgId());
|
|
|
+ }
|
|
|
lambdaQueryWrapper.orderByDesc(QwMsg::getMsgId);
|
|
|
List<QwMsg> records = qwMsgMapper.selectList(lambdaQueryWrapper);
|
|
|
return records;
|
|
@@ -337,7 +550,12 @@ public class QwMsgServiceImpl extends ServiceImpl<QwMsgMapper, QwMsg> implements
|
|
|
List<QwMessageListVO> qwMessageVOS = new ArrayList<>();
|
|
|
for (QwMsg record : list) {
|
|
|
QwMessageListVO listVO = new QwMessageListVO();
|
|
|
- listVO.setType("text");
|
|
|
+ String type = "text";
|
|
|
+ MsgType msgType = MsgType.getMsgType(record.getMsgType());
|
|
|
+ if (Objects.nonNull(record.getMsgType())) {
|
|
|
+ type = msgType.getValue();
|
|
|
+ }
|
|
|
+ listVO.setType(type);
|
|
|
listVO.setStatus("succeed");
|
|
|
QWFromUser qwFromUser = new QWFromUser();
|
|
|
//用户发送
|
|
@@ -348,13 +566,15 @@ public class QwMsgServiceImpl extends ServiceImpl<QwMsgMapper, QwMsg> implements
|
|
|
}else if(record.getSendType() == 2){
|
|
|
qwFromUser.setId(Long.parseLong(record.getQwUserId()));
|
|
|
qwFromUser.setDisplayName(user.getQwUserName());
|
|
|
- qwFromUser.setAvatar("https://cos.his.cdwjyyh.com/fs/20241231/22a765a96da247d1b83ea94fef438a41.png");
|
|
|
+ qwFromUser.setAvatar(user.getAvatar());
|
|
|
}
|
|
|
+ listVO.setExtId(record.getQwExtId());
|
|
|
listVO.setFromUser(qwFromUser);
|
|
|
listVO.setSendTime(record.getCreateTime().getTime());
|
|
|
listVO.setId(record.getMsgId().toString());
|
|
|
listVO.setContent(record.getContent());
|
|
|
listVO.setToContactId(param.getConversationId());
|
|
|
+ listVO.setAppKey(user.getAppKey());
|
|
|
qwMessageVOS.add(listVO);
|
|
|
}
|
|
|
return qwMessageVOS;
|