|
@@ -300,26 +300,51 @@ class ApiService{
|
|
|
|
|
|
$list = [];
|
|
$list = [];
|
|
$pie = [];
|
|
$pie = [];
|
|
-
|
|
|
|
if(count($people_list) > 0){
|
|
if(count($people_list) > 0){
|
|
for($i=0;$i<count($people_list);$i++){
|
|
for($i=0;$i<count($people_list);$i++){
|
|
- $count = 0;
|
|
|
|
|
|
+ $area_list = [];
|
|
for($j=0;$j<count($query);$j++){
|
|
for($j=0;$j<count($query);$j++){
|
|
if($people_list[$i] == $query[$j]->lrr){
|
|
if($people_list[$i] == $query[$j]->lrr){
|
|
- $list[$i]['department'] = $query[$j]->dwmc;
|
|
|
|
- $count++;
|
|
|
|
|
|
+ $list[$i]['department'] = str_replace("洗选中心", "", $query[$j]->xjdw);
|
|
|
|
+ $area_list[] = $query[$j]->xjqy;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $unit_zd = DB::connection('mysql_fwe10')->table('uf_zhxx_qlcqyzd')->where('szxmc',$list[$i]['department'])->where('IS_DELETE',0)->pluck('qymc');
|
|
|
|
+
|
|
|
|
+ $minCount = PHP_INT_MAX;
|
|
|
|
+
|
|
|
|
+ foreach ($unit_zd as $itemB) {
|
|
|
|
+ // 如果数组A中不包含数组B中的某个项,则直接退出
|
|
|
|
+ if (!in_array($itemB, $area_list)) {
|
|
|
|
+ $minCount = 0;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // 计算该项在数组A中出现的次数
|
|
|
|
+ $count = 0;
|
|
|
|
+ foreach ($area_list as $itemA) {
|
|
|
|
+ if ($itemA == $itemB) {
|
|
|
|
+ $count++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 更新最少的数量
|
|
|
|
+ $minCount = min($minCount, $count);
|
|
}
|
|
}
|
|
|
|
+
|
|
$lrr = explode('|',$people_list[$i]);
|
|
$lrr = explode('|',$people_list[$i]);
|
|
$list[$i]['lastname'] = $lrr[0];
|
|
$list[$i]['lastname'] = $lrr[0];
|
|
$list[$i]['person_id'] = $lrr[1];
|
|
$list[$i]['person_id'] = $lrr[1];
|
|
- $list[$i]['count'] = $count;
|
|
|
|
|
|
+ $list[$i]['count'] = $minCount;
|
|
|
|
|
|
$pie[$i]['name'] = $lrr[0];
|
|
$pie[$i]['name'] = $lrr[0];
|
|
- $pie[$i]['value'] = $count;
|
|
|
|
|
|
+ $pie[$i]['value'] = $minCount;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ usort($list, function($a, $b) {
|
|
|
|
+ return strcmp($b['count'], $a['count']); // 注意 $b 在前
|
|
|
|
+ });
|
|
|
|
+
|
|
$result['data']['list'] = $list;
|
|
$result['data']['list'] = $list;
|
|
$result['data']['pie'] = $pie;
|
|
$result['data']['pie'] = $pie;
|
|
|
|
|