zhongrj
2024-02-07 334649ca7fde52d01ef5416abcda19af51dd8e27
九小导出同步修改
3 files modified
120 ■■■■ changed files
src/main/java/org/springblade/modules/place/mapper/PlaceMapper.java 3 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml 73 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/place/service/impl/PlaceServiceImpl.java 44 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/place/mapper/PlaceMapper.java
@@ -146,7 +146,8 @@
    List<NinePlaceExcel> export( @Param("place") PlaceVO place,
                                 @Param("houseCodeList") List<String> houseCodeList,
                                 @Param("regionChildCodesList") List<String> regionChildCodesList,
                                 @Param("isAdministrator") Integer isAdministrator);
                                 @Param("isAdministrator") Integer isAdministrator,
                                 @Param("nineTypeList") List<String> nineTypeList);
    /**
     * 查询 警务网格为空的数据
src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml
@@ -476,15 +476,15 @@
        jpe.confirm_flag confirmFlag,
        bus.`name` AS policeName,
        bus.phone AS policePhone,
        IFNULL(jda.address_name,jp.location) addressName,
        jp.location addressName,
        jpag.pcs_name deptName
        from jczz_place jp
        left join jczz_grid jg on jg.grid_code = jp.grid_code and jg.is_deleted = 0
        left join blade_user bu on bu.id = jp.principal_user_id and bu.is_deleted = 0
        left join jczz_place_ext jpe on jpe.place_id=jp.id and jpe.is_deleted = 0
        LEFT JOIN jczz_police_affairs_grid jpag on jp.jw_grid_code= jpag.jw_grid_code
        left join blade_region br on br.code = jpag.community_code
        LEFT JOIN blade_user bus on bus.id = jpag.police_user_id
        LEFT JOIN jczz_doorplate_address jda on jda.address_code=jp.house_code
        left join (
        select a.* from jczz_place_poi_label a inner join
        (
@@ -516,8 +516,11 @@
            and bus.name like concat('%',#{place.policeName},'%')
        </if>
        <if test="place.nineType!=null and place.nineType!=''">
            and jp.nine_type = #{place.nineType}
        <if test="nineTypeList!=null and nineTypeList.size()>0">
            and jp.nine_type in
            <foreach collection="nineTypeList" separator="," open="(" close=")" item="nineType">
                #{nineType}
            </foreach>
        </if>
        <if test="place.isFront!=null and place.isFront!=''">
@@ -544,20 +547,60 @@
        <if test="place.isPerfect==2">
            and jp.status = 2
        </if>
        <if test="houseCodeList != null and houseCodeList.size()>0">
            and jp.house_code in
            <foreach collection="houseCodeList" item="houseCode" separator ="," open="("  close=")">
                #{houseCode}
            </foreach>
        </if>
        <if test="isAdministrator==2">
            <choose>
                <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                    and jg.grid_code in
                    <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                        #{code}
                    </foreach>
                <when test="place.roleName != null and place.roleName != ''">
                    <if test="place.roleName=='wgy'">
                        <choose>
                            <when test="gridCodeList !=null and gridCodeList.size()>0">
                                and jp.grid_code in
                                <foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
                                    #{code}
                                </foreach>
                            </when>
                            <otherwise>
                                and jp.grid_code in ('')
                            </otherwise>
                        </choose>
                    </if>
                    <if test="place.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 in ('')
                            )
                        </otherwise>
                    </choose>
                </otherwise>
            </choose>
        </if>
        order by jp.create_time desc,jp.id desc
src/main/java/org/springblade/modules/place/service/impl/PlaceServiceImpl.java
@@ -1237,17 +1237,43 @@
    @Override
    public List<NinePlaceExcel> export(PlaceVO place) {
        place.setIsNine(1);
        // 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("")) {
            if (place.getRoleName().equals("网格员")) {
                // 查询对应的房屋地址code
                list = gridService.getAddressCodeListByUserId(AuthUtil.getUserId());
        String roleName = SpringUtils.getRequestParam("roleName");
        String communityCode = SpringUtils.getRequestParam("communityCode");
        if (!Strings.isBlank(communityCode)){
            // 校验社区编号是否合规
            if(null!=SpringUtils.getBean(IRegionService.class).getById(communityCode)) {
                place.setCommunityCode(communityCode);
            }
        }
        List<NinePlaceExcel> aa = baseMapper.export(place, list, regionChildCodesList, isAdministrator);
        List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId());
        Integer isAdministrator = AuthUtil.isAdministrator()==true?1:2;
        // 网格编号集合
        List<String> gridCodeList = new ArrayList<>();
        // 民警角色
        if (!Strings.isBlank(roleName)){
            place.setRoleName(roleName);
            if(roleName.equals("mj")) {
                regionChildCodesList = SpringUtil.getBean(IPoliceAffairsGridService.class).getCommunityCodeListByUserId(AuthUtil.getUserId());
            }
            if (roleName.equals("wgy")) {
                gridCodeList = SpringUtil.getBean(IGridService.class).getGridListByUserId(AuthUtil.getUserId());
            }
        }
        List<String> strings = new ArrayList<>();
        if (null!=place.getNineType()){
            QueryWrapper<DictBiz> queryWrapper = new QueryWrapper<>();
            queryWrapper.eq("is_deleted",0).eq("dict_key",place.getNineType()).eq("code","nineType");
            // 先查询当前
            DictBiz one = dictBizService.getOne(queryWrapper);
            // 查询本身和子集的key
            List<DictBiz> list = dictBizService.getList("nineType", one.getId());
            if (list.size()==0){
                strings.add(place.getNineType().toString());
            }else {
                strings = list.stream().map(DictBiz::getDictKey).collect(Collectors.toList());
            }
        }
        List<NinePlaceExcel> aa = baseMapper.export(place, gridCodeList, regionChildCodesList, isAdministrator,strings);
        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) {