linwei
2024-01-25 3524bd78770d3dd16b8be3e4fa9cba06a42cefa0
住户监管柱状图
5 files modified
217 ■■■■■ changed files
src/main/java/org/springblade/modules/house/controller/HouseController.java 22 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/mapper/HouseMapper.java 10 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/mapper/HouseMapper.xml 152 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/service/IHouseService.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/service/impl/HouseServiceImpl.java 26 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/controller/HouseController.java
@@ -106,6 +106,28 @@
    }
    /**
     * 房屋标签统计
     */
    @GetMapping("/labelStatistics")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "房屋标签统计")
    public R labelStatistics(HouseVO house) {
        List<Map<String, Object>>  pages = houseService.labelStatistics( house);
        return R.data(pages);
    }
    /**
     * 房屋标签区域统计
     */
    @GetMapping("/labelCommunityStatistics")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "房屋标签区域统计")
    public R labelCommunityStatistics(HouseVO house) {
        List<Map<String, Object>>  pages = houseService.labelCommunityStatistics( house);
        return R.data(pages);
    }
    /**
     * 房屋 新增
     */
    @PostMapping("/save")
src/main/java/org/springblade/modules/house/mapper/HouseMapper.java
@@ -51,6 +51,7 @@
    /**
     * 房屋自定义详情查询
     *
     * @param house
     * @return
     */
@@ -58,6 +59,7 @@
    /**
     * 导出房屋数据
     *
     * @param house
     * @return
     */
@@ -85,4 +87,12 @@
    List<String> getHouseBuilding(String districtCode);
    List<String> getHouseUnit(String districtCode, String building);
    List<Map<String, Object>>  labelStatistics(@Param("house") HouseVO house,
                                               @Param("regionChildCodesList") List<String> regionChildCodesList,
                                               @Param("isAdministrator") Integer isAdministrator);
    List<Map<String, Object>>  labelCommunityStatistics(@Param("house") HouseVO house,
                                                        @Param("regionChildCodesList") List<String> regionChildCodesList,
                                                        @Param("isAdministrator") Integer isAdministrator);
}
src/main/java/org/springblade/modules/house/mapper/HouseMapper.xml
@@ -181,9 +181,6 @@
                            #{code}
                        </foreach>
                    </when>
                    <otherwise>
                        and jg.community_code in ('')
                    </otherwise>
                </choose>
            </if>
            <if test="house.parentId != null ">
@@ -580,5 +577,154 @@
    </select>
    <select id="labelStatistics" resultType="java.util.Map">
        SELECT
        jl.id AS id,
        jl.parent_id AS parentId,
        jl.label_name AS name,
        jl.sort,
        (SELECT
        count( DISTINCT jhl.house_code )
        FROM
        jczz_user_house_label jhl
        LEFT JOIN jczz_house jh ON jhl.house_code = jh.house_code
        LEFT JOIN jczz_grid jg ON jg.grid_code = jh.grid_code
        AND jg.is_deleted = 0
        LEFT JOIN blade_region br ON br.CODE = jg.community_code
        <where>
            <if test="house.id != null ">and jh.id = #{house.id}</if>
            <if test="house.streetCode != null and house.streetCode != ''">
                and jda.town_street_code like concat('%',#{house.streetCode},'%')
            </if>
            <if test="house.houseCode != null  and house.houseCode != ''">and jh.house_code = #{house.houseCode}</if>
            <if test="house.districtCode != null  and house.districtCode != ''">and jh.district_code =
                #{house.districtCode}
            </if>
            <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 br.town_name like concat('%',#{house.townStreetName},'%')
            </if>
            <if test="house.neiName!=null and house.neiName!=''">
                and br.name like concat('%',#{house.neiName},'%')
            </if>
            <if test="house.address!=null and house.address!=''">
                and jh.address like concat('%',#{house.address},'%')
            </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>
            <if test="house.propertyPrice != null ">and jh.property_price = #{house.propertyPrice}</if>
            <if test="house.serviceDue != null ">and jh.service_due = #{house.serviceDue}</if>
            <if test="house.floor != null ">and jh.floor = #{house.floor}</if>
            <if test="house.building != null  and house.building != ''">and jh.building = #{house.building}</if>
            <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="isAdministrator==2">
                <choose>
                    <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                        and jg.community_code in
                        <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                            #{code}
                        </foreach>
                    </when>
                </choose>
            </if>
            <if test="house.parentId != null ">
                <if test="house.labelId != null ">
                    AND jl.id = #{house.labelId}
                </if>
                <if test="house.parentId != null ">
                    AND jl.parent_id = #{house.parentId}
                </if>
                and jhl.label_id=jl.id
                AND jhl.lable_type = 2
                AND jhl.label_id IS NOT NULL
            </if>
            and jh.is_deleted = 0
        </where>
        ) count
        FROM
        jczz_label jl where is_deleted = 0
        <if test="house.parentId != null ">
            AND jl.parent_id = #{house.parentId}
        </if>
        and jl.id != '1002'
    </select>
    <select id="labelCommunityStatistics" resultType="java.util.Map">
        SELECT
        jc.name,
        (SELECT
        count(DISTINCT jhl.house_code)
        FROM
        jczz_user_house_label jhl
        LEFT JOIN jczz_house jh ON jhl.house_code = jh.house_code
        LEFT JOIN jczz_grid jg ON jg.grid_code = jh.grid_code
        AND jg.is_deleted = 0
        LEFT JOIN blade_region br ON br.CODE = jg.community_code
        WHERE jhl.lable_type = 2 and jg.community_code = jc.code
        <if test="house.townStreetName!=null and house.townStreetName!=''">
            and br.town_name like concat('%',#{house.townStreetName},'%')
        </if>
        <if test="house.neiName!=null and house.neiName!=''">
            and br.name like concat('%',#{house.neiName},'%')
        </if>
        <if test="house.neiName!=null and house.neiName!=''">
            and br.name like concat('%',#{house.neiName},'%')
        </if>
        <if test="house.address!=null and house.address!=''">
            and jh.address like concat('%',#{house.address},'%')
        </if>
        <if test="isAdministrator==2">
            <choose>
                <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                    and jg.community_code in
                    <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                        #{code}
                    </foreach>
                </when>
            </choose>
        </if>
        <if test="house.parentId != null ">
            and jh.house_code in (
            SELECT DISTINCT
            juhl.house_code
            FROM
            jczz_user_house_label juhl
            LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
            WHERE
            juhl.lable_type = 2
            <if test="house.labelId != null ">
                AND jl.id = #{house.labelId}
            </if>
            <if test="house.parentId != null ">
                AND jl.parent_id = #{house.parentId}
            </if>
            AND juhl.label_id IS NOT NULL
            )
        </if>
        )counts
        FROM
        jczz_community jc
        <where>
            <if test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                jc.CODE IN
                <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                    #{code}
                </foreach>
            </if>
        </where>
    </select>
</mapper>
src/main/java/org/springblade/modules/house/service/IHouseService.java
@@ -47,6 +47,7 @@
    /**
     * 房屋自定义详情查询
     *
     * @param house
     * @return
     */
@@ -54,6 +55,7 @@
    /**
     * 房屋自定义新增或修改
     *
     * @param house
     * @return
     */
@@ -65,6 +67,7 @@
    /**
     * 查询房屋树
     *
     * @param houseParam
     * @return
     */
@@ -83,4 +86,8 @@
    List<String> getHouseBuilding(String districtCode);
    List<String> getHouseUnit(String districtCode, String building);
    List<Map<String, Object>> labelStatistics(HouseVO house);
    List<Map<String, Object>> labelCommunityStatistics(HouseVO house);
}
src/main/java/org/springblade/modules/house/service/impl/HouseServiceImpl.java
@@ -94,6 +94,7 @@
    /**
     * 房屋自定义详情查询
     *
     * @param house
     * @return
     */
@@ -104,6 +105,7 @@
    /**
     * 房屋自定义新增或修改
     *
     * @param house
     * @return
     */
@@ -138,6 +140,7 @@
    /**
     * 网格绑定
     *
     * @param house
     */
    public void gridBind(HouseEntity house) {
@@ -160,6 +163,7 @@
    /**
     * 导入房屋数据
     *
     * @param data
     * @param isCovered
     */
@@ -179,6 +183,7 @@
    /**
     * 查询房屋树
     *
     * @param houseParam
     * @return
     */
@@ -191,6 +196,7 @@
    /**
     * 根据角色获取地址编号集合
     *
     * @param houseParam
     * @return
     */
@@ -207,6 +213,7 @@
    /**
     * 人房数据导入
     *
     * @param data
     * @param isCovered
     */
@@ -226,6 +233,7 @@
    /**
     * 保存房屋数据
     *
     * @param houseAndHoldExcel
     */
    @Transactional(rollbackFor = Exception.class)
@@ -275,6 +283,7 @@
    /**
     * 保存住户数据
     *
     * @param houseAndHoldExcel
     */
    @Transactional(rollbackFor = Exception.class)
@@ -553,6 +562,7 @@
    /**
     * 现居住地街道转换
     *
     * @param homeAdcode
     * @return
     */
@@ -569,6 +579,7 @@
    /**
     * 根据名称转成code
     *
     * @param residentProvinceAdcode 省名称
     * @param residentCityAdcode 市名称
     * @param residentAdcode 区县名称
@@ -599,6 +610,7 @@
    /**
     * 保存或更新用户(业主)
     *
     * @param householdEntity
     */
    public void saveOrUpdateUser(HouseholdEntity householdEntity) {
@@ -674,4 +686,18 @@
    public List<String> getHouseUnit(String districtCode, String building) {
        return baseMapper.getHouseUnit(districtCode, building);
    }
    @Override
    public List<Map<String, Object>>  labelStatistics(HouseVO house) {
        List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId());
        Integer isAdministrator = AuthUtil.isAdministrator() == true ? 1 : 2;
        return baseMapper.labelStatistics(house,regionChildCodesList,isAdministrator);
    }
    @Override
    public List<Map<String, Object>> labelCommunityStatistics(HouseVO house) {
        List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId());
        Integer isAdministrator = AuthUtil.isAdministrator() == true ? 1 : 2;
        return baseMapper.labelCommunityStatistics(house,regionChildCodesList,isAdministrator);
    }
}