| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import liquibase.repackaged.org.apache.commons.lang3.StringUtils; |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.springblade.common.cache.SysCache; |
| | | import org.springblade.common.node.TreeStringNode; |
| | | import org.springblade.common.utils.IdUtils; |
| | | 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.SpringUtil; |
| | |
| | | import org.springblade.modules.police.entity.PoliceAffairsGridEntity; |
| | | import org.springblade.modules.police.service.IPoliceAffairsGridService; |
| | | import org.springblade.modules.system.entity.Dept; |
| | | import org.springblade.modules.system.entity.DictBiz; |
| | | 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.IUserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | placeVO.setUpdateTime(new Date()); |
| | | // 查看是否包含houseCode,如果有,则更新 |
| | | if (!Strings.isBlank(placeVO.getHouseCode())) { |
| | | // 比对是否1km 范围内(现场)采集 |
| | | setIsScene(placeVO); |
| | | // 更新,先查询场所信息 |
| | | QueryWrapper<PlaceEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("is_deleted", 0).eq("house_code", placeVO.getHouseCode()); |
| | |
| | | // 设置基础数据 |
| | | placeVO.setCreateUser(AuthUtil.getUserId()); |
| | | placeVO.setCreateTime(new Date()); |
| | | // 比对是否1km 范围内(现场)采集 |
| | | setIsSceneNotHouseCode(placeVO); |
| | | // 设置来源( 1:地址总表 2:国控采集) |
| | | placeVO.setSource(2); |
| | | // 并生成36位的houseCode |
| | |
| | | gridBind(placeVO); |
| | | // 网格编号绑定场所-新 |
| | | gridCodeBind(placeVO); |
| | | // 警务网格绑定 |
| | | jwGridCodeBind(placeVO); |
| | | // 房屋编号绑定 |
| | | // houseCodeBind(placeVO); |
| | | // 返回结果 |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * 警务网格绑定 |
| | | * |
| | | * @param placeVO |
| | | */ |
| | | public void jwGridCodeBind(PlaceVO placeVO) { |
| | | if (!Strings.isBlank(placeVO.getLng())) { |
| | | String point = "'POINT(" + placeVO.getLng() + " " + placeVO.getLat() + ")'"; |
| | | // 点落面警务网格 |
| | | List<PoliceAffairsGridEntity> policeAffairsGridEntities |
| | | = SpringUtil.getBean(IPoliceAffairsGridService.class).spatialAnalysis(point); |
| | | if (policeAffairsGridEntities.size() > 0) { |
| | | // 设置警务网格并更新 |
| | | placeVO.setJwGridCode(policeAffairsGridEntities.get(0).getJwGridCode()); |
| | | // 更新 |
| | | updateById(placeVO); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置是否现场采集(1km 范围内) |
| | | * |
| | | * @param placeVO |
| | | */ |
| | | public void setIsScene(PlaceVO placeVO) { |
| | | if (!Strings.isBlank(placeVO.getX()) && !Strings.isBlank(placeVO.getLng())) { |
| | | Integer placeEntity = baseMapper.comparisonPosition(placeVO); |
| | | if (placeEntity == 1) { |
| | | placeVO.setIsScene(1); |
| | | } else { |
| | | placeVO.setIsScene(2); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置是否现场采集(1km 范围内),非地址总表数据 |
| | | * |
| | | * @param placeVO |
| | | */ |
| | | public void setIsSceneNotHouseCode(PlaceVO placeVO) { |
| | | if (!Strings.isBlank(placeVO.getX()) && !Strings.isBlank(placeVO.getLng())) { |
| | | boolean flag = baseMapper.comparisonPositionNotHouseCode(placeVO); |
| | | if (flag) { |
| | | placeVO.setIsScene(1); |
| | | } else { |
| | | placeVO.setIsScene(2); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public IPage<PlaceVO> selectNinePlacePage(IPage<PlaceVO> page, PlaceVO place) { |
| | | List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId()); |
| | | // 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("")) { |
| | |
| | | @Override |
| | | public List<NinePlaceExcel> export(PlaceVO place) { |
| | | place.setIsNine(1); |
| | | List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId()); |
| | | // 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("")) { |
| | |
| | | } |
| | | } |
| | | List<NinePlaceExcel> aa = baseMapper.export(place, list, regionChildCodesList, isAdministrator); |
| | | 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) { |
| | | for (DictBiz dictBiz : nineType) { |
| | | if (StringUtils.isNotBlank(ninePlaceExcel.getNineType()) && ninePlaceExcel.getNineType().equals(dictBiz.getDictKey())) { |
| | | if (ninePlaceExcel.getNineType().contains("10,11,12")) { |
| | | ninePlaceExcel.setNineType("小学校(幼儿园、校外培训机构)- " + dictBiz.getDictValue()); |
| | | } else if (ninePlaceExcel.getNineType().contains("13,14,15")) { |
| | | ninePlaceExcel.setNineType("小医院(诊所、养老院)- " + dictBiz.getDictValue()); |
| | | } else { |
| | | ninePlaceExcel.setNineType(dictBiz.getDictValue()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return aa; |
| | | } |
| | | |
| | |
| | | List<PlaceEntity> list = baseMapper.getPlaceNotJwGridCode(); |
| | | // 遍历 |
| | | for (PlaceEntity placeEntity : list) { |
| | | if (!Strings.isBlank(placeEntity.getLng())){ |
| | | if (!Strings.isBlank(placeEntity.getLng())) { |
| | | // 空间分析 |
| | | //点坐标解析 |
| | | String point = "'POINT(" + placeEntity.getLng() + " " + placeEntity.getLat() +")'"; |
| | | String point = "'POINT(" + placeEntity.getLng() + " " + placeEntity.getLat() + ")'"; |
| | | //String point = "'POINT(" + villageInfoExcel.getLatitude() + " " + villageInfoExcel.getLongitude() +")'"; |
| | | List<PoliceAffairsGridEntity> policeAffairsGridEntities |
| | | = SpringUtil.getBean(IPoliceAffairsGridService.class).spatialAnalysis(point); |
| | | if (policeAffairsGridEntities.size()>0){ |
| | | if (policeAffairsGridEntities.size() > 0) { |
| | | PoliceAffairsGridEntity policeAffairsGridEntity = policeAffairsGridEntities.get(0); |
| | | placeEntity.setJwGridCode(policeAffairsGridEntity.getJwGridCode()); |
| | | // 更新 |