Browse Source

居民信息采集-Excel导出

feature/syp_points
songyunpeng 5 years ago
parent
commit
8ad98afb53
  1. 2
      esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/utils/ExcelUtils.java
  2. 121
      esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/BasePopulationInformationExportDto.java
  3. 47
      esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/BaseResidentInformationExportDto.java
  4. 32
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/HousingInformationController.java
  5. 20
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/HousingInformationDao.java
  6. 163
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/excel/BasePopulationInformationExportExcel.java
  7. 56
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/excel/BaseResidentInformationExportExcel.java
  8. 4
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/HouseBusinessInfoService.java
  9. 19
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/HousingInformationService.java
  10. 2
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/HouseBusinessInfoServiceImpl.java
  11. 39
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/HousingInformationServiceImpl.java
  12. 27
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/PopulationInformationServiceImpl.java
  13. 84
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/HousingInformationDao.xml

2
esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/utils/ExcelUtils.java

@ -94,7 +94,7 @@ public class ExcelUtils {
* @param sheetNames sheet名字列表
*/
public static void exportExcelToTargetWithSheets(HttpServletResponse response, String fileName, List<String> sheetNames,
List<Class<?>> targetClassList,List<Object>... sourceList) throws Exception {
List<Class<?>> targetClassList,Collection<?>... sourceList) throws Exception {
if(sheetNames.size()!=targetClassList.size() && targetClassList.size()!=sourceList.length){
throw new RenException("参数传递出错");
}

121
esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/BasePopulationInformationExportDto.java

@ -0,0 +1,121 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dto;
import lombok.Data;
import java.math.BigDecimal;
/**
* 人口信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-08-19
*/
@Data
public class BasePopulationInformationExportDto {
private String id;
private String gridName;
private String houseAddress;
private String buyingTime;
private BigDecimal houseArea;
private String propertyOwner;
private String propertyOwnerIdentityNo;
private String propertyOwnerCard;
private String propertyOwnerMobile;
private String houseUse;
private String tenantName;
private String tenantPhone;
private String tenantIdentityNo;
private String enterpriseName;
private String socialUniformCode;
private String legalRepresentative;
private String enterprisePhone;
private String residentsName;
private String residentsSex;
private String residentsBirthday;
private String residentsNation;
private String educationLevel;
private String politicsStatus;
private String joinTime;
private String organizationalRelationshipLocation;
private String residentsIdentityNo;
private String residentsPhone;
private String bodyStatus;
private String maritalStatus;
private String accountType;
private String militaryService;
private String householdRegistrationPlace;
private String employmentStatus;
private String currentEmployer;
private String currentEmployerAddress;
private String unemploymentReason;
private String reemploymentPermit;
private String unemploymentRegister;
private String unemploymentRegisterTime;
private String familyCategory;
private String helpStatus;
private Integer motorVehicleNum;
private String motorVehicleCategory;
private String dogStatus;
}

47
esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/BaseResidentInformationExportDto.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dto;
import lombok.Data;
/**
* 人口信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-08-19
*/
@Data
public class BaseResidentInformationExportDto {
private String houseHeadName;
private String residentsIdentityNo;
private String houseHeadRelation;
private String residentsName;
private String residentsSex;
private String residentsNation;
private String currentEmployer;
private String currentAddress;
}

32
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/HousingInformationController.java

@ -17,7 +17,9 @@
package com.elink.esua.epdc.controller;
import com.elink.esua.epdc.commons.tools.exception.RenException;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
@ -25,10 +27,13 @@ import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.dto.BasePopulationInformationExportDto;
import com.elink.esua.epdc.dto.BaseResidentInformationExportDto;
import com.elink.esua.epdc.dto.HousingInformationDTO;
import com.elink.esua.epdc.excel.BasePopulationInformationExcel;
import com.elink.esua.epdc.excel.BasePopulationInformationExportExcel;
import com.elink.esua.epdc.excel.BaseResidentInformationExcel;
import com.elink.esua.epdc.excel.HousingInformationExcel;
import com.elink.esua.epdc.excel.BaseResidentInformationExportExcel;
import com.elink.esua.epdc.service.HousingInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -39,6 +44,8 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
@ -90,8 +97,23 @@ public class HousingInformationController {
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<HousingInformationDTO> list = housingInformationService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, HousingInformationExcel.class);
//查询房屋和人口信息
List<BasePopulationInformationExportDto> basePopulationInformationExcelList = housingInformationService.selectBasePopulationInformationExcelList(params);
if(basePopulationInformationExcelList == null || basePopulationInformationExcelList.size()==0){
throw new RenException("数据为空");
}
//根据获取的户主ID查询居住人信息
Map<String,List<BasePopulationInformationExportDto>> baseMap = basePopulationInformationExcelList.stream().collect(Collectors.groupingBy(BasePopulationInformationExportDto::getId));
//获取所有的户主ID
Set<String> houseHeadIds = baseMap.keySet();
List<BaseResidentInformationExportDto> baseResidentInformationExportDtoList = housingInformationService.selectBaseResidentInformationExcelList(houseHeadIds);
List<Class<?>> classes = new ArrayList<>(2);
classes.add(BasePopulationInformationExportExcel.class);
classes.add(BaseResidentInformationExportExcel.class);
List<String> sheetNames = new ArrayList<>(2);
sheetNames.add("房屋信息和户主信息");
sheetNames.add("居民信息");
ExcelUtils.exportExcelToTargetWithSheets(response, "居民信息导出",sheetNames,classes, ConvertUtils.sourceToTarget(basePopulationInformationExcelList, BasePopulationInformationExportExcel.class),ConvertUtils.sourceToTarget(baseResidentInformationExportDtoList,BaseResidentInformationExportExcel.class));
}
/**
@ -117,8 +139,8 @@ public class HousingInformationController {
**/
@GetMapping("exportModule")
public void exportModule(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<Object> basePopulationInformationExcels = new ArrayList<>(1);
List<Object> baseResidentInformationExcels = new ArrayList<>(1);
List<BasePopulationInformationExcel> basePopulationInformationExcels = new ArrayList<>(1);
List<BaseResidentInformationExcel> baseResidentInformationExcels = new ArrayList<>(1);
BasePopulationInformationExcel basePopulationInformationExcel = new BasePopulationInformationExcel();
basePopulationInformationExcel.setHouseAddress("XX家园XX号楼XX单元XXX");
basePopulationInformationExcel.setBuyingTime("2020-02-02");

20
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/HousingInformationDao.java

@ -18,12 +18,16 @@
package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.dto.BasePopulationInformationExportDto;
import com.elink.esua.epdc.dto.BaseResidentInformationExportDto;
import com.elink.esua.epdc.dto.HousingInformationDTO;
import com.elink.esua.epdc.entity.HousingInformationEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 房屋信息表
@ -49,4 +53,20 @@ public interface HousingInformationDao extends BaseDao<HousingInformationEntity>
* @return com.elink.esua.epdc.dto.HousingInformationDTO
**/
HousingInformationDTO selectByIdAndUsed(Map<String, Object> params);
/**
* @Description 查询导出的 房屋信息和户主信息
* @Author songyunpeng
* @Date 2020/9/1
* @Param [params]
* @return java.util.List<com.elink.esua.epdc.excel.BasePopulationInformationExcel>
**/
List<BasePopulationInformationExportDto> selectBasePopulationInformationExcelList(Map<String, Object> params);
/**
* @Description 根据户主ID列表获取居住人信息
* @Author songyunpeng
* @Date 2020/9/1
* @Param [houseHeadIds]
* @return java.util.List<com.elink.esua.epdc.dto.BaseResidentInformationExportDto>
**/
List<BaseResidentInformationExportDto> selectBaseResidentInformationExcelList(@Param("houseHeadIds") Set<String> houseHeadIds);
}

163
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/excel/BasePopulationInformationExportExcel.java

@ -0,0 +1,163 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.math.BigDecimal;
/**
* 人口信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-08-19
*/
@Data
public class BasePopulationInformationExportExcel {
@Excel(name = "所属网格")
private String gridName;
@Excel(name = "房屋地址")
private String houseAddress;
@Excel(name = "购房时间")
private String buyingTime;
@Excel(name = "房屋面积")
private BigDecimal houseArea;
@Excel(name = "产权人姓名")
private String propertyOwner;
@Excel(name = "产权人身份证号")
private String propertyOwnerIdentityNo;
@Excel(name = "产权证")
private String propertyOwnerCard;
@Excel(name = "产权人联系电话")
private String propertyOwnerMobile;
@Excel(name = "房屋用途",replace = {"自住_0","租赁_1","经营_2"})
private String houseUse;
@Excel(name = "承租人姓名")
private String tenantName;
@Excel(name = "承租人电话")
private String tenantPhone;
@Excel(name = "承租人身份证号")
private String tenantIdentityNo;
@Excel(name = "企业名称")
private String enterpriseName;
@Excel(name = "社会统一代码")
private String socialUniformCode;
@Excel(name = "法人代表")
private String legalRepresentative;
@Excel(name = "电话")
private String enterprisePhone;
@Excel(name = "户主姓名")
private String residentsName;
@Excel(name = "性别",replace = {"女_0","男_1"})
private String residentsSex;
@Excel(name = "出生年月")
private String residentsBirthday;
@Excel(name = "民族")
private String residentsNation;
@Excel(name = "文化程度")
private String educationLevel;
@Excel(name = "政治面貌",replace = {"群众_0","党员_1"})
private String politicsStatus;
@Excel(name = "入党时间")
private String joinTime;
@Excel(name = "组织关系所在地")
private String organizationalRelationshipLocation;
@Excel(name = "身份证号码")
private String residentsIdentityNo;
@Excel(name = "户主联系电话")
private String residentsPhone;
@Excel(name = "身体状况",replace = {"病残_0","健康_1"})
private String bodyStatus;
@Excel(name = "婚姻状况",replace = {"未婚_0","已婚_1"})
private String maritalStatus;
@Excel(name = "户口类型",replace = {"城镇_0","农业_1"})
private String accountType;
@Excel(name = "服兵役",replace = {"否_0","是_1"})
private String militaryService;
@Excel(name = "户籍地")
private String householdRegistrationPlace;
@Excel(name = "就业情况",replace = {"在岗_0","失业_1"})
private String employmentStatus;
@Excel(name = "现工作单位")
private String currentEmployer;
@Excel(name = "现单位地址")
private String currentEmployerAddress;
@Excel(name = "失业原因",replace = {"原单位破产_0","解除合同_1","效益不好_2","减员_3","其他_4"})
private String unemploymentReason;
@Excel(name = "再就业优惠证",replace = {"无_0","有_1"})
private String reemploymentPermit;
@Excel(name = "失业登记",replace = {"否_0","是_1"})
private String unemploymentRegister;
@Excel(name = "失业登记时间")
private String unemploymentRegisterTime;
@Excel(name = "家庭类别",replace = {"普通家庭_0","军烈_2","优抚_3","困难家庭_6"})
private String familyCategory;
@Excel(name = "救助情况",replace = {"低保_0","大病_1","廉租_2","教育_3","临时_4","其他_5"})
private String helpStatus;
@Excel(name = "机动车数量")
private Integer motorVehicleNum;
@Excel(name = "机动车类型",replace = {"轿车_0","摩托_1","其他_2"})
private String motorVehicleCategory;
@Excel(name = "宠物犬状况",replace = {"无_0","有_1"})
private String dogStatus;
}

56
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/excel/BaseResidentInformationExportExcel.java

@ -0,0 +1,56 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
/**
* 人口信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-08-19
*/
@Data
public class BaseResidentInformationExportExcel {
@Excel(name = "户主身份证号码")
private String residentsIdentityNo;
@Excel(name = "户主姓名")
private String houseHeadName;
@Excel(name = "与户主关系",replace = {"子女_0","夫妻_1","其他_2","父母_3"})
private String houseHeadRelation;
@Excel(name = "居住人姓名")
private String residentsName;
@Excel(name = "性别",replace = {"女_0","男_1"})
private String residentsSex;
@Excel(name = "民族")
private String residentsNation;
@Excel(name = "现工作单位")
private String currentEmployer;
@Excel(name = "现居住地")
private String currentAddress;
}

4
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/HouseBusinessInfoService.java

@ -94,13 +94,13 @@ public interface HouseBusinessInfoService extends BaseService<HouseBusinessInfoE
void delete(String[] ids);
/**
* @Description 根据房屋ID查询承租人信息
* @Description 根据房屋ID查询企业经营信息
* @Author songyunpeng
* @Date 2020/8/19
* @Param [houseID]
* @return com.elink.esua.epdc.entity.HouseRentInfoEntity
**/
HouseBusinessInfoEntity getHouseRentInfoEntityByHouseId(String houseID);
HouseBusinessInfoEntity getHouseBusinessInfoEntityByHouseId(String houseID);
/**
* @Description 前端类表
* @Author songyunpeng

19
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/HousingInformationService.java

@ -20,12 +20,15 @@ package com.elink.esua.epdc.service;
import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.BasePopulationInformationExportDto;
import com.elink.esua.epdc.dto.BaseResidentInformationExportDto;
import com.elink.esua.epdc.dto.HousingInformationDTO;
import com.elink.esua.epdc.entity.HousingInformationEntity;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 房屋信息表
@ -110,4 +113,20 @@ public interface HousingInformationService extends BaseService<HousingInformatio
* @return com.elink.esua.epdc.commons.tools.utils.Result
**/
Result importPopulationInfo(MultipartFile file,String gridId);
/**
* @Description 查询导出的 房屋信息和户主信息
* @Author songyunpeng
* @Date 2020/9/1
* @Param [params]
* @return java.util.List<com.elink.esua.epdc.excel.BasePopulationInformationExcel>
**/
List<BasePopulationInformationExportDto> selectBasePopulationInformationExcelList(Map<String, Object> params);
/**
* @Description 根据户主ID列表获取居住人信息
* @Author songyunpeng
* @Date 2020/9/1
* @Param [houseHeadIds]
* @return java.util.List<com.elink.esua.epdc.dto.BaseResidentInformationExportDto>
**/
List<BaseResidentInformationExportDto> selectBaseResidentInformationExcelList(Set<String> houseHeadIds);
}

2
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/HouseBusinessInfoServiceImpl.java

@ -101,7 +101,7 @@ public class HouseBusinessInfoServiceImpl extends BaseServiceImpl<HouseBusinessI
}
@Override
public HouseBusinessInfoEntity getHouseRentInfoEntityByHouseId(String houseID) {
public HouseBusinessInfoEntity getHouseBusinessInfoEntityByHouseId(String houseID) {
Map<String,Object> params = new HashMap<>();
params.put("HOUSE_ID", houseID);
List<HouseBusinessInfoEntity> houseBusinessInfoEntities = baseDao.selectByMap(params);

39
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/HousingInformationServiceImpl.java

@ -35,10 +35,7 @@ import com.elink.esua.epdc.constant.HouseUseConstant;
import com.elink.esua.epdc.constant.PopulationDictConstant;
import com.elink.esua.epdc.dao.HouseResidentDao;
import com.elink.esua.epdc.dao.HousingInformationDao;
import com.elink.esua.epdc.dto.HousingInformationDTO;
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO;
import com.elink.esua.epdc.dto.SysPopulationSimpleDictDTO;
import com.elink.esua.epdc.dto.SysSimpleDictDTO;
import com.elink.esua.epdc.dto.*;
import com.elink.esua.epdc.dto.epdc.form.SysPopulationSimpleDictFormDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcPopulationErrorResultDTO;
import com.elink.esua.epdc.entity.*;
@ -193,6 +190,11 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform
houseRentInfoEntity.setTenantPhone(dto.getTenantPhone());
houseRentInfoEntity.setHouseId(entity.getId());
houseRentInfoService.insert(houseRentInfoEntity);
//删除企业信息
HouseBusinessInfoEntity oldHouseBusinessInfoEntity = houseBusinessInfoService.getHouseBusinessInfoEntityByHouseId(entity.getId());
if(oldHouseBusinessInfoEntity!=null){
houseBusinessInfoService.deleteById(oldHouseBusinessInfoEntity.getId());
}
} else {
oldHouseRentInfoEntity.setTenantIdentityNo(dto.getTenantIdentityNo());
oldHouseRentInfoEntity.setTenantName(dto.getTenantName());
@ -201,7 +203,7 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform
houseRentInfoService.updateById(oldHouseRentInfoEntity);
}
} else if (HouseUseConstant.BUSINESS.equals(dto.getHouseUse())) {
HouseBusinessInfoEntity oldHouseBusinessInfoEntity = houseBusinessInfoService.getHouseRentInfoEntityByHouseId(entity.getId());
HouseBusinessInfoEntity oldHouseBusinessInfoEntity = houseBusinessInfoService.getHouseBusinessInfoEntityByHouseId(entity.getId());
if (oldHouseBusinessInfoEntity == null) {
HouseBusinessInfoEntity houseBusinessInfoEntity = new HouseBusinessInfoEntity();
houseBusinessInfoEntity.setEnterpriseName(dto.getEnterpriseName());
@ -210,6 +212,11 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform
houseBusinessInfoEntity.setSocialUniformCode(dto.getSocialUniformCode());
houseBusinessInfoEntity.setHouseId(entity.getId());
houseBusinessInfoService.insert(houseBusinessInfoEntity);
//删除承租信息
HouseRentInfoEntity oldHouseRentInfoEntity = houseRentInfoService.getHouseRentInfoEntityByHouseId(entity.getId());
if(oldHouseRentInfoEntity!=null){
houseRentInfoService.deleteById(oldHouseRentInfoEntity.getId());
}
} else {
oldHouseBusinessInfoEntity.setEnterpriseName(dto.getEnterpriseName());
oldHouseBusinessInfoEntity.setEnterprisePhone(dto.getEnterprisePhone());
@ -218,6 +225,17 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform
oldHouseBusinessInfoEntity.setHouseId(entity.getId());
houseBusinessInfoService.updateById(oldHouseBusinessInfoEntity);
}
}else if (HouseUseConstant.SINCE_THE_LIVING.equals(dto.getHouseUse())) {
//删除企业信息
HouseBusinessInfoEntity oldHouseBusinessInfoEntity = houseBusinessInfoService.getHouseBusinessInfoEntityByHouseId(entity.getId());
if(oldHouseBusinessInfoEntity!=null){
houseBusinessInfoService.deleteById(oldHouseBusinessInfoEntity.getId());
}
//删除承租信息
HouseRentInfoEntity oldHouseRentInfoEntity = houseRentInfoService.getHouseRentInfoEntityByHouseId(entity.getId());
if(oldHouseRentInfoEntity!=null){
houseRentInfoService.deleteById(oldHouseRentInfoEntity.getId());
}
}
}
@ -321,6 +339,17 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform
}
return new Result();
}
@Override
public List<BasePopulationInformationExportDto> selectBasePopulationInformationExcelList(Map<String, Object> params) {
return baseDao.selectBasePopulationInformationExcelList(params);
}
@Override
public List<BaseResidentInformationExportDto> selectBaseResidentInformationExcelList(Set<String> houseHeadIds) {
return baseDao.selectBaseResidentInformationExcelList(houseHeadIds);
}
/**
* @Description 校验完成后插入居民信息
* @Author songyunpeng

27
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/PopulationInformationServiceImpl.java

@ -17,6 +17,7 @@
package com.elink.esua.epdc.service.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
@ -143,6 +144,19 @@ public class PopulationInformationServiceImpl extends BaseServiceImpl<Population
PopulationInformationEntity infoByIdentityNo = selectById(dto.getId());
if(dto.getResidentsIdentityNo().equals(infoByIdentityNo.getResidentsIdentityNo())){
PopulationInformationEntity entity = ConvertUtils.sourceToTarget(dto, PopulationInformationEntity.class);
//置空其他选择信息-防止导出时数据出错
if("0".equals(dto.getPoliticsStatus())){
//如果表单选择的是群众,则清空入党时间和组织关系所在地
entity.setJoinTime(DateUtil.parse("0000-00-00"));
entity.setOrganizationalRelationshipLocation("");
}
if("0".equals(dto.getEmploymentStatus())){
//如果表单选择的是在岗,则清空失业原因,再就业优惠政,失业登记和失业登记时间
entity.setUnemploymentReason("");
entity.setReemploymentPermit("");
entity.setUnemploymentRegister("");
entity.setUnemploymentRegisterTime(DateUtil.parse("0000-00-00"));
}
updateById(entity);
return new Result();
}else {
@ -164,6 +178,19 @@ public class PopulationInformationServiceImpl extends BaseServiceImpl<Population
//2.第二次提交,则更新户主信息
PopulationInformationEntity entity = ConvertUtils.sourceToTarget(dto, PopulationInformationEntity.class);
entity.setId(infoByIdentityNo.getId());
//置空其他选择信息-防止导出时数据出错
if("0".equals(dto.getPoliticsStatus())){
//如果表单选择的是群众,则清空入党时间和组织关系所在地
entity.setJoinTime(DateUtil.parse("0000-00-00"));
entity.setOrganizationalRelationshipLocation("");
}
if("0".equals(dto.getEmploymentStatus())){
//如果表单选择的是在岗,则清空失业原因,再就业优惠政,失业登记和失业登记时间
entity.setUnemploymentReason("");
entity.setReemploymentPermit("");
entity.setUnemploymentRegister("");
entity.setUnemploymentRegisterTime(DateUtil.parse("0000-00-00"));
}
updateById(entity);
return new Result();
}

84
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/HousingInformationDao.xml

@ -92,6 +92,90 @@
</if>
where t.DEL_FLAG ='0' and t.ID = #{id}
</select>
<select id="selectBasePopulationInformationExcelList"
resultType="com.elink.esua.epdc.dto.BasePopulationInformationExportDto">
select
t2.ID,
t.HOUSE_ADDRESS,
t.BUYING_TIME,
t.HOUSE_AREA,
t.PROPERTY_OWNER,
t.PROPERTY_OWNER_IDENTITY_NO,
t.PROPERTY_OWNER_MOBILE,
t.PROPERTY_OWNER_CARD,
t.HOUSE_USE,
SUBSTRING_INDEX(t.ALL_DEPT_NAMES, '-', -1) as gridName,
t3.TENANT_NAME,
t3.TENANT_PHONE,
t4.ENTERPRISE_NAME,
t4.SOCIAL_UNIFORM_CODE,
t4.LEGAL_REPRESENTATIVE,
t4.ENTERPRISE_PHONE,
t2.RESIDENTS_NAME,
t2.RESIDENTS_SEX,
t2.RESIDENTS_NATION,
t2.RESIDENTS_BIRTHDAY,
t2.EDUCATION_LEVEL,
t2.POLITICS_STATUS,
t2.JOIN_TIME,
t2.ORGANIZATIONAL_RELATIONSHIP_LOCATION,
t2.RESIDENTS_IDENTITY_NO,
t2.RESIDENTS_PHONE,
t2.BODY_STATUS,
t2.MARITAL_STATUS,
t2.ACCOUNT_TYPE,
t2.MILITARY_SERVICE,
t2.HOUSEHOLD_REGISTRATION_PLACE,
t2.EMPLOYMENT_STATUS,
t2.CURRENT_EMPLOYER,
t2.CURRENT_EMPLOYER_ADDRESS,
t2.UNEMPLOYMENT_REASON,
t2.REEMPLOYMENT_PERMIT,
t2.UNEMPLOYMENT_REGISTER,
t2.UNEMPLOYMENT_REGISTER_TIME,
t2.FAMILY_CATEGORY,
t2.HELP_STATUS,
t2.MOTOR_VEHICLE_NUM,
t2.MOTOR_VEHICLE_CATEGORY,
t2.DOG_STATUS
from epdc_housing_information t
left join epdc_house_resident t1 on t1.HOUSE_ID = t.ID and t1.DEL_FLAG = '0'
left join epdc_population_information t2 on t1.RESIDENT_ID = t2.ID and t2.DEL_FLAG = '0'
left join epdc_house_rent_info t3 on t.ID = t3.HOUSE_ID and t3.DEL_FLAG = '0'
left join epdc_house_business_info t4 on t.ID = t4.HOUSE_ID and t4.DEL_FLAG = '0'
where t.DEL_FLAG = '0' and t2.RESIDENTS_IDENTITY_NO != '' and t2.RESIDENTS_IDENTITY_NO is not null
<if test="houseAddress != '' and houseAddress != null">and t.HOUSE_ADDRESS like concat('%',#{houseAddress},'%') </if>
<if test="propertyOwner != '' and propertyOwner != null">and t.PROPERTY_OWNER like concat('%',#{propertyOwner},'%')</if>
<if test="propertyOwnerMobile != '' and propertyOwnerMobile != null">and t.PROPERTY_OWNER_MOBILE like concat('%',#{propertyOwnerMobile},'%')</if>
<if test="houseUse != '' and houseUse != null">and t.HOUSE_USE = #{houseUse}</if>
<if test="streetId != '' and streetId != null">
AND (find_in_set(#{streetId},t.PARENT_DEPT_IDS)
OR find_in_set(#{streetId},t.ALL_DEPT_IDS))
</if>
<if test="communityId != '' and communityId != null">
AND (find_in_set(#{communityId},t.PARENT_DEPT_IDS)
OR find_in_set(#{communityId},t.ALL_DEPT_IDS))
</if>
<if test="gridId != '' and gridId != null">
and (t.grid_id = #{gridId}
OR find_in_set(#{gridId},t.ALL_DEPT_IDS))
</if>
order by t.CREATED_TIME desc
</select>
<select id="selectBaseResidentInformationExcelList"
resultType="com.elink.esua.epdc.dto.BaseResidentInformationExportDto">
select t2.RESIDENTS_NAME as houseHeadName,t2.RESIDENTS_IDENTITY_NO,t1.RESIDENTS_NAME,t.HOUSE_HEAD_RELATION,t1.RESIDENTS_SEX,t1.RESIDENTS_NATION,t1.CURRENT_EMPLOYER,t1.CURRENT_ADDRESS
from epdc_house_resident t
left join epdc_population_information t1 on t.RESIDENT_ID = t1.ID
left join epdc_population_information t2 on t.HOUSE_HEAD_ID = t2.ID
where t.DEL_FLAG ='0' and t1.DEL_FLAG = '0'
and t.HOUSE_HEAD_ID in
<foreach collection="houseHeadIds" index="index" item="houseHeadId" open="(" separator="," close=")">
#{houseHeadId}
</foreach>
order by t.CREATED_TIME desc
</select>
</mapper>
Loading…
Cancel
Save