|
@@ -15,6 +15,10 @@ import com.cyksj.config.corp.YHLXWxCorpConfig;
|
|
|
import com.cyksj.dto.CorpOauth2UserInfo;
|
|
import com.cyksj.dto.CorpOauth2UserInfo;
|
|
|
import com.cyksj.dto.RedisKey;
|
|
import com.cyksj.dto.RedisKey;
|
|
|
import com.cyksj.model.entity.WxCorpApp;
|
|
import com.cyksj.model.entity.WxCorpApp;
|
|
|
|
|
+import com.cyksj.model.kf.WxCpKfAccountAdd;
|
|
|
|
|
+import com.cyksj.model.kf.WxCpKfAccountAddResp;
|
|
|
|
|
+import com.cyksj.model.kf.WxCpKfAccountDel;
|
|
|
|
|
+import com.cyksj.model.kf.WxCpKfAccountUpd;
|
|
|
import com.cyksj.model.request.corp.CorpFollowContact;
|
|
import com.cyksj.model.request.corp.CorpFollowContact;
|
|
|
import com.cyksj.model.request.corp.CorpGroupConfig;
|
|
import com.cyksj.model.request.corp.CorpGroupConfig;
|
|
|
import com.cyksj.model.request.corp.CorpMsgTemplate;
|
|
import com.cyksj.model.request.corp.CorpMsgTemplate;
|
|
@@ -826,4 +830,65 @@ public class WxCorpOpsImpl implements WxCorpOps {
|
|
|
}
|
|
}
|
|
|
return JSONUtil.parseObj(res.body()).getJSONArray("ids").toList(String.class);
|
|
return JSONUtil.parseObj(res.body()).getJSONArray("ids").toList(String.class);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public WxCpKfAccountAddResp addAccount(String corpId, WxCpKfAccountAdd add) throws Exception {
|
|
|
|
|
+ String url = "https://qyapi.weixin.qq.com/cgi-bin/kf/account/add?access_token=" + getKfAccessToken(corpId);
|
|
|
|
|
+ HttpResponse<String> res =
|
|
|
|
|
+ J11HttpC.custom()
|
|
|
|
|
+ .ofPost()
|
|
|
|
|
+ .url(url)
|
|
|
|
|
+ .headers(J11HttpC.ReqType.raw_json)
|
|
|
|
|
+ .body(HttpRequest.BodyPublishers.ofString(Jsons.toJson(add), IoKit.Charsets.UTF_8.getCharset()))
|
|
|
|
|
+ .send(HttpResponse.BodyHandlers.ofString());
|
|
|
|
|
+ if (200 != res.statusCode()) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("添加客服帐号: " + res.body());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ WxCpKfAccountAddResp resp = Jsons.parseObject(res.body(), WxCpKfAccountAddResp.class);
|
|
|
|
|
+ if (resp.getErrcode() != 0) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("添加客服帐号: " + resp.getErrmsg());
|
|
|
|
|
+ }
|
|
|
|
|
+ return resp;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void delAccount(String corpId, WxCpKfAccountDel del) throws Exception {
|
|
|
|
|
+ String url = "https://qyapi.weixin.qq.com/cgi-bin/kf/account/del?access_token=" + getKfAccessToken(corpId);
|
|
|
|
|
+ HttpResponse<String> res =
|
|
|
|
|
+ J11HttpC.custom()
|
|
|
|
|
+ .ofPost()
|
|
|
|
|
+ .url(url)
|
|
|
|
|
+ .headers(J11HttpC.ReqType.raw_json)
|
|
|
|
|
+ .body(HttpRequest.BodyPublishers.ofString(Jsons.toJson(del), IoKit.Charsets.UTF_8.getCharset()))
|
|
|
|
|
+ .send(HttpResponse.BodyHandlers.ofString());
|
|
|
|
|
+ if (200 != res.statusCode()) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("删除客服帐号: " + res.body());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ JSONObject jsonObject = new JSONObject(res.body());
|
|
|
|
|
+ if (jsonObject.getInt("errcode") != 0) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("删除客服账号出错: " + jsonObject.getStr("errmsg"));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void updAccount(String corpId, WxCpKfAccountUpd upd) throws Exception {
|
|
|
|
|
+ String url = "https://qyapi.weixin.qq.com/cgi-bin/kf/account/update?access_token=" + getKfAccessToken(corpId);
|
|
|
|
|
+ HttpResponse<String> res =
|
|
|
|
|
+ J11HttpC.custom()
|
|
|
|
|
+ .ofPost()
|
|
|
|
|
+ .url(url)
|
|
|
|
|
+ .headers(J11HttpC.ReqType.raw_json)
|
|
|
|
|
+ .body(HttpRequest.BodyPublishers.ofString(Jsons.toJson(upd), IoKit.Charsets.UTF_8.getCharset()))
|
|
|
|
|
+ .send(HttpResponse.BodyHandlers.ofString());
|
|
|
|
|
+ if (200 != res.statusCode()) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("修改客服帐号: " + res.body());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ JSONObject jsonObject = new JSONObject(res.body());
|
|
|
|
|
+ if (jsonObject.getInt("errcode") != 0) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("修改客服账号出错: " + jsonObject.getStr("errmsg"));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|