|
@@ -12,6 +12,8 @@ import lombok.SneakyThrows;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.hc.client5.http.classic.methods.HttpPost;
|
|
import org.apache.hc.client5.http.classic.methods.HttpPost;
|
|
import org.apache.hc.client5.http.entity.UrlEncodedFormEntity;
|
|
import org.apache.hc.client5.http.entity.UrlEncodedFormEntity;
|
|
|
|
+import org.apache.hc.client5.http.fluent.Request;
|
|
|
|
+import org.apache.hc.client5.http.fluent.Response;
|
|
import org.apache.hc.client5.http.impl.classic.BasicHttpClientResponseHandler;
|
|
import org.apache.hc.client5.http.impl.classic.BasicHttpClientResponseHandler;
|
|
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
|
|
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
|
|
import org.apache.hc.client5.http.impl.classic.HttpClients;
|
|
import org.apache.hc.client5.http.impl.classic.HttpClients;
|
|
@@ -83,7 +85,6 @@ public class YoumeiAccountServiceImpl extends ServiceImpl<YoumeiAccountMapper, Y
|
|
.build();
|
|
.build();
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
public String getWbjcTokenCache() {
|
|
public String getWbjcTokenCache() {
|
|
return tokenCache.get("sxgdwbjc", this::getWbjcToken);
|
|
return tokenCache.get("sxgdwbjc", this::getWbjcToken);
|
|
}
|
|
}
|
|
@@ -98,16 +99,11 @@ public class YoumeiAccountServiceImpl extends ServiceImpl<YoumeiAccountMapper, Y
|
|
|
|
|
|
@SneakyThrows
|
|
@SneakyThrows
|
|
public Object wordCheck(String text) {
|
|
public Object wordCheck(String text) {
|
|
- List<NameValuePair> formparams = new ArrayList<>();
|
|
|
|
- formparams.add(new BasicNameValuePair("accessToken", getWbjcTokenCache()));
|
|
|
|
- formparams.add(new BasicNameValuePair("text", text));
|
|
|
|
- @Cleanup
|
|
|
|
- UrlEncodedFormEntity params = new UrlEncodedFormEntity(formparams, Consts.UTF_8);
|
|
|
|
-
|
|
|
|
- var httpPost = new HttpPost("https://api-open-wx-www.yqt365.com/dataapp/api/umei/fw/open/wbjc/article_correct_external");
|
|
|
|
- httpPost.setEntity(params);
|
|
|
|
|
|
|
|
- var body = client.execute(httpPost,new BasicHttpClientResponseHandler());
|
|
|
|
|
|
+ var response = Request.post("https://api-open-wx-www.yqt365.com/dataapp/api/umei/fw/open/wbjc/article_correct_external")
|
|
|
|
+ .bodyForm(new BasicNameValuePair("accessToken", getWbjcTokenCache()),
|
|
|
|
+ new BasicNameValuePair("text", text)).execute();
|
|
|
|
+ var body = response.returnContent().asString();
|
|
CheckWordResponse checkWordDto = objectMapper.readValue(body, CheckWordResponse.class);
|
|
CheckWordResponse checkWordDto = objectMapper.readValue(body, CheckWordResponse.class);
|
|
CheckWordResponse.DataDTO data = checkWordDto.getData();
|
|
CheckWordResponse.DataDTO data = checkWordDto.getData();
|
|
|
|
|