|
@@ -243,13 +243,7 @@ public class GetProvinceNewsService {
|
|
|
*/
|
|
|
public void commonProvinceAddArticle(List<String> reStrs, String baseUrl, String sourceName, Integer sourceId, Integer type) {
|
|
|
List<GetArticleInfoDTO> articleInfoDTOS = new ArrayList<>();
|
|
|
- int count = 0;
|
|
|
for (String reStr : reStrs) {
|
|
|
- // 限制处理的新闻项数量,避免处理过多数据
|
|
|
- if (count > 20) {
|
|
|
- log.info("已达到处理上限(20条),停止处理更多新闻项");
|
|
|
- break;
|
|
|
- }
|
|
|
Document document = Jsoup.parse(reStr);
|
|
|
Element linkElement = document.getElementsByTag("a").first();
|
|
|
if (baseUrl.contains("scjg.jl.gov.cn")) {
|
|
@@ -265,9 +259,9 @@ public class GetProvinceNewsService {
|
|
|
dateStr = getHainanDate(dateStr);
|
|
|
}
|
|
|
String yesterdayDateStr = DateUtil.getYesterdayDateStr();
|
|
|
-// if (!StringUtils.equals(dateStr, yesterdayDateStr)) {
|
|
|
-// break;
|
|
|
-// }
|
|
|
+ if (!StringUtils.equals(dateStr, yesterdayDateStr)) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
Date date = new Date();
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
try {
|
|
@@ -338,7 +332,6 @@ public class GetProvinceNewsService {
|
|
|
articleInfoDTO.setPublicTime(date);
|
|
|
articleInfoDTO.setDigest(condensedAbstract);
|
|
|
articleInfoDTOS.add(articleInfoDTO);
|
|
|
- count++;
|
|
|
}
|
|
|
articleInfoService.batchAddArticleInfo(articleInfoDTOS);
|
|
|
}
|