|
@@ -293,7 +293,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
@Override
|
|
@Override
|
|
|
public QwGetGroupmsgListV2Result getGroupmsgListV2(QwGetGroupmsgListV2Param param,String corpId) {
|
|
public QwGetGroupmsgListV2Result getGroupmsgListV2(QwGetGroupmsgListV2Param param,String corpId) {
|
|
|
|
|
|
|
|
- String json = sendPost(QwApiConfig.getGroupmsgListV2, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.getGroupmsgListV2, param,corpId,null);
|
|
|
QwGetGroupmsgListV2Result qwGetGroupmsgListV2Result = JSON.parseObject(json, QwGetGroupmsgListV2Result.class);
|
|
QwGetGroupmsgListV2Result qwGetGroupmsgListV2Result = JSON.parseObject(json, QwGetGroupmsgListV2Result.class);
|
|
|
return qwGetGroupmsgListV2Result;
|
|
return qwGetGroupmsgListV2Result;
|
|
|
}
|
|
}
|
|
@@ -304,7 +304,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
@Override
|
|
@Override
|
|
|
public QwGetGroupmsgTaskResult getGroupmsgTask(QwGetGroupMsgTask task,String corpId) {
|
|
public QwGetGroupmsgTaskResult getGroupmsgTask(QwGetGroupMsgTask task,String corpId) {
|
|
|
|
|
|
|
|
- String json = sendPost(QwApiConfig.getGroupmsgTask, task,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.getGroupmsgTask, task,corpId,null);
|
|
|
QwGetGroupmsgTaskResult qwGetGroupmsgTaskResult = JSON.parseObject(json, QwGetGroupmsgTaskResult.class);
|
|
QwGetGroupmsgTaskResult qwGetGroupmsgTaskResult = JSON.parseObject(json, QwGetGroupmsgTaskResult.class);
|
|
|
return qwGetGroupmsgTaskResult;
|
|
return qwGetGroupmsgTaskResult;
|
|
|
|
|
|
|
@@ -315,7 +315,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public QwGroupmsgSendResult getGroupmsgSendResult(QwGetGroupmsgSendParam param,String corpId) {
|
|
public QwGroupmsgSendResult getGroupmsgSendResult(QwGetGroupmsgSendParam param,String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.getGroupmsgSendResult, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.getGroupmsgSendResult, param,corpId,null);
|
|
|
QwGroupmsgSendResult qwGroupmsgSendResult = JSON.parseObject(json, QwGroupmsgSendResult.class);
|
|
QwGroupmsgSendResult qwGroupmsgSendResult = JSON.parseObject(json, QwGroupmsgSendResult.class);
|
|
|
return qwGroupmsgSendResult;
|
|
return qwGroupmsgSendResult;
|
|
|
}
|
|
}
|
|
@@ -808,7 +808,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
@Override
|
|
@Override
|
|
|
public QwAddContactWayResult addContactWay(QwAddContactWayParam param, String corpId) {
|
|
public QwAddContactWayResult addContactWay(QwAddContactWayParam param, String corpId) {
|
|
|
|
|
|
|
|
- String json = sendPost(QwApiConfig.addContactWay, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.addContactWay, param,corpId,null);
|
|
|
QwAddContactWayResult qwAddContactWayResult = JSON.parseObject(json, QwAddContactWayResult.class);
|
|
QwAddContactWayResult qwAddContactWayResult = JSON.parseObject(json, QwAddContactWayResult.class);
|
|
|
return qwAddContactWayResult;
|
|
return qwAddContactWayResult;
|
|
|
|
|
|
|
@@ -818,7 +818,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
@Override
|
|
@Override
|
|
|
public QwGetContactWayResult getContactWay(QwGetContactWayParam param, String corpId) {
|
|
public QwGetContactWayResult getContactWay(QwGetContactWayParam param, String corpId) {
|
|
|
|
|
|
|
|
- String json = sendPost(QwApiConfig.getContactWay, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.getContactWay, param,corpId,null);
|
|
|
QwGetContactWayResult qwGetContactWayResult = JSON.parseObject(json, QwGetContactWayResult.class);
|
|
QwGetContactWayResult qwGetContactWayResult = JSON.parseObject(json, QwGetContactWayResult.class);
|
|
|
return qwGetContactWayResult;
|
|
return qwGetContactWayResult;
|
|
|
}
|
|
}
|
|
@@ -827,7 +827,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
@Override
|
|
@Override
|
|
|
public QwListContactWayReslut listContactWay(QwListContactWayParam param, String corpId) {
|
|
public QwListContactWayReslut listContactWay(QwListContactWayParam param, String corpId) {
|
|
|
|
|
|
|
|
- String json = sendPost(QwApiConfig.listContactWay, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.listContactWay, param,corpId,null);
|
|
|
QwListContactWayReslut qwListContactWayReslut = JSON.parseObject(json, QwListContactWayReslut.class);
|
|
QwListContactWayReslut qwListContactWayReslut = JSON.parseObject(json, QwListContactWayReslut.class);
|
|
|
return qwListContactWayReslut;
|
|
return qwListContactWayReslut;
|
|
|
|
|
|
|
@@ -836,7 +836,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
/** 更新企业已配置的「联系我」方式 */
|
|
/** 更新企业已配置的「联系我」方式 */
|
|
|
@Override
|
|
@Override
|
|
|
public QwResult updateContactWay(QwUpdateContactWayParam param, String corpId) {
|
|
public QwResult updateContactWay(QwUpdateContactWayParam param, String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.updateContactWay, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.updateContactWay, param,corpId,null);
|
|
|
QwResult qwResult = JSON.parseObject(json, QwResult.class);
|
|
QwResult qwResult = JSON.parseObject(json, QwResult.class);
|
|
|
return qwResult;
|
|
return qwResult;
|
|
|
|
|
|
|
@@ -846,14 +846,14 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
@Override
|
|
@Override
|
|
|
public QwResult delContactWay(QwGetContactWayParam param, String corpId) {
|
|
public QwResult delContactWay(QwGetContactWayParam param, String corpId) {
|
|
|
|
|
|
|
|
- String json = sendPost(QwApiConfig.delContactWay, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.delContactWay, param,corpId,null);
|
|
|
QwResult qwResult = JSON.parseObject(json, QwResult.class);
|
|
QwResult qwResult = JSON.parseObject(json, QwResult.class);
|
|
|
return qwResult;
|
|
return qwResult;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public QwAddContactWayResult addJoinWay(QwAddJoinWayParam param, String corpId) {
|
|
public QwAddContactWayResult addJoinWay(QwAddJoinWayParam param, String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.addJoinWay, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.addJoinWay, param,corpId,null);
|
|
|
QwAddContactWayResult qwAddContactWayResult = JSON.parseObject(json, QwAddContactWayResult.class);
|
|
QwAddContactWayResult qwAddContactWayResult = JSON.parseObject(json, QwAddContactWayResult.class);
|
|
|
return qwAddContactWayResult;
|
|
return qwAddContactWayResult;
|
|
|
}
|
|
}
|
|
@@ -862,7 +862,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
@Override
|
|
@Override
|
|
|
public QeGetJoinWayResult getJoinWay(QwGetContactWayParam param, String corpId) {
|
|
public QeGetJoinWayResult getJoinWay(QwGetContactWayParam param, String corpId) {
|
|
|
|
|
|
|
|
- String json = sendPost(QwApiConfig.getJoinWay, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.getJoinWay, param,corpId,null);
|
|
|
QeGetJoinWayResult qeGetJoinWayResult = JSON.parseObject(json, QeGetJoinWayResult.class);
|
|
QeGetJoinWayResult qeGetJoinWayResult = JSON.parseObject(json, QeGetJoinWayResult.class);
|
|
|
return qeGetJoinWayResult;
|
|
return qeGetJoinWayResult;
|
|
|
}
|
|
}
|
|
@@ -870,7 +870,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
/** 更新客户群进群方式配置 */
|
|
/** 更新客户群进群方式配置 */
|
|
|
@Override
|
|
@Override
|
|
|
public QwResult updateJoinWay(QwAddJoinWayParam param, String corpId) {
|
|
public QwResult updateJoinWay(QwAddJoinWayParam param, String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.updateJoinWay, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.updateJoinWay, param,corpId,null);
|
|
|
QwResult qwResult = JSON.parseObject(json, QwResult.class);
|
|
QwResult qwResult = JSON.parseObject(json, QwResult.class);
|
|
|
return qwResult;
|
|
return qwResult;
|
|
|
|
|
|
|
@@ -880,7 +880,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
@Override
|
|
@Override
|
|
|
public QwResult delJoinWay(QwGetContactWayParam param, String corpId) {
|
|
public QwResult delJoinWay(QwGetContactWayParam param, String corpId) {
|
|
|
|
|
|
|
|
- String json = sendPost(QwApiConfig.delJoinWay, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.delJoinWay, param,corpId,null);
|
|
|
QwResult qwResult = JSON.parseObject(json, QwResult.class);
|
|
QwResult qwResult = JSON.parseObject(json, QwResult.class);
|
|
|
return qwResult;
|
|
return qwResult;
|
|
|
|
|
|
|
@@ -889,20 +889,20 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
/** 获取客户群统计数据 */
|
|
/** 获取客户群统计数据 */
|
|
|
@Override
|
|
@Override
|
|
|
public QwUserBehaviorDataResult getUserBehaviorData(QwUserBehaviorDataParam param, String corpId) {
|
|
public QwUserBehaviorDataResult getUserBehaviorData(QwUserBehaviorDataParam param, String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.getUserBehaviorData, param, corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.getUserBehaviorData, param, corpId,null);
|
|
|
return JSON.parseObject(json, QwUserBehaviorDataResult.class);
|
|
return JSON.parseObject(json, QwUserBehaviorDataResult.class);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** 获取群聊统计数据 */
|
|
/** 获取群聊统计数据 */
|
|
|
@Override
|
|
@Override
|
|
|
public QwGroupChatStatisticResult getGroupChatStatistic(QwGroupChatStatisticParam param, String corpId) {
|
|
public QwGroupChatStatisticResult getGroupChatStatistic(QwGroupChatStatisticParam param, String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.groupChatStatistic, param, corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.groupChatStatistic, param, corpId,null);
|
|
|
return JSON.parseObject(json, QwGroupChatStatisticResult.class);
|
|
return JSON.parseObject(json, QwGroupChatStatisticResult.class);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public QwGroupChatStatisticResult getGroupChatStatisticByOwner(QwGroupChatStatisticParam param, String corpId) {
|
|
public QwGroupChatStatisticResult getGroupChatStatisticByOwner(QwGroupChatStatisticParam param, String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.groupChatStatisticByOwner, param, corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.groupChatStatisticByOwner, param, corpId,null);
|
|
|
return JSON.parseObject(json, QwGroupChatStatisticResult.class);
|
|
return JSON.parseObject(json, QwGroupChatStatisticResult.class);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -914,12 +914,17 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public QwOpenidResult externalcontactToOpenid(QwOpenidByExternalcontactParams param, String corpId) {
|
|
public QwOpenidResult externalcontactToOpenid(QwOpenidByExternalcontactParams param, String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.externalContactConvertToOpenid, param, corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.externalContactConvertToOpenid, param, corpId,null);
|
|
|
return JSON.parseObject(json, QwOpenidResult.class);
|
|
return JSON.parseObject(json, QwOpenidResult.class);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public String getOpenUserid(String accessToken,String userId) {
|
|
|
|
|
|
|
+ public String getOpenUserid(String accessToken,String userId,String corpId) {
|
|
|
|
|
+ String openUserIdRedisKey = "corpId:" + userId;
|
|
|
|
|
+ String redisResult= redisCache.getCacheObject(openUserIdRedisKey);
|
|
|
|
|
+ if(StringUtils.isNotBlank(redisResult)){
|
|
|
|
|
+ return redisResult;
|
|
|
|
|
+ }
|
|
|
JSONObject json=new JSONObject();
|
|
JSONObject json=new JSONObject();
|
|
|
HttpClient httpClient = HttpClients.createDefault();
|
|
HttpClient httpClient = HttpClients.createDefault();
|
|
|
try {
|
|
try {
|
|
@@ -941,7 +946,9 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
if (!openUserIdList.isEmpty()) {
|
|
if (!openUserIdList.isEmpty()) {
|
|
|
for (HashMap map : openUserIdList) {
|
|
for (HashMap map : openUserIdList) {
|
|
|
if (map.get("userid").toString().equals(userId)) {
|
|
if (map.get("userid").toString().equals(userId)) {
|
|
|
- return map.get("open_userid").toString();
|
|
|
|
|
|
|
+ String openUserid = map.get("open_userid").toString();
|
|
|
|
|
+ redisCache.setCacheObject(openUserIdRedisKey,openUserid);
|
|
|
|
|
+ return openUserid;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1125,7 +1132,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
URIBuilder builder = new URIBuilder(QwApiConfig.getServerQwUserName);
|
|
URIBuilder builder = new URIBuilder(QwApiConfig.getServerQwUserName);
|
|
|
String accessToken = getToken(corpId, permanentCode);
|
|
String accessToken = getToken(corpId, permanentCode);
|
|
|
builder.setParameter("access_token", accessToken);
|
|
builder.setParameter("access_token", accessToken);
|
|
|
- String transUserId = getOpenUserid(accessToken,userid);
|
|
|
|
|
|
|
+ String transUserId = getOpenUserid(accessToken,userid,corpId);
|
|
|
builder.setParameter("userid", transUserId);
|
|
builder.setParameter("userid", transUserId);
|
|
|
URI uri = builder.build();
|
|
URI uri = builder.build();
|
|
|
HttpPost httpPost = new HttpPost(uri);
|
|
HttpPost httpPost = new HttpPost(uri);
|
|
@@ -1304,7 +1311,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public QwAddMomentTaskResult addMomentTask(QwAddMomentTask qwAddMomentTask, String corpId) {
|
|
public QwAddMomentTaskResult addMomentTask(QwAddMomentTask qwAddMomentTask, String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.addMomentTask, qwAddMomentTask, corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.addMomentTask, qwAddMomentTask, corpId,null);
|
|
|
QwAddMomentTaskResult qwAddMomentTaskResult = JSON.parseObject(json, QwAddMomentTaskResult.class);
|
|
QwAddMomentTaskResult qwAddMomentTaskResult = JSON.parseObject(json, QwAddMomentTaskResult.class);
|
|
|
return qwAddMomentTaskResult;
|
|
return qwAddMomentTaskResult;
|
|
|
}
|
|
}
|
|
@@ -1348,7 +1355,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public QwResult cancelMomentTask(QwCancelMomentTask qwCancelMomentTask, String corpId) {
|
|
public QwResult cancelMomentTask(QwCancelMomentTask qwCancelMomentTask, String corpId) {
|
|
|
- String result = sendPost(QwApiConfig.cancelMomentTask, qwCancelMomentTask, corpId);
|
|
|
|
|
|
|
+ String result = sendPost(QwApiConfig.cancelMomentTask, qwCancelMomentTask, corpId,null);
|
|
|
|
|
|
|
|
return JSON.parseObject(result, QwResult.class);
|
|
return JSON.parseObject(result, QwResult.class);
|
|
|
}
|
|
}
|
|
@@ -1358,7 +1365,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public QwGetMomentTaskGResult getMomentTaskGResult(QwGetMomentTask qwGetMomentTask, String corpId) {
|
|
public QwGetMomentTaskGResult getMomentTaskGResult(QwGetMomentTask qwGetMomentTask, String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.getMomentTask, qwGetMomentTask, corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.getMomentTask, qwGetMomentTask, corpId,null);
|
|
|
return JSON.parseObject(json, QwGetMomentTaskGResult.class);
|
|
return JSON.parseObject(json, QwGetMomentTaskGResult.class);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1367,7 +1374,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public QwGetMomentCustomerListResult getMomentCustomerList(QwGetMomentCustomerListParam customerListParam, String corpId) {
|
|
public QwGetMomentCustomerListResult getMomentCustomerList(QwGetMomentCustomerListParam customerListParam, String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.getMomentCustomerList, customerListParam, corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.getMomentCustomerList, customerListParam, corpId,null);
|
|
|
return JSON.parseObject(json, QwGetMomentCustomerListResult.class);
|
|
return JSON.parseObject(json, QwGetMomentCustomerListResult.class);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1376,7 +1383,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public QwGetMomentCustomerListResult getMomentSendResult(QwGetMomentSendResultParam qwGetMomentSendResultParam, String corpId) {
|
|
public QwGetMomentCustomerListResult getMomentSendResult(QwGetMomentSendResultParam qwGetMomentSendResultParam, String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.getMomentSendResult, qwGetMomentSendResultParam, corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.getMomentSendResult, qwGetMomentSendResultParam, corpId,null);
|
|
|
return JSON.parseObject(json, QwGetMomentCustomerListResult.class);
|
|
return JSON.parseObject(json, QwGetMomentCustomerListResult.class);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1385,7 +1392,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public QwGetMomentCommentsParamResult getMomentComments(QwGetMomentCommentsParam qwGetMomentCommentsParam, String corpId) {
|
|
public QwGetMomentCommentsParamResult getMomentComments(QwGetMomentCommentsParam qwGetMomentCommentsParam, String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.getMomentComments, qwGetMomentCommentsParam, corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.getMomentComments, qwGetMomentCommentsParam, corpId,null);
|
|
|
return JSON.parseObject(json, QwGetMomentCommentsParamResult.class);
|
|
return JSON.parseObject(json, QwGetMomentCommentsParamResult.class);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1401,11 +1408,13 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
}
|
|
}
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
- public String sendPost(String url, Object param, String corpId) {
|
|
|
|
|
|
|
+ public String sendPost(String url, Object param, String corpId,String appSecret) {
|
|
|
int maxRetries = 3; // 最大重试次数
|
|
int maxRetries = 3; // 最大重试次数
|
|
|
int retryCount = 0; // 当前重试次数
|
|
int retryCount = 0; // 当前重试次数
|
|
|
// 1. 获取配置信息(可放在循环外,但要确保每次都能获取到最新的token)
|
|
// 1. 获取配置信息(可放在循环外,但要确保每次都能获取到最新的token)
|
|
|
- String appSecret = getAppSecret(corpId);
|
|
|
|
|
|
|
+ if (StringUtils.isBlank(appSecret)) {
|
|
|
|
|
+ appSecret = getAppSecret(corpId);
|
|
|
|
|
+ }
|
|
|
while (retryCount < maxRetries) {
|
|
while (retryCount < maxRetries) {
|
|
|
try {
|
|
try {
|
|
|
// 2. 构造并发送请求
|
|
// 2. 构造并发送请求
|
|
@@ -1600,13 +1609,15 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
// String appSecret = qwCompanyConfig.getOpen_Secret();
|
|
// String appSecret = qwCompanyConfig.getOpen_Secret();
|
|
|
QwCompany qwCompany = iQwCompanyService.selectQwCompanyByCorpId(corpId);
|
|
QwCompany qwCompany = iQwCompanyService.selectQwCompanyByCorpId(corpId);
|
|
|
|
|
|
|
|
- String appSecret = qwCompany.getOpenSecret();
|
|
|
|
|
|
|
+// String appSecret = qwCompany.getOpenSecret();
|
|
|
HttpClient httpClient = HttpClients.createDefault();
|
|
HttpClient httpClient = HttpClients.createDefault();
|
|
|
try {
|
|
try {
|
|
|
|
|
|
|
|
URIBuilder builder = new URIBuilder(QwApiConfig.externalcontactListUrl);
|
|
URIBuilder builder = new URIBuilder(QwApiConfig.externalcontactListUrl);
|
|
|
- builder.setParameter("access_token", getToken(corpId,appSecret));
|
|
|
|
|
- builder.setParameter("userid", userId);
|
|
|
|
|
|
|
+ String accessToken = getToken(corpId, qwCompany.getPermanentCode());
|
|
|
|
|
+ builder.setParameter("access_token", accessToken);
|
|
|
|
|
+ String openUserid = getOpenUserid(accessToken, userId, corpId);
|
|
|
|
|
+ builder.setParameter("userid", openUserid);
|
|
|
URI uri = builder.build();
|
|
URI uri = builder.build();
|
|
|
HttpGet httpGet = new HttpGet(uri);
|
|
HttpGet httpGet = new HttpGet(uri);
|
|
|
HttpResponse response = httpClient.execute(httpGet);
|
|
HttpResponse response = httpClient.execute(httpGet);
|
|
@@ -1642,22 +1653,31 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public QwExternalContactAllListResult getAllExternalcontactList(QwExternalListParam param,String corpId) {
|
|
|
|
|
- String json = sendPost(QwApiConfig.externalcontactAllLlistUrl, param,corpId);
|
|
|
|
|
|
|
+ public QwExternalContactAllListResult getAllExternalcontactList(QwExternalListParam param,String corpId,QwCompany qwCompany) {
|
|
|
|
|
+ List<String> useridList = param.getUserid_list();
|
|
|
|
|
+ if (useridList != null && useridList.size() > 0) {
|
|
|
|
|
+ List<String> list = new ArrayList<>();
|
|
|
|
|
+ String accessToken = getToken(corpId, qwCompany.getPermanentCode());
|
|
|
|
|
+ useridList.forEach(userid->{
|
|
|
|
|
+ list.add(getOpenUserid(accessToken, userid, corpId));
|
|
|
|
|
+ });
|
|
|
|
|
+ param.setUserid_list(list);
|
|
|
|
|
+ }
|
|
|
|
|
+ String json = sendPost(QwApiConfig.externalcontactAllLlistUrl, param,corpId,qwCompany.getPermanentCode());
|
|
|
QwExternalContactAllListResult qwResult = JSON.parseObject(json, QwExternalContactAllListResult.class);
|
|
QwExternalContactAllListResult qwResult = JSON.parseObject(json, QwExternalContactAllListResult.class);
|
|
|
return qwResult;
|
|
return qwResult;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public QwExternalContactRemarkResult externalcontactRemark(QwExternalContactRemarkParam param,String corpId) {
|
|
public QwExternalContactRemarkResult externalcontactRemark(QwExternalContactRemarkParam param,String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.externalcontactRemarkUrl, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.externalcontactRemarkUrl, param,corpId,null);
|
|
|
QwExternalContactRemarkResult qwResult = JSON.parseObject(json, QwExternalContactRemarkResult.class);
|
|
QwExternalContactRemarkResult qwResult = JSON.parseObject(json, QwExternalContactRemarkResult.class);
|
|
|
return qwResult;
|
|
return qwResult;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public QwTagResult getTag(QwTagParam param,String corpId) {
|
|
public QwTagResult getTag(QwTagParam param,String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.getTagUrl, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.getTagUrl, param,corpId,null);
|
|
|
log.error("json={}",json);
|
|
log.error("json={}",json);
|
|
|
QwTagResult qwResult = JSON.parseObject(json, QwTagResult.class);
|
|
QwTagResult qwResult = JSON.parseObject(json, QwTagResult.class);
|
|
|
return qwResult;
|
|
return qwResult;
|
|
@@ -1665,7 +1685,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
@Override
|
|
@Override
|
|
|
public QwResult sendWelcomeMsg(SendWelcomeMsgParam param, String corpId) {
|
|
public QwResult sendWelcomeMsg(SendWelcomeMsgParam param, String corpId) {
|
|
|
|
|
|
|
|
- String json = sendPost(QwApiConfig.sendWelcomeMsg,param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.sendWelcomeMsg,param,corpId,null);
|
|
|
QwResult qwResult = JSON.parseObject(json, QwResult.class);
|
|
QwResult qwResult = JSON.parseObject(json, QwResult.class);
|
|
|
return qwResult;
|
|
return qwResult;
|
|
|
}
|
|
}
|
|
@@ -1730,7 +1750,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
@Override
|
|
@Override
|
|
|
public QwUseridResult getuseridBymobile(QwUseridBymobileParam param, String corpId) {
|
|
public QwUseridResult getuseridBymobile(QwUseridBymobileParam param, String corpId) {
|
|
|
|
|
|
|
|
- String json = sendPost(QwApiConfig.getuseridBymobile, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.getuseridBymobile, param,corpId,null);
|
|
|
QwUseridResult qwResult = JSON.parseObject(json, QwUseridResult.class);
|
|
QwUseridResult qwResult = JSON.parseObject(json, QwUseridResult.class);
|
|
|
|
|
|
|
|
return qwResult;
|
|
return qwResult;
|
|
@@ -1739,7 +1759,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
@Override
|
|
@Override
|
|
|
public QwUseridResult getuseridByEmail(QwUseridByEmailParam param, String corpId) {
|
|
public QwUseridResult getuseridByEmail(QwUseridByEmailParam param, String corpId) {
|
|
|
|
|
|
|
|
- String json = sendPost(QwApiConfig.getuseridByEmail, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.getuseridByEmail, param,corpId,null);
|
|
|
QwUseridResult qwResult = JSON.parseObject(json, QwUseridResult.class);
|
|
QwUseridResult qwResult = JSON.parseObject(json, QwUseridResult.class);
|
|
|
return qwResult;
|
|
return qwResult;
|
|
|
}
|
|
}
|
|
@@ -1748,7 +1768,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
@Override
|
|
@Override
|
|
|
public QwAddTagResult addTag(QwAddTagParam param,String corpId) {
|
|
public QwAddTagResult addTag(QwAddTagParam param,String corpId) {
|
|
|
|
|
|
|
|
- String json = sendPost(QwApiConfig.addTagUrl, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.addTagUrl, param,corpId,null);
|
|
|
QwAddTagResult qwResult = JSON.parseObject(json, QwAddTagResult.class);
|
|
QwAddTagResult qwResult = JSON.parseObject(json, QwAddTagResult.class);
|
|
|
return qwResult;
|
|
return qwResult;
|
|
|
}
|
|
}
|
|
@@ -1756,7 +1776,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
@Override
|
|
@Override
|
|
|
public QwResult editTag(QwEditTagParam param,String corpId) {
|
|
public QwResult editTag(QwEditTagParam param,String corpId) {
|
|
|
|
|
|
|
|
- String json = sendPost(QwApiConfig.editTagUrl, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.editTagUrl, param,corpId,null);
|
|
|
QwResult qwResult = JSON.parseObject(json, QwResult.class);
|
|
QwResult qwResult = JSON.parseObject(json, QwResult.class);
|
|
|
return qwResult;
|
|
return qwResult;
|
|
|
}
|
|
}
|
|
@@ -1764,91 +1784,91 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
@Override
|
|
@Override
|
|
|
public QwResult delTag(QwTagParam param,String corpId) {
|
|
public QwResult delTag(QwTagParam param,String corpId) {
|
|
|
|
|
|
|
|
- String json = sendPost(QwApiConfig.delTagUrl, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.delTagUrl, param,corpId,null);
|
|
|
QwResult qwResult = JSON.parseObject(json, QwResult.class);
|
|
QwResult qwResult = JSON.parseObject(json, QwResult.class);
|
|
|
return qwResult;
|
|
return qwResult;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public QwTransferCustomerResult transferCustomer(QwTransferCustomerParam param,String corpId) {
|
|
public QwTransferCustomerResult transferCustomer(QwTransferCustomerParam param,String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.transferCustomerUrl, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.transferCustomerUrl, param,corpId,null);
|
|
|
QwTransferCustomerResult qwResult = JSON.parseObject(json, QwTransferCustomerResult.class);
|
|
QwTransferCustomerResult qwResult = JSON.parseObject(json, QwTransferCustomerResult.class);
|
|
|
return qwResult;
|
|
return qwResult;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public QwGetTransferResult getTransfer(QwGetTransferParam param,String corpId) {
|
|
public QwGetTransferResult getTransfer(QwGetTransferParam param,String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.getTransferUrl, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.getTransferUrl, param,corpId,null);
|
|
|
QwGetTransferResult qwResult = JSON.parseObject(json, QwGetTransferResult.class);
|
|
QwGetTransferResult qwResult = JSON.parseObject(json, QwGetTransferResult.class);
|
|
|
return qwResult;
|
|
return qwResult;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public QwGroupChatTransferResult groupChatTransfer(QwGroupChatTransferParam param,String corpId) {
|
|
public QwGroupChatTransferResult groupChatTransfer(QwGroupChatTransferParam param,String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.groupChatTransferUrl, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.groupChatTransferUrl, param,corpId,null);
|
|
|
QwGroupChatTransferResult qwResult = JSON.parseObject(json, QwGroupChatTransferResult.class);
|
|
QwGroupChatTransferResult qwResult = JSON.parseObject(json, QwGroupChatTransferResult.class);
|
|
|
return qwResult;
|
|
return qwResult;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public QwUnassignedListResult getUnassignedList(QwUnassignedListParam param,String corpId) {
|
|
public QwUnassignedListResult getUnassignedList(QwUnassignedListParam param,String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.getUnassignedListUrl, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.getUnassignedListUrl, param,corpId,null);
|
|
|
QwUnassignedListResult qwResult = JSON.parseObject(json, QwUnassignedListResult.class);
|
|
QwUnassignedListResult qwResult = JSON.parseObject(json, QwUnassignedListResult.class);
|
|
|
return qwResult;
|
|
return qwResult;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public QwTransferCustomerResignedResult resignedTransferCustomer(QwTransferCustomerResignedParam param,String corpId) {
|
|
public QwTransferCustomerResignedResult resignedTransferCustomer(QwTransferCustomerResignedParam param,String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.resignedTransferCustomerUrl, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.resignedTransferCustomerUrl, param,corpId,null);
|
|
|
QwTransferCustomerResignedResult qwResult = JSON.parseObject(json, QwTransferCustomerResignedResult.class);
|
|
QwTransferCustomerResignedResult qwResult = JSON.parseObject(json, QwTransferCustomerResignedResult.class);
|
|
|
return qwResult;
|
|
return qwResult;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public QwGetTransferResult getResignedTransfer(QwGetTransferParam param,String corpId) {
|
|
public QwGetTransferResult getResignedTransfer(QwGetTransferParam param,String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.getResignedTransferUrl, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.getResignedTransferUrl, param,corpId,null);
|
|
|
QwGetTransferResult qwResult = JSON.parseObject(json, QwGetTransferResult.class);
|
|
QwGetTransferResult qwResult = JSON.parseObject(json, QwGetTransferResult.class);
|
|
|
return qwResult;
|
|
return qwResult;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public QwGroupChatTransferResult resignedGroupChatTransfer(QwGroupChatTransferParam param,String corpId) {
|
|
public QwGroupChatTransferResult resignedGroupChatTransfer(QwGroupChatTransferParam param,String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.resignedGroupChatTransferUrl, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.resignedGroupChatTransferUrl, param,corpId,null);
|
|
|
QwGroupChatTransferResult qwResult = JSON.parseObject(json, QwGroupChatTransferResult.class);
|
|
QwGroupChatTransferResult qwResult = JSON.parseObject(json, QwGroupChatTransferResult.class);
|
|
|
return qwResult;
|
|
return qwResult;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public QwResult editUserTag(QwEditUserTagParam param,String corpId) {
|
|
public QwResult editUserTag(QwEditUserTagParam param,String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.editUserTagUrl, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.editUserTagUrl, param,corpId,null);
|
|
|
QwResult qwResult = JSON.parseObject(json, QwResult.class);
|
|
QwResult qwResult = JSON.parseObject(json, QwResult.class);
|
|
|
return qwResult;
|
|
return qwResult;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public QwSendMsgResult sendMsg(QwSendMsgParam param, String corpId) {
|
|
public QwSendMsgResult sendMsg(QwSendMsgParam param, String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.sendMsg, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.sendMsg, param,corpId,null);
|
|
|
QwSendMsgResult qwResult = JSON.parseObject(json, QwSendMsgResult.class);
|
|
QwSendMsgResult qwResult = JSON.parseObject(json, QwSendMsgResult.class);
|
|
|
return qwResult;
|
|
return qwResult;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public QwLinkListResult linkList(QwParam param, String corpId) {
|
|
public QwLinkListResult linkList(QwParam param, String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.linkList, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.linkList, param,corpId,null);
|
|
|
QwLinkListResult qwResult = JSON.parseObject(json, QwLinkListResult.class);
|
|
QwLinkListResult qwResult = JSON.parseObject(json, QwLinkListResult.class);
|
|
|
return qwResult;
|
|
return qwResult;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public QwLinkGetResult linkGet(QwLinkGetParam param, String corpId) {
|
|
public QwLinkGetResult linkGet(QwLinkGetParam param, String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.linkGet, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.linkGet, param,corpId,null);
|
|
|
QwLinkGetResult qwResult = JSON.parseObject(json, QwLinkGetResult.class);
|
|
QwLinkGetResult qwResult = JSON.parseObject(json, QwLinkGetResult.class);
|
|
|
return qwResult;
|
|
return qwResult;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public QwLinkCreateResult linkCreate(QwLinkCreateParam param, String corpId) {
|
|
public QwLinkCreateResult linkCreate(QwLinkCreateParam param, String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.linkCreate, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.linkCreate, param,corpId,null);
|
|
|
QwLinkCreateResult qwResult = JSON.parseObject(json, QwLinkCreateResult.class);
|
|
QwLinkCreateResult qwResult = JSON.parseObject(json, QwLinkCreateResult.class);
|
|
|
if(qwResult.getErrcode() != 0) throw new BaseException("创建获客链接错误:" + qwResult.getErrmsg());
|
|
if(qwResult.getErrcode() != 0) throw new BaseException("创建获客链接错误:" + qwResult.getErrmsg());
|
|
|
return qwResult;
|
|
return qwResult;
|
|
@@ -1856,7 +1876,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public QwResult linkUpdate(QwLinkCreateParam param, String corpId) {
|
|
public QwResult linkUpdate(QwLinkCreateParam param, String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.linkUpdate, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.linkUpdate, param,corpId,null);
|
|
|
QwResult qwResult = JSON.parseObject(json, QwResult.class);
|
|
QwResult qwResult = JSON.parseObject(json, QwResult.class);
|
|
|
if(qwResult.getErrcode() != 0) throw new BaseException("修改获客链接错误:" + qwResult.getErrmsg());
|
|
if(qwResult.getErrcode() != 0) throw new BaseException("修改获客链接错误:" + qwResult.getErrmsg());
|
|
|
return qwResult;
|
|
return qwResult;
|
|
@@ -1864,7 +1884,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public QwResult linkDelete(QwLinkGetParam param, String corpId) {
|
|
public QwResult linkDelete(QwLinkGetParam param, String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.linkDelete, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.linkDelete, param,corpId,null);
|
|
|
QwResult qwResult = JSON.parseObject(json, QwResult.class);
|
|
QwResult qwResult = JSON.parseObject(json, QwResult.class);
|
|
|
if(qwResult.getErrcode() != 0) throw new BaseException("删除获客链接错误:" + qwResult.getErrmsg());
|
|
if(qwResult.getErrcode() != 0) throw new BaseException("删除获客链接错误:" + qwResult.getErrmsg());
|
|
|
return qwResult;
|
|
return qwResult;
|
|
@@ -1872,7 +1892,7 @@ public class QwApiServiceImpl implements QwApiService {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public QwLinkCustomerResult linkCustomer(QwLinkCustomerParam param, String corpId) {
|
|
public QwLinkCustomerResult linkCustomer(QwLinkCustomerParam param, String corpId) {
|
|
|
- String json = sendPost(QwApiConfig.linkCustomer, param,corpId);
|
|
|
|
|
|
|
+ String json = sendPost(QwApiConfig.linkCustomer, param,corpId,null);
|
|
|
QwLinkCustomerResult qwResult = JSON.parseObject(json, QwLinkCustomerResult.class);
|
|
QwLinkCustomerResult qwResult = JSON.parseObject(json, QwLinkCustomerResult.class);
|
|
|
if(qwResult.getErrcode() != 0) throw new BaseException("获客链接错误:" + qwResult.getErrmsg());
|
|
if(qwResult.getErrcode() != 0) throw new BaseException("获客链接错误:" + qwResult.getErrmsg());
|
|
|
return qwResult;
|
|
return qwResult;
|