diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/lingshan/PartyCenterHousePageFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/lingshan/PartyCenterHousePageFormDTO.java new file mode 100644 index 0000000000..267b23e03f --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/lingshan/PartyCenterHousePageFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.form.lingshan; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +/** + * @Description + * @Author yzm + * @Date 2023/5/16 17:50 + */ +@Data +public class PartyCenterHousePageFormDTO extends PageFormDTO { + /** + * 所属小区 + */ + private String neighborHoodName; + /** + * 所属楼栋 + */ + private String buildingName; + + //tokenDto. + private String customerId; + //tokenDto. + private String staffId; +} + diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/lingshan/PartyCenterHouseBindLianHuFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/lingshan/PartyCenterHouseBindLianHuFormDTO.java new file mode 100644 index 0000000000..ae1737f3ef --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/lingshan/PartyCenterHouseBindLianHuFormDTO.java @@ -0,0 +1,17 @@ +package com.epmet.dto.result.lingshan; + +import lombok.Data; + +import java.util.List; + +/** + * @Description 灵山需求:绑定联户入参DTO + * @Author yzm + * @Date 2023/5/16 18:27 + */ +@Data +public class PartyCenterHouseBindLianHuFormDTO { + private String partyCenterHouseId; + private List lianHuHouseIdList; +} + diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/lingshan/PartyCenterHouseResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/lingshan/PartyCenterHouseResultDTO.java new file mode 100644 index 0000000000..d42084013a --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/lingshan/PartyCenterHouseResultDTO.java @@ -0,0 +1,86 @@ +package com.epmet.dto.result.lingshan; + +import lombok.Data; + +/** + * @Description + * @Author yzm + * @Date 2023/5/16 17:51 + */ +@Data +public class PartyCenterHouseResultDTO { + private String partyCenterHouseId; + private String houseName; + /** + * 门牌号 + */ + private String doorName; + + /** + * 所属楼栋id + */ + private String buildingId; + private String buildingName; + + /** + * 所属单元id + */ + private String buildingUnitId; + private String unitName; + + /** + * 所属小区 + */ + private String neighborHoodId; + private String neighborHoodName; + + /** + * 所属网格 + */ + private String gridId; + private String gridName; + + /** + * 所属组织 + */ + private String agencyId; + private String agencyName; + + /** + * 房屋类型 + */ + private String houseType; + private String houseTypeName; + /** + * 房屋用途 + */ + private String purpose; + private String purposeName; + /** + * 是否出租 + * 房屋状态:1:出租 0:自住 2:闲置 3:未售出 + */ + private Integer rentFlag; + private String houseStatusName; + + /** + * 房主姓名 + */ + private String ownerName; + /** + * 房主电话 + */ + private String ownerPhone; + /** + * 房主身份证 + */ + private String ownerIdCard; + + private String remark; + /** + * 联户数 + */ + private Integer totalLianHu; + +} + diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java index c2420c0832..2eb3a2c5bc 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java @@ -21,17 +21,22 @@ import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.MaskResponse; import com.epmet.commons.tools.dto.form.PageFormDTO; import com.epmet.commons.tools.dto.result.OptionResultDTO; +import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.IcHouseDTO; import com.epmet.dto.form.CheckHouseInfoFormDTO; import com.epmet.dto.form.HouseFormDTO; +import com.epmet.dto.form.lingshan.PartyCenterHousePageFormDTO; import com.epmet.dto.result.HouseAgencyInfoResultDTO; import com.epmet.dto.result.HouseInfoDTO; import com.epmet.dto.result.HouseListResultDTO; import com.epmet.dto.result.HousesNameResultDTO; +import com.epmet.dto.result.lingshan.PartyCenterHouseBindLianHuFormDTO; +import com.epmet.dto.result.lingshan.PartyCenterHouseResultDTO; import com.epmet.service.IcHouseService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -161,4 +166,45 @@ public class IcHouseController { return icHouseService.checkHomeInfo(formDTO); } + /** + * 灵山项目-联户绑定 + * 该接口返回:党员中心户房屋列表;默认登录用户查询本组织及下级 + * + * @param formDTO + * @return + */ + @PostMapping("party-center-house-list") + public Result> queryPartyCenterHouseList(@LoginUser TokenDto tokenDto, @RequestBody PartyCenterHousePageFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); + return new Result>().ok(icHouseService.queryPartyCenterHouseList(formDTO)); + } + + /** + * 灵山项目-党员中心户,绑定联户 + * @param formDTO + * @return + */ + @PostMapping("bingLianHu") + public Result bingLianHu( @RequestBody PartyCenterHouseBindLianHuFormDTO formDTO) { + if(StringUtils.isNotBlank(formDTO.getPartyCenterHouseId())){ + icHouseService.bingLianHu(formDTO.getPartyCenterHouseId(),formDTO.getLianHuHouseIdList()); + } + return new Result(); + } + + /** + * 灵山项目-查询联户房屋列表 + * + * @param partyCenterHouseId + * @return + */ + @PostMapping("queryLianHuHouseId/{partyCenterHouseId}") + public Result> queryLianHuHouseId(@PathVariable("partyCenterHouseId") String partyCenterHouseId) { + List list = icHouseService.queryLianHuHouseId(partyCenterHouseId); + return new Result>().ok(list); + } + + + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java index 1f3ceacfe5..70bbd77c9c 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java @@ -7,6 +7,7 @@ import com.epmet.dto.form.GetHouseInfoToCollectFormDTO; import com.epmet.dto.form.HouseChartFormDTO; import com.epmet.dto.form.IcHouseListFormDTO; import com.epmet.dto.result.*; +import com.epmet.dto.result.lingshan.PartyCenterHouseResultDTO; import com.epmet.entity.CustomerOrgParameterEntity; import com.epmet.entity.IcHouseEntity; import org.apache.ibatis.annotations.Mapper; @@ -213,4 +214,19 @@ public interface IcHouseDao extends BaseDao { List houseStatisListDetail(HouseChartFormDTO formDTO); List selectListForRenFangStats(@Param("buildingId") String buildingId); + + /** + * 灵山项目-联户绑定 + * 该接口返回:党员中心户房屋列表;默认登录用户查询本组织及下级 + * + * @param customerId + * @param agencyId + * @param neighborHoodName + * @param buildingName + * @return + */ + List selectListPartyCenterHouse(@Param("customerId") String customerId, + @Param("agencyId") String agencyId, + @Param("neighborHoodName") String neighborHoodName, + @Param("buildingName") String buildingName); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/LingshanPartyCenterHouseLianhuDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/LingshanPartyCenterHouseLianhuDao.java new file mode 100644 index 0000000000..7fb9c42711 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/LingshanPartyCenterHouseLianhuDao.java @@ -0,0 +1,24 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.LingshanPartyCenterHouseLianhuEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 灵山_党员中心户联户 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-05-16 + */ +@Mapper +public interface LingshanPartyCenterHouseLianhuDao extends BaseDao { + + /** + * 查询党员中心对应的联户房屋id + * @param partyCenterHouseId + * @return + */ + List queryLianHuHouseId(String partyCenterHouseId); +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/LingshanPartyCenterHouseLianhuEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/LingshanPartyCenterHouseLianhuEntity.java new file mode 100644 index 0000000000..58026cb462 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/LingshanPartyCenterHouseLianhuEntity.java @@ -0,0 +1,66 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 灵山_党员中心户联户 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-05-16 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("lingshan_party_center_house_lianhu") +public class LingshanPartyCenterHouseLianhuEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 党员中心户房屋id:lingshan_party_center_house.HOUSE_ID + */ + private String partyCenterHouseId; + + /** + * 联户:房屋所属组织id + */ + private String agencyId; + + /** + * 联户:房屋所属网格id + */ + private String gridId; + + /** + * 联户:grid_id的path。包含grid_id + */ + private String gridIdPath; + + /** + * 联户:小区id + */ + private String neighborHoodId; + + /** + * 联户:楼栋id + */ + private String buildingId; + + /** + * 联户:单元id + */ + private String buildingUnitId; + + /** + * 联户:联户房屋id + */ + private String houseId; + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java index 0855d78104..29a7712d8c 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java @@ -2,14 +2,19 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.dto.result.OptionResultDTO; +import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.IcHouseDTO; import com.epmet.dto.ImportGeneralDTO; import com.epmet.dto.form.CheckHouseInfoFormDTO; -import com.epmet.dto.form.DetailByTypeFormDTO; import com.epmet.dto.form.HouseFormDTO; -import com.epmet.dto.result.*; +import com.epmet.dto.form.lingshan.PartyCenterHousePageFormDTO; +import com.epmet.dto.result.HouseAgencyInfoResultDTO; +import com.epmet.dto.result.HouseInfoDTO; +import com.epmet.dto.result.HouseListResultDTO; +import com.epmet.dto.result.HousesNameResultDTO; +import com.epmet.dto.result.lingshan.PartyCenterHouseResultDTO; import com.epmet.entity.IcHouseEntity; import java.util.List; @@ -138,5 +143,24 @@ public interface IcHouseService extends BaseService { */ Result checkHomeInfo(CheckHouseInfoFormDTO formDTO); + /** + * 灵山项目-联户绑定 + * 该接口返回:党员中心户房屋列表;默认登录用户查询本组织及下级 + * @return + */ + PageData queryPartyCenterHouseList(PartyCenterHousePageFormDTO formDTO); + /** + * 灵山项目-党员中心户,绑定联户 + * @param partyCenterHouseId + * @param lianHuHouseIdList + */ + void bingLianHu(String partyCenterHouseId, List lianHuHouseIdList); + + /** + * 灵山项目-查询联户房屋列表 + * @param partyCenterHouseId + * @return + */ + List queryLianHuHouseId(String partyCenterHouseId); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java index 93322c7ed6..52473f17ba 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java @@ -5,30 +5,28 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.bean.HouseInfoCache; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.PidUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.dao.IcBuildingDao; -import com.epmet.dao.IcBuildingUnitDao; -import com.epmet.dao.IcHouseDao; -import com.epmet.dao.IcNeighborHoodDao; -import com.epmet.dto.IcHouseDTO; -import com.epmet.dto.IcResiCategoryStatsConfigDTO; -import com.epmet.dto.IcResiUserDTO; -import com.epmet.dto.ImportGeneralDTO; +import com.epmet.commons.tools.utils.SpringContextUtils; +import com.epmet.dao.*; +import com.epmet.dto.*; import com.epmet.dto.form.CheckHouseInfoFormDTO; import com.epmet.dto.form.HouseFormDTO; +import com.epmet.dto.form.lingshan.PartyCenterHousePageFormDTO; import com.epmet.dto.result.*; -import com.epmet.entity.IcBuildingEntity; -import com.epmet.entity.IcBuildingUnitEntity; -import com.epmet.entity.IcHouseEntity; -import com.epmet.entity.IcNeighborHoodEntity; +import com.epmet.dto.result.lingshan.PartyCenterHouseResultDTO; +import com.epmet.entity.*; import com.epmet.enums.HousePurposeEnums; import com.epmet.enums.HouseRentFlagEnums; import com.epmet.enums.HouseTypeEnums; @@ -36,7 +34,10 @@ import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.OperCustomizeOpenFeignClient; import com.epmet.redis.IcHouseRedis; +import com.epmet.service.CustomerGridService; import com.epmet.service.IcHouseService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -73,6 +74,9 @@ public class IcHouseServiceImpl extends BaseServiceImpl().ok(checkHomeInfoResultInfo); } + + + /** + * 灵山项目-联户绑定 + * 该接口返回:党员中心户房屋列表;默认登录用户查询本组织及下级 + * + * @return + */ + @Override + public PageData queryPartyCenterHouseList(PartyCenterHousePageFormDTO formDTO) { + CustomerStaffInfoCacheResult staffInfoCacheResult= CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(),formDTO.getStaffId()); + PageHelper.startPage(formDTO.getPageNo(),formDTO.getPageSize()); + List list=baseDao.selectListPartyCenterHouse(formDTO.getCustomerId(),staffInfoCacheResult.getAgencyId(), + formDTO.getNeighborHoodName(),formDTO.getBuildingName()); + list.forEach(item -> { + item.setHouseTypeName(HouseTypeEnums.getTypeValue(item.getHouseType())); + item.setPurposeName(HousePurposeEnums.getTypeValue(item.getPurpose())); + }); + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal(),formDTO.getPageSize()); + } + + /** + * 灵山项目-党员中心户,绑定联户 + * + * @param partyCenterHouseId + * @param lianHuHouseIdList + */ + @Override + public void bingLianHu(String partyCenterHouseId, List lianHuHouseIdList) { + IcHouseEntity partyCenterHouse=baseDao.selectById(partyCenterHouseId); + IcNeighborHoodEntity neighborHoodEntity=icNeighborHoodDao.selectById(partyCenterHouse.getNeighborHoodId()); + CustomerGridDTO gridDTO=SpringContextUtils.getBean(CustomerGridService.class).get(neighborHoodEntity.getGridId()); + // 先删除 + LambdaQueryWrapper queryWrapper=new LambdaQueryWrapper<>(); + queryWrapper.eq(LingshanPartyCenterHouseLianhuEntity::getPartyCenterHouseId,partyCenterHouseId); + partyCenterHouseLianhuDao.delete(queryWrapper); + // 后插入 + lianHuHouseIdList.forEach(lianHuHouseId->{ + IcHouseEntity icHouseEntity=baseDao.selectById(lianHuHouseId); + if(null!=icHouseEntity){ + LingshanPartyCenterHouseLianhuEntity entity=new LingshanPartyCenterHouseLianhuEntity(); + entity.setCustomerId(neighborHoodEntity.getCustomerId()); + entity.setPartyCenterHouseId(partyCenterHouseId); + entity.setAgencyId(neighborHoodEntity.getAgencyId()); + entity.setGridId(neighborHoodEntity.getGridId()); + entity.setGridIdPath(PidUtils.convertPid2OrgIdPath(gridDTO.getId(), gridDTO.getPids())); + entity.setNeighborHoodId(icHouseEntity.getNeighborHoodId()); + entity.setBuildingId(icHouseEntity.getBuildingId()); + entity.setBuildingUnitId(icHouseEntity.getBuildingUnitId()); + entity.setHouseId(lianHuHouseId); + partyCenterHouseLianhuDao.insert(entity); + } + }); + } + + + /** + * 灵山项目-查询联户房屋列表 + * + * @param partyCenterHouseId + * @return + */ + @Override + public List queryLianHuHouseId(String partyCenterHouseId) { + if(StringUtils.isBlank(partyCenterHouseId)){ + return new ArrayList<>(); + } + return partyCenterHouseLianhuDao.queryLianHuHouseId(partyCenterHouseId); + } + + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml index 6eac8ed9fd..26cd9e0382 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml @@ -701,4 +701,55 @@ CAST(a.DOOR_NAME AS SIGNED), CONVERT(a.DOOR_NAME using gbk) + + + diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/LingshanPartyCenterHouseLianhuDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/LingshanPartyCenterHouseLianhuDao.xml new file mode 100644 index 0000000000..dec2563774 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/LingshanPartyCenterHouseLianhuDao.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file