linwe
2024-06-24 60e1a68fa319cd9e92d632bf678b31af20973508
驾驶舱添加社区筛选优化
15 files modified
798 ■■■■ changed files
src/main/java/org/springblade/common/cache/SysCache.java 8 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/common/param/CommonParamSet.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/doorplateAddress/service/impl/DoorplateAddressServiceImpl.java 14 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/grid/mapper/GridmanMapper.java 6 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/grid/mapper/GridmanMapper.xml 91 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/grid/service/impl/GridmanServiceImpl.java 14 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/mapper/HouseMapper.java 14 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/mapper/HouseMapper.xml 440 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/mapper/HouseRentalMapper.xml 15 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.java 4 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml 104 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/service/impl/HouseServiceImpl.java 16 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/service/impl/HouseholdServiceImpl.java 9 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/vo/HouseRentalTenantVO.java 58 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/vo/HouseVO.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/common/cache/SysCache.java
@@ -401,12 +401,8 @@
                // 查询对应的区域编号code
                Dept dept = deptService.getById(id);
                if (null != dept) {
                    if (
                        (roleName.equals("mj") && dept.getDeptNature()==1) ||
                        (
                            (roleName.equals("wgy") || roleName.equals("wzcj")) && dept.getDeptNature()==2
                        )
                    ){
                    if ((roleName.equals("mj") && dept.getDeptNature() == 1) ||
                        ((roleName.equals("wgy") || roleName.equals("wzcj")) && dept.getDeptNature() == 2)) {
                        if (!AuthUtil.isAdministrator()) {
                            if (dept.getRegionCode() == null) {
                                return;
src/main/java/org/springblade/common/param/CommonParamSet.java
@@ -84,7 +84,7 @@
            }
            if (isAdministrator == 2) {
                if (!Strings.isBlank(communityCode)) {
                if (Strings.isNotBlank(communityCode)) {
                    // 请求头带了后直接使用过滤
                    regionChildCodesList.add(communityCode);
                }else {
src/main/java/org/springblade/modules/doorplateAddress/service/impl/DoorplateAddressServiceImpl.java
@@ -31,7 +31,6 @@
import org.springblade.common.utils.SpringUtils;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.modules.backblast.entity.BackblastPubRecordEntity;
import org.springblade.modules.category.dto.CategoryDTO;
import org.springblade.modules.category.service.ICategoryService;
import org.springblade.modules.community.entity.CommunityEntity;
@@ -46,7 +45,6 @@
import org.springblade.modules.doorplateAddress.vo.FuncNode;
import org.springblade.modules.grid.entity.GridEntity;
import org.springblade.modules.grid.entity.GridRangeEntity;
import org.springblade.modules.grid.entity.GridmanEntity;
import org.springblade.modules.grid.service.IGridRangeService;
import org.springblade.modules.grid.service.IGridService;
import org.springblade.modules.grid.service.IGridmanService;
@@ -66,10 +64,8 @@
import org.springblade.modules.place.service.IPlaceExtService;
import org.springblade.modules.place.service.IPlacePoiLabelService;
import org.springblade.modules.place.service.IPlaceService;
import org.springblade.modules.place.vo.PlaceVO;
import org.springblade.modules.police.entity.PoliceAffairsGridEntity;
import org.springblade.modules.police.service.IPoliceAffairsGridService;
import org.springblade.modules.system.entity.Region;
import org.springblade.modules.system.service.IRegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -150,10 +146,8 @@
        String roleName = SpringUtils.getRequestParam("roleName");
        if (!Strings.isBlank(roleName)) {
            // 如果是网格管理员,系统管理员,民警,无诈场所采集
            if (roleName.equals("admin") ||
                roleName.equals("wzcj") ||
                roleName.equals("wgy") ||
                roleName.equals("mj")) {
            if (roleName.equals("admin") || roleName.equals("wzcj") ||
                roleName.equals("wgy") || roleName.equals("mj")) {
                houseParam.setRoleName(roleName);
                if ((roleName.equals("wgy") || roleName.equals("wzcj"))
                    && !userId.equals("1726859808689696770")) {
@@ -169,6 +163,10 @@
                List<TreeStringNode> townList = baseMapper.getRegionListByGroupTwon(houseParam, stringList, communityList);
                // 查询社区
                List<TreeStringNode> neiList = baseMapper.getRegionListByGroupNei(houseParam, stringList, communityList);
                // 查询网格
                if (stringList.size() > 0) {
                    List<GridEntity> list1 = gridService.list(Wrappers.<GridEntity>lambdaQuery().in(GridEntity::getGridCode, stringList));
                }
                // 遍历
                for (TreeStringNode treeNode : townList) {
                    // 遍历
src/main/java/org/springblade/modules/grid/mapper/GridmanMapper.java
@@ -52,11 +52,11 @@
     */
    List<GridmanVO> getGridmanList(@Param("gridman") GridmanVO gridman);
    Integer getGridStatistics(String code, Long userId, String roleType);
    Integer getGridStatistics(List<String> communityCodeList, Long userId, String roleType);
    Integer getCompanyStatistics(String code, Long userId, String roleType);
    Integer getCompanyStatistics(List<String> communityCodeList , Long userId, String roleType);
    Integer getOwnersCommitteeStatistics(String code, Long userId, String roleType);
    Integer getOwnersCommitteeStatistics(List<String> communityCodeList, Long userId, String roleType);
    /**
     * 网格员表 自定义详情
src/main/java/org/springblade/modules/grid/mapper/GridmanMapper.xml
@@ -79,11 +79,16 @@
        SELECT count(1) number
        FROM jczz_gridman jgm
        LEFT JOIN jczz_grid jg ON jg.grid_code = jgm.grid_code
        WHERE jg.community_code = #{code}
        AND jg.is_deleted = 0
        <if test="userId!=null and roleType == '1'">
            and jgm.user_id= #{userId}
        </if>
        <where>
            jg.community_code in
            <foreach collection="communityCodeList" item="code" open="(" close=")" separator=",">
                #{code}
            </foreach>
            AND jg.is_deleted = 0
            <if test="userId!=null and roleType == '1'">
                and jgm.user_id= #{userId}
            </if>
        </where>
    </select>
    <select id="getCompanyStatistics" resultType="java.lang.Integer">
@@ -92,23 +97,27 @@
        FROM
        jczz_property_company_district jpcd
        LEFT JOIN jczz_district jd ON jd.id = jpcd.district_id
        WHERE
        jd.community_code = #{code}
        and jpcd.is_deleted= 0
        <if test="userId!=null and roleType == '1'">
            AND jd.aoi_code in (
            SELECT distinct
            jda.aoi_code
            FROM
            jczz_grid jg
            LEFT JOIN jczz_gridman jgm ON jg.grid_code = jgm.grid_code
            LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jg.house_code
            WHERE
            jgm.user_id = #{userId}
            AND jg.is_deleted = 0
            AND jda.aoi_code IS NOT NULL
            )
        </if>
        <where>
            jd.community_code in
            <foreach collection="communityCodeList" item="code" open="(" close=")" separator=",">
                #{code}
            </foreach>
            and jpcd.is_deleted= 0
            <if test="userId!=null and roleType == '1'">
                AND jd.aoi_code in (
                SELECT distinct
                jda.aoi_code
                FROM
                jczz_grid jg
                LEFT JOIN jczz_gridman jgm ON jg.grid_code = jgm.grid_code
                LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jg.house_code
                WHERE
                jgm.user_id = #{userId}
                AND jg.is_deleted = 0
                AND jda.aoi_code IS NOT NULL
                )
            </if>
        </where>
    </select>
    <select id="getOwnersCommitteeStatistics" resultType="java.lang.Integer">
@@ -116,23 +125,27 @@
        count(1)
        FROM jczz_owners_committee joc LEFT JOIN
        jczz_district jd ON jd.id = joc.area_id
        WHERE
        jd.community_code = #{code}
        and joc.delete_flag= 0
        <if test="userId!=null and roleType == '1'">
            AND jd.aoi_code in (
            SELECT distinct
            jda.aoi_code
            FROM
            jczz_grid jg
            LEFT JOIN jczz_gridman jgm ON jg.grid_code = jgm.grid_code
            LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jg.house_code
            WHERE
            jgm.user_id = #{userId}
            AND jg.is_deleted = 0
            AND jda.aoi_code IS NOT NULL
            )
        </if>
        <where>
            jd.community_code in
            <foreach collection="communityCodeList" item="code" open="(" close=")" separator=",">
                #{code}
            </foreach>
            and joc.delete_flag= 0
            <if test="userId!=null and roleType == '1'">
                AND jd.aoi_code in (
                SELECT distinct
                jda.aoi_code
                FROM
                jczz_grid jg
                LEFT JOIN jczz_gridman jgm ON jg.grid_code = jgm.grid_code
                LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jg.house_code
                WHERE
                jgm.user_id = #{userId}
                AND jg.is_deleted = 0
                AND jda.aoi_code IS NOT NULL
                )
            </if>
        </where>
    </select>
src/main/java/org/springblade/modules/grid/service/impl/GridmanServiceImpl.java
@@ -26,6 +26,7 @@
import org.springblade.common.param.CommonParamSet;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.modules.grid.entity.GridEntity;
import org.springblade.modules.grid.entity.GridmanEntity;
@@ -277,17 +278,18 @@
    @Override
    public Object getGridStatistics(String code, String roleType) {
        Map<String, Object> objectObjectHashMap = new HashMap<>();
        List<String> communityCodeList = Func.toStrList(code);
        if (roleType.equals("2")) {
            Integer gridStatistics = baseMapper.getGridStatistics(code, null, roleType);
            Integer companyStatistics = baseMapper.getCompanyStatistics(code, null, roleType);
            Integer ownersCommitteeStatistics = baseMapper.getOwnersCommitteeStatistics(code, null, roleType);
            Integer gridStatistics = baseMapper.getGridStatistics(communityCodeList, null, roleType);
            Integer companyStatistics = baseMapper.getCompanyStatistics(communityCodeList, null, roleType);
            Integer ownersCommitteeStatistics = baseMapper.getOwnersCommitteeStatistics(communityCodeList, null, roleType);
            objectObjectHashMap.put("gridStatistics", gridStatistics);
            objectObjectHashMap.put("companyStatistics", companyStatistics);
            objectObjectHashMap.put("ownersStatistics", ownersCommitteeStatistics);
        } else {
            Integer gridStatistics = baseMapper.getGridStatistics(code, AuthUtil.getUserId(), roleType);
            Integer companyStatistics = baseMapper.getCompanyStatistics(code, AuthUtil.getUserId(), roleType);
            Integer ownersCommitteeStatistics = baseMapper.getOwnersCommitteeStatistics(code, AuthUtil.getUserId(), roleType);
            Integer gridStatistics = baseMapper.getGridStatistics(communityCodeList, AuthUtil.getUserId(), roleType);
            Integer companyStatistics = baseMapper.getCompanyStatistics(communityCodeList, AuthUtil.getUserId(), roleType);
            Integer ownersCommitteeStatistics = baseMapper.getOwnersCommitteeStatistics(communityCodeList, AuthUtil.getUserId(), roleType);
            objectObjectHashMap.put("gridStatistics", gridStatistics);
            objectObjectHashMap.put("companyStatistics", companyStatistics);
            objectObjectHashMap.put("ownersStatistics", ownersCommitteeStatistics);
src/main/java/org/springblade/modules/house/mapper/HouseMapper.java
@@ -78,9 +78,9 @@
    Map<String, HouseTree> getHouseTree(@Param("houseParam") HouseParam houseParam,
                                        @Param("list") List<String> list);
    Integer getHouseStatisticsOne(String code, Long userId, String aoiCode, String buildingCode, String unitCode, String roleType);
    Integer getHouseStatisticsOne(List<String> communityCodeList, Long userId, String aoiCode, String buildingCode, String unitCode, String roleType);
    Integer getHouseStatisticsTwo(@Param("code") String code,
    Integer getHouseStatisticsTwo(@Param("communityCodeList") List<String> communityCodeList,
                                  @Param("aoiCode") String aoiCode,
                                  @Param("buildingCode") String buildingCode,
                                  @Param("unitCode") String unitCode,
@@ -89,9 +89,9 @@
                                  @Param("regionChildCodesList")List<String> regionChildCodesList,
                                  @Param("gridCodeList")List<String> gridCodeList);
    Integer getHouseStatisticsThree(String code, Long userId, String aoiCode, String buildingCode, String unitCode, String roleType);
    Integer getHouseStatisticsThree(List<String> communityCodeList, Long userId, String aoiCode, String buildingCode, String unitCode, String roleType);
    Integer getHouseStatisticsFour(String code, Long userId, String aoiCode, String buildingCode, String unitCode, String roleType);
    Integer getHouseStatisticsFour(List<String> communityCodeList, Long userId, String aoiCode, String buildingCode, String unitCode, String roleType);
    List<String> getHouseBuilding(String districtCode);
@@ -121,15 +121,11 @@
    /**
     * 按房屋标签统计
     * @param house
     * @param isAdministrator
     * @param regionChildCodesList
     * @param gridCodeList
     * @return
     */
    List<Map<String, Object>> getHouseLabelStatistic(@Param("house") HouseVO house,
                                                     @Param("isAdministrator") Integer isAdministrator,
                                                     @Param("regionChildCodesList")List<String> regionChildCodesList,
                                                     @Param("gridCodeList")List<String> gridCodeList);
                                                     @Param("communityCodeList")List<String> regionChildCodesList);
    /**
     * 查询对应的社区编号
src/main/java/org/springblade/modules/house/mapper/HouseMapper.xml
@@ -406,44 +406,49 @@
        FROM
        jczz_house jh
        LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jh.house_code
        WHERE
        jda.nei_code = #{code}
        AND jh.is_deleted = 0
        <if test="buildingCode != null  and buildingCode != ''">
            and jda.building_code=#{buildingCode}
        </if>
       <where>
           jda.nei_code in
           <foreach collection="communityCodeList" item="code" open="(" close=")" separator=",">
               #{code}
           </foreach>
           AND jh.is_deleted = 0
           <if test="buildingCode != null  and buildingCode != ''">
               and jda.building_code=#{buildingCode}
           </if>
        <if test="unitCode != null  and unitCode != ''">
            and jda.unit_code=#{unitCode}
        </if>
           <if test="unitCode != null  and unitCode != ''">
               and jda.unit_code=#{unitCode}
           </if>
        <if test="aoiCode != null  and aoiCode != ''">
            and jda.aoi_code=#{aoiCode}
        </if>
        <if test="userId != null and roleType == '1'">
            AND jda.address_code IN (
            SELECT DISTINCT
            jgr.house_code
            FROM
            jczz_grid jg
            LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id
            LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
            WHERE
            jgm.user_id = #{userId}
            AND jg.is_deleted = 0
            )
        </if>
        <if test="userId != null and roleType == '3'">
            AND jda.address_code IN (SELECT
            jda.address_code
            FROM
            jczz_doorplate_address jda
            LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code
            WHERE
            jc.res_police_user_id like concat('%',#{userId},'%'))
            )
        </if>
        ) a
           <if test="aoiCode != null  and aoiCode != ''">
               and jda.aoi_code=#{aoiCode}
           </if>
           <if test="userId != null and roleType == '1'">
               AND jda.address_code IN (
               SELECT DISTINCT
               jgr.house_code
               FROM
               jczz_grid jg
               LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id
               LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
               WHERE
               jgm.user_id = #{userId}
               AND jg.is_deleted = 0
               )
           </if>
           <if test="userId != null and roleType == '3'">
               AND jda.address_code IN (SELECT
               jda.address_code
               FROM
               jczz_doorplate_address jda
               LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code
               WHERE
               jc.res_police_user_id like concat('%',#{userId},'%'))
               )
           </if>
           ) a
       </where>
    </select>
@@ -456,85 +461,84 @@
        LEFT JOIN jczz_house jh ON jda.address_code = jh.house_code AND jh.is_deleted = 0
        LEFT JOIN jczz_grid jg on jg.grid_code = jh.grid_code and jg.is_deleted = 0
        LEFT JOIN jczz_police_affairs_grid jpag on jh.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
        WHERE
        jda.nei_code = #{code}
        and jda.doorplate_type = '户室牌'
        <choose>
            <when test="(buildingCode != null  and buildingCode != '') or
        <where>
            jda.nei_code in
            <foreach collection="communityCodeList" item="code" open="(" close=")" separator=",">
                #{code}
            </foreach>
            and jda.doorplate_type = '户室牌'
            <choose>
                <when test="(buildingCode != null  and buildingCode != '') or
                (unitCode != null  and unitCode != '') or (aoiCode != null  and aoiCode != '')">
                <if test="buildingCode != null  and buildingCode != ''">
                    and jda.building_code=#{buildingCode}
                </if>
                <if test="unitCode != null  and unitCode != ''">
                    and jda.unit_code=#{unitCode}
                    AND jda.unit_code is not null
                </if>
                <if test="aoiCode != null  and aoiCode != ''">
                    and jda.aoi_code=#{aoiCode}
                </if>
            </when>
            <otherwise>
                <if test="isAdministrator==2">
                    <choose>
                        <when test="house.roleName != null and house.roleName != ''">
                            <if test="house.roleName=='wgy'">
                                <choose>
                                    <when test="gridCodeList !=null and gridCodeList.size()>0">
                                        and jh.grid_code in
                                        <foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
                                            #{code}
                                        </foreach>
                                    </when>
                                    <otherwise>
                                        and jh.grid_code in ('')
                                    </otherwise>
                                </choose>
                            </if>
                            <if test="house.roleName=='mj'">
                    <if test="buildingCode != null  and buildingCode != ''">
                        and jda.building_code=#{buildingCode}
                    </if>
                    <if test="unitCode != null  and unitCode != ''">
                        and jda.unit_code=#{unitCode}
                        AND jda.unit_code is not null
                    </if>
                    <if test="aoiCode != null  and aoiCode != ''">
                        and jda.aoi_code=#{aoiCode}
                    </if>
                </when>
                <otherwise>
                    <if test="isAdministrator==2">
                        <choose>
                            <when test="house.roleName != null and house.roleName != ''">
                                <if test="house.roleName=='wgy'">
                                    <choose>
                                        <when test="gridCodeList !=null and gridCodeList.size()>0">
                                            and jh.grid_code in
                                            <foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
                                                #{code}
                                            </foreach>
                                        </when>
                                        <otherwise>
                                            and jh.grid_code in ('')
                                        </otherwise>
                                    </choose>
                                </if>
                                <if test="house.roleName=='mj'">
                                    <choose>
                                        <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                                            and jpag.community_code in
                                            <foreach collection="regionChildCodesList" item="code" open="(" close=")"
                                                     separator=",">
                                                #{code}
                                            </foreach>
                                        </when>
                                        <otherwise>
                                            and jpag.community_code in ('')
                                        </otherwise>
                                    </choose>
                                </if>
                            </when>
                            <otherwise>
                                <choose>
                                    <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                                        and jpag.community_code in
                                        <foreach collection="regionChildCodesList" item="code" open="(" close=")"
                                                 separator=",">
                                        and ( jg.grid_code in
                                        <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                                            #{code}
                                        </foreach>
                                        or
                                        jpag.community_code in
                                        <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                                            #{code}
                                        </foreach>
                                        )
                                    </when>
                                    <otherwise>
                                        and jpag.community_code in ('')
                                        and
                                        ( jg.grid_code in ('') or jpag.community_code in ('') )
                                    </otherwise>
                                </choose>
                            </if>
                        </when>
                        <otherwise>
                            <choose>
                                <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                                    and
                                    (
                                    jg.grid_code in
                                    <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                                        #{code}
                                    </foreach>
                                    or
                                    jpag.community_code in
                                    <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                                        #{code}
                                    </foreach>
                                    )
                                </when>
                                <otherwise>
                                    and
                                    (
                                    jg.grid_code in ('')
                                    or
                                    jpag.community_code in ('')
                                    )
                                </otherwise>
                            </choose>
                        </otherwise>
                    </choose>
                </if>
            </otherwise>
        </choose>
                            </otherwise>
                        </choose>
                    </if>
                </otherwise>
            </choose>
        </where>
    </select>
@@ -544,45 +548,49 @@
        FROM
        jczz_household jhh
        LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jhh.house_code
        WHERE
        jda.nei_code = #{code}
        AND jhh.is_deleted = 0
        and jda.doorplate_type = '户室牌'
        <if test="buildingCode != null  and buildingCode != ''">
            and jda.building_code=#{buildingCode}
        </if>
        <where>
            jda.nei_code in
            <foreach collection="communityCodeList" item="code" open="(" close=")" separator=",">
                #{code}
            </foreach>
            AND jhh.is_deleted = 0
            and jda.doorplate_type = '户室牌'
            <if test="buildingCode != null  and buildingCode != ''">
                and jda.building_code=#{buildingCode}
            </if>
        <if test="unitCode != null  and unitCode != ''">
            and jda.unit_code=#{unitCode}
            AND jda.unit_code is not null
        </if>
            <if test="unitCode != null  and unitCode != ''">
                and jda.unit_code=#{unitCode}
                AND jda.unit_code is not null
            </if>
        <if test="aoiCode != null  and aoiCode != ''">
            and jda.aoi_code=#{aoiCode}
        </if>
        <if test="userId != null and roleType == '1'">
            AND jda.address_code IN (
            SELECT DISTINCT
            jgr.house_code
            FROM
            jczz_grid jg
            LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id
            LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
            WHERE
            jgm.user_id = #{userId}
            AND jg.is_deleted = 0
            )
        </if>
        <if test="userId != null and roleType == '3'">
            AND jda.address_code IN (SELECT
            jda.address_code
            FROM
            jczz_doorplate_address jda
            LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code
            WHERE
            jc.res_police_user_id like concat('%',#{userId},'%'))
            )
        </if>
            <if test="aoiCode != null  and aoiCode != ''">
                and jda.aoi_code=#{aoiCode}
            </if>
            <if test="userId != null and roleType == '1'">
                AND jda.address_code IN (
                SELECT DISTINCT
                jgr.house_code
                FROM
                jczz_grid jg
                LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id
                LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
                WHERE
                jgm.user_id = #{userId}
                AND jg.is_deleted = 0
                )
            </if>
            <if test="userId != null and roleType == '3'">
                AND jda.address_code IN (SELECT
                jda.address_code
                FROM
                jczz_doorplate_address jda
                LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code
                WHERE
                jc.res_police_user_id like concat('%',#{userId},'%'))
                )
            </if>
        </where>
    </select>
@@ -596,47 +604,49 @@
        FROM
        jczz_house jh
        LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jh.house_code
        WHERE
        jda.nei_code = #{code}
        AND jh.is_deleted = 0
        AND jda.unit_code is not null
        <if test="buildingCode != null  and buildingCode != ''">
            and jda.building_code=#{buildingCode}
        </if>
        <where>
            jda.nei_code in
            <foreach collection="communityCodeList" item="code" open="(" close=")" separator=",">
                #{code}
            </foreach>
            AND jh.is_deleted = 0
            AND jda.unit_code is not null
            <if test="buildingCode != null  and buildingCode != ''">
                and jda.building_code=#{buildingCode}
            </if>
        <if test="unitCode != null  and unitCode != ''">
            and jda.unit_code=#{unitCode}
        </if>
            <if test="unitCode != null  and unitCode != ''">
                and jda.unit_code=#{unitCode}
            </if>
        <if test="aoiCode != null  and aoiCode != ''">
            and jda.aoi_code=#{aoiCode}
        </if>
        <if test="userId != null and roleType == '1'">
            AND jda.address_code IN (
            SELECT DISTINCT
            jgr.house_code
            FROM
            jczz_grid jg
            LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id
            LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
            WHERE
            jgm.user_id = #{userId}
            AND jg.is_deleted = 0
            )
        </if>
        <if test="userId != null and roleType == '3'">
            AND jda.address_code IN (SELECT
            jda.address_code
            FROM
            jczz_doorplate_address jda
            LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code
            WHERE
            jc.res_police_user_id like concat('%',#{userId},'%'))
            )
        </if>
        ) a
            <if test="aoiCode != null  and aoiCode != ''">
                and jda.aoi_code=#{aoiCode}
            </if>
            <if test="userId != null and roleType == '1'">
                AND jda.address_code IN (
                SELECT DISTINCT
                jgr.house_code
                FROM
                jczz_grid jg
                LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id
                LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
                WHERE
                jgm.user_id = #{userId}
                AND jg.is_deleted = 0
                )
            </if>
            <if test="userId != null and roleType == '3'">
                AND jda.address_code IN (SELECT
                jda.address_code
                FROM
                jczz_doorplate_address jda
                LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code
                WHERE
                jc.res_police_user_id like concat('%',#{userId},'%'))
                )
            </if>
            ) a
        </where>
    </select>
    <select id="getHouseBuilding" resultType="java.lang.String">
@@ -860,67 +870,11 @@
            LEFT JOIN jczz_police_affairs_grid jpag on jh.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
            LEFT JOIN jczz_user_house_label juhl ON juhl.house_code = jh.house_code and juhl.lable_type = 2
            where jda.doorplate_type = '户室牌'
            <if test="house.communityCode != null  and house.communityCode != ''">
                and jda.nei_code = #{house.communityCode}
            </if>
            <if test="isAdministrator==2">
                <choose>
                    <when test="house.roleName != null and house.roleName != ''">
                        <if test="house.roleName=='wgy'">
                            <choose>
                                <when test="gridCodeList !=null and gridCodeList.size()>0">
                                    and jh.grid_code in
                                    <foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
                                        #{code}
                                    </foreach>
                                </when>
                                <otherwise>
                                    and jh.grid_code in ('')
                                </otherwise>
                            </choose>
                        </if>
                        <if test="house.roleName=='mj'">
                            <choose>
                                <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                                    and jpag.community_code in
                                    <foreach collection="regionChildCodesList" item="code" open="(" close=")"
                                             separator=",">
                                        #{code}
                                    </foreach>
                                </when>
                                <otherwise>
                                    and jpag.community_code in ('')
                                </otherwise>
                            </choose>
                        </if>
                    </when>
                    <otherwise>
                        <choose>
                            <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                                and
                                (
                                jg.grid_code in
                                <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                                    #{code}
                                </foreach>
                                or
                                jpag.community_code in
                                <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                                    #{code}
                                </foreach>
                                )
                            </when>
                            <otherwise>
                                and
                                (
                                jg.grid_code in ('')
                                or
                                jpag.community_code in ('')
                                )
                            </otherwise>
                        </choose>
                    </otherwise>
                </choose>
            <if test="communityCodeList != null">
                and jda.nei_code in
                <foreach collection="communityCodeList" item="code" open="(" close=")" separator=",">
                    #{code}
                </foreach>
            </if>
            group by juhl.label_name
        ) b on a.label_name =b.labelName
src/main/java/org/springblade/modules/house/mapper/HouseRentalMapper.xml
@@ -118,20 +118,24 @@
        SELECT
        jhr.*,
        jh.address as houseName,
        b.tenantName,
        br.town_name as townStreetName,
        br.name as neiName,
        b.phone,
        <if test="vo.tenantInfoFlag != null and vo.tenantInfoFlag != 0">
            b.tenantName,
            b.phone,
        </if>
        concat(jh.district_name," ",jh.building," ",unit," ",room) as address,
        case when TIMESTAMPDIFF( MONTH, jhr.rental_time, jhr.due_time )&gt;= 8 then 1
             when TIMESTAMPDIFF( MONTH, jhr.rental_time, jhr.due_time )&lt;4 then 3
             else 2 end as dldType,
        if(jhr.termination_time is null,if(date_format(jhr.due_time,'%Y-%m-%d') >= date_format(now(),'%Y-%m-%d'),0,1),2) as status
        when TIMESTAMPDIFF( MONTH, jhr.rental_time, jhr.due_time )&lt;4 then 3
        else 2 end as dldType,
        if(jhr.termination_time is null,if(date_format(jhr.due_time,'%Y-%m-%d') >= date_format(now(),'%Y-%m-%d'),0,1),2)
        as status
        FROM jczz_house_rental jhr
        JOIN jczz_house jh ON jh.house_code = jhr.house_code and jh.is_deleted = 0
        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
        LEFT JOIN jczz_police_affairs_grid jpag on jh.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
        <if test="vo.tenantInfoFlag != null and vo.tenantInfoFlag != 0">
        LEFT JOIN (
            SELECT jht.housing_rental_id,jht.name as tenantName,jht.phone_number as phone
            FROM jczz_household jht RIGHT JOIN (
@@ -145,6 +149,7 @@
                GROUP BY  housing_rental_id
            ) a ON a.id = jht.id and a.housing_rental_id is not null
        ) b ON b.housing_rental_id = jhr.id
        </if>
        WHERE jhr.is_deleted = 0
        <if test="vo.townStreetName!=null and vo.townStreetName!=''">
            and br.town_name like concat('%',#{vo.townStreetName},'%')
src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.java
@@ -126,9 +126,9 @@
     */
    HouseholdOtherVO getSecurity(@Param("household") HouseholdVO household);
    List<Map<String, Object>> getHouseHoldStatistics(String code, Long userId, String roleType);
    List<Map<String, Object>> getHouseHoldStatistics(List<String> communityCodeList, Long userId, String roleType);
    List<Map<String, Object>> getHouseHoldStatisticsAge(String code, Long userId, String roleType);
    List<Map<String, Object>> getHouseHoldStatisticsAge(List<String> communityCodeList, Long userId, String roleType);
    /**
     * 查询所有未入库的业主信息
src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
@@ -894,36 +894,41 @@
        FROM
        jczz_household jh
        LEFT JOIN jczz_doorplate_address jda ON jh.house_code = jda.address_code
        WHERE
        jda.nei_code = #{code}
        AND jh.is_deleted = 0
        and jda.doorplate_type = '户室牌'
        <if test="userId != null and roleType == '1'">
            AND jda.address_code IN (
            SELECT DISTINCT
            jgr.house_code
            FROM
            jczz_grid jg
            LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id
            LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
            WHERE
            jgm.user_id = #{userId}
            AND jg.is_deleted = 0
            )
        </if>
        <if test="userId != null and roleType == '3'">
            AND jda.address_code IN (SELECT
            jda.address_code
            FROM
            jczz_doorplate_address jda
            LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code
            WHERE
            jc.res_police_user_id like concat('%',#{userId},'%'))
            )
        </if>
        ) a
        GROUP BY
        a.gender
        <where>
            jda.nei_code in
            <foreach collection="communityCodeList" item="code" open="(" close=")" separator=",">
                #{code}
            </foreach>
            AND jh.is_deleted = 0
            and jda.doorplate_type = '户室牌'
            <if test="userId != null and roleType == '1'">
                AND jda.address_code IN (
                SELECT DISTINCT
                jgr.house_code
                FROM
                jczz_grid jg
                LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id
                LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
                WHERE
                jgm.user_id = #{userId}
                AND jg.is_deleted = 0
                )
            </if>
            <if test="userId != null and roleType == '3'">
                AND jda.address_code IN (SELECT
                jda.address_code
                FROM
                jczz_doorplate_address jda
                LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code
                WHERE
                jc.res_police_user_id like concat('%',#{userId},'%'))
                )
            </if>
            ) a
            GROUP BY
            a.gender
        </where>
    </select>
    <select id="getHouseHoldStatisticsAge" resultType="java.util.Map">
@@ -945,23 +950,28 @@
        count(1) as number FROM
        jczz_household jh
        LEFT JOIN jczz_doorplate_address jda ON jh.house_code = jda.address_code
        WHERE
        jda.nei_code = #{code}
        and jda.doorplate_type = '户室牌'
        AND jh.is_deleted = 0
        <if test="userId != null and roleType == '1'">
            AND jda.address_code IN (
            SELECT
            distinct jgr.house_code
            FROM
            jczz_grid jg
            LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id
            LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
            WHERE
            jgm.user_id = #{userId}
            AND jg.is_deleted = 0
            )
        </if>
        <where>
            jda.nei_code in
            <foreach collection="communityCodeList" item="code" open="(" close=")" separator=",">
                #{code}
            </foreach>
            and jda.doorplate_type = '户室牌'
            AND jh.is_deleted = 0
            <if test="userId != null and roleType == '1'">
                AND jda.address_code IN (
                SELECT
                distinct jgr.house_code
                FROM
                jczz_grid jg
                LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id
                LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
                WHERE
                jgm.user_id = #{userId}
                AND jg.is_deleted = 0
                )
            </if>
        </where>
        GROUP BY age
    </select>
src/main/java/org/springblade/modules/house/service/impl/HouseServiceImpl.java
@@ -33,6 +33,7 @@
import org.springblade.common.utils.SpringUtils;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity;
import org.springblade.modules.doorplateAddress.service.IDoorplateAddressService;
import org.springblade.modules.grid.entity.GridEntity;
@@ -828,13 +829,14 @@
        if (!Strings.isBlank(roleName) && roleName.equals("mj")){
            userId = AuthUtil.getUserId();
        }
        Integer result1 = baseMapper.getHouseStatisticsOne(code, userId, aoiCode, buildingCode, unitCode, roleType);
        Integer result2  = baseMapper.getHouseStatisticsTwo(code, aoiCode, buildingCode, unitCode, house,
        List<String> communityCodeList = Func.toStrList(code);
        Integer result1 = baseMapper.getHouseStatisticsOne(communityCodeList, userId, aoiCode, buildingCode, unitCode, roleType);
        Integer result2  = baseMapper.getHouseStatisticsTwo(communityCodeList, aoiCode, buildingCode, unitCode, house,
            commonParamSet.getIsAdministrator(),
            commonParamSet.getRegionChildCodesList(),
            commonParamSet.getGridCodeList());
        Integer result3 = baseMapper.getHouseStatisticsThree(code, userId, aoiCode, buildingCode, unitCode, roleType);
        Integer result4 = baseMapper.getHouseStatisticsFour(code, userId, aoiCode, buildingCode, unitCode, roleType);
        Integer result3 = baseMapper.getHouseStatisticsThree(communityCodeList, userId, aoiCode, buildingCode, unitCode, roleType);
        Integer result4 = baseMapper.getHouseStatisticsFour(communityCodeList, userId, aoiCode, buildingCode, unitCode, roleType);
        objectObjectHashMap.put("result1", result1);
        objectObjectHashMap.put("result2", result2);
        objectObjectHashMap.put("result3", result3);
@@ -928,10 +930,8 @@
    public List<Map<String, Object>> getHouseLabelStatistic(HouseVO house) {
        CommonParamSet commonParamSet = new CommonParamSet<>().invoke(HouseVO.class, house);
        // 按房屋标签统计
        List<Map<String, Object>> list = baseMapper.getHouseLabelStatistic(house,
            commonParamSet.getIsAdministrator(),
            commonParamSet.getRegionChildCodesList(),
            commonParamSet.getGridCodeList());
        List<String> communityCodeList = Func.toStrList(house.getCode());
        List<Map<String, Object>> list = baseMapper.getHouseLabelStatistic(house,communityCodeList);
        // 返回
        return list;
    }
src/main/java/org/springblade/modules/house/service/impl/HouseholdServiceImpl.java
@@ -650,15 +650,16 @@
    @Override
    public Object getHouseHoldStatistics(String code, String roleType) {
        Map<String, Object> objectObjectHashMap = new HashMap<>();
        List<String> communityCodeList = Func.toStrList(code);
        if (roleType.equals("2")) {
            List<Map<String, Object>> result = baseMapper.getHouseHoldStatistics(code, null, roleType);
            List<Map<String, Object>> result1 = baseMapper.getHouseHoldStatisticsAge(code, null, roleType);
            List<Map<String, Object>> result = baseMapper.getHouseHoldStatistics(communityCodeList, null, roleType);
            List<Map<String, Object>> result1 = baseMapper.getHouseHoldStatisticsAge(communityCodeList, null, roleType);
            objectObjectHashMap.put("gender", result);
            objectObjectHashMap.put("age", result1);
            return objectObjectHashMap;
        } else {
            List<Map<String, Object>> result = baseMapper.getHouseHoldStatistics(code, AuthUtil.getUserId(), roleType);
            List<Map<String, Object>> result1 = baseMapper.getHouseHoldStatisticsAge(code, AuthUtil.getUserId(), roleType);
            List<Map<String, Object>> result = baseMapper.getHouseHoldStatistics(communityCodeList, AuthUtil.getUserId(), roleType);
            List<Map<String, Object>> result1 = baseMapper.getHouseHoldStatisticsAge(communityCodeList, AuthUtil.getUserId(), roleType);
            objectObjectHashMap.put("gender", result);
            objectObjectHashMap.put("age", result1);
            return objectObjectHashMap;
src/main/java/org/springblade/modules/house/vo/HouseRentalTenantVO.java
@@ -1,10 +1,8 @@
package org.springblade.modules.house.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.modules.house.entity.HouseRentalEntity;
import org.springblade.modules.house.entity.HouseTenantEntity;
import java.util.List;
/**
 * 房屋租户VO
@@ -12,70 +10,52 @@
@Data
public class HouseRentalTenantVO extends HouseRentalEntity {
    //租户名
    @ApiModelProperty(value = "租户名")
    private String tenantName;
    //房屋名
    @ApiModelProperty(value = "房屋名")
    private String houseName;
    //电话
    @ApiModelProperty(value = "联系电话")
    private String phone;
    /**
     * 租房时间类型  1:长期  2:中期  3:短期
     */
    @ApiModelProperty(value = "租房时间类型  1:长期  2:中期  3:短期")
    private Integer dldType;
    /**
     * 拼接地址
     */
    @ApiModelProperty(value = "拼接地址")
    private String address;
    /**
     * 是否到期 0:未到期  1:已到期  2:已终止
     */
    @ApiModelProperty(value = "是否到期 0:未到期  1:已到期  2:已终止")
    private Integer status;
    /**
     * 区域编号
     */
    @ApiModelProperty(value = "区域编号")
    private String regionCode;
    /**
     * 开始时间
     */
    @ApiModelProperty(value = "开始时间")
    private String startTime;
    /**
     * 结束时间
     */
    @ApiModelProperty(value = "结束时间")
    private String endTime;
    private  String neiCode;
    @ApiModelProperty(value = "小区编号")
    private String neiCode;
    @ApiModelProperty(value = "用户编号")
    private Long userId;
    /**
     * 角色名称
     */
    @ApiModelProperty(value = "角色名称")
    private String roleName;
    /**
     * 社区编号
     */
    @ApiModelProperty(value = "社区编号")
    private String communityCode;
    /**
     * 街道名称
     */
    @ApiModelProperty(value = "街道名称")
    private String townStreetName;
    /**
     * 社区名称
     */
    @ApiModelProperty(value = "社区名称")
    private String neiName;
    @ApiModelProperty(value = "租户信息标识 0:未显示  1:显示")
    private Integer tenantInfoFlag = 1;
}
src/main/java/org/springblade/modules/house/vo/HouseVO.java
@@ -88,4 +88,7 @@
     * 标签id
     */
    private Integer status;
    @ApiModelProperty(value = "编码", example = "")
    private String code;
}