lin
2024-03-25 9f8f9d13c42ca8cdccbf351069082a5fdccef2e4
src/main/java/org/springblade/modules/house/service/impl/HouseServiceImpl.java
@@ -23,12 +23,14 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.util.Strings;
import org.springblade.common.cache.SysCache;
import org.springblade.common.param.CommonParamSet;
import org.springblade.common.utils.IdUtils;
import org.springblade.common.utils.NodeTreeUtil;
import org.springblade.common.utils.SpringUtils;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.modules.grid.entity.GridEntity;
import org.springblade.modules.grid.entity.GridRangeEntity;
import org.springblade.modules.grid.service.IGridRangeService;
import org.springblade.modules.grid.service.IGridService;
@@ -46,10 +48,11 @@
import org.springblade.modules.house.vo.HouseVO;
import org.springblade.modules.label.entity.LabelEntity;
import org.springblade.modules.label.service.ILabelService;
import org.springblade.modules.system.entity.Dept;
import org.springblade.modules.label.vo.LabelVO;
import org.springblade.modules.police.entity.PoliceAffairsGridEntity;
import org.springblade.modules.police.service.IPoliceAffairsGridService;
import org.springblade.modules.system.entity.Region;
import org.springblade.modules.system.entity.User;
import org.springblade.modules.system.service.IDeptService;
import org.springblade.modules.system.service.IRegionService;
import org.springblade.modules.system.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -88,22 +91,19 @@
   @Override
   public IPage<HouseVO> selectHousePage(IPage<HouseVO> page, HouseVO house) {
      List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId());
      Integer isAdministrator = AuthUtil.isAdministrator()==true?1:2;
      List<HouseVO> houseVOS = baseMapper.selectHousePage(page, house,regionChildCodesList,isAdministrator);
      // 遍历查询网格
//      for (HouseVO houseVO : houseVOS) {
//         // 设置对应的网格名称
//         GridVO gridVO = gridService.getGridDetailByHouseCode(houseVO.getHouseCode());
//         if (null!= gridVO){
//            houseVO.setGridName(gridVO.getGridName());
//         }
//      }
//      List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId());
//      Integer isAdministrator = AuthUtil.isAdministrator() == true ? 1 : 2;
      CommonParamSet commonParamSet = new CommonParamSet().invoke(HouseVO.class,house);
      List<HouseVO> houseVOS = baseMapper.selectHousePage(page, house,
         commonParamSet.getRegionChildCodesList(),commonParamSet.getGridCodeList(), commonParamSet.getIsAdministrator()
         );
      return page.setRecords(houseVOS);
   }
   /**
    * 房屋自定义详情查询
    *
    * @param house
    * @return
    */
@@ -114,6 +114,7 @@
   /**
    * 房屋自定义新增或修改
    *
    * @param house
    * @return
    */
@@ -131,7 +132,7 @@
            // 更新数据
            return updateById(house);
         }
      }else {
      } else {
         //自己生成编号
         // 设置来源( 1:地址总表  2:国控采集)
         house.setSource(2);
@@ -148,15 +149,16 @@
   /**
    * 网格绑定
    *
    * @param house
    */
   public void gridBind(HouseEntity house) {
      if (null!=house.getGridId()){
      if (null != house.getGridId()) {
         // 判断关联关系表是否存在
         QueryWrapper<GridRangeEntity> wrapper = new QueryWrapper<>();
         wrapper.eq("grid_id",house.getGridId()).eq("house_code",house.getHouseCode());
         wrapper.eq("grid_id", house.getGridId()).eq("house_code", house.getHouseCode());
         GridRangeEntity one = gridRangeService.getOne(wrapper);
         if (null==one){
         if (null == one) {
            // 新增
            GridRangeEntity gridRangeEntity = new GridRangeEntity();
            gridRangeEntity.setHouseCode(house.getHouseCode());
@@ -170,6 +172,7 @@
   /**
    * 导入房屋数据
    *
    * @param data
    * @param isCovered
    */
@@ -189,18 +192,20 @@
   /**
    * 查询房屋树
    *
    * @param houseParam
    * @return
    */
   @Override
   public List<HouseTree> getHouseTree(HouseParam houseParam) {
      List<String> houseCodeList = getHouseCodeList(houseParam);
      return NodeTreeUtil.getHouseTree(baseMapper.getHouseTree(houseParam,houseCodeList));
      return NodeTreeUtil.getHouseTree(baseMapper.getHouseTree(houseParam, houseCodeList));
   }
   /**
    * 根据角色获取地址编号集合
    *
    * @param houseParam
    * @return
    */
@@ -209,7 +214,7 @@
      if (null != houseParam.getRoleName() && !houseParam.getRoleName().equals("")) {
         if (houseParam.getRoleName().equals("网格员")) {
            // 查询对应的房屋地址code
            stringList = gridService.getAddressCodeListByUserId(AuthUtil.getUserId());
            stringList = gridService.getAddressCodeListByUserId(AuthUtil.getUserId(),null);
         }
      }
      return stringList;
@@ -217,6 +222,7 @@
   /**
    * 人房数据导入
    *
    * @param data
    * @param isCovered
    */
@@ -236,23 +242,24 @@
   /**
    * 保存房屋数据
    *
    * @param houseAndHoldExcel
    */
   @Transactional(rollbackFor = Exception.class)
   public void saveHouseData(HouseAndHoldExcel houseAndHoldExcel) {
      // 查询库中是否已存在
      QueryWrapper<HouseEntity> wrapper = new QueryWrapper<>();
      wrapper.eq("house_code",houseAndHoldExcel.getHouseCode())
      .eq("is_deleted",0);
      wrapper.eq("house_code", houseAndHoldExcel.getHouseCode())
         .eq("is_deleted", 0);
      HouseEntity one = getOne(wrapper);
      // 不存在则插入,存在则不操作
      if (null == one){
      if (null == one) {
         HouseEntity houseEntity = new HouseEntity();
         houseEntity.setHouseCode(houseAndHoldExcel.getHouseCode());
         houseEntity.setHouseName(houseAndHoldExcel.getHouseName());
         houseEntity.setDistrictName(houseAndHoldExcel.getDistrictName());
         houseEntity.setUnit(houseAndHoldExcel.getUnit());
         if (!Strings.isBlank(houseAndHoldExcel.getFloor())){
         if (!Strings.isBlank(houseAndHoldExcel.getFloor())) {
            houseEntity.setFloor(houseAndHoldExcel.getFloor());
         }
         houseEntity.setRoom(houseAndHoldExcel.getRoom());
@@ -274,7 +281,7 @@
         houseEntity.setUpdateUser(AuthUtil.getUserId().toString());
         if (!Strings.isBlank(houseAndHoldExcel.getHouseCode())) {
            houseEntity.setSource(1);
         }else {
         } else {
            houseEntity.setHouseCode(IdUtils.getIdBy36());
            houseEntity.setSource(2);
         }
@@ -285,66 +292,70 @@
   /**
    * 保存住户数据
    *
    * @param houseAndHoldExcel
    */
   @Transactional(rollbackFor = Exception.class)
   public void saveHouseholdData(HouseAndHoldExcel houseAndHoldExcel) {
      // 查询库中是否已存在
      QueryWrapper<HouseholdEntity> wrapper = new QueryWrapper<>();
      wrapper.eq("house_code",houseAndHoldExcel.getHouseCode())
         .eq("is_deleted",0)
         .eq("name",houseAndHoldExcel.getName());
      wrapper.eq("house_code", houseAndHoldExcel.getHouseCode())
         .eq("is_deleted", 0)
         .eq("id_card", houseAndHoldExcel.getIdCard())
         .eq("name", houseAndHoldExcel.getName());
      HouseholdEntity one = householdService.getOne(wrapper);
      // 不存在则插入,存在则不操作
      if (null == one){
      if (null == one) {
         HouseholdEntity householdEntity = new HouseholdEntity();
         householdEntity.setHouseCode(houseAndHoldExcel.getHouseCode());
         householdEntity.setName(houseAndHoldExcel.getName());
         householdEntity.setPhoneNumber(houseAndHoldExcel.getPhoneNumber());
         if (!Strings.isBlank(houseAndHoldExcel.getRoleType())){
            householdEntity.setRoleType(Integer.parseInt(houseAndHoldExcel.getRoleType()));
         }
         // 与角色关系
         if (!Strings.isBlank(houseAndHoldExcel.getRelationship())){
         if (!Strings.isBlank(houseAndHoldExcel.getRelationship())) {
            householdEntity.setRelationship(Integer.parseInt(houseAndHoldExcel.getRelationship()));
            // 如果是业主,则需要往用户表插入用户
            if (householdEntity.getRelationship()==1){
            if (householdEntity.getRelationship() == 1) {
               saveOrUpdateUser(householdEntity);
            }
         }
         /// 是否主要联系人
         if (!Strings.isBlank(houseAndHoldExcel.getIsPrimaryContact())){
         if (!Strings.isBlank(houseAndHoldExcel.getIsPrimaryContact())) {
            householdEntity.setIsPrimaryContact(Integer.parseInt(houseAndHoldExcel.getIsPrimaryContact()));
         }
         // 居住状态
         if (!Strings.isBlank(houseAndHoldExcel.getResidentialStatus())){
         if (!Strings.isBlank(houseAndHoldExcel.getResidentialStatus())) {
            householdEntity.setResidentialStatus(Integer.parseInt(houseAndHoldExcel.getResidentialStatus()));
         }
         // 性别
         if (!Strings.isBlank(houseAndHoldExcel.getGender())){
         if (!Strings.isBlank(houseAndHoldExcel.getGender())) {
            householdEntity.setGender(Short.parseShort(houseAndHoldExcel.getGender()));
         }
         householdEntity.setIdCard(houseAndHoldExcel.getIdCard());
         // 居民身份证
         if (!Strings.isBlank(houseAndHoldExcel.getIdCard())) {
            // 身份证类型为居民身份证
            householdEntity.setCardType(111);
            householdEntity.setIdCard(houseAndHoldExcel.getIdCard());
         }
         // 党员
         if (!Strings.isBlank(houseAndHoldExcel.getPartyEmber())){
         if (!Strings.isBlank(houseAndHoldExcel.getPartyEmber())) {
            householdEntity.setPartyEmber(Integer.parseInt(houseAndHoldExcel.getPartyEmber()));
         }
         householdEntity.setHkmtPass(houseAndHoldExcel.getHkmtPass());
         householdEntity.setPassport(houseAndHoldExcel.getPassport());
         // householdEntity.setHkmtPass(houseAndHoldExcel.getHkmtPass());
         // householdEntity.setPassport(houseAndHoldExcel.getPassport());
         // 民族
         if (!Strings.isBlank(houseAndHoldExcel.getEthnicity())){
         if (!Strings.isBlank(houseAndHoldExcel.getEthnicity())) {
            householdEntity.setEthnicity(Integer.parseInt(houseAndHoldExcel.getEthnicity()));
         }
         // 学历
         if (!Strings.isBlank(houseAndHoldExcel.getEducation())){
         if (!Strings.isBlank(houseAndHoldExcel.getEducation())) {
            householdEntity.setEducation(Integer.parseInt(houseAndHoldExcel.getEducation()));
         }
         // 户籍类型
         if (!Strings.isBlank(houseAndHoldExcel.getResidentType())){
         if (!Strings.isBlank(houseAndHoldExcel.getResidentType())) {
            householdEntity.setResidentType(Integer.parseInt(houseAndHoldExcel.getResidentType().trim()));
         }
         // 户籍地区县
         if (!Strings.isBlank(houseAndHoldExcel.getResidentAdcode())){
         if (!Strings.isBlank(houseAndHoldExcel.getResidentAdcode())) {
            String adCode = shiftResidentResidentAdCode(houseAndHoldExcel.getResidentProvinceAdcode(),
               houseAndHoldExcel.getResidentCityAdcode(),
               houseAndHoldExcel.getResidentAdcode());
@@ -353,7 +364,7 @@
         }
         householdEntity.setHukouRegistration(houseAndHoldExcel.getHukouRegistration());
         // 籍贯地区县
         if (!Strings.isBlank(houseAndHoldExcel.getNativePlaceAdcode())){
         if (!Strings.isBlank(houseAndHoldExcel.getNativePlaceAdcode())) {
            String adCode = shiftResidentResidentAdCode(null,
               null,
               houseAndHoldExcel.getNativePlaceAdcode());
@@ -361,18 +372,19 @@
            houseAndHoldExcel.setNativePlaceAdcode(adCode);
         }
         // 健康状况
         if (!Strings.isBlank(houseAndHoldExcel.getHealthStatus())){
         if (!Strings.isBlank(houseAndHoldExcel.getHealthStatus())) {
            householdEntity.setHealthStatus(Integer.parseInt(houseAndHoldExcel.getHealthStatus()));
         }
         householdEntity.setDiseaseName(houseAndHoldExcel.getDiseaseName());
         householdEntity.setReligiousBelief(houseAndHoldExcel.getReligiousBelief());
         // 工作状态
         if (!Strings.isBlank(houseAndHoldExcel.getWorkStatus())){
         if (!Strings.isBlank(houseAndHoldExcel.getWorkStatus())) {
            householdEntity.setWorkStatus(Integer.parseInt(houseAndHoldExcel.getWorkStatus()));
         }
         householdEntity.setEmployer(houseAndHoldExcel.getEmployer());
         householdEntity.setOccupation(houseAndHoldExcel.getOccupation());
         householdEntity.setCmpyRegAddr(houseAndHoldExcel.getCmpyRegAddr());
         // 外出
         householdEntity.setGoOutReason(houseAndHoldExcel.getGoOutReason());
         if (!Strings.isBlank(houseAndHoldExcel.getGoOutTime())) {
            try {
@@ -385,12 +397,14 @@
         householdEntity.setGoOutWhere(houseAndHoldExcel.getGoOutWhere());
         householdEntity.setGoOutAddr(houseAndHoldExcel.getGoOutAddr());
         // 婚姻状态
         if (!Strings.isBlank(houseAndHoldExcel.getMaritalStatus())){
         if (!Strings.isBlank(houseAndHoldExcel.getMaritalStatus())) {
            householdEntity.setMaritalStatus(Integer.parseInt(houseAndHoldExcel.getMaritalStatus()));
         }
         // 车牌号
         householdEntity.setCardNumber(houseAndHoldExcel.getCardNumber());
         // 其他联系方式
         householdEntity.setOtherContact(houseAndHoldExcel.getOtherContact());
         if (Strings.isBlank(householdEntity.getHouseCode())){
         if (!Strings.isBlank(householdEntity.getHomeAdcode())) {
            // 暂时不处理,导入数据目前都有house_code
            String adCode = shiftResidentHomeAdcode(houseAndHoldExcel.getHomeAdcode());
            // 转换行政区code
@@ -428,55 +442,55 @@
               }
            }
         }
      }else {
      } else {
         // 更新
         one.setHouseCode(houseAndHoldExcel.getHouseCode());
         one.setName(houseAndHoldExcel.getName());
         one.setPhoneNumber(houseAndHoldExcel.getPhoneNumber());
         if (!Strings.isBlank(houseAndHoldExcel.getRoleType())){
            one.setRoleType(Integer.parseInt(houseAndHoldExcel.getRoleType()));
         }
         // 与角色关系
         if (!Strings.isBlank(houseAndHoldExcel.getRelationship())){
         if (!Strings.isBlank(houseAndHoldExcel.getRelationship())) {
            one.setRelationship(Integer.parseInt(houseAndHoldExcel.getRelationship()));
            // 如果是业主,则需要往用户表插入用户
            if (one.getRelationship()==1){
            if (one.getRelationship() == 1) {
               saveOrUpdateUser(one);
            }
         }
         /// 是否主要联系人
         if (!Strings.isBlank(houseAndHoldExcel.getIsPrimaryContact())){
         if (!Strings.isBlank(houseAndHoldExcel.getIsPrimaryContact())) {
            one.setIsPrimaryContact(Integer.parseInt(houseAndHoldExcel.getIsPrimaryContact()));
         }
         // 居住状态
         if (!Strings.isBlank(houseAndHoldExcel.getResidentialStatus())){
         if (!Strings.isBlank(houseAndHoldExcel.getResidentialStatus())) {
            one.setResidentialStatus(Integer.parseInt(houseAndHoldExcel.getResidentialStatus()));
         }
         // 性别
         if (!Strings.isBlank(houseAndHoldExcel.getGender())){
         if (!Strings.isBlank(houseAndHoldExcel.getGender())) {
            one.setGender(Short.parseShort(houseAndHoldExcel.getGender()));
         }
         one.setIdCard(houseAndHoldExcel.getIdCard());
         // 居民身份证
         if (!Strings.isBlank(houseAndHoldExcel.getIdCard())) {
            // 身份证类型为居民身份证
            one.setCardType(111);
            one.setIdCard(houseAndHoldExcel.getIdCard());
         }
         // 党员
         if (!Strings.isBlank(houseAndHoldExcel.getPartyEmber())){
         if (!Strings.isBlank(houseAndHoldExcel.getPartyEmber())) {
            one.setPartyEmber(Integer.parseInt(houseAndHoldExcel.getPartyEmber()));
         }
         one.setHkmtPass(houseAndHoldExcel.getHkmtPass());
         one.setPassport(houseAndHoldExcel.getPassport());
         // 民族
         if (!Strings.isBlank(houseAndHoldExcel.getEthnicity())){
         if (!Strings.isBlank(houseAndHoldExcel.getEthnicity())) {
            one.setEthnicity(Integer.parseInt(houseAndHoldExcel.getEthnicity()));
         }
         // 学历
         if (!Strings.isBlank(houseAndHoldExcel.getEducation())){
         if (!Strings.isBlank(houseAndHoldExcel.getEducation())) {
            one.setEducation(Integer.parseInt(houseAndHoldExcel.getEducation()));
         }
         // 户籍类型
         if (!Strings.isBlank(houseAndHoldExcel.getResidentType())){
         if (!Strings.isBlank(houseAndHoldExcel.getResidentType())) {
            one.setResidentType(Integer.parseInt(houseAndHoldExcel.getResidentType().trim()));
         }
         // 户籍地区县
         if (!Strings.isBlank(houseAndHoldExcel.getResidentAdcode())){
         if (!Strings.isBlank(houseAndHoldExcel.getResidentAdcode())) {
            String adCode = shiftResidentResidentAdCode(houseAndHoldExcel.getResidentProvinceAdcode(),
               houseAndHoldExcel.getResidentCityAdcode(),
               houseAndHoldExcel.getResidentAdcode());
@@ -485,7 +499,7 @@
         }
         one.setHukouRegistration(houseAndHoldExcel.getHukouRegistration());
         // 籍贯地区县
         if (!Strings.isBlank(houseAndHoldExcel.getNativePlaceAdcode())){
         if (!Strings.isBlank(houseAndHoldExcel.getNativePlaceAdcode())) {
            String adCode = shiftResidentResidentAdCode(null,
               null,
               houseAndHoldExcel.getNativePlaceAdcode());
@@ -493,13 +507,13 @@
            houseAndHoldExcel.setNativePlaceAdcode(adCode);
         }
         // 健康状况
         if (!Strings.isBlank(houseAndHoldExcel.getHealthStatus())){
         if (!Strings.isBlank(houseAndHoldExcel.getHealthStatus())) {
            one.setHealthStatus(Integer.parseInt(houseAndHoldExcel.getHealthStatus()));
         }
         one.setDiseaseName(houseAndHoldExcel.getDiseaseName());
         one.setReligiousBelief(houseAndHoldExcel.getReligiousBelief());
         // 工作状态
         if (!Strings.isBlank(houseAndHoldExcel.getWorkStatus())){
         if (!Strings.isBlank(houseAndHoldExcel.getWorkStatus())) {
            one.setWorkStatus(Integer.parseInt(houseAndHoldExcel.getWorkStatus()));
         }
         one.setEmployer(houseAndHoldExcel.getEmployer());
@@ -517,12 +531,12 @@
         one.setGoOutWhere(houseAndHoldExcel.getGoOutWhere());
         one.setGoOutAddr(houseAndHoldExcel.getGoOutAddr());
         // 婚姻状态
         if (!Strings.isBlank(houseAndHoldExcel.getMaritalStatus())){
         if (!Strings.isBlank(houseAndHoldExcel.getMaritalStatus())) {
            one.setMaritalStatus(Integer.parseInt(houseAndHoldExcel.getMaritalStatus()));
         }
         one.setCardNumber(houseAndHoldExcel.getCardNumber());
         one.setOtherContact(houseAndHoldExcel.getOtherContact());
         if (Strings.isBlank(one.getHouseCode())){
         if (!Strings.isBlank(one.getHomeAdcode())) {
            // 暂时不处理,导入数据目前都有house_code
            String adCode = shiftResidentHomeAdcode(houseAndHoldExcel.getHomeAdcode());
            // 转换行政区code
@@ -563,15 +577,16 @@
   /**
    * 现居住地街道转换
    *
    * @param homeAdcode
    * @return
    */
   public String shiftResidentHomeAdcode(String homeAdcode) {
      // 只根据区县名称查询
      QueryWrapper<Region> wrapper = new QueryWrapper<>();
      wrapper.eq("town_name",homeAdcode);
      wrapper.eq("town_name", homeAdcode);
      List<Region> list = regionService.list(wrapper);
      if (list.size()==1){
      if (list.size() == 1) {
         return list.get(0).getTownCode();
      }
      return "";
@@ -579,28 +594,29 @@
   /**
    * 根据名称转成code
    *
    * @param residentProvinceAdcode 省名称
    * @param residentCityAdcode 市名称
    * @param residentAdcode 区县名称
    * @param residentCityAdcode     市名称
    * @param residentAdcode         区县名称
    */
   public String shiftResidentResidentAdCode(String residentProvinceAdcode,String residentCityAdcode,String residentAdcode) {
   public String shiftResidentResidentAdCode(String residentProvinceAdcode, String residentCityAdcode, String residentAdcode) {
      if (!Strings.isBlank(residentProvinceAdcode)
         && !Strings.isBlank(residentCityAdcode)){
         && !Strings.isBlank(residentCityAdcode)) {
         // 根据省市县三级查询对应的区县code
         QueryWrapper<Region> wrapper = new QueryWrapper<>();
         wrapper.eq("province_name",residentProvinceAdcode)
            .eq("city_name",residentCityAdcode)
            .eq("district_name",residentAdcode);
         wrapper.eq("province_name", residentProvinceAdcode)
            .eq("city_name", residentCityAdcode)
            .eq("district_name", residentAdcode);
         List<Region> list = regionService.list(wrapper);
         if (list.size()>0){
         if (list.size() > 0) {
            return list.get(0).getDistrictCode();
         }
      }else {
      } else {
         // 只根据区县名称查询
         QueryWrapper<Region> wrapper = new QueryWrapper<>();
         wrapper.eq("district_name",residentAdcode);
         wrapper.eq("district_name", residentAdcode);
         List<Region> list = regionService.list(wrapper);
         if (list.size()==1){
         if (list.size() == 1) {
            return list.get(0).getDistrictCode();
         }
      }
@@ -609,19 +625,20 @@
   /**
    * 保存或更新用户(业主)
    *
    * @param householdEntity
    */
   public void saveOrUpdateUser(HouseholdEntity householdEntity) {
      if (null!=householdEntity.getPhoneNumber() && !householdEntity.getPhoneNumber().equals("")) {
      if (null != householdEntity.getPhoneNumber() && !householdEntity.getPhoneNumber().equals("")) {
         //根据手机号查询库里的数据
         User userParams = new User();
         userParams.setPhone(householdEntity.getPhoneNumber());
         User user = userService.getOne(Condition.getQueryWrapper(userParams));
         if (null!=user) {
         if (null != user) {
            //如果用户存在,则该用户id绑定住户
            householdEntity.setAssociatedUserId(user.getId());
            // 判断用户是否包含了居民角色,不包含则需更新
            if (!user.getRoleId().contains("1717429059648606209")){
            if (!user.getRoleId().contains("1717429059648606209")) {
               user.setRoleId(user.getRoleId() + ",1717429059648606209");
               //更新
               userService.updateById(user);
@@ -649,7 +666,7 @@
   }
   @Override
   public Map<String, Object> getHouseStatistics(String code, String roleType,String aoiCode,String buildingCode,String unitCode) {
   public Map<String, Object> getHouseStatistics(String code, String roleType, String aoiCode, String buildingCode, String unitCode) {
      Map<String, Object> objectObjectHashMap = new HashMap<>();
      if (roleType.equals("2")) {
         //    result1 查询楼栋数  result2 查询房屋套数 result3 查询住户数  result4 查询单元数
@@ -684,4 +701,84 @@
   public List<String> getHouseUnit(String districtCode, String building) {
      return baseMapper.getHouseUnit(districtCode, building);
   }
   @Override
   public List<Map<String, Object>> labelStatistics(HouseVO house) {
      List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId());
      Integer isAdministrator = AuthUtil.isAdministrator() == true ? 1 : 2;
      return baseMapper.labelStatistics(house, regionChildCodesList, isAdministrator);
   }
   @Override
   public List<Map<String, Object>> labelCommunityStatistics(HouseVO house) {
      List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId());
      Integer isAdministrator = AuthUtil.isAdministrator() == true ? 1 : 2;
      List<Map<String, Object>> list = baseMapper.labelCommunityStatistics(house, regionChildCodesList);
      for (Map<String, Object> map : list) {
         List<LabelVO> code = baseMapper.getlabelCount(house, regionChildCodesList, isAdministrator, map.get("code").toString());
         map.put("child",code);
      }
      return list;
   }
   /**
    * 房屋网格处理
    * @return
    */
   @Override
   public Object houseGridHandle() {
      // 查询未处理的数据
      List<HouseEntity> houseEntityList = baseMapper.getNotBindGridOrJwGridList(1);
      // 遍历
      for (HouseEntity houseEntity : houseEntityList) {
         String point = "'POINT(" + houseEntity.getLng() + " " + houseEntity.getLat() + ")'";
         List<GridEntity> gridEntityList = SpringUtils.getBean(IGridService.class).spatialAnalysis(point);
         if (gridEntityList.size()>0){
            houseEntity.setGridCode(gridEntityList.get(0).getGridCode());
            houseEntity.setGridId(gridEntityList.get(0).getId());
            // 更新
            updateById(houseEntity);
         }
      }
      return null;
   }
   /**
    * 房屋警格处理
    * @return
    */
   @Override
   public Object houseJwGridHandle() {
      // 查询未处理的数据
      List<HouseEntity> houseEntityList = baseMapper.getNotBindGridOrJwGridList(2);
      // 遍历
      for (HouseEntity houseEntity : houseEntityList) {
         String point = "'POINT(" + houseEntity.getLng() + " " + houseEntity.getLat() + ")'";
         List<PoliceAffairsGridEntity> policeAffairsGridEntityList = SpringUtils.getBean(IPoliceAffairsGridService.class).spatialAnalysis(point);
         if (policeAffairsGridEntityList.size()>0){
            houseEntity.setJwGridCode(policeAffairsGridEntityList.get(0).getJwGridCode());
            // 更新
            updateById(houseEntity);
         }
      }
      return null;
   }
   /**
    * 房屋画像统计-按房屋标签统计
    * @param house
    * @return
    */
   @Override
   public List<Map<String,Object>> getHouseLabelStatistic(HouseVO house) {
      CommonParamSet commonParamSet = new CommonParamSet<>().invoke(HouseVO.class, house);
      // 按房屋标签统计
      List<Map<String,Object>> list = baseMapper.getHouseLabelStatistic(house,
         commonParamSet.getIsAdministrator(),
         commonParamSet.getRegionChildCodesList(),
         commonParamSet.getGridCodeList());
      // 返回
      return list;
   }
}