| | |
| | | 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; |
| | |
| | | import org.springblade.modules.label.entity.LabelEntity; |
| | | import org.springblade.modules.label.service.ILabelService; |
| | | 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.IRegionService; |
| | |
| | | |
| | | @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); |
| | | // 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); |
| | | } |
| | | |
| | |
| | | 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; |
| | |
| | | QueryWrapper<HouseholdEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("house_code", houseAndHoldExcel.getHouseCode()) |
| | | .eq("is_deleted", 0) |
| | | .eq("id_card", houseAndHoldExcel.getIdCard()) |
| | | .eq("name", houseAndHoldExcel.getName()); |
| | | HouseholdEntity one = householdService.getOne(wrapper); |
| | | // 不存在则插入,存在则不操作 |
| | |
| | | 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())) { |
| | | householdEntity.setRelationship(Integer.parseInt(houseAndHoldExcel.getRelationship())); |
| | |
| | | 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())) { |
| | | householdEntity.setPartyEmber(Integer.parseInt(houseAndHoldExcel.getPartyEmber())); |
| | |
| | | householdEntity.setEmployer(houseAndHoldExcel.getEmployer()); |
| | | householdEntity.setOccupation(houseAndHoldExcel.getOccupation()); |
| | | householdEntity.setCmpyRegAddr(houseAndHoldExcel.getCmpyRegAddr()); |
| | | // 外出 |
| | | householdEntity.setGoOutReason(houseAndHoldExcel.getGoOutReason()); |
| | | if (!Strings.isBlank(houseAndHoldExcel.getGoOutTime())) { |
| | | try { |
| | |
| | | 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 |
| | |
| | | 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())) { |
| | | one.setRelationship(Integer.parseInt(houseAndHoldExcel.getRelationship())); |
| | |
| | | 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())) { |
| | | one.setPartyEmber(Integer.parseInt(houseAndHoldExcel.getPartyEmber())); |
| | | } |
| | | // one.setHkmtPass(houseAndHoldExcel.getHkmtPass()); |
| | | // one.setPassport(houseAndHoldExcel.getPassport()); |
| | | // 民族 |
| | | if (!Strings.isBlank(houseAndHoldExcel.getEthnicity())) { |
| | | one.setEthnicity(Integer.parseInt(houseAndHoldExcel.getEthnicity())); |
| | |
| | | } |
| | | 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 |
| | |
| | | } |
| | | 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; |
| | | } |
| | | } |