Prechádzať zdrojové kódy

bug:个人数据统计饼图,及职务

温红权 8 rokov pred
rodič
commit
240d03e05f

+ 203 - 34
VisualInspection/js/statistics/personal_data_statistics.js

@@ -8,6 +8,10 @@ var score_statistics;
 var check_type;
 var cur_status;
 var hide = false;
+
+var array_points = new Array();
+var array_points2 = new Array();
+
 // 默认初始化日期一个月
 $(".div-start input").val(new Date().getFullYear() + "-" + (new Date().getMonth() > 10 ? new Date().getMonth() : "0" + new Date().getMonth()) + "-26");
 $(".div-end input").val(new Date().getFullYear() + "-" + (new Date().getMonth() + 1 > 10 ? new Date().getMonth() + 1 : "0" + (new Date().getMonth() + 1)) + "-25");
@@ -39,8 +43,8 @@ $(function() {
     function queryAppeal(start_date, end_date, user_id) {
 
         $("#station_name").html($("#select-dept").find("option:selected").text())
-        $("#station_user_name").html($("#select-personal").find("option:selected").text())
 
+        $("#station_user_name").html("-")
 
         //请求数据
         var data_t = {
@@ -57,6 +61,14 @@ $(function() {
             $("#l_dept_ranking").html("-");
             $("#l_com_ranking").html("-");
             $("#l_score_ranking").html("-");
+            if (typeof(res.user) != undefined && res.user != null) {
+                $("#station_user_name").html(res.user.position_name)
+            }
+
+
+
+
+
 
             var isshow_c = false;
             var isshow_l = false;
@@ -239,14 +251,48 @@ $(function() {
                 array_year_score.length = 0;
             }
         } else if (type == 2) {
-            array_check_type.length = 0;
+            array_points = new Array();
+            array_points2 = new Array();
+            var map = new HashMap();
+
             if (data.length != 0) {
                 for (var i = 0; i < data.length; i++) {
-                    array_check_type.push({ "value": data[i].all_check_score, "name": data[i].name });
+                    if (typeof(data[i].all_check_score) == "undefined" || data[i].all_check_score == null) continue;
+                    if (map.get(data[i].name) == null) {
+                        map.set(data[i].name, data[i].all_check_score);
+                    } else {
+                        map.set(data[i].name, map.get(data[i].name) + data[i].all_check_score);
+                    }
+                    array_points2.push({ "value": (data[i].all_check_score), "name": data[i].checked_name + ($("#select-personal").val() == data[i].user_id ? "" : "(组员)") + " " + data[i].name, "itemStyle": { "normal": { "color": getchildColor(data[i].name, i).hexStr() } } });
                 }
-            } else {
-                array_check_type.length = 0;
             }
+            map.forEach(function(value, key) {
+                array_points.push({ "value": value, "name": key, "itemStyle": { "normal": { "color": getColor(key).hexStr() } } });
+            });
+
+
+
+
+
+
+
+
+
+            // array_points.push({ "value": (data.total0), "name": '满分', "itemStyle": { "normal": { "color": '#48CCCD' } } });
+            // array_points.push({ "value": data.total15, "name": '0-15分', "itemStyle": { "normal": { "color": '#38ACEC' } } });
+            // array_points.push({ "value": data.total50, "name": '15-50分', "itemStyle": { "normal": { "color": '#FFD801' } } });
+            // array_points.push({ "value": data.totalOver50, "name": '50分以上', "itemStyle": { "normal": { "color": '#7F38EC' } } });
+
+
+            // array_points2.push({ "value": temp[0], "name": '连云港道管', "itemStyle": { "normal": { "color": '#7BCCB5' } } });
+            // array_check_type.length = 0;
+            // if (data.length != 0) {
+            //     for (var i = 0; i < data.length; i++) {
+            //         array_check_type.push({ "value": data[i].all_check_score, "name": data[i].name });
+            //     }
+            // } else {
+            //     array_check_type.length = 0;
+            // }
         }
     }
 
@@ -439,10 +485,67 @@ $(function() {
      * 图二
      */
     function personal_check_type() {
+        // option = {
+        //     tooltip: {
+        //         trigger: 'item',
+        //         formatter: "个人服务检查问题占比 <br/>{b} : {c}分 ({d}%)"
+        //     },
+        //     noDataLoadingOption: {
+        //         text: '暂无数据',
+        //         effect: 'bubble',
+        //         effectOption: {
+        //             effect: {
+        //                 n: 0 //气泡个数为0
+        //             }
+        //         },
+        //         textStyle: {
+        //             fontSize: 20,
+        //             fontFamily: 'cursive',
+        //             fontWeight: 'bold'
+        //         }
+        //     },
+        //     toolbox: {
+        //         show: true,
+        //         feature: {
+
+        //             magicType: {
+
+        //                 type: ['pie', 'funnel'],
+        //                 option: {
+        //                     funnel: {
+        //                         x: '25%',
+        //                         width: '50%',
+        //                         funnelAlign: 'left',
+        //                         max: 1548
+        //                     }
+        //                 }
+        //             },
+        //         }
+        //     },
+        //     calculable: true,
+        //     series: [{
+        //         name: '访问来源',
+        //         type: 'pie',
+        //         radius: '55%',
+        //         center: ['50%', '50%'],
+        //         data: array_check_type,
+        //         itemStyle: {
+        //             normal: {
+        //                 label: {
+        //                     show: true,
+        //                     formatter: '{b} :\n{c}分 ({d}%)'
+        //                 },
+        //                 labelLine: { show: true }
+        //             }
+        //         }
+        //     }]
+        // };
+
+
         option = {
             tooltip: {
                 trigger: 'item',
-                formatter: "个人服务检查问题占比 <br/>{b} : {c}分 ({d}%)"
+                formatter: "个人温馨服务检查问题类别占比 <br/>{b} : {c}分 ({d}%)"
             },
             noDataLoadingOption: {
                 text: '暂无数据',
@@ -460,40 +563,69 @@ $(function() {
             },
             toolbox: {
                 show: true,
-                feature: {
-
-                    magicType: {
+            },
+            calculable: false,
+            series: [{
+                    name: '访问来源',
+                    type: 'pie',
+                    selectedMode: 'single',
+                    radius: [0, 80],
+
+                    // for funnel
+                    x: '20%',
+                    width: '40%',
+                    funnelAlign: 'right',
+                    max: 1548,
+
+                    itemStyle: {
+                        normal: {
+                            label: {
+                                show: true,
+                                formatter: '{b}:\n{c}分({d}%)',
+                                textStyle: {
+                                    alias: 'center',
+                                    fontSize: 10,
+                                    color: '#888'
+                                }
+                            },
+                            labelLine: {
+                                show: true,
+                                length: 80,
+                                lineStyle: {
+                                    color: '#888'
+                                }
 
-                        type: ['pie', 'funnel'],
-                        option: {
-                            funnel: {
-                                x: '25%',
-                                width: '50%',
-                                funnelAlign: 'left',
-                                max: 1548
                             }
                         }
                     },
+                    data: array_points
+                },
+                {
+                    name: '访问来源',
+                    type: 'pie',
+                    radius: [100, 125],
+
+                    // for funnel
+                    x: '60%',
+                    width: '35%',
+                    funnelAlign: 'left',
+                    max: 1048,
+                    itemStyle: {
+                        normal: {
+                            label: {
+                                show: false,
+                                formatter: '{b}:{c}人({d}%)'
+                            },
+                            labelLine: {
+                                show: false
+                            }
+                        }
+                    },
+                    data: array_points2
                 }
-            },
-            calculable: true,
-            series: [{
-                name: '访问来源',
-                type: 'pie',
-                radius: '55%',
-                center: ['50%', '50%'],
-                data: array_check_type,
-                itemStyle: {
-                    normal: {
-                        label: {
-                            show: true,
-                            formatter: '{b} :\n{c}分 ({d}%)'
-                        },
-                        labelLine: { show: true }
-                    }
-                }
-            }]
+            ]
         };
+
         return option;
     }
 
@@ -507,4 +639,41 @@ function setVisit() {
     if (hasRole("ROLE_STATION")) {
         $("#select-personal").attr("disabled", "disabled");
     }
+}
+
+function getColor(name) {
+
+
+
+    var color = new $.zui.Color('#52D017');
+    switch (name) {
+        case "环境卫生":
+            { color = new $.zui.Color('#52D017'); break; }
+        case "仪容仪表着装":
+            { color = new $.zui.Color('#00FFFF'); break; }
+        case "动作":
+            { color = new $.zui.Color('#7F38EC'); break; }
+        case "表情":
+            { color = new $.zui.Color('#FFA500'); break; }
+        case "文明用语":
+            { color = new $.zui.Color('#0000A0'); break; }
+        case "环境卫生":
+            { color = new $.zui.Color('#52D017'); break; }
+        case "工作纪律及行为举止":
+            { color = new $.zui.Color('#48CCCD'); break; }
+        case "便民服务":
+            { color = new $.zui.Color('#FFFF00'); break; }
+        case "安全管理":
+            { color = new $.zui.Color('#00FF00'); break; }
+    }
+    return color;
+}
+
+function getchildColor(name, p) {
+    var color1 = getColor(name);
+
+
+    var color = new $.zui.Color(color1.r - p * 20, color1.g - p * 20, color1.b - p * 20);
+
+    return color;
 }

+ 7 - 4
VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/cluster/UserInfoMapper.xml

@@ -15,6 +15,7 @@
         <result column="workno" property="workno" jdbcType="VARCHAR" />
         <result column="fee_station_name" property="fee_station_name" jdbcType="VARCHAR" />
         <result column="delete_time" property="delete_time" jdbcType="DATE" />
+        <result column="position_name" property="position_name" jdbcType="VARCHAR" />
     </resultMap>
     <resultMap id="userMap" type="com.xintong.visualinspection.bean.User">
         <id property="id" column="ID"/>
@@ -28,6 +29,7 @@
         <result property="pic" column="pic" jdbcType="VARCHAR"/>
         <result column="workno" property="workno" jdbcType="VARCHAR" />
         <result column="delete_time" property="delete_time" jdbcType="DATE" />
+        <result column="position_name" property="position_name" jdbcType="VARCHAR" />
         <collection property="roles" ofType="com.xintong.visualinspection.bean.Role">
             <result column="name" property="name"/>
         </collection>
@@ -48,13 +50,14 @@
         <result column="fee_station_name" property="fee_station_name" jdbcType="VARCHAR" />
         <result column="delete_time" property="delete_time" jdbcType="DATE" />
         <result column="invalidtime" property="invalidtime" jdbcType="VARCHAR" />
+        <result column="position_name" property="position_name" jdbcType="VARCHAR" />
     </resultMap>
 
 
     <select id="getAll" resultMap="BaseResultMap"  >
         SELECT
-        *
-        FROM t_sys_users
+        a.*,(select NAME from  sys_job where id = a.POSITIONID ) as position_name
+        FROM t_sys_users a
     </select>
 
     <select id="getOne" parameterType="java.lang.Integer" resultMap="BaseResultMap" >
@@ -66,7 +69,7 @@
 
 	<select id="getOneDetail" parameterType="java.lang.Integer" resultMap="BaseResultMap" >
         SELECT
-        t.* ,  fs.name AS fee_station_name
+        t.* ,  fs.name AS fee_station_name,(select NAME from  sys_job where id = t.POSITIONID ) as position_name
         FROM t_sys_users t
         LEFT JOIN t_br_layer_fee_station fs ON t.organid = fs.organ_id
         WHERE t.id = #{id} 
@@ -111,7 +114,7 @@
 
 
     <select id="findByUserName" parameterType="String" resultMap="userMap">
-        select u.*,o.parentid as road_manager_id
+        select u.*,o.parentid as road_manager_id,(select NAME from  sys_job where id = u.POSITIONID ) as position_name
         from t_sys_users u left join t_sys_organ o on u.organid=o.id
         where username= #{username} and u.status >0
     </select>

+ 28 - 18
VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/master/StatisticsMapper.xml

@@ -460,24 +460,34 @@
      </select>
      
      <select id="selectOneCheckedItemInfo" parameterType="com.xintong.visualinspection.bean.StatisticsBean" resultType="com.xintong.visualinspection.bean.StatisticsBean">
-     	SELECT count(DISTINCT m.task_id) AS checked_num , sum(m.check_item_score) AS all_check_score , m.parent_id,m.check_item_name AS name FROM check_task t INNER JOIN
-		(
-			select ci.name AS check_item_name , t.* FROM
-			(  SELECT ci.parent_id, t.* from check_score t LEFT JOIN check_item  ci ON t.check_item_id = ci.id
-				WHERE 1=1
-				AND checked_person = #{user_id}
-			 ) t 
-			LEFT JOIN check_item ci ON t.parent_id = ci.id
-			) m ON t.id = m.task_id
-			where t.check_status !=22 and t.id not in <include refid="taskexclouddeleteUser"/>
-			<if test="start_date !=null">
-				AND  t.start_time >= #{start_date}
-			</if>
-			<if test="end_date !=null">
-				AND t.end_time &lt; #{end_date}
-			</if>
-		GROUP BY m.parent_id
-     
+
+         select a.*,(select truename from t_sys_users where id = a.user_id LIMIT 1 ) as checked_name from (
+
+         SELECT
+         count(DISTINCT t.id) AS checked_num ,
+         sum(cs.check_item_score) AS all_check_score ,
+         (select parent_id from check_item where check_item.id = cs.check_item_id LIMIT 1) as parent_id,
+         ( select name from check_item where id = (select parent_id from check_item where check_item.id = cs.check_item_id LIMIT 1)) AS NAME,
+         t.checked_person as user_id
+         FROM
+         check_task t
+
+         left join  check_score cs on (cs.task_id = t.id )
+
+         WHERE
+         t.check_status != 22 and t.id not in <include refid="taskexclouddeleteUser"/> and (t.checked_person = #{user_id} or t.monitor_user_id = #{user_id})
+         <if test="start_date !=null">
+             AND  t.start_time >= #{start_date}
+         </if>
+         <if test="end_date !=null">
+             AND t.end_time &lt; #{end_date}
+         </if>
+
+         GROUP BY
+         parent_id,user_id
+
+         ) a where a.all_check_score is not null
+
      </select>
      
      <select id="selectOneCheckedDetailInfo" parameterType="com.xintong.visualinspection.bean.StatisticsBean" resultType="com.xintong.visualinspection.bean.StatisticsBean">

+ 2 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/pojo/UserRankingData.java

@@ -1,6 +1,7 @@
 package com.xintong.visualinspection.pojo;
 
 import com.xintong.visualinspection.bean.StatisticsBo;
+import com.xintong.visualinspection.bean.User;
 import lombok.Data;
 
 /**
@@ -11,4 +12,5 @@ import lombok.Data;
 public class UserRankingData {
     private StatisticsBo lastP;
     private StatisticsBo currentP;
+    private User user;
 }

+ 2 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/StatisticsServiceImpl.java

@@ -97,6 +97,8 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
                 break;
             }
         }
+
+        data.setUser(CacheUtil.getUserFromMap(obj.getUser_id()));
 	    return data;
     }