|
@@ -26,6 +26,11 @@ import org.springframework.beans.factory.InitializingBean;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
|
|
+import java.nio.file.Files;
|
|
|
|
|
+import java.nio.file.Path;
|
|
|
|
|
+import java.nio.file.Paths;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
@@ -114,7 +119,7 @@ public class RankService implements InitializingBean {
|
|
|
if (CollectionUtil.isEmpty(contentList)) {
|
|
if (CollectionUtil.isEmpty(contentList)) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- contentList = contentList.subList(0, Math.min(contentList.size(), 200));
|
|
|
|
|
|
|
+ contentList = contentList.subList(0, Math.min(contentList.size(), 500));
|
|
|
for (Content content : contentList) {
|
|
for (Content content : contentList) {
|
|
|
JSONObject obj = new JSONObject();
|
|
JSONObject obj = new JSONObject();
|
|
|
obj.put("id", content.getId());
|
|
obj.put("id", content.getId());
|
|
@@ -123,7 +128,32 @@ public class RankService implements InitializingBean {
|
|
|
obj.put("scoreMap", content.getScoreMap());
|
|
obj.put("scoreMap", content.getScoreMap());
|
|
|
jsonArray.add(obj);
|
|
jsonArray.add(obj);
|
|
|
}
|
|
}
|
|
|
- log.info("{} 账号名称 {} {}评分结果 {}", strategy, accountName, position, JSONObject.toJSONString(jsonArray));
|
|
|
|
|
|
|
+// log.info("{} 账号名称 {} {}评分结果 {}", strategy, accountName, position, JSONObject.toJSONString(jsonArray));
|
|
|
|
|
+// String result = String.format(
|
|
|
|
|
+// "%s 账号名称 %s %s 评分结果 %s%n",
|
|
|
|
|
+// strategy,
|
|
|
|
|
+// accountName,
|
|
|
|
|
+// position,
|
|
|
|
|
+// JSONObject.toJSONString(jsonArray)
|
|
|
|
|
+// );
|
|
|
|
|
+ System.out.println(strategy);
|
|
|
|
|
+ if ("头条".equals(position)){
|
|
|
|
|
+ writeToFile(jsonArray);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private static void writeToFile(JSONArray jsonArray) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 文件路径可按需调整
|
|
|
|
|
+ Path path = Paths.get("Rank_V19_2.json");
|
|
|
|
|
+
|
|
|
|
|
+ Files.write(
|
|
|
|
|
+ path,
|
|
|
|
|
+ JSONObject.toJSONString(jsonArray, true).getBytes(StandardCharsets.UTF_8)
|
|
|
|
|
+ );
|
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public static void commonAddSecondContent(RankParam param, List<Content> result,
|
|
public static void commonAddSecondContent(RankParam param, List<Content> result,
|