| | |
| | | |
| | | <!--根据地址编号查询网格数据--> |
| | | <select id="getGridDetailByHouseCode" resultType="org.springblade.modules.grid.vo.GridVO"> |
| | | select jg.id,jg.grid_name,jg.community_name, |
| | | select jg.id,jg.grid_name,br.town_name AS townStreetName,br.name AS community_name, |
| | | bu.real_name as realName,bu.phone as gridPhone |
| | | from jczz_grid jg |
| | | left join jczz_grid_range jgr on jg.id = jgr.grid_id |
| | | left join jczz_gridman jgm on jg.id = jgm.grid_id and jgm.is_deleted = 0 |
| | | left join blade_user bu on bu.id = jgm.user_id and bu.is_deleted = 0 |
| | | left join blade_region br ON br.code = jg.community_code |
| | | where jg.is_deleted = 0 |
| | | and jgr.house_code = #{houseCode} |
| | | limit 1 |
| | |
| | | |
| | | private String gridPhone; |
| | | |
| | | /** |
| | | * 街道名称 |
| | | */ |
| | | private String townStreetName; |
| | | |
| | | } |
| | |
| | | <select id="selectHousePage" resultMap="houseAndHouseLabelMap"> |
| | | select |
| | | jh.*, |
| | | concat(building," ",unit," ",room) as address, |
| | | jda.town_street_name as townStreetName,jda.nei_name as neiName |
| | | concat(jh.building," ",jh.unit," ",jh.room) as address, |
| | | br.town_name as townStreetName,br.name as neiName |
| | | from jczz_house jh |
| | | left join jczz_doorplate_address jda on jda.address_code = jh.house_code |
| | | left join jczz_grid_range jgr on jgr.house_code = jh.house_code |
| | | left join jczz_grid jg on jg.id = jgr.grid_id and jg.is_deleted = 0 |
| | | left join blade_region br on br.code = jg.community_code |
| | | where jh.is_deleted = 0 |
| | | <if test="house.id != null "> and jh.id = #{house.id}</if> |
| | | <if test="house.streetCode != null and house.streetCode != ''"> |
| | |
| | | and jh.district_name like concat('%',#{house.districtName},'%') |
| | | </if> |
| | | <if test="house.townStreetName!=null and house.townStreetName!=''"> |
| | | and jda.town_street_name like concat('%',#{house.townStreetName},'%') |
| | | and br.town_name like concat('%',#{house.townStreetName},'%') |
| | | </if> |
| | | <if test="house.neiName!=null and house.neiName!=''"> |
| | | and jda.nei_name like concat('%',#{house.neiName},'%') |
| | | and br.name like concat('%',#{house.neiName},'%') |
| | | </if> |
| | | <if test="house.houseName != null and house.houseName != ''"> and jh.house_name like concat('%',#{house.houseName},'%')</if> |
| | | <if test="house.phone != null and house.phone != ''"> and jh.phone = #{house.phone}</if> |
| | |
| | | <select id="getHouseDetail" resultMap="houseAndHouseLabelMap"> |
| | | select |
| | | jh.*, |
| | | jhl.id as cid,jhl.*,jhl.remark as cremark |
| | | jhl.id as cid,jhl.*,jhl.remark as cremark, |
| | | br.code as neiCode,jg.id as gridId,br.town_code as streetCode |
| | | from jczz_house jh |
| | | left join jczz_user_house_label jhl on jh.house_code = jhl.house_code and jhl.lable_type = 2 |
| | | left join jczz_grid_range jgr on jgr.house_code = jh.house_code |
| | | left join jczz_grid jg on jg.id = jgr.grid_id and jg.is_deleted = 0 |
| | | left join blade_region br on br.code = jg.community_code |
| | | where jh.is_deleted = 0 |
| | | and jh.house_code = #{house.houseCode} |
| | | <if test="house.houseCode!=null and house.houseCode!=''"> |
| | | and jh.house_code = #{house.houseCode} |
| | | </if> |
| | | <if test="house.id!=null"> |
| | | and jh.id = #{house.id} |
| | | </if> |
| | | </select> |
| | | |
| | | <!--房屋数据导出--> |
| | |
| | | QueryWrapper<GridRangeEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("grid_id",house.getGridId()).eq("house_code",house.getHouseCode()); |
| | | GridRangeEntity one = gridRangeService.getOne(wrapper); |
| | | if (null!=one){ |
| | | if (null==one){ |
| | | // 新增 |
| | | GridRangeEntity gridRangeEntity = new GridRangeEntity(); |
| | | gridRangeEntity.setHouseCode(house.getHouseCode()); |
| | |
| | | */ |
| | | private String townStreetName; |
| | | /** |
| | | * 社区编号 |
| | | */ |
| | | private String neiCode; |
| | | /** |
| | | * 社区名称 |
| | | */ |
| | | private String neiName; |
| | | |
| | | /** |
| | | * 网格名称 |
| | | */ |
| | |
| | | public R placeUserHandle() { |
| | | return R.data(placeService.placeUserHandle()); |
| | | } |
| | | |
| | | /** |
| | | * 场所标签数据处理 |
| | | */ |
| | | @GetMapping("/placeLabelHandle") |
| | | public R placeLabelHandle() { |
| | | return R.data(placeService.placeLabelHandle()); |
| | | } |
| | | } |
| | |
| | | jp.*, |
| | | bu.real_name as username,bu.phone as phone, |
| | | bx.real_name as createUserName, |
| | | jda.town_street_name as townStreetName,jda.nei_name as neiName, |
| | | br.town_name as townStreetName,br.name as neiName, |
| | | jpe.confirm_flag confirmFlag |
| | | from jczz_place jp |
| | | left join blade_user bu on bu.id = jp.principal_user_id and bu.is_deleted = 0 |
| | | left join blade_user bx on bx.id = jp.create_user and bx.is_deleted = 0 |
| | | left join jczz_doorplate_address jda on jda.address_code = jp.house_code |
| | | LEFT JOIN jczz_place_ext jpe on jpe.place_id=jp.id |
| | | left join jczz_grid_range jgr on jgr.house_code = jp.house_code |
| | | left join jczz_grid jg on jg.id = jgr.grid_id and jg.is_deleted = 0 |
| | | left join blade_region br on br.code = jg.community_code |
| | | left join ( |
| | | select a.* from jczz_place_poi_label a inner join |
| | | ( |
| | |
| | | and jp.house_code = #{place.houseCode} |
| | | </if> |
| | | <if test="place.townStreetName!=null and place.townStreetName!=''"> |
| | | and jda.town_street_name like concat('%',#{place.townStreetName},'%') |
| | | and br.town_name like concat('%',#{place.townStreetName},'%') |
| | | </if> |
| | | <if test="place.neiName!=null and place.neiName!=''"> |
| | | and jda.nei_name like concat('%',#{place.neiName},'%') |
| | | and br.name like concat('%',#{place.neiName},'%') |
| | | </if> |
| | | <if test="place.id!=null"> |
| | | and jp.id = #{place.id} |
| | |
| | | select |
| | | jp.*, |
| | | bu.real_name as username,bu.phone as phone, |
| | | jppl.id as plid,jppl.*,jcl.category_name as labelName |
| | | jppl.id as plid,jppl.*,jc.category_name as labelName, |
| | | br.code as neiCode,jg.id as gridId |
| | | from jczz_place jp |
| | | left join blade_user bu on bu.id = jp.principal_user_id and bu.is_deleted = 0 |
| | | left join jczz_place_poi_label jppl on jppl.place_id = jp.id |
| | | left join jczz_category_label jcl on jcl.category_no = jppl.poi_code |
| | | left join jczz_category jc on jc.category_no = jppl.poi_code |
| | | left join jczz_grid_range jgr on jgr.house_code = jp.house_code |
| | | left join jczz_grid jg on jg.id = jgr.grid_id and jg.is_deleted = 0 |
| | | left join blade_region br on br.code = jg.community_code |
| | | where jp.is_deleted = 0 |
| | | <if test="place.houseCode!=null and place.houseCode!=''"> |
| | | and jp.house_code = #{place.houseCode} |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.springblade.modules.place.entity.PlacePoiLabel; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface PlacePoiLabelMapper extends BaseMapper<PlacePoiLabel> { |
| | | |
| | | /** |
| | | * 查询第三级数据 |
| | | * @return |
| | | */ |
| | | List<PlacePoiLabel> getPlacePoiLabelList(); |
| | | } |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.springblade.modules.place.mapper.PlacePoiLabelMapper"> |
| | | |
| | | |
| | | <!--查询第三级数据--> |
| | | <select id="getPlacePoiLabelList" resultType="org.springblade.modules.place.entity.PlacePoiLabel"> |
| | | select * from jczz_place_poi_label where length(poi_code)=6 |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | import org.springblade.modules.place.entity.PlaceExtEntity; |
| | | import org.springblade.modules.place.entity.PlacePoiLabel; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface IPlacePoiLabelService extends IService<PlacePoiLabel> { |
| | | /** |
| | | * 查询第三级数据 |
| | | * @return |
| | | */ |
| | | List<PlacePoiLabel> getPlacePoiLabelList(); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | boolean updatePlace(PlaceVO placeVO); |
| | | |
| | | /** |
| | | * 场所标签数据处理 |
| | | */ |
| | | Object placeLabelHandle(); |
| | | } |
| | |
| | | import org.springblade.modules.place.service.IPlacePoiLabelService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class PlacePoiLabelServiceImpl extends ServiceImpl<PlacePoiLabelMapper, PlacePoiLabel> implements IPlacePoiLabelService { |
| | | |
| | | /** |
| | | * 查询第三级数据 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<PlacePoiLabel> getPlacePoiLabelList() { |
| | | return baseMapper.getPlacePoiLabelList(); |
| | | } |
| | | } |
| | |
| | | GridVO gridVO = gridService.getGridDetailByHouseCode(placeVO.getHouseCode()); |
| | | if (null!= gridVO){ |
| | | placeVO.setGridName(gridVO.getGridName()); |
| | | // placeVO.setNeiName(gridVO.getCommunityName()); |
| | | // placeVO.setTownStreetName(gridVO.getTownStreetName()); |
| | | } |
| | | } |
| | | // 返回 |
| | |
| | | QueryWrapper<GridRangeEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("grid_id",placeVO.getGrid()).eq("house_code",placeVO.getHouseCode()); |
| | | GridRangeEntity one = gridRangeService.getOne(wrapper); |
| | | if (null!=one){ |
| | | if (null==one){ |
| | | // 新增 |
| | | GridRangeEntity gridRangeEntity = new GridRangeEntity(); |
| | | gridRangeEntity.setHouseCode(placeVO.getHouseCode()); |
| | |
| | | // 返回 |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * 场所标签数据处理 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Object placeLabelHandle() { |
| | | // 查询所有的标签绑定 |
| | | List<PlacePoiLabel> list = placePoiLabelService.getPlacePoiLabelList(); |
| | | // 遍历 |
| | | for (PlacePoiLabel placePoiLabel : list) { |
| | | // 处理单个 |
| | | String labelCode = placePoiLabel.getPoiCode().toString(); |
| | | // 切割成三个,分别是大类,中类,小类 |
| | | String bigString = labelCode.substring(0,2); |
| | | String midString = labelCode.substring(0,4); |
| | | // 大类 |
| | | PlacePoiLabel big = new PlacePoiLabel(); |
| | | big.setPlaceId(placePoiLabel.getPlaceId()); |
| | | big.setPoiCode(Integer.parseInt(bigString)); |
| | | big.setType(1); |
| | | // 保存前先判断 |
| | | QueryWrapper<PlacePoiLabel> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("place_id",placePoiLabel.getPlaceId()).eq("poi_code",Integer.parseInt(bigString)); |
| | | PlacePoiLabel one = placePoiLabelService.getOne(queryWrapper); |
| | | if (null==one) { |
| | | placePoiLabelService.save(big); |
| | | } |
| | | // 中类 |
| | | PlacePoiLabel mid = new PlacePoiLabel(); |
| | | mid.setPlaceId(placePoiLabel.getPlaceId()); |
| | | mid.setPoiCode(Integer.parseInt(midString)); |
| | | mid.setType(2); |
| | | // 保存前先判断 |
| | | QueryWrapper<PlacePoiLabel> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("place_id",placePoiLabel.getPlaceId()).eq("poi_code",Integer.parseInt(midString)); |
| | | PlacePoiLabel two = placePoiLabelService.getOne(wrapper); |
| | | if (null==two) { |
| | | placePoiLabelService.save(mid); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |