提交 3e1dfdc1 编写于 作者: 孙喜旺

Revert "feat:联系人token使用ContactTokenInterceptor添加"

This reverts commit 3b0789a3
上级 2a8f3fee
......@@ -6,7 +6,6 @@ import com.dtflys.forest.annotation.DataObject;
import com.dtflys.forest.annotation.Request;
import com.linkwechat.wecom.domain.dto.WeResultDto;
import com.linkwechat.wecom.domain.dto.tag.*;
import com.linkwechat.wecom.interceptor.ContactTokenInterceptor;
import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
/**
......@@ -22,7 +21,9 @@ public interface WeCropTagClient {
* @param weCropGroupTag dataType = "json"
* @return
*/
@Request(url="/externalcontact/add_corp_tag", type = "POST", interceptor = ContactTokenInterceptor.class)
@Request(url="/externalcontact/add_corp_tag",
type = "POST"
)
WeCropGropTagDtlDto addCorpTag(@DataObject WeCropGroupTagDto weCropGroupTag);
......@@ -30,7 +31,9 @@ public interface WeCropTagClient {
* 获取所有标签 WeCropGroupTagDto
* @return
*/
@Request(url = "/externalcontact/get_corp_tag_list", type = "POST", interceptor = ContactTokenInterceptor.class)
@Request(url = "/externalcontact/get_corp_tag_list",
type = "POST"
)
WeCropGroupTagListDto getAllCorpTagList();
......@@ -38,7 +41,9 @@ public interface WeCropTagClient {
* 根据指定标签的id,获取标签详情
* @return
*/
@Request(url = "/externalcontact/get_corp_tag_list", type = "POST", interceptor = ContactTokenInterceptor.class)
@Request(url = "/externalcontact/get_corp_tag_list",
type = "POST"
)
WeCropGroupTagListDto getCorpTagListByTagIds(@Body WeFindCropTagParam weFindCropTagParam);
......@@ -47,7 +52,9 @@ public interface WeCropTagClient {
* @param weCropDelDto
* @return
*/
@Request(url = "/externalcontact/del_corp_tag", type = "POST", interceptor = ContactTokenInterceptor.class)
@Request(url = "/externalcontact/del_corp_tag",
type = "POST"
)
WeResultDto delCorpTag(@DataObject WeCropDelDto weCropDelDto);
......@@ -56,6 +63,8 @@ public interface WeCropTagClient {
* @param weCropTagDto
* @return
*/
@Request(url = "/externalcontact/edit_corp_tag", type = "POST", interceptor = ContactTokenInterceptor.class)
@Request(url = "/externalcontact/edit_corp_tag",
type = "POST"
)
WeResultDto editCorpTag(@DataObject WeCropTagDto weCropTagDto);
}
\ No newline at end of file
......@@ -5,7 +5,6 @@ import com.linkwechat.wecom.domain.dto.*;
import com.linkwechat.wecom.domain.dto.customer.*;
import com.linkwechat.wecom.domain.query.GroupChatStatisticQuery;
import com.linkwechat.wecom.domain.query.UserBehaviorDataQuery;
import com.linkwechat.wecom.interceptor.ContactTokenInterceptor;
import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
......@@ -23,7 +22,7 @@ public interface WeCustomerClient {
* 获取配置了客户联系功能的成员列表
* @return
*/
@Request(url = "/externalcontact/get_follow_user_list", interceptor = ContactTokenInterceptor.class)
@Request(url = "/externalcontact/get_follow_user_list")
FollowUserList getFollowUserList();
......@@ -32,7 +31,7 @@ public interface WeCustomerClient {
* @param userId 企业服务管理人员id(具有外部联系功能的员工)
* @return
*/
@Request(url = "/externalcontact/list",interceptor = ContactTokenInterceptor.class)
@Request(url = "/externalcontact/list")
ExternalUserList list(@Query("userid") String userId);
......@@ -41,7 +40,7 @@ public interface WeCustomerClient {
* @param externalUserid
* @return
*/
@Request(url = "/externalcontact/get",interceptor = ContactTokenInterceptor.class)
@Request(url = "/externalcontact/get")
ExternalUserDetail get(@Query("external_userid") String externalUserid);
/**
......@@ -49,7 +48,7 @@ public interface WeCustomerClient {
* @param query
* @return
*/
@Request(url = "/externalcontact/batch/get_by_user", type = "POST",interceptor = ContactTokenInterceptor.class)
@Request(url = "/externalcontact/batch/get_by_user", type = "POST")
ExternalUserList getByUser(@DataObject Map<String,Object> query);
......@@ -68,14 +67,17 @@ public interface WeCustomerClient {
* 编辑客户标签
* @return
*/
@Request(url = "/externalcontact/mark_tag", type = "POST", interceptor = ContactTokenInterceptor.class)
@Request(url = "/externalcontact/mark_tag",
type = "POST"
)
WeResultDto makeCustomerLabel(@DataObject CutomerTagEdit cutomerTagEdit);
/**
* 客户发送欢迎语
*/
@Request(url = "/externalcontact/send_welcome_msg", type = "POST", interceptor = ContactTokenInterceptor.class)
@Request(url = "/externalcontact/send_welcome_msg",
type = "POST")
WeResultDto sendWelcomeMsg(@DataObject WeWelcomeMsg wxCpWelcomeMsg);
......@@ -83,7 +85,8 @@ public interface WeCustomerClient {
* unionid转换external_userid
* @return
*/
@Request(url = "/externalcontact/unionid_to_external_userid", type = "POST", interceptor = ContactTokenInterceptor.class)
@Request(url = "/externalcontact/unionid_to_external_userid",
type = "POST")
ExternalUserDetail unionidToExternalUserid(@DataObject ExternalUserDetail.ExternalContact unionid);
......@@ -91,20 +94,23 @@ public interface WeCustomerClient {
* 联系客户统计
* @return
*/
@Request(url = "/externalcontact/get_user_behavior_data", type = "POST", interceptor = ContactTokenInterceptor.class)
@Request(url = "/externalcontact/get_user_behavior_data",
type = "POST")
UserBehaviorDataDto getUserBehaviorData(@JSONBody UserBehaviorDataQuery query);
/**
* 群聊数据统计(按群主聚合的方式)
* @return
*/
@Request(url = "/externalcontact/groupchat/statistic", type = "POST", interceptor = ContactTokenInterceptor.class)
@Request(url = "/externalcontact/groupchat/statistic",
type = "POST")
GroupChatStatisticDto getGroupChatStatistic(@JSONBody GroupChatStatisticQuery query);
/**
* 群聊数据统计(按自然日聚合的方式)
* @return
*/
@Request(url = "/externalcontact/groupchat/statistic_group_by_day", type = "POST", interceptor = ContactTokenInterceptor.class)
@Request(url = "/externalcontact/groupchat/statistic_group_by_day",
type = "POST")
GroupChatStatisticDto getGroupChatStatisticGroupByDay(@JSONBody GroupChatStatisticQuery query);
}
......@@ -6,7 +6,6 @@ import com.dtflys.forest.annotation.Query;
import com.dtflys.forest.annotation.Request;
import com.linkwechat.wecom.domain.dto.customer.CustomerGroupDetail;
import com.linkwechat.wecom.domain.dto.customer.CustomerGroupList;
import com.linkwechat.wecom.interceptor.ContactTokenInterceptor;
import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
/**
......@@ -23,7 +22,9 @@ public interface WeCustomerGroupClient {
* @param params
* @return
*/
@Request(url="/externalcontact/groupchat/list", type = "POST", interceptor = ContactTokenInterceptor.class)
@Request(url="/externalcontact/groupchat/list",
type = "POST"
)
CustomerGroupList groupChatLists(@DataObject CustomerGroupList.Params params);
......@@ -32,6 +33,8 @@ public interface WeCustomerGroupClient {
* @param params
* @return
*/
@Request(url="/externalcontact/groupchat/get", type = "POST", interceptor = ContactTokenInterceptor.class)
@Request(url="/externalcontact/groupchat/get",
type = "POST"
)
CustomerGroupDetail groupChatDetail(@DataObject CustomerGroupDetail.Params params);
}
\ No newline at end of file
......@@ -5,7 +5,6 @@ import com.linkwechat.wecom.domain.dto.message.QueryCustomerMessageStatusResultD
import com.linkwechat.wecom.domain.dto.message.QueryCustomerMessageStatusResultDto;
import com.linkwechat.wecom.domain.dto.message.SendMessageResultDto;
import com.linkwechat.wecom.domain.dto.message.WeCustomerMessagePushDto;
import com.linkwechat.wecom.interceptor.ContactTokenInterceptor;
import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
/**
......@@ -21,7 +20,9 @@ public interface WeCustomerMessagePushClient {
* 添加企业群发消息任务
* <a href="https://work.weixin.qq.com/api/doc/90000/90135/92135">API文档地址</a>
*/
@Request(url = "/externalcontact/add_msg_template", type = "POST",interceptor = ContactTokenInterceptor.class)
@Request(url = "/externalcontact/add_msg_template",
type = "POST"
)
SendMessageResultDto sendCustomerMessageToUser(@Body WeCustomerMessagePushDto customerMessagePushDto);
/**
......@@ -30,7 +31,9 @@ public interface WeCustomerMessagePushClient {
*
* @param queryCustomerMessageStatusResultDataObjectDto{msgid} <a href="https://work.weixin.qq.com/api/doc/90000/90135/92135">添加企业群发消息任务返回的msgid</a>
*/
@Request(url = "/externalcontact/get_group_msg_result", type = "POST", interceptor = ContactTokenInterceptor.class)
@Request(url = "/externalcontact/get_group_msg_result",
type = "POST"
)
QueryCustomerMessageStatusResultDto queryCustomerMessageStatus(@Body QueryCustomerMessageStatusResultDataObjectDto queryCustomerMessageStatusResultDataObjectDto);
......
......@@ -5,7 +5,6 @@ import com.dtflys.forest.annotation.DataObject;
import com.dtflys.forest.annotation.Query;
import com.dtflys.forest.annotation.Request;
import com.linkwechat.wecom.domain.dto.WeExternalContactDto;
import com.linkwechat.wecom.interceptor.ContactTokenInterceptor;
import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
/**
......@@ -16,10 +15,12 @@ import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
@BaseRequest(interceptor = WeAccessTokenInterceptor.class)
public interface WeExternalContactClient {
@Request(url = "/externalcontact/add_contact_way", type = "POST", interceptor = ContactTokenInterceptor.class)
@Request(url = "/externalcontact/add_contact_way",
type = "POST"
)
WeExternalContactDto addContactWay(@DataObject WeExternalContactDto.WeContactWay weContactWay);
@Request(url = "/externalcontact/update_contact_way", type = "POST", interceptor = ContactTokenInterceptor.class)
@Request(url = "/externalcontact/update_contact_way", type = "POST")
WeExternalContactDto updateContactWay(@DataObject WeExternalContactDto.WeContactWay weContactWay);
@Request(url = "/externalcontact/del_contact_way", type = "POST")
......
......@@ -2,7 +2,6 @@ package com.linkwechat.wecom.client;
import com.dtflys.forest.annotation.*;
import com.linkwechat.wecom.domain.dto.*;
import com.linkwechat.wecom.interceptor.ContactTokenInterceptor;
import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
/**
......@@ -67,7 +66,9 @@ public interface WeUserClient {
* 分配客户
* @return
*/
@Request(url="/externalcontact/transfer", type = "POST", interceptor = ContactTokenInterceptor.class)
@Request(url="/externalcontact/transfer",
type = "POST"
)
WeResultDto allocateCustomer(@Body AllocateWeCustomerDto allocateWeCustomerDto);
......@@ -75,7 +76,9 @@ public interface WeUserClient {
* 分配成员群
* @return
*/
@Request(url="/externalcontact/groupchat/transfer", type = "POST", interceptor = ContactTokenInterceptor.class)
@Request(url="/externalcontact/groupchat/transfer",
type = "POST"
)
WeResultDto allocateGroup(@Body AllocateWeGroupDto allocateWeGroupDto);
......@@ -83,7 +86,10 @@ public interface WeUserClient {
* 获取离职员工列表
* @return
*/
@Request(url = "/externalcontact/get_unassigned_list", type = "POST", interceptor = ContactTokenInterceptor.class)
@Request(
url = "/externalcontact/get_unassigned_list",
type = "POST"
)
LeaveWeUserListsDto leaveWeUsers();
......
package com.linkwechat.wecom.interceptor;
import com.dtflys.forest.http.ForestRequest;
import com.dtflys.forest.interceptor.Interceptor;
import com.linkwechat.wecom.service.IWeAccessTokenService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 联系人token拦截器
* @author huolifu
* @date 2021/6/16
*/
@Slf4j
@Component
public class ContactTokenInterceptor implements Interceptor {
@Autowired
private IWeAccessTokenService iWeAccessTokenService;
@Override
public boolean beforeExecute(ForestRequest request) {
request.addQuery("access_token",iWeAccessTokenService.findContactAccessToken());
return true;
}
}
......@@ -51,7 +51,10 @@ public class WeAccessTokenInterceptor implements Interceptor{
// 添加请求参数access_token
if(!Arrays.asList(weComeConfig.getNoAccessTokenUrl()).contains(uri)){
String token="";
if(Arrays.asList(weComeConfig.getNeedProviderTokenUrl()).contains(uri)){ //需要供应商token
if(Arrays.asList(weComeConfig.getNeedContactTokenUrl()).contains(uri)){ //需要联系人token
token=iWeAccessTokenService.findContactAccessToken();
}else if(Arrays.asList(weComeConfig.getNeedProviderTokenUrl()).contains(uri)){ //需要供应商token
token=iWeAccessTokenService.findProviderAccessToken();
}else if(Arrays.asList(weComeConfig.getNeedChatTokenUrl()).contains(uri)){ //需要会话存档token
token=iWeAccessTokenService.findChatAccessToken();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册