Commit 9b555473 authored by leizhan's avatar leizhan

兼容微信小程序省市县的回显问题

parent e8f662cb
......@@ -39,6 +39,12 @@ public class CommercialDto extends BaseDto {
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Integer> projectAddress;
@ApiModelProperty(value = "省市区名称")
private String projectAddressName;
@ApiModelProperty(value = "省市区文字集合")
private List<String> projectAddressText;
@ApiModelProperty(value = "设备信息")
private String device;
......
......@@ -55,10 +55,15 @@ public class Commercial extends BaseEntity {
private String telephone;
/**
* 省市区
* 省市区code
*/
@TableField(value = "project_address",typeHandler = FastjsonTypeHandler.class)
private List<Object> projectAddress;
/**
* 省市区名称
*/
@TableField("project_address_name")
private String projectAddressName;
/**
* 设备信息
......
......@@ -73,6 +73,9 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
public SurveyInfoAllDto saveSurveyInfo(SurveyInfoAllDto surveyInfoAllDto,String operationType) {
JSONArray regionName = getRegionName();
List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class);
//更新勘察基本信息
SurveyInformation surveyInformation = BeanDtoUtils.convert(surveyInfoAllDto.getSurveyInformation(), SurveyInformation.class);
surveyInformation.setReview(0);
......@@ -92,6 +95,16 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
//更新商务信息
CommercialDto oldCommercial = surveyInfoAllDto.getCommercial();
Commercial commercial = BeanDtoUtils.convert(oldCommercial, Commercial.class);
// 处理省市县
String paddressName = "";
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getProjectAddress()) {
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
paddressName = paddressName + re.getRegionName() + "/";
}
}
}
commercial.setProjectAddressName(paddressName.substring(0, paddressName.length() - 2));
commercial.setSurveyInformationId(surveyInformation.getSequenceNbr());
commercialService.saveOrUpdate(commercial);
......@@ -119,25 +132,26 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
peasantHousehold.setPermanentAddress(surveyInfoAllDto.getSurveyInformation().getPermanentAddress());
peasantHousehold.setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail());
peasantHousehold.setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail());
JSONArray regionName = getRegionName();
List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class);
// 处理项目地址
String projectAddressName = "";
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getProjectAddress())
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getProjectAddress()) {
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
projectAddressName = projectAddressName + re.getRegionName() + "/";
}
}
}
peasantHousehold.setProjectAddressName(projectAddressName.substring(0, projectAddressName.length() - 2));
//常住地址
String permanentAddressName = "";
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getPermanentAddress())
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getPermanentAddress()) {
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
permanentAddressName = permanentAddressName + re.getRegionName() + "/";
}
}
}
peasantHousehold.setPermanentAddressName(permanentAddressName.substring(0, permanentAddressName.length() - 2));
peasantHouseholdServiceImpl.saveOrUpdate(peasantHousehold);
return surveyInfoAllDto;
......@@ -156,8 +170,12 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
peasantHouseholdQueryWrapper.eq("survey_information_id", surveyInformationId);
PeasantHousehold peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdQueryWrapper);
BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation());
surveyInfoAllDto.getSurveyInformation().setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/")));
surveyInfoAllDto.getSurveyInformation().setPermanentAddressText(Arrays.asList(peasantHousehold.getPermanentAddressName().split("/")));
if (!StringUtils.isEmpty(peasantHousehold.getProjectAddressName())) {
surveyInfoAllDto.getSurveyInformation().setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/")));
}
if(!StringUtils.isEmpty(peasantHousehold.getPermanentAddressName())){
surveyInfoAllDto.getSurveyInformation().setPermanentAddressText(Arrays.asList(peasantHousehold.getPermanentAddressName().split("/")));
}
if(peasantHousehold.getPermanentAddress() ==null){
surveyInfoAllDto.getSurveyInformation().setPermanentAddress(peasantHousehold.getProjectAddress());
......@@ -182,6 +200,9 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
Commercial commercial = commercialService.getBaseMapper().selectOne(commercialQueryWrapper);
surveyInfoAllDto.setCommercial(BeanDtoUtils.convert(commercial, CommercialDto.class));
if(commercial !=null && !StringUtils.isEmpty(commercial.getProjectAddressName())){
surveyInfoAllDto.getCommercial().setProjectAddressText(Arrays.asList(commercial.getProjectAddressName().split("/")));
}
QueryWrapper<ExtendedInformation> extendedInformationQueryWrapper = new QueryWrapper<>();
extendedInformationQueryWrapper.eq("survey_information_id", surveyInformationId);
......
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