| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.qiniu.util.Auth; |
| | | import liquibase.repackaged.org.apache.commons.lang3.StringUtils; |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.springblade.common.constant.DictConstant; |
| | | import org.springblade.common.node.TreeNode; |
| | | import org.springblade.common.node.TreeStringNode; |
| | | import org.springblade.common.utils.NodeTreeUtil; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.modules.category.dto.CategoryLabelDTO; |
| | | import org.springblade.modules.category.service.ICategoryLabelService; |
| | | import org.springblade.modules.district.entity.DistrictEntity; |
| | | import org.springblade.modules.district.service.IDistrictService; |
| | | import org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity; |
| | | import org.springblade.modules.doorplateAddress.mapper.DoorplateAddressMapper; |
| | | import org.springblade.modules.doorplateAddress.service.IDoorplateAddressService; |
| | |
| | | import org.springblade.modules.house.vo.HouseParam; |
| | | import org.springblade.modules.house.vo.HouseRentalVO; |
| | | import org.springblade.modules.house.vo.HouseholdVO; |
| | | import org.springblade.modules.place.entity.PlaceEntity; |
| | | import org.springblade.modules.place.service.IPlaceService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | @Autowired |
| | | private IGridService gridService; |
| | | |
| | | @Autowired |
| | | private IDistrictService districtService; |
| | | |
| | | @Autowired |
| | | private ICategoryLabelService iCategoryLabelService; |
| | | |
| | | |
| | | @Override |
| | | public IPage<DoorplateAddressVO> selectDoorplateAddressPage(IPage<DoorplateAddressVO> page, DoorplateAddressVO doorplateAddress) { |
| | |
| | | stringList = gridService.getAddressCodeListByUserId(AuthUtil.getUserId()); |
| | | } |
| | | } |
| | | List<TreeNode> list = new ArrayList<>(); |
| | | List<TreeStringNode> list = new ArrayList<>(); |
| | | if (null!=type) { |
| | | // 如果是网格管理员,系统管理员 |
| | | if (type==1){ |
| | | // 查询街道 |
| | | List<TreeNode> townList = baseMapper.getRegionListByGroupTwon(houseParam,stringList); |
| | | List<TreeStringNode> townList = baseMapper.getRegionListByGroupTwon(houseParam,stringList); |
| | | // 查询社区 |
| | | List<TreeNode> neiList = baseMapper.getRegionListByGroupNei(houseParam,stringList); |
| | | List<TreeStringNode> neiList = baseMapper.getRegionListByGroupNei(houseParam,stringList); |
| | | // 遍历 |
| | | for (TreeNode treeNode : townList) { |
| | | for (TreeStringNode treeNode : townList) { |
| | | // 遍历 |
| | | for (TreeNode node : neiList) { |
| | | for (TreeStringNode node : neiList) { |
| | | if (treeNode.getId().equals(node.getParentId())){ |
| | | node.setHasChildren(false); |
| | | treeNode.getChildren().add(node); |
| | |
| | | * @param list |
| | | * @return |
| | | */ |
| | | private Object getInhabitantInfo(List<TreeNode> list) { |
| | | private Object getInhabitantInfo(List<TreeStringNode> list) { |
| | | // 查询房屋集合信息 |
| | | List<TreeNode> houseNodeList = householdService.selectHouseNodeList(AuthUtil.getUserId()); |
| | | for (TreeNode treeNode : houseNodeList) { |
| | | List<TreeStringNode> houseNodeList = householdService.selectHouseNodeList(AuthUtil.getUserId()); |
| | | for (TreeStringNode treeNode : houseNodeList) { |
| | | // 判断房屋类型类型 |
| | | if (DictConstant.SMALL_DOORPLATE.equals(treeNode.getDoorplateType()) || |
| | | (DictConstant.centre_DOORPLATE.equals(treeNode.getDoorplateType()) && |
| | |
| | | } |
| | | } |
| | | // 查询场所集合信息 |
| | | List<TreeNode> placeNodeList = placeService.selectPlaceNodeList(AuthUtil.getUserId()); |
| | | for (TreeNode treeNode : placeNodeList) { |
| | | List<TreeStringNode> placeNodeList = placeService.selectPlaceNodeList(AuthUtil.getUserId()); |
| | | for (TreeStringNode treeNode : placeNodeList) { |
| | | treeNode.setAddressType(2); |
| | | CategoryLabelDTO categoryLabelDTO = new CategoryLabelDTO(); |
| | | categoryLabelDTO.setPlaceId(treeNode.getId()); |
| | | List<CategoryLabelDTO> categoryLabelDTOS = iCategoryLabelService.selectCategoryLabelList(categoryLabelDTO); |
| | | treeNode.setCategoryLabelList(categoryLabelDTOS); |
| | | // if (DictConstant.SMALL_DOORPLATE.equals(treeNode.getDoorplateType()) || |
| | | // (DictConstant.centre_DOORPLATE.equals(treeNode.getDoorplateType()) && |
| | | // treeNode.getAddressLevel().equals(1))) { |
| | |
| | | } |
| | | if (houseNodeList.size() > 0 && placeNodeList.size() > 0) { |
| | | // 合并 |
| | | TreeNode houseNode = new TreeNode(); |
| | | TreeStringNode houseNode = new TreeStringNode(); |
| | | houseNode.setName("房屋"); |
| | | houseNode.setId("1"); |
| | | houseNode.setHasChildren(true); |
| | | houseNode.setChildren(houseNodeList); |
| | | |
| | | TreeNode placeNode = new TreeNode(); |
| | | TreeStringNode placeNode = new TreeStringNode(); |
| | | placeNode.setName("场所"); |
| | | placeNode.setId("2"); |
| | | placeNode.setHasChildren(true); |
| | |
| | | */ |
| | | @Override |
| | | public Object getHousesList(HouseParam houseParam) { |
| | | List<TreeNode> list = new ArrayList<>(); |
| | | List<TreeStringNode> list = new ArrayList<>(); |
| | | Map<String, Object> map = new HashMap<>(2); |
| | | // 获取网格员对应的地址编号集合 |
| | | List<String> stringList = getHouseCodeList(houseParam); |
| | |
| | | // 获取网格员对应的网格信息 |
| | | getGridInfoByGridman(houseParam); |
| | | // 查询商超 |
| | | List<TreeNode> list = baseMapper.getPlaceRelList(houseParam); |
| | | List<TreeStringNode> list = baseMapper.getPlaceRelList(houseParam); |
| | | map.put("aoiList", new ArrayList<>()); |
| | | map.put("shopList", list); |
| | | // 返回 |
| | |
| | | List<String> stringList = getHouseCodeList(houseParam); |
| | | // 判断 code 长度,如果 code 长度大于 12 则为小区查楼栋/商铺,否则则按社区查街路巷 |
| | | if (houseParam.getCode().length() > 12) { |
| | | List<TreeNode> aoiList = new ArrayList<>(); |
| | | List<TreeNode> shopList = new ArrayList<>(); |
| | | List<TreeStringNode> aoiList = new ArrayList<>(); |
| | | List<TreeStringNode> shopList = new ArrayList<>(); |
| | | // 根据社区名称查询楼栋或者商铺的集合 |
| | | |
| | | List<TreeNode> list = baseMapper.getBuildingList(houseParam, stringList); |
| | | List<TreeStringNode> list = baseMapper.getBuildingList(houseParam, stringList); |
| | | // 排序 StringUtils.getDigits(X.getName()) 取出数字排序 |
| | | List<TreeNode> sortList = list.stream().sorted(Comparator.comparing(X -> StringUtils.getDigits(X.getName()))).collect(Collectors.toList()); |
| | | List<TreeStringNode> sortList = list.stream().sorted(Comparator.comparing(X -> StringUtils.getDigits(X.getName()))).collect(Collectors.toList()); |
| | | if (list.size() > 0) { |
| | | for (TreeNode treeNode : sortList) { |
| | | for (TreeStringNode treeNode : sortList) { |
| | | if (treeNode.getAddressType() == 1) { |
| | | aoiList.add(treeNode); |
| | | } |
| | |
| | | return map; |
| | | } else { |
| | | // 查询街路巷 |
| | | List<TreeNode> list = baseMapper.getStreetRuList(houseParam, stringList); |
| | | List<TreeStringNode> list = baseMapper.getStreetRuList(houseParam, stringList); |
| | | map.put("aoiList", new ArrayList<>()); |
| | | map.put("shopList", list); |
| | | // 返回 |
| | |
| | | // 批量插入 |
| | | houseService.saveBatch(houseList); |
| | | } |
| | | |
| | | /** |
| | | * 小区数据处理 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Object aoiDataHandle() { |
| | | // 查询所有的地址表id集合 |
| | | List<Long> aoiCodeList = baseMapper.getAoiCodeList(); |
| | | // 查询小区集合 |
| | | List<DoorplateAddressEntity> list = baseMapper.getAoiList(aoiCodeList); |
| | | // 创建小区集合对象 |
| | | List<DistrictEntity> aoiList = new ArrayList<>(); |
| | | // 将小区数据保存到小区表中 |
| | | for (DoorplateAddressEntity addressEntity : list) { |
| | | DistrictEntity districtEntity = new DistrictEntity(); |
| | | districtEntity.setCommunityCode(addressEntity.getNeiCode()); |
| | | districtEntity.setAoiCode(addressEntity.getAoiCode()); |
| | | districtEntity.setName(addressEntity.getAoiName()); |
| | | districtEntity.setAddress(addressEntity.getAddressName()); |
| | | districtEntity.setLng(addressEntity.getX()); |
| | | districtEntity.setLat(addressEntity.getY()); |
| | | // 加入集合 |
| | | aoiList.add(districtEntity); |
| | | } |
| | | // 批量插入 |
| | | districtService.saveBatch(aoiList); |
| | | // 返回 |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 场所数据处理 |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Object placeDataHandle() { |
| | | // 查询所有的地址表和场所表差集集合 |
| | | List<DoorplateAddressEntity> list = baseMapper.getPlaceList(); |
| | | // 创建场所集合对象 |
| | | List<PlaceEntity> placeList = new ArrayList<>(); |
| | | // 将小区数据保存到小区表中 |
| | | for (DoorplateAddressEntity addressEntity : list) { |
| | | PlaceEntity placeEntity = new PlaceEntity(); |
| | | placeEntity.setHouseCode(addressEntity.getAddressCode()); |
| | | placeEntity.setPlaceName(addressEntity.getPoi()); |
| | | placeEntity.setLng(addressEntity.getX()); |
| | | placeEntity.setLat(addressEntity.getY()); |
| | | placeEntity.setLocaltion(addressEntity.getAddressName()); |
| | | placeEntity.setLat(addressEntity.getY()); |
| | | // 加入集合 |
| | | placeList.add(placeEntity); |
| | | } |
| | | // 批量插入 |
| | | placeService.saveBatch(placeList); |
| | | // 返回 |
| | | return null; |
| | | } |
| | | } |