|
|
@@ -3,16 +3,19 @@ package com.tzld.piaoquan.longarticle.service.remote.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.tzld.piaoquan.longarticle.model.dto.ArticleSortRequest;
|
|
|
import com.tzld.piaoquan.longarticle.model.dto.ArticleSortResponse;
|
|
|
import com.tzld.piaoquan.longarticle.service.remote.SortService;
|
|
|
import com.tzld.piaoquan.longarticle.utils.HttpClientUtil;
|
|
|
import com.tzld.piaoquan.longarticle.utils.HttpPoolClientUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.util.Objects;
|
|
|
+import java.util.concurrent.CompletableFuture;
|
|
|
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
@@ -39,6 +42,40 @@ public class SortServiceImpl implements SortService {
|
|
|
return response;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean deleteGzhWaiting(String planId, String publishAccountId) {
|
|
|
+ if (StringUtils.isBlank(planId) || StringUtils.isBlank(publishAccountId)) {
|
|
|
+ log.warn("deleteGzhWaiting param invalid, planId={} publishAccountId={}", planId, publishAccountId);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ String apiUrl = "http://101.37.174.139:80/deleteGzhWaiting?planId=" + planId
|
|
|
+ + "&publishAccountId=" + publishAccountId;
|
|
|
+ try {
|
|
|
+ String res = HTTP_POOL_CLIENT_UTIL_DEFAULT.get(apiUrl);
|
|
|
+ log.info("deleteGzhWaiting planId={} publishAccountId={} res={}", planId, publishAccountId, res);
|
|
|
+ if (StringUtils.isBlank(res)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ JSONObject jsonObject = JSON.parseObject(res);
|
|
|
+ return jsonObject != null && Objects.equals(jsonObject.getInteger("code"), 0);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("deleteGzhWaiting error planId={} publishAccountId={} errorMsg:{}",
|
|
|
+ planId, publishAccountId, e.getMessage());
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void asyncRecommend(ArticleSortRequest request) {
|
|
|
+ CompletableFuture.runAsync(() -> {
|
|
|
+ try {
|
|
|
+ publishArticleSort(request);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("asyncRecommend error request={} errorMsg:{}", request, e.getMessage());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void addBatchGroupGZH(String ghId, String appId) {
|
|
|
String apiUrl = "http://101.37.174.139:80/user/addGZH";
|