|
@@ -11,12 +11,15 @@ import com.tzld.longarticle.recommend.server.mapper.aigc.PublishContentMapper;
|
|
|
import com.tzld.longarticle.recommend.server.mapper.crawler.CrawlerBaseMapper;
|
|
import com.tzld.longarticle.recommend.server.mapper.crawler.CrawlerBaseMapper;
|
|
|
import com.tzld.longarticle.recommend.server.model.dto.PublishContentDTO;
|
|
import com.tzld.longarticle.recommend.server.model.dto.PublishContentDTO;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.aigc.PublishAccount;
|
|
import com.tzld.longarticle.recommend.server.model.entity.aigc.PublishAccount;
|
|
|
|
|
+import com.tzld.longarticle.recommend.server.model.entity.aigc.PublishPlan;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.crawler.AccountAvgInfo;
|
|
import com.tzld.longarticle.recommend.server.model.entity.crawler.AccountAvgInfo;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
|
|
import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.crawler.ArticleDetailInfo;
|
|
import com.tzld.longarticle.recommend.server.model.entity.crawler.ArticleDetailInfo;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.crawler.PublishSortLog;
|
|
import com.tzld.longarticle.recommend.server.model.entity.crawler.PublishSortLog;
|
|
|
import com.tzld.longarticle.recommend.server.model.param.PublishContentParam;
|
|
import com.tzld.longarticle.recommend.server.model.param.PublishContentParam;
|
|
|
|
|
+import com.tzld.longarticle.recommend.server.model.param.RecommendRequest;
|
|
|
import com.tzld.longarticle.recommend.server.repository.aigc.PublishAccountRepository;
|
|
import com.tzld.longarticle.recommend.server.repository.aigc.PublishAccountRepository;
|
|
|
|
|
+import com.tzld.longarticle.recommend.server.repository.aigc.PublishPlanRepository;
|
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.AccountAvgInfoRepository;
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.AccountAvgInfoRepository;
|
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.ArticleDetailInfoRepository;
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.ArticleDetailInfoRepository;
|
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository;
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository;
|
|
@@ -25,6 +28,7 @@ import com.tzld.longarticle.recommend.server.service.recommend.RecommendService;
|
|
|
import com.tzld.longarticle.recommend.server.service.recommend.recall.RecallService;
|
|
import com.tzld.longarticle.recommend.server.service.recommend.recall.RecallService;
|
|
|
import com.tzld.longarticle.recommend.server.util.DateUtils;
|
|
import com.tzld.longarticle.recommend.server.util.DateUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import okhttp3.*;
|
|
|
import org.apache.commons.math3.stat.correlation.PearsonsCorrelation;
|
|
import org.apache.commons.math3.stat.correlation.PearsonsCorrelation;
|
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
@@ -43,6 +47,7 @@ import java.io.IOException;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.nio.file.Files;
|
|
import java.nio.file.Files;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@SpringBootTest(classes = Application.class)
|
|
@SpringBootTest(classes = Application.class)
|
|
@@ -69,6 +74,8 @@ public class RecommendTest {
|
|
|
private AigcBaseMapper aigcBaseMapper;
|
|
private AigcBaseMapper aigcBaseMapper;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private PublishContentMapper publishContentMapper;
|
|
private PublishContentMapper publishContentMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private PublishPlanRepository publishPlanRepository;
|
|
|
|
|
|
|
|
@ApolloJsonValue("${accountStrategyConfig:{}}")
|
|
@ApolloJsonValue("${accountStrategyConfig:{}}")
|
|
|
private Map<String, String> accountStrategyConfigMap;
|
|
private Map<String, String> accountStrategyConfigMap;
|
|
@@ -877,4 +884,44 @@ public class RecommendTest {
|
|
|
}
|
|
}
|
|
|
System.out.println(JSONObject.toJSONString(accountStrategyConfigMap));
|
|
System.out.println(JSONObject.toJSONString(accountStrategyConfigMap));
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ public void deepTest() {
|
|
|
|
|
+ List<PublishPlan> publishPlanList = publishPlanRepository.getByPlanStatusAndChannel(1, 5);
|
|
|
|
|
+ for (PublishPlan publishPlan : publishPlanList) {
|
|
|
|
|
+ List<PublishAccount> accountList = aigcBaseMapper.getPublishAccountByPlanId(publishPlan.getId());
|
|
|
|
|
+ for (PublishAccount publishAccount : accountList) {
|
|
|
|
|
+ RecommendRequest param = new RecommendRequest();
|
|
|
|
|
+ param.setAccountId(publishAccount.getId());
|
|
|
|
|
+ param.setAccountName(publishAccount.getName());
|
|
|
|
|
+ param.setGhId(publishAccount.getGhId());
|
|
|
|
|
+ param.setPlanId(publishPlan.getId());
|
|
|
|
|
+ param.setPushType(1);
|
|
|
|
|
+ param.setPublishNum(4);
|
|
|
|
|
+ param.setStrategy("ArticleRankV5");
|
|
|
|
|
+ param.setParamStrategy(true);
|
|
|
|
|
+ param.setExcludeLog(true);
|
|
|
|
|
+ long start = System.currentTimeMillis();
|
|
|
|
|
+ try {
|
|
|
|
|
+ OkHttpClient client = new OkHttpClient().newBuilder()
|
|
|
|
|
+ .connectTimeout(15, TimeUnit.MINUTES)
|
|
|
|
|
+ .readTimeout(15, TimeUnit.MINUTES)
|
|
|
|
|
+ .writeTimeout(15, TimeUnit.MINUTES)
|
|
|
|
|
+ .build();
|
|
|
|
|
+ MediaType mediaType = MediaType.parse("application/json;charset=UTF-8");
|
|
|
|
|
+ RequestBody body = RequestBody.create(mediaType, JSONObject.toJSONString(param));
|
|
|
|
|
+ Request request = new Request.Builder()
|
|
|
|
|
+ .url("http://121.199.79.174:80/recommend")
|
|
|
|
|
+ .method("POST", body)
|
|
|
|
|
+ .addHeader("Content-Type", "application/json;charset=UTF-8")
|
|
|
|
|
+ .build();
|
|
|
|
|
+ Response response = client.newCall(request).execute();
|
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
|
+ log.error("deepTest error", e);
|
|
|
|
|
+ }
|
|
|
|
|
+ log.info("deepTest finish planId:{} accountName:{} cost:{}", publishPlan.getId(),
|
|
|
|
|
+ publishAccount.getName(), System.currentTimeMillis() - start);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|