| | |
| | | list = gridService.getAddressCodeListByUserId(AuthUtil.getUserId()); |
| | | } |
| | | } |
| | | List<PlaceVO> placeVOS = baseMapper.selectPlacePage(page, place, list,regionChildCodesList,isAdministrator); |
| | | // 遍历 |
| | | for (PlaceVO placeVO : placeVOS) { |
| | | // 设置对应的网格名称 |
| | | GridVO gridVO = gridService.getGridDetailByHouseCode(placeVO.getHouseCode()); |
| | | if (null!= gridVO){ |
| | | placeVO.setGridName(gridVO.getGridName()); |
| | | } |
| | | } |
| | | List<PlaceVO> placeVOS = baseMapper.selectPlacePage(page, place,list,regionChildCodesList,isAdministrator); |
| | | // 返回 |
| | | return page.setRecords(placeVOS); |
| | | } |
| | |
| | | setPlaceStatus(placeVO); |
| | | // 更新场所信息 |
| | | flag = updateById(placeVO); |
| | | // 保存场所详情及任务信息 |
| | | savePlaceExtAndTaskInfo(placeVO); |
| | | // 场所标签信息绑定(更新,调整) |
| | | placeLabelBind(placeVO); |
| | | // 网格绑定 |
| | | gridBind(placeVO); |
| | | }else { |
| | | // 设置基础数据 |
| | | placeVO.setCreateUser(AuthUtil.getUserId()); |
| | |
| | | setPlaceStatus(placeVO); |
| | | // 新增场所信息 |
| | | flag = save(placeVO); |
| | | // 保存场所详情及任务信息 |
| | | savePlaceExtAndTaskInfo(placeVO); |
| | | // 场所标签信息绑定 |
| | | placeLabelBind(placeVO); |
| | | // 网格绑定 |
| | | gridBind(placeVO); |
| | | } |
| | | // 位置绑定,通过定位去匹配所在网格 |
| | | // 保存场所详情及任务信息 |
| | | savePlaceExtAndTaskInfo(placeVO); |
| | | // 场所标签信息绑定(更新,调整) |
| | | placeLabelBind(placeVO); |
| | | // 网格绑定 |
| | | gridBind(placeVO); |
| | | // 网格编号绑定场所-新 |
| | | gridCodeBind(placeVO); |
| | | // 房屋编号绑定 |
| | | // houseCodeBind(placeVO); |
| | | // 返回结果 |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * 房屋绑定 |
| | | * @param placeVO |
| | | */ |
| | | public void houseCodeBind(PlaceVO placeVO) { |
| | | String houseCode = placeVO.getHouseCode(); |
| | | List<String> list = Arrays.asList(houseCode.split(",")); |
| | | if (list.size()>1){ |
| | | // 处理对应的绑定房屋数据 |
| | | List<Long> longs = new ArrayList<>(); |
| | | // 把其他单个的场所数据删除 |
| | | for (String code : list) { |
| | | // 先查询对应的场所id |
| | | QueryWrapper<PlaceEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("house_code",code).eq("is_deleted",0); |
| | | PlaceEntity one = getOne(wrapper); |
| | | if (null!=one){ |
| | | longs.add(one.getId()); |
| | | // 删除对应的单个编号的场所 |
| | | removeById(one.getId()); |
| | | } |
| | | } |
| | | if (longs.size()>0) { |
| | | // 删除对应的详情 |
| | | removePlaceExt(longs); |
| | | // 删除对应的标签绑定信息 |
| | | removePlaceLabel(longs); |
| | | } |
| | | }else { |
| | | // 一对一,暂时不处理,后续考虑需加绑定关系表 |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 网格员角色位置绑定 |
| | | * 网格编号绑定 |
| | | * @param placeVO |
| | | */ |
| | | private void gridmanPositionHandle(PlaceVO placeVO) { |
| | | public void gridCodeBind(PlaceVO placeVO) { |
| | | // 无网格编号时 |
| | | if (Strings.isBlank(placeVO.getGridCode())){ |
| | | // 判断角色,如果是网格员则直接使用网格员的网格id,如果是民警则采用点落面的方式进行获取网格的id |
| | | if (!Strings.isBlank(placeVO.getRoleName())) { |
| | | // 网格员场所网格编号绑定-新 |
| | | gridmanGridCodePositionHandle(placeVO); |
| | | // 民警角色时通过位置绑定网格-新 |
| | | policeGridCodePositionHandle(placeVO); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 网格员角色位置绑定-grid_id |
| | | * @param placeVO |
| | | */ |
| | | public void gridmanPositionHandle(PlaceVO placeVO) { |
| | | if (placeVO.getRoleName().equals("网格员")) { |
| | | // 判断网格员,查询对应网格人对应的网格id |
| | | Integer gridId = gridmanService.getGridIdByUserId(AuthUtil.getUserId()); |
| | |
| | | // 修改 |
| | | gridRangeService.updateById(one); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 网格员角色位置绑定-grid_code |
| | | * @param placeVO |
| | | */ |
| | | public void gridmanGridCodePositionHandle(PlaceVO placeVO) { |
| | | if (placeVO.getRoleName().equals("网格员")) { |
| | | // 判断网格员,查询对应网格人对应的网格 |
| | | GridEntity grid = gridService.getGridByUserId(AuthUtil.getUserId()); |
| | | if (null != grid && !Strings.isBlank(grid.getGridCode())) { |
| | | // 场所编号绑定 |
| | | placeVO.setGridCode(grid.getGridCode()); |
| | | // 更新场所信息 |
| | | updateById(placeVO); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 民警角色时通过位置绑定网格 |
| | | * @param placeVO |
| | | */ |
| | | private void policeGridCodePositionHandle(PlaceVO placeVO) { |
| | | // 是民警且位置信息存在 |
| | | if (placeVO.getRoleName().equals("民警") && !Strings.isBlank(placeVO.getLng())) { |
| | | //点坐标解析 |
| | | String point = "'POINT(" + placeVO.getLng() + " " + placeVO.getLat() +")'"; |
| | | // String point = "'POINT(" + villageInfoExcel.getLatitude() + " " + villageInfoExcel.getLongitude() +")'"; |
| | | GridEntity gridEntity = gridMapper.spatialAnalysis(point); |
| | | if (null != gridEntity && !Strings.isBlank(gridEntity.getGridCode())) { |
| | | // 场所编号绑定 |
| | | placeVO.setGridCode(gridEntity.getGridCode()); |
| | | // 更新场所信息 |
| | | updateById(placeVO); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 场所标签信息绑定入库 |
| | | * @param placeVO |
| | | */ |
| | |
| | | * @param placeVO |
| | | */ |
| | | public void savePlaceLabel(PlaceVO placeVO) { |
| | | // 批量新增 |
| | | List<String> labelList = Arrays.asList(placeVO.getLabel().split(",")); |
| | | if (labelList.size()>1){ |
| | | // 只处理小类 |
| | | // 遍历 |
| | | labelList.forEach(labelId -> { |
| | | if (!Strings.isBlank(placeVO.getLabel())) { |
| | | // 批量新增 |
| | | List<String> labelList = Arrays.asList(placeVO.getLabel().split(",")); |
| | | if (labelList.size() > 1) { |
| | | // 只处理小类 |
| | | // 遍历 |
| | | labelList.forEach(labelId -> { |
| | | // 处理小类 |
| | | if (labelId.length() > 4) { |
| | | // 切割成三个,分别是大类,中类,小类 |
| | | String bigString = labelId.substring(0, 2); |
| | | String midString = labelId.substring(0, 4); |
| | | // 大类 |
| | | PlacePoiLabel big = new PlacePoiLabel(); |
| | | big.setPlaceId(placeVO.getId()); |
| | | big.setPoiCode(Integer.parseInt(bigString)); |
| | | big.setType(1); |
| | | if (!Strings.isBlank(placeVO.getColor())) { |
| | | big.setColor(placeVO.getColor()); |
| | | } |
| | | placePoiLabelService.save(big); |
| | | // 中类 |
| | | PlacePoiLabel mid = new PlacePoiLabel(); |
| | | mid.setPlaceId(placeVO.getId()); |
| | | mid.setPoiCode(Integer.parseInt(midString)); |
| | | mid.setType(2); |
| | | if (!Strings.isBlank(placeVO.getColor())) { |
| | | mid.setColor(placeVO.getColor()); |
| | | } |
| | | placePoiLabelService.save(mid); |
| | | // 小类 |
| | | PlacePoiLabel min = new PlacePoiLabel(); |
| | | min.setPlaceId(placeVO.getId()); |
| | | min.setPoiCode(Integer.parseInt(labelId)); |
| | | min.setType(3); |
| | | if (!Strings.isBlank(placeVO.getColor())) { |
| | | min.setColor(placeVO.getColor()); |
| | | } |
| | | placePoiLabelService.save(min); |
| | | } |
| | | }); |
| | | } else { |
| | | // 处理单个 |
| | | String labelCode = labelList.get(0); |
| | | // 切割成三个,分别是大类,中类,小类 |
| | | String bigString = labelCode.substring(0, 2); |
| | | String midString = labelCode.substring(0, 4); |
| | | // 大类 |
| | | PlacePoiLabel big = new PlacePoiLabel(); |
| | | big.setPlaceId(placeVO.getId()); |
| | | big.setPoiCode(Integer.parseInt(bigString)); |
| | | big.setType(1); |
| | | if (!Strings.isBlank(placeVO.getColor())) { |
| | | big.setColor(placeVO.getColor()); |
| | | } |
| | | placePoiLabelService.save(big); |
| | | // 中类 |
| | | PlacePoiLabel mid = new PlacePoiLabel(); |
| | | mid.setPlaceId(placeVO.getId()); |
| | | mid.setPoiCode(Integer.parseInt(midString)); |
| | | mid.setType(2); |
| | | if (!Strings.isBlank(placeVO.getColor())) { |
| | | mid.setColor(placeVO.getColor()); |
| | | } |
| | | placePoiLabelService.save(mid); |
| | | // 处理小类 |
| | | if (labelId.length()>4) { |
| | | // 切割成三个,分别是大类,中类,小类 |
| | | String bigString = labelId.substring(0,2); |
| | | String midString = labelId.substring(0,4); |
| | | // 大类 |
| | | PlacePoiLabel big = new PlacePoiLabel(); |
| | | big.setPlaceId(placeVO.getId()); |
| | | big.setPoiCode(Integer.parseInt(bigString)); |
| | | big.setType(1); |
| | | if (!Strings.isBlank(placeVO.getColor())){ |
| | | big.setColor(placeVO.getColor()); |
| | | } |
| | | placePoiLabelService.save(big); |
| | | // 中类 |
| | | PlacePoiLabel mid = new PlacePoiLabel(); |
| | | mid.setPlaceId(placeVO.getId()); |
| | | mid.setPoiCode(Integer.parseInt(midString)); |
| | | mid.setType(2); |
| | | if (!Strings.isBlank(placeVO.getColor())){ |
| | | mid.setColor(placeVO.getColor()); |
| | | } |
| | | placePoiLabelService.save(mid); |
| | | if (labelCode.length() > 4) { |
| | | // 小类 |
| | | PlacePoiLabel min = new PlacePoiLabel(); |
| | | min.setPlaceId(placeVO.getId()); |
| | | min.setPoiCode(Integer.parseInt(labelId)); |
| | | min.setPoiCode(Integer.parseInt(labelCode)); |
| | | min.setType(3); |
| | | if (!Strings.isBlank(placeVO.getColor())){ |
| | | if (!Strings.isBlank(placeVO.getColor())) { |
| | | min.setColor(placeVO.getColor()); |
| | | } |
| | | placePoiLabelService.save(min); |
| | | } |
| | | }); |
| | | }else { |
| | | // 处理单个 |
| | | String labelCode = labelList.get(0); |
| | | // 切割成三个,分别是大类,中类,小类 |
| | | String bigString = labelCode.substring(0, 2); |
| | | String midString = labelCode.substring(0, 4); |
| | | // 大类 |
| | | PlacePoiLabel big = new PlacePoiLabel(); |
| | | big.setPlaceId(placeVO.getId()); |
| | | big.setPoiCode(Integer.parseInt(bigString)); |
| | | big.setType(1); |
| | | if (!Strings.isBlank(placeVO.getColor())){ |
| | | big.setColor(placeVO.getColor()); |
| | | } |
| | | placePoiLabelService.save(big); |
| | | // 中类 |
| | | PlacePoiLabel mid = new PlacePoiLabel(); |
| | | mid.setPlaceId(placeVO.getId()); |
| | | mid.setPoiCode(Integer.parseInt(midString)); |
| | | mid.setType(2); |
| | | if (!Strings.isBlank(placeVO.getColor())){ |
| | | mid.setColor(placeVO.getColor()); |
| | | } |
| | | placePoiLabelService.save(mid); |
| | | // 处理小类 |
| | | if (labelCode.length() > 4) { |
| | | // 小类 |
| | | PlacePoiLabel min = new PlacePoiLabel(); |
| | | min.setPlaceId(placeVO.getId()); |
| | | min.setPoiCode(Integer.parseInt(labelCode)); |
| | | min.setType(3); |
| | | if (!Strings.isBlank(placeVO.getColor())){ |
| | | min.setColor(placeVO.getColor()); |
| | | } |
| | | placePoiLabelService.save(min); |
| | | } |
| | | } |
| | | } |
| | |
| | | public PlaceVO getDetail(PlaceVO place) { |
| | | // 查询场所信息 |
| | | PlaceVO placeVO = baseMapper.getDetail(place); |
| | | if (null!= place.getAddressType() && place.getAddressType()==4){ |
| | | if (null != placeVO) { |
| | | // 门牌信息 |
| | | if (null != placeVO) { |
| | | if (null != place.getAddressType() && place.getAddressType() == 4) { |
| | | // 查询地址编码信息(社区派出所相关信息) |
| | | DoorplateAddressEntity addressEntity = placeRelService.getDoorplateAddressEntity(placeVO); |
| | | placeVO.setDoorplateAddressEntity(addressEntity); |
| | | // 查询网格信息 |
| | | // 查询网格信息--商超 |
| | | placeVO.setGrid(gridService.getGridDetailByParam(placeVO)); |
| | | } |
| | | }else { |
| | | if (null != placeVO) { |
| | | if (null != placeVO.getHouseCode() && !placeVO.getHouseCode().equals("")) { |
| | | place.setHouseCode(placeVO.getHouseCode()); |
| | | } |
| | | if (placeVO.getPlacePoiLabelVOList().size()>0){ |
| | | } else { |
| | | // 管理后台查询赋值颜色 |
| | | if (placeVO.getPlacePoiLabelVOList().size() > 0) { |
| | | PlacePoiLabelVO placePoiLabelVO = placeVO.getPlacePoiLabelVOList().get(0); |
| | | if (!Strings.isBlank(placePoiLabelVO.getColor())){ |
| | | if (!Strings.isBlank(placePoiLabelVO.getColor())) { |
| | | placeVO.setColor(placePoiLabelVO.getColor()); |
| | | } |
| | | } |
| | | // 查询门牌地址信息 |
| | | if (null != place.getHouseCode() && !place.getHouseCode().equals("")) { |
| | | QueryWrapper<DoorplateAddressEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("address_code", place.getHouseCode()); |
| | | List<DoorplateAddressEntity> list = doorplateAddressService.list(wrapper); |
| | | if (list.size() > 0) { |
| | | placeVO.setDoorplateAddressEntity(list.get(0)); |
| | | placeVO.setNeiCode(list.get(0).getNeiCode()); |
| | | } |
| | | // 查询网格数据 |
| | | GridVO gridVO = gridService.getGridDetailByHouseCode(place.getHouseCode()); |
| | | if (null!= gridVO) { |
| | | placeVO.setGrid(gridVO); |
| | | place.setGridId(gridVO.getId()); |
| | | } |
| | | // 设置详情信息 |
| | | QueryWrapper<PlaceExtEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("is_deleted",0).eq("place_id",placeVO.getId()); |
| | | placeVO.setPlaceExtEntity(placeExtService.getOne(queryWrapper)); |
| | | } else { |
| | | // 通过定位点落面分析网格位置,反向推出社区派出所相关数据 |
| | | |
| | | // 查询地址门牌信息 |
| | | QueryWrapper<DoorplateAddressEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("address_code", placeVO.getHouseCode()); |
| | | List<DoorplateAddressEntity> list = doorplateAddressService.list(wrapper); |
| | | if (list.size() > 0) { |
| | | placeVO.setDoorplateAddressEntity(list.get(0)); |
| | | placeVO.setNeiCode(list.get(0).getNeiCode()); |
| | | } |
| | | // 查询场所对应的网格数据 |
| | | placeVO.setGrid(gridService.getPlaceGridDetailByHouseCode(placeVO.getHouseCode())); |
| | | // 设置详情信息 |
| | | QueryWrapper<PlaceExtEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("is_deleted", 0).eq("place_id", placeVO.getId()); |
| | | placeVO.setPlaceExtEntity(placeExtService.getOne(queryWrapper)); |
| | | } |
| | | } |
| | | // 返回 |