房屋数据导出和搜索条件新增

This commit is contained in:
Renpc-kilig 2024-01-08 15:31:08 +08:00
parent acb7e3ebfb
commit 9d7b4d27cf
7 changed files with 1157 additions and 589 deletions

View File

@ -1,5 +1,6 @@
package com.cm.population.controller.api.house;
import com.alibaba.excel.EasyExcel;
import com.cm.common.annotation.CheckRequestBodyAnnotation;
import com.cm.common.base.AbstractController;
import com.cm.common.constants.ISystemConstant;
@ -18,6 +19,10 @@ import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -151,4 +156,50 @@ public class HouseController extends AbstractController {
return new SuccessResult();
}
@ApiOperation(value = "导出excel", notes = "导出excel接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("export")
public void excelPersonScore(HttpServletResponse response) throws Exception {
Map<String, Object> params = requestParams();
String excelName = "房屋数据";
String fileName = URLEncoder.encode(excelName, "UTF-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
String [] headers = {"街道名称","社区名称","小区名称","楼/排名称","所在单元/列","所在层/院","门牌号","房主名称","证件号码","联系电话",
"托管人姓名","证件号码","联系电话","与房主关系","自住","出租","空房"};
List<List<String>> listHeader = new ArrayList<>();
for(String item : headers) {
List<String> title = new ArrayList<>();
title.add(item);
listHeader.add(title);
}
List<HouseDTO> list = list();
List<List<Object>> listData = new ArrayList<>();
for (HouseDTO dto : list) {
List<Object> data = new ArrayList<>();
data.add(dto.getStreetName());
data.add(dto.getCommunityName());
data.add(dto.getResidentialName());
data.add(dto.getBuildingName());
data.add(dto.getAffiliationUnit());
data.add(dto.getAffiliationFloors());
data.add(dto.getHouseNum());
data.add(dto.getHomeowner());
data.add(dto.getDocumentNum());
data.add(dto.getPhone());
data.add(dto.getCustodian());
data.add(dto.getCustodianDocumentNum());
data.add(dto.getCustodianPhone());
data.add(dto.getRelationshipHomeowner());
data.add((dto.getIsSelf() != null && dto.getIsSelf() == 1) ? "": "");
data.add((dto.getIsRental() != null && dto.getIsRental() == 1) ? "": "");
data.add((dto.getIsVacant() != null && dto.getIsVacant() == 1) ? "": "");
listData.add(data);
}
EasyExcel.write(response.getOutputStream()).sheet("房屋数据").head(listHeader).doWrite(listData);
}
}

View File

@ -1,5 +1,6 @@
package com.cm.population.pojo.dtos.house;
import com.cm.common.annotation.CheckNumberAnnotation;
import com.cm.population.pojo.dtos.population.PopulationDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -131,6 +132,12 @@ public class HouseDTO {
private List<PopulationDTO> populationDTOList;
@ApiModelProperty(name = "count", value = "房屋人员")
private Integer count;
@ApiModelProperty(name = "isSelf", value = "是否自住房")
private Integer isSelf;
@ApiModelProperty(name = "ownerPopulationId", value = "房主人口ID")
private String ownerPopulationId;
@ApiModelProperty(name = "custodianPopulationId", value = "托管人人口ID")
private String custodianPopulationId;
public String getHouseId() {
return houseId;
@ -587,4 +594,28 @@ public class HouseDTO {
public void setCount(Integer count) {
this.count = count;
}
public Integer getIsSelf() {
return isSelf;
}
public void setIsSelf(Integer isSelf) {
this.isSelf = isSelf;
}
public String getOwnerPopulationId() {
return ownerPopulationId;
}
public void setOwnerPopulationId(String ownerPopulationId) {
this.ownerPopulationId = ownerPopulationId;
}
public String getCustodianPopulationId() {
return custodianPopulationId;
}
public void setCustodianPopulationId(String custodianPopulationId) {
this.custodianPopulationId = custodianPopulationId;
}
}

View File

@ -119,6 +119,13 @@ public class HouseVO {
private String streetName;
@ApiModelProperty(name = "populationVOList", value = "同住人信息")
private List<PopulationVO> populationVOList;
@ApiModelProperty(name = "isSelf", value = "是否自住房")
@CheckNumberAnnotation(name = "是否自住房")
private Integer isSelf;
@ApiModelProperty(name = "ownerPopulationId", value = "房主人口ID")
private String ownerPopulationId;
@ApiModelProperty(name = "custodianPopulationId", value = "托管人人口ID")
private String custodianPopulationId;
public String getCommunity() {
return community == null ? "" : community.trim();
@ -495,4 +502,28 @@ public class HouseVO {
public void setPopulationVOList(List<PopulationVO> populationVOList) {
this.populationVOList = populationVOList;
}
public Integer getIsSelf() {
return isSelf;
}
public void setIsSelf(Integer isSelf) {
this.isSelf = isSelf;
}
public String getOwnerPopulationId() {
return ownerPopulationId;
}
public void setOwnerPopulationId(String ownerPopulationId) {
this.ownerPopulationId = ownerPopulationId;
}
public String getCustodianPopulationId() {
return custodianPopulationId;
}
public void setCustodianPopulationId(String custodianPopulationId) {
this.custodianPopulationId = custodianPopulationId;
}
}

View File

@ -58,6 +58,9 @@
<result column="street" property="street"/>
<result column="street_name" property="streetName"/>
<result column="count" property="count"/>
<result column="is_self" property="isSelf"/>
<result column="owner_population_id" property="ownerPopulationId"/>
<result column="custodian_population_id" property="custodianPopulationId"/>
</resultMap>
<resultMap id="houseBO" type="com.cm.population.pojo.bos.house.HouseBO">
@ -220,14 +223,17 @@
affiliated_unit,
is_rental,
is_vacant,
is_self,
lodge_type_id,
lodge_type_name,
rental_purposes,
owner_population_id,
homeowner,
document_id,
document_name,
document_num,
phone,
custodian_population_id,
custodian,
custodian_document_id,
custodian_document_name,
@ -272,14 +278,17 @@
#{affiliatedUnit},
#{isRental},
#{isVacant},
#{isSelf},
#{lodgeTypeId},
#{lodgeTypeName},
#{rentalPurposes},
#{ownerPopulationId},
#{homeowner},
#{documentId},
#{documentName},
#{documentNum},
#{phone},
#{custodianPopulationId},
#{custodian},
#{custodianDocumentId},
#{custodianDocumentName},
@ -420,6 +429,9 @@
<if test="isVacant != null">
is_vacant = #{isVacant},
</if>
<if test="isSelf != null">
is_self = #{isSelf},
</if>
<if test="lodgeTypeId != null and lodgeTypeId != ''">
lodge_type_id = #{lodgeTypeId},
</if>
@ -429,6 +441,9 @@
<if test="rentalPurposes != null and rentalPurposes != ''">
rental_purposes = #{rentalPurposes},
</if>
<if test="ownerPopulationId != null and ownerPopulationId != ''">
owner_population_id = #{ownerPopulationId},
</if>
<if test="homeowner != null and homeowner != ''">
homeowner = #{homeowner},
</if>
@ -444,6 +459,9 @@
<if test="phone != null and phone != ''">
phone = #{phone},
</if>
<if test="custodianPopulationId != null and custodianPopulationId != ''">
custodian_population_id = #{custodianPopulationId},
</if>
<if test="custodian != null and custodian != ''">
custodian = #{custodian},
</if>
@ -504,14 +522,17 @@
t1.affiliated_unit,
t1.is_rental,
t1.is_vacant,
t1.is_self,
t1.lodge_type_id,
t1.lodge_type_name,
t1.rental_purposes,
t1.owner_population_id,
t1.homeowner,
t1.document_id,
t1.document_name,
t1.document_num,
t1.phone,
t1.custodian_population_id,
t1.custodian,
t1.custodian_document_id,
t1.custodian_document_name,
@ -696,14 +717,17 @@
t1.affiliated_unit,
t1.is_rental,
t1.is_vacant,
t1.is_self,
t1.lodge_type_id,
t1.lodge_type_name,
t1.rental_purposes,
t1.owner_population_id,
t1.homeowner,
t1.document_id,
t1.document_name,
t1.document_num,
t1.phone,
t1.owner_population_id,
t1.custodian,
t1.custodian_document_id,
t1.custodian_document_name,
@ -762,6 +786,9 @@
<if test="isVacant != null">
AND is_vacant = #{isVacant}
</if>
<if test="isSelf != null">
AND is_self = #{isSelf}
</if>
<if test="keywords != null and keywords != ''">
AND (
t1.house_num LIKE CONCAT('%', #{keywords}, '%')

File diff suppressed because it is too large Load Diff

View File

@ -228,20 +228,27 @@
</div>
</div>
<div class="layui-form-item layui-row" pane>
<div class="layui-col-xs6 layui-form-pane">
<div class="layui-col-xs4 layui-form-pane">
<label class="layui-form-label">是否出租屋</label>
<div class="layui-input-block">
<input type="radio" name="isRental" lay-filter="isRental" value="1" title="是">
<input type="radio" name="isRental" lay-filter="isRental" value="0" title="否" checked>
</div>
</div>
<div class="layui-col-xs6 layui-form-pane">
<div class="layui-col-xs4 layui-form-pane">
<label class="layui-form-label">是否空置房</label>
<div class="layui-input-block">
<input type="radio" name="isVacant" lay-filter="isVacant" value="1" title="是">
<input type="radio" name="isVacant" lay-filter="isVacant" value="0" title="否" checked>
</div>
</div>
<div class="layui-col-xs4 layui-form-pane">
<label class="layui-form-label">是否自住房</label>
<div class="layui-input-block">
<input type="radio" name="isSelf" lay-filter="isSelf" value="1" title="是">
<input type="radio" name="isSelf" lay-filter="isSelf" value="0" title="否" checked>
</div>
</div>
</div>
</div>
@ -283,6 +290,7 @@
<div class="layui-col-xs6">
<label class="layui-form-label">房主名称</label>
<div class="layui-input-block">
<input type="hidden" id="ownerPopulationId" name="ownerPopulationId" class="layui-input" value="" maxlength="255">
<input type="text" id="homeowner" name="homeowner" class="layui-input" value="" placeholder="请输入房主名称" maxlength="255">
</div>
</div>
@ -329,6 +337,7 @@
<div class="layui-col-xs6">
<label class="layui-form-label">托管人姓名</label>
<div class="layui-input-block">
<input type="hidden" id="custodianPopulationId" name="custodianPopulationId" class="layui-input" value="" maxlength="255">
<input type="text" id="custodian" name="custodian" class="layui-input" value="" placeholder="请输入托管人姓名" maxlength="255">
</div>
</div>

View File

@ -228,20 +228,27 @@
</div>
</div>
<div class="layui-form-item layui-row" pane>
<div class="layui-col-xs6 layui-form-pane">
<div class="layui-col-xs4 layui-form-pane">
<label class="layui-form-label">是否出租屋</label>
<div class="layui-input-block">
<input type="radio" name="isRental" lay-filter="isRental" value="1" title="是">
<input type="radio" name="isRental" lay-filter="isRental" value="0" title="否" checked>
</div>
</div>
<div class="layui-col-xs6 layui-form-pane">
<div class="layui-col-xs4 layui-form-pane">
<label class="layui-form-label">是否空置房</label>
<div class="layui-input-block">
<input type="radio" name="isVacant" lay-filter="isVacant" value="1" title="是">
<input type="radio" name="isVacant" lay-filter="isVacant" value="0" title="否" checked>
</div>
</div>
<div class="layui-col-xs4 layui-form-pane">
<label class="layui-form-label">是否自住房</label>
<div class="layui-input-block">
<input type="radio" name="isSelf" lay-filter="isSelf" value="1" title="是">
<input type="radio" name="isSelf" lay-filter="isSelf" value="0" title="否" checked>
</div>
</div>
</div>
</div>
@ -283,6 +290,7 @@
<div class="layui-col-xs6">
<label class="layui-form-label">房主名称</label>
<div class="layui-input-block">
<input type="hidden" id="ownerPopulationId" name="ownerPopulationId" class="layui-input" value="" maxlength="255">
<input type="text" id="homeowner" name="homeowner" class="layui-input" value="" placeholder="请输入房主名称" maxlength="255">
</div>
</div>
@ -329,6 +337,7 @@
<div class="layui-col-xs6">
<label class="layui-form-label">托管人姓名</label>
<div class="layui-input-block">
<input type="hidden" id="custodianPopulationId" name="custodianPopulationId" class="layui-input" value="" maxlength="255">
<input type="text" id="custodian" name="custodian" class="layui-input" value="" placeholder="请输入托管人姓名" maxlength="255">
</div>
</div>