|
@@ -1,10 +1,13 @@
|
|
|
package com.tzld.longarticle.recommend.server;
|
|
|
|
|
|
+import cn.hutool.core.io.resource.ResourceUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.tencentcloudapi.tms.v20201229.models.TextModerationResponse;
|
|
|
import com.tzld.longarticle.recommend.server.model.Content;
|
|
|
import com.tzld.longarticle.recommend.server.remote.AIGCRemoteService;
|
|
|
import com.tzld.longarticle.recommend.server.remote.ArticleSensitiveRemoteService;
|
|
|
+import com.tzld.longarticle.recommend.server.repository.crawler.AccountAvgInfoRepository;
|
|
|
+import com.tzld.longarticle.recommend.server.repository.entity.crawler.AccountAvgInfo;
|
|
|
import com.tzld.longarticle.recommend.server.service.filter.FilterParam;
|
|
|
import com.tzld.longarticle.recommend.server.service.filter.FilterResult;
|
|
|
import com.tzld.longarticle.recommend.server.service.filter.FilterStrategy;
|
|
@@ -20,6 +23,7 @@ import java.io.File;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.nio.file.Files;
|
|
|
import java.util.List;
|
|
|
+import java.util.Set;
|
|
|
|
|
|
@SpringBootTest(classes = Application.class)
|
|
|
@Slf4j
|
|
@@ -33,6 +37,8 @@ public class FilterStrategyTest {
|
|
|
AIGCRemoteService aigcRemoteService;
|
|
|
@Resource
|
|
|
ArticleSensitiveRemoteService articleSensitiveRemoteService;
|
|
|
+ @Resource
|
|
|
+ private AccountAvgInfoRepository accountAvgInfoRepository;
|
|
|
// @Test
|
|
|
// public void badStrategyTest() {
|
|
|
// FilterParam param = new FilterParam();
|
|
@@ -92,4 +98,15 @@ public class FilterStrategyTest {
|
|
|
log.error("No JSON files found in the folder.");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Test
|
|
|
+ void AccountAvgInfoTest() {
|
|
|
+ String cardJSON = ResourceUtil.readUtf8Str("file/AccountInfo.json");
|
|
|
+ JSONObject accountInfo = JSONObject.parseObject(cardJSON);
|
|
|
+ Set<String> keys = accountInfo.keySet();
|
|
|
+ for (String key : keys) {
|
|
|
+ AccountAvgInfo info = accountInfo.getObject(key, AccountAvgInfo.class);
|
|
|
+ accountAvgInfoRepository.save(info);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|