|
|
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
+import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.common.snowflake.Sequence;
|
|
|
import com.cyksj.common.util.Codec;
|
|
|
import com.cyksj.common.util.IoKit;
|
|
|
@@ -18,12 +19,17 @@ import com.cyksj.mapper.GroupsRelationCustomerServiceFollowRecordMapper;
|
|
|
import com.cyksj.mapper.GroupsRelationExpiryRecordMapper;
|
|
|
import com.cyksj.model.dto.AuthRedirect;
|
|
|
import com.cyksj.model.entity.CorpFollow;
|
|
|
+import com.cyksj.model.entity.CorpMsgFollowAssociation;
|
|
|
+import com.cyksj.model.entity.QyMsgContent;
|
|
|
+import com.cyksj.model.manage.views.CorpQyMsgAuditChatView;
|
|
|
import com.cyksj.model.request.corp.CorpCommonReq;
|
|
|
import com.cyksj.model.views.YHLXUserDetailView;
|
|
|
import com.cyksj.redis.RedisService;
|
|
|
import com.cyksj.service.corp.CorpService;
|
|
|
import com.cyksj.service.corp.CorpUserService;
|
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
|
+import com.ejlchina.searcher.SearchResult;
|
|
|
+import com.ejlchina.searcher.util.MapUtils;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
@@ -33,8 +39,10 @@ import org.springframework.web.bind.annotation.*;
|
|
|
import javax.servlet.http.Cookie;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Optional;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/*
|
|
|
*项目名: netflix
|
|
|
@@ -260,4 +268,37 @@ public class WxCorpController {
|
|
|
corpUserService.markCorpUser(corpCommonReq);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 企微会话列表
|
|
|
+ * @param externalUserid 用户 externalUserid
|
|
|
+ */
|
|
|
+ @GetMapping("/getMsgAuditChat")
|
|
|
+ public Result<SearchResult<CorpQyMsgAuditChatView>> getMsgAuditChat(String externalUserid) {
|
|
|
+ String followId = getCorpUuid();
|
|
|
+ List<CorpMsgFollowAssociation> corpMsgFollowAssociations = beanSearcher.searchAll(CorpMsgFollowAssociation.class, MapUtils.builder().field(CorpMsgFollowAssociation::getFollowId, followId).build());
|
|
|
+ List<String> followIds = corpMsgFollowAssociations.stream().map(CorpMsgFollowAssociation::getAssociationFollowId).collect(Collectors.toList());
|
|
|
+ followIds.add(followId);
|
|
|
+ if (StringUtils.isBlank(externalUserid)) {
|
|
|
+ throw BusinessRuntimeException.getInstance("缺少必填参数.");
|
|
|
+ }
|
|
|
+ SearchResult<CorpQyMsgAuditChatView> search = beanSearcher.search(CorpQyMsgAuditChatView.class, MapUtils.flatBuilder(request.getParameterMap())
|
|
|
+ .field(CorpQyMsgAuditChatView::getExternalUserid, externalUserid)
|
|
|
+ .put("followId", followIds.stream()
|
|
|
+ .map(String::valueOf)
|
|
|
+ .collect(Collectors.joining(",")))
|
|
|
+ .build());
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取聊天记录
|
|
|
+ */
|
|
|
+ @GetMapping("/getMsgByFollowIdAndUserId")
|
|
|
+ public Result<SearchResult<QyMsgContent>> getMsgByFollowIdAndUserId(){
|
|
|
+ SearchResult<QyMsgContent> search = beanSearcher.search(QyMsgContent.class, MapUtils.flatBuilder(request.getParameterMap()).build());
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
|
+ }
|
|
|
}
|