| | |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | | import org.springblade.modules.house.entity.UserHouseLabelEntity; |
| | | import org.springblade.modules.house.service.IHouseholdService; |
| | | import org.springblade.modules.house.vo.HouseholdVO; |
| | | import org.springblade.modules.label.entity.LabelEntity; |
| | | import org.springblade.modules.place.entity.*; |
| | | import org.springblade.modules.place.excel.NinePlaceExcel; |
| | |
| | | gridBind(placeVO); |
| | | // 警务网格绑定 |
| | | jwGridCodeBind(placeVO); |
| | | // 保存从业人员 |
| | | savePlacePractitioner(placeVO); |
| | | // 返回结果 |
| | | return flag; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 保存从业人员 |
| | | * |
| | | * @param placeVO |
| | | */ |
| | | private void savePlacePractitioner(PlaceVO placeVO) { |
| | | if (placeVO.getPlacePractitioner() != null) { |
| | | IPlacePractitionerService practitionerService = SpringUtil.getBean(IPlacePractitionerService.class); |
| | | // 查询对应已存在的租户 |
| | | QueryWrapper<PlacePractitionerEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("place_id", placeVO.getId()).eq("is_deleted",0); |
| | | List<PlacePractitionerEntity> oldList = practitionerService.list(wrapper); |
| | | // 取出从业人员信息 |
| | | List<PlacePractitionerEntity> placePractitionerList = placeVO.getPlacePractitioner(); |
| | | for (PlacePractitionerEntity placePractitionerEntity : placePractitionerList) { |
| | | placePractitionerEntity.setPlaceId(placeVO.getId()); |
| | | } |
| | | // 申明新增,修改,删除集合 |
| | | List<PlacePractitionerEntity> newList = new ArrayList<>(); |
| | | List<PlacePractitionerEntity> addList = new ArrayList<>(); |
| | | List<PlacePractitionerEntity> updateList = new ArrayList<>(); |
| | | List<PlacePractitionerEntity> removeList = new ArrayList<>(); |
| | | // 遍历设置数据 |
| | | for (PlacePractitionerEntity placePractitionerEntity : placePractitionerList) { |
| | | if (null == placePractitionerEntity.getId()) { |
| | | // 新增 |
| | | addList.add(placePractitionerEntity); |
| | | } else { |
| | | newList.add(placePractitionerEntity); |
| | | } |
| | | } |
| | | // 遍历去差集,判断是新增还是删除还是更新 |
| | | // 取旧数据和新提交数据差集--删除 |
| | | removeList = oldList.stream().filter(vo -> !newList.stream().map(e -> |
| | | e.getId()).collect(Collectors.toList()).contains(vo.getId())).collect(Collectors.toList()); |
| | | // 取旧数据和新提交数据交集--更新 |
| | | updateList = newList.stream().filter(vo -> oldList.stream().map(e -> |
| | | e.getId()).collect(Collectors.toList()).contains(vo.getId())).collect(Collectors.toList()); |
| | | |
| | | // 批量新增 |
| | | if (addList.size() > 0) { |
| | | practitionerService.saveBatch(addList); |
| | | } |
| | | // 批量修改 |
| | | if (updateList.size() > 0) { |
| | | practitionerService.updateBatchById(updateList); |
| | | } |
| | | // 批量删除 |
| | | if (removeList.size() > 0) { |
| | | practitionerService.removeBatchByIds(removeList); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * @param placeVO |
| | | */ |
| | | @Override |
| | | public void jwGridCodeBind(PlaceVO placeVO) { |
| | | if (!Strings.isBlank(placeVO.getLng())) { |
| | | String point = "'POINT(" + placeVO.getLng() + " " + placeVO.getLat() + ")'"; |
| | |
| | | * |
| | | * @param placeVO |
| | | */ |
| | | private void policePositionHandle(PlaceVO placeVO) { |
| | | @Override |
| | | public void policePositionHandle(PlaceVO placeVO) { |
| | | // 是民警且位置信息存在 |
| | | if (!Strings.isBlank(placeVO.getLng())) { |
| | | //点坐标解析 |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void savePlaceExtAndTaskInfo(PlaceVO placeVO) { |
| | | PlaceExtEntity placeExtEntity = new PlaceExtEntity(); |
| | | placeExtEntity.setPlaceId(placeVO.getId()); |
| | | // 判断是否已存在,已存在则不新增 |
| | | QueryWrapper<PlaceExtEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("is_deleted", 0) |
| | | .eq("place_id", placeVO.getId()); |
| | | PlaceExtEntity one = placeExtService.getOne(wrapper); |
| | | if (null == one) { |
| | | PlaceExtEntity extServiceOne = placeExtService.getOne(wrapper); |
| | | if (null == extServiceOne) { |
| | | // 判断是否有传 |
| | | if (placeVO.getPlaceExtEntity() != null) { |
| | | placeExtEntity = placeVO.getPlaceExtEntity(); |
| | | } |
| | | placeExtEntity.setPlaceId(placeVO.getId()); |
| | | // 默认给待完善状态 |
| | | placeExtEntity.setConfirmFlag(4); |
| | |
| | | // 新增场所详情 |
| | | placeExtService.save(placeExtEntity); |
| | | } else { |
| | | placeExtService.updateById(placeVO.getPlaceExtEntity()); |
| | | if (placeVO.getPlaceExtEntity() != null) { |
| | | placeExtService.updateById(placeVO.getPlaceExtEntity()); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | QueryWrapper<PlaceExtEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("is_deleted", 0).eq("place_id", placeVO.getId()); |
| | | placeVO.setPlaceExtEntity(placeExtService.getOne(queryWrapper)); |
| | | // 查询从业人员 |
| | | IPlacePractitionerService placePractitionerService = SpringUtils.getBean(IPlacePractitionerService.class); |
| | | List<PlacePractitionerEntity> entityList = placePractitionerService.list(Wrappers.<PlacePractitionerEntity>lambdaQuery() |
| | | .eq(PlacePractitionerEntity::getPlaceId, placeVO.getId())); |
| | | placeVO.setPlacePractitioner(entityList); |
| | | // 查询绑定的房屋 |
| | | placeVO.setHouseBindList(baseMapper.getHouseBindMap(placeVO.getHouseCodeBinds())); |
| | | } |