linwei
2024-02-21 2535346464dec2b661e79857ebba335355911552
自查+物业项目经理查询优化
7 files modified
194 ■■■■ changed files
src/main/java/org/springblade/common/param/CommonParamSet.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/place/mapper/PlaceCheckMapper.xml 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml 7 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskPlaceSelfCheck/mapper/TaskPlaceSelfCheckMapper.java 9 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskPlaceSelfCheck/mapper/TaskPlaceSelfCheckMapper.xml 146 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskPlaceSelfCheck/service/impl/TaskPlaceSelfCheckServiceImpl.java 20 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskPlaceSelfCheck/vo/TaskPlaceSelfCheckVO.java 8 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/common/param/CommonParamSet.java
@@ -59,7 +59,7 @@
            }
            isAdministrator = Strings.isBlank(roleName) && (AuthUtil.isAdministrator() == true || AuthUtil.isAdmin() == true) ? 1 : 2;
            if (isAdministrator==2) {
                // 获取当前用户的所属行政区划编号
                // 获取当前用户的所属行政区划编号()
                regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId());
                // 获取网格编号集合
                gridCodeList = new ArrayList<>();
src/main/java/org/springblade/modules/place/mapper/PlaceCheckMapper.xml
@@ -183,7 +183,7 @@
                        <otherwise>
                            and
                            (
                            jg.grid_code in ('') or jpag.community_code in in ('')
                            jg.grid_code in ('') or jpag.community_code in ('')
                            )
                        </otherwise>
                    </choose>
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -109,8 +109,8 @@
    <!--用户详情map-->
    <resultMap id="selectUserDetailMap" type="org.springblade.modules.system.vo.UserDetailVO" autoMapping="true">
        <id property="id" column="id" />
        <collection property="deptList"  javaType="java.util.List"
        <id property="id" column="id"/>
        <collection property="deptList" javaType="java.util.List"
                    ofType="org.springblade.modules.system.vo.DeptDetailVO" autoMapping="true">
            <id property="id" column="cid"/>
            <id property="level" column="region_level"/>
@@ -224,7 +224,8 @@
            ( SELECT id, parent_id FROM blade_dept ORDER BY parent_id, id ) org_query,
            (SELECT    @id := #{deptId} ) initialisation
            WHERE
            FIND_IN_SET( parent_id, @id ) > 0 AND @id := CONCAT( @id, ',', id )
            (FIND_IN_SET( parent_id, @id ) > 0 or FIND_IN_SET( id, @id ) > 0)
            AND @id := CONCAT( @id, ',', id )
            )
    </select>
src/main/java/org/springblade/modules/taskPlaceSelfCheck/mapper/TaskPlaceSelfCheckMapper.java
@@ -22,6 +22,7 @@
import org.springblade.modules.taskPlaceSelfCheck.vo.TaskPlaceSelfCheckVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
@@ -39,7 +40,11 @@
     * @param taskPlaceSelfCheck
     * @return
     */
    List<TaskPlaceSelfCheckVO> selectTaskPlaceSelfCheckPage(IPage page, @Param("palce") TaskPlaceSelfCheckVO taskPlaceSelfCheck);
    List<TaskPlaceSelfCheckVO> selectTaskPlaceSelfCheckPage(IPage page,
                                                            @Param("palce") TaskPlaceSelfCheckVO taskPlaceSelfCheck,
                                                            @Param("isAdministrator") Integer isAdministrator,
                                                            @Param("regionChildCodesList") List<String> regionChildCodesList,
                                                            @Param("gridCodeList") List<String> gridCodeList);
    /**
     * 查询消防自查记任务表
@@ -47,7 +52,7 @@
     * @param taskPlaceSelfCheck 消防自查记任务表ID
     * @return 消防自查记任务表
     */
    public TaskPlaceSelfCheckDTO selectTaskPlaceSelfCheckById(  @Param("palce") TaskPlaceSelfCheckEntity taskPlaceSelfCheck);
    public TaskPlaceSelfCheckDTO selectTaskPlaceSelfCheckById(@Param("palce") TaskPlaceSelfCheckEntity taskPlaceSelfCheck);
    /**
     * 查询消防自查记任务表列表
src/main/java/org/springblade/modules/taskPlaceSelfCheck/mapper/TaskPlaceSelfCheckMapper.xml
@@ -4,40 +4,144 @@
    <!-- 通用查询映射结果 -->
    <resultMap id="taskPlaceSelfCheckResultMap"
               type="org.springblade.modules.taskPlaceSelfCheck.entity.TaskPlaceSelfCheckEntity">
               type="org.springblade.modules.taskPlaceSelfCheck.vo.TaskPlaceSelfCheckVO">
        <result property="id" column="id"/>
        <result property="taskId" column="task_id"/>
        <result property="taskName" column="task_name"/>
        <result property="placeName" column="place_name"/>
        <result property="remark" column="remark"/>
        <result property="updateTime" column="update_time"/>
        <result property="createTime" column="create_time"/>
        <result property="houseCode" column="house_code"/>
        <result property="rectificationEndTime" column="rectification_end_time"/>
        <result property="rectificationCompleteTime" column="rectification_complete_time"/>
        <result property="rectificationFlag" column="rectification_flag"/>
        <result property="policeStation" column="police_station"/>
        <result property="rectificationNoticeImgUrl" column="rectification_notice_img_url"/>
        <result property="signaturePath" column="signature_path"/>
        <result property="createUser" column="create_user"/>
        <result property="imageUrls" column="image_urls"/>
        <result property="status" column="status"/>
        <result property="deleteFlag" column="delete_flag"/>
        <collection property="placePoiLabelVOList" column="jpid" javaType="java.util.List"
                    select="selectPlacePoiLabelList"
                    ofType="org.springblade.modules.place.vo.PlacePoiLabelVO"
                    autoMapping="true">
        </collection>
        <collection property="taskPlaceRecordVOList" column="id" select="selectPatrolRecordList"
                    javaType="java.util.List" ofType="org.springblade.modules.taskPlaceRecord.vo.TaskPlaceRecordVO"
                    autoMapping="true">
        </collection>
    </resultMap>
    <select id="selectTaskPlaceSelfCheckPage" resultMap="taskPlaceSelfCheckResultMap">
        select * from jczz_task_place_self_check
        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,
        br.village_name,
        bu.`name`,
        jpe.legal_tel,
        jpe.legal_person
        FROM jczz_task_place_self_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>
            <if test="palce.id != null ">and id = #{palce.id}</if>
            <if test="palce.taskId != null ">and task_id = #{palce.taskId}</if>
            <if test="palce.taskName != null  and palce.taskName != ''">and task_name = #{palce.taskName}</if>
            <if test="palce.placeName != null  and palce.placeName != ''">and place_name = #{palce.placeName}</if>
            <if test="palce.remark != null  and palce.remark != ''">and remark = #{palce.remark}</if>
            <if test="palce.updateTime != null ">and update_time = #{palce.updateTime}</if>
            <if test="palce.createTime != null ">and create_time = #{palce.createTime}</if>
            <if test="palce.houseCode != null  and palce.houseCode != ''">and house_code = #{palce.houseCode}</if>
            <if test="palce.rectificationEndTime != null ">and rectification_end_time = #{palce.rectificationEndTime}
            <if test="palce.id != null ">and jpc.id = #{palce.id}</if>
            <if test="palce.taskId != null ">and jpc.task_id = #{palce.taskId}</if>
            <if test="palce.taskName != null  and palce.taskName != ''">and jpc.task_name = #{palce.taskName}</if>
            <if test="palce.placeName != null  and palce.placeName != ''">and jpc.place_name = #{palce.placeName}</if>
            <if test="palce.remark != null  and palce.remark != ''">and jpc.remark = #{palce.remark}</if>
            <if test="palce.updateTime != null ">and jpc.update_time = #{palce.updateTime}</if>
            <if test="palce.createTime != null ">and jpc.create_time = #{palce.createTime}</if>
            <if test="palce.houseCode != null  and palce.houseCode != ''">and jpc.house_code = #{palce.houseCode}</if>
            <if test="palce.rectificationEndTime != null ">and jpc.rectification_end_time =
                #{palce.rectificationEndTime}
            </if>
            <if test="palce.rectificationCompleteTime != null ">and rectification_complete_time =
            <if test="palce.rectificationCompleteTime != null ">and jpc.rectification_complete_time =
                #{palce.rectificationCompleteTime}
            </if>
            <if test="palce.rectificationFlag != null ">and rectification_flag = #{palce.rectificationFlag}</if>
            <if test="palce.policeStation != null  and palce.policeStation != ''">and police_station =
            <if test="palce.rectificationFlag != null ">and jpc.rectification_flag = #{palce.rectificationFlag}</if>
            <if test="palce.policeStation != null  and palce.policeStation != ''">and jpc.police_station =
                #{palce.policeStation}
            </if>
            <if test="palce.rectificationNoticeImgUrl != null  and palce.rectificationNoticeImgUrl != ''">and
                rectification_notice_img_url = #{palce.rectificationNoticeImgUrl}
                jpc.rectification_notice_img_url = #{palce.rectificationNoticeImgUrl}
            </if>
            <if test="palce.signaturePath != null  and palce.signaturePath != ''">and signature_path =
            <if test="palce.signaturePath != null  and palce.signaturePath != ''">and jpc.signature_path =
                #{palce.signaturePath}
            </if>
            <if test="palce.createUser != null ">and create_user = #{palce.createUser}</if>
            <if test="palce.imageUrls != null  and palce.imageUrls != ''">and image_urls = #{palce.imageUrls}</if>
            <if test="palce.status != null ">and status = #{palce.status}</if>
            <if test="palce.deleteFlag != null ">and delete_flag = #{palce.deleteFlag}</if>
            <if test="palce.createUser != null ">and jpc.create_user = #{palce.createUser}</if>
            <if test="palce.imageUrls != null  and palce.imageUrls != ''">and jpc.image_urls = #{palce.imageUrls}</if>
            <if test="palce.status != null ">and jpc.status = #{palce.status}</if>
            <if test="palce.deleteFlag != null ">and jpc.delete_flag = #{palce.deleteFlag}</if>
            <if test="isAdministrator==2">
                <choose>
                    <when test="palce.roleName != null and palce.roleName != ''">
                        <if test="palce.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="palce.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>
                            </otherwise>
                        </choose>
                    </otherwise>
                </choose>
            </if>
        </where>
    </select>
@@ -95,7 +199,7 @@
    <select id="selectPatrolRecordList" parameterType="Long"
            resultType="org.springblade.modules.patrol.vo.PatrolRecordVO">
            resultType="org.springblade.modules.taskPlaceRecord.vo.TaskPlaceRecordVO">
            select
            jpr.id,
            jpr.item_id,
src/main/java/org/springblade/modules/taskPlaceSelfCheck/service/impl/TaskPlaceSelfCheckServiceImpl.java
@@ -19,6 +19,7 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.common.constant.CommonConstant;
import org.springblade.common.constant.DictConstant;
import org.springblade.common.param.CommonParamSet;
import org.springblade.common.utils.SpringUtils;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.BeanUtil;
@@ -57,7 +58,24 @@
    @Override
    public IPage<TaskPlaceSelfCheckVO> selectTaskPlaceSelfCheckPage(IPage<TaskPlaceSelfCheckVO> page, TaskPlaceSelfCheckVO taskPlaceSelfCheck) {
        return page.setRecords(baseMapper.selectTaskPlaceSelfCheckPage(page, taskPlaceSelfCheck));
        // 公共参数设置
        CommonParamSet commonParamSet = new CommonParamSet().invoke(TaskPlaceSelfCheckVO.class,taskPlaceSelfCheck);
        List<TaskPlaceSelfCheckVO> placeCheckVOS = baseMapper.selectTaskPlaceSelfCheckPage(page,
            taskPlaceSelfCheck,
            commonParamSet.getIsAdministrator(),
            commonParamSet.getRegionChildCodesList(),
            commonParamSet.getGridCodeList());
        for (TaskPlaceSelfCheckVO placeCheckVO : placeCheckVOS) {
            int number = 0;
            for (TaskPlaceRecordVO patrolRecord : placeCheckVO.getTaskPlaceRecordVOList()) {
                if (patrolRecord.getState().equals(0)) {
                    number++;
                }
            }
            placeCheckVO.setNumber(number);
        }
        return page.setRecords(placeCheckVOS);
        // return page.setRecords(baseMapper.selectTaskPlaceSelfCheckPage(page, taskPlaceSelfCheck));
    }
    /**
src/main/java/org/springblade/modules/taskPlaceSelfCheck/vo/TaskPlaceSelfCheckVO.java
@@ -101,4 +101,12 @@
    @ApiModelProperty(value = "结束时间", example = "")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private String endTime;
    // 角色名称
    @ApiModelProperty(value = "角色名称", example = "")
    private String roleName;
    // 社区编号
    @ApiModelProperty(value = "社区编号", example = "")
    private String communityCode;
}