|
|
@@ -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.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.common.snowflake.Sequence;
|
|
|
import com.cyksj.common.util.Codec;
|
|
|
@@ -15,14 +16,15 @@ import com.cyksj.dto.CorpJsSdkTicket;
|
|
|
import com.cyksj.dto.CorpOauth2UserInfo;
|
|
|
import com.cyksj.dto.Result;
|
|
|
import com.cyksj.enums.GatewayResponse;
|
|
|
-import com.cyksj.mapper.GroupsRelationCustomerServiceFollowRecordMapper;
|
|
|
import com.cyksj.mapper.GroupsRelationExpiryRecordMapper;
|
|
|
+import com.cyksj.mapper.UserMapper;
|
|
|
+import com.cyksj.mapper.corp.CorpUserTagMapper;
|
|
|
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.entity.*;
|
|
|
import com.cyksj.model.manage.views.CorpQyMsgAuditChatView;
|
|
|
import com.cyksj.model.request.corp.CorpCommonReq;
|
|
|
+import com.cyksj.model.views.CorpUserIntentionView;
|
|
|
+import com.cyksj.model.views.UserIntentionPieView;
|
|
|
import com.cyksj.model.views.YHLXUserDetailView;
|
|
|
import com.cyksj.redis.RedisService;
|
|
|
import com.cyksj.service.corp.CorpService;
|
|
|
@@ -30,6 +32,7 @@ import com.cyksj.service.corp.CorpUserService;
|
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
|
import com.ejlchina.searcher.SearchResult;
|
|
|
import com.ejlchina.searcher.param.Operator;
|
|
|
+import com.ejlchina.searcher.util.MapBuilder;
|
|
|
import com.ejlchina.searcher.util.MapUtils;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -72,7 +75,9 @@ public class WxCorpController {
|
|
|
|
|
|
private final GroupsRelationExpiryRecordMapper groupsRelationExpiryRecordMapper;
|
|
|
|
|
|
- private final GroupsRelationCustomerServiceFollowRecordMapper relationCustomerServiceFollowRecordMapper;
|
|
|
+ private final CorpUserTagMapper corpUserTagMapper;
|
|
|
+
|
|
|
+ private final UserMapper userMapper;
|
|
|
|
|
|
private final static String CORP_UUID = "corp-uuid";
|
|
|
|
|
|
@@ -80,7 +85,7 @@ public class WxCorpController {
|
|
|
* 企业微信 消息推送url
|
|
|
*/
|
|
|
@RequestMapping(value = "/msg/notify", method = {RequestMethod.GET, RequestMethod.POST})
|
|
|
- public String msgNotify(@RequestParam(value = "msg_signature") String msgSignature, String timestamp, String nonce, @RequestParam(value = "echostr",required = false) String echoStr) throws Exception {
|
|
|
+ public String msgNotify(@RequestParam(value = "msg_signature") String msgSignature, String timestamp, String nonce, @RequestParam(value = "echostr", required = false) String echoStr) throws Exception {
|
|
|
if (StrUtil.hasEmpty(msgSignature, timestamp, nonce)) {
|
|
|
return StringUtil.EMPTY;
|
|
|
}
|
|
|
@@ -216,7 +221,7 @@ public class WxCorpController {
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(jsSdkTicket);
|
|
|
}
|
|
|
|
|
|
- public String getCorpUuid(){
|
|
|
+ public String getCorpUuid() {
|
|
|
return Optional.ofNullable(request.getHeader(CORP_UUID)).orElse(StringUtil.EMPTY);
|
|
|
}
|
|
|
|
|
|
@@ -276,6 +281,7 @@ public class WxCorpController {
|
|
|
|
|
|
/**
|
|
|
* 企微会话列表
|
|
|
+ *
|
|
|
* @param externalUserid 用户 externalUserid
|
|
|
*/
|
|
|
@GetMapping("/getMsgAuditChat")
|
|
|
@@ -300,8 +306,68 @@ public class WxCorpController {
|
|
|
* 获取聊天记录
|
|
|
*/
|
|
|
@GetMapping("/getMsgByFollowIdAndUserId")
|
|
|
- public Result<SearchResult<QyMsgContent>> getMsgByFollowIdAndUserId(){
|
|
|
+ public Result<SearchResult<QyMsgContent>> getMsgByFollowIdAndUserId() {
|
|
|
SearchResult<QyMsgContent> search = beanSearcher.search(QyMsgContent.class, MapUtils.flatBuilder(request.getParameterMap()).build());
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取主动回传 回传数据
|
|
|
+ *
|
|
|
+ * @Param unionId 用户unionId
|
|
|
+ */
|
|
|
+ @GetMapping("/acquistionLinkCallback")
|
|
|
+ public Result<CorpCustomerAcquistionCallback> getAcquistionLinkCallback(Long userId) {
|
|
|
+ MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
|
|
|
+ if (userId != null) {
|
|
|
+ User user = userMapper.selectById(userId);
|
|
|
+ if (user != null && StrUtil.isNotBlank(user.getUnionid())) {
|
|
|
+ builder.field(CorpCustomerAcquistionCallback::getUnionId, user.getUnionid());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ CorpCustomerAcquistionCallback corpCustomerAcquistionCallback = beanSearcher.searchFirst(CorpCustomerAcquistionCallback.class, builder.build());
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(corpCustomerAcquistionCallback);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 主动回传
|
|
|
+ *
|
|
|
+ * @param id 记录id
|
|
|
+ */
|
|
|
+ @GetMapping("/acquistionLinkCallback/{id}")
|
|
|
+ public Result<String> postAcquistionLinkCallback(@PathVariable Long id) {
|
|
|
+ corpService.postAcquistionLinkCallback(id);
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改 意向
|
|
|
+ */
|
|
|
+ @PutMapping("/upCallbackIntention")
|
|
|
+ public Result<String> upCallbackIntention(@RequestBody CorpCustomerAcquistionCallback corpCustomerAcquistionCallback) {
|
|
|
+ log.info("修改意向:{}", corpCustomerAcquistionCallback);
|
|
|
+ if (corpCustomerAcquistionCallback.getId() == null || corpCustomerAcquistionCallback.getId() == 0 || corpCustomerAcquistionCallback.getIntention() == null) {
|
|
|
+ throw BusinessRuntimeException.getInstance("缺少必填参数.");
|
|
|
+ }
|
|
|
+ corpService.upCallbackIntention(corpCustomerAcquistionCallback);
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用户意愿饼图
|
|
|
+ */
|
|
|
+ @GetMapping("/get/user/intention/pie")
|
|
|
+ public Result<List<UserIntentionPieView>> getUserIntentionPie(String tagId, String date) {
|
|
|
+ List<UserIntentionPieView> userIntentionPieViews = corpUserTagMapper.getUserIntentionPie(tagId, date);
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(userIntentionPieViews);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 标签用户列表
|
|
|
+ */
|
|
|
+ @GetMapping("/get/tag/user/list")
|
|
|
+ public Result<Page<CorpUserIntentionView>> getCorpUserIntentionView(Long userId, String nickname, String tagId, String date, Integer intention, @RequestParam(defaultValue = "1") Integer start, @RequestParam(defaultValue = "10") Integer limit) {
|
|
|
+ Page<CorpUserIntentionView> page = corpUserTagMapper.getCorpUserIntentionView(new Page<>(start, limit), userId, nickname, tagId, date, intention);
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(page);
|
|
|
+ }
|
|
|
}
|