Commit 36910f13 authored by litengwei's avatar litengwei

代码提交

parent 4ad347ee
...@@ -105,4 +105,6 @@ public class CommercialDto extends BaseDto { ...@@ -105,4 +105,6 @@ public class CommercialDto extends BaseDto {
@ApiModelProperty(value = " 省市区详细地址") @ApiModelProperty(value = " 省市区详细地址")
private String projectAddressDetail; private String projectAddressDetail;
@ApiModelProperty(value = "勘察表id")
private Long surveyInformationId;
} }
...@@ -6,6 +6,8 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -6,6 +6,8 @@ import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto; import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
/** /**
...@@ -22,6 +24,9 @@ public class PeasantHouseholdDto extends BaseDto { ...@@ -22,6 +24,9 @@ public class PeasantHouseholdDto extends BaseDto {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "勘察表id")
private Long surveyInformationId;
@ApiModelProperty(value = "农户信息编号") @ApiModelProperty(value = "农户信息编号")
private String peasantHouseholdNo; private String peasantHouseholdNo;
...@@ -40,15 +45,22 @@ public class PeasantHouseholdDto extends BaseDto { ...@@ -40,15 +45,22 @@ public class PeasantHouseholdDto extends BaseDto {
@ApiModelProperty(value = "定金") @ApiModelProperty(value = "定金")
private Float deposit; private Float deposit;
@DateTimeFormat(pattern = "yyyy-MM-dd HH")
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Date creationTime; private Date creationTime;
@ApiModelProperty(value = "项目地址") @ApiModelProperty(value = "项目地址")
private String projectAddress; private String projectAddress;
@ApiModelProperty(value = "项目地址Arr")
private String[] projectAddressArr;
@ApiModelProperty(value = "常住地址") @ApiModelProperty(value = "常住地址")
private String permanentAddress; private String permanentAddress;
@ApiModelProperty(value = "常住地址Arr")
private String permanentAddressArr;
@ApiModelProperty(value = "是否勘察 0,1") @ApiModelProperty(value = "是否勘察 0,1")
private Integer surveyOrNot; private Integer surveyOrNot;
...@@ -68,4 +80,10 @@ public class PeasantHouseholdDto extends BaseDto { ...@@ -68,4 +80,10 @@ public class PeasantHouseholdDto extends BaseDto {
private String permanentAddressDetail; private String permanentAddressDetail;
@ApiModelProperty(value = "开发人") @ApiModelProperty(value = "开发人")
private String developer; private String developer;
@ApiModelProperty(value = "常住地址")
private String permanentAddressName;
@ApiModelProperty(value = "项目地址")
private String projectAddressName;
} }
package com.yeejoin.amos.boot.module.hygf.api.dto;
import io.swagger.annotations.ApiModel;
import lombok.Data;
@Data
@ApiModel(value="PeasantHouseholdDto", description="农户信息")
public class PeasantHouseholdDtoP {
PeasantHouseholdDto farmerInformation;
}
...@@ -20,6 +20,8 @@ public class SurveyDetailsDto extends BaseDto { ...@@ -20,6 +20,8 @@ public class SurveyDetailsDto extends BaseDto {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "勘察表id")
private Long surveyInformationId;
@ApiModelProperty(value = "勘察时间") @ApiModelProperty(value = "勘察时间")
private Date surveyorTime; private Date surveyorTime;
......
...@@ -51,4 +51,28 @@ public class SurveyInformationDto extends BaseDto { ...@@ -51,4 +51,28 @@ public class SurveyInformationDto extends BaseDto {
@ApiModelProperty(value = " 审核状态 0未审核,1审核中,2审核结束") @ApiModelProperty(value = " 审核状态 0未审核,1审核中,2审核结束")
private Integer review; private Integer review;
@ApiModelProperty(value = "业主姓名")
private String ownersName;
@ApiModelProperty(value = "联系电话")
private String telephone;
@ApiModelProperty(value = "身份证号")
private String idCard;
@ApiModelProperty(value = "邮箱")
private String mailbox;
@ApiModelProperty(value = "项目详细地址")
private String projectAddressDetail;
@ApiModelProperty(value = "常住详细地址")
private String permanentAddressDetail;
@ApiModelProperty(value = "项目地址")
private String projectAddress;
@ApiModelProperty(value = "常住地址")
private String permanentAddress;
} }
...@@ -22,6 +22,12 @@ public class PeasantHousehold extends BaseEntity { ...@@ -22,6 +22,12 @@ public class PeasantHousehold extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**
* 勘察表id
*/
@TableField("survey_information_id")
private Long surveyInformationId;
/** /**
* 农户信息编号 * 农户信息编号
*/ */
...@@ -77,6 +83,18 @@ public class PeasantHousehold extends BaseEntity { ...@@ -77,6 +83,18 @@ public class PeasantHousehold extends BaseEntity {
private String permanentAddress; private String permanentAddress;
/** /**
* 常住地址
*/
@TableField("permanent_address_name")
private String permanentAddressName;
/**
* 项目地址
*/
@TableField("project_address_name")
private String projectAddressName;
/**
* 是否勘察 0,1 * 是否勘察 0,1
*/ */
@TableField("survey_or_not") @TableField("survey_or_not")
......
package com.yeejoin.amos.boot.module.hygf.biz.controller; package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.alibaba.fastjson.JSONArray;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.dto.PeasantHouseholdDtoP;
import com.yeejoin.amos.boot.module.hygf.api.dto.SurveyInformationDto;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.SurveyInformationServiceImpl;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import org.apache.commons.lang3.StringUtils;
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;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List; import java.util.List;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.PeasantHouseholdServiceImpl; import com.yeejoin.amos.boot.module.hygf.biz.service.impl.PeasantHouseholdServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
...@@ -28,9 +41,17 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType; ...@@ -28,9 +41,17 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
@RequestMapping(value = "/peasant-household") @RequestMapping(value = "/peasant-household")
public class PeasantHouseholdController extends BaseController { public class PeasantHouseholdController extends BaseController {
@Autowired
SurveyInformationServiceImpl surveyInformationServiceImpl;
@Autowired @Autowired
PeasantHouseholdServiceImpl peasantHouseholdServiceImpl; PeasantHouseholdServiceImpl peasantHouseholdServiceImpl;
@Autowired
RedisUtils redisUtils;
private static final String regionRedis="app_region_redis";
/** /**
* 新增农户信息 * 新增农户信息
* *
...@@ -39,9 +60,29 @@ public class PeasantHouseholdController extends BaseController { ...@@ -39,9 +60,29 @@ public class PeasantHouseholdController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增农户信息", notes = "新增农户信息") @ApiOperation(httpMethod = "POST", value = "新增农户信息", notes = "新增农户信息")
public ResponseModel<PeasantHouseholdDto> save(@RequestBody PeasantHouseholdDto model) { public ResponseModel<PeasantHouseholdDto> save(@RequestBody PeasantHouseholdDtoP model) {
model = peasantHouseholdServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model); SurveyInformationDto surveyInformationDto = new SurveyInformationDto();
surveyInformationServiceImpl.createWithModel(surveyInformationDto);
JSONArray regionName = getRegionName();
List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class);
// 处理地址
String area = "";
for (String reg : model.getFarmerInformation().getProjectAddressArr())
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
area = area + re.getRegionName() + "/";
}
}
model.getFarmerInformation().setProjectAddressName(area.substring(0, area.length() - 2));
model.getFarmerInformation().setProjectAddress(StringUtils.joinWith(",", model.getFarmerInformation().getProjectAddressArr()));
model.getFarmerInformation().setPermanentAddress(StringUtils.joinWith(",", model.getFarmerInformation().getPermanentAddressArr()));
model.getFarmerInformation().setSurveyInformationId(surveyInformationDto.getSequenceNbr());
PeasantHouseholdDto householdDto = peasantHouseholdServiceImpl.createWithModel(model.getFarmerInformation());
return ResponseHelper.buildResponse(householdDto);
} }
/** /**
...@@ -113,4 +154,35 @@ public class PeasantHouseholdController extends BaseController { ...@@ -113,4 +154,35 @@ public class PeasantHouseholdController extends BaseController {
public ResponseModel<List<PeasantHouseholdDto>> selectForList() { public ResponseModel<List<PeasantHouseholdDto>> selectForList() {
return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.queryForPeasantHouseholdList()); return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.queryForPeasantHouseholdList());
} }
public JSONArray getRegionName(){
JSONArray jsonArray = new JSONArray();
if (redisUtils.hasKey(regionRedis)) {
jsonArray= JSONArray.parseArray(redisUtils.get(regionRedis).toString());
}else {
Collection<RegionModel> regionChild = new ArrayList<>();
RegionModel regionModel1 = new RegionModel();
regionChild.add(regionModel1);
FeignClientResult<Collection<RegionModel>> collectionFeignClientResult = Systemctl.regionClient.queryForTreeParent(610000L);
Collection<RegionModel> result = collectionFeignClientResult.getResult();
for (RegionModel regionModel : result) {
if(null != regionModel && null != regionModel.getChildren()) {
for (RegionModel child : regionModel.getChildren()) {
if(null != child && null != child.getChildren()) {
for (RegionModel childChild : child.getChildren()) {
jsonArray.add(childChild);
}
child.setChildren(regionChild);
jsonArray.add(child);
}
}
regionModel.setChildren(regionChild);
jsonArray.add(regionModel);
}
}
redisUtils.set(regionRedis,jsonArray);
}
return jsonArray;
}
} }
...@@ -116,15 +116,29 @@ public class SurveyInformationController extends BaseController { ...@@ -116,15 +116,29 @@ public class SurveyInformationController extends BaseController {
} }
/** /**
* 列表全部数据查询 * 勘察信息数据提交
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST",value = "勘察信息数据提交", notes = "勘察信息列表全部数据查询") @ApiOperation(httpMethod = "POST",value = "勘察信息数据提交", notes = "勘察信息数据提交")
@PostMapping(value = "/survey") @PostMapping(value = "/surveySubmit")
public ResponseModel<SurveyInfoAllDto> survey(@RequestBody SurveyInfoAllDto surveyInfoAllDto ) { public ResponseModel<SurveyInfoAllDto> surveySubmit(@RequestBody SurveyInfoAllDto surveyInfoAllDto ) {
SurveyInfoAllDto returnDto = surveyInformationServiceImpl.saveSurveyInfo(surveyInfoAllDto); SurveyInfoAllDto returnDto = surveyInformationServiceImpl.saveSurveyInfo(surveyInfoAllDto);
return ResponseHelper.buildResponse(returnDto); return ResponseHelper.buildResponse(returnDto);
} }
/**
* 勘察信息编辑
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "勘察信息编辑", notes = "勘察信息编辑")
@GetMapping(value = "/surveyQuery")
public ResponseModel<SurveyInfoAllDto> surveyQuery(@RequestParam String surveyInformationId) {
SurveyInfoAllDto returnDto = surveyInformationServiceImpl.querySurveyInfo(surveyInformationId);
return ResponseHelper.buildResponse(returnDto);
}
} }
package com.yeejoin.amos.boot.module.hygf.biz.service.impl; package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.dto.*; import com.yeejoin.amos.boot.module.hygf.api.dto.*;
import com.yeejoin.amos.boot.module.hygf.api.entity.*; import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.mapper.SurveyInformationMapper; 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.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List; import java.util.List;
/** /**
...@@ -33,6 +43,13 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -33,6 +43,13 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
@Autowired @Autowired
CommercialServiceImpl commercialService; CommercialServiceImpl commercialService;
@Autowired
PeasantHouseholdServiceImpl peasantHouseholdServiceImpl;
@Autowired
RedisUtils redisUtils;
private static final String regionRedis="app_region_redis";
/** /**
...@@ -53,7 +70,7 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -53,7 +70,7 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
public SurveyInfoAllDto saveSurveyInfo(SurveyInfoAllDto surveyInfoAllDto) { public SurveyInfoAllDto saveSurveyInfo(SurveyInfoAllDto surveyInfoAllDto) {
SurveyInformation surveyInformation = BeanDtoUtils.convert(surveyInfoAllDto.getSurveyInformation(), SurveyInformation.class); SurveyInformation surveyInformation = BeanDtoUtils.convert(surveyInfoAllDto.getSurveyInformation(), SurveyInformation.class);
this.save(surveyInformation); this.saveOrUpdate(surveyInformation);
SurveyDetails surveyDetails = BeanDtoUtils.convert(surveyInfoAllDto.getSurveyDetails(), SurveyDetails.class); SurveyDetails surveyDetails = BeanDtoUtils.convert(surveyInfoAllDto.getSurveyDetails(), SurveyDetails.class);
surveyDetailsService.save(surveyDetails.setSurveyInformationId(surveyInformation.getSequenceNbr())); surveyDetailsService.save(surveyDetails.setSurveyInformationId(surveyInformation.getSequenceNbr()));
...@@ -69,4 +86,73 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -69,4 +86,73 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
return surveyInfoAllDto; return surveyInfoAllDto;
} }
public SurveyInfoAllDto querySurveyInfo(String surveyInformationId) {
SurveyInfoAllDto surveyInfoAllDto = new SurveyInfoAllDto();
SurveyInformation surveyInformation = this.getById(surveyInformationId);
surveyInfoAllDto.setSurveyInformation(BeanDtoUtils.convert(surveyInformation, SurveyInformationDto.class));
QueryWrapper<PeasantHousehold> peasantHouseholdQueryWrapper = new QueryWrapper<>();
peasantHouseholdQueryWrapper.eq("surveyInformationId", surveyInformationId);
PeasantHousehold peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdQueryWrapper);
BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation());
QueryWrapper<SurveyDetails> surveyDetailsQueryWrapper = new QueryWrapper<>();
surveyDetailsQueryWrapper.eq("surveyInformationId", surveyInformationId);
SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper);
surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class));
QueryWrapper<Information> informationQueryWrapper = new QueryWrapper<>();
surveyDetailsQueryWrapper.eq("surveyInformationId", surveyInformationId);
Information information = informationService.getBaseMapper().selectOne(informationQueryWrapper);
surveyInfoAllDto.setInformation(BeanDtoUtils.convert(information, InformationDto.class));
QueryWrapper<Commercial> commercialQueryWrapper = new QueryWrapper<>();
surveyDetailsQueryWrapper.eq("surveyInformationId", surveyInformationId);
Commercial commercial = commercialService.getBaseMapper().selectOne(commercialQueryWrapper);
surveyInfoAllDto.setCommercial(BeanDtoUtils.convert(commercial, CommercialDto.class));
QueryWrapper<ExtendedInformation> extendedInformationQueryWrapper = new QueryWrapper<>();
surveyDetailsQueryWrapper.eq("surveyInformationId", surveyInformationId);
ExtendedInformation extendedInformation = extendedInformationService.getBaseMapper().selectOne(extendedInformationQueryWrapper);
surveyInfoAllDto.setExtendedInformation(BeanDtoUtils.convert(extendedInformation, ExtendedInformationDto.class));
return surveyInfoAllDto;
}
public JSONArray getRegionName(){
JSONArray jsonArray = new JSONArray();
if (redisUtils.hasKey(regionRedis)) {
jsonArray= JSONArray.parseArray(redisUtils.get(regionRedis).toString());
}else {
Collection<RegionModel> regionChild = new ArrayList<>();
RegionModel regionModel1 = new RegionModel();
regionChild.add(regionModel1);
FeignClientResult<Collection<RegionModel>> collectionFeignClientResult = Systemctl.regionClient.queryForTreeParent(610000L);
Collection<RegionModel> result = collectionFeignClientResult.getResult();
for (RegionModel regionModel : result) {
for (RegionModel child : regionModel.getChildren()) {
for (RegionModel childChild : child.getChildren()) {
jsonArray.add(childChild);
}
child.setChildren(regionChild);
jsonArray.add(child);
}
regionModel.setChildren(regionChild);
jsonArray.add(regionModel);
}
redisUtils.set(regionRedis,jsonArray);
}
return jsonArray;
}
} }
\ No newline at end of file
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