Browse Source

【功能优化】问卷可以通过社区ID查询

1.问卷调查列表可以通过社区ID查询,需要传orgType为agency
2.问卷详情校验权限,可以通过社区ID查询,需要传orgType为agency
national_dev
Bill 2 years ago
parent
commit
bf0066ebc6
  1. 12
      code/smart-community/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetTDuckController.java
  2. 2
      code/smart-community/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/QuestionnaireService.java
  3. 33
      code/smart-community/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrUserProjectServiceImpl.java
  4. 39
      code/smart-community/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/QuestionnaireServiceImpl.java

12
code/smart-community/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetTDuckController.java

@ -7,6 +7,7 @@ import com.epmet.commons.tools.exception.ValidateException;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dataaggre.constant.TDuckConstant;
import com.epmet.dataaggre.dto.epmettduck.PrPublishRangeDTO; import com.epmet.dataaggre.dto.epmettduck.PrPublishRangeDTO;
import com.epmet.dataaggre.dto.epmettduck.form.*; import com.epmet.dataaggre.dto.epmettduck.form.*;
import com.epmet.dataaggre.dto.epmettduck.result.*; import com.epmet.dataaggre.dto.epmettduck.result.*;
@ -167,11 +168,16 @@ public class EpmetTDuckController {
PermissionValidateResultDTO r = null; PermissionValidateResultDTO r = null;
if (AppClientConstant.APP_RESI.equals(app)) { if (AppClientConstant.APP_RESI.equals(app)) {
if (StringUtils.isBlank(orgId) || !"grid".equals(input.getOrgType())) { if (StringUtils.isBlank(orgId)) {
// 居民端,orgId是网格id,必填 // 居民端,orgId是网格id,必填
throw new ValidateException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), "【调查问卷】校验访问权限-居民端 orgId不能为空,且orgType需要为[grid]"); throw new ValidateException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), "【调查问卷】校验访问权限-居民端 orgId不能为空");
} }
r = questionnaireService.resiPermissionValidate(projectKey, userId, orgId); if(TDuckConstant.ORG_TYPE_AGENCY.equals(input.getOrgType())) {
r = questionnaireService.resiPermissionValidate(projectKey, userId, orgId, input.getOrgType());
} else {
r = questionnaireService.resiPermissionValidate(projectKey, userId, orgId);
}
} else if (AppClientConstant.APP_GOV.equals(app)) { } else if (AppClientConstant.APP_GOV.equals(app)) {
// 工作端 // 工作端
r = questionnaireService.govPermissionValidate(projectKey, userId, customerId); r = questionnaireService.govPermissionValidate(projectKey, userId, customerId);

2
code/smart-community/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/QuestionnaireService.java

@ -5,5 +5,7 @@ import com.epmet.dataaggre.dto.epmettduck.result.PermissionValidateResultDTO;
public interface QuestionnaireService { public interface QuestionnaireService {
PermissionValidateResultDTO resiPermissionValidate(String projectKey, String userId, String gridId); PermissionValidateResultDTO resiPermissionValidate(String projectKey, String userId, String gridId);
PermissionValidateResultDTO resiPermissionValidate(String projectKey, String userId, String orgId, String orgType);
PermissionValidateResultDTO govPermissionValidate(String projectKey, String staffId, String customerId); PermissionValidateResultDTO govPermissionValidate(String projectKey, String staffId, String customerId);
} }

33
code/smart-community/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrUserProjectServiceImpl.java

@ -55,8 +55,11 @@ import com.epmet.dataaggre.service.epmettduck.PrPublishRangeService;
import com.epmet.dataaggre.service.epmettduck.PrUserProjectService; import com.epmet.dataaggre.service.epmettduck.PrUserProjectService;
import com.epmet.dataaggre.service.epmettduck.PrVistRecordService; import com.epmet.dataaggre.service.epmettduck.PrVistRecordService;
import com.epmet.dataaggre.service.govorg.GovOrgService; import com.epmet.dataaggre.service.govorg.GovOrgService;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.result.AgencySubResultDTO;
import com.epmet.dto.result.ProcessorListResultDTO;
import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
@ -197,16 +200,28 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao,
orgIds.add(selfOrg); orgIds.add(selfOrg);
} }
}else { }else {
CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO();
customerGridFormDTO.setGridId(formDTO.getOrgId()); if(TDuckConstant.ORG_TYPE_AGENCY.equals(formDTO.getOrgType())){
// 查询网格信息 CustomerAgencyDTO customerAgency = govOrgOpenFeignClient.getAgencyById(formDTO.getOrgId()).getData();
Result<CustomerGridDTO> gridResult = govOrgOpenFeignClient.getGridBaseInfoByGridId(customerGridFormDTO);
if (!gridResult.success()){ if(customerAgency == null) {
throw new RenException("查询网格信息失败了..."); throw new RenException("查询组织信息失败了...");
}
String oneOrg = customerAgency.getPids() + ":" + customerAgency.getId();
orgIds.add(oneOrg);
} else {
CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO();
customerGridFormDTO.setGridId(formDTO.getOrgId());
// 查询网格信息
Result<CustomerGridDTO> gridResult = govOrgOpenFeignClient.getGridBaseInfoByGridId(customerGridFormDTO);
if (!gridResult.success()) {
throw new RenException("查询网格信息失败了...");
}
CustomerGridDTO data = gridResult.getData();
String oneOrg = data.getPids() + ":" + data.getId();
orgIds.add(oneOrg);
} }
CustomerGridDTO data = gridResult.getData();
String oneOrg = data.getPids() + ":" + data.getId();
orgIds.add(oneOrg);
} }
// 根据orgIds查询 问卷调查的key // 根据orgIds查询 问卷调查的key
List<String> projectKeys = baseDao.selectProjectKey(orgIds,formDTO.getCustomerId()); List<String> projectKeys = baseDao.selectProjectKey(orgIds,formDTO.getCustomerId());

39
code/smart-community/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/QuestionnaireServiceImpl.java

@ -11,12 +11,14 @@ import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dataaggre.constant.TDuckConstant;
import com.epmet.dataaggre.dto.epmettduck.result.PermissionValidateResultDTO; import com.epmet.dataaggre.dto.epmettduck.result.PermissionValidateResultDTO;
import com.epmet.dataaggre.entity.epmettduck.PrPublishRangeEntity; import com.epmet.dataaggre.entity.epmettduck.PrPublishRangeEntity;
import com.epmet.dataaggre.entity.epmettduck.PrUserProjectEntity; import com.epmet.dataaggre.entity.epmettduck.PrUserProjectEntity;
import com.epmet.dataaggre.service.QuestionnaireService; import com.epmet.dataaggre.service.QuestionnaireService;
import com.epmet.dataaggre.service.epmettduck.PrPublishRangeService; import com.epmet.dataaggre.service.epmettduck.PrPublishRangeService;
import com.epmet.dataaggre.service.epmettduck.PrUserProjectService; import com.epmet.dataaggre.service.epmettduck.PrUserProjectService;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient;
@ -88,6 +90,43 @@ public class QuestionnaireServiceImpl implements QuestionnaireService, ResultDat
return r; return r;
} }
@Override
public PermissionValidateResultDTO resiPermissionValidate(String projectKey, String userId, String orgId, String orgType) {
PrUserProjectEntity project = prUserProjectService.getProjectEntityBykey(projectKey);
if (project == null || !AppClientConstant.APP_RESI.equals(project.getClient())) {
// 工作端只能看到发布到居民端的
log.warn("【调查问卷】居民端无法查看发布到工作端的调查问卷,staffId:{}, projectKey:{}", userId, projectKey);
return generateValidateResult(userId, projectKey, false);
}
String gridIdPath = null;
if(TDuckConstant.ORG_TYPE_AGENCY.equals(orgType)) {
CustomerAgencyDTO customerAgency = govOrgOpenFeignClient.getAgencyById(orgId).getData();
if (customerAgency == null) {
throw new RenException("查询组织信息失败了...");
}
gridIdPath = customerAgency.getPids() + ":" + customerAgency.getId();
} else {
CustomerGridFormDTO form = new CustomerGridFormDTO();
form.setGridId(orgId);
Result<CustomerGridDTO> gridInfoResult = govOrgOpenFeignClient.getGridBaseInfoByGridId(form);
CustomerGridDTO gridInfo = getResultDataOrThrowsException(gridInfoResult, ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "【调查问卷】校验访问权限,查询网格信息失败", null);
// 网格父级ID列表:网格ID(拼接起来,冒号分割)
gridIdPath = gridInfo.getPids().concat(":").concat(gridInfo.getId());
}
List<PrPublishRangeEntity> publishRangeEntity = prPublishRangeService.getPublishRangeEntity(projectKey);
PermissionValidateResultDTO r = new PermissionValidateResultDTO();
for (PrPublishRangeEntity rangeEntity : publishRangeEntity) {
if (gridIdPath.contains(rangeEntity.getOrgIds())) {
return generateValidateResult(userId, projectKey, true);
}
}
r.setPermitted(false);
return r;
}
@Override @Override
public PermissionValidateResultDTO govPermissionValidate(String projectKey, String staffId, String customerId) { public PermissionValidateResultDTO govPermissionValidate(String projectKey, String staffId, String customerId) {
PrUserProjectEntity project = prUserProjectService.getProjectEntityBykey(projectKey); PrUserProjectEntity project = prUserProjectService.getProjectEntityBykey(projectKey);

Loading…
Cancel
Save