lidongdong
2022-11-15 59c76e8ec3fbcb474993f3373ae4a03b4d604ff9
修改导办人员即是领导又是工人    bug
7个文件已修改
575 ■■■■ 已修改文件
flower_city/src/main/java/com/dg/core/api/GuideRepairOrderAppletsController.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/controller/GuideRepairOrderController.java 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/controller/HomeStatisticsController.java 280 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/db/gen/mapper/HomeStatisticsMapper.java 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/service/HomeStatisticsService.java 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/service/impl/HomeStatisticsImpl.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/resources/mapper/HomeStatisticsMapper.xml 129 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/api/GuideRepairOrderAppletsController.java
@@ -331,9 +331,16 @@
        String userId=null;
        if( StringUtils.equals("2",sysUser.getRoleIds()))
        {
            userId=sysUser.getUserId()+"";
            ids=new ArrayList<>();
            ids.add(sysUser.getDepartmentId());
            if(StringUtils.equals("1",sysUser.getIsDivisionHead()))
            {
                ids=PermissionUtil.getPermission(sysUser,iOrganizationChartService);
            }
            else
            {
                userId=sysUser.getUserId()+"";
                ids=new ArrayList<>();
                ids.add(sysUser.getDepartmentId());
            }
        }
        else
        {
flower_city/src/main/java/com/dg/core/controller/GuideRepairOrderController.java
@@ -387,18 +387,16 @@
        String userId=null;
        if( StringUtils.equals("2",sysUser.getRoleIds()))
        {
//            if(StringUtils.equals("1",sysUser.getIsDivisionHead()))
//            {
//                userId=null;
//            }
//            else
//            {
//                ids=null;
//                userId=sysUser.getUserId()+"";
//            }
            userId=sysUser.getUserId()+"";
//            ids=new ArrayList<>();
//            ids.add(sysUser.getDepartmentId());
            if(StringUtils.equals("1",sysUser.getIsDivisionHead()))
            {
                ids=PermissionUtil.getPermission(sysUser,iOrganizationChartService);
            }
            else
            {
                userId=sysUser.getUserId()+"";
                ids=new ArrayList<>();
                ids.add(sysUser.getDepartmentId());
            }
        }
        else
        {
@@ -422,18 +420,16 @@
        String userId=null;
        if( StringUtils.equals("2",sysUser.getRoleIds()))
        {
//            if(StringUtils.equals("1",sysUser.getIsDivisionHead()))
//            {
//                userId=null;
//            }
//            else
//            {
//                ids=null;
//                userId=sysUser.getUserId()+"";
//            }
            userId=sysUser.getUserId()+"";
//            ids=new ArrayList<>();
//            ids.add(sysUser.getDepartmentId());
            if(StringUtils.equals("1",sysUser.getIsDivisionHead()))
            {
                ids=PermissionUtil.getPermission(sysUser,iOrganizationChartService);
            }
            else
            {
                userId=sysUser.getUserId()+"";
                ids=new ArrayList<>();
                ids.add(sysUser.getDepartmentId());
            }
        }
        else
        {
flower_city/src/main/java/com/dg/core/controller/HomeStatisticsController.java
@@ -182,7 +182,7 @@
    {
        PieChartAll pieChartAll=new PieChartAll();
        pieChartAll.setWorkOrderNum(iGuideRepairOrderService.countStatisticsNum("",null,null,null,null,null,null,null)+"");
        pieChartAll.setFingerpostNum(homeStatisticsService.countStatisticsNum(null)+"");
        pieChartAll.setFingerpostNum(homeStatisticsService.countStatisticsNum(null,null)+"");
        List<PieChart> workOrderList=new ArrayList<>();
        List<PieChart> fingerpostList=new ArrayList<>();
        List<ClassifyAdministration> oneIds=homeStatisticsService.getClassify(null,"1");
@@ -206,7 +206,7 @@
            if(clasIds.size()>0)
            {
                workOrderNum=iGuideRepairOrderService.countStatisticsNum(null,null,null,null,null,clasIds,null,null);
                fingerpostNum=homeStatisticsService.countStatisticsNum(clasIds);
                fingerpostNum=homeStatisticsService.countStatisticsNum(clasIds,null);
            }
            workOrder.setNum(workOrderNum+"");
            fingerpost.setNum(fingerpostNum+"");
@@ -295,22 +295,22 @@
    @GetMapping("/getGuidePlate")
    public TableDataInfo<GuidePlate> getGuidePlate(@RequestParam("type") String type)
    {
        int allNum=homeStatisticsService.staffNum();
        int allNum=homeStatisticsService.staffNum(null);
        if(StringUtils.equals("1",type))
        {
            //安评价
            return getDataTable(homeStatisticsService.score(),allNum);
            return getDataTable(homeStatisticsService.score(null),allNum);
        }
        else if(StringUtils.equals("2",type))
        {
            //2 按办结量
            return getDataTable(homeStatisticsService.guidePlatePeople(),allNum);
            return getDataTable(homeStatisticsService.guidePlatePeople(null),allNum);
        }
        else
        {
            //3 按超时
            return getDataTable(homeStatisticsService.timeout(),allNum);
            return getDataTable(homeStatisticsService.timeout(null),allNum);
        }
    }
@@ -319,14 +319,14 @@
    @GetMapping("/getGuidance")
    public TableDataInfo<Guidance> getGuidance(@RequestParam("type") String type)
    {
        int allNum=homeStatisticsService.countWork();
        int allNum=homeStatisticsService.countWork(null);
        if(StringUtils.equals("1",type))
        {
            return getDataTable(homeStatisticsService.guidanceBrowse(),allNum);
            return getDataTable(homeStatisticsService.guidanceBrowse(null),allNum);
        }
        else
        {
            return getDataTable(homeStatisticsService.guidanceTransaction(),allNum);
            return getDataTable(homeStatisticsService.guidanceTransaction(null),allNum);
        }
    }
@@ -393,8 +393,270 @@
    /***************************************************    部门数据统计  start   **********************************************************/
    @ApiOperation("部门数据根据选择的时间段 筛选导办工单数 timeType:1 本年度 15 近15天的   30 近30天的")
    @GetMapping("/department/getSelectionTimeOrder")
    public ResultData<CountList> getDepartmentOrder(@RequestParam("timeType") Integer timeType,@RequestParam("ids") List<String> ids)
    {
        if(ids==null || ids.size()<1)
        {
            return  ResultData.success();
        }
        if(timeType<1)
        {
            return ResultData.error("请输入时间");
        }
        if(timeType==1)
        {
            Calendar calendar=Calendar.getInstance();
            timeType=calendar.get(Calendar.DAY_OF_YEAR);
        }
//        System.out.println(timeType);
        //1 本年度 15 近15天的   30 近30天的
        List<CountListNum> listOne=iGuideRepairOrderService.countListNum("2",ids,timeType);
        List<CountListNum> listTwo=iGuideRepairOrderService.countListNum("3",ids,timeType);
        CountList countList=new CountList();
        countList.setWaitDealWithList(listOne);
        countList.setHaveDealWith(listTwo);
        return ResultData.success(countList);
    }
    @ApiOperation("部门数据首页统计不同时间段的工单数量")
    @GetMapping("/department/getTimeWorkOrder")
    public ResultData<TimeWorkOrder> getDepartmentTimeWorkOrder(@RequestParam("ids") List<String> ids)
    {
        if(ids==null || ids.size()<1)
        {
            return  ResultData.success();
        }
        //1 今天   2昨天   3本月   4本年度
        //累计全部 本年 本月 今日 昨日
        TimeWorkOrder timeWorkOrder=new TimeWorkOrder();
        timeWorkOrder.setAllNum(iGuideRepairOrderService.countStatisticsNum(null,ids,null,null,null,null,null,null));
        timeWorkOrder.setYearNum(iGuideRepairOrderService.countStatisticsNum(null,ids,"4",null,null,null,null,null));
        timeWorkOrder.setMonthNum(iGuideRepairOrderService.countStatisticsNum(null,ids,"3",null,null,null,null,null));
        timeWorkOrder.setTodayNum(iGuideRepairOrderService.countStatisticsNum(null,ids,"1",null,null,null,null,null));
        timeWorkOrder.setYesterdayNum(iGuideRepairOrderService.countStatisticsNum(null,ids,"2",null,null,null,null,null));
        return ResultData.success(timeWorkOrder);
    }
    @ApiOperation("部门数据首页统计不同状态工单数")
    @GetMapping("/department/getWorkOrder")
    public ResultData<WorkOrder> getDepartmentWorkOrder(@RequestParam("ids") List<String> ids)
    {
        if(ids==null || ids.size()<1)
        {
            return  ResultData.success();
        }
        WorkOrder workOrder=new WorkOrder();
        //状态(1待分配  2 待办结 3 已办结 4 待评价 5 已取消)
        workOrder.setAllNum(iGuideRepairOrderService.countStatisticsNum("",ids,null,null,null,null,null,null));
        workOrder.setWaitDistribution(iGuideRepairOrderService.countStatisticsNum("1",ids,null,null,null,null,null,null));
        workOrder.setWaitDealWith(iGuideRepairOrderService.countStatisticsNum("2",ids,null,null,null,null,null,null));
        workOrder.setHaveDealWith(iGuideRepairOrderService.countStatisticsNum("3",ids,null,null,null,null,null,null));
        workOrder.setRemainEvaluated(iGuideRepairOrderService.countStatisticsNum("4",ids,null,null,null,null,null,null));
        workOrder.setCanceled(iGuideRepairOrderService.countStatisticsNum("5",ids,null,null,null,null,null,null));
        // //服务状态(1.已解决 2.未解决)
        workOrder.setUnsolved(iGuideRepairOrderService.countStatisticsNum(null,ids,null,null,null,null,"2",null));
        workOrder.setResolved(iGuideRepairOrderService.countStatisticsNum(null,ids,null,null,null,null,"1",null));
        //是否超时 (1 未超时   2已超时) 超时未办结
        workOrder.setOvertime(iGuideRepairOrderService.countStatisticsNum(null,ids,null,"2",null,null,null,null));
//        超时未办结
        workOrder.setOvertimeWaitDealWith(iGuideRepairOrderService.countStatisticsNum("2",ids,null,"2",null,null,null,null));
        return ResultData.success(workOrder);
    }
    @ApiOperation("部门数据获取效率比值")
    @GetMapping("/department/getEfficiency")
    public ResultData<EfficiencyEntity> getDepartmentEfficiency(@RequestParam("ids") List<String> ids)
    {
        if(ids==null || ids.size()<1)
        {
            return  ResultData.success();
        }
        EfficiencyEntity entity=new EfficiencyEntity();
        //总工单数
        int allNum=iGuideRepairOrderService.countStatisticsNum("",ids,null,null,null,null,null,null);
        java.text.DecimalFormat weekDf=new java.text.DecimalFormat("##.##%");//传入格式模板
        int bj=iGuideRepairOrderService.countStatisticsNum("3",ids,null,null,null,null,null,null);
        if(bj!=0)
        {
            //        好评率=评价为满意的导办工单数量/已办结状态工单数量
            String goodReputationEfficiency=weekDf.format((float)(iGuideRepairOrderService.countStatisticsNum(null,ids,null,null,"1",null,null,null)
                    /(float)bj));
            entity.setGoodReputationEfficiency(goodReputationEfficiency);
            //      解决率=已解决状态的导办工单数量/已办结状态工单数量
            String resolveEfficiency=weekDf.format((float)(iGuideRepairOrderService.countStatisticsNum(null,ids,null,null,null,null,"1",null)
                    /(float)bj));
            entity.setResolveEfficiency(resolveEfficiency);
            if(allNum!=0)
            {
//              办结率=待评价+已办结状态的导办工单数量/总工单数量
                String workEfficiency=weekDf.format((float)((iGuideRepairOrderService.countStatisticsNum("4",ids,null,null,null,null,null,null)
                        +bj)/(float)allNum));
                entity.setWorkEfficiency(workEfficiency);
            }
        }
        int cs=iGuideRepairOrderService.countStatisticsNum(null,ids,null,"2",null,null,null,null);
        if(cs!=0)
        {
            //        超时办结率=超时状态下的待评价+已办结状态的导办工单数量/超时状态的导办工单数量
            String timeoutEfficiency=weekDf.format((float)((iGuideRepairOrderService.countStatisticsNum("4",ids,null,"2",null,null,null,null)
                    +iGuideRepairOrderService.countStatisticsNum("3",ids,null,null,null,null,null,null))
                    /(float)cs));
            entity.setTimeoutEfficiency(timeoutEfficiency);
        }
        if(allNum!=0)
        {
            //        回复率=最新进展里大于0条回复的导办工单数量/总工单数量
            //状态(1待分配  2 待办结 3 已办结 4 待评价 5 已取消 6未解决  7已解决  8 系统自动分配 9 回复   10转派    11手动分配)
            String num=(homeStatisticsService.reversionRate("9",null));
            if(!StringUtils.isEmpty(num))
            {
                String reversionRate=weekDf.format(Float.valueOf(num)/(float)allNum);
                entity.setReversionRate(reversionRate);
            }
        }
        return ResultData.success(entity);
    }
    @ApiOperation("部门数据 工单  办事指南饼状图数据")
    @GetMapping("/department/getPieChart")
    public ResultData<PieChartAll> getDepartmentPieChart(@RequestParam("ids") List<String> ids)
    {
        if(ids==null || ids.size()<1)
        {
            return  ResultData.success();
        }
        PieChartAll pieChartAll=new PieChartAll();
        pieChartAll.setWorkOrderNum(iGuideRepairOrderService.countStatisticsNum("",ids,null,null,null,null,null,null)+"");
        pieChartAll.setFingerpostNum(homeStatisticsService.countStatisticsNum(null,ids)+"");
        List<PieChart> workOrderList=new ArrayList<>();
        List<PieChart> fingerpostList=new ArrayList<>();
        List<ClassifyAdministration> oneIds=homeStatisticsService.getClassify(null,"1");
        for (ClassifyAdministration oneClassify:oneIds)
        {
            PieChart workOrder=new PieChart();
            PieChart fingerpost=new PieChart();
            workOrder.setName(oneClassify.getClassifyName());
            fingerpost.setName(oneClassify.getClassifyName());
            List<ClassifyAdministration> twoIds = homeStatisticsService.getClassify(oneClassify.getId()+"",null);
            List clasIds=new ArrayList();
            clasIds.add(oneClassify.getId());
            for (ClassifyAdministration classify:twoIds)
            {
                clasIds.add(classify.getId());
            }
            int workOrderNum=0;
            int fingerpostNum=0;
            if(clasIds.size()>0)
            {
                workOrderNum=iGuideRepairOrderService.countStatisticsNum(null,ids,null,null,null,clasIds,null,null);
                fingerpostNum=homeStatisticsService.countStatisticsNum(clasIds,ids);
            }
            workOrder.setNum(workOrderNum+"");
            fingerpost.setNum(fingerpostNum+"");
            workOrderList.add(workOrder);
            fingerpostList.add(fingerpost);
        }
        pieChartAll.setWorkOrderList(workOrderList);
        pieChartAll.setFingerpostList(fingerpostList);
        return ResultData.success(pieChartAll);
    }
    @ApiOperation("部门数据导办人员排行榜 type 1 安评价   2 按办结量 3 按超时 4按工单量  5 按未办结量")
    @GetMapping("/department/getGuidePlate")
    public TableDataInfo<GuidePlate> getDepartmentGuidePlate(@RequestParam("type") String type,@RequestParam("ids") List<String> ids)
    {
        if(ids==null || ids.size()<1)
        {
            return  getDataTable(new ArrayList<>());
        }
        int allNum=homeStatisticsService.staffNum(ids);
        if(StringUtils.equals("1",type))
        {
            //安评价
            return getDataTable(homeStatisticsService.score(ids),allNum);
        }
        else if(StringUtils.equals("2",type))
        {
            //2 按办结量
            return getDataTable(homeStatisticsService.guidePlatePeople(ids),allNum);
        }
        else if(StringUtils.equals("3",type))
        {
            //3 按超时
            return getDataTable(homeStatisticsService.timeout(ids),allNum);
        }
        else if(StringUtils.equals("4",type))
        {
            //按工单量
            return getDataTable(homeStatisticsService.workunit(ids),allNum);
        }
        else
        {
            //按未办结量
            return getDataTable(homeStatisticsService.tosettled(ids),allNum);
        }
    }
    @ApiOperation("部门数据办事指南排行榜 type 1 按浏览量   2 按办结量")
    @GetMapping("/department/getGuidance")
    public TableDataInfo<Guidance> getDepartmentGuidance(@RequestParam("type") String type,@RequestParam("ids") List<String> ids)
    {
        if(ids==null || ids.size()<1)
        {
            return  getDataTable(new ArrayList<>());
        }
        int allNum=homeStatisticsService.countWork(ids);
        if(StringUtils.equals("1",type))
        {
            return getDataTable(homeStatisticsService.guidanceBrowse(ids),allNum);
        }
        else
        {
            return getDataTable(homeStatisticsService.guidanceTransaction(ids),allNum);
        }
    }
    /***************************************************    部门数据统计 end   **********************************************************/
flower_city/src/main/java/com/dg/core/db/gen/mapper/HomeStatisticsMapper.java
@@ -15,31 +15,45 @@
     * 按办结量排序
     * @return
     */
    List<GuidePlate> guidePlatePeople();
    List<GuidePlate> guidePlatePeople(List<String> ids);
    /**
     *按评分排序
     * @return
     */
    List<GuidePlate> score();
    List<GuidePlate> score(List<String> ids);
    /**
     * 按超时
     * @return
     */
    List<GuidePlate> timeout();
    List<GuidePlate> timeout(List<String> ids);
    /**
     * 按未办结
     * @param ids
     * @return
     */
    List<GuidePlate> tosettled(List<String> ids);
    /**
     * 按工单量
     * @param ids
     * @return
     */
    List<GuidePlate> workunit(List<String> ids);
    /**
     * 导办人员统计数
     * @return
     */
    Integer staffNum();
    Integer staffNum(List<String> ids);
    /**
     * 办事指南数量统计
     * @return
     */
    Integer countWork();
    Integer countWork(List<String> ids);
    /**
     * 获取一级部门
@@ -63,18 +77,19 @@
     * 办事指南根据导办数量排序
     * @return
     */
    List<Guidance> guidanceTransaction();
    List<Guidance> guidanceTransaction(List<String> ids);
    /**
     * 办事指南根据浏览数量排序
     * @return
     */
    List<Guidance> guidanceBrowse();
    List<Guidance> guidanceBrowse(List<String> ids);
    /**
     * 获取统计数据  首页用  勿动
     */
    int countStatisticsNum(List<String> classifyIds);
    int countStatisticsNum(@Param("classifyIds") List<String> classifyIds,
                           @Param("ids") List<String> ids);
    /**
flower_city/src/main/java/com/dg/core/service/HomeStatisticsService.java
@@ -14,19 +14,33 @@
     * 按办结量排序
     * @return
     */
    List<GuidePlate> guidePlatePeople();
    List<GuidePlate> guidePlatePeople(List<String> ids);
    /**
     *按评分排序
     * @return
     */
    List<GuidePlate> score();
    List<GuidePlate> score(List<String> ids);
    /**
     * 按超时
     * @return
     */
    List<GuidePlate> timeout();
    List<GuidePlate> timeout(List<String> ids);
    /**
     * 按未办结
     * @param ids
     * @return
     */
    List<GuidePlate> tosettled(List<String> ids);
    /**
     * 按工单量
     * @param ids
     * @return
     */
    List<GuidePlate> workunit(List<String> ids);
    /**
     * 评分
@@ -49,30 +63,30 @@
     * 办事指南根据导办数量排序
     * @return
     */
    List<Guidance> guidanceTransaction();
    List<Guidance> guidanceTransaction(List<String> ids);
    /**
     * 办事指南根据浏览数量排序
     * @return
     */
    List<Guidance> guidanceBrowse();
    List<Guidance> guidanceBrowse(List<String> ids);
    /**
     * 导办人员统计数
     * @return
     */
    Integer staffNum();
    Integer staffNum(List<String> ids);
    /**
     * 办事指南数量统计
     * @return
     */
    Integer countWork();
    Integer countWork(List<String> ids);
    /**
     * 获取统计数据  首页用  勿动
     */
    int countStatisticsNum(List<String> classifyIds);
    int countStatisticsNum(List<String> classifyIds,List<String> ids);
    /**
@@ -81,8 +95,8 @@
     * @param classifyGrade
     * @return
     */
    public List<ClassifyAdministration> getClassify(@Param("parentId") String parentId,
                                                    @Param("classifyGrade") String classifyGrade);
    public List<ClassifyAdministration> getClassify(String parentId,
                                                    String classifyGrade);
    List<String> countId(String district);
flower_city/src/main/java/com/dg/core/service/impl/HomeStatisticsImpl.java
@@ -7,6 +7,7 @@
import com.dg.core.db.gen.entity.OrganizationEntity;
import com.dg.core.db.gen.mapper.HomeStatisticsMapper;
import com.dg.core.service.HomeStatisticsService;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -16,18 +17,28 @@
{
    @Override
    public List<GuidePlate> guidePlatePeople() {
        return baseMapper.guidePlatePeople();
    public List<GuidePlate> guidePlatePeople(List<String> ids) {
        return baseMapper.guidePlatePeople(ids);
    }
    @Override
    public List<GuidePlate> score() {
        return baseMapper.score();
    public List<GuidePlate> score(List<String> ids) {
        return baseMapper.score(ids);
    }
    @Override
    public List<GuidePlate> timeout() {
        return baseMapper.timeout();
    public List<GuidePlate> timeout(List<String> ids) {
        return baseMapper.timeout(ids);
    }
    @Override
    public List<GuidePlate> tosettled(List<String> ids) {
        return baseMapper.tosettled(ids);
    }
    @Override
    public List<GuidePlate> workunit(List<String> ids) {
        return baseMapper.workunit(ids);
    }
    @Override
@@ -46,30 +57,29 @@
    }
    @Override
    public List<Guidance> guidanceTransaction() {
        return baseMapper.guidanceTransaction();
    public List<Guidance> guidanceTransaction(List<String> ids) {
        return baseMapper.guidanceTransaction(ids);
    }
    @Override
    public List<Guidance> guidanceBrowse() {
        return baseMapper.guidanceBrowse();
    public List<Guidance> guidanceBrowse(List<String> ids) {
        return baseMapper.guidanceBrowse(ids);
    }
    @Override
    public Integer staffNum() {
        return baseMapper.staffNum();
    public Integer staffNum(List<String> ids) {
        return baseMapper.staffNum(ids);
    }
    @Override
    public Integer countWork() {
        return baseMapper.countWork();
    public Integer countWork(List<String> ids) {
        return baseMapper.countWork(ids);
    }
    @Override
    public int countStatisticsNum(List<String> classifyIds) {
        return baseMapper.countStatisticsNum(classifyIds);
    public int countStatisticsNum(List<String> classifyIds,List<String> ids) {
        return baseMapper.countStatisticsNum(classifyIds,ids);
    }
    @Override
    public List<ClassifyAdministration> getClassify(String parentId, String classifyGrade) {
        return baseMapper.getClassify(parentId,classifyGrade);
flower_city/src/main/resources/mapper/HomeStatisticsMapper.xml
@@ -8,7 +8,17 @@
            user_name as userName,
            (SELECT organization_name FROM automessage_organization_chart WHERE  automessage_organization_chart.id=department_id) as departmentNmae,
            (select count(id) from automessage_guide_repair_order WHERE automessage_guide_repair_order.guide_user_id=automessage_sys_user.user_id) as num
        FROM automessage_sys_user WHERE user_type=2 ORDER BY
        FROM automessage_sys_user
        <where>
            user_type=2
            <if test="ids != null">
                and department_id IN
                <foreach collection="ids" item="param"  open="(" close=")" separator=",">
                    #{param}
                </foreach>
            </if>
        </where>
        ORDER BY
            num DESC
        LIMIT 10
    </select>
@@ -19,7 +29,17 @@
            user_name,
            (SELECT organization_name FROM automessage_organization_chart WHERE  automessage_organization_chart.id=department_id) as departmentNmae,
            ((select sum(IF(evaluate_state='1',10,IF(evaluate_state='2',5,0))) from automessage_guide_repair_order WHERE automessage_guide_repair_order.guide_user_id=automessage_sys_user.user_id)/(select count(id) from automessage_guide_repair_order WHERE automessage_guide_repair_order.guide_user_id=automessage_sys_user.user_id)) as num
        FROM automessage_sys_user WHERE user_type=2 ORDER BY
        FROM automessage_sys_user
        <where>
            user_type=2
            <if test="ids != null">
                and department_id IN
                <foreach collection="ids" item="param"  open="(" close=")" separator=",">
                    #{param}
                </foreach>
            </if>
        </where>
        ORDER BY
            num DESC
        LIMIT 10
    </select>
@@ -31,8 +51,62 @@
            (SELECT organization_name FROM automessage_organization_chart WHERE  automessage_organization_chart.id=department_id) as departmentNmae,
            (select count(id) from automessage_guide_repair_order WHERE automessage_guide_repair_order.guide_user_id=automessage_sys_user.user_id and automessage_guide_repair_order.is_timeout=2
            ) as num
        FROM automessage_sys_user WHERE user_type=2 ORDER BY
        FROM automessage_sys_user
        <where>
            user_type=2
            <if test="ids != null">
                and department_id IN
                <foreach collection="ids" item="param"  open="(" close=")" separator=",">
                    #{param}
                </foreach>
            </if>
        </where>
        ORDER BY
            num DESC
        LIMIT 10
    </select>
    <!--  按未办结  -->
    <select id="tosettled" resultType="com.dg.core.db.gen.entity.GuidePlate">
        SELECT
        user_name as userName,
        (SELECT organization_name FROM automessage_organization_chart WHERE  automessage_organization_chart.id=department_id) as departmentNmae,
        (select count(id) from automessage_guide_repair_order WHERE automessage_guide_repair_order.guide_user_id=automessage_sys_user.user_id and automessage_guide_repair_order.state=2
        ) as num
        FROM automessage_sys_user
        <where>
            user_type=2
            <if test="ids != null">
                and department_id IN
                <foreach collection="ids" item="param"  open="(" close=")" separator=",">
                    #{param}
                </foreach>
            </if>
        </where>
        ORDER BY
        num DESC
        LIMIT 10
    </select>
    <!--  按未办结  -->
    <select id="workunit" resultType="com.dg.core.db.gen.entity.GuidePlate">
        SELECT
        user_name as userName,
        (SELECT organization_name FROM automessage_organization_chart WHERE  automessage_organization_chart.id=department_id) as departmentNmae,
        (select count(id) from automessage_guide_repair_order WHERE automessage_guide_repair_order.guide_user_id=automessage_sys_user.user_id) as num
        FROM automessage_sys_user
        <where>
            user_type=2
            <if test="ids != null">
                and department_id IN
                <foreach collection="ids" item="param"  open="(" close=")" separator=",">
                    #{param}
                </foreach>
            </if>
        </where>
        ORDER BY
        num DESC
        LIMIT 10
    </select>
@@ -40,7 +114,16 @@
    <!--  导办人员统计数  -->
    <select id="staffNum" resultType="int">
        SELECT count(id)
        FROM automessage_sys_user WHERE user_type=2
        FROM automessage_sys_user
        <where>
            user_type=2
            <if test="ids != null">
                and department_id IN
                <foreach collection="ids" item="param"  open="(" close=")" separator=",">
                    #{param}
                </foreach>
            </if>
        </where>
    </select>
<!--  获取一级组织  -->
@@ -76,16 +159,32 @@
    <!--  办事指南 根据导办数量排序 -->
    <select id="guidanceTransaction" resultType="com.dg.core.db.gen.entity.Guidance">
        SELECT matter_name as name ,transaction_num as num from
        automessage_transaction_event ORDER BY
            num DESC
        automessage_transaction_event
        <where>
            <if test="ids != null">
                and department_id IN
                <foreach collection="ids" item="param"  open="(" close=")" separator=",">
                    #{param}
                </foreach>
            </if>
        </where>
        ORDER BY num DESC
        LIMIT 10
    </select>
    <!-- 办事指南 根据导办数量排序 -->
    <select id="guidanceBrowse"  resultType="com.dg.core.db.gen.entity.Guidance">
        SELECT matter_name as name ,browse_num as num from
            automessage_transaction_event ORDER BY
            num DESC
            automessage_transaction_event
        <where>
            <if test="ids != null">
                and department_id IN
                <foreach collection="ids" item="param"  open="(" close=")" separator=",">
                    #{param}
                </foreach>
            </if>
        </where>
        ORDER BY num DESC
            LIMIT 10
    </select>
@@ -93,6 +192,14 @@
    <!-- 办事指南 统计数量 -->
    <select id="countWork"  resultType="int">
        SELECT count(id) from automessage_transaction_event
        <where>
            <if test="ids != null">
                and department_id IN
                <foreach collection="ids" item="param"  open="(" close=")" separator=",">
                    #{param}
                </foreach>
            </if>
        </where>
    </select>
@@ -107,6 +214,12 @@
                    #{param}
                </foreach>
            </if>
            <if test="ids != null">
                and department_id IN
                <foreach collection="ids" item="param"  open="(" close=")" separator=",">
                    #{param}
                </foreach>
            </if>
        </where>
    </select>