zyx 2 年之前
父节点
当前提交
063f8fd2ad
共有 2 个文件被更改,包括 4 次插入7 次删除
  1. 1 2
      build.gradle
  2. 3 5
      src/main/java/com/sxtvs/open/api/youmei/service/YoumeiAccountServiceImpl.java

+ 1 - 2
build.gradle

@@ -36,10 +36,9 @@ dependencies {
     implementation 'com.baomidou:mybatis-plus-boot-starter:3.5.3.1'
     implementation 'com.baomidou:dynamic-datasource-spring-boot-starter:3.6.1'
     testImplementation 'com.baomidou:mybatis-plus-generator:3.5.3'
-    implementation 'org.freemarker:freemarker:2.3.31'
+    testImplementation 'org.freemarker:freemarker:2.3.31'
 
     implementation 'org.apache.httpcomponents.client5:httpclient5:5.2.1'
-    implementation 'org.apache.httpcomponents.client5:httpclient5-fluent:5.2.1'
 
     implementation 'mysql:mysql-connector-java:8.0.28'
 

+ 3 - 5
src/main/java/com/sxtvs/open/api/youmei/service/YoumeiAccountServiceImpl.java

@@ -12,7 +12,7 @@ import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.hc.client5.http.classic.methods.HttpPost;
 import org.apache.hc.client5.http.entity.UrlEncodedFormEntity;
-import org.apache.hc.client5.http.fluent.ContentResponseHandler;
+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.HttpClients;
 import org.apache.hc.core5.http.NameValuePair;
@@ -20,7 +20,6 @@ import org.apache.hc.core5.http.message.BasicNameValuePair;
 import org.apache.http.Consts;
 import org.springframework.stereotype.Service;
 
-import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -108,9 +107,8 @@ public class YoumeiAccountServiceImpl extends ServiceImpl<YoumeiAccountMapper, Y
         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 ContentResponseHandler());
-
-        CheckWordResponse checkWordDto = objectMapper.readValue(body.asString(StandardCharsets.UTF_8), CheckWordResponse.class);
+        var body = client.execute(httpPost,new BasicHttpClientResponseHandler());
+        CheckWordResponse checkWordDto = objectMapper.readValue(body, CheckWordResponse.class);
         CheckWordResponse.DataDTO data = checkWordDto.getData();
 
         if (data.getChecklist().size() == 0) {