zhongrj
2023-12-22 ddef54b90b578d14e2cdad5d21a0fc2f612be46a
小区,场所,房屋修改
10 files modified
236 ■■■■ changed files
src/main/java/org/springblade/modules/district/mapper/DistrictMapper.xml 6 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/grid/entity/GridWorkLogEntity.java 26 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/mapper/HouseMapper.xml 9 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml 7 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/service/impl/HouseServiceImpl.java 59 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/vo/HouseVO.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/place/entity/PlacePoiLabel.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml 6 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/place/service/impl/PlaceServiceImpl.java 108 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/place/vo/PlaceVO.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/district/mapper/DistrictMapper.xml
@@ -30,9 +30,15 @@
        <if test="district.name !=null and district.name !=''">
            and jd.name like concat('%',#{district.name},'%')
        </if>
        <if test="district.communityName !=null and district.communityName !=''">
            and br.village_name like concat('%', #{district.communityName},'%')
        </if>
        <if test="district.communityCode !=null and district.communityCode !=''">
            and jd.community_code = #{district.communityCode}
        </if>
        <if test="district.townStreetName !=null and district.townStreetName !=''">
            and br.town_name like concat('%',#{district.townStreetName},'%')
        </if>
    </select>
    <!--小区树查询-->
src/main/java/org/springblade/modules/grid/entity/GridWorkLogEntity.java
@@ -32,6 +32,7 @@
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import org.springframework.format.annotation.DateTimeFormat;
import sun.rmi.runtime.Log;
/**
 * 网格工作日志表 实体类
@@ -58,15 +59,32 @@
     */
    @ApiModelProperty(value = "房屋编号")
    private String houseCode;
    /**
     * 走访人姓名
     * 走访类型
     */
    @ApiModelProperty(value = "走访人姓名")
    @ApiModelProperty(value = "走访类型")
    private Integer type;
    /**
     * 重点人员类型
     */
    @ApiModelProperty(value = "重点人员类型")
    private Integer personType;
    /**
     * 被访人用户id
     */
    @ApiModelProperty(value = "被访人用户id")
    private Long householdId;
    /**
     * 被访人姓名
     */
    @ApiModelProperty(value = "被访人姓名")
    private String name;
    /**
     * 走访人电话
     * 被访人电话
     */
    @ApiModelProperty(value = "走访人电话")
    @ApiModelProperty(value = "被访人电话")
    private String phone;
    /**
     * 内容
src/main/java/org/springblade/modules/house/mapper/HouseMapper.xml
@@ -147,6 +147,12 @@
        <if test="house.districtName != null  and house.districtName != ''">
            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},'%')
        </if>
        <if test="house.neiName!=null and house.neiName!=''">
            and jda.nei_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>
        <if test="house.area != null "> and jh.area = #{house.area}</if>
@@ -157,6 +163,9 @@
        <if test="house.unit != null  and house.unit != ''"> and jh.unit = #{house.unit}</if>
        <if test="house.room != null  and house.room != ''"> and jh.room = #{house.room}</if>
        <if test="house.buildingNo != null "> and jh.building_no = #{house.buildingNo}</if>
        <if test="house.regionCode != null and house.regionCode !='' ">
         and jda.nei_code like concat('%',#{house.regionCode},'%')
        </if>
    </select>
    <!--房屋自定义详情查询-->
src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
@@ -142,7 +142,12 @@
        <if test="household.confirmFlag != null ">
            and jh.confirm_flag = #{household.confirmFlag}
        </if>
        <if test="household.townStreetName!=null and household.townStreetName!=''">
            and jda.town_street_name like concat('%',#{household.townStreetName},'%')
        </if>
        <if test="household.neiName!=null and household.neiName!=''">
            and jda.nei_name like concat('%',#{household.neiName},'%')
        </if>
        <if test="household.housingRentalId != null ">
            and jh.housing_rental_id = #{household.housingRentalId}
        </if>
src/main/java/org/springblade/modules/house/service/impl/HouseServiceImpl.java
@@ -27,6 +27,8 @@
import org.springblade.common.utils.SpringUtils;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.modules.grid.entity.GridRangeEntity;
import org.springblade.modules.grid.service.IGridRangeService;
import org.springblade.modules.grid.service.IGridService;
import org.springblade.modules.grid.vo.GridVO;
import org.springblade.modules.house.entity.HouseEntity;
@@ -43,6 +45,7 @@
import org.springblade.modules.house.vo.HouseVO;
import org.springblade.modules.label.entity.LabelEntity;
import org.springblade.modules.label.service.ILabelService;
import org.springblade.modules.place.vo.PlaceVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -65,6 +68,9 @@
    @Autowired
    private IHouseholdService householdService;
    @Autowired
    private IGridRangeService gridRangeService;
    @Override
    public IPage<HouseVO> selectHousePage(IPage<HouseVO> page, HouseVO house) {
@@ -97,17 +103,52 @@
     */
    @Override
    public boolean saveOrUpdateHouse(HouseEntity house) {
        // 查询是否已存在房屋数据
        QueryWrapper<HouseEntity> wrapper = new QueryWrapper<>();
        wrapper.eq("house_code",house.getHouseCode());
        HouseEntity one = getOne(wrapper);
        if (null != one){
            house.setId(one.getId());
            // 更新数据
            return updateById(house);
        boolean flag = false;
        // 如果没有房屋编号,自己生成
        if (!Strings.isBlank(house.getHouseCode())) {
            // 查询是否已存在房屋数据
            QueryWrapper<HouseEntity> wrapper = new QueryWrapper<>();
            wrapper.eq("house_code", house.getHouseCode());
            HouseEntity one = getOne(wrapper);
            if (null != one) {
                house.setId(one.getId());
                // 更新数据
                return updateById(house);
            }
        }else {
            //自己生成编号
            // 设置来源( 1:地址总表  2:国控采集)
            house.setSource(2);
            // 并生成36位的houseCode
            house.setHouseCode(IdUtils.getIdBy36());
        }
        //插入数据
        return save(house);
        flag = save(house);
        // 设置网格绑定数据
        gridBind(house);
        // 返回
        return flag;
    }
    /**
     * 网格绑定
     * @param house
     */
    public void gridBind(HouseEntity house) {
        if (null!=house.getGridId()){
            // 判断关联关系表是否存在
            QueryWrapper<GridRangeEntity> wrapper = new QueryWrapper<>();
            wrapper.eq("grid_id",house.getGridId()).eq("house_code",house.getHouseCode());
            GridRangeEntity one = gridRangeService.getOne(wrapper);
            if (null!=one){
                // 新增
                GridRangeEntity gridRangeEntity = new GridRangeEntity();
                gridRangeEntity.setHouseCode(house.getHouseCode());
                gridRangeEntity.setGridId(house.getGridId());
                // 插入
                gridRangeService.save(gridRangeEntity);
            }
        }
    }
src/main/java/org/springblade/modules/house/vo/HouseVO.java
@@ -57,5 +57,10 @@
     */
    private String gridName;
    /**
     * 区域编号
     */
    private String regionCode;
    private List<UserHouseLabelVO> userHouseLabelVOList = new ArrayList<>();
}
src/main/java/org/springblade/modules/place/entity/PlacePoiLabel.java
@@ -30,4 +30,9 @@
    private Integer poiCode;
    /**
     * 类型  1:大类  2:中类  3:小类
     */
    private Integer type;
}
src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml
@@ -62,6 +62,12 @@
        <if test="place.houseCode!=null and place.houseCode!=''">
            and jp.house_code = #{place.houseCode}
        </if>
        <if test="place.townStreetName!=null and place.townStreetName!=''">
            and jda.town_street_name like concat('%',#{place.townStreetName},'%')
        </if>
        <if test="place.neiName!=null and place.neiName!=''">
            and jda.nei_name like concat('%',#{place.neiName},'%')
        </if>
        <if test="place.id!=null">
            and jp.id = #{place.id}
        </if>
src/main/java/org/springblade/modules/place/service/impl/PlaceServiceImpl.java
@@ -26,6 +26,8 @@
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity;
import org.springblade.modules.doorplateAddress.service.IDoorplateAddressService;
import org.springblade.modules.grid.entity.GridRangeEntity;
import org.springblade.modules.grid.service.IGridRangeService;
import org.springblade.modules.grid.service.IGridService;
import org.springblade.modules.grid.vo.GridVO;
import org.springblade.modules.place.entity.*;
@@ -71,6 +73,9 @@
    @Autowired
    private IGridService gridService;
    @Autowired
    private IGridRangeService gridRangeService;
    /**
     * 自定义列表查询
@@ -131,7 +136,11 @@
            QueryWrapper<PlaceEntity> wrapper = new QueryWrapper<>();
            wrapper.eq("is_deleted",0).eq("house_code",placeVO.getHouseCode());
            PlaceEntity one = getOne(wrapper);
            placeVO.setId(one.getId());
            if (null!=one) {
                placeVO.setId(one.getId());
            }
            // 设置来源( 1:地址总表  2:国控采集),扫码采集
            placeVO.setSource(1);
            // 绑定用户信息
            bindUserHandle(placeVO);
            // 更新场所信息
@@ -140,6 +149,8 @@
            savePlaceExtAndTaskInfo(placeVO);
            // 场所标签信息绑定(更新,调整)
            placeLabelBind(placeVO);
            // 网格绑定
            gridBind(placeVO);
        }else {
            // 设置基础数据
            placeVO.setCreateUser(AuthUtil.getUserId());
@@ -156,10 +167,33 @@
            savePlaceExtAndTaskInfo(placeVO);
            // 场所标签信息绑定
            placeLabelBind(placeVO);
            // 网格绑定
            gridBind(placeVO);
        }
        // 位置绑定,通过定位去匹配所在网格
        // 返回结果
        return flag;
    }
    /**
     * 网格绑定
     * @param placeVO
     */
    public void gridBind(PlaceVO placeVO) {
        if (null!=placeVO.getGridId()){
            // 判断关联关系表是否存在
            QueryWrapper<GridRangeEntity> wrapper = new QueryWrapper<>();
            wrapper.eq("grid_id",placeVO.getGrid()).eq("house_code",placeVO.getHouseCode());
            GridRangeEntity one = gridRangeService.getOne(wrapper);
            if (null!=one){
                // 新增
                GridRangeEntity gridRangeEntity = new GridRangeEntity();
                gridRangeEntity.setHouseCode(placeVO.getHouseCode());
                gridRangeEntity.setGridId(placeVO.getGridId());
                // 插入
                gridRangeService.save(gridRangeEntity);
            }
        }
    }
    /**
@@ -194,13 +228,63 @@
    public void savePlaceLabel(PlaceVO placeVO) {
        // 批量新增
        List<String> labelList = Arrays.asList(placeVO.getLabel().split(","));
        // 遍历
        labelList.forEach(labelId -> {
            PlacePoiLabel placePoiLabel = new PlacePoiLabel();
            placePoiLabel.setPlaceId(placeVO.getId());
            placePoiLabel.setPoiCode(Integer.parseInt(labelId));
            placePoiLabelService.save(placePoiLabel);
        });
        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);
                    placePoiLabelService.save(big);
                    // 中类
                    PlacePoiLabel mid = new PlacePoiLabel();
                    mid.setPlaceId(placeVO.getId());
                    mid.setPoiCode(Integer.parseInt(midString));
                    mid.setType(2);
                    placePoiLabelService.save(mid);
                    // 小类
                    PlacePoiLabel min = new PlacePoiLabel();
                    min.setPlaceId(placeVO.getId());
                    min.setPoiCode(Integer.parseInt(labelId));
                    min.setType(3);
                    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);
            placePoiLabelService.save(big);
            // 中类
            PlacePoiLabel mid = new PlacePoiLabel();
            mid.setPlaceId(placeVO.getId());
            mid.setPoiCode(Integer.parseInt(midString));
            mid.setType(2);
            placePoiLabelService.save(mid);
            // 处理小类
            if (labelCode.length()>4) {
                // 小类
                PlacePoiLabel min = new PlacePoiLabel();
                min.setPlaceId(placeVO.getId());
                min.setPoiCode(Integer.parseInt(labelCode));
                min.setType(3);
                placePoiLabelService.save(min);
            }
        }
    }
    /**
@@ -347,9 +431,14 @@
                    List<DoorplateAddressEntity> list = doorplateAddressService.list(wrapper);
                    if (list.size() > 0) {
                        placeVO.setDoorplateAddressEntity(list.get(0));
                        placeVO.setNeiCode(list.get(0).getNeiCode().replaceAll("0+$", ""));
                    }
                    // 查询网格数据
                    placeVO.setGrid(gridService.getGridDetailByHouseCode(place.getHouseCode()));
                    GridVO gridVO = gridService.getGridDetailByHouseCode(place.getHouseCode());
                    if (null!= gridVO) {
                        placeVO.setGrid(gridVO);
                        place.setGridId(gridVO.getId());
                    }
                } else {
                    // 通过定位点落面分析网格位置,反向推出社区派出所相关数据
@@ -544,7 +633,6 @@
        // 修改场所信息
        flag = updateById(placeVO);
        // 修改标签绑定信息
        // 返回
        return flag;
    }
src/main/java/org/springblade/modules/place/vo/PlaceVO.java
@@ -94,6 +94,11 @@
    private String neiName;
    /**
     * 社区编号
     */
    private String neiCode;
    /**
     * 网格名称
     */
    private String gridName;