Browse Source

导出一户一档 暂存2

dev
jianjun 3 years ago
parent
commit
67abec4113
  1. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/handler/ExcelFillCellMergeStrategy.java
  2. 159
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseMemberResultDTO.java
  3. 42
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java
  4. 79
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java
  5. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/RentTenantDataFormDTO.java
  6. 175
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/HouseIcResiUserResultDTO.java
  7. 6
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  8. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  9. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  10. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  11. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
  12. 33
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  13. 53
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

4
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/handler/ExcelFillCellMergeStrategy.java

@ -91,9 +91,9 @@ public class ExcelFillCellMergeStrategy implements CellWriteHandler {
// 将当前单元格数据与上一个单元格数据比较 // 将当前单元格数据与上一个单元格数据比较
Boolean dataBool = preData.equals(curData); Boolean dataBool = preData.equals(curData);
//此处需要注意:因为我是按照序号确定是否需要合并的,所以获取每一行第一列数据和上一行第一列数据进行比较,如果相等合并 //此处需要注意:因为我是按照序号确定是否需要合并的,所以获取每一行第一列数据和上一行第一列数据进行比较,如果相等合并
Boolean bool = cell.getRow().getCell(0).getStringCellValue().equals(cell.getSheet().getRow(curRowIndex - 1).getCell(0).getStringCellValue());
if (!dataBool || !bool) {
if (!dataBool) {
return; return;
} }
Sheet sheet = writeSheetHolder.getSheet(); Sheet sheet = writeSheetHolder.getSheet();

159
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseMemberResultDTO.java

@ -1,9 +1,10 @@
package com.epmet.dto.result; package com.epmet.dto.result;
import com.epmet.commons.tools.dto.form.PageFormDTO; import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
import java.util.List; import java.io.Serializable;
/** /**
* desc:房屋和房屋成员返回结果类 * desc:房屋和房屋成员返回结果类
@ -13,27 +14,173 @@ import java.util.List;
* @version: 1.0 * @version: 1.0
*/ */
@Data @Data
public class HouseMemberResultDTO extends PageFormDTO { public class HouseMemberResultDTO implements Serializable {
private static final long serialVersionUID = 4574743024782401136L; private static final long serialVersionUID = 1L;
@ExcelProperty(value = {"房屋信息","所属组织"},index = 1)
private String agencyName; private String agencyName;
@ExcelProperty(value = {"房屋信息","所属网格"},index = 2)
private String gridName; private String gridName;
@ExcelIgnore
private String neighborHoodId;
@ExcelProperty(value = {"房屋信息","所属小区"},index = 3)
private String neighborHoodName; private String neighborHoodName;
@ExcelIgnore
private String buildingId;
@ExcelIgnore
private String houseId;
@ExcelProperty(value = {"房屋信息","所属楼栋"},index = 4)
private String buildingName; private String buildingName;
@ExcelProperty(value = {"房屋信息","单元"},index = 5)
private String unitName; private String unitName;
/** /**
* 门牌号 * 门牌号
*/ */
@ExcelProperty(value = {"房屋信息","门牌号"},index = 6)
private String doorName; private String doorName;
/** /**
* 房屋类型1楼房2平房3别墅 * 房屋类型1楼房2平房3别墅
*/ */
@ExcelProperty(value = {"房屋信息","房屋类型"},index = 7)
private String houseType; private String houseType;
/** /**
* 家庭成员 * 房屋用途
*/ */
public static List<IcHouseMemberResultDTO> memberList; @ExcelProperty(value = {"房屋信息","房屋用途"},index = 8)
private String purpose;
/**
* 房屋状态
*/
@ExcelProperty(value = {"房屋信息","房屋状态"},index = 9)
private String rentFlag;
/**
* 房主姓名
*/
@ExcelProperty(value = {"房屋信息","房主姓名"},index = 10)
private String ownerName;
/**
* 房主电话
*/
@ExcelProperty(value = {"房屋信息","房主电话"},index = 11)
private String ownerPhone;
/**
* 房主身份证
*/
@ExcelProperty(value = {"房屋信息","房主身份证"},index = 12)
private String ownerIdCard;
//居民信息/**/
/**
* 主键
*/
@ExcelIgnore
private String id;
/**
* 姓名
*/
@ExcelProperty(value = {"实际居住人息","姓名"},index = 13)
private String name;
/**
* 性别
*/
@ExcelProperty(value = {"实际居住人息","性别"},index = 14)
private String gender;
/**
* 手机号
*/
@ExcelProperty(value = {"实际居住人息","手机号"},index = 15)
private String mobile;
/**
* 身份证号
*/
@ExcelProperty(value = {"实际居住人息","身份证号"},index = 16)
private String idCard;
/**
* 出生日期
*/
@ExcelProperty(value = {"实际居住人息","出生日期"},index = 17)
private String birthday;
/**
* 户籍所在地
*/
@ExcelProperty(value = {"实际居住人息","户籍所在地"},index = 18)
private String hjszd;
/**
* 与户主关系字典表
*/
@ExcelProperty(value = {"实际居住人息","与户主关系"},index = 19)
private String yhzgx;
/**
* 是否党员
*/
@ExcelProperty(value = {"实际居住人息","是否党员"},index = 20)
private String isParty;
/**
* 是否租户
*/
@ExcelProperty(value = {"实际居住人息","是否租户"},index = 21)
private String isTenant;
/**
* 是否流动人口
*/
@ExcelProperty(value = {"实际居住人息","是否流动人口"},index = 22)
private String isFloating;
/**
* 工作单位
*/
@ExcelProperty(value = {"实际居住人息","工作单位"},index = 23)
private String gzdw;
/**
* 民族字典表
*/
@ExcelProperty(value = {"实际居住人息","民族"},index = 24)
private String mz;
/**
* 籍贯
*/
@ExcelProperty(value = {"实际居住人息","籍贯"},index = 25)
private String jg;
/**
* 婚姻状况字典表
*/
@ExcelProperty(value = {"实际居住人息","婚姻状况"},index = 26)
private String hyzk;
/**
* 文化程度字典表
*/
@ExcelProperty(value = {"实际居住人息","文化程度"},index = 27)
private String culture;
/**
* 宗教信仰
*/
@ExcelProperty(value = {"实际居住人息","宗教信仰"},index = 28)
private String faith;
/**
* 备注
*/
@ExcelProperty(value = {"实际居住人息","备注"},index = 29)
private String remarks;
} }

42
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java

@ -21,6 +21,9 @@ import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.annotation.MaskResponse; import com.epmet.commons.tools.annotation.MaskResponse;
@ -34,6 +37,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.poi.excel.handler.ExcelFillCellMergeStrategy;
import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.constants.ImportTaskConstants; import com.epmet.constants.ImportTaskConstants;
@ -45,6 +49,8 @@ import com.epmet.service.HouseService;
import com.epmet.util.ExcelPoiUtils; import com.epmet.util.ExcelPoiUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -326,22 +332,42 @@ public class HouseController implements ResultDataResolver {
@NoRepeatSubmit @NoRepeatSubmit
@RequestMapping(value = "/exportHouseUser") @RequestMapping(value = "/exportHouseUser")
public void exportHouseUser(@LoginUser TokenDto tokenDto, @RequestBody IcHouseListFormDTO formDTO, HttpServletResponse response) throws Exception { public void exportHouseUser(@LoginUser TokenDto tokenDto, @RequestBody IcHouseListFormDTO formDTO, HttpServletResponse response) throws Exception {
formDTO.setIsPage(false);
formDTO.setPageSize(NumConstant.ONE_THOUSAND);
//效验数据 //效验数据
LoginUserDetailsResultDTO loginUserDetail = getLoginUserDetailsResultDTO(tokenDto, "【查询房屋】查询当前staff所在组织信息失败"); if (StringUtils.isBlank(formDTO.getAgencyId())){
formDTO.setAgencyId(loginUserDetail.getAgencyId()); LoginUserDetailsResultDTO loginUserDetail = getLoginUserDetailsResultDTO(tokenDto, "【查询房屋】查询当前staff所在组织信息失败");
formDTO.setAgencyId(loginUserDetail.getAgencyId());
}
ValidatorUtils.validateEntity(formDTO); ValidatorUtils.validateEntity(formDTO);
ExcelWriter excelWriter = null; ExcelWriter excelWriter = null;
try { try {
excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel("一户一档信息.xlsx", response)) excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel("一户一档信息.xlsx", response), HouseMemberResultDTO.class)
.registerWriteHandler(new FreezeAndFilter()) .registerWriteHandler(new FreezeAndFilter())
.build(); .build();
int[] mergeRowArr = new int[]{0,1,2,3,4,5,6,7,8,9,10};
WriteSheet writeSheet = EasyExcel.writerSheet().build();
// 头的策略
WriteCellStyle headWriteCellStyle = new WriteCellStyle();
// 背景设置为红色
headWriteCellStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex());
WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle);
FreezeAndFilter writeHandler = new FreezeAndFilter();
ExcelFillCellMergeStrategy mergeStrategy = new ExcelFillCellMergeStrategy(2,mergeRowArr);
WriteSheet writeSheet = EasyExcel.writerSheet().registerWriteHandler(mergeStrategy)
.registerWriteHandler(horizontalCellStyleStrategy)
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
.registerWriteHandler(writeHandler)
.build();
List<HouseMemberResultDTO> dataList = null; List<HouseMemberResultDTO> dataList = null;
do { do {
dataList = houseService.getHouseUser(tokenDto,formDTO); dataList = houseService.getHouseUser(tokenDto,formDTO);
System.out.println("====:"+JSON.toJSONString(dataList));
excelWriter.write(dataList,writeSheet);
formDTO.setPageSize(formDTO.getPageSize()+1);
}while (dataList != null && dataList.size() == formDTO.getPageSize()); }while (dataList != null && dataList.size() == formDTO.getPageSize());
//获取导出配置 //获取导出配置
@ -353,6 +379,10 @@ public class HouseController implements ResultDataResolver {
Result<Object> result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),e.getMsg()); Result<Object> result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),e.getMsg());
printWriter.write(JSON.toJSONString(result)); printWriter.write(JSON.toJSONString(result));
printWriter.close(); printWriter.close();
}finally {
if (excelWriter != null){
excelWriter.finish();
}
} }
} }

79
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java

@ -37,6 +37,8 @@ import com.epmet.service.*;
import com.epmet.util.ExcelPoiUtils; import com.epmet.util.ExcelPoiUtils;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -50,6 +52,7 @@ import java.io.InputStream;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -470,16 +473,80 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
icBuildingService.update(icBuildingDTO); icBuildingService.update(icBuildingDTO);
} }
} }
//Cache<String,>
@Override @Override
public List<HouseMemberResultDTO> getHouseUser(TokenDto tokenDto, IcHouseListFormDTO formDTO) { public List<HouseMemberResultDTO> getHouseUser(TokenDto tokenDto, IcHouseListFormDTO formDTO) {
RentTenantDataFormDTO resiParam = new RentTenantDataFormDTO();
resiParam.setCustomerId(tokenDto.getCustomerId());
resiParam.setAgencyId(formDTO.getAgencyId());
resiParam.setGridId(formDTO.getGridId());
resiParam.setPageSize(NumConstant.ONE_THOUSAND);
//查询级别 默认按照小区去查
int searchLevel = 0;
//如果楼宇id不为空 则直接查询楼宇内的居民
if (StringUtils.isNotEmpty(formDTO.getBuildingId())){
searchLevel = 1;
}
//如果有具体的查询套件 则直接降级为2 按照房屋Id 来查
if (StringUtils.isNotEmpty(formDTO.getOwnerName()) || StringUtils.isNotEmpty(formDTO.getOwnerPhone()) || StringUtils.isNotEmpty(formDTO.getRentFlag())){
searchLevel = 2;
}
PageData<IcHouseListResultDTO> houseList = this.getHouseList(formDTO); PageData<IcHouseListResultDTO> houseList = this.getHouseList(formDTO);
List<HouseMemberResultDTO> memberResultDTOS = ConvertUtils.sourceToTarget(houseList.getList(), HouseMemberResultDTO.class); List<HouseMemberResultDTO> resultDTOS = ConvertUtils.sourceToTarget(houseList.getList(), HouseMemberResultDTO.class);
memberResultDTOS.parallelStream().forEach(o ->{
RentTenantDataFormDTO userResiInfoListFormDTO = new RentTenantDataFormDTO(); List<HouseMemberResultDTO> result = new ArrayList<>();
epmetUserOpenFeignClient.getHouseMemberList(userResiInfoListFormDTO); int finalSearchLevel = searchLevel;
Cache<String,List<HouseIcResiUserResultDTO.HouseMemberResultDTO>> memberMap = CacheBuilder.newBuilder().expireAfterAccess(1, TimeUnit.SECONDS).build();
resultDTOS.parallelStream().forEach(o ->{
resiParam.setNeighborHoodId(o.getNeighborHoodId());
if (finalSearchLevel == 1){
resiParam.setBuildingId(o.getBuildingId());
}
if (finalSearchLevel == 2){
resiParam.setHouseId(o.getHouseId());
}
getHouseMembers(resiParam, memberMap);
List<HouseIcResiUserResultDTO.HouseMemberResultDTO> members = memberMap.getIfPresent(o.getHouseId());
if (members == null){
return;
}
members.forEach(m->{
HouseMemberResultDTO resultDTO = ConvertUtils.sourceToTarget(m, HouseMemberResultDTO.class);
resultDTO.setAgencyName(o.getAgencyName());
resultDTO.setGridName(o.getGridName());
resultDTO.setNeighborHoodName(o.getNeighborHoodName());
resultDTO.setBuildingName(o.getBuildingName());
resultDTO.setUnitName(o.getUnitName());
resultDTO.setDoorName(o.getDoorName());
resultDTO.setHouseType(o.getHouseType());
resultDTO.setPurpose(o.getPurpose());
resultDTO.setRentFlag(o.getRentFlag());
resultDTO.setOwnerName(o.getOwnerName());
resultDTO.setOwnerPhone(o.getOwnerPhone());
resultDTO.setOwnerIdCard(o.getOwnerIdCard());
result.add(resultDTO);
});
}); });
return memberResultDTOS; return result;
}
public void getHouseMembers(RentTenantDataFormDTO resiParam, Cache<String, List<HouseIcResiUserResultDTO.HouseMemberResultDTO>> memberMap) {
List<HouseIcResiUserResultDTO> memberListTemp = null;
do {
Result<List<HouseIcResiUserResultDTO>> memberResult = epmetUserOpenFeignClient.getHouseMemberList(resiParam);
if (!memberResult.success()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "调用user服务失败");
}
memberListTemp = memberResult.getData();
if (CollectionUtils.isEmpty(memberListTemp)) {
continue;
}
resiParam.setPageSize(resiParam.getPageSize()+1);
memberListTemp.parallelStream().forEach(h -> memberMap.put(h.getHomeId(), h.getHouseMemberList()));
} while (memberListTemp != null && memberListTemp.size() == resiParam.getPageSize());
} }
/** /**

5
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/RentTenantDataFormDTO.java

@ -29,6 +29,11 @@ public class RentTenantDataFormDTO extends PageFormDTO {
*/ */
private String agencyId; private String agencyId;
/**
* pids
*/
private String pids;
/** /**
* 网格Id * 网格Id
*/ */

175
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/HouseIcResiUserResultDTO.java

@ -0,0 +1,175 @@
/**
* 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.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 房屋内居民结果
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-10-26
*/
@Data
public class HouseIcResiUserResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 客户Id customer.id
*/
private String customerId;
/**
*
*/
private String agencyId;
/**
* 网格ID
*/
private String gridId;
/**
* 所属小区ID
*/
private String villageId;
/**
* 所属楼宇Id
*/
private String buildId;
/**
* 单元id
*/
private String unitId;
/**
* 所属家庭Id
*/
private String homeId;
/**
* 屋内的居民
*/
private List<HouseMemberResultDTO> houseMemberList;
@Data
public static class HouseMemberResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 姓名
*/
private String name;
/**
* 性别
*/
private String gender;
/**
* 手机号
*/
private String mobile;
/**
* 身份证号
*/
private String idCard;
/**
* 出生日期
*/
private String birthday;
/**
* 户籍所在地
*/
private String hjszd;
/**
* 与户主关系字典表
*/
private String yhzgx;
/**
* 是否党员
*/
private String isParty;
/**
* 是否租户
*/
private String isTenant;
/**
* 是否流动人口
*/
private String isFloating;
/**
* 工作单位
*/
private String gzdw;
/**
* 民族字典表
*/
private String mz;
/**
* 籍贯
*/
private String jg;
/**
* 婚姻状况字典表
*/
private String hyzk;
/**
* 文化程度字典表
*/
private String culture;
/**
* 宗教信仰
*/
private String faith;
/**
* 备注
*/
private String remarks;
}
}

6
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -23,8 +23,8 @@ import java.util.Set;
* @author yinzuomei@elink-cn.com * @author yinzuomei@elink-cn.com
* @date 2020/6/4 13:09 * @date 2020/6/4 13:09
*/ */
// @FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class, url = "localhost:8087") @FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class, url = "localhost:8087")
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class) //@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class)
public interface EpmetUserOpenFeignClient { public interface EpmetUserOpenFeignClient {
/** /**
@ -747,5 +747,5 @@ public interface EpmetUserOpenFeignClient {
* @return * @return
*/ */
@PostMapping("/epmetuser/icresiuser/getHouseMemberList") @PostMapping("/epmetuser/icresiuser/getHouseMemberList")
Result<List<RentTenantDataResultDTO>> getHouseMemberList(@RequestBody RentTenantDataFormDTO formDTO); Result<List<HouseIcResiUserResultDTO>> getHouseMemberList(@RequestBody RentTenantDataFormDTO formDTO);
} }

2
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

@ -544,7 +544,7 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
} }
@Override @Override
public Result<List<RentTenantDataResultDTO>> getHouseMemberList(RentTenantDataFormDTO formDTO) { public Result<List<HouseIcResiUserResultDTO>> getHouseMemberList(RentTenantDataFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getHouseMemberList", formDTO); return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getHouseMemberList", formDTO);
} }

2
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java

@ -1002,7 +1002,7 @@ public class IcResiUserController implements ResultDataResolver {
return new Result().ok(r); return new Result().ok(r);
} }
@PostMapping("getHouseMemberList") @PostMapping("getHouseMemberList")
Result<List<RentTenantDataResultDTO>> getHouseMemberList(@RequestBody RentTenantDataFormDTO formDTO) { Result<List<HouseIcResiUserResultDTO>> getHouseMemberList(@RequestBody RentTenantDataFormDTO formDTO) {
return new Result().ok(icResiUserService.getHouseMemberList(formDTO)); return new Result().ok(icResiUserService.getHouseMemberList(formDTO));
} }
} }

8
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java

@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.commons.tools.dto.result.OptionDataResultDTO; import com.epmet.commons.tools.dto.result.OptionDataResultDTO;
import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.form.EpidemicPreventionFormDTO; import com.epmet.dto.form.EpidemicPreventionFormDTO;
import com.epmet.dto.form.RentTenantDataFormDTO;
import com.epmet.dto.form.ResiUserQueryValueDTO; import com.epmet.dto.form.ResiUserQueryValueDTO;
import com.epmet.dto.result.*; import com.epmet.dto.result.*;
import com.epmet.entity.IcResiUserEntity; import com.epmet.entity.IcResiUserEntity;
@ -301,4 +302,11 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
IcResiUserEntity selectResiNoDelFlag(@Param("icResiUserId") String icResiUserId); IcResiUserEntity selectResiNoDelFlag(@Param("icResiUserId") String icResiUserId);
List<UserChartResultDTO> userChart(@Param("orgId") String orgId, @Param("orgType") String orgType); List<UserChartResultDTO> userChart(@Param("orgId") String orgId, @Param("orgType") String orgType);
/**
* desc:根据维度获取居民信息表的数据
* @param formDTO
* @return
*/
List<HouseIcResiUserResultDTO> getResiUser(RentTenantDataFormDTO formDTO);
} }

2
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java

@ -324,5 +324,5 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
* @param formDTO * @param formDTO
* @return * @return
*/ */
List<RentTenantDataResultDTO> getHouseMemberList(RentTenantDataFormDTO formDTO); List<HouseIcResiUserResultDTO> getHouseMemberList(RentTenantDataFormDTO formDTO);
} }

33
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

@ -1802,33 +1802,24 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
} }
@Override @Override
public List<RentTenantDataResultDTO> getHouseMemberList(RentTenantDataFormDTO formDTO) { public List<HouseIcResiUserResultDTO> getHouseMemberList(RentTenantDataFormDTO formDTO) {
String pids = ""; //如果是组织 且非顶级组织 则利用pids 查询 本级及下级
//根据pid 获取居民 信息
if (StringUtils.isNotBlank(formDTO.getGridId())){
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(formDTO.getGridId());
if (gridInfo == null){
log.warn("getHouseMemberList gridId:{} is not exist",formDTO.getGridId());
return null;
}
pids = gridInfo.getPids().concat(StrConstant.COLON).concat(formDTO.getGridId());
}
if (StringUtils.isNotBlank(formDTO.getAgencyId())){ if (StringUtils.isNotBlank(formDTO.getAgencyId())){
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(formDTO.getAgencyId()); AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(formDTO.getAgencyId());
if (agencyInfo == null){ if (agencyInfo == null){
log.warn("getHouseMemberList agencyId:{} is not exist",formDTO.getAgencyId()); log.warn("getHouseMemberList agencyId:{} is not exist",formDTO.getAgencyId());
return null; return null;
} }
pids = agencyInfo.getPids().concat(StrConstant.COLON).concat(formDTO.getAgencyId()); if (!NumConstant.ZERO_STR.equals(agencyInfo.getPid())) {
} String pids = agencyInfo.getPids().concat(StrConstant.COLON).concat(formDTO.getAgencyId());
LambdaQueryWrapper<IcResiUserEntity> queryWrapper = new LambdaQueryWrapper<>(); formDTO.setPids(pids);
queryWrapper.eq(IcResiUserEntity::getCustomerId,formDTO.getCustomerId()) }
.eq(StringUtils.isNotBlank(formDTO.getAgencyId()),IcResiUserEntity::getCustomerId,formDTO.getCustomerId()) }
.eq(StringUtils.isNotBlank(formDTO.getCustomerId()),IcResiUserEntity::getCustomerId,formDTO.getCustomerId())
; Page<HouseIcResiUserResultDTO> listPage = PageHelper
/*PageHelper.startPage(formDTO.getPageNo(),formDTO.getPageSize(),formDTO.getIsPage()) .startPage(formDTO.getPageNo(),formDTO.getPageSize(),formDTO.getIsPage())
.doSelectPage(()->baseDao.getResiUser())*/ .doSelectPage(()->baseDao.getResiUser(formDTO));
return null; return listPage.getResult();
} }
} }

53
epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

@ -2,7 +2,36 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.IcResiUserDao"> <mapper namespace="com.epmet.dao.IcResiUserDao">
<resultMap id="homeMemberList" type="com.epmet.dto.result.HouseIcResiUserResultDTO">
<result column="customer_id" property="customerId"/>
<result column="agency_id" property="agencyId"/>
<result column="grid_id" property="gridId"/>
<result column="village_id" property="villageId"/>
<result column="build_id" property="buildId"/>
<result column="unit_id" property="unitId"/>
<result column="home_id" property="homeId"/>
<collection property="houseMemberList" ofType="com.epmet.dto.result.HouseIcResiUserResultDTO$HouseMemberResultDTO">
<id column="id" property="id"/>
<result column="name" property="name"/>
<result column="mobile" property="mobile"/>
<result column="gender" property="gender"/>
<result column="id_card" property="idCard"/>
<result column="birthday" property="birthday"/>
<result column="hjszd" property="hjszd"/>
<result column="yhzgx" property="yhzgx"/>
<result column="is_party" property="isParty"/>
<result column="is_tenant" property="isTenant"/>
<result column="is_floating" property="isFloating"/>
<result column="gzdw" property="gzdw"/>
<result column="mz" property="mz"/>
<result column="jg" property="jg"/>
<result column="hyzk" property="hyzk"/>
<result column="culture" property="culture"/>
<result column="faith" property="faith"/>
<result column="remarks" property="remarks"/>
</collection>
</resultMap>
<insert id="add"> <insert id="add">
insert into ${tableName} insert into ${tableName}
( (
@ -911,5 +940,27 @@
</choose> </choose>
GROUP BY is_floating GROUP BY is_floating
</select> </select>
<select id="getResiUser" resultMap="homeMemberList">
SELECT
*
FROM ic_resi_user
WHERE
CUSTOMER_ID = #{customerId}
<if test="pids != null and pids.trim() != ''">
and AGENCY_ID = #{agencyId} OR PIDS like CONCAT(#{pids}, '%')
</if>
<if test="gridId != null and gridId.trim() != ''">
and GRID_ID = #{gridId}
</if>
<if test="neighborHoodId != null and neighborHoodId.trim() != ''">
and VILLAGE_ID = #{neighborHoodId}
</if>
<if test="buildingId != null and buildingId.trim() != ''">
and BUILD_ID = #{neighborHoodId}
</if>
<if test="houseId != null and houseId.trim() != ''">
and HOME_ID = #{houseId}
</if>
</select>
</mapper> </mapper>

Loading…
Cancel
Save