新增首页工单 办事指南排行榜接口   导办人员排行榜接口  组织排行榜接口  新增办事指南统计接口   导办人员统计接口  组织胖行榜统计接口
5个文件已修改
7个文件已添加
526 ■■■■■ 已修改文件
flower_city/src/main/java/com/dg/core/controller/HomeStatisticsController.java 134 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/controller/UserController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/db/gen/entity/Guidance.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/db/gen/entity/GuidePlate.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/db/gen/entity/OrganizationEntity.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/db/gen/mapper/HomeStatisticsMapper.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/service/HomeStatisticsService.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/service/impl/HomeStatisticsImpl.java 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/service/impl/OrganizationChartImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/resources/mapper/GuideRepairOrderMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/resources/mapper/HomeStatisticsMapper.xml 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/resources/mapper/SysUserMapper.xml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/controller/HomeStatisticsController.java
@@ -2,10 +2,8 @@
import com.dg.core.ResultData;
import com.dg.core.db.gen.entity.*;
import com.dg.core.service.IClassifyAdministrationService;
import com.dg.core.service.IGuideEvolveService;
import com.dg.core.service.IGuideRepairOrderService;
import com.dg.core.service.ITransactionEventService;
import com.dg.core.service.*;
import com.dg.core.util.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
@@ -15,14 +13,12 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.*;
@Api(tags = {"首页统计接口"})
@RestController
@RequestMapping("/Home")
public class HomeStatisticsController
public class HomeStatisticsController extends BaseController
{
    //导办工单接口
    @Autowired
@@ -38,6 +34,18 @@
    @Autowired
    ITransactionEventService iTransactionEventService;
    @Autowired
    HomeStatisticsService homeStatisticsService;
    @Autowired
    com.dg.core.service.ISysUserService IUserService;
    @Autowired
    IOrganizationChartService iOrganizationChartService;
    @ApiOperation("首页统计不同状态工单数")
    @GetMapping("/getWorkOrder")
@@ -203,15 +211,119 @@
    }
    @ApiOperation("组织排行榜")
    @ApiOperation("组织排行榜  type 1 安评价   2 按办结量")
    @GetMapping("/getOrganization")
    public ResultData getOrganization()
    public TableDataInfo getOrganization(@RequestParam("type") String type)
    {
        List<OrganizationEntity> guidePlates=homeStatisticsService.getDepartment();
        if(StringUtils.equals("1",type))
        {
            for (OrganizationEntity bean:guidePlates)
            {
                bean.setNum(0+"");
                List<String> ids=iOrganizationChartService.getIds(bean.getId()+"");
        return ResultData.success();
                //总评分
                String scoreNum=homeStatisticsService.organizationScore(ids)+"";
                int score=0;
                if(!StringUtils.isEmpty(scoreNum) &&  !StringUtils.equals("null",scoreNum))
                {
                    score=Integer.valueOf(scoreNum);
                }
                //总数量
                int allNum=homeStatisticsService.organizationNum(ids);
                if(allNum>0 && score>0)
                {
                    java.text.DecimalFormat weekDf=new java.text.DecimalFormat("##.##");//传入格式模板
                    String workEfficiency=weekDf.format((float)(score/allNum));
                    bean.setNum(workEfficiency);
                }
            }
        }
        else
        {
            for (OrganizationEntity bean:guidePlates)
            {
                bean.setNum(0+"");
                List<String> ids=iOrganizationChartService.getIds(bean.getId()+"");
                //总数量
                int allNum=homeStatisticsService.organizationNum(ids);
                if(allNum>0)
                {
                    bean.setNum(allNum+"");
                }
            }
        }
        OrganizationEntity entity=null;
        for(int i = 0 ;i< guidePlates.size() -1; i++) {
            for (int j = 0; j < guidePlates.size() - 1 - i; j++) {
                if(Float.valueOf(guidePlates.get(j).getNum())>Float.valueOf(guidePlates.get(j+1).getNum()))
                {
                    entity=guidePlates.get(j);
                    guidePlates.set(j,guidePlates.get(j+1));
                    guidePlates.set(j+1,entity);
                }
            }
        }
        Collections.reverse(guidePlates);
        return getDataTable(guidePlates,guidePlates.size());
    }
    @ApiOperation("导办人员排行榜 type 1 安评价   2 按办结量 3 按超时")
    @GetMapping("/getGuidePlate")
    public TableDataInfo getGuidePlate(@RequestParam("type") String type)
    {
        int allNum=homeStatisticsService.staffNum();
        if(StringUtils.equals("1",type))
        {
            //安评价
            return getDataTable(homeStatisticsService.score(),allNum);
        }
        else if(StringUtils.equals("2",type))
        {
            //2 按办结量
            return getDataTable(homeStatisticsService.guidePlatePeople(),allNum);
        }
        else
        {
            //3 按超时
            return getDataTable(homeStatisticsService.timeout(),allNum);
        }
    }
    @ApiOperation("办事指南排行榜 type 1 按浏览量   2 按办结量")
    @GetMapping("/getGuidance")
    public TableDataInfo getGuidance(@RequestParam("type") String type)
    {
        int allNum=homeStatisticsService.countWork();
        if(StringUtils.equals("1",type))
        {
            return getDataTable(homeStatisticsService.guidanceBrowse(),allNum);
        }
        else
        {
            return getDataTable(homeStatisticsService.guidanceTransaction(),allNum);
        }
    }
}
flower_city/src/main/java/com/dg/core/controller/UserController.java
@@ -212,7 +212,7 @@
            return error("该账户已存在!");
        }
        config.setUserType("1");
        config.setUserType("3");
        config.setCreateTime(LocalDateTime.now());
        config.setUpdateTime(LocalDateTime.now());
@@ -241,7 +241,7 @@
            return error("账户不能为空");
        }
        config.setUserType("1");
        config.setUserType("3");
        return toAjax(IUserService.updateConfig(config));
    }
flower_city/src/main/java/com/dg/core/db/gen/entity/Guidance.java
New file
@@ -0,0 +1,19 @@
package com.dg.core.db.gen.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@ApiModel("办事指南表")
@Data
public class Guidance implements Serializable
{
    @ApiModelProperty(name = "name", value = "名称")
    private String name;
    @ApiModelProperty(name = "num", value = "内容")
    private String num;
}
flower_city/src/main/java/com/dg/core/db/gen/entity/GuidePlate.java
New file
@@ -0,0 +1,24 @@
package com.dg.core.db.gen.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@ApiModel("导办工单进展记录表")
@Data
public class GuidePlate implements Serializable
{
    @ApiModelProperty(name = "userName", value = "用户名")
    private String userName;
    @ApiModelProperty(name = "departmentNmae", value = "部门")
    private String departmentNmae;
    @ApiModelProperty(name = "num", value = "内容")
    private String num;
}
flower_city/src/main/java/com/dg/core/db/gen/entity/OrganizationEntity.java
New file
@@ -0,0 +1,27 @@
package com.dg.core.db.gen.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@ApiModel("组织排行榜")
@Data
public class OrganizationEntity implements Serializable {
    @ApiModelProperty("id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    @ApiModelProperty(name = "departmentNmae", value = "部门")
    private String departmentNmae;
    @TableField(exist = false)
    @ApiModelProperty(name = "num", value = "内容")
    private String num="0";
}
flower_city/src/main/java/com/dg/core/db/gen/mapper/HomeStatisticsMapper.java
New file
@@ -0,0 +1,71 @@
package com.dg.core.db.gen.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dg.core.db.gen.entity.Guidance;
import com.dg.core.db.gen.entity.GuidePlate;
import com.dg.core.db.gen.entity.OrganizationEntity;
import java.util.List;
public interface HomeStatisticsMapper  extends BaseMapper<GuidePlate>
{
    /**
     * 按办结量排序
     * @return
     */
    List<GuidePlate> guidePlatePeople();
    /**
     *按评分排序
     * @return
     */
    List<GuidePlate> score();
    /**
     * 按超时
     * @return
     */
    List<GuidePlate> timeout();
    /**
     * 导办人员统计数
     * @return
     */
    Integer staffNum();
    /**
     * 办事指南数量统计
     * @return
     */
    Integer countWork();
    /**
     * 获取一级部门
     * @return
     */
    List<OrganizationEntity> getDepartment();
    /**
     * 评分
     * @return
     */
    Integer organizationScore(List<String> ids);
    /**
     * 办结量
     * @return
     */
    Integer organizationNum(List<String> ids);
    /**
     * 办事指南根据导办数量排序
     * @return
     */
    List<Guidance> guidanceTransaction();
    /**
     * 办事指南根据浏览数量排序
     * @return
     */
    List<Guidance> guidanceBrowse();
}
flower_city/src/main/java/com/dg/core/service/HomeStatisticsService.java
New file
@@ -0,0 +1,69 @@
package com.dg.core.service;
import com.dg.core.db.gen.entity.Guidance;
import com.dg.core.db.gen.entity.GuidePlate;
import com.dg.core.db.gen.entity.OrganizationEntity;
import java.util.List;
public interface HomeStatisticsService
{
    /**
     * 按办结量排序
     * @return
     */
    List<GuidePlate> guidePlatePeople();
    /**
     *按评分排序
     * @return
     */
    List<GuidePlate> score();
    /**
     * 按超时
     * @return
     */
    List<GuidePlate> timeout();
    /**
     * 评分
     * @return
     */
    Integer organizationScore(List<String> ids);
    /**
     * 办结量
     * @return
     */
    Integer organizationNum(List<String> ids);
    /**
     * 获取一级部门
     * @return
     */
    List<OrganizationEntity> getDepartment();
    /**
     * 办事指南根据导办数量排序
     * @return
     */
    List<Guidance> guidanceTransaction();
    /**
     * 办事指南根据浏览数量排序
     * @return
     */
    List<Guidance> guidanceBrowse();
    /**
     * 导办人员统计数
     * @return
     */
    Integer staffNum();
    /**
     * 办事指南数量统计
     * @return
     */
    Integer countWork();
}
flower_city/src/main/java/com/dg/core/service/impl/HomeStatisticsImpl.java
New file
@@ -0,0 +1,67 @@
package com.dg.core.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dg.core.db.gen.entity.Guidance;
import com.dg.core.db.gen.entity.GuidePlate;
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.stereotype.Service;
import java.util.List;
@Service
public class HomeStatisticsImpl extends ServiceImpl<HomeStatisticsMapper, GuidePlate>
        implements HomeStatisticsService
{
    @Override
    public List<GuidePlate> guidePlatePeople() {
        return baseMapper.guidePlatePeople();
    }
    @Override
    public List<GuidePlate> score() {
        return baseMapper.score();
    }
    @Override
    public List<GuidePlate> timeout() {
        return baseMapper.timeout();
    }
    @Override
    public Integer organizationScore(List<String> ids) {
        return baseMapper.organizationScore(ids);
    }
    @Override
    public Integer organizationNum(List<String> ids) {
        return baseMapper.organizationNum(ids);
    }
    @Override
    public List<OrganizationEntity> getDepartment() {
        return baseMapper.getDepartment();
    }
    @Override
    public List<Guidance> guidanceTransaction() {
        return baseMapper.guidanceTransaction();
    }
    @Override
    public List<Guidance> guidanceBrowse() {
        return baseMapper.guidanceBrowse();
    }
    @Override
    public Integer staffNum() {
        return baseMapper.staffNum();
    }
    @Override
    public Integer countWork() {
        return baseMapper.countWork();
    }
}
flower_city/src/main/java/com/dg/core/service/impl/OrganizationChartImpl.java
@@ -134,7 +134,6 @@
        {
            if(sysStreet!=null&&sysStreet.getId()!=null)
            {
                ids.add(sysStreet.getId()+"");
                if(sysStreet.getChild()!=null && sysStreet.getChild().size()>0)
                {
                    ids.addAll(disposestreetId(sysStreet.getChild()));
flower_city/src/main/resources/mapper/GuideRepairOrderMapper.xml
@@ -187,7 +187,7 @@
            </if>
        </where>
    </select>
    <!--  首页统计  勿动  -->
    <select id="countListNum"  resultType="com.dg.core.db.gen.entity.CountListNum">
        select create_time,count(id) as num from automessage_guide_repair_order
        <where>
flower_city/src/main/resources/mapper/HomeStatisticsMapper.xml
New file
@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dg.core.db.gen.mapper.HomeStatisticsMapper">
    <!-- 按办结量排序 -->
    <select id="guidePlatePeople" 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 ORDER BY
            num DESC
        LIMIT 10
    </select>
    <!--  按评分排序  -->
    <select id="score" resultType="com.dg.core.db.gen.entity.GuidePlate">
        SELECT
            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
            num DESC
        LIMIT 10
    </select>
    <!--  按超时  -->
    <select id="timeout" 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.is_timeout=2
            ) as num
        FROM automessage_sys_user WHERE user_type=2 ORDER BY
            num DESC
        LIMIT 10
    </select>
    <!--  导办人员统计数  -->
    <select id="staffNum" resultType="integer">
        SELECT count(id)
        FROM automessage_sys_user WHERE user_type=2
    </select>
<!--  获取一级组织  -->
    <select id="getDepartment" resultType="com.dg.core.db.gen.entity.OrganizationEntity">
        SELECT
            organization_name as departmentNmae,
            id
        FROM automessage_organization_chart
        WHERE grade=1
    </select>
    <!--  组织排行榜 按评价  -->
    <select id="organizationScore" resultType="integer">
        SELECT  sum(IF(evaluate_state='1',10,IF(evaluate_state='2',5,0)))
        FROM automessage_guide_repair_order
        WHERE department_id in
        <foreach collection="ids" item="param"  open="(" close=")" separator=",">
            #{param}
        </foreach>
    </select>
    <!--  组织排行榜 按办结量  -->
    <select id="organizationNum" resultType="integer">
        SELECT  count(id) FROM automessage_guide_repair_order WHERE department_id in
        <foreach collection="ids" item="param"  open="(" close=")" separator=",">
            #{param}
        </foreach>
    </select>
    <!--  办事指南 根据导办数量排序 -->
    <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
        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
            LIMIT 10
    </select>
    <!-- 办事指南 统计数量 -->
    <select id="countWork"  resultType="integer">
        SELECT count(id) from automessage_transaction_event
    </select>
</mapper>
flower_city/src/main/resources/mapper/SysUserMapper.xml
@@ -252,7 +252,4 @@
        delete from automessage_sys_user where user_id= #{id}
    </delete>
</mapper>