|
@@ -3186,26 +3186,34 @@ class CameraApiController extends BaseController
|
|
->leftJoin('uf_xx_area','uf_xx_area.id','=','uf_xx_coal_washery.area_id')
|
|
->leftJoin('uf_xx_area','uf_xx_area.id','=','uf_xx_coal_washery.area_id')
|
|
->where('uf_xx_coal_washery.is_delete',0)->orderBy('uf_xx_area.create_time')->orderBy('uf_xx_coal_washery.sort')->get();
|
|
->where('uf_xx_coal_washery.is_delete',0)->orderBy('uf_xx_area.create_time')->orderBy('uf_xx_coal_washery.sort')->get();
|
|
|
|
|
|
- if(count($coal_list) > 0){
|
|
|
|
- for($i=0;$i<count($coal_list);$i++){
|
|
|
|
- $risk_list = DB::connection('mysql_fwe10')->table('uf_xx_risk_assignment')->where('risk_level',2)->whereDate('create_time', $date)->where('IS_DELETE', 0)->where('coal_washery_id',$coal_list[$i]->ID)->where('move_camera','!=',null)->orderBy('create_time')->get();
|
|
|
|
- if(count($risk_list) > 0){
|
|
|
|
- for($j=0;$j<count($risk_list);$j++){
|
|
|
|
|
|
+ $risk_list = DB::connection('mysql_fwe10')->table('uf_xx_risk_assignment')->where('risk_level',2)->whereDate('create_time', $date)->where('IS_DELETE', 0)->where('move_camera','!=',null)->orderBy('create_time')->get();
|
|
|
|
+ $risk_dict = [];
|
|
|
|
+ foreach ($risk_list as $key => $value) {
|
|
|
|
+ $risk_dict[$value->coal_washery_id][] = $value;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ foreach ($coal_list as $key => $value) {
|
|
|
|
+ try {
|
|
|
|
+
|
|
|
|
+ if(isset($risk_dict[$value->ID]) && !empty($risk_dict[$value->ID])) {
|
|
|
|
+ $risk = $risk_dict[$value->ID];
|
|
|
|
+ foreach ($risk as $k => $v) {
|
|
$index++;
|
|
$index++;
|
|
- array_push($result['camera_list'],[
|
|
|
|
- 'area'=>$coal_list[$i]->area_title,
|
|
|
|
- 'unit'=>$risk_list[$j]->unit,
|
|
|
|
|
|
+ $result['camera_list'][] = [
|
|
|
|
+ 'area'=>$value->area_title,
|
|
|
|
+ 'unit'=>$value->title,
|
|
'index'=>$index,
|
|
'index'=>$index,
|
|
- 'people_num'=>$risk_list[$j]->work_num,
|
|
|
|
- 'content'=>$risk_list[$j]->risk_name,
|
|
|
|
- 'work_location'=>$risk_list[$j]->risk_location,
|
|
|
|
- 'leader'=>$risk_list[$j]->work_people
|
|
|
|
- ]);
|
|
|
|
|
|
+ 'people_num'=>$v->work_num,
|
|
|
|
+ 'content'=>$v->risk_name,
|
|
|
|
+ 'work_location'=>$v->risk_location,
|
|
|
|
+ 'leader'=>$v->work_people,
|
|
|
|
+ ];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ } catch (Exception $e) {
|
|
|
|
+ echo $e->getMessage();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
return $result;
|
|
return $result;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3220,106 +3228,80 @@ class CameraApiController extends BaseController
|
|
$date = date('Y-m-d');
|
|
$date = date('Y-m-d');
|
|
}
|
|
}
|
|
|
|
|
|
- $gao = DB::connection('mysql_fwe10')->table('uf_xx_risk_assignment')
|
|
|
|
|
|
+ $risk_data = DB::connection('mysql_fwe10')->table('uf_xx_risk_assignment')
|
|
->select('uf_xx_risk_assignment.*','uf_xx_area.title')
|
|
->select('uf_xx_risk_assignment.*','uf_xx_area.title')
|
|
->leftJoin('uf_xx_coal_washery', 'uf_xx_risk_assignment.coal_washery_id', '=', 'uf_xx_coal_washery.id')
|
|
->leftJoin('uf_xx_coal_washery', 'uf_xx_risk_assignment.coal_washery_id', '=', 'uf_xx_coal_washery.id')
|
|
->leftJoin('uf_xx_area', 'uf_xx_coal_washery.area_id', '=', 'uf_xx_area.id')
|
|
->leftJoin('uf_xx_area', 'uf_xx_coal_washery.area_id', '=', 'uf_xx_area.id')
|
|
->whereDate('uf_xx_risk_assignment.create_time', $date)
|
|
->whereDate('uf_xx_risk_assignment.create_time', $date)
|
|
->where('uf_xx_risk_assignment.is_delete',0)
|
|
->where('uf_xx_risk_assignment.is_delete',0)
|
|
->where('uf_xx_risk_assignment.wcqk',0)
|
|
->where('uf_xx_risk_assignment.wcqk',0)
|
|
- ->where('uf_xx_risk_assignment.risk_level',0)
|
|
|
|
->get();
|
|
->get();
|
|
|
|
|
|
- if(count($gao) > 0){
|
|
|
|
- $result = $result . '高风险' . count($gao) . '项';
|
|
|
|
- $ningdong = 0;
|
|
|
|
- $taixi = 0;
|
|
|
|
- $str = '';
|
|
|
|
- for($i=0;$i<count($gao);$i++){
|
|
|
|
- if($gao[$i]->title == '宁东片区'){
|
|
|
|
- $ningdong++;
|
|
|
|
- }
|
|
|
|
- if($gao[$i]->title == '太西片区'){
|
|
|
|
- $taixi++;
|
|
|
|
|
|
+ $level_arr = [
|
|
|
|
+ 'gao'=>[
|
|
|
|
+ 'title'=>'高',
|
|
|
|
+ 'con'=>0,
|
|
|
|
+ 'nd'=>0,
|
|
|
|
+ 'tx'=>0
|
|
|
|
+ ],
|
|
|
|
+ 'zhong'=>[
|
|
|
|
+ 'title'=>'中',
|
|
|
|
+ 'con'=>0,
|
|
|
|
+ 'nd'=>0,
|
|
|
|
+ 'tx'=>0
|
|
|
|
+ ],
|
|
|
|
+ 'di'=>[
|
|
|
|
+ 'title'=>'低',
|
|
|
|
+ 'con'=>0,
|
|
|
|
+ 'nd'=>0,
|
|
|
|
+ 'tx'=>0
|
|
|
|
+ ]
|
|
|
|
+ ];
|
|
|
|
+ foreach ($risk_data as $key => $value) {
|
|
|
|
+ $risk_level = $value->risk_level;
|
|
|
|
+ if ($risk_level == 0) {
|
|
|
|
+ ++$level_arr['gao']['con'];
|
|
|
|
+ if ($value->title == '宁东片区') {
|
|
|
|
+ ++$level_arr['gao']['nd'];
|
|
|
|
+ } else if ($value->title == '太西片区') {
|
|
|
|
+ ++$level_arr['gao']['tx'];
|
|
}
|
|
}
|
|
- }
|
|
|
|
- if($ningdong > 0){
|
|
|
|
- $str = $str.'宁东'.$ningdong.'项,';
|
|
|
|
- }
|
|
|
|
- if($taixi > 0){
|
|
|
|
- $str = $str.'太西'.$taixi.'项,';
|
|
|
|
- }
|
|
|
|
- $str = rtrim($str, ",");
|
|
|
|
-
|
|
|
|
- $result = $result . '('.$str.')、';
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- $zhong = DB::connection('mysql_fwe10')->table('uf_xx_risk_assignment')
|
|
|
|
- ->select('uf_xx_risk_assignment.*','uf_xx_area.title')
|
|
|
|
- ->leftJoin('uf_xx_coal_washery', 'uf_xx_risk_assignment.coal_washery_id', '=', 'uf_xx_coal_washery.id')
|
|
|
|
- ->leftJoin('uf_xx_area', 'uf_xx_coal_washery.area_id', '=', 'uf_xx_area.id')
|
|
|
|
- ->whereDate('uf_xx_risk_assignment.create_time', $date)
|
|
|
|
- ->where('uf_xx_risk_assignment.is_delete',0)
|
|
|
|
- ->where('uf_xx_risk_assignment.wcqk',0)
|
|
|
|
- ->where('uf_xx_risk_assignment.risk_level',1)
|
|
|
|
- ->get();
|
|
|
|
-
|
|
|
|
- if(count($zhong) > 0){
|
|
|
|
- $result = $result . '中风险' . count($zhong) . '项';
|
|
|
|
- $ningdong = 0;
|
|
|
|
- $taixi = 0;
|
|
|
|
- $str = '';
|
|
|
|
- for($i=0;$i<count($zhong);$i++){
|
|
|
|
- if($zhong[$i]->title == '宁东片区'){
|
|
|
|
- $ningdong++;
|
|
|
|
|
|
+ } else if ($risk_level == 1) {
|
|
|
|
+ ++$level_arr['zhong']['con'];
|
|
|
|
+ if ($value->title == '宁东片区') {
|
|
|
|
+ ++$level_arr['zhong']['nd'];
|
|
|
|
+ } else if ($value->title == '太西片区') {
|
|
|
|
+ ++$level_arr['zhong']['tx'];
|
|
}
|
|
}
|
|
- if($zhong[$i]->title == '太西片区'){
|
|
|
|
- $taixi++;
|
|
|
|
|
|
+ } else {
|
|
|
|
+ ++$level_arr['di']['con'];
|
|
|
|
+ if ($value->title == '宁东片区') {
|
|
|
|
+ ++$level_arr['di']['nd'];
|
|
|
|
+ } else if ($value->title == '太西片区') {
|
|
|
|
+ ++$level_arr['di']['tx'];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if($ningdong > 0){
|
|
|
|
- $str = $str.'宁东'.$ningdong.'项,';
|
|
|
|
- }
|
|
|
|
- if($taixi > 0){
|
|
|
|
- $str = $str.'太西'.$taixi.'项,';
|
|
|
|
- }
|
|
|
|
- $str = rtrim($str, ",");
|
|
|
|
-
|
|
|
|
- $result = $result . '('.$str.')、';
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- $di = DB::connection('mysql_fwe10')->table('uf_xx_risk_assignment')
|
|
|
|
- ->select('uf_xx_risk_assignment.*','uf_xx_area.title')
|
|
|
|
- ->leftJoin('uf_xx_coal_washery', 'uf_xx_risk_assignment.coal_washery_id', '=', 'uf_xx_coal_washery.id')
|
|
|
|
- ->leftJoin('uf_xx_area', 'uf_xx_coal_washery.area_id', '=', 'uf_xx_area.id')
|
|
|
|
- ->whereDate('uf_xx_risk_assignment.create_time', $date)
|
|
|
|
- ->where('uf_xx_risk_assignment.is_delete',0)
|
|
|
|
- ->where('uf_xx_risk_assignment.wcqk',0)
|
|
|
|
- ->where('uf_xx_risk_assignment.risk_level',2)
|
|
|
|
- ->get();
|
|
|
|
-
|
|
|
|
- if(count($di) > 0){
|
|
|
|
- $result = $result . '低风险' . count($di) . '项';
|
|
|
|
- $ningdong = 0;
|
|
|
|
- $taixi = 0;
|
|
|
|
- $str = '';
|
|
|
|
- for($i=0;$i<count($di);$i++){
|
|
|
|
- if($di[$i]->title == '宁东片区'){
|
|
|
|
- $ningdong++;
|
|
|
|
|
|
+ foreach ($level_arr as $key => $value) {
|
|
|
|
+ // 不需要低风险
|
|
|
|
+ if ($key == 'di') continue;
|
|
|
|
+ $con = $value['con'];
|
|
|
|
+ $con_nd = $value['nd'];
|
|
|
|
+ $con_tx = $value['tx'];
|
|
|
|
+ $title = $value['title'];
|
|
|
|
+ if ($con > 0) {
|
|
|
|
+ $result .= $title.'风险' . $con . '项';
|
|
|
|
+ $str = '';
|
|
|
|
+ if($con_nd > 0){
|
|
|
|
+ $str = $str.'宁东'.$con_nd.'项,';
|
|
}
|
|
}
|
|
- if($di[$i]->title == '太西片区'){
|
|
|
|
- $taixi++;
|
|
|
|
|
|
+ if($con_tx > 0){
|
|
|
|
+ $str = $str.'太西'.$con_tx.'项,';
|
|
}
|
|
}
|
|
|
|
+ $str = rtrim($str, ",");
|
|
|
|
+ $result = $result . '('.$str.')、';
|
|
}
|
|
}
|
|
- if($ningdong > 0){
|
|
|
|
- $str = $str.'宁东'.$ningdong.'项,';
|
|
|
|
- }
|
|
|
|
- if($taixi > 0){
|
|
|
|
- $str = $str.'太西'.$taixi.'项,';
|
|
|
|
- }
|
|
|
|
- $str = rtrim($str, ",");
|
|
|
|
-
|
|
|
|
- $result = $result . '('.$str.')、';
|
|
|
|
}
|
|
}
|
|
|
|
|
|
$result = rtrim($result, "、");
|
|
$result = rtrim($result, "、");
|