linwei
2024-02-19 0f70534d41cffbd2d5779e53baa11ad0f4231637
Merge remote-tracking branch 'origin/master'
5 files modified
1 files added
257 ■■■■■ changed files
src/main/java/org/springblade/modules/place/controller/PlaceCheckController.java 21 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/place/excel/PlaceCheckExcel.java 55 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/place/mapper/PlaceCheckMapper.java 15 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/place/mapper/PlaceCheckMapper.xml 119 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/place/service/IPlaceCheckService.java 12 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/place/service/impl/PlaceCheckServiceImpl.java 35 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/place/controller/PlaceCheckController.java
@@ -21,14 +21,21 @@
import io.swagger.annotations.ApiParam;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.place.dto.PlaceCheckDTO;
import org.springblade.modules.place.excel.NinePlaceExcel;
import org.springblade.modules.place.excel.PlaceCheckExcel;
import org.springblade.modules.place.vo.PlaceVO;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.place.entity.PlaceCheckEntity;
@@ -36,6 +43,8 @@
import org.springblade.modules.place.wrapper.PlaceCheckWrapper;
import org.springblade.modules.place.service.IPlaceCheckService;
import org.springblade.core.boot.ctrl.BladeController;
import java.util.List;
/**
 * 场所检查表 控制器
@@ -133,5 +142,17 @@
        return R.status(placeCheckService.removeByIds(Func.toLongList(ids)));
    }
    /**
     * 导出场所检查信息
     * @param placeCheck
     */
    @GetMapping("export-placeCheck")
    @ApiOperationSupport(order = 8)
    @ApiOperation(value = "导出场所检查", notes = "传入placeCheck")
    public void exportPlaceCheck(PlaceCheckVO placeCheck, HttpServletResponse response) {
        List<PlaceCheckExcel> list = placeCheckService.exportPlaceCheck(placeCheck);
        ExcelUtil.export(response, "场所检查" + DateUtil.time(), "场所检查记录表", list, PlaceCheckExcel.class);
    }
}
src/main/java/org/springblade/modules/place/excel/PlaceCheckExcel.java
New file
@@ -0,0 +1,55 @@
package org.springblade.modules.place.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.io.Serializable;
/**
 * 场所检查
 *
 * @author zhongrj
 * @date 2024/02/19
 */
@Data
@ColumnWidth(25)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class PlaceCheckExcel implements Serializable {
    private static final long serialVersionUID = 2L;
    /** 街道名称 */
    @ExcelProperty( "所属街道")
    private String streetName;
    @ExcelProperty(value = "所属社区")
    private String communityName;
    @ExcelProperty(value = "所属网格")
    private String gridName;
    @ExcelProperty( value = "场所名称")
    private String placeName;
    @ExcelProperty( value = "场所隐患")
    private String remark;
    @ExcelProperty(value = "场所负责人")
    private String principal;
    @ExcelProperty(value = "场所负责人电话")
    private String principalPhone;
    @ExcelProperty(value = "场所地址")
    private String location;
    @ExcelProperty(value = "创建时间")
    private String createTime;
}
src/main/java/org/springblade/modules/place/mapper/PlaceCheckMapper.java
@@ -19,6 +19,7 @@
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.place.dto.PlaceCheckDTO;
import org.springblade.modules.place.entity.PlaceCheckEntity;
import org.springblade.modules.place.excel.PlaceCheckExcel;
import org.springblade.modules.place.vo.PlaceCheckVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -61,5 +62,17 @@
     */
    public List<PlaceCheckDTO> selectPlaceCheckList(PlaceCheckDTO placeCheckDTO);
    /**
     * 查询列表数据导出
     *
     * @param placeCheck
     * @param isAdministrator
     * @param regionChildCodesList
     * @param gridCodeList
     * @return
     */
    List<PlaceCheckExcel> selectPlaceCheckListExcel(@Param("placeCheck") PlaceCheckVO placeCheck,
                                                    @Param("isAdministrator") Integer isAdministrator,
                                                    @Param("regionChildCodesList") List<String> regionChildCodesList,
                                                    @Param("gridCodeList") List<String> gridCodeList);
}
src/main/java/org/springblade/modules/place/mapper/PlaceCheckMapper.xml
@@ -252,5 +252,124 @@
        </where>
    </select>
    <!--查询列表数据导出-->
    <select id="selectPlaceCheckListExcel" resultType="org.springblade.modules.place.excel.PlaceCheckExcel">
        SELECT
        jpc.*,
        jp.id jpid,
        jp.place_name,
        jp.location,
        jg.grid_name,
        jp.principal,
        jp.principal_phone,
        jp.nine_type,
        jp.is_nine,
        br.town_name as streetName,
        br.village_name as communityName,
        bu.`name`,
        jpe.legal_tel,
        jpe.legal_person
        FROM
        jczz_place_check jpc
        LEFT JOIN jczz_place jp ON jpc.house_code = jp.house_code and jp.is_deleted = 0
        LEFT JOIN jczz_grid jg ON jg.grid_code = jp.grid_code and jg.is_deleted = 0
        LEFT JOIN blade_region br ON br.`code` = jg.community_code
        LEFT JOIN jczz_place_ext jpe ON jpe.place_id = jp.id and jpe.is_deleted = 0
        LEFT JOIN blade_user bu ON bu.id = jpc.create_user and bu.is_deleted = 0
        LEFT JOIN jczz_police_affairs_grid jpag on jp.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
        where jpc.is_deleted = 0
        <if test="placeCheck.houseCode!=null and placeCheck.houseCode!=''">
            and jpc.house_code = #{placeCheck.houseCode}
        </if>
        <if test="placeCheck.streetName!=null and placeCheck.streetName!=''">
            and br.town_name like concat('%', #{placeCheck.streetName},'%')
        </if>
        <if test="placeCheck.communityName!=null and placeCheck.communityName!=''">
            and br.village_name like concat('%', #{placeCheck.communityName},'%')
        </if>
        <if test="placeCheck.gridName!=null and placeCheck.gridName!=''">
            and jg.grid_name like concat('%', #{placeCheck.gridName},'%')
        </if>
        <if test="placeCheck.placeName!=null and placeCheck.placeName!=''">
            and jp.place_name like concat('%', #{placeCheck.placeName},'%')
        </if>
        <if test="placeCheck.principal!=null and placeCheck.principal!=''">
            and jp.principal like concat('%', #{placeCheck.principal},'%')
        </if>
        <if test="placeCheck.principalPhone!=null and placeCheck.principalPhone!=''">
            and jp.principal_phone like concat('%', #{placeCheck.principalPhone},'%')
        </if>
        <if test="placeCheck.startTime!=null and placeCheck.startTime!=''">
            and date_format(jpc.create_time,'%Y-%m-%d') &gt;= #{placeCheck.startTime}
        </if>
        <if test="placeCheck.endTime!=null and placeCheck.endTime!=''">
            and date_format(jpc.create_time,'%Y-%m-%d') &lt;= #{placeCheck.endTime}
        </if>
        <if test="isAdministrator==2">
            <choose>
                <when test="placeCheck.roleName != null and placeCheck.roleName != ''">
                    <if test="placeCheck.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="placeCheck.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 jpc.create_time desc
    </select>
</mapper>
src/main/java/org/springblade/modules/place/service/IPlaceCheckService.java
@@ -19,6 +19,8 @@
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.modules.place.dto.PlaceCheckDTO;
import org.springblade.modules.place.entity.PlaceCheckEntity;
import org.springblade.modules.place.excel.NinePlaceExcel;
import org.springblade.modules.place.excel.PlaceCheckExcel;
import org.springblade.modules.place.vo.PlaceCheckVO;
import org.springblade.core.mp.base.BaseService;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -51,7 +53,7 @@
     * @param id 场所检查表ID
     * @return 场所检查表
     */
    public PlaceCheckVO selectPlaceCheckById(Long id);
    PlaceCheckVO selectPlaceCheckById(Long id);
    /**
     * 查询场所检查表列表
@@ -59,5 +61,11 @@
     * @param placeCheckDTO 场所检查表
     * @return 场所检查表集合
     */
    public List<PlaceCheckDTO> selectPlaceCheckList(PlaceCheckDTO placeCheckDTO);
    List<PlaceCheckDTO> selectPlaceCheckList(PlaceCheckDTO placeCheckDTO);
    /**
     * 导出场所检查信息
     * @param placeCheck
     */
    List<PlaceCheckExcel> exportPlaceCheck(PlaceCheckVO placeCheck);
}
src/main/java/org/springblade/modules/place/service/impl/PlaceCheckServiceImpl.java
@@ -34,6 +34,8 @@
import org.springblade.modules.patrol.service.IPatrolRecordService;
import org.springblade.modules.place.dto.PlaceCheckDTO;
import org.springblade.modules.place.entity.PlaceCheckEntity;
import org.springblade.modules.place.excel.NinePlaceExcel;
import org.springblade.modules.place.excel.PlaceCheckExcel;
import org.springblade.modules.place.service.IPlaceService;
import org.springblade.modules.place.vo.PlaceCheckVO;
import org.springblade.modules.place.mapper.PlaceCheckMapper;
@@ -175,4 +177,37 @@
    public List<PlaceCheckDTO> selectPlaceCheckList(PlaceCheckDTO placeCheckDTO) {
        return this.baseMapper.selectPlaceCheckList(placeCheckDTO);
    }
    /**
     * 导出场所检查信息
     * @param placeCheck
     */
    @Override
    public List<PlaceCheckExcel> exportPlaceCheck(PlaceCheckVO placeCheck) {
        String roleName = SpringUtils.getRequestParam("roleName");
        String communityCode = SpringUtils.getRequestParam("communityCode");
        if (!Strings.isBlank(communityCode)){
            // 校验社区编号是否合规
            if(null!=SpringUtils.getBean(IRegionService.class).getById(communityCode)) {
                placeCheck.setCommunityCode(communityCode);
            }
        }
        List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId());
        Integer isAdministrator = AuthUtil.isAdministrator()==true?1:2;
        // 网格编号集合
        List<String> gridCodeList = new ArrayList<>();
        // 民警角色
        if (!Strings.isBlank(roleName)){
            placeCheck.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<PlaceCheckExcel> placeCheckVOS = baseMapper.selectPlaceCheckListExcel(placeCheck,isAdministrator,regionChildCodesList,gridCodeList);
        // 返回
        return placeCheckVOS;
    }
}