|
|
@ -358,24 +358,11 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao, |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<PageVolunteerInfoResultDTO> queryVolunteerPage(String customerId, Integer pageNo, Integer pageSize, String superiorAgencyId) { |
|
|
|
public List<PageVolunteerInfoResultDTO> queryVolunteerPage(String customerId, Integer pageNo, Integer pageSize, String agencyId) { |
|
|
|
LambdaQueryWrapper<VolunteerInfoEntity> query = new LambdaQueryWrapper<>(); |
|
|
|
Optional.ofNullable(customerId).ifPresent(cid -> query.eq(VolunteerInfoEntity::getCustomerId, cid)); |
|
|
|
Optional.ofNullable(superiorAgencyId).ifPresent(cid -> { |
|
|
|
|
|
|
|
// 需要查询agency的pids:id,通过这个字符串去匹配志愿者的Pids字段来查询
|
|
|
|
String errorMsg = "【分页查询志愿者列表】失败"; |
|
|
|
CustomerAgencyDTO agencyInfo = getResultDataOrThrowsException(govOrgOpenFeignClient.getAgencyById(superiorAgencyId), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg); |
|
|
|
if (agencyInfo == null) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg); |
|
|
|
} |
|
|
|
|
|
|
|
String pidsAndAgencyIdPath = agencyInfo.getPids().concat(":").concat(superiorAgencyId); |
|
|
|
if (pidsAndAgencyIdPath.startsWith(":")) { |
|
|
|
pidsAndAgencyIdPath = pidsAndAgencyIdPath.replaceFirst(":", ""); |
|
|
|
} |
|
|
|
|
|
|
|
query.likeRight(VolunteerInfoEntity::getPids, pidsAndAgencyIdPath); |
|
|
|
Optional.ofNullable(agencyId).ifPresent(aid -> { |
|
|
|
query.likeRight(VolunteerInfoEntity::getPids, getPidsByAgencyId(aid)); |
|
|
|
}); |
|
|
|
|
|
|
|
PageHelper.startPage(pageNo, pageSize); |
|
|
@ -391,17 +378,43 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao, |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Integer getVolunteerCount(String customerId, String pidsPrefix) { |
|
|
|
public Integer getVolunteerCount(String customerId, String agencyId) { |
|
|
|
LambdaQueryWrapper<VolunteerInfoEntity> query = new LambdaQueryWrapper<>(); |
|
|
|
|
|
|
|
Optional.ofNullable(customerId).ifPresent((cId) -> { |
|
|
|
query.eq(VolunteerInfoEntity::getCustomerId, cId); |
|
|
|
}); |
|
|
|
|
|
|
|
Optional.ofNullable(pidsPrefix).ifPresent((pidsPrefixt) -> { |
|
|
|
query.likeRight(VolunteerInfoEntity::getPids, pidsPrefixt); |
|
|
|
Optional.ofNullable(agencyId).ifPresent((aid) -> { |
|
|
|
query.likeRight(VolunteerInfoEntity::getPids, getPidsByAgencyId(aid)); |
|
|
|
}); |
|
|
|
|
|
|
|
return baseDao.selectCount(query); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 使用agencyId,获取pids(agencyPids:agencyId) |
|
|
|
* @param agencyId |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private String getPidsByAgencyId(String agencyId) { |
|
|
|
// 需要查询agency的pids:id,通过这个字符串去匹配志愿者的Pids字段来查询
|
|
|
|
String errorMsg = "【分页查询志愿者列表】失败"; |
|
|
|
CustomerAgencyDTO agencyInfo = getResultDataOrThrowsException(govOrgOpenFeignClient.getAgencyById(agencyId), |
|
|
|
ServiceConstant.GOV_ORG_SERVER, |
|
|
|
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), |
|
|
|
errorMsg, |
|
|
|
errorMsg); |
|
|
|
|
|
|
|
if (agencyInfo == null) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg); |
|
|
|
} |
|
|
|
|
|
|
|
String pidsAndAgencyIdPath = agencyInfo.getPids().concat(":").concat(agencyId); |
|
|
|
if (pidsAndAgencyIdPath.startsWith(":")) { |
|
|
|
pidsAndAgencyIdPath = pidsAndAgencyIdPath.replaceFirst(":", ""); |
|
|
|
} |
|
|
|
|
|
|
|
return pidsAndAgencyIdPath; |
|
|
|
} |
|
|
|
} |
|
|
|