提交 8822668b 编写于 作者: S sunxiwang

会话存档接口修改,及会话存档回调方法数据入库

上级 8d4336e3
package com.linkwechat.web.controller.wecom;
import com.github.pagehelper.PageInfo;
import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult;
......@@ -7,6 +8,7 @@ import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.common.utils.poi.ExcelUtil;
import com.linkwechat.wecom.domain.WeChatContactMapping;
import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.service.IWeChatContactMappingService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -46,6 +48,18 @@ public class WeChatContactMappingController extends BaseController
return getDataTable(list);
}
/**
* 按客户查询关系映射列表
*/
@PreAuthorize("@ss.hasPermi('chat:mapping:listByCustomer')")
@GetMapping("/listByCustomer")
public TableDataInfo listByCustomer()
{
startPage();
PageInfo<WeCustomer> weCustomerPageInfo = weChatContactMappingService.listByCustomer();
return getDataTable(weCustomerPageInfo);
}
/**
* 导出聊天关系映射列表
*/
......
package com.linkwechat.web.controller.wecom;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.api.R;
import com.github.pagehelper.PageInfo;
import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.ConversationArchiveQuery;
import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.wecom.service.IWeConversationArchiveService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -20,7 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@RequestMapping("/wecom/finance")
public class WeConversationArchiveController {
public class WeConversationArchiveController extends BaseController {
@Autowired
private IWeConversationArchiveService weConversationArchiveService;
......@@ -34,8 +33,8 @@ public class WeConversationArchiveController {
*/
@PreAuthorize("@ss.hasPermi('conversationArchive:chatContact:list')")
@GetMapping("/getChatContactList")
public R<PageInfo<JSONObject>> getChatContactList(ConversationArchiveQuery query) {
return R.ok(weConversationArchiveService.getChatContactList(query));
public TableDataInfo getChatContactList(ConversationArchiveQuery query) {
return getDataTable(weConversationArchiveService.getChatContactList(query));
}
......@@ -49,8 +48,8 @@ public class WeConversationArchiveController {
*/
@PreAuthorize("@ss.hasPermi('conversationArchive:chatRoomContact:list')")
@GetMapping("/getChatRoomContactList")
public R<PageInfo<JSONObject>> getChatRoomContactList(ConversationArchiveQuery query) {
return R.ok(weConversationArchiveService.getChatRoomContactList(query));
public TableDataInfo getChatRoomContactList(ConversationArchiveQuery query) {
return getDataTable(weConversationArchiveService.getChatRoomContactList(query));
}
......
......@@ -74,6 +74,20 @@ public class BaseController
return rspData;
}
/**
* 响应请求分页数据
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
protected TableDataInfo getDataTable(PageInfo<?> pageInfo)
{
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(pageInfo.getList());
rspData.setTotal(pageInfo.getTotal());
return rspData;
}
/**
* 响应返回结果
*
......
......@@ -21,10 +21,4 @@ public class ConversationArchiveQuery extends BaseEntity {
/** 类型 */
private String msgType;
@JSONField(defaultValue = "1")
private Integer pageSize;
@JSONField(defaultValue = "10")
private Integer pageNum;
}
......@@ -61,7 +61,7 @@ public class ElasticSearch {
public void createIndex(String idxName, String idxSQL) {
try {
if (!this.indexExist(idxName)) {
log.error(" idxName={} 已经存在,idxSql={}", idxName, idxSQL);
//log.error(" idxName={} 已经存在,idxSql={}", idxName, idxSQL);
return;
}
CreateIndexRequest request = new CreateIndexRequest(idxName);
......@@ -295,7 +295,7 @@ public class ElasticSearch {
public void deleteIndex(String idxName) {
try {
if (!this.indexExist(idxName)) {
log.error(" idxName={} 已经存在", idxName);
//log.error(" idxName={} 已经存在", idxName);
return;
}
restHighLevelClient.indices().delete(new DeleteIndexRequest(idxName), RequestOptions.DEFAULT);
......
......@@ -17,8 +17,6 @@ import java.security.PrivateKey;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.stream.Collectors;
/**
* @author sxw
......@@ -93,7 +91,7 @@ public class FinanceUtils {
e.printStackTrace();
}
});
log.info("数据解析完成:------------" + chatdataArr.toJSONString());
log.info("数据解析完成:------------");
}
Finance.FreeSlice(slice);
return resList;
......@@ -124,6 +122,7 @@ public class FinanceUtils {
if (StringUtils.isNotEmpty(msgType)) {
getSwitchType(realJsonData, msgType);
}
log.info("数据解析:------------"+ realJsonData.toJSONString());
return realJsonData;
} catch (Exception e) {
log.error("解析密文失败");
......@@ -236,7 +235,7 @@ public class FinanceUtils {
if (realJsonData.containsKey("content")) {
realJsonData.put("content", data);
} else {
realJsonData.put("msgType", data);
realJsonData.put(msgType, data);
}
}
......
......@@ -19,7 +19,7 @@ public interface WeMsgAuditClient {
@Request(url = "/msgaudit/get_permit_user_list",
type = "POST"
)
WeMsgAuditDto getPermitUserList(@DataVariable WeMsgAuditDto msgAuditDto);
WeMsgAuditDto getPermitUserList(@DataObject WeMsgAuditDto msgAuditDto);
/**
* 单聊 获取会话中外部成员的同意情况
......@@ -29,17 +29,17 @@ public interface WeMsgAuditClient {
@Request(url = "/msgaudit/check_single_agree",
type = "POST"
)
WeMsgAuditDto checkSingleAgree(@DataVariable WeMsgAuditDto msgAuditDto);
WeMsgAuditDto checkSingleAgree(@DataObject WeMsgAuditDto msgAuditDto);
/**
* 群聊 获取群会话中外部成员的同意情况
* @param msgAuditDto
* @param weMsgAuditVo
* @return
*/
@Request(url = "/msgaudit/check_room_agree",
type = "POST"
)
WeMsgAuditDto checkRoomAgree(@DataVariable WeMsgAuditDto msgAuditDto);
WeMsgAuditDto checkRoomAgree(@DataObject WeMsgAuditVo weMsgAuditVo);
/**
* 获取会话内容存档内部群信息
......@@ -49,5 +49,5 @@ public interface WeMsgAuditClient {
@Request(url = "/msgaudit/groupchat/get",
type = "POST"
)
WeMsgAuditDto getGroupChat(@DataVariable WeMsgAuditVo weMsgAuditVo);
WeMsgAuditDto getGroupChat(@DataObject WeMsgAuditVo weMsgAuditVo);
}
......@@ -3,57 +3,88 @@ package com.linkwechat.wecom.domain;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField;
import com.linkwechat.common.annotation.Excel;
import com.linkwechat.wecom.domain.dto.msgaudit.WeMsgAuditDto;
import com.linkwechat.wecom.domain.dto.msgaudit.GroupChatVo;
import lombok.Data;
/**
* 聊天关系映射对象 we_chat_contact_mapping
*
*
* @author ruoyi
* @date 2020-12-27
*/
@Data
public class WeChatContactMapping
{
public class WeChatContactMapping {
private static final long serialVersionUID = 1L;
/** 主键id */
/**
* 主键id
*/
private Long id;
/** 发送人id */
/**
* 发送人id
*/
@Excel(name = "发送人id")
private String fromId;
/** 接收人id */
/**
* 接收人id
*/
@Excel(name = "接收人id")
private String receiveId;
/** 群聊id */
/**
* 群聊id
*/
@Excel(name = "群聊id")
private String roomId;
/** 是否为客户 0-成员 1-客户 2-机器人*/
/**
* 是否为客户 0-成员 1-客户 2-机器人
*/
@Excel(name = "是否为客户 0-成员 1-客户 2-机器人")
private Integer isCustom;
/** 是否为客户 0-内部 1-外部 2-群聊*/
/**
* 是否为客户 0-内部 1-外部 2-群聊
*/
@TableField(exist = false)
private Integer searchType;
/** 内部接收人信息 */
/**
* 内部接收人信息
*/
@TableField(exist = false)
private WeUser weUser;
private WeUser fromWeUser;
/** 外部接收人信息 */
/**
* 外部接收人信息
*/
@TableField(exist = false)
private WeCustomer weCustomer;
private WeCustomer fromWeCustomer;
/** 群信息 */
/**
* 内部接收人信息
*/
@TableField(exist = false)
private WeMsgAuditDto roomInfo;
private WeUser receiveWeUser;
/** 最后一条聊天数据 */
/**
* 外部接收人信息
*/
@TableField(exist = false)
private WeCustomer receiveWeCustomer;
/**
* 群信息
*/
@TableField(exist = false)
private GroupChatVo roomInfo;
/**
* 最后一条聊天数据
*/
@TableField(exist = false)
private JSONObject finalChatContext;
}
package com.linkwechat.wecom.domain.dto.msgaudit;
import lombok.Data;
/**
* @author sxw
* @description
* @date 2020/12/30 23:41
**/
@Data
public class GroupChatVo {
/**客户群ID*/
private String chat_id;
/**群名*/
private String name;
/**群主ID*/
private String owner;
/**群的创建时间*/
private long create_time;
/**群公告*/
private String notice;
}
......@@ -48,6 +48,8 @@ public class WeEventChangeExternalContactImpl implements WeCallBackEventFactory
private WeMessagePushClient weMessagePushClient;
@Autowired
private IWeCorpAccountService weCorpAccountService;
@Autowired
private IWeChatContactMappingService weChatContactMappingService;
@Override
......@@ -72,6 +74,9 @@ public class WeEventChangeExternalContactImpl implements WeCallBackEventFactory
case "transfer_fail"://客户接替失败事件
transferFail(message);
break;
case "msg_audit_approved"://客户同意进行聊天内容存档事件
msgAuditApproved(message);
break;
default:
break;
}
......@@ -82,6 +87,21 @@ public class WeEventChangeExternalContactImpl implements WeCallBackEventFactory
}
}
private void msgAuditApproved(WxCpXmlMessageVO message) {
String userId = message.getUserId();
String externalUserId = message.getExternalUserId();
WeChatContactMapping fromMapping = new WeChatContactMapping();
fromMapping.setFromId(userId);
fromMapping.setReceiveId(externalUserId);
fromMapping.setIsCustom(WeConstans.ID_TYPE_EX);
weChatContactMappingService.insertWeChatContactMapping(fromMapping);
WeChatContactMapping receiveMapping = new WeChatContactMapping();
receiveMapping.setFromId(externalUserId);
receiveMapping.setReceiveId(userId);
receiveMapping.setIsCustom(WeConstans.ID_TYPE_USER);
weChatContactMappingService.insertWeChatContactMapping(receiveMapping);
}
private void weChatChangeEvent(WxCpXmlMessageVO message) {
}
......
package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeChatContactMapping;
import java.util.List;
/**
* 聊天关系映射Mapper接口
*
*
* @author ruoyi
* @date 2020-12-27
*/
public interface WeChatContactMappingMapper
{
public interface WeChatContactMappingMapper extends BaseMapper<WeChatContactMapping> {
/**
* 查询聊天关系映射
*
*
* @param id 聊天关系映射ID
* @return 聊天关系映射
*/
......@@ -23,7 +23,7 @@ public interface WeChatContactMappingMapper
/**
* 查询聊天关系映射列表
*
*
* @param weChatContactMapping 聊天关系映射
* @return 聊天关系映射集合
*/
......@@ -31,7 +31,7 @@ public interface WeChatContactMappingMapper
/**
* 新增聊天关系映射
*
*
* @param weChatContactMapping 聊天关系映射
* @return 结果
*/
......@@ -39,7 +39,7 @@ public interface WeChatContactMappingMapper
/**
* 修改聊天关系映射
*
*
* @param weChatContactMapping 聊天关系映射
* @return 结果
*/
......@@ -47,7 +47,7 @@ public interface WeChatContactMappingMapper
/**
* 删除聊天关系映射
*
*
* @param id 聊天关系映射ID
* @return 结果
*/
......@@ -55,7 +55,7 @@ public interface WeChatContactMappingMapper
/**
* 批量删除聊天关系映射
*
*
* @param ids 需要删除的数据ID
* @return 结果
*/
......
package com.linkwechat.wecom.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import com.linkwechat.common.core.domain.elastic.ElasticSearchEntity;
import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.wecom.domain.WeChatContactMapping;
import com.linkwechat.wecom.domain.WeCustomer;
import java.util.List;
/**
* 聊天关系映射Service接口
*
*
* @author ruoyi
* @date 2020-12-27
*/
public interface IWeChatContactMappingService
{
public interface IWeChatContactMappingService extends IService<WeChatContactMapping> {
/**
* 查询聊天关系映射
*
*
* @param id 聊天关系映射ID
* @return 聊天关系映射
*/
......@@ -24,7 +26,7 @@ public interface IWeChatContactMappingService
/**
* 查询聊天关系映射列表
*
*
* @param weChatContactMapping 聊天关系映射
* @return 聊天关系映射集合
*/
......@@ -32,7 +34,7 @@ public interface IWeChatContactMappingService
/**
* 新增聊天关系映射
*
*
* @param weChatContactMapping 聊天关系映射
* @return 结果
*/
......@@ -40,7 +42,7 @@ public interface IWeChatContactMappingService
/**
* 修改聊天关系映射
*
*
* @param weChatContactMapping 聊天关系映射
* @return 结果
*/
......@@ -48,7 +50,7 @@ public interface IWeChatContactMappingService
/**
* 批量删除聊天关系映射
*
*
* @param ids 需要删除的聊天关系映射ID
* @return 结果
*/
......@@ -56,7 +58,7 @@ public interface IWeChatContactMappingService
/**
* 删除聊天关系映射信息
*
*
* @param id 聊天关系映射ID
* @return 结果
*/
......@@ -64,7 +66,13 @@ public interface IWeChatContactMappingService
/**
* 保存
*
* @param query
*/
public void saveWeChatContactMapping(List<ElasticSearchEntity> query);
/**
* 按客户查询关系映射列表
*/
PageInfo<WeCustomer> listByCustomer();
}
package com.linkwechat.wecom.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageInfo;
import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.core.domain.elastic.ElasticSearchEntity;
import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.client.WeCustomerClient;
import com.linkwechat.wecom.client.WeCustomerGroupClient;
import com.linkwechat.wecom.client.WeMsgAuditClient;
import com.linkwechat.wecom.client.WeUserClient;
import com.linkwechat.wecom.domain.WeChatContactMapping;
import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.WeUser;
import com.linkwechat.wecom.domain.vo.WeMsgAuditVo;
import com.linkwechat.wecom.domain.dto.customer.CustomerGroupDetail;
import com.linkwechat.wecom.domain.dto.msgaudit.GroupChatVo;
import com.linkwechat.wecom.mapper.WeChatContactMappingMapper;
import com.linkwechat.wecom.mapper.WeCustomerMapper;
import com.linkwechat.wecom.mapper.WeUserMapper;
......@@ -22,8 +29,10 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* 聊天关系映射Service业务层处理
......@@ -33,7 +42,7 @@ import java.util.Optional;
*/
@Slf4j
@Service
public class WeChatContactMappingServiceImpl implements IWeChatContactMappingService {
public class WeChatContactMappingServiceImpl extends ServiceImpl<WeChatContactMappingMapper, WeChatContactMapping> implements IWeChatContactMappingService {
@Autowired
private WeChatContactMappingMapper weChatContactMappingMapper;
@Autowired
......@@ -45,6 +54,8 @@ public class WeChatContactMappingServiceImpl implements IWeChatContactMappingSer
@Autowired
private WeCustomerClient weCustomerClient;
@Autowired
private WeCustomerGroupClient weCustomerGroupClient;
@Autowired
private WeMsgAuditClient weMsgAuditClient;
@Autowired
private IWeConversationArchiveService weConversationArchiveService;
......@@ -74,19 +85,20 @@ public class WeChatContactMappingServiceImpl implements IWeChatContactMappingSer
if (StringUtils.isNotEmpty(item.getReceiveId())) {
if (WeConstans.ID_TYPE_USER.equals(item.getIsCustom())) {
//成员信息
item.setWeUser(weUserMapper.selectOne(new LambdaQueryWrapper<WeUser>().eq(WeUser::getUserId, item.getReceiveId())));
item.setReceiveWeUser(weUserMapper.selectOne(new LambdaQueryWrapper<WeUser>().eq(WeUser::getUserId, item.getReceiveId())));
} else if (WeConstans.ID_TYPE_EX.equals(item.getIsCustom())) {
//获取外部联系人信息
item.setWeCustomer(weCustomerMapper.selectWeCustomerById(item.getReceiveId()));
item.setReceiveWeCustomer(weCustomerMapper.selectWeCustomerById(item.getReceiveId()));
} else if (WeConstans.ID_TYPE_MACHINE.equals(item.getIsCustom())) {
//拉去机器人信息暂不处理
}
item.setFinalChatContext(weConversationArchiveService.getFinalChatContactInfo(item.getFromId(), item.getReceiveId()));
} else if (StringUtils.isNotEmpty(item.getRoomId())) {
//获取群信息
WeMsgAuditVo weMsgAuditVo = new WeMsgAuditVo();
weMsgAuditVo.setRoomid(item.getRoomId());
item.setRoomInfo(weMsgAuditClient.getGroupChat(weMsgAuditVo));
CustomerGroupDetail customerGroupDetail = weCustomerGroupClient.groupChatDetail(new CustomerGroupDetail().new Params(item.getRoomId()));
GroupChatVo groupChatVo = new GroupChatVo();
BeanUtil.copyProperties(customerGroupDetail.getGroup_chat().get(0), groupChatVo);
item.setRoomInfo(groupChatVo);
item.setFinalChatContext(weConversationArchiveService.getFinalChatRoomContactInfo(item.getFromId(), item.getRoomId()));
}
});
......@@ -177,6 +189,19 @@ public class WeChatContactMappingServiceImpl implements IWeChatContactMappingSer
});
}
@Override
public PageInfo<WeCustomer> listByCustomer() {
LambdaQueryWrapper<WeChatContactMapping> lambdaQueryWrapper = new LambdaQueryWrapper<WeChatContactMapping>()
.eq(WeChatContactMapping::getIsCustom, WeConstans.ID_TYPE_EX);
List<WeChatContactMapping> weChatContactMappingList = this.baseMapper.selectList(lambdaQueryWrapper);
List<WeCustomer> resultList = Optional.ofNullable(weChatContactMappingList).orElseGet(ArrayList::new)
.stream().map(item -> weCustomerMapper.selectWeCustomerById(item.getReceiveId())).collect(Collectors.toList());
PageInfo<WeCustomer> weCustomerPageInfo = new PageInfo<>(resultList);
weCustomerPageInfo.setTotal(new PageInfo<>(weChatContactMappingList).getTotal());
return weCustomerPageInfo;
}
/**
* 发送人转接收人
......
......@@ -6,6 +6,8 @@ import com.github.pagehelper.PageInfo;
import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.core.domain.ConversationArchiveQuery;
import com.linkwechat.common.core.elasticsearch.ElasticSearch;
import com.linkwechat.common.core.page.PageDomain;
import com.linkwechat.common.core.page.TableSupport;
import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.service.IWeConversationArchiveService;
......@@ -39,11 +41,14 @@ public class WeConversationArchiveServiceImpl implements IWeConversationArchiveS
*/
@Override
public PageInfo<JSONObject> getChatContactList(ConversationArchiveQuery query) {
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum() == null ? 1 : pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize() == null ? 10 : pageDomain.getPageSize();
SearchSourceBuilder builder = new SearchSourceBuilder();
int from = (query.getPageSize() - 1) * query.getPageNum();
builder.size(query.getPageNum());
int from = (pageNum - 1) * pageSize;
builder.size(pageSize);
builder.from(from);
builder.sort("msgtime", SortOrder.ASC);
builder.sort("msgtime", SortOrder.DESC);
BoolQueryBuilder fromBuilder = QueryBuilders.boolQuery().must(QueryBuilders.matchQuery("roomid", ""))
.must(QueryBuilders.matchQuery("from", query.getFromId()))
.must(QueryBuilders.matchQuery("tolist.keyword", query.getReceiveId()));
......@@ -67,16 +72,19 @@ public class WeConversationArchiveServiceImpl implements IWeConversationArchiveS
boolQueryBuilder.filter(QueryBuilders.rangeQuery("msgtime").gte(beginTime).lte(endTime));
}
builder.query(boolQueryBuilder);
return elasticSearch.searchPage(WeConstans.WECOM_FINANCE_INDEX, builder, query.getPageNum(), query.getPageSize(), JSONObject.class);
return elasticSearch.searchPage(WeConstans.WECOM_FINANCE_INDEX, builder, pageNum, pageSize, JSONObject.class);
}
@Override
public PageInfo<JSONObject> getChatRoomContactList(ConversationArchiveQuery query) {
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum() == null ? 1 : pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize() == null ? 10 : pageDomain.getPageSize();
SearchSourceBuilder builder = new SearchSourceBuilder();
int from = (query.getPageSize() - 1) * query.getPageNum();
builder.size(query.getPageNum());
int from = (pageNum - 1) * pageSize;
builder.size(pageSize);
builder.from(from);
builder.sort("msgtime", SortOrder.ASC);
builder.sort("msgtime", SortOrder.DESC);
BoolQueryBuilder fromBuilder = QueryBuilders.boolQuery().must(QueryBuilders.matchQuery("roomid", query.getRoomId()))
.must(QueryBuilders.matchQuery("from", query.getFromId()));
......@@ -102,14 +110,14 @@ public class WeConversationArchiveServiceImpl implements IWeConversationArchiveS
}
builder.query(boolQueryBuilder);
return elasticSearch.searchPage(WeConstans.WECOM_FINANCE_INDEX, builder, query.getPageNum(), query.getPageSize(), JSONObject.class);
return elasticSearch.searchPage(WeConstans.WECOM_FINANCE_INDEX, builder, pageNum, pageSize, JSONObject.class);
}
@Override
public JSONObject getFinalChatContactInfo(String fromId, String receiveId) {
SearchSourceBuilder builder = new SearchSourceBuilder();
builder.sort("msgtime", SortOrder.ASC);
builder.sort("msgtime", SortOrder.DESC);
builder.size(1);
BoolQueryBuilder fromBuilder = QueryBuilders.boolQuery().must(QueryBuilders.matchQuery("roomid", ""))
.must(QueryBuilders.matchQuery("from", fromId))
......@@ -134,7 +142,7 @@ public class WeConversationArchiveServiceImpl implements IWeConversationArchiveS
@Override
public JSONObject getFinalChatRoomContactInfo(String fromId, String roomId) {
SearchSourceBuilder builder = new SearchSourceBuilder();
builder.sort("msgtime", SortOrder.ASC);
builder.sort("msgtime", SortOrder.DESC);
builder.size(1);
BoolQueryBuilder fromBuilder = QueryBuilders.boolQuery().must(QueryBuilders.matchQuery("roomid", roomId))
.must(QueryBuilders.matchQuery("from", fromId));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册