xiangpei
2024-09-02 5a62cf2c51da8c1caca1d8bcfdcb97eeda27cc68
接口权限字符调整、下发页面单位统计工单数优化
8个文件已修改
79 ■■■■■ 已修改文件
ycl-pojo/src/main/java/com/ycl/platform/domain/query/ReportQuery.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/controller/WorkOrderController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/mapper/YwUnitMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/service/impl/ReportServiceImpl.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/service/impl/YwUnitServiceImpl.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/utils/SecurityUtils.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/resources/mapper/zgyw/ReportMapper.xml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/resources/mapper/zgyw/YwUnitMapper.xml 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-pojo/src/main/java/com/ycl/platform/domain/query/ReportQuery.java
@@ -35,6 +35,9 @@
    private List<Integer> peopleIdList;
    @ApiModelProperty("运维单位")
    private Integer unitId;
    @ApiModelProperty("状态")
    private Integer status;
ycl-server/src/main/java/com/ycl/platform/controller/WorkOrderController.java
@@ -111,7 +111,7 @@
    @PostMapping("/distribute/page")
    @ApiOperation(value = "下发分页", notes = "下发分页")
    @PreAuthorize("@ss.hasPermi('work:order:distribute')")
    @PreAuthorize("@ss.hasPermi('work:order:distribute:page')")
    public Result distributePage(@RequestBody DistributeWorkOrderQuery query) {
        return workOrderService.distributePage(query);
    }
@@ -132,7 +132,7 @@
    @GetMapping("/{id}")
    @ApiOperation(value = "详情", notes = "详情")
    @PreAuthorize("@ss.hasPermi('work:order:query')")
    @PreAuthorize("@ss.hasPermi('work:order:detail')")
    public Result detail(@PathVariable("id") String id) {
        return workOrderService.detail(id);
    }
ycl-server/src/main/java/com/ycl/platform/mapper/YwUnitMapper.java
@@ -25,7 +25,7 @@
     * 运维单位列表统计
     * @return 数据
     */
    List<YwUnitVO> workList(@Param("query") DistributeWorkOrderQuery query);
    Integer workList(@Param("query") DistributeWorkOrderQuery query);
    /**
     * 通过用户ID查找运维单位
ycl-server/src/main/java/com/ycl/platform/service/impl/ReportServiceImpl.java
@@ -252,6 +252,7 @@
    @Override
    public Result page(ReportQuery query) {
        IPage<ReportVO> page = PageUtil.getPage(query, ReportVO.class);
        query.setUnitId(SecurityUtils.getUnitId());
        baseMapper.page(page, query);
        List<SysDictData> errorTypeList = dictTypeService.selectDictDataByType("report_error_type");
        Map<String, String> dictMap = errorTypeList.stream().collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel));
@@ -310,6 +311,7 @@
    public List<ReportVO> export(ReportQuery query) {
        IPage<ReportVO> page = PageUtil.getPage(query, ReportVO.class);
        page.setSize(-1);
        query.setUnitId(SecurityUtils.getUnitId());
        baseMapper.page(page, query);
        List<SysDictData> errorTypeList = dictTypeService.selectDictDataByType("report_error_type");
        Map<String, String> dictMap = errorTypeList.stream().collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel));
ycl-server/src/main/java/com/ycl/platform/service/impl/YwUnitServiceImpl.java
@@ -216,8 +216,18 @@
    @Override
    public Result workList(DistributeWorkOrderQuery query) {
        List<YwUnitVO> entities = baseMapper.workList(query);
        return Result.ok().data(entities);
        List<YwUnit> ywUnits = baseMapper.selectList(null);
        List<YwUnitVO> lists = ywUnits.stream().map(item -> {
            YwUnitVO vo = new YwUnitVO();
            BeanUtils.copyProperties(item, vo);
            return vo;
        }).collect(Collectors.toList());
        for (YwUnitVO ywUnit : lists) {
            query.setUnitId(ywUnit.getId());
            Integer workOrderNum = baseMapper.workList(query);
            ywUnit.setWorkOrderCount(workOrderNum);
        }
        return Result.ok().data(lists);
    }
    @Override
ycl-server/src/main/java/com/ycl/utils/SecurityUtils.java
@@ -44,6 +44,11 @@
     * */
    public static Integer getUnitId() {
        try {
            if (isAdmin(getUserId())) {
                return null;
            } else if (hasRole("yw_admin")) {
                return null;
            }
            return getLoginUser().getUser().getUnitId();
        }
        catch (Exception e)
ycl-server/src/main/resources/mapper/zgyw/ReportMapper.xml
@@ -41,6 +41,9 @@
        <if test="query.reportType != null and query.reportType != ''">
            AND r.report_type = #{query.reportType}
        </if>
        <if test="query.unitId != null">
            AND r.unit_id = #{query.unitId}
        </if>
        <if test="query.status != null">
            AND r.status = #{query.status}
        </if>
ycl-server/src/main/resources/mapper/zgyw/YwUnitMapper.xml
@@ -33,36 +33,26 @@
        where id = #{id}
    </select>
    <select id="workList" resultType="com.ycl.platform.domain.vo.YwUnitVO">
    <select id="workList" resultType="integer">
        SELECT
               u.id AS id, u.unit_name, count(DISTINCT wot.id) AS work_order_count
               count(*)
        FROM
            t_yw_unit u
                LEFT JOIN
             (
                SELECT
                    wo.id,
                    wo.unit_id
                FROM
                    t_work_order wo
                    INNER JOIN t_monitor tm ON wo.serial_number = tm.serial_number
                    INNER JOIN t_yw_point yp ON yp.serial_number = wo.serial_number AND yp.deleted = 0
                    INNER JOIN t_work_order_error_type et ON wo.work_order_no = et.work_order_no
                    INNER JOIN sys_dict_data da ON da.dict_value = et.error_name AND da.dict_type = 'error_type'
                    <if test="query.errorTypeList != null and query.errorTypeList.size() > 0">AND da.dict_value in <foreach
                            collection="query.errorTypeList" open="(" separator="," close=")" item="errorType">#{errorType}</foreach>
                    </if>
                WHERE
                    wo.deleted = 0
                    <if test="query.status != null and query.status != ''">
                        AND wo.status = #{query.status}
                    </if>
                    <if test="query.keyword != null and query.keyword != ''">
                        AND (tm.name like concat('%', #{query.keyword}, '%') or tm.serial_number like concat('%', #{query.keyword}, '%'))
                    </if>
                ) as wot ON wot.unit_id = u.id
        WHERE u.deleted = 0
                group by u.id
            t_work_order wo
            INNER JOIN t_monitor tm ON wo.serial_number = tm.serial_number AND #{query.unitId}
            INNER JOIN t_yw_point yp ON yp.serial_number = wo.serial_number AND yp.deleted = 0
            INNER JOIN t_work_order_error_type et ON wo.work_order_no = et.work_order_no
            INNER JOIN sys_dict_data da ON da.dict_value = et.error_name AND da.dict_type = 'error_type'
            <if test="query.errorTypeList != null and query.errorTypeList.size() > 0">AND da.dict_value in <foreach
                    collection="query.errorTypeList" open="(" separator="," close=")" item="errorType">#{errorType}</foreach>
            </if>
        WHERE
            wo.deleted = 0
            <if test="query.status != null and query.status != ''">
                AND wo.status = #{query.status}
            </if>
            <if test="query.keyword != null and query.keyword != ''">
                AND (tm.name like concat('%', #{query.keyword}, '%') or tm.serial_number like concat('%', #{query.keyword}, '%'))
            </if>
    </select>
    <insert id="insertYwUnit" parameterType="YwUnit" useGeneratedKeys="true" keyProperty="id">