mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-05-06 21:57:48 +08:00
🆕 #2592 【企业微信】增加外部联系人聊天敏感词的的新增、修改、删除的接口方法
This commit is contained in:
parent
ccd452c2a5
commit
0256461044
@ -960,5 +960,33 @@ public interface WxCpExternalContactService {
|
|||||||
WxMediaUploadResult uploadAttachment(String mediaType, Integer attachmentType, File file)
|
WxMediaUploadResult uploadAttachment(String mediaType, Integer attachmentType, File file)
|
||||||
throws WxErrorException;
|
throws WxErrorException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* 新建敏感词规则
|
||||||
|
* 企业和第三方应用可以通过此接口新建敏感词规则
|
||||||
|
* 请求方式:POST(HTTPS)
|
||||||
|
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/add_intercept_rule?access_token=ACCESS_TOKEN
|
||||||
|
* <pre>
|
||||||
|
*/
|
||||||
|
WxCpInterceptRuleResultResp addInterceptRule(WxCpInterceptRuleResp ruleResp) throws WxErrorException;
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* 修改敏感词规则
|
||||||
|
* 企业和第三方应用可以通过此接口修改敏感词规则
|
||||||
|
* 请求方式:POST(HTTPS)
|
||||||
|
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/update_intercept_rule?access_token=ACCESS_TOKEN
|
||||||
|
* <pre>
|
||||||
|
*/
|
||||||
|
WxCpInterceptRuleResultResp updateInterceptRule(WxCpInterceptRuleResp ruleResp) throws WxErrorException;
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* 删除敏感词规则
|
||||||
|
* 企业和第三方应用可以通过此接口修改敏感词规则
|
||||||
|
* 请求方式:POST(HTTPS)
|
||||||
|
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/del_intercept_rule?access_token=ACCESS_TOKEN
|
||||||
|
* <pre>
|
||||||
|
* @param rule_id 规则id
|
||||||
|
*/
|
||||||
|
WxCpBaseResp delInterceptRule(String rule_id) throws WxErrorException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,12 @@ package me.chanjar.weixin.cp.api.impl;
|
|||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
|
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
|
||||||
@ -839,4 +841,26 @@ public class WxCpExternalContactServiceImpl implements WxCpExternalContactServic
|
|||||||
return this.mainService.execute(MediaUploadRequestExecutor.create(
|
return this.mainService.execute(MediaUploadRequestExecutor.create(
|
||||||
this.mainService.getRequestHttp()), url, file);
|
this.mainService.getRequestHttp()), url, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WxCpInterceptRuleResultResp addInterceptRule(WxCpInterceptRuleResp ruleResp) throws WxErrorException {
|
||||||
|
return WxCpInterceptRuleResultResp
|
||||||
|
.fromJson(this.mainService.post(this.mainService.getWxCpConfigStorage().getApiUrl(ADD_INTERCEPT_RULE), ruleResp.toJson()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WxCpInterceptRuleResultResp updateInterceptRule(WxCpInterceptRuleResp ruleResp) throws WxErrorException {
|
||||||
|
return WxCpInterceptRuleResultResp
|
||||||
|
.fromJson(this.mainService.post(this.mainService.getWxCpConfigStorage().getApiUrl(UPDATE_INTERCEPT_RULE), ruleResp.toJson()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WxCpBaseResp delInterceptRule(String rule_id) throws WxErrorException {
|
||||||
|
JsonObject jsonObject = new JsonObject();
|
||||||
|
jsonObject.addProperty("rule_id",rule_id);
|
||||||
|
return WxCpBaseResp
|
||||||
|
.fromJson(this.mainService.post(this.mainService.getWxCpConfigStorage().getApiUrl(DEL_INTERCEPT_RULE), jsonObject));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
61
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpInterceptRuleResp.java
vendored
Normal file
61
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpInterceptRuleResp.java
vendored
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
package me.chanjar.weixin.cp.bean.external;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增敏感词规则请求参数封装实体类
|
||||||
|
*
|
||||||
|
* @author didi
|
||||||
|
* @date 2022-04-17
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class WxCpInterceptRuleResp {
|
||||||
|
|
||||||
|
@SerializedName("rule_name")
|
||||||
|
private String ruleName;
|
||||||
|
@SerializedName("rule_id")
|
||||||
|
private String ruleId;
|
||||||
|
@SerializedName("word_list")
|
||||||
|
private List<String> wordList;
|
||||||
|
@SerializedName("semantics_list")
|
||||||
|
private List<Integer> semanticsList;
|
||||||
|
@SerializedName("intercept_type")
|
||||||
|
private int interceptType;
|
||||||
|
@SerializedName("applicable_range")
|
||||||
|
private ApplicableRange applicableRange;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class ApplicableRange {
|
||||||
|
@SerializedName("user_list")
|
||||||
|
private List<String> userList;
|
||||||
|
@SerializedName("department_list")
|
||||||
|
private List<Integer> departmentList;
|
||||||
|
public static ApplicableRange fromJson(String json) {
|
||||||
|
return WxCpGsonBuilder.create().fromJson(json, ApplicableRange.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toJson() {
|
||||||
|
return WxCpGsonBuilder.create().toJson(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static WxCpInterceptRuleResp fromJson(String json) {
|
||||||
|
return WxCpGsonBuilder.create().fromJson(json, WxCpInterceptRuleResp.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toJson() {
|
||||||
|
return WxCpGsonBuilder.create().toJson(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
30
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpInterceptRuleResultResp.java
vendored
Normal file
30
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpInterceptRuleResultResp.java
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package me.chanjar.weixin.cp.bean.external;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
|
||||||
|
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新建敏感词规则负返回结果
|
||||||
|
* @author didi
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class WxCpInterceptRuleResultResp extends WxCpBaseResp implements Serializable {
|
||||||
|
|
||||||
|
@SerializedName("rule_id")
|
||||||
|
private String ruleId;
|
||||||
|
|
||||||
|
public static WxCpInterceptRuleResultResp fromJson(String json) {
|
||||||
|
return WxCpGsonBuilder.create().fromJson(json, WxCpInterceptRuleResultResp.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toJson() {
|
||||||
|
return WxCpGsonBuilder.create().toJson(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -42,6 +42,9 @@ public class ContentValue implements Serializable {
|
|||||||
|
|
||||||
private Vacation vacation;
|
private Vacation vacation;
|
||||||
|
|
||||||
|
@SerializedName("date_range")
|
||||||
|
private Attendance.DataRange dateRange;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class Date implements Serializable {
|
public static class Date implements Serializable {
|
||||||
private static final long serialVersionUID = -6181554080062231138L;
|
private static final long serialVersionUID = -6181554080062231138L;
|
||||||
|
@ -281,6 +281,11 @@ public interface WxCpApiPathConsts {
|
|||||||
|
|
||||||
String UPLOAD_ATTACHMENT = "/cgi-bin/media/upload_attachment";
|
String UPLOAD_ATTACHMENT = "/cgi-bin/media/upload_attachment";
|
||||||
|
|
||||||
|
|
||||||
|
String ADD_INTERCEPT_RULE = "/cgi-bin/externalcontact/add_intercept_rule";
|
||||||
|
String UPDATE_INTERCEPT_RULE = "/cgi-bin/externalcontact/update_intercept_rule";
|
||||||
|
String DEL_INTERCEPT_RULE = "/cgi-bin/externalcontact/del_intercept_rule";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Kf {
|
interface Kf {
|
||||||
|
Loading…
Reference in New Issue
Block a user