Commit 83e0cd3e authored by leizhan's avatar leizhan

优化勘察信息录入,部分信息自动赋值回填

parent 563155ee
...@@ -67,8 +67,7 @@ public class PeasantHouseholdController extends BaseController { ...@@ -67,8 +67,7 @@ public class PeasantHouseholdController extends BaseController {
surveyInformationServiceImpl.createWithModel(surveyInformationDto); surveyInformationServiceImpl.createWithModel(surveyInformationDto);
JSONArray regionName = getRegionName(); JSONArray regionName = getRegionName();
List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class); List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class);
if(StringUtils.isEmpty(model.getProjectAddressName())){ // 处理项目地址
// 处理地址
String area = ""; String area = "";
for (Integer reg : model.getProjectAddress()) for (Integer reg : model.getProjectAddress())
for (RegionModel re : list) { for (RegionModel re : list) {
...@@ -76,20 +75,28 @@ public class PeasantHouseholdController extends BaseController { ...@@ -76,20 +75,28 @@ public class PeasantHouseholdController extends BaseController {
area = area + re.getRegionName() + "/"; area = area + re.getRegionName() + "/";
} }
} }
model.setProjectAddressName(area.substring(0, area.length() - 2)+"/"+model.getProjectAddressDetail()); model.setProjectAddressName(area.substring(0, area.length() - 2));
}
if ("1".equals(model.getIsPermanent())) { if ("1".equals(model.getIsPermanent())) {
model.setPermanentAddress(model.getProjectAddress()); model.setPermanentAddress(model.getProjectAddress());
model.setPermanentAddressDetail(model.getProjectAddressDetail()); model.setPermanentAddressDetail(model.getProjectAddressDetail());
model.setPermanentAddressName(area.substring(0, area.length() - 2));
}else {
// 处理常住地址
String permanent = "";
for (Integer reg : model.getPermanentAddress())
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
permanent = permanent + re.getRegionName() + "/";
}
}
model.setPermanentAddressName(permanent.substring(0, permanent.length() - 2));
} }
model.setSurveyInformationId(surveyInformationDto.getSequenceNbr()); model.setSurveyInformationId(surveyInformationDto.getSequenceNbr());
model.setSurveyOrNot(0); model.setSurveyOrNot(0);
model.setReview(0); model.setReview(0);
if(StringUtils.isEmpty(model.getDeveloperCode())){ model.setDeveloperCode(userInfo.getCompanys().get(0).getOrgCode());
model.setDeveloperCode(userInfo.getAgencyCode());
}
model.setDeveloperName(userInfo.getOrgNamesWithoutRole()); model.setDeveloperName(userInfo.getOrgNamesWithoutRole());
if(StringUtils.isEmpty(model.getDeveloper())){ if(StringUtils.isEmpty(model.getDeveloper())){
model.setDeveloper(userInfo.getRealName()); model.setDeveloper(userInfo.getRealName());
...@@ -192,7 +199,8 @@ public class PeasantHouseholdController extends BaseController { ...@@ -192,7 +199,8 @@ public class PeasantHouseholdController extends BaseController {
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
AgencyUserModel userInfo = getUserInfo(); AgencyUserModel userInfo = getUserInfo();
return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.queryForPeasantHouseholdPage(page,userInfo.getAgencyCode(),ownersName)); String orgCode = userInfo.getCompanys().get(0).getOrgCode();
return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.queryForPeasantHouseholdPage(page,orgCode,ownersName));
} }
/** /**
......
package com.yeejoin.amos.boot.module.hygf.biz.controller; package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.yeejoin.amos.boot.module.hygf.api.dto.SurveyInfoAllDto; import com.yeejoin.amos.boot.module.hygf.api.dto.SurveyInfoAllDto;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -138,8 +139,8 @@ public class SurveyInformationController extends BaseController { ...@@ -138,8 +139,8 @@ public class SurveyInformationController extends BaseController {
@ApiOperation(httpMethod = "GET",value = "勘察信息编辑", notes = "勘察信息编辑") @ApiOperation(httpMethod = "GET",value = "勘察信息编辑", notes = "勘察信息编辑")
@GetMapping(value = "/surveyQuery") @GetMapping(value = "/surveyQuery")
public ResponseModel<SurveyInfoAllDto> surveyQuery(@RequestParam String surveyInformationId) { public ResponseModel<SurveyInfoAllDto> surveyQuery(@RequestParam String surveyInformationId) {
AgencyUserModel userInfo = getUserInfo();
SurveyInfoAllDto returnDto = surveyInformationServiceImpl.querySurveyInfo(surveyInformationId); SurveyInfoAllDto returnDto = surveyInformationServiceImpl.querySurveyInfo(surveyInformationId,userInfo);
return ResponseHelper.buildResponse(returnDto); return ResponseHelper.buildResponse(returnDto);
} }
} }
...@@ -71,7 +71,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto ...@@ -71,7 +71,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
* 分页查询 * 分页查询
*/ */
public Page<PeasantHouseholdDto> queryForPeasantHouseholdPage(Page<PeasantHouseholdDto> page,String developerCode,@Condition(Operator.like) String ownersName) { public Page<PeasantHouseholdDto> queryForPeasantHouseholdPage(Page<PeasantHouseholdDto> page,String developerCode,@Condition(Operator.like) String ownersName) {
Page<PeasantHouseholdDto> peasantHouseholdDtoPage = this.queryForPage(page, null, false,developerCode,ownersName); Page<PeasantHouseholdDto> peasantHouseholdDtoPage = this.queryForPage(page, "rec_date", false,developerCode,ownersName);
List<PeasantHouseholdDto> records = peasantHouseholdDtoPage.getRecords(); List<PeasantHouseholdDto> records = peasantHouseholdDtoPage.getRecords();
List<PeasantHouseholdDto> newRecords = records.stream().map(item -> { List<PeasantHouseholdDto> newRecords = records.stream().map(item -> {
if (item.getSurveyOrNot() == 0) { if (item.getSurveyOrNot() == 0) {
......
...@@ -11,6 +11,7 @@ import com.yeejoin.amos.boot.module.hygf.api.mapper.SurveyInformationMapper; ...@@ -11,6 +11,7 @@ import com.yeejoin.amos.boot.module.hygf.api.mapper.SurveyInformationMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.ISurveyInformationService; import com.yeejoin.amos.boot.module.hygf.api.service.ISurveyInformationService;
import com.yeejoin.amos.boot.module.hygf.api.util.BeanDtoUtils; import com.yeejoin.amos.boot.module.hygf.api.util.BeanDtoUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel; import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import org.apache.commons.beanutils.ConvertUtils; import org.apache.commons.beanutils.ConvertUtils;
...@@ -24,6 +25,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -24,6 +25,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -157,7 +159,7 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -157,7 +159,7 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
return surveyInfoAllDto; return surveyInfoAllDto;
} }
public SurveyInfoAllDto querySurveyInfo(String surveyInformationId) { public SurveyInfoAllDto querySurveyInfo(String surveyInformationId,AgencyUserModel userInfo) {
SurveyInfoAllDto surveyInfoAllDto = new SurveyInfoAllDto(); SurveyInfoAllDto surveyInfoAllDto = new SurveyInfoAllDto();
...@@ -170,6 +172,11 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -170,6 +172,11 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
peasantHouseholdQueryWrapper.eq("survey_information_id", surveyInformationId); peasantHouseholdQueryWrapper.eq("survey_information_id", surveyInformationId);
PeasantHousehold peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdQueryWrapper); PeasantHousehold peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdQueryWrapper);
BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation()); BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation());
surveyInfoAllDto.getSurveyInformation().setDeveloperName(userInfo.getCompanys().get(0).getCompanyName());
surveyInfoAllDto.getSurveyInformation().setDeveloperCode(userInfo.getCompanys().get(0).getOrgCode());
surveyInfoAllDto.getSurveyInformation().setSalesmanId(userInfo.getUserId());
surveyInfoAllDto.getSurveyInformation().setSalesman(userInfo.getRealName());
surveyInfoAllDto.getSurveyInformation().setCreator(userInfo.getRealName());
if (!StringUtils.isEmpty(peasantHousehold.getProjectAddressName())) { if (!StringUtils.isEmpty(peasantHousehold.getProjectAddressName())) {
surveyInfoAllDto.getSurveyInformation().setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/"))); surveyInfoAllDto.getSurveyInformation().setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/")));
} }
...@@ -181,8 +188,9 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -181,8 +188,9 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
surveyInfoAllDto.getSurveyInformation().setPermanentAddress(peasantHousehold.getProjectAddress()); surveyInfoAllDto.getSurveyInformation().setPermanentAddress(peasantHousehold.getProjectAddress());
surveyInfoAllDto.getSurveyInformation().setIsPermanent("1"); surveyInfoAllDto.getSurveyInformation().setIsPermanent("1");
} }
surveyInfoAllDto.getSurveyInformation().setSequenceNbr(surveyInformation.getSequenceNbr());
surveyInfoAllDto.getSurveyInformation().setSequenceNbr(surveyInformation.getSequenceNbr());
surveyInfoAllDto.getSurveyInformation().setCreatorTime(new Date());
QueryWrapper<SurveyDetails> surveyDetailsQueryWrapper = new QueryWrapper<>(); QueryWrapper<SurveyDetails> surveyDetailsQueryWrapper = new QueryWrapper<>();
surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId); surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId);
SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper); SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper);
...@@ -206,7 +214,10 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -206,7 +214,10 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
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){ if(information == null){
surveyInfoAllDto.setCommercial(new CommercialDto()); CommercialDto commercialDto = new CommercialDto();
commercialDto.setType("zrr");
commercialDto.setLegalType("zjdnhw");
surveyInfoAllDto.setCommercial(commercialDto);
}else { }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())){
......
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