Commit 72b0c111 authored by leizhan's avatar leizhan

兼容微信小程序,当未勘察时。返回空的对象

parent 9b555473
...@@ -187,29 +187,41 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -187,29 +187,41 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId); surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId);
SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper); SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper);
if(surveyDetails == null){
surveyInfoAllDto.setSurveyDetails(new SurveyDetailsDto());
}else {
surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class)); surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class));
}
QueryWrapper<Information> informationQueryWrapper = new QueryWrapper<>(); QueryWrapper<Information> informationQueryWrapper = new QueryWrapper<>();
informationQueryWrapper.eq("survey_information_id", surveyInformationId); informationQueryWrapper.eq("survey_information_id", surveyInformationId);
Information information = informationService.getBaseMapper().selectOne(informationQueryWrapper); Information information = informationService.getBaseMapper().selectOne(informationQueryWrapper);
if(information == null){
surveyInfoAllDto.setInformation(new InformationDto());
}else {
surveyInfoAllDto.setInformation(BeanDtoUtils.convert(information, InformationDto.class)); surveyInfoAllDto.setInformation(BeanDtoUtils.convert(information, InformationDto.class));
}
QueryWrapper<Commercial> commercialQueryWrapper = new QueryWrapper<>(); QueryWrapper<Commercial> commercialQueryWrapper = new QueryWrapper<>();
commercialQueryWrapper.eq("survey_information_id", surveyInformationId); commercialQueryWrapper.eq("survey_information_id", surveyInformationId);
Commercial commercial = commercialService.getBaseMapper().selectOne(commercialQueryWrapper); Commercial commercial = commercialService.getBaseMapper().selectOne(commercialQueryWrapper);
if(information == null){
surveyInfoAllDto.setCommercial(new CommercialDto());
}else {
surveyInfoAllDto.setCommercial(BeanDtoUtils.convert(commercial, CommercialDto.class)); surveyInfoAllDto.setCommercial(BeanDtoUtils.convert(commercial, CommercialDto.class));
if(commercial !=null && !StringUtils.isEmpty(commercial.getProjectAddressName())){ if(commercial !=null && !StringUtils.isEmpty(commercial.getProjectAddressName())){
surveyInfoAllDto.getCommercial().setProjectAddressText(Arrays.asList(commercial.getProjectAddressName().split("/"))); surveyInfoAllDto.getCommercial().setProjectAddressText(Arrays.asList(commercial.getProjectAddressName().split("/")));
} }
}
QueryWrapper<ExtendedInformation> extendedInformationQueryWrapper = new QueryWrapper<>(); QueryWrapper<ExtendedInformation> extendedInformationQueryWrapper = new QueryWrapper<>();
extendedInformationQueryWrapper.eq("survey_information_id", surveyInformationId); extendedInformationQueryWrapper.eq("survey_information_id", surveyInformationId);
ExtendedInformation extendedInformation = extendedInformationService.getBaseMapper().selectOne(extendedInformationQueryWrapper); ExtendedInformation extendedInformation = extendedInformationService.getBaseMapper().selectOne(extendedInformationQueryWrapper);
if(information == null){
surveyInfoAllDto.setExtendedInformation(new ExtendedInformationDto());
}else {
surveyInfoAllDto.setExtendedInformation(BeanDtoUtils.convert(extendedInformation, ExtendedInformationDto.class)); surveyInfoAllDto.setExtendedInformation(BeanDtoUtils.convert(extendedInformation, ExtendedInformationDto.class));
}
return surveyInfoAllDto; return surveyInfoAllDto;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment