Beispiel #1
0
 public function handle_request_internal()
 {
     $req = APF::get_instance()->get_request();
     //$res    = APF::get_instance()->get_response();
     $params = $req->get_parameters();
     $pro = $params['pro'] ? $params['pro'] : 'all';
     $user_id = $req->get_user_id();
     $departments = Bll_DdCommonBiz::get_instance()->get_departments_for_user_group();
     $groups = Bll_UserGroupCustomBiz::get_instance()->get_all_groups();
     $input_arr = array('type_key' => 'page', 'type_value' => $pro);
     $page_bind_groups = Bll_ReportGroupSelectedBiz::get_instance()->get_group_ids_arr($input_arr);
     foreach ($departments as $value) {
         if (intval($value->value) < 17 || intval($value->value) > 26) {
             $department[$value->value] = $value->name;
         }
     }
     foreach ($groups as $value) {
         $group[$value->department][] = array('name' => $value->group_name, 'id' => $value->id);
     }
     $tab_info = array('all' => array('name' => 'ALL', 'click' => false), 'mobile' => array('name' => 'Mobile', 'click' => false), 'pc' => array('name' => 'Pc', 'click' => false));
     $tab_info[$pro]['click'] = true;
     $req->set_attribute('tab_info', $tab_info);
     $req->set_attribute('department', $department);
     if ($group != null) {
         $req->set_attribute('group', $group);
     }
     $req->set_attribute('user_id', $user_id);
     if (!empty($page_bind_groups) || strlen($page_bind_groups[0]) > 0) {
         $req->set_attribute('page_bind_groups', $page_bind_groups);
     }
     $req->set_attribute('department_id', $department_id);
     return 'NewReport_UserOnlineBug';
 }
 public static function &get_instance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 private function update_group_selected_by_groups_id($group_id, $group_selected_id)
 {
     $data = Bll_ReportGroupSelectedBiz::get_instance()->get_group_selected_by_id($group_selected_id);
     if ($data) {
         $groups_ids = explode(',', $data->group_ids);
         if (in_array($group_id, $groups_ids)) {
             $groups_ids = array_flip($groups_ids);
             unset($groups_ids[$group_id]);
             $groups_ids = array_flip($groups_ids);
             if ($groups_ids) {
                 $group_ids = implode(',', $groups_ids);
                 $data->group_ids = $group_ids;
                 $data->save();
             } else {
                 $data->delete();
             }
         }
     }
     return $data->id;
 }
Beispiel #4
0
 public function handle_request_internal()
 {
     $req = APF::get_instance()->get_request();
     $res = APF::get_instance()->get_response();
     $params = $req->get_parameters();
     $pro = $params['pro'] ? $params['pro'] : 'all';
     $user_id = $req->get_user_id();
     $departments = Bll_DdCommonBiz::get_instance()->get_departments_for_user_group();
     $groups = Bll_UserGroupCustomBiz::get_instance()->get_all_groups();
     $input_arr = array('type_key' => 'page', 'type_value' => 'onlinenew');
     $return = " ";
     if (isset($params['group_id']) && !empty($params['group_id'])) {
         $input_arr['groups'] = explode("|", $params['group_id']);
         array_pop($input_arr['groups']);
         $return = Bll_ReportGroupSelectedBiz::get_instance()->insert_selected_group($input_arr);
     }
     if ($return == null || $return == " ") {
         $page_bind_groups = "";
     } else {
         $page_bind_groups = Bll_ReportGroupSelectedBiz::get_instance()->get_group_ids_arr($input_arr);
     }
     foreach ($departments as $value) {
         if (intval($value->value) < 17 || intval($value->value) > 26) {
             $department[$value->value] = $value->name;
         }
     }
     $page_bind_groups_with_name = array();
     foreach ($groups as $value) {
         $group[$value->department][] = array('name' => $value->group_name, 'id' => $value->id);
         if (!empty($page_bind_groups) || strlen($page_bind_groups[0]) > 0) {
             foreach ($page_bind_groups as $p) {
                 if ($p == $value->id) {
                     $temp = array();
                     $temp['id'] = $p;
                     $temp['name'] = $value->group_name;
                     array_push($page_bind_groups_with_name, $temp);
                 }
             }
         }
     }
     $tab_info = array('all' => array('name' => 'ALL', 'click' => false), 'mobile' => array('name' => 'Mobile', 'click' => false), 'pc' => array('name' => 'Pc', 'click' => false));
     $tab_info[$pro]['click'] = true;
     $req->set_attribute('tab_info', $tab_info);
     $req->set_attribute('department', $department);
     if ($group != null) {
         $req->set_attribute('group', $group);
     }
     $req->set_attribute('user_id', $user_id);
     if (!empty($page_bind_groups) || strlen($page_bind_groups[0]) > 0) {
         $req->set_attribute('page_bind_groups', $page_bind_groups);
     }
     if (!empty($page_bind_groups_with_name) || strlen($page_bind_groups_with_name) > 0) {
         $req->set_attribute('page_bind_groups_with_name', $page_bind_groups_with_name);
     }
     $req->set_attribute('department_id', $department_id);
     $product = $params['pro'] ? $params['pro'] : 0;
     $tab_info = APF::get_instance()->get_config('department');
     /*$tab_info = array(
                     0 => array('name' => 'Overview', 'click' => false),
                     1 => array('name' => 'Anjuke', 'click' => false),
                     2 => array('name' => 'Aifang', 'click' => false),
                     3 => array('name' => 'Haozu', 'click' => false),
                     4 => array('name' => 'Jinpu', 'click' => false),
                     5 => array('name' => 'Mobile', 'click' => false),
                     6 => array('name' => 'Inc', 'click' => false)
     
             );*/
     $tab_info[$product]['click'] = true;
     $month_query = $params['form_month'] ? $params['form_month'] : date("Y-m", strtotime('now'));
     $depart_value_id = array('0' => '99', '10' => '51', '11' => '52', '12' => '53', '13' => '54', '20' => '52', '5' => '100', '15' => '56', '24' => '75');
     $pro_id = $depart_value_id[$product];
     $begin = date('Y-m-01', strtotime('now'));
     $end = date('Y-m-t', strtotime('now'));
     $detail_url = Ticket_CustomQueryController::build_uri() . "?act=query&page_current=1&created_at[v][1][b]=" . $begin . "&created_at[v][1][e]=" . $end . "&environment[v][]=19&department[v][]=" . $pro_id . "&sort_by=resolution&sort_order=desc&sort_c=&sort_o=desc";
     $departments = Bll_DdCommonBiz::get_instance()->get_departments_new();
     $department = array();
     foreach ($departments as $depart) {
         $department[$depart->value] = $depart->name;
     }
     //overview
     if ($product == 0) {
         $rows = 30 * count($department);
         $counts_all = Bll_ReportDayOnlineBiz::get_instance()->get_counts_by_date_all($rows, $product);
         //每个部门
         $counts_all = array_reverse($counts_all);
         $count_day_sec = array();
         $counts_all_temp = array();
         /*$count ="";
                     $day="";
                     foreach($counts_all as $row){
                         if (  in_array( $row->department,array('14','15','16','18','19') ) ){
                             $count = $count + $row->count;
                             $day =$row->day;
                         }else{
                             $counts_all_temp[] =$row;
                         }
                     }
                     $count_day_sec[$day]['移动']=$count."";
         
         
                     foreach ($counts_all_temp as $row) {
                         $count_day_sec[$row->day][$department[$row->department]] = $row->count;
                     }*/
         foreach ($counts_all as $row) {
             $count_day_sec[$row->day][$department[$row->department]] = $row->count;
         }
         foreach ($count_day_sec as $day => $ticketcnt) {
             $count = $ticketcnt['Mobile-broker'] + $ticketcnt['Mobile-jinpu'] + $ticketcnt['Mobile-xinfang'] + $ticketcnt['Mobile-haozu'] + $ticketcnt['Mobile-anjuke'];
             $count_day_sec[$day]['移动'] = $count;
             unset($count_day_sec[$day]['Mobile-broker']);
             unset($count_day_sec[$day]['Mobile-jinpu']);
             unset($count_day_sec[$day]['Mobile-xinfang']);
             unset($count_day_sec[$day]['Mobile-haozu']);
             unset($count_day_sec[$day]['Mobile-anjuke']);
         }
         $count_day_all = array();
         foreach ($count_day_sec as $key => $row) {
             $count_day_all[] = array_merge(array('date' => $key), $row);
         }
         //$count_day_all[] = array_merge($count_day_all,$temparray);
         //month_all
         //$rows_month = 12 * count($department);
         //array_pop($department);
         //array_pop($department);
         //month_all
         $rows_month = 12 * count($department);
         $last_twelve_month = array();
         for ($month = date('Y-m-d', strtotime('now')), $times = 12; $times > 0; $month = date('Y-m-d', strtotime('last month', strtotime($month))), --$times) {
             $last_twelve_month[] = date('Y-m', strtotime($month));
         }
         $last_twelve_month = array_reverse($last_twelve_month);
         foreach ($last_twelve_month as $month) {
             foreach ($department as $key => $value) {
                 $departc[] = Bll_ReportMonthOnlineBiz::get_instance()->get_counts_by_month($month, 'all', $key);
             }
             $counts_month = $departc;
         }
         foreach ($counts_month as $value) {
             $temp[] = $value[0];
         }
         $counts_month = $temp;
         /*$count_month_temp = array();
           $count= 0;
           $month="";
           foreach($counts_month as $row){
               if (  in_array( $row->department,array('14','15','16','18','19') ) ){
                   $count = $count + $row->count;
                   $month =$row->month;
               }else{
                   $count_month_temp[] =$row;
               }
           }*/
         //$counts_month = Bll_ReportMonthOnlineBiz::get_instance()->get_counts_by_type('all', $rows_month, $product, 1);
         $count_month_sec = array();
         foreach ($counts_month as $row) {
             $count_month_sec[$row->month][$department[$row->department]] = $row->count;
         }
         array_shift($count_month_sec);
         foreach ($count_month_sec as $month => $ticketcnt) {
             $count = $ticketcnt['Mobile-broker'] + $ticketcnt['Mobile-jinpu'] + $ticketcnt['Mobile-xinfang'] + $ticketcnt['Mobile-haozu'] + $ticketcnt['Mobile-anjuke'];
             $count_month_sec[$month]['移动'] = $count;
             unset($count_month_sec[$month]['Mobile-broker']);
             unset($count_month_sec[$month]['Mobile-jinpu']);
             unset($count_month_sec[$month]['Mobile-xinfang']);
             unset($count_month_sec[$month]['Mobile-haozu']);
             unset($count_month_sec[$month]['Mobile-anjuke']);
         }
         //$count_month_sec[$month]['移动']=$count."";
         $count_month_all = array();
         foreach ($count_month_sec as $key => $row) {
             $count = $row['用户端'] + $row['开发商'] + $row['CRM'] + $row['客户端'] + $row['移动'] + $row['Inc.'];
             $count_month_all[] = array_merge(array('date' => $key, 'count' => $count), $row);
         }
         /*$depart_staff = array(
           '1' => 'Inc',
           '2' => 'Anjuke',
           '3' => 'Aifang',
           '4' => 'Haozu',
           '5' => 'Jinpu',
           '6' => 'Mobile'
           );*/
         $m_begin = date('Y-m', strtotime('-7 month'));
         $m_end = date('Y-m', strtotime('now'));
         $tech_persons = Bll_ReportPersonCountBiz::get_instance()->get_counts_by_month($m_begin, $m_end);
         $tech_count = array();
         foreach ($tech_persons as $row) {
             $tech_count[$row->month][$row->department] = $row->person_count;
         }
         $count_month_table = $count_month_all;
         rsort($count_month_table);
         array_pop($count_month_table);
         $req->set_attribute('product', $product);
         $req->set_attribute('month_query', $month_query);
         $req->set_attribute('count_day_all', $count_day_all);
         $req->set_attribute('count_month_all', $count_month_all);
         $req->set_attribute('tab_info', $tab_info);
         $req->set_attribute('detail_url', '');
         $req->set_attribute('tech_count', $tech_count);
         $req->set_attribute('count_month_table', $count_month_table);
         return 'Newreport_OnlineNew';
     }
     if ($product == 5) {
         $owner = Bll_ReportDayOnlineOwnerBiz::get_instance()->get_owner();
         $rows = 30 * count($owner);
         $allowner = array();
         foreach ($owner as $own) {
             $allowner[] = $own->owner;
         }
         $counts_all = Bll_ReportDayOnlineOwnerBiz::get_instance()->get_30day($rows);
         //$counts_all = array_reverse($data);
         $count_day_sec = array();
         foreach ($counts_all as $row) {
             $count_day_sec[$row->day][$row->owner] = $row->count;
         }
         $count_day_all = array();
         foreach ($count_day_sec as $key => $row) {
             $count_day_all[] = array_merge(array('date' => $key), $row);
         }
         $count_day_all = array_reverse($count_day_all);
         $req->set_attribute('product', $product);
         $req->set_attribute('month_query', $month_query);
         $req->set_attribute('count_day_all', $count_day_all);
         $req->set_attribute('tab_info', $tab_info);
         $req->set_attribute('allowner', $allowner);
         return 'Newreport_OnlineNew';
     }
     if ($product == 15) {
         $rows = 30 * 5;
         $counts_all = Bll_ReportDayOnlineBiz::get_instance()->get_counts_mobile_by_date($rows, array(14, 15, 16, 18, 19));
         $counts_all = array_reverse($counts_all);
         $count_day_sec = array();
         $count_day_all = array();
         $count_day_all_temp = array();
         foreach ($counts_all as $row) {
             $count_day_sec[$row->day][$department[$row->department]] = $row->count;
         }
         foreach ($count_day_sec as $day => $ticketcnt) {
             $count_day_all[] = array('date' => $day, 'count' => array_sum($ticketcnt));
             //$count_day_all_temp[$day] =  array_sum($ticketcnt);
         }
         /* foreach($count_day_all_temp as $row){
                $count_day_all[] = array('date' => $row->day,
                                         'count' => $row->count);
            }*/
         //month_all
         $rows_month = 12 * count($department);
         $last_twelve_month = array();
         for ($month = date('Y-m-d', strtotime('now')), $times = 12; $times > 0; $month = date('Y-m-d', strtotime('last month', strtotime($month))), --$times) {
             $last_twelve_month[] = date('Y-m', strtotime($month));
         }
         $last_twelve_month = array_reverse($last_twelve_month);
         foreach ($last_twelve_month as $month) {
             foreach ($department as $key => $value) {
                 $departc[] = Bll_ReportMonthOnlineBiz::get_instance()->get_counts_by_month($month, 'all', $key);
             }
             $counts_month = $departc;
         }
         foreach ($counts_month as $value) {
             $temp[] = $value[0];
         }
         $counts_month = $temp;
         //$counts_month = Bll_ReportMonthOnlineBiz::get_instance()->get_counts_by_type('all', $rows_month, $product, 1);
         $count_month_sec = array();
         foreach ($counts_month as $row) {
             $count_month_sec[$row->month][$department[$row->department]] = $row->count;
         }
         array_shift($count_month_sec);
         foreach ($count_month_sec as $month => $ticketcnt) {
             $count = $ticketcnt['Mobile-broker'] + $ticketcnt['Mobile-jinpu'] + $ticketcnt['Mobile-xinfang'] + $ticketcnt['Mobile-haozu'] + $ticketcnt['Mobile-anjuke'];
             $count_month_sec[$month]['移动'] = $count;
             unset($count_month_sec[$month]['Mobile-broker']);
             unset($count_month_sec[$month]['Mobile-jinpu']);
             unset($count_month_sec[$month]['Mobile-xinfang']);
             unset($count_month_sec[$month]['Mobile-haozu']);
             unset($count_month_sec[$month]['Mobile-anjuke']);
         }
         /*foreach($counts_month as $row){
                         if (  in_array( $row->department,array('14','15','16','18','19') ) ){
                             $count = $count + $row->count;
                             $month =$row->month;
                         }else{
                             $count_month_temp[] =$row;
                         }
                     }
                     foreach ($count_month_temp as $row) {
                         $count_month_sec[$row->month][$department[$row->department]] = $row->count;
                     }
         
                     $m_begin = date('Y-m', strtotime('-7 month'));
                     $m_end = date('Y-m', strtotime('now'));
         
                     /*$rows_month = 12;
                     $counts_month = Bll_ReportMonthOnlineBiz::get_instance()->get_counts_by_type('all', $rows_month, array(14,15,16,18,19));
                     $count_month_all = array();
                     $counts_month_sec=array();
                     foreach($counts_month as $temp){
                         $counts_month_sec[$temp['month']][$temp['department']] =$temp;
                     }
         */
         $count_month_all = array();
         $count_month_all_temp = array();
         foreach ($count_month_sec as $key => $value) {
             $count_month_all_temp[$key] = array_slice($value, -1, 1);
         }
         foreach ($count_month_all_temp as $key => $value) {
             $count_month_all[] = array('date' => $key, 'count' => $value['移动']);
         }
         //$count_month_all = array_reverse($count_month_all);
         $count_month_table = $count_month_all;
         rsort($count_month_table);
         //array_pop($count_month_table);
         //group by resolution
         $counts_resos = Bll_ReportMonthOnlineBiz::get_instance()->get_counts_by_month_mobile($month_query, 'resolution', array(14, 15, 16, 18, 19));
         $counts_reso = array();
         foreach ($counts_resos as $row) {
             $counts_reso[$row->type_value] = $row->count;
         }
         $resolutions = Bll_DdCommonBiz::get_instance()->get_resolutions();
         $resolution = array();
         foreach ($resolutions as $resolu) {
             $resolution[$resolu->value] = $resolu->name;
         }
         $count_month_reso = array();
         foreach ($resolution as $r_value => $r_name) {
             $count_reso = isset($counts_reso[$r_value]) ? $counts_reso[$r_value] : 0;
             $count_month_reso[] = array('date' => $r_name, 'count' => $count_reso);
         }
         $req->set_attribute('product', $product);
         $req->set_attribute('month_query', $month_query);
         $req->set_attribute('count_day_all', $count_day_all);
         $req->set_attribute('count_month_all', $count_month_all);
         $req->set_attribute('tab_info', $tab_info);
         $req->set_attribute('detail_url', '');
         $req->set_attribute('tech_count', $tech_count);
         $req->set_attribute('count_month_table', $count_month_table);
         $req->set_attribute('count_month_reso', $count_month_reso);
         return 'Newreport_OnlineNew';
     }
     if ($page_bind_groups != "") {
         //day_all
         $department_id = intval(Bll_DdCommonBiz::get_instance()->get_department_id_by_value($product));
         $count_day_all = array();
         $days = $this->get_30Days();
         $interval = $this->get_the_day();
         $begin = $interval[0];
         $end = $interval[1];
         $tickets_all = Bll_TicketBiz::get_instance()->get_count_online_by_month($begin, $end, 'all', $department_id);
         for ($i = 29; $i >= 0; $i--) {
             $c = 0;
             foreach ($page_bind_groups as $group_id) {
                 $group_user_names = $this->get_group_member_name($group_id);
                 if (!empty($group_user_names)) {
                     foreach ($tickets_all as $value) {
                         if (in_array($value->owner, $group_user_names) && substr($value->created_at, 0, 10) == $days[$i]) {
                             $c++;
                         }
                     }
                 }
             }
             $count_day_all[] = array('date' => $days[$i], 'count' => $c);
         }
         //month_all
         $count_month_all = array();
         $count_month_comp = array();
         $count_month_reso = array();
         $counts_comp = array();
         $counts_reso = array();
         $flag = 0;
         $months = $this->get_12Months();
         for ($i = 11; $i >= 0; $i--) {
             $total = 0;
             $month_interval = $this->get_the_month($months[$i]);
             $begin = $month_interval[0];
             $end = $month_interval[1];
             $tickets_all = Bll_TicketBiz::get_instance()->get_count_online_by_month($begin, $end, 'all', $department_id);
             if ($month_query == $months[$i]) {
                 $flag = 1;
                 foreach ($page_bind_groups as $group_id) {
                     $group_user_names = $this->get_group_member_name($group_id);
                     if (!empty($group_user_names)) {
                         foreach ($tickets_all as $value) {
                             if (in_array($value->owner, $group_user_names)) {
                                 $total++;
                                 $counts_comp[$value->component] = isset($counts_comp[$value->component]) ? ++$counts_comp[$value->component] : 1;
                                 $counts_reso[$value->resolution] = isset($counts_reso[$value->resolution]) ? ++$counts_reso[$value->resolution] : 1;
                             }
                         }
                     }
                 }
             } else {
                 foreach ($page_bind_groups as $group_id) {
                     $group_user_names = $this->get_group_member_name($group_id);
                     if (!empty($group_user_names)) {
                         foreach ($tickets_all as $value) {
                             if (in_array($value->owner, $group_user_names)) {
                                 $total++;
                             }
                         }
                     }
                 }
             }
             $count_month_all[] = array('date' => $months[$i], 'count' => $total);
         }
         if ($flag == 0) {
             $month_interval = $this->get_the_month($months[$i]);
             $begin = $month_interval[0];
             $end = $month_interval[1];
             $tickets_all = Bll_TicketBiz::get_instance()->get_count_online_by_month($begin, $end, 'all', $department_id);
             foreach ($page_bind_groups as $group_id) {
                 $group_user_names = $this->get_group_member_name($group_id);
                 if (!empty($group_user_names)) {
                     foreach ($tickets_all as $value) {
                         if (in_array($value->owner, $group_user_names)) {
                             $counts_comp[$value->component] = isset($counts_comp[$value->component]) ? ++$counts_comp[$value->component] : 1;
                             $counts_reso[$value->resolution] = isset($counts_reso[$value->resolution]) ? ++$counts_reso[$value->resolution] : 1;
                         }
                     }
                 }
             }
         }
         $components = Bll_DdComponentBiz::get_instance()->get_components($pro_id);
         foreach ($components as $component) {
             $count_row = isset($counts_comp[$component->int]) ? $counts_comp[$component->int] : 0;
             $count_month_comp[] = array('date' => $component->name, 'count' => $count_row);
         }
         $resolutions = Bll_DdCommonBiz::get_instance()->get_resolutions();
         $resolution = array();
         foreach ($resolutions as $resolu) {
             $resolution[$resolu->id] = $resolu->name;
         }
         foreach ($resolution as $r_value => $r_name) {
             $count_reso = isset($counts_reso[$r_value]) ? $counts_reso[$r_value] : 0;
             $count_month_reso[] = array('date' => $r_name, 'count' => $count_reso);
         }
     } else {
         $rows = 30;
         $counts_all = Bll_ReportDayOnlineBiz::get_instance()->get_counts_by_date_all($rows, $product);
         $counts_all = array_reverse($counts_all);
         $count_day_all = array();
         foreach ($counts_all as $row) {
             $count_day_all[] = array('date' => $row->day, 'count' => $row->count);
         }
         //month_all
         $rows_month = 12;
         $counts_month = Bll_ReportMonthOnlineBiz::get_instance()->get_counts_by_type('all', $rows_month, $product);
         $count_month_all = array();
         foreach ($counts_month as $row) {
             $count_month_all[] = array('date' => $row->month, 'count' => $row->count);
         }
         $count_month_all = array_reverse($count_month_all);
         //group by component
         $counts_comps = Bll_ReportMonthOnlineBiz::get_instance()->get_counts_by_month($month_query, 'component', $product);
         $counts_comp = array();
         foreach ($counts_comps as $row) {
             $counts_comp[$row->type_value] = $row->count;
         }
         $components = Bll_DdComponentBiz::get_instance()->get_components($pro_id);
         $count_month_comp = array();
         foreach ($components as $component) {
             $count_row = isset($counts_comp[$component->value]) ? $counts_comp[$component->value] : 0;
             $count_month_comp[] = array('date' => $component->name, 'count' => $count_row);
         }
         //group by resolution
         $counts_resos = Bll_ReportMonthOnlineBiz::get_instance()->get_counts_by_month($month_query, 'resolution', $product);
         $counts_reso = array();
         foreach ($counts_resos as $row) {
             $counts_reso[$row->type_value] = $row->count;
         }
         $resolutions = Bll_DdCommonBiz::get_instance()->get_resolutions();
         $resolution = array();
         foreach ($resolutions as $resolu) {
             $resolution[$resolu->value] = $resolu->name;
         }
         $count_month_reso = array();
         foreach ($resolution as $r_value => $r_name) {
             $count_reso = isset($counts_reso[$r_value]) ? $counts_reso[$r_value] : 0;
             $count_month_reso[] = array('date' => $r_name, 'count' => $count_reso);
         }
     }
     $req->set_attribute('product', $product);
     $req->set_attribute('month_query', $month_query);
     $req->set_attribute('count_day_all', $count_day_all);
     $req->set_attribute('count_month_all', $count_month_all);
     $req->set_attribute('count_month_comp', $count_month_comp);
     $req->set_attribute('count_month_reso', $count_month_reso);
     $req->set_attribute('tab_info', $tab_info);
     $req->set_attribute('detail_url', $detail_url);
     return 'Newreport_OnlineNew';
 }
Beispiel #5
0
 public function handle_request_internal()
 {
     $type_key = array("all" => '', "mobile" => 'mobile_web', "pc" => 'pc');
     $req = APF::get_instance()->get_request();
     $params = $req->get_parameters();
     $params['pro'] = isset($params['pro']) ? $params['pro'] : 'all';
     $time_type = isset($params['time_type']) ? $params['time_type'] : 'week';
     if ($params['pro'] == "custom") {
         $department = Bll_DdCommonBiz::get_instance()->get_department_id_by_name("客户端");
     } else {
         $department = Bll_DdCommonBiz::get_instance()->get_department_id_by_name("用户端");
     }
     $department_value = intval($department->value);
     $department_id = intval($department->id);
     $time_param = $this->get_time($time_type);
     $input_arr['type_key'] = $params['type_key'];
     $input_arr['type_value'] = $params['pro'];
     if (!$params['group_id'] == "") {
         $input_arr['groups'] = explode("|", $params['group_id']);
     }
     //请求插入组信息
     if (isset($params['is_insert']) && !$params['group_id'] == "") {
         Bll_ReportGroupSelectedBiz::get_instance()->insert_selected_group($input_arr);
     } elseif ($params['id'] == 'processbug_by_person') {
         $person_bugs = Bll_TicketBiz::get_instance()->get_persons_online_closed_by_product_line($time_param[0], $time_param[1], "", $type_key[$params['pro']], $department_id);
         foreach ($person_bugs as $key => $value) {
             if (!empty($value) && $value[0] != null) {
                 $tables[] = array("bugs" => $key, 'name' => $value[0]);
             }
         }
         $content = "<table>\n                        <th colspan='2'><strong>按bug责任人统计</strong></th>\n                        <tr>\n                          <td><strong>bugid</strong></td>\n                          <td><strong>责任人</strong></td>\n                        </tr>";
         foreach ($tables as $key => $value) {
             $value['name'] = preg_replace('|\\s[a-zA-Z]+|', '', $value['name']);
             $content .= "<tr>\n                          <td><a target='_blank' href='http://ibug.corp.anjuke.com/ticket/detail?ticket_id={$value['bugs']}'>" . $value['bugs'] . "</a></td>\n                          <td>" . rtrim($value['name'], ';') . "</td>\n                          </tr>";
         }
         $content .= "</table>";
     } elseif ($params['id'] == 'processbug_rate') {
         if (isset($input_arr['groups']) && !empty($input_arr['groups']) && count($input_arr['groups']) > 0) {
             foreach ($input_arr['groups'] as $value) {
                 $processbug_rate = $this->get_rank_bug_resolved_by_group($time_type, $value);
                 $tables[] = array("name" => $processbug_rate['group_name'], "less_87" => $processbug_rate['less_87'], "more_87" => $processbug_rate['more_87'], "less_88" => $processbug_rate['less_88'], "more_88" => $processbug_rate['more_88'], "less_89" => $processbug_rate['less_89'], "more_89" => $processbug_rate['more_89'], "less_90" => $processbug_rate['less_90'], "more_90" => $processbug_rate['more_90'], "rate" => $processbug_rate['rate']);
             }
             foreach ($tables as $key => $value) {
                 $rate[$key] = $value['rate'];
             }
             array_multisort($rate, SORT_DESC, $tables);
             $content = "<table><th colspan='11'><strong>各团队线上bug解决速度排行榜</strong></th>\n                        <tr>\n                          <td rowspan='2'><strong>排名</strong></td>\n                          <td rowspan='2'><strong>团队</strong></td>\n                          <td rowspan='2'><strong>及时解决率</strong></td>\n                          <td colspan='2'><strong>E1-非常紧急</strong></td>\n                          <td colspan='2'><strong>E2-紧急</strong></td>\n                          <td colspan='2'><strong>E3-一般紧急</strong></td>\n                          <td colspan='2'><strong>E4-不紧急</strong></td>\n                        </tr>\n                        <tr>\n                          <td><strong>t<=24h</strong></td>\n                          <td><strong>t>24h</strong></td>\n                          <td><strong>t<=48h</strong></td>\n                          <td><strong>t>48h</strong></td>\n                          <td><strong>t<=72h</strong></td>\n                          <td><strong>t>72h</strong></td>\n                          <td><strong>t<=1月</strong></td>\n                          <td><strong>t>1月</strong></td>\n                        </tr>";
             $counter = 1;
             foreach ($tables as $key => $value) {
                 $Rate = floor($value['rate'] * 10000) / 10000 * 100;
                 $value['rate'] = $Rate . '%';
                 $content .= "<tr>\n                          <td>" . $counter++ . "</td>\n                          <td>" . $value['name'] . "</td>\n                          <td>" . $value['rate'] . "</td>\n                          <td>" . $value['less_87'] . "</td>\n                          <td>" . $value['more_87'] . "</td>\n                          <td>" . $value['less_88'] . "</td>\n                          <td>" . $value['more_88'] . "</td>\n                          <td>" . $value['less_89'] . "</td>\n                          <td>" . $value['more_89'] . "</td>\n                          <td>" . $value['less_90'] . "</td>\n                          <td>" . $value['more_90'] . "</td>\n                          </tr>";
             }
             $content .= "<tr><td></td><td colspan='10'>\n                            说明:<br>1.t为bug完整处理时长(去除节假日)<br>2.E1,E2,E3,E4分别为表中4类bug的bug数<br>\n                            3.e1,e2,e3,e4分别为表中4类bug的及时解决数<br>\n                            计算规则:及时解决率=(e1*5+e2*3+e3*1+e4*0.5)/(E1*5+E2*3+E3*1+E4*0.5)*100%</td></tr></table>";
         }
     } elseif ($params['id'] == 'online_bug_pandect') {
         $content = "<table><th colspan='3'><strong>线上bug总览</strong></th>\n                    <tr>\n                      <td><strong>上报来源</strong></td>\n                      <td><strong>新增bug</strong></td>\n                      <td><strong>关闭bug</strong></td>\n                    </tr>";
         if ($params['pro'] == 'custom') {
             $online_bug_pandect_create['test'] = Bll_TicketBiz::get_instance()->get_count_online_by_product_line_pandect($time_param[0], $time_param[1], 1, array('17'), $department_id);
             $online_bug_pandect_create['product'] = Bll_TicketBiz::get_instance()->get_count_online_by_product_line_pandect($time_param[0], $time_param[1], 1, array('19'), $department_id);
             $online_bug_pandect_close['test'] = Bll_TicketBiz::get_instance()->get_count_online_by_product_line_pandect($time_param[0], $time_param[1], 0, array('17'), $department_id);
             $online_bug_pandect_close['product'] = Bll_TicketBiz::get_instance()->get_count_online_by_product_line_pandect($time_param[0], $time_param[1], 0, array('19'), $department_id);
             $content .= "<tr>\n                          <td>业务部门</td>\n                          <td>" . count($online_bug_pandect_create['product'][$department_id]) . "</td>\n                          <td>" . count($online_bug_pandect_close['product'][$department_id]) . "</td>\n                          </tr>";
             $content .= "<tr>\n                          <td>QA</td>\n                          <td>" . count($online_bug_pandect_create['test'][$department_id]) . "</td>\n                          <td>" . count($online_bug_pandect_close['test'][$department_id]) . "</td>\n                          </tr>";
         } else {
             $online_bug_pandect_create['test'] = Bll_TicketBiz::get_instance()->get_count_online_by_product_line_pandect_by_user($time_param[0], $time_param[1], 1, array('17'));
             $online_bug_pandect_create['product'] = Bll_TicketBiz::get_instance()->get_count_online_by_product_line_pandect_by_user($time_param[0], $time_param[1], 1, array('19'));
             $online_bug_pandect_close['test'] = Bll_TicketBiz::get_instance()->get_count_online_by_product_line_pandect_by_user($time_param[0], $time_param[1], 0, array('17'));
             $online_bug_pandect_close['product'] = Bll_TicketBiz::get_instance()->get_count_online_by_product_line_pandect_by_user($time_param[0], $time_param[1], 0, array('19'));
             if ($params['pro'] == 'pc') {
                 $content .= "<tr>\n                          <td>业务部门</td>\n                          <td>" . count($online_bug_pandect_create['product']['pc']) . "</td>\n                          <td>" . count($online_bug_pandect_close['product']['pc']) . "</td>\n                          </tr>";
                 $content .= "<tr>\n                          <td>QA</td>\n                          <td>" . count($online_bug_pandect_create['test']['pc']) . "</td>\n                          <td>" . count($online_bug_pandect_close['test']['pc']) . "</td>\n                          </tr>";
             } elseif ($params['pro'] == 'mobile') {
                 $content .= "<tr>\n                              <td>业务部门</td>\n                              <td>" . count($online_bug_pandect_create['product']['mobile_web']) . "</td>\n                              <td>" . count($online_bug_pandect_close['product']['mobile_web']) . "</td>\n                              </tr>";
                 $content .= "<tr>\n                              <td>QA</td>\n                              <td>" . count($online_bug_pandect_create['test']['mobile_web']) . "</td>\n                              <td>" . count($online_bug_pandect_close['test']['mobile_web']) . "</td>\n                              </tr>";
             } else {
                 $content .= "<tr>\n                              <td>业务部门</td>\n                              <td>" . (count($online_bug_pandect_create['product']['mobile_web']) + count($online_bug_pandect_create['product']['pc'])) . "</td>\n                              <td>" . (count($online_bug_pandect_close['product']['mobile_web']) + count($online_bug_pandect_close['product']['pc'])) . "</td>\n                              </tr>";
                 $content .= "<tr>\n                              <td>QA</td>\n                              <td>" . (count($online_bug_pandect_create['test']['mobile_web']) + count($online_bug_pandect_create['test']['pc'])) . "</td>\n                              <td>" . (count($online_bug_pandect_close['test']['mobile_web']) + count($online_bug_pandect_close['test']['pc'])) . "</td>\n                              </tr>";
             }
         }
         $content .= "</table>";
     } elseif ($params['id'] == 'not_closedbug') {
         $content = "<table><th colspan='6'><strong>未关闭的线上bug</strong></th>\n                    <tr>\n                      <td><strong>Ticket</strong></td>\n                      <td><strong>Summary</strong></td>\n                      <td><strong>QA跟进人</strong></td>\n                      <td><strong>处理人</strong></td>\n                      <td><strong>Component</strong></td>\n                      <td><strong>Created Time</strong></td>\n                    </tr>";
         $not_closed_bugs = Bll_TicketBiz::get_instance()->get_online_opened_tickets_by_line($type_key[$params['pro']], $department_id);
         //var_dump($not_closed_bugs);die;
         if (empty($not_closed_bugs)) {
             $content .= "</table>";
         } else {
             foreach ($not_closed_bugs as $key => $value) {
                 $tables[] = array("ticket" => $value->id, "summary" => $value->summary, "assignqa" => $value->assigned_qa, "owner" => $value->owner, "component" => $value->component, "createdtime" => $value->created_at);
             }
             foreach ($tables as $key => $value) {
                 if (!empty($value['component'])) {
                     $value['component'] = $this->map_component($value['component'], $department_id);
                 }
                 if (!empty($value['assignqa'])) {
                     $value['assignqa'] = Bll_UserBiz::get_instance()->get_chinesename_by_username($value['assignqa']);
                 }
                 if (!empty($value['owner'])) {
                     $value['owner'] = Bll_UserBiz::get_instance()->get_chinesename_by_username($value['owner']);
                 }
                 $content .= "<tr>\n                      <td><a target='_blank' href='http://ibug.corp.anjuke.com/ticket/detail?ticket_id={$value['ticket']}'>" . $value['ticket'] . "</a></td>\n                      <td>" . $value['summary'] . "</td>\n                      <td>" . $value['assignqa'] . "</td>\n                      <td>" . $value['owner'] . "</td>\n                      <td>" . $value['component'] . "</td>\n                      <td>" . $value['createdtime'] . "</td>\n                      </tr>";
             }
             $content .= "</table>";
         }
     } else {
         $content .= "<table><th><strong>参数错误</strong><th></table>";
     }
     echo $content;
 }
Beispiel #6
0
 public function handle_request_internal()
 {
     $user = array();
     $display = array();
     $depart = 12;
     //12=>用户事业部
     //前端:508 后台:599,600 602 移动:601,根据hroa的api
     //product = 50=>网站端,51=>mobile
     $type_key = array("mobile" => array('product' => '51', 'user' => array(508, 602, 601)), "pc" => array('product' => '50', 'user' => array(508, 599, 600, 602)));
     $tab_info = array('pc' => array('name' => 'Pc', 'click' => false), 'mobile' => array('name' => 'Mobile', 'click' => false));
     $req = APF::get_instance()->get_request();
     // $res = APF::get_instance()->get_response();
     $params = $req->get_parameters();
     $pro = $params['pro'] ? $params['pro'] : 'pc';
     $time_type = $params['time'] ? $params['time'] : 'week';
     $report_type = $params['report'] ? $params['report'] : 'week';
     $tab_info[$pro]['click'] = true;
     $display['pro'] = $pro;
     $display['report_type'] = $report_type;
     /*获取开始时间,结束时间*/
     $time_arr = $this->get_time_type($time_type);
     $from = $time_arr['begin'];
     $to = $time_arr['end'];
     $display['input_from'] = date("Y-m-d", strtotime($from));
     $display['input_to'] = date("Y-m-d", strtotime($to));
     /* 获取组信息*/
     $departments = Bll_DdCommonBiz::get_instance()->get_departments_for_user_group();
     $groups = Bll_UserGroupCustomBiz::get_instance()->get_all_groups();
     $input_arr = array('type_key' => 'page', 'type_value' => $pro . '_project');
     $page_bind_groups = Bll_ReportGroupSelectedBiz::get_instance()->get_group_ids_arr($input_arr);
     /*获取用户端的所有组*/
     $groups_user = Bll_UserGroupCustomBiz::get_instance()->get_groups_by_department(10);
     //10=>用户端
     foreach ($departments as $value) {
         if (intval($value->value) < 17 || intval($value->value) > 26) {
             $department[$value->value] = $value->name;
         }
     }
     foreach ($groups as $value) {
         $group[$value->department][] = array('name' => $value->group_name, 'id' => $value->id);
     }
     $req->set_attribute('department', $department);
     if ($group != null) {
         $req->set_attribute('group', $group);
     }
     if (!empty($page_bind_groups) || strlen($page_bind_groups[0]) > 0) {
         $req->set_attribute('page_bind_groups', $page_bind_groups);
     }
     /*获取项目延期信息*/
     $begin = strtotime($from);
     $end = strtotime($to);
     $ss = new APi_DeployInfoController();
     $delay_projects_all = $ss->get_deply_project($begin, $end);
     foreach ($delay_projects_all as $project) {
         //            if($project->type != 4){
         //                $delay_projects[] = $project;
         //            }
         if ($project->type == 1) {
             $delay_projects['pc'][] = $project;
         } elseif ($project->type == 2 || $project->type == 3) {
             $delay_projects['mobile'][] = $project;
         }
     }
     /* 获取组信息*/
     $product_line = $type_key[$pro]['product'];
     $result_arr = $this->get_time_type('month');
     $dev_summary = Bll_ReportMonthDevBiz::get_instance()->get_data_by_product_and_months($result_arr['nine_months'], 51, 'product_line', $pro);
     //获取前6个月的bug总览
     $dev_bug_summary = array();
     foreach ($dev_summary as $summary) {
         $dev_bug_summary['month'][] = $summary->month;
         $dev_bug_summary['workload'][] = $summary->dev_workload;
         $dev_bug_summary['bugs'][] = $summary->count;
         $dev_bug_summary['bug_workload'][] = $summary->dev_workload == 0 ? 0 : round($summary->count / $summary->dev_workload, 2);
     }
     /*获取user信息,通过hroa api*/
     for ($c = 0; $c < count($type_key[$pro]['user']); $c++) {
         $user[] = $this->get_user_by_department($type_key[$pro]['user'][$c]);
     }
     $user = $this->merge_array($user);
     $projects = Bll_PMTProjectBiz::get_instance()->get_project_by_user_and_time($depart, $product_line, $from, $to);
     if (empty($projects)) {
         $req->set_attribute('tab_info', $tab_info);
         $req->set_attribute('display', $display);
         $req->set_attribute('table_project', array());
         $req->set_attribute('project_tested', array());
         $req->set_attribute('dev_bug_workload_rate', array());
         $req->set_attribute('dev_bug_summary', array());
         $req->set_attribute('top_three_projects', array());
         //top 3项目
         $req->set_attribute('delay_projects', array());
         //延期项目
         return 'NewReport_ProjectQuality';
     }
     $pmt_ids_init = array();
     $projects_pmtid = array();
     foreach ($projects as $project) {
         $projects_pmtid[$project['id']] = $project;
         $pmt_ids_init[] = $project['id'];
     }
     $tasks = Bll_PMTProjectBiz::get_instance()->get_tasks_by_pmt_ids($pmt_ids_init);
     $tasks_pmtid = array();
     $tasks_pmtid_person = array();
     if ($tasks) {
         foreach ($tasks as $task) {
             if (in_array($task['task_type_id'], array(2, 3, 33))) {
                 //2=>前端开发,3=>后端开发,33=>开发
                 $tasks_pmtid[$task['project_id']]['dev'][] = $task;
                 $tasks_pmtid_person[$task['project_id']]['dev'][$task['chinese_name']][] = $task['workload'];
             } elseif (in_array($task['task_type_id'], array(4))) {
                 //4=>测试
                 $tasks_pmtid[$task['project_id']]['test'][] = $task;
                 $tasks_pmtid_person[$task['project_id']]['test'][$task['chinese_name']][] = $task['workload'];
             }
         }
     }
     $pmt_ids = array();
     $pmt_no_test_ids = array();
     //项目无测试人员
     foreach ($pmt_ids_init as $pmt_id) {
         if (!empty($tasks_pmtid[$pmt_id]['dev'])) {
             //task为开发的不为空则存pmt_id
             $pmt_ids[] = $pmt_id;
             if (empty($tasks_pmtid[$pmt_id]['test'])) {
                 //开发不为空并且qa为空的为notesting项目;
                 $pmt_no_test_ids[] = $pmt_id;
             }
         } else {
             //$pmt_ids[] = '';
         }
     }
     if (empty($pmt_ids)) {
         $req->set_attribute('tab_info', $tab_info);
         $req->set_attribute('table_project', array());
         $req->set_attribute('display', $display);
         $req->set_attribute('project_tested', array());
         $req->set_attribute('dev_bug_workload_rate', array());
         $req->set_attribute('dev_bug_summary', array());
         //项目bug总览
         $req->set_attribute('top_three_projects', array());
         //top 3项目
         $req->set_attribute('delay_projects', array());
         //延期项目
         return 'NewReport_ProjectQuality';
     }
     $project_tested = array();
     $count_all_project = isset($pmt_ids) ? count($pmt_ids) : 0;
     $count_notest_project = isset($pmt_no_test_ids) ? count($pmt_no_test_ids) : 0;
     $project_tested['all'] = $count_all_project;
     $project_tested['tested'] = $count_all_project - $count_notest_project;
     //有测试人员的项目数
     $project_tested['notest'] = $count_notest_project;
     //no testing项目数
     $bug_detail = Bll_TicketBiz::get_instance()->get_bugs_detail_by_pmtids($pmt_ids);
     //根据pmt_id获取bug数目
     $bugs_pmtid = array();
     foreach ($bug_detail as $bug) {
         $bugs_pmtid[$bug->pmt_id][] = $bug;
         //每个pmt项目获取的bug
     }
     $users = Bll_UserBiz::get_instance()->get_all_users();
     $user_wc = array();
     foreach ($users as $row) {
         $user_wc[$row->whole_name] = $row->chinese_name;
     }
     $bug_detail_dev = array();
     $bug_detail_qa = array();
     foreach ($bug_detail as $row) {
         $bug_detail_dev[$row->pmt_id][$user_wc[$row->owner]][] = $row;
         $bug_detail_qa[$row->pmt_id][$user_wc[$row->reporter]][] = $row;
     }
     $table_work_person = array();
     $dev_bug_workload_rate = array();
     foreach ($pmt_ids as $pmt_id) {
         $dev_p = array();
         //开发者
         $dev_t = array();
         //开发工时
         $test_p = array();
         $test_t = array();
         $dev_bug = array();
         //开发bug
         $test_bug = array();
         //测试bug
         $dev_bug_workload = array();
         $test_bug_workload = array();
         $table_work_person[$pmt_id]['php_bug'] = 0;
         $table_work_person[$pmt_id]['js_bug'] = 0;
         //前端bug
         $table_work_person[$pmt_id]['qa_bug'] = 0;
         //qa bug
         foreach ($tasks_pmtid_person[$pmt_id]['dev'] as $d_p => $task_dev) {
             $dev_p[$d_p] = $d_p;
             $dev_t[$d_p] = 0;
             $dev_bug[$d_p] = isset($bug_detail_dev[$pmt_id][$d_p]) ? count($bug_detail_dev[$pmt_id][$d_p]) : 0;
             foreach ($task_dev as $t) {
                 $dev_t[$d_p] += intval($t);
             }
             $dev_bug_workload[$d_p] = $dev_t[$d_p] == 0 ? 0 : round(intval($dev_bug[$d_p]) / $dev_t[$d_p], 2);
         }
         foreach ($tasks_pmtid_person[$pmt_id]['test'] as $t_p => $task_test) {
             $test_p[$t_p] = $t_p;
             $test_t[$t_p] = 0;
             $test_bug[$t_p] = isset($bug_detail_qa[$pmt_id][$t_p]) ? count($bug_detail_qa[$pmt_id][$t_p]) : 0;
             foreach ($task_test as $t) {
                 $test_t[$t_p] += intval($t);
             }
             $test_bug_workload[$t_p] = $test_t[$t_p] == 0 ? 0 : round(intval($test_bug[$t_p]) / $test_t[$t_p], 2);
         }
         foreach ($dev_t as $dev_key => $dev_value) {
             if (in_array($dev_key, $user)) {
                 if (isset($dev_bug_workload_rate[$dev_key])) {
                     $dev_bug_workload_rate[$dev_key][0] += $dev_bug[$dev_key];
                     $dev_bug_workload_rate[$dev_key][1] += $dev_value;
                 } else {
                     $dev_bug_workload_rate[$dev_key][0] = $dev_bug[$dev_key];
                     $dev_bug_workload_rate[$dev_key][1] = $dev_value;
                 }
             }
         }
         //508=>前端,后台:599,600 602 移动:601 QA:603
         foreach ($dev_p as $key => $value) {
             if (in_array($value, $this->get_user_by_department(508))) {
                 $table_work_person[$pmt_id]['js_bug'] += $dev_bug[$key];
                 //判断是否是前端bug和PHP bug
             } else {
                 $table_work_person[$pmt_id]['php_bug'] += $dev_bug[$key];
             }
         }
         $table_work_person[$pmt_id]['dev_p'] = implode("<br />", $dev_p);
         //开发者
         $table_work_person[$pmt_id]['dev_t'] = implode("<br />", $dev_t);
         //开发工时
         $table_work_person[$pmt_id]['test_p'] = implode("<br />", $test_p);
         //测试者
         $table_work_person[$pmt_id]['test_t'] = implode("<br />", $test_t);
         //测试工时
         $table_work_person[$pmt_id]['dev_bug'] = implode("<br />", $dev_bug);
         //开发bug
         $table_work_person[$pmt_id]['test_bug'] = implode("<br />", $test_bug);
         //测试bug
         $table_work_person[$pmt_id]['dev_bug_workload'] = implode("<br />", $dev_bug_workload);
         $table_work_person[$pmt_id]['test_bug_workload'] = implode("<br />", $test_bug_workload);
     }
     $dev_bug_workload_rate = $this->process_rate($dev_bug_workload_rate);
     if ($params['ajax'] == 1) {
         if ($params['div'] == "#best_dev_group") {
             $group_rate = $this->process_group_info($params['group_id'], $dev_bug_workload_rate);
             $best = $this->get_best_group($group_rate);
             echo $best;
             return 0;
         }
     }
     //stage: 5-dev 6-test
     $table_workload = array();
     $table_through = array();
     foreach ($pmt_ids as $pmt_id) {
         if (empty($tasks_pmtid[$pmt_id]['dev'])) {
             $table_workload[$pmt_id]['dev_person'] = '';
             $table_workload[$pmt_id]['dev_workload'] = 0;
         } else {
             $person = array();
             $time = 0;
             $tasks_pmtid[$pmt_id]['groups'] = '';
             $temp_group_selected = array();
             foreach ($tasks_pmtid[$pmt_id]['dev'] as $row) {
                 $person[] = $row['chinese_name'];
                 $data = Bll_UserBiz::get_instance()->get_user_id_by_chinese_name($row['chinese_name']);
                 foreach ($groups_user as $group) {
                     $group_members = explode(',', $group->group_members);
                     $group_members = array_filter($group_members);
                     if (in_array($data->user_id, $group_members)) {
                         $temp_group_selected[] = $group->group_name;
                     }
                 }
                 $temp_group_selected = array_unique($temp_group_selected);
                 $tasks_pmtid[$pmt_id]['groups'] = implode(',', $temp_group_selected);
                 // 项目与组之间关系
                 $time += intval($row['workload']);
             }
             $person = array_unique($person);
             $person_str = implode("/", $person);
             $table_workload[$pmt_id]['dev_person'] = $person_str;
             $table_workload[$pmt_id]['dev_workload'] = $time;
             $through_arr = array();
             foreach ($person as $person_row) {
                 $str = isset($rates_pmtid[$pmt_id][$person_row]) ? $rates_pmtid[$pmt_id][$person_row] : "-";
                 if ($str == "-") {
                     $through_arr[] = $person_row . ": " . $str;
                 } else {
                     if ($str < 100) {
                         $through_arr[] = '<span style="color:red;">' . $person_row . ": " . $str . '%</span>';
                     } else {
                         $through_arr[] = $person_row . ": " . $str . '%';
                     }
                 }
             }
             $str = isset($rates_pmtid[$pmt_id]['all']) ? $rates_pmtid[$pmt_id]['all'] : "-";
             if ($str == "-") {
                 $through_arr[] = '整个项目' . ": " . $str;
             } else {
                 if ($str < 100) {
                     $through_arr[] = '<span style="color:red;">' . '整个项目' . ": " . $str . '%</span>';
                 } else {
                     $through_arr[] = '整个项目' . ": " . $str . '%';
                 }
             }
             $through_str = implode("<br />", $through_arr);
             $table_through[$pmt_id] = $through_str;
         }
         if (empty($tasks_pmtid[$pmt_id]['test'])) {
             $table_workload[$pmt_id]['test_person'] = '';
             $table_workload[$pmt_id]['test_workload'] = 0;
         } else {
             $person = array();
             $time = 0;
             foreach ($tasks_pmtid[$pmt_id]['test'] as $row) {
                 $person[] = $row['chinese_name'];
                 $time += intval($row['workload']);
             }
             $person = array_unique($person);
             $person_str = implode("/", $person);
             $table_workload[$pmt_id]['test_person'] = $person_str;
             $table_workload[$pmt_id]['test_workload'] = $time;
         }
     }
     $table_project = array();
     foreach ($pmt_ids as $pmt_id) {
         $table_project[$pmt_id]['pmt_id'] = $pmt_id;
         $table_project[$pmt_id]['summary'] = $projects_pmtid[$pmt_id]['summary'];
         $table_project[$pmt_id]['release_date'] = date("Y-m-d", strtotime($projects_pmtid[$pmt_id]['date_release']));
         $table_project[$pmt_id]['pro_set'] = empty($projects_pmtid[$pmt_id]['set_id']) ? '' : $projects_pmtid[$pmt_id]['set_id'] . ". " . $projects_pmtid[$pmt_id]['set_name'];
         $table_project[$pmt_id]['owner'] = $projects_pmtid[$pmt_id]['chinese_name'];
         $table_project[$pmt_id]['bugs_count'] = isset($bugs_pmtid[$pmt_id]) ? count($bugs_pmtid[$pmt_id]) : 0;
         $table_project[$pmt_id]['dev_person'] = $table_work_person[$pmt_id]['dev_p'];
         //开发者
         $table_project[$pmt_id]['dev_workload'] = $table_work_person[$pmt_id]['dev_t'];
         //开发工时
         $table_project[$pmt_id]['dev_bug'] = $table_work_person[$pmt_id]['dev_bug'];
         //开发bug
         $table_project[$pmt_id]['test_person'] = $table_work_person[$pmt_id]['test_p'];
         //测试者
         $table_project[$pmt_id]['test_workload'] = $table_work_person[$pmt_id]['test_t'];
         //测试工时
         $table_project[$pmt_id]['test_bug'] = $table_work_person[$pmt_id]['test_bug'];
         //测试发现的bug
         $table_project[$pmt_id]['dev_workload_all'] = $table_workload[$pmt_id]['dev_workload'];
         //总开发工时
         $table_project[$pmt_id]['test_workload_all'] = $table_workload[$pmt_id]['test_workload'];
         //总测试工时
         $table_project[$pmt_id]['bug_devload'] = $table_project[$pmt_id]['dev_workload_all'] == 0 ? 0 : round($table_project[$pmt_id]['bugs_count'] / $table_project[$pmt_id]['dev_workload_all'], 2);
         $table_project[$pmt_id]['bug_testload'] = $table_project[$pmt_id]['test_workload_all'] == 0 ? 0 : round($table_project[$pmt_id]['bugs_count'] / $table_project[$pmt_id]['test_workload_all'], 2);
         $table_project[$pmt_id]['php_bug'] = $table_work_person[$pmt_id]['php_bug'];
         $table_project[$pmt_id]['js_bug'] = $table_work_person[$pmt_id]['js_bug'];
         $table_project[$pmt_id]['others_bug'] = $table_project[$pmt_id]['bugs_count'] - ($table_work_person[$pmt_id]['js_bug'] + $table_work_person[$pmt_id]['php_bug']);
         //总bug数目-(php+js) bug
         $table_project[$pmt_id]['groups'] = $tasks_pmtid[$pmt_id]['groups'];
     }
     if ($params['ajax'] == 1) {
         if ($params['div'] == "#contrast_dev_group") {
             echo $this->group_quality($table_project, $params['group_id'], $from, $to, count($pmt_ids), $delay_projects[$display['pro']]);
             return 0;
         }
     }
     $dev_bug_workload_rate = array_values($dev_bug_workload_rate);
     $top_three_projects = array();
     usort($table_project, "self::my_sort");
     $top_three_projects['first'] = $table_project[0];
     $top_three_projects['second'] = $table_project[1];
     $top_three_projects['third'] = $table_project[2];
     //top3项目
     $req->set_attribute('tab_info', $tab_info);
     $req->set_attribute('table_project', $table_project);
     $req->set_attribute('dev_bug_workload_rate', $dev_bug_workload_rate);
     $req->set_attribute('project_tested', $project_tested);
     $req->set_attribute('display', $display);
     $req->set_attribute('dev_bug_summary', $dev_bug_summary);
     //项目bug总览
     $req->set_attribute('top_three_projects', $top_three_projects);
     //top3项目
     $req->set_attribute('delay_projects', $delay_projects);
     //延期项目
     return 'NewReport_ProjectQuality';
 }
$week = intval($week);
$resolutions = Bll_DdCommonBiz::get_instance()->get_resolutions();
$reso_id_value = array();
foreach ($resolutions as $resolution) {
    $reso_id_value[$resolution->id] = $resolution->value;
}
$reasons = Bll_DdCommonBiz::get_instance()->get_reasons();
$reason_id_value = array();
foreach ($reasons as $reason) {
    $reason_id_value[$reason->id] = $reason->value;
}
$departments = Bll_DdCommonBiz::get_instance()->get_departments_new();
//get the department,eg:用户端,客户端
$tickets_all = array();
foreach ($departments as $depart) {
    $list = Bll_ReportGroupSelectedBiz::get_instance()->get_all_groups_by_department($depart->value);
    $inserted_group = array();
    foreach ($list as $value) {
        if (in_array($value->group_id, $inserted_group)) {
            //防止重复插入相同group id的数据
            continue;
        }
        $inserted_group[] = $value->group_id;
        $item = array();
        $item['department'] = $depart->value;
        $item['type_key'] = "group";
        $item['week'] = $week;
        $item['type_value'] = $value->group_id;
        $item['updated_time'] = date("Y-m-d H:i:s");
        //获取group下所有人的tickets数量
        $user_id_arr = Bll_UserGroupCustomBiz::get_instance()->get_group_members_by_id($value->group_id);