26 files modified
5 files renamed
1 files added
| | |
| | | |
| | | import org.springblade.common.node.TreeIntegerNode; |
| | | import org.springblade.common.node.TreeNode; |
| | | import org.springblade.modules.doorplateAddress.vo.DoorplateAddressVOTree; |
| | | import org.springblade.modules.house.vo.HouseTree; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | } |
| | | return tree; |
| | | } |
| | | |
| | | /** |
| | | * 树转换 |
| | | * @param treeMap |
| | | * @return |
| | | */ |
| | | public static List<DoorplateAddressVOTree> getAddressNodeTree(Map<String, DoorplateAddressVOTree> treeMap){ |
| | | List<DoorplateAddressVOTree> tree = new ArrayList<>(); |
| | | if (treeMap.size() > 1) { |
| | | treeMap.forEach((code, treeNode) -> { |
| | | if (treeMap.containsKey(treeNode.getParentCode())) { |
| | | treeMap.get(treeNode.getParentCode()).getChildren().add(treeNode); |
| | | } else { |
| | | tree.add(treeNode); |
| | | } |
| | | }); |
| | | } |
| | | return tree; |
| | | } |
| | | |
| | | /** |
| | | * 树转换 |
| | | * @param treeMap |
| | | * @return |
| | | */ |
| | | public static List<HouseTree> getHouseTree(Map<String, HouseTree> treeMap){ |
| | | List<HouseTree> tree = new ArrayList<>(); |
| | | if (treeMap.size() > 1) { |
| | | treeMap.forEach((code, treeNode) -> { |
| | | if (treeMap.containsKey(treeNode.getParentCode())) { |
| | | treeMap.get(treeNode.getParentCode()).getChildren().add(treeNode); |
| | | } else { |
| | | tree.add(treeNode); |
| | | } |
| | | }); |
| | | } |
| | | return tree; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取房屋树--数据有问题暂时不用2023/11/16 |
| | | * @param houseParam |
| | | * @return |
| | | */ |
| | | @GetMapping("/getHouseTree") |
| | | public R getHouseTree(HouseParam houseParam){ |
| | | return R.data(doorplateAddressService.getHouseTree(houseParam)); |
| | | } |
| | | |
| | | /** |
| | | * 根据参数获取地址详情 |
| | | * @return |
| | | */ |
| | |
| | | return R.data(detail); |
| | | } |
| | | |
| | | /** |
| | | * 数据处理 |
| | | * @return |
| | | */ |
| | | @GetMapping("/dataHandle") |
| | | public R dataHandle(){ |
| | | return R.data(doorplateAddressService.dataHandle()); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import liquibase.pro.packaged.P; |
| | | import org.apache.ibatis.annotations.MapKey; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springblade.common.node.TreeNode; |
| | | import org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity; |
| | |
| | | import org.springblade.modules.house.vo.HouseParam; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 门牌地址表(总台账数据) Mapper 接口 |
| | |
| | | * @return |
| | | */ |
| | | List<DoorplateAddressEntity> getAllDoorplateAddress(@Param("name") String name); |
| | | |
| | | /** |
| | | * 获取房屋树 |
| | | * @param houseParam |
| | | * @param list |
| | | * @return |
| | | */ |
| | | @MapKey("code") |
| | | Map<String, DoorplateAddressVOTree> getHouseTree(@Param("houseParam") HouseParam houseParam, |
| | | @Param("list") List<String> list); |
| | | /** |
| | | * 查询所有户室数据 |
| | | * @return |
| | | */ |
| | | List<DoorplateAddressEntity> getHouseList(); |
| | | } |
| | |
| | | select * from jczz_doorplate_address where nei_name = #{name} |
| | | </select> |
| | | |
| | | <!--获取房屋树--> |
| | | <select id="getHouseTree" resultType="org.springblade.modules.doorplateAddress.vo.DoorplateAddressVOTree"> |
| | | SELECT |
| | | aoi_code as code, |
| | | aoi_name as name, |
| | | nei_code as parentCode |
| | | FROM jczz_doorplate_address |
| | | WHERE nei_code = #{houseParam.code} |
| | | and aoi_code is not null and aoi_code !='' |
| | | and aoi_name is not null and aoi_name !='' |
| | | GROUP BY aoi_code,aoi_name,nei_code |
| | | <include refid="filterHouseGrid"/> |
| | | union all |
| | | ( |
| | | SELECT |
| | | building_code as code, |
| | | building_name as name, |
| | | aoi_code as parentCode |
| | | FROM jczz_doorplate_address |
| | | WHERE nei_code = #{houseParam.code} |
| | | and building_code is not null and building_code !='' |
| | | and building_name is not null and building_name !='' |
| | | GROUP BY building_code,building_name,aoi_code |
| | | <include refid="filterHouseGrid"/> |
| | | ) |
| | | union all |
| | | ( |
| | | select |
| | | jda.unit_code as code, |
| | | ifnull(jda.unit_name,"一单元") name, |
| | | jda.building_code as parentCode |
| | | from jczz_doorplate_address jda |
| | | where 1=1 |
| | | and floor != '' |
| | | and house_name != '' |
| | | and doorplate_type = '户室牌' |
| | | and nei_code = #{houseParam.code} |
| | | <include refid="filterHouseGrid"/> |
| | | group by unit_name,unit_code,building_code |
| | | ) |
| | | union all |
| | | ( |
| | | select |
| | | jda.address_code as code, |
| | | jda.house_name as name, |
| | | jda.unit_code as parentCode |
| | | from jczz_doorplate_address jda |
| | | where 1=1 |
| | | and floor != '' |
| | | and house_name != '' |
| | | and doorplate_type = '户室牌' |
| | | and nei_code = #{houseParam.code} |
| | | <include refid="filterHouseGrid"/> |
| | | ) |
| | | </select> |
| | | |
| | | <!--查询所有户室数据--> |
| | | <select id="getHouseList" resultType="org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity"> |
| | | select * from jczz_doorplate_address |
| | | where 1=1 and doorplate_type = '户室牌' |
| | | and address_code not in ( |
| | | select house_code from jczz_house |
| | | ) |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | * @return |
| | | */ |
| | | List<DoorplateAddressEntity> getAllDoorplateAddress(String name); |
| | | |
| | | /** |
| | | * 获取房屋树 |
| | | * @param houseParam |
| | | * @return |
| | | */ |
| | | List<DoorplateAddressVOTree> getHouseTree(HouseParam houseParam); |
| | | |
| | | /** |
| | | * 数据处理 |
| | | * @return |
| | | */ |
| | | Object dataHandle(); |
| | | } |
| | |
| | | */ |
| | | package org.springblade.modules.doorplateAddress.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import liquibase.repackaged.org.apache.commons.lang3.StringUtils; |
| | | import org.springblade.common.constant.DictConstant; |
| | | import org.springblade.common.node.TreeNode; |
| | | import org.springblade.common.utils.NodeTreeUtil; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity; |
| | | import org.springblade.modules.doorplateAddress.mapper.DoorplateAddressMapper; |
| | |
| | | import org.springblade.modules.doorplateAddress.vo.DoorplateAddressVOTree; |
| | | import org.springblade.modules.doorplateAddress.vo.FuncNode; |
| | | import org.springblade.modules.grid.service.IGridService; |
| | | import org.springblade.modules.house.entity.HouseEntity; |
| | | import org.springblade.modules.house.service.IHouseRentalService; |
| | | import org.springblade.modules.house.service.IHouseService; |
| | | import org.springblade.modules.house.service.IHouseholdService; |
| | | import org.springblade.modules.house.vo.HouseParam; |
| | | import org.springblade.modules.house.vo.HouseRentalVO; |
| | |
| | | |
| | | @Autowired |
| | | private IPlaceService placeService; |
| | | |
| | | @Autowired |
| | | private IHouseService houseService; |
| | | |
| | | @Autowired |
| | | private IHouseholdService householdService; |
| | |
| | | public Object getHousesList(HouseParam houseParam) { |
| | | List<TreeNode> list = new ArrayList<>(); |
| | | Map<String, Object> map = new HashMap<>(2); |
| | | List<String> stringList = new ArrayList<>(); |
| | | if (null!=houseParam.getRoleName() && !houseParam.getRoleName().equals("")){ |
| | | if (houseParam.getRoleName().equals("网格员")){ |
| | | // 查询对应的房屋地址code |
| | | stringList = gridService.getAddressCodeListByUserId(AuthUtil.getUserId()); |
| | | } |
| | | } |
| | | List<String> stringList = getHouseCodeList(houseParam); |
| | | // 查小区,场所 |
| | | if (houseParam.getType()==1){ |
| | | // 根据社区名称查询小区集合 |
| | |
| | | * @return |
| | | */ |
| | | private Map<String, Object> getHouseLevelData(HouseParam houseParam, Map<String, Object> map) { |
| | | List<String> stringList = new ArrayList<>(); |
| | | if (null!=houseParam.getRoleName() && !houseParam.getRoleName().equals("")){ |
| | | if (houseParam.getRoleName().equals("网格员")){ |
| | | // 查询对应的房屋地址code |
| | | stringList = gridService.getAddressCodeListByUserId(AuthUtil.getUserId()); |
| | | } |
| | | } |
| | | List<String> stringList = getHouseCodeList(houseParam); |
| | | // 判断地址类型 |
| | | if (houseParam.getAddressType()==1) { |
| | | List<FuncNode> aoiList = new ArrayList<>(); |
| | |
| | | * @return |
| | | */ |
| | | private Object getBuildLevelData(HouseParam houseParam,Map<String, Object> map) { |
| | | List<String> stringList = new ArrayList<>(); |
| | | if (null!=houseParam.getRoleName() && !houseParam.getRoleName().equals("")){ |
| | | if (houseParam.getRoleName().equals("网格员")){ |
| | | // 查询对应的房屋地址code |
| | | stringList = gridService.getAddressCodeListByUserId(AuthUtil.getUserId()); |
| | | } |
| | | } |
| | | List<String> stringList = getHouseCodeList(houseParam); |
| | | // 判断 code 长度,如果 code 长度大于 12 则为小区查楼栋/商铺,否则则按社区查街路巷 |
| | | if (houseParam.getCode().length()>12){ |
| | | List<TreeNode> aoiList = new ArrayList<>(); |
| | |
| | | |
| | | /** |
| | | * 查询户室及住户相关信息,单元中包含住户 |
| | | * @param name |
| | | * @param code |
| | | * @param houseParam |
| | | * @param stringList |
| | | * @return |
| | | */ |
| | | private List<FuncNode> getUnitHouseholdList(HouseParam houseParam,List<String> stringList) { |
| | |
| | | public List<DoorplateAddressEntity> getAllDoorplateAddress(String name) { |
| | | return baseMapper.getAllDoorplateAddress(name); |
| | | } |
| | | |
| | | /** |
| | | * 获取房屋树 |
| | | * @param houseParam |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<DoorplateAddressVOTree> getHouseTree(HouseParam houseParam) { |
| | | List<String> stringList = getHouseCodeList(houseParam); |
| | | // 根据社区居委会编号获取对应的小区/楼栋/单元/户室 |
| | | return NodeTreeUtil.getAddressNodeTree(baseMapper.getHouseTree(houseParam,stringList)); |
| | | } |
| | | |
| | | /** |
| | | * 根据角色获取地址编号集合 |
| | | * @param houseParam |
| | | * @return |
| | | */ |
| | | private List<String> getHouseCodeList(HouseParam houseParam) { |
| | | List<String> stringList = new ArrayList<>(); |
| | | if (null != houseParam.getRoleName() && !houseParam.getRoleName().equals("")) { |
| | | if (houseParam.getRoleName().equals("网格员")) { |
| | | // 查询对应的房屋地址code |
| | | stringList = gridService.getAddressCodeListByUserId(AuthUtil.getUserId()); |
| | | } |
| | | } |
| | | return stringList; |
| | | } |
| | | |
| | | /** |
| | | * 数据处理 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Object dataHandle() { |
| | | // 处理户室数据 |
| | | handleHouseData(); |
| | | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 处理房屋数据 |
| | | */ |
| | | private void handleHouseData() { |
| | | // 查询所有户室数据 |
| | | List<DoorplateAddressEntity> list = baseMapper.getHouseList(); |
| | | // 需要新增的房屋 list |
| | | List<HouseEntity> houseList = new ArrayList<>(); |
| | | // 处理户室数据 |
| | | for (DoorplateAddressEntity doorplateAddressEntity : list) { |
| | | // 查询是否已存在,存在就插入,不存在则插入 |
| | | QueryWrapper<HouseEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("house_code",doorplateAddressEntity.getAddressCode()) |
| | | .eq("is_deleted",0); |
| | | HouseEntity one = houseService.getOne(wrapper); |
| | | if (null==one){ |
| | | HouseEntity houseEntity = new HouseEntity(); |
| | | houseEntity.setHouseCode(doorplateAddressEntity.getAddressCode()); |
| | | houseEntity.setDistrictCode(doorplateAddressEntity.getAoiCode()); |
| | | houseEntity.setDistrictName(doorplateAddressEntity.getAoiName()); |
| | | houseEntity.setHouseName(doorplateAddressEntity.getAddressName()); |
| | | houseEntity.setFloor(Integer.parseInt(doorplateAddressEntity.getFloor())); |
| | | houseEntity.setBuilding(doorplateAddressEntity.getBuildingName()); |
| | | houseEntity.setUnit(doorplateAddressEntity.getUnitName()); |
| | | houseEntity.setRoom(doorplateAddressEntity.getHouseName()); |
| | | houseEntity.setBuildingNo(doorplateAddressEntity.getBuildingCode()); |
| | | houseEntity.setCreateUser(AuthUtil.getUserId().toString()); |
| | | houseEntity.setCreateTime(new Date()); |
| | | houseEntity.setUpdateUser(AuthUtil.getUserId().toString()); |
| | | houseEntity.setUpdateTime(new Date()); |
| | | // 加入集合 |
| | | houseList.add(houseEntity); |
| | | } |
| | | } |
| | | // 批量插入 |
| | | houseService.saveBatch(houseList); |
| | | } |
| | | } |
| | |
| | | |
| | | private String code; |
| | | |
| | | private String parentCode; |
| | | |
| | | private List<DoorplateAddressVOTree> children; |
| | | |
| | | } |
| | |
| | | import javax.validation.Valid; |
| | | |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | | import org.springblade.core.secure.BladeUser; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.house.vo.HouseholdVO; |
| | | import org.springblade.modules.system.excel.HouseExcel; |
| | | import org.springblade.modules.system.excel.HouseHoldExcel; |
| | | import org.springblade.modules.house.excel.HouseImporter; |
| | | import org.springblade.modules.house.vo.HouseParam; |
| | | import org.springblade.modules.house.excel.HouseExcel; |
| | | import org.springblade.modules.system.excel.UserExcel; |
| | | import org.springblade.modules.system.excel.UserImporter; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.house.entity.HouseEntity; |
| | |
| | | import org.springblade.modules.house.wrapper.HouseWrapper; |
| | | import org.springblade.modules.house.service.IHouseService; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * 导出用户 |
| | | * 导出房屋 |
| | | */ |
| | | @GetMapping("export-house") |
| | | @ApiOperationSupport(order = 13) |
| | | @ApiOperation(value = "导出房屋", notes = "传入user") |
| | | public void exportUser(HouseVO household, HttpServletResponse response) { |
| | | public void exportHouse(HouseVO household, HttpServletResponse response) { |
| | | List<HouseExcel> list = houseService.export(household); |
| | | ExcelUtil.export(response, "房屋数据" + DateUtil.time(), "房屋数据表", list, HouseExcel.class); |
| | | } |
| | | |
| | | /** |
| | | * 导入房屋 |
| | | */ |
| | | @GetMapping("import-house") |
| | | public R importHouse(MultipartFile file, Integer isCovered) { |
| | | HouseImporter houseImporter = new HouseImporter(houseService, isCovered == 1); |
| | | ExcelUtil.save(file, houseImporter, HouseExcel.class); |
| | | return R.success("操作成功"); |
| | | } |
| | | |
| | | /** |
| | | * 查询房屋树 |
| | | * @param houseParam |
| | | * @return |
| | | */ |
| | | @GetMapping("/getHouseTree") |
| | | public R getHouseTree(HouseParam houseParam) { |
| | | return R.data(houseService.getHouseTree(houseParam)); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import javax.validation.Valid; |
| | | |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | | import org.springblade.core.secure.BladeUser; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.house.vo.HouseRentalTenantVO; |
| | | import org.springblade.modules.house.vo.HouseVO; |
| | | import org.springblade.modules.system.excel.HouseExcel; |
| | | import org.springblade.modules.system.excel.HouseRentalExcel; |
| | | import org.springblade.modules.house.excel.HouseRentalExcel; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.house.entity.HouseRentalEntity; |
| | |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.system.excel.UserExcel; |
| | | import org.springblade.modules.system.excel.HouseHoldExcel; |
| | | import org.springblade.modules.system.excel.HouseHoldImporter; |
| | | import org.springblade.modules.system.excel.UserImporter; |
| | | import org.springblade.modules.house.excel.HouseHoldExcel; |
| | | import org.springblade.modules.house.excel.HouseHoldImporter; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | |
| | | * 幢编号 |
| | | */ |
| | | @ApiModelProperty(value = "幢编号") |
| | | private Integer buildingNo; |
| | | private String buildingNo; |
| | | /** |
| | | * 图片URLS |
| | | */ |
| File was renamed from src/main/java/org/springblade/modules/system/excel/HouseExcel.java |
| | |
| | | package org.springblade.modules.system.excel; |
| | | package org.springblade.modules.house.excel; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.alibaba.excel.annotation.write.style.ColumnWidth; |
| | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * UserExcel |
| | | * HouseExcel |
| | | * |
| | | * @author Chill |
| | | */ |
| | |
| | | public class HouseExcel implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 2L; |
| | | |
| | | /** 主键id */ |
| | | @ExcelProperty( "主键ID") |
| | | private Long id; |
| | | |
| | | /** 门牌地址编码 */ |
| | | @ExcelProperty( "门牌地址编码") |
| File was renamed from src/main/java/org/springblade/modules/system/excel/HouseHoldExcel.java |
| | |
| | | package org.springblade.modules.system.excel; |
| | | package org.springblade.modules.house.excel; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnore; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| File was renamed from src/main/java/org/springblade/modules/system/excel/HouseHoldImporter.java |
| | |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.system.excel; |
| | | package org.springblade.modules.house.excel; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springblade.core.excel.support.ExcelImporter; |
| File was renamed from src/main/java/org/springblade/modules/system/excel/HouseImporter.java |
| | |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.system.excel; |
| | | package org.springblade.modules.house.excel; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springblade.core.excel.support.ExcelImporter; |
| | | import org.springblade.modules.house.excel.HouseExcel; |
| | | import org.springblade.modules.house.service.IHouseService; |
| | | import org.springblade.modules.house.service.IHouseholdService; |
| | | |
| | | import java.util.List; |
| | | |
| File was renamed from src/main/java/org/springblade/modules/system/excel/HouseRentalExcel.java |
| | |
| | | package org.springblade.modules.system.excel; |
| | | package org.springblade.modules.house.excel; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.alibaba.excel.annotation.write.style.ColumnWidth; |
| | |
| | | */ |
| | | package org.springblade.modules.house.mapper; |
| | | |
| | | import org.apache.ibatis.annotations.MapKey; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springblade.modules.house.entity.HouseEntity; |
| | | import org.springblade.modules.house.vo.HouseParam; |
| | | import org.springblade.modules.house.vo.HouseTree; |
| | | import org.springblade.modules.house.vo.HouseVO; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.system.excel.HouseExcel; |
| | | import org.springblade.modules.house.excel.HouseExcel; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 房屋 Mapper 接口 |
| | |
| | | HouseVO getHouseDetail(@Param("house") HouseVO house); |
| | | |
| | | List<HouseExcel> export(HouseVO household); |
| | | |
| | | /** |
| | | * 查询房屋树 |
| | | * @param houseParam |
| | | * @param list |
| | | * @return |
| | | */ |
| | | @MapKey(value = "code") |
| | | Map<String, HouseTree> getHouseTree(@Param("houseParam") HouseParam houseParam, |
| | | @Param("list") List<String> list); |
| | | } |
| | |
| | | <result column="is_deleted" property="isDeleted"/> |
| | | </resultMap> |
| | | |
| | | <!--过滤网格数据--> |
| | | <sql id="filterHouseGrid"> |
| | | <if test="houseParam.roleName!=null and houseParam.roleName!=''"> |
| | | <if test="houseParam.roleName=='网格员'"> |
| | | <choose> |
| | | <when test="list != null and list.size()>0"> |
| | | and house_code in |
| | | <foreach collection="list" item="houseCode" separator ="," open="(" close=")"> |
| | | #{houseCode} |
| | | </foreach> |
| | | </when> |
| | | <otherwise> |
| | | and house_code in ('') |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | </if> |
| | | </sql> |
| | | |
| | | <sql id="selectHouse"> |
| | | select |
| | | id, |
| | |
| | | </resultMap> |
| | | |
| | | <!--自定义分页列表--> |
| | | <select id="selectHousePage" resultMap="houseResultMap"> |
| | | <include refid="selectHouse"/> |
| | | <where> |
| | | <if test="house.id != null "> and id = #{house.id}</if> |
| | | <if test="house.houseCode != null and house.houseCode != ''"> and house_code = #{house.houseCode}</if> |
| | | <if test="house.districtCode != null and house.districtCode != ''"> and district_code = #{house.districtCode}</if> |
| | | <if test="house.districtName != null and house.districtName != ''"> and district_name = #{house.districtName}</if> |
| | | <if test="house.houseName != null and house.houseName != ''"> and house_name = #{house.houseName}</if> |
| | | <if test="house.phone != null and house.phone != ''"> and phone = #{house.phone}</if> |
| | | <if test="house.area != null "> and area = #{house.area}</if> |
| | | <if test="house.propertyPrice != null "> and property_price = #{house.propertyPrice}</if> |
| | | <if test="house.serviceDue != null "> and service_due = #{house.serviceDue}</if> |
| | | <if test="house.floor != null "> and floor = #{house.floor}</if> |
| | | <if test="house.building != null and house.building != ''"> and building = #{house.building}</if> |
| | | <if test="house.unit != null and house.unit != ''"> and unit = #{house.unit}</if> |
| | | <if test="house.room != null and house.room != ''"> and room = #{house.room}</if> |
| | | <if test="house.buildingNo != null "> and building_no = #{house.buildingNo}</if> |
| | | <if test="house.imageUrls != null and house.imageUrls != ''"> and image_urls = #{house.imageUrls}</if> |
| | | <if test="house.createUser != null and house.createUser != ''"> and create_user = #{house.createUser}</if> |
| | | <if test="house.createTime != null "> and create_time = #{house.createTime}</if> |
| | | <if test="house.updateUser != null and house.updateUser != ''"> and update_user = #{house.updateUser}</if> |
| | | <if test="house.updateTime != null "> and update_time = #{house.updateTime}</if> |
| | | <if test="house.remark != null and house.remark != ''"> and remark = #{house.remark}</if> |
| | | <if test="house.isDeleted != null "> and is_deleted = #{house.isDeleted}</if> |
| | | </where> |
| | | <select id="selectHousePage" resultType="org.springblade.modules.house.vo.HouseVO"> |
| | | select *,concat(building," ",unit," ",room) as address from jczz_house |
| | | where is_deleted = 0 |
| | | <if test="house.id != null "> and id = #{house.id}</if> |
| | | <if test="house.houseCode != null and house.houseCode != ''"> and house_code = #{house.houseCode}</if> |
| | | <if test="house.districtCode != null and house.districtCode != ''"> and district_code = #{house.districtCode}</if> |
| | | <if test="house.districtName != null and house.districtName != ''"> |
| | | and district_name like concat('%',#{house.districtName},'%') |
| | | </if> |
| | | <if test="house.houseName != null and house.houseName != ''"> and house_name = #{house.houseName}</if> |
| | | <if test="house.phone != null and house.phone != ''"> and phone = #{house.phone}</if> |
| | | <if test="house.area != null "> and area = #{house.area}</if> |
| | | <if test="house.propertyPrice != null "> and property_price = #{house.propertyPrice}</if> |
| | | <if test="house.serviceDue != null "> and service_due = #{house.serviceDue}</if> |
| | | <if test="house.floor != null "> and floor = #{house.floor}</if> |
| | | <if test="house.building != null and house.building != ''"> and building = #{house.building}</if> |
| | | <if test="house.unit != null and house.unit != ''"> and unit = #{house.unit}</if> |
| | | <if test="house.room != null and house.room != ''"> and room = #{house.room}</if> |
| | | <if test="house.buildingNo != null "> and building_no = #{house.buildingNo}</if> |
| | | </select> |
| | | |
| | | <!--房屋自定义详情查询--> |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="export" resultType="org.springblade.modules.system.excel.HouseExcel"> |
| | | <select id="export" resultType="org.springblade.modules.house.excel.HouseExcel"> |
| | | <include refid="selectHouse"/> |
| | | <where> |
| | | <if test="id != null "> and id = #{id}</if> |
| | |
| | | </select> |
| | | |
| | | |
| | | <!--获取房屋树--> |
| | | <select id="getHouseTree" resultType="org.springblade.modules.house.vo.HouseTree"> |
| | | SELECT |
| | | district_code as code, |
| | | district_name as name, |
| | | jda.nei_code as parentCode |
| | | FROM jczz_house jh |
| | | left join |
| | | (select nei_code,aoi_code from jczz_doorplate_address where nei_code = #{houseParam.code} group by nei_code,aoi_code) jda |
| | | on jda.aoi_code = jh.district_code |
| | | WHERE jda.nei_code = #{houseParam.code} |
| | | <include refid="filterHouseGrid"/> |
| | | GROUP BY district_code,district_name,nei_code |
| | | union all |
| | | ( |
| | | SELECT |
| | | building as code, |
| | | building as name, |
| | | district_code as parentCode |
| | | FROM jczz_house jh |
| | | left join |
| | | (select nei_code,aoi_code from jczz_doorplate_address where nei_code = #{houseParam.code} group by nei_code,aoi_code) jda |
| | | on jda.aoi_code = jh.district_code |
| | | WHERE jda.nei_code = #{houseParam.code} |
| | | <include refid="filterHouseGrid"/> |
| | | GROUP BY building,district_code |
| | | ) |
| | | union all |
| | | ( |
| | | select |
| | | unit as code, |
| | | unit name, |
| | | building as parentCode |
| | | FROM jczz_house jh |
| | | left join |
| | | (select nei_code,aoi_code from jczz_doorplate_address where nei_code = #{houseParam.code} group by nei_code,aoi_code) jda |
| | | on jda.aoi_code = jh.district_code |
| | | WHERE jda.nei_code = #{houseParam.code} |
| | | <include refid="filterHouseGrid"/> |
| | | group by unit,building |
| | | ) |
| | | union all |
| | | ( |
| | | select |
| | | room as code, |
| | | room name, |
| | | unit as parentCode |
| | | FROM jczz_house jh |
| | | left join |
| | | (select nei_code,aoi_code from jczz_doorplate_address where nei_code = #{houseParam.code} group by nei_code,aoi_code) jda |
| | | on jda.aoi_code = jh.district_code |
| | | WHERE jda.nei_code = #{houseParam.code} |
| | | <include refid="filterHouseGrid"/> |
| | | ) |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | */ |
| | | package org.springblade.modules.house.mapper; |
| | | |
| | | import liquibase.pro.packaged.P; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springblade.modules.house.entity.HouseRentalEntity; |
| | | import org.springblade.modules.house.vo.HouseRentalStatistics; |
| | |
| | | import org.springblade.modules.house.vo.HouseRentalVO; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.system.excel.HouseRentalExcel; |
| | | import org.springblade.modules.house.excel.HouseRentalExcel; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | <!--自定义列表查询--> |
| | | <select id="selectHouseRentalPage" resultType="org.springblade.modules.house.vo.HouseRentalTenantVO"> |
| | | SELECT jhr.*,jda.address_name as houseName,b.tenantName,b.phone |
| | | SELECT jhr.*,jda.address_name as houseName,b.tenantName,b.phone, |
| | | concat(jh.district_name," ",jh.building," ",unit," ",room) as address, |
| | | case when TIMESTAMPDIFF( MONTH, jhr.rental_time, jhr.due_time )>= 8 then 1 |
| | | when TIMESTAMPDIFF( MONTH, jhr.rental_time, jhr.due_time )<4 then 3 |
| | | else 2 end as dldType |
| | | FROM jczz_house_rental jhr |
| | | LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jhr.house_code |
| | | JOIN jczz_doorplate_address jda ON jda.address_code = jhr.house_code |
| | | JOIN jczz_house jh ON jh.house_code = jhr.house_code |
| | | LEFT JOIN ( |
| | | SELECT jht.housing_rental_id,jht.name as tenantName,jht.phone |
| | | FROM jczz_house_tenant jht RIGHT JOIN ( |
| | |
| | | <if test="vo.tenantName != null and vo.tenantName != ''"> |
| | | AND b.tenantName LIKE CONCAT('%',#{vo.tenantName},'%') |
| | | </if> |
| | | <if test="vo.tenantName != null and vo.tenantName != ''"> |
| | | AND b.tenantName LIKE CONCAT('%',#{vo.tenantName},'%') |
| | | <if test="vo.tenantRelationship != null"> |
| | | AND jhr.tenant_relationship = #{vo.tenantRelationship} |
| | | </if> |
| | | <if test="vo.houseStatus != null"> |
| | | AND jhr.house_status = #{vo.houseStatus} |
| | | </if> |
| | | <if test="vo.rentalUse != null"> |
| | | AND jhr.rental_use = #{vo.rentalUse} |
| | | </if> |
| | | <if test="vo.dldType != null"> |
| | | <if test="vo.dldType ==1 "> |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="export" resultType="org.springblade.modules.system.excel.HouseRentalExcel"> |
| | | <select id="export" resultType="org.springblade.modules.house.excel.HouseRentalExcel"> |
| | | |
| | | <include refid="selectHouseRental"/> |
| | | <where> |
| | |
| | | import org.springblade.modules.house.vo.HouseholdVO; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.system.excel.HouseHoldExcel; |
| | | import org.springblade.modules.house.excel.HouseHoldExcel; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @param household |
| | | * @return |
| | | */ |
| | | List<HouseholdVO> selectHouseholdPage(IPage page, HouseholdVO household); |
| | | List<HouseholdVO> selectHouseholdPage(IPage page,@Param("household") HouseholdVO household); |
| | | |
| | | |
| | | /** |
| | |
| | | </resultMap> |
| | | |
| | | <!--自定义分页数据查询--> |
| | | <select id="selectHouseholdPage" resultMap="householdResultMap"> |
| | | select * from jczz_household where is_deleted = 0 |
| | | <select id="selectHouseholdPage" resultType="org.springblade.modules.house.vo.HouseholdVO"> |
| | | select |
| | | jh.*, |
| | | jhs.district_name aoiName, |
| | | concat(jhs.building," ",unit," ",room) as address |
| | | from |
| | | jczz_household jh join jczz_house jhs on jh.house_code = jhs.house_code and jhs.is_deleted = 0 |
| | | where jh.is_deleted = 0 |
| | | <if test="household.name!=null and household.name !=''"> |
| | | and jh.name like concat('%',#{household.name},'%') |
| | | </if> |
| | | <if test="household.phoneNumber!=null and household.phoneNumber !=''"> |
| | | and jh.phone_number like concat('%',#{household.phoneNumber},'%') |
| | | </if> |
| | | <if test="household.idCard!=null and household.idCard !=''"> |
| | | and jh.id_card like concat('%',#{household.idCard},'%') |
| | | </if> |
| | | <if test="household.aoiName!=null and household.aoiName !=''"> |
| | | and jhs.district_name like concat('%',#{household.aoiName},'%') |
| | | </if> |
| | | </select> |
| | | |
| | | <!--查询房屋集合信息--> |
| | |
| | | and jh.id = #{household.id} |
| | | </select> |
| | | |
| | | <select id="export" resultType="org.springblade.modules.system.excel.HouseHoldExcel"> |
| | | <select id="export" resultType="org.springblade.modules.house.excel.HouseHoldExcel"> |
| | | <include refid="selectHousehold"/> |
| | | <where> |
| | | <if test="id != null "> and id = #{id}</if> |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springblade.modules.house.entity.HouseRentalEntity; |
| | | import org.springblade.modules.house.vo.HouseRentalStatistics; |
| | | import org.springblade.modules.house.vo.HouseRentalTenantVO; |
| | | import org.springblade.modules.house.vo.HouseRentalVO; |
| | | import org.springblade.core.mp.base.BaseService; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.system.excel.HouseRentalExcel; |
| | | import org.springblade.modules.house.excel.HouseRentalExcel; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springblade.modules.house.entity.HouseEntity; |
| | | import org.springblade.modules.house.vo.HouseParam; |
| | | import org.springblade.modules.house.vo.HouseTree; |
| | | import org.springblade.modules.house.vo.HouseVO; |
| | | import org.springblade.core.mp.base.BaseService; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.system.excel.HouseExcel; |
| | | import org.springblade.modules.system.excel.HouseHoldExcel; |
| | | import org.springblade.modules.house.excel.HouseExcel; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | void importUserHouse(List<HouseExcel> data, Boolean isCovered); |
| | | |
| | | List<HouseExcel> export(HouseVO household); |
| | | |
| | | /** |
| | | * 查询房屋树 |
| | | * @param houseParam |
| | | * @return |
| | | */ |
| | | List<HouseTree> getHouseTree(HouseParam houseParam); |
| | | } |
| | |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | | import org.springblade.modules.house.vo.HouseholdVO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.system.excel.HouseHoldExcel; |
| | | import org.springblade.modules.house.excel.HouseHoldExcel; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | import org.springblade.modules.house.mapper.HouseRentalMapper; |
| | | import org.springblade.modules.house.service.IHouseRentalService; |
| | | import org.springblade.modules.house.vo.HouseTenantVO; |
| | | import org.springblade.modules.system.excel.HouseExcel; |
| | | import org.springblade.modules.system.excel.HouseRentalExcel; |
| | | import org.springblade.modules.house.excel.HouseRentalExcel; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.common.utils.NodeTreeUtil; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.modules.grid.service.IGridService; |
| | | import org.springblade.modules.house.entity.HouseEntity; |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | | import org.springblade.modules.house.vo.HouseParam; |
| | | import org.springblade.modules.house.vo.HouseTree; |
| | | import org.springblade.modules.house.vo.HouseVO; |
| | | import org.springblade.modules.house.mapper.HouseMapper; |
| | | import org.springblade.modules.house.service.IHouseService; |
| | | import org.springblade.core.mp.base.BaseServiceImpl; |
| | | import org.springblade.modules.label.service.ILabelService; |
| | | import org.springblade.modules.system.excel.HouseExcel; |
| | | import org.springblade.modules.system.excel.HouseHoldExcel; |
| | | import org.springblade.modules.house.excel.HouseExcel; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | |
| | | */ |
| | | @Service |
| | | public class HouseServiceImpl extends ServiceImpl<HouseMapper, HouseEntity> implements IHouseService { |
| | | |
| | | |
| | | @Autowired |
| | | private IGridService gridService; |
| | | |
| | | @Override |
| | | public IPage<HouseVO> selectHousePage(IPage<HouseVO> page, HouseVO house) { |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导入房屋数据 |
| | | * @param data |
| | | * @param isCovered |
| | | */ |
| | | @Override |
| | | public void importUserHouse(List<HouseExcel> data, Boolean isCovered) { |
| | | data.forEach(houseExcel -> { |
| | |
| | | List<HouseExcel> houseExcels = baseMapper.export(household); |
| | | return houseExcels; |
| | | } |
| | | |
| | | /** |
| | | * 查询房屋树 |
| | | * @param houseParam |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<HouseTree> getHouseTree(HouseParam houseParam) { |
| | | List<String> houseCodeList = getHouseCodeList(houseParam); |
| | | return NodeTreeUtil.getHouseTree(baseMapper.getHouseTree(houseParam,houseCodeList)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据角色获取地址编号集合 |
| | | * @param houseParam |
| | | * @return |
| | | */ |
| | | private List<String> getHouseCodeList(HouseParam houseParam) { |
| | | List<String> stringList = new ArrayList<>(); |
| | | if (null != houseParam.getRoleName() && !houseParam.getRoleName().equals("")) { |
| | | if (houseParam.getRoleName().equals("网格员")) { |
| | | // 查询对应的房屋地址code |
| | | stringList = gridService.getAddressCodeListByUserId(AuthUtil.getUserId()); |
| | | } |
| | | } |
| | | return stringList; |
| | | } |
| | | } |
| | |
| | | import org.springblade.modules.house.mapper.HouseholdMapper; |
| | | import org.springblade.modules.house.service.IHouseholdService; |
| | | import org.springblade.modules.system.entity.DictBiz; |
| | | import org.springblade.modules.system.excel.HouseHoldExcel; |
| | | import org.springblade.modules.house.excel.HouseHoldExcel; |
| | | import org.springblade.modules.system.service.IDictBizService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | */ |
| | | private String roleName; |
| | | |
| | | /** |
| | | * 拼接地址 |
| | | */ |
| | | private String address; |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package org.springblade.modules.house.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class HouseTree { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private String name; |
| | | |
| | | private String code; |
| | | |
| | | private String parentCode; |
| | | |
| | | private boolean hashChild; |
| | | |
| | | private List<HouseTree> children = new ArrayList<>(); |
| | | |
| | | } |
| | |
| | | public class HouseVO extends HouseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 拼接地址 |
| | | */ |
| | | private String address; |
| | | |
| | | private List<HouseLabelVO> houseLabelVOList = new ArrayList<>(); |
| | | } |
| | |
| | | private String roleRelationName; |
| | | |
| | | /** |
| | | * 小区名称 |
| | | */ |
| | | private String aoiName; |
| | | |
| | | /** |
| | | * 地址 |
| | | */ |
| | | private String address; |
| | | |
| | | /** |
| | | * 标签 |
| | | */ |
| | | private List<HouseholdLabelVO> householdLabelList = new ArrayList<>(); |