|
|
@ -3,6 +3,7 @@ package com.epmet.dataaggre.service.impl; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.BuildingInfoCache; |
|
|
|
import com.epmet.commons.tools.utils.EpmetRequestHolder; |
|
|
@ -75,8 +76,8 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<CoverageAnalisisDataListResultDTO> analysisDataList(List<String> coverageTypes, List<String> categoryKeys, |
|
|
|
String search, Integer pageNo, Integer pageSize, Boolean isPage) { |
|
|
|
public PageData<CoverageAnalisisDataListResultDTO> analysisDataList(List<String> coverageTypes, List<String> categoryKeys, |
|
|
|
String search, Integer pageNo, Integer pageSize, Boolean isPage) { |
|
|
|
|
|
|
|
String customerId = EpmetRequestHolder.getLoginUserCustomerId(); |
|
|
|
String staffId = EpmetRequestHolder.getLoginUserId(); |
|
|
@ -109,8 +110,16 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
|
// 总共查询了多少个了
|
|
|
|
int lastTotalCount = 0; |
|
|
|
int totalCount = 0; |
|
|
|
|
|
|
|
// 是否出现要展示的数据
|
|
|
|
boolean dataAppear = false; |
|
|
|
|
|
|
|
// 是否是第一次出现需要展示的数据
|
|
|
|
boolean firstTimeDataAppear = false; |
|
|
|
|
|
|
|
// 数据是否够了,够了就不再查询数据
|
|
|
|
boolean isDataEnough = false; |
|
|
|
|
|
|
|
// 结果集
|
|
|
|
List<CoverageAnalisisDataListResultDTO> rls = new ArrayList<>(); |
|
|
|
for (String coverageType : coverageTypes) { |
|
|
@ -119,7 +128,11 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
|
continue; |
|
|
|
} |
|
|
|
for (GovOrgCoverageService.CategoryCoverageMapping e : ccm) { |
|
|
|
boolean firstTimeDataAppear = false; |
|
|
|
|
|
|
|
Integer tempCount = doDataListCount(EpmetRequestHolder.getLoginUserCustomerId(), agencyId, staffPids, e.getPlaceType(), |
|
|
|
e.getCategoryKey(), search); |
|
|
|
lastTotalCount = totalCount; |
|
|
|
totalCount += tempCount; |
|
|
|
|
|
|
|
if (!isPage) { |
|
|
|
// 不分页,查询所有
|
|
|
@ -131,19 +144,18 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
// 查询当前category有多少个
|
|
|
|
if (!dataAppear) { |
|
|
|
Integer tempCount = doDataListCount(EpmetRequestHolder.getLoginUserCustomerId(), agencyId, staffPids, e.getPlaceType(), |
|
|
|
e.getCategoryKey(), search); |
|
|
|
|
|
|
|
lastTotalCount = totalCount; |
|
|
|
totalCount += tempCount; |
|
|
|
if (totalCount > start) { |
|
|
|
if (totalCount > start) { |
|
|
|
if (!dataAppear) { |
|
|
|
dataAppear = true; |
|
|
|
firstTimeDataAppear = true; |
|
|
|
} else { |
|
|
|
continue; |
|
|
|
} |
|
|
|
} else { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
if (isDataEnough) { |
|
|
|
// 数据够了,则不再查询数据列表,只检索数量,用于分页条显示
|
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
// 检索数据
|
|
|
@ -153,19 +165,23 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
|
|
|
|
|
if (firstTimeDataAppear) { |
|
|
|
rls.addAll(dataSegment.subList(start - lastTotalCount, dataSegment.size())); |
|
|
|
firstTimeDataAppear = false; |
|
|
|
} else { |
|
|
|
rls.addAll(dataSegment); |
|
|
|
} |
|
|
|
|
|
|
|
firstTimeDataAppear = false; |
|
|
|
|
|
|
|
// 最后,将多余的数据裁剪掉
|
|
|
|
if (rls.size() >= pageSize) { |
|
|
|
return rls.subList(0, pageSize); |
|
|
|
isDataEnough = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return rls; |
|
|
|
|
|
|
|
if (isPage && rls.size() >= pageSize) { |
|
|
|
return new PageData<>(rls.subList(0, pageSize), totalCount); |
|
|
|
} else { |
|
|
|
return new PageData<>(rls, totalCount); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|