Browse Source

修改:

1.查询志愿者列表agencyId问题
dev
wangxianzhang 4 years ago
parent
commit
0343073e12
  1. 4
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/VolunteerCommonFormDTO.java
  2. 8
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java
  3. 12
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java
  4. 51
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
  5. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/VolunteerServiceImpl.java

4
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/VolunteerCommonFormDTO.java

@ -20,9 +20,9 @@ public class VolunteerCommonFormDTO {
private String customerId;
/**
* 上级组织ID使用PIDS like查询该组织下所有志愿者注意是like 'agencyId:%'
* 组织ID
*/
private String superiorAgencyId;
private String agencyId;
private Integer pageNo = 0;

8
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java

@ -141,8 +141,8 @@ public class ResiVolunteerController {
Integer pageNo = input.getPageNo();
Integer pageSize = input.getPageSize();
String customerId = input.getCustomerId();
String superiorAgencyId = input.getSuperiorAgencyId();
List<PageVolunteerInfoResultDTO> l = volunteerInfoService.queryVolunteerPage(customerId, pageNo, pageSize, superiorAgencyId);
String agencyId = input.getAgencyId();
List<PageVolunteerInfoResultDTO> l = volunteerInfoService.queryVolunteerPage(customerId, pageNo, pageSize, agencyId);
return new Result<List<PageVolunteerInfoResultDTO>>().ok(l);
}
@ -154,9 +154,9 @@ public class ResiVolunteerController {
@PostMapping("count")
public Result<Integer> getVolunteerCount(@RequestBody VolunteerCommonFormDTO input) {
String customerId = input.getCustomerId();
String pidsPrefix = input.getSuperiorAgencyId();
String agencyId = input.getAgencyId();
Integer volunteerCount = volunteerInfoService.getVolunteerCount(customerId, pidsPrefix);
Integer volunteerCount = volunteerInfoService.getVolunteerCount(customerId, agencyId);
return new Result<Integer>().ok(volunteerCount);
}
}

12
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java

@ -95,12 +95,20 @@ public interface VolunteerInfoService extends BaseService<VolunteerInfoEntity> {
*/
List<OptionDTO> queryListVolunteer(String customerId,String staffId,String userRealName);
List<PageVolunteerInfoResultDTO> queryVolunteerPage(String customerId, Integer pageNo, Integer pageSize, String superiorAgencyId);
/**
* @param customerId
* @param pageNo
* @param pageSize
* @param agencyId 组织ID使用PIDS like查询该组织"及下级"所有志愿者
* @return
*/
List<PageVolunteerInfoResultDTO> queryVolunteerPage(String customerId, Integer pageNo, Integer pageSize, String agencyId);
/**
* 查询志愿者数量
* @param customerId
* @param agencyId 组织ID查询该组织"及下级"下所有的志愿者
* @return
*/
Integer getVolunteerCount(String customerId, String pidsPrefix);
Integer getVolunteerCount(String customerId, String agencyId);
}

51
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java

@ -359,24 +359,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);
@ -392,17 +379,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,获取pidsagencyPids: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;
}
}

4
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/VolunteerServiceImpl.java

@ -103,7 +103,7 @@ public class VolunteerServiceImpl implements VolunteerService, ResultDataResolve
String vcErrorMsg = "【志愿者分布】查询志愿者总数出错";
VolunteerCommonFormDTO volunteerCountForm = new VolunteerCommonFormDTO();
volunteerCountForm.setCustomerId(customerId);
volunteerCountForm.setSuperiorAgencyId(agencyId);
volunteerCountForm.setAgencyId(agencyId);
Integer volunteerCount = getResultDataOrThrowsException(epmetHeartOpenFeignClient.getVolunteerCount(volunteerCountForm),
ServiceConstant.EPMET_HEART_SERVER,
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),
@ -237,7 +237,7 @@ public class VolunteerServiceImpl implements VolunteerService, ResultDataResolve
private List<PageVolunteerInfoResultDTO> listVolunteersByPage(String customerId, String agencyId, Integer pageNo, Integer pageSize) {
VolunteerCommonFormDTO volunteerForm = new VolunteerCommonFormDTO();
volunteerForm.setCustomerId(customerId);
volunteerForm.setSuperiorAgencyId(agencyId);
volunteerForm.setAgencyId(agencyId);
volunteerForm.setPageNo(pageNo);
volunteerForm.setPageSize(pageSize);

Loading…
Cancel
Save