添加空文件判断

This commit is contained in:
梁琦涛
2023-12-12 19:39:25 +08:00
parent 2cf9a38f70
commit 9fc5da5209
3 changed files with 26 additions and 19 deletions
@@ -56,6 +56,7 @@ public class HomeSearchCheckEsPlanJob implements Job {
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
log.info("============ es同步任务开始==============");
// 获取外部传来的参数
JobDataMap map = context.getJobDetail().getJobDataMap();
String resourceType = map.getString("parameter");
@@ -92,6 +93,7 @@ public class HomeSearchCheckEsPlanJob implements Job {
default:break;
}
});
log.info("============ es同步任务结束==============");
}
private void checkLawsNewsFeed(String resourceType, Map<String, Integer> mapHash) {
@@ -102,8 +104,6 @@ public class HomeSearchCheckEsPlanJob implements Job {
m4 = listLawsNewsFeed.size();
}
if(count4 != m4 || !StringUtils.isBlank(resourceType)){
// 清理数据重新更新
delete(resourceType);
if(!CollectionUtils.isEmpty(listLawsNewsFeed)){
List<String> listIds = listLawsNewsFeed.stream().map(LawsNewsFeed::getId).collect(Collectors.toList());
addES(listIds, LawsHomeSearchCommon.LAWS_NEWS_FEED);
@@ -119,8 +119,6 @@ public class HomeSearchCheckEsPlanJob implements Job {
m3 = listLawsEnterpriseStandard.size();
}
if(count3 != m3 || !StringUtils.isBlank(resourceType)){
// 清理数据重新更新
delete(resourceType);
if(!CollectionUtils.isEmpty(listLawsEnterpriseStandard)){
List<String> listIds = listLawsEnterpriseStandard.stream().map(LawsEnterpriseStandard::getId).collect(Collectors.toList());
addES(listIds, LawsHomeSearchCommon.LAWS_ENTERPRISE_STANDARD);
@@ -136,8 +134,6 @@ public class HomeSearchCheckEsPlanJob implements Job {
m2 = listLawsOverseasStandard.size();
}
if(count2 != m2 || !StringUtils.isBlank(resourceType)){
// 清理数据重新更新
delete(resourceType);
if(!CollectionUtils.isEmpty(listLawsOverseasStandard)){
List<String> listIds = listLawsOverseasStandard.stream().map(LawsOverseasStandard::getId).collect(Collectors.toList());
addES(listIds, LawsHomeSearchCommon.LAWS_OVERSEAS_STANDARD);
@@ -154,8 +150,6 @@ public class HomeSearchCheckEsPlanJob implements Job {
m1 = listLawsDomesticStandard.size();
}
if(count1 != m1 || !StringUtils.isBlank(resourceType)){
// 清理数据重新更新
delete(resourceType);
if(!CollectionUtils.isEmpty(listLawsDomesticStandard)){
List<String> listIds = listLawsDomesticStandard.stream().map(LawsDomesticStandard::getId).collect(Collectors.toList());
addES(listIds, LawsHomeSearchCommon.LAWS_DOMESTIC_STANDARD);
@@ -1044,7 +1044,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
// 批量操作
// 从第0个下标开始
int startIndex = 0;
int batchCount = 2000;
int batchCount = 500;
List<String> listIds = Arrays.asList(ids.split(","));
ForkJoinPool pool = new ForkJoinPool();
if(CollectionUtils.isEmpty(listIds)) {
@@ -1368,6 +1368,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
public void updateElasticsearch(LawsHomeNormalSearchVO obj,List<OSSFile> listFile){
String idTemp = obj.getId();
System.out.println("--------------" + obj);
StringBuilder fileTextAll = getStringBuilder(listFile);
addES(obj, idTemp, fileTextAll);
}