解决线程无限执行问题
This commit is contained in:
+9
-3
@@ -103,7 +103,9 @@ public class HomeSearchCheckEsPlanJob implements Job {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkLawsEnterpriseStandard(String resourceType, Map<String, Integer> mapHash) {
|
private void checkLawsEnterpriseStandard(String resourceType, Map<String, Integer> mapHash) {
|
||||||
List<LawsEnterpriseStandard> listLawsEnterpriseStandard = lawsEnterpriseStandardService.list();
|
LambdaQueryWrapper<LawsEnterpriseStandard> query = new LambdaQueryWrapper<>();
|
||||||
|
query.ne(LawsEnterpriseStandard::getStandardState,"9");
|
||||||
|
List<LawsEnterpriseStandard> listLawsEnterpriseStandard = lawsEnterpriseStandardService.list(query);
|
||||||
int count3 = mapHash.getOrDefault(LawsHomeSearchCommon.LAWS_ENTERPRISE_STANDARD, 0);
|
int count3 = mapHash.getOrDefault(LawsHomeSearchCommon.LAWS_ENTERPRISE_STANDARD, 0);
|
||||||
int m3 = 0;
|
int m3 = 0;
|
||||||
if(!CollectionUtils.isEmpty(listLawsEnterpriseStandard)){
|
if(!CollectionUtils.isEmpty(listLawsEnterpriseStandard)){
|
||||||
@@ -119,7 +121,9 @@ public class HomeSearchCheckEsPlanJob implements Job {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkLawsOverseasStandard(String resourceType, Map<String, Integer> mapHash) {
|
private void checkLawsOverseasStandard(String resourceType, Map<String, Integer> mapHash) {
|
||||||
List<LawsOverseasStandard> listLawsOverseasStandard = lawsOverseasStandardService.list();
|
LambdaQueryWrapper<LawsOverseasStandard> query = new LambdaQueryWrapper<>();
|
||||||
|
query.ne(LawsOverseasStandard::getStandardState,"7");
|
||||||
|
List<LawsOverseasStandard> listLawsOverseasStandard = lawsOverseasStandardService.list(query);
|
||||||
int count2 = mapHash.getOrDefault(LawsHomeSearchCommon.LAWS_OVERSEAS_STANDARD, 0);
|
int count2 = mapHash.getOrDefault(LawsHomeSearchCommon.LAWS_OVERSEAS_STANDARD, 0);
|
||||||
int m2 = 0;
|
int m2 = 0;
|
||||||
if(!CollectionUtils.isEmpty(listLawsOverseasStandard)){
|
if(!CollectionUtils.isEmpty(listLawsOverseasStandard)){
|
||||||
@@ -135,7 +139,9 @@ public class HomeSearchCheckEsPlanJob implements Job {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkLawsDomesticStandard(String resourceType, Map<String, Integer> mapHash) {
|
private void checkLawsDomesticStandard(String resourceType, Map<String, Integer> mapHash) {
|
||||||
List<LawsDomesticStandard> listLawsDomesticStandard = lawsDomesticStandardService.list();
|
LambdaQueryWrapper<LawsDomesticStandard> query = new LambdaQueryWrapper<>();
|
||||||
|
query.ne(LawsDomesticStandard::getStandardState,"7");
|
||||||
|
List<LawsDomesticStandard> listLawsDomesticStandard = lawsDomesticStandardService.list(query);
|
||||||
// 比对数据
|
// 比对数据
|
||||||
int count1 = mapHash.getOrDefault(LawsHomeSearchCommon.LAWS_DOMESTIC_STANDARD, 0);
|
int count1 = mapHash.getOrDefault(LawsHomeSearchCommon.LAWS_DOMESTIC_STANDARD, 0);
|
||||||
int m1 = 0;
|
int m1 = 0;
|
||||||
|
|||||||
-13
@@ -1094,7 +1094,6 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|||||||
int startIndex = 0;
|
int startIndex = 0;
|
||||||
int batchCount = 500;
|
int batchCount = 500;
|
||||||
List<String> listIds = Arrays.asList(ids.split(","));
|
List<String> listIds = Arrays.asList(ids.split(","));
|
||||||
ForkJoinPool pool = new ForkJoinPool();
|
|
||||||
if(CollectionUtils.isEmpty(listIds)) {
|
if(CollectionUtils.isEmpty(listIds)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1109,11 +1108,9 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|||||||
if(CollectionUtils.isEmpty(listLawsDomesticStandard)){
|
if(CollectionUtils.isEmpty(listLawsDomesticStandard)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
CompletableFuture.runAsync(()->{
|
|
||||||
for (LawsDomesticStandard lawsDomesticStandard : listLawsDomesticStandard) {
|
for (LawsDomesticStandard lawsDomesticStandard : listLawsDomesticStandard) {
|
||||||
createData(resourceType, opType, lawsDomesticStandard);
|
createData(resourceType, opType, lawsDomesticStandard);
|
||||||
}
|
}
|
||||||
},pool);
|
|
||||||
// 下一批
|
// 下一批
|
||||||
startIndex = startIndex + batchCount;
|
startIndex = startIndex + batchCount;
|
||||||
}
|
}
|
||||||
@@ -1216,8 +1213,6 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|||||||
int startIndex = 0;
|
int startIndex = 0;
|
||||||
int batchCount = 2000;
|
int batchCount = 2000;
|
||||||
List<String> listIds = Arrays.asList(ids.split(","));
|
List<String> listIds = Arrays.asList(ids.split(","));
|
||||||
ForkJoinPool pool = new ForkJoinPool();
|
|
||||||
// 异步执行
|
|
||||||
while (startIndex < listIds.size()) {
|
while (startIndex < listIds.size()) {
|
||||||
int endIndex = getEndIndex(startIndex, batchCount, listIds);
|
int endIndex = getEndIndex(startIndex, batchCount, listIds);
|
||||||
List<String> listIdsSub = listIds.subList(startIndex, endIndex);
|
List<String> listIdsSub = listIds.subList(startIndex, endIndex);
|
||||||
@@ -1228,7 +1223,6 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|||||||
if(CollectionUtils.isEmpty(listLawsOverseasStandard)){
|
if(CollectionUtils.isEmpty(listLawsOverseasStandard)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
CompletableFuture.runAsync(()->{
|
|
||||||
for (LawsOverseasStandard lawsOverseasStandard : listLawsOverseasStandard) {
|
for (LawsOverseasStandard lawsOverseasStandard : listLawsOverseasStandard) {
|
||||||
try {
|
try {
|
||||||
LawsHomeNormalSearchVO obj = new LawsHomeNormalSearchVO();
|
LawsHomeNormalSearchVO obj = new LawsHomeNormalSearchVO();
|
||||||
@@ -1256,7 +1250,6 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|||||||
log.error(SYNC_ES_ERR,e.getMessage());
|
log.error(SYNC_ES_ERR,e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},pool);
|
|
||||||
startIndex = startIndex + batchCount; // 下一批
|
startIndex = startIndex + batchCount; // 下一批
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1307,8 +1300,6 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|||||||
int startIndex = 0;
|
int startIndex = 0;
|
||||||
int batchCount = 2000;
|
int batchCount = 2000;
|
||||||
List<String> listIds = Arrays.asList(ids.split(","));
|
List<String> listIds = Arrays.asList(ids.split(","));
|
||||||
ForkJoinPool pool = new ForkJoinPool();
|
|
||||||
// 异步执行
|
|
||||||
while (startIndex < listIds.size()) {
|
while (startIndex < listIds.size()) {
|
||||||
int endIndex = getEndIndex(startIndex, batchCount, listIds);
|
int endIndex = getEndIndex(startIndex, batchCount, listIds);
|
||||||
List<String> listIdsSub = listIds.subList(startIndex, endIndex);
|
List<String> listIdsSub = listIds.subList(startIndex, endIndex);
|
||||||
@@ -1319,7 +1310,6 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|||||||
if(CollectionUtils.isEmpty(listLawsEnterpriseStandard)){
|
if(CollectionUtils.isEmpty(listLawsEnterpriseStandard)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
CompletableFuture.runAsync(()->{
|
|
||||||
for (LawsEnterpriseStandard lawsEnterpriseStandard : listLawsEnterpriseStandard) {
|
for (LawsEnterpriseStandard lawsEnterpriseStandard : listLawsEnterpriseStandard) {
|
||||||
try {
|
try {
|
||||||
LawsHomeNormalSearchVO obj = new LawsHomeNormalSearchVO();
|
LawsHomeNormalSearchVO obj = new LawsHomeNormalSearchVO();
|
||||||
@@ -1349,7 +1339,6 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|||||||
log.error(SYNC_ES_ERR,e.getMessage());
|
log.error(SYNC_ES_ERR,e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},pool);
|
|
||||||
startIndex = startIndex + batchCount; // 下一批
|
startIndex = startIndex + batchCount; // 下一批
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1395,7 +1384,6 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|||||||
if(CollectionUtils.isEmpty(listLawsNewsFeed)){
|
if(CollectionUtils.isEmpty(listLawsNewsFeed)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
CompletableFuture.runAsync(()->{
|
|
||||||
for (LawsNewsFeed lawsNewsFeed : listLawsNewsFeed) {
|
for (LawsNewsFeed lawsNewsFeed : listLawsNewsFeed) {
|
||||||
try {
|
try {
|
||||||
LawsHomeNormalSearchVO obj = new LawsHomeNormalSearchVO();
|
LawsHomeNormalSearchVO obj = new LawsHomeNormalSearchVO();
|
||||||
@@ -1413,7 +1401,6 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|||||||
log.error(SYNC_ES_ERR,e.getMessage());
|
log.error(SYNC_ES_ERR,e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},pool);
|
|
||||||
startIndex = startIndex + batchCount; // 下一批
|
startIndex = startIndex + batchCount; // 下一批
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user