|
|
@ -7,6 +7,7 @@ import com.epmet.commons.tools.enums.CoverageEnums; |
|
|
|
import com.epmet.commons.tools.enums.CoveragePlaceTypeEnum; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.exception.ExceptionUtils; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
@ -55,6 +56,8 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.CompletableFuture; |
|
|
|
import java.util.concurrent.ExecutionException; |
|
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
@ -247,39 +250,51 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
|
if (CollectionUtils.isEmpty(tables)){ |
|
|
|
return result; |
|
|
|
} |
|
|
|
// 更多,查询出直接返回
|
|
|
|
if (StringUtils.isNotBlank(formDTO.getSearchType())){ |
|
|
|
if (formDTO.getSearchType().equals(OrgConstant.SEARCH_TYPE_USER)){ |
|
|
|
PageInfo<UserInfoResultDTO> allIcUserPageInfo = getIcUserPageInfo(formDTO); |
|
|
|
result.setUserInfos(allIcUserPageInfo.getList()); |
|
|
|
result.setUserInfosTotal(allIcUserPageInfo.getTotal()); |
|
|
|
return result; |
|
|
|
}else if (formDTO.getSearchType().equals(OrgConstant.SEARCH_TYPE_RESOURCE)){ |
|
|
|
Integer total = NumConstant.ZERO; |
|
|
|
Integer start = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); |
|
|
|
Integer end = start + formDTO.getPageSize(); |
|
|
|
Integer flag; |
|
|
|
List<ResourceInfoResultDTO> reInfos = new ArrayList<>(); |
|
|
|
List<CompletableFuture<List<ResourceInfoResultDTO>>> futures = new ArrayList<>(); |
|
|
|
for (String resource : resources) { |
|
|
|
if (MenusEnums.IC_SUPERIOR_RESOURCE.getUrl().equals(resource)){ |
|
|
|
Integer superiorResourceInfosCount = govOrgService.getSuperiorResourceInfosCount(formDTO); |
|
|
|
total = total + superiorResourceInfosCount; |
|
|
|
if (superiorResourceInfosCount > start){ |
|
|
|
|
|
|
|
} |
|
|
|
CompletableFuture<List<ResourceInfoResultDTO>> c = CompletableFuture.supplyAsync(() -> govOrgService.getSuperiorResourceInfos(formDTO)); |
|
|
|
futures.add(c); |
|
|
|
}else if (MenusEnums.IC_CITY_MANAGEMENT.getUrl().equals(resource)){ |
|
|
|
Integer cityManageInfosCount = govOrgService.getCityManageInfosCount(formDTO); |
|
|
|
total = total + cityManageInfosCount; |
|
|
|
|
|
|
|
CompletableFuture<List<ResourceInfoResultDTO>> c = CompletableFuture.supplyAsync(() -> govOrgService.getCityManageInfos(formDTO)); |
|
|
|
futures.add(c); |
|
|
|
}else if (MenusEnums.IC_COMMUNITY_SELF_ORGANIZATION.getUrl().equals(resource)){ |
|
|
|
Integer communitySelOrgInfosCount = heartService.getCommunitySelOrgInfosCount(formDTO); |
|
|
|
total = total + communitySelOrgInfosCount; |
|
|
|
CompletableFuture<List<ResourceInfoResultDTO>> c = CompletableFuture.supplyAsync(() -> heartService.getCommunitySelOrgInfos(formDTO)); |
|
|
|
futures.add(c); |
|
|
|
}else if (MenusEnums.IC_DANGEROUS_CHEMICALS.getUrl().equals(resource)){ |
|
|
|
|
|
|
|
CompletableFuture<List<ResourceInfoResultDTO>> c = CompletableFuture.supplyAsync(() -> govOrgService.getDangerousChemicalsInfos(formDTO)); |
|
|
|
futures.add(c); |
|
|
|
}else if (MenusEnums.IC_ENTERPRISE.getUrl().equals(resource)){ |
|
|
|
|
|
|
|
CompletableFuture<List<ResourceInfoResultDTO>> c = CompletableFuture.supplyAsync(() -> govOrgService.getEnterpriseInfos(formDTO)); |
|
|
|
futures.add(c); |
|
|
|
}else if (MenusEnums.IC_PUBLIC_SERVICE.getUrl().equals(resource)){ |
|
|
|
|
|
|
|
CompletableFuture<List<ResourceInfoResultDTO>> c = CompletableFuture.supplyAsync(() -> govOrgService.getPublicServiceInfos(formDTO)); |
|
|
|
futures.add(c); |
|
|
|
} |
|
|
|
} |
|
|
|
for (CompletableFuture<List<ResourceInfoResultDTO>> future : futures) { |
|
|
|
try { |
|
|
|
if (CollectionUtils.isNotEmpty(future.get())){ |
|
|
|
reInfos.addAll(future.get()); |
|
|
|
} |
|
|
|
} catch (InterruptedException e) { |
|
|
|
log.error("【五大图层首页】异步获取资源列表被中断:{}", ExceptionUtils.getErrorStackTrace(e)); |
|
|
|
} catch (ExecutionException e) { |
|
|
|
log.error("【五大图层首页】异步获取异步获取资源列表失败:{}", ExceptionUtils.getErrorStackTrace(e)); |
|
|
|
} |
|
|
|
} |
|
|
|
result.setResourceInfos(reInfos); |
|
|
|
return result; |
|
|
|
} |
|
|
|
}else { |
|
|
|
// 查询居民
|
|
|
|
PageInfo<UserInfoResultDTO> allIcUserPageInfo = getIcUserPageInfo(formDTO); |
|
|
|