| | |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.springblade.common.cache.SysCache; |
| | | import org.springblade.common.node.TreeStringNode; |
| | | import org.springblade.common.param.CommonParamSet; |
| | | import org.springblade.common.utils.IdUtils; |
| | | import org.springblade.common.utils.SpringUtils; |
| | | import org.springblade.core.mp.support.Condition; |
| | |
| | | import org.springblade.modules.place.service.IPlaceExtService; |
| | | import org.springblade.modules.place.service.IPlacePoiLabelService; |
| | | import org.springblade.modules.place.service.IPlaceRelService; |
| | | import org.springblade.modules.place.vo.PlaceCheckVO; |
| | | import org.springblade.modules.place.vo.PlacePoiLabelVO; |
| | | import org.springblade.modules.place.vo.PlaceVO; |
| | | import org.springblade.modules.place.mapper.PlaceMapper; |
| | |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.service.IDeptService; |
| | | import org.springblade.modules.system.service.IDictBizService; |
| | | import org.springblade.modules.system.service.IRegionService; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | 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 IHouseholdService householdService; |
| | | |
| | | @Autowired |
| | | private IDictBizService dictBizService; |
| | | |
| | | /** |
| | | * 自定义列表查询 |
| | | * |
| | |
| | | */ |
| | | @Override |
| | | public IPage<PlaceVO> selectPlacePage(IPage<PlaceVO> page, PlaceVO place) { |
| | | List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId()); |
| | | Integer isAdministrator = AuthUtil.isAdministrator() == true ? 1 : 2; |
| | | List<String> list = new ArrayList<>(); |
| | | if (null != place.getRoleName() && !place.getRoleName().equals("")) { |
| | | if (place.getRoleName().equals("网格员")) { |
| | | // 查询对应的房屋地址code |
| | | list = gridService.getAddressCodeListByUserId(AuthUtil.getUserId()); |
| | | } |
| | | } |
| | | List<PlaceVO> placeVOS = baseMapper.selectPlacePage(page, place, list, regionChildCodesList, isAdministrator); |
| | | // 公共参数设置 |
| | | CommonParamSet commonParamSet = new CommonParamSet().invoke(PlaceVO.class,place); |
| | | List<PlaceVO> placeVOS = baseMapper.selectPlacePage(page, |
| | | place, |
| | | commonParamSet.getGridCodeList(), |
| | | commonParamSet.getRegionChildCodesList(), |
| | | commonParamSet.getIsAdministrator()); |
| | | // 返回 |
| | | return page.setRecords(placeVOS); |
| | | } |
| | |
| | | placeVO.setUpdateTime(new Date()); |
| | | // 查看是否包含houseCode,如果有,则更新 |
| | | if (!Strings.isBlank(placeVO.getHouseCode())) { |
| | | setSource(placeVO); |
| | | // 比对是否1km 范围内(现场)采集 |
| | | setIsScene(placeVO); |
| | | // 更新,先查询场所信息 |
| | |
| | | // houseCodeBind(placeVO); |
| | | // 返回结果 |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * 设置场所的source 来源 |
| | | * @param placeVO |
| | | */ |
| | | public void setSource(PlaceVO placeVO) { |
| | | if (null!=placeVO.getSource()){ |
| | | placeVO.setSource(placeVO.getSource()); |
| | | }else { |
| | | // 查询该houseCode 是否存在地址总表,如果是,赋值 1,否则2 |
| | | QueryWrapper<DoorplateAddressEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("address_code",placeVO.getHouseCode()); |
| | | DoorplateAddressEntity one = doorplateAddressService.getOne(wrapper); |
| | | if (null!=one){ |
| | | placeVO.setSource(1); |
| | | }else { |
| | | placeVO.setSource(2); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | && !Strings.isBlank(placeVO.getLocation()) |
| | | && !Strings.isBlank(placeVO.getPlaceName()) |
| | | && !Strings.isBlank(placeVO.getImageUrls()) |
| | | && !Strings.isBlank(placeVO.getPrincipalIdCard()) |
| | | ) { |
| | | // 已完善 |
| | | placeVO.setStatus(2); |
| | |
| | | if (null != addressEntity) { |
| | | placeVO = new PlaceVO(); |
| | | placeVO.setDoorplateAddressEntity(addressEntity); |
| | | placeVO.setLng(addressEntity.getX()); |
| | | placeVO.setLat(addressEntity.getY()); |
| | | placeVO.setLocation(addressEntity.getAddressName()); |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public IPage<PlaceVO> selectNinePlacePage(IPage<PlaceVO> page, PlaceVO place) { |
| | | // todo |
| | | List<String> regionChildCodesList = new ArrayList<>();//SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId()); |
| | | Integer isAdministrator = AuthUtil.isAdministrator() == true ? 1 : 2; |
| | | List<String> list = new ArrayList<>(); |
| | | if (null != place.getRoleName() && !place.getRoleName().equals("")) { |
| | | if (place.getRoleName().equals("网格员")) { |
| | | // 查询对应的房屋地址code |
| | | list = gridService.getAddressCodeListByUserId(AuthUtil.getUserId()); |
| | | String roleName = SpringUtils.getRequestParam("roleName"); |
| | | String communityCode = SpringUtils.getRequestParam("communityCode"); |
| | | if (!Strings.isBlank(communityCode)){ |
| | | // 校验社区编号是否合规 |
| | | if(null!=SpringUtils.getBean(IRegionService.class).getById(communityCode)) { |
| | | place.setCommunityCode(communityCode); |
| | | } |
| | | } |
| | | List<PlaceVO> placeVOS = baseMapper.selectNinePlacePage(page, place, list, regionChildCodesList, isAdministrator); |
| | | List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId()); |
| | | Integer isAdministrator = AuthUtil.isAdministrator()==true?1:2; |
| | | // 网格编号集合 |
| | | List<String> gridCodeList = new ArrayList<>(); |
| | | // 民警角色 |
| | | if (!Strings.isBlank(roleName)){ |
| | | place.setRoleName(roleName); |
| | | if(roleName.equals("mj")) { |
| | | regionChildCodesList = SpringUtil.getBean(IPoliceAffairsGridService.class).getCommunityCodeListByUserId(AuthUtil.getUserId()); |
| | | } |
| | | if (roleName.equals("wgy")) { |
| | | gridCodeList = SpringUtil.getBean(IGridService.class).getGridListByUserId(AuthUtil.getUserId()); |
| | | } |
| | | } |
| | | List<String> strings = new ArrayList<>(); |
| | | if (null!=place.getNineType()){ |
| | | QueryWrapper<DictBiz> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("is_deleted",0).eq("dict_key",place.getNineType()).eq("code","nineType"); |
| | | // 先查询当前 |
| | | DictBiz one = dictBizService.getOne(queryWrapper); |
| | | // 查询本身和子集的key |
| | | List<DictBiz> list = dictBizService.getList("nineType", one.getId()); |
| | | if (list.size()==0){ |
| | | strings.add(place.getNineType().toString()); |
| | | }else { |
| | | strings = list.stream().map(DictBiz::getDictKey).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | List<PlaceVO> placeVOS = baseMapper.selectNinePlacePage(page, place, gridCodeList, regionChildCodesList, isAdministrator,strings); |
| | | // 返回 |
| | | return page.setRecords(placeVOS); |
| | | } |
| | | |
| | | @Override |
| | | public List<NinePlaceExcel> export(PlaceVO place) { |
| | | place.setIsNine(1); |
| | | // todo |
| | | List<String> regionChildCodesList = new ArrayList<>();//SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId()); |
| | | Integer isAdministrator = AuthUtil.isAdministrator() == true ? 1 : 2; |
| | | List<String> list = new ArrayList<>(); |
| | | if (null != place.getRoleName() && !place.getRoleName().equals("")) { |
| | | if (place.getRoleName().equals("网格员")) { |
| | | // 查询对应的房屋地址code |
| | | list = gridService.getAddressCodeListByUserId(AuthUtil.getUserId()); |
| | | String roleName = SpringUtils.getRequestParam("roleName"); |
| | | String communityCode = SpringUtils.getRequestParam("communityCode"); |
| | | if (!Strings.isBlank(communityCode)){ |
| | | // 校验社区编号是否合规 |
| | | if(null!=SpringUtils.getBean(IRegionService.class).getById(communityCode)) { |
| | | place.setCommunityCode(communityCode); |
| | | } |
| | | } |
| | | List<NinePlaceExcel> aa = baseMapper.export(place, list, regionChildCodesList, isAdministrator); |
| | | List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId()); |
| | | Integer isAdministrator = AuthUtil.isAdministrator()==true?1:2; |
| | | // 网格编号集合 |
| | | List<String> gridCodeList = new ArrayList<>(); |
| | | // 民警角色 |
| | | if (!Strings.isBlank(roleName)){ |
| | | place.setRoleName(roleName); |
| | | if(roleName.equals("mj")) { |
| | | regionChildCodesList = SpringUtil.getBean(IPoliceAffairsGridService.class).getCommunityCodeListByUserId(AuthUtil.getUserId()); |
| | | } |
| | | if (roleName.equals("wgy")) { |
| | | gridCodeList = SpringUtil.getBean(IGridService.class).getGridListByUserId(AuthUtil.getUserId()); |
| | | } |
| | | } |
| | | List<String> strings = new ArrayList<>(); |
| | | if (null!=place.getNineType()){ |
| | | QueryWrapper<DictBiz> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("is_deleted",0).eq("dict_key",place.getNineType()).eq("code","nineType"); |
| | | // 先查询当前 |
| | | DictBiz one = dictBizService.getOne(queryWrapper); |
| | | // 查询本身和子集的key |
| | | List<DictBiz> list = dictBizService.getList("nineType", one.getId()); |
| | | if (list.size()==0){ |
| | | strings.add(place.getNineType().toString()); |
| | | }else { |
| | | strings = list.stream().map(DictBiz::getDictKey).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | List<NinePlaceExcel> aa = baseMapper.export(place, gridCodeList, regionChildCodesList, isAdministrator,strings); |
| | | IDictBizService bean = SpringUtils.getBean(IDictBizService.class); |
| | | List<DictBiz> nineType = bean.list(Wrappers.<DictBiz>lambdaQuery().eq(DictBiz::getCode, "nineType").eq(DictBiz::getIsDeleted, 0)); |
| | | for (NinePlaceExcel ninePlaceExcel : aa) { |