|
@@ -2884,7 +2884,7 @@ class CameraApiController extends BaseController
|
|
|
if (!isset($params['area_id'])) {
|
|
|
return self::errorResponse(ApiEnum::STATUS_CODE_EMPTY);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$coal_washery_id_list = DB::connection('mysql_fwe10')->table('uf_xx_coal_washery')->where('area_id',$params['area_id'])->where('is_delete',0)->pluck('id');
|
|
|
$result = [];
|
|
|
$start_date = $params['start_date'];
|
|
@@ -2907,10 +2907,6 @@ class CameraApiController extends BaseController
|
|
|
//导出总表
|
|
|
public function export1(Request $request){
|
|
|
$params = $request->all();
|
|
|
- $result = [];
|
|
|
- $classes = ['早班','中班','夜班'];
|
|
|
- $risk_level = ['高','中','低'];
|
|
|
- $risk_desc = ['高风险','中风险','低风险'];
|
|
|
|
|
|
if(isset($params['date'])){
|
|
|
$date = $params['date'];
|
|
@@ -2918,102 +2914,186 @@ class CameraApiController extends BaseController
|
|
|
$date = date('Y-m-d');
|
|
|
}
|
|
|
|
|
|
- $result['num'] = DB::connection('mysql_fwe10')->table('uf_xx_risk_assignment')->whereDate('create_time', $date)->where('is_delete',0)->count();
|
|
|
-
|
|
|
- $result['gao'] = DB::connection('mysql_fwe10')->table('uf_xx_risk_assignment')->whereDate('create_time', $date)->where('risk_level',0)->where('is_delete',0)->count();
|
|
|
- $result['zhong'] = DB::connection('mysql_fwe10')->table('uf_xx_risk_assignment')->whereDate('create_time', $date)->where('risk_level',1)->where('is_delete',0)->count();
|
|
|
- $result['di'] = DB::connection('mysql_fwe10')->table('uf_xx_risk_assignment')->whereDate('create_time', $date)->where('risk_level',2)->where('is_delete',0)->count();
|
|
|
- $result['ziying'] = DB::connection('mysql_fwe10')->table('uf_xx_risk_assignment')
|
|
|
- ->leftJoin('uf_xx_coal_washery', 'uf_xx_risk_assignment.coal_washery_id', '=', 'uf_xx_coal_washery.id')
|
|
|
- ->whereDate('uf_xx_risk_assignment.create_time', $date)
|
|
|
- ->where('uf_xx_coal_washery.obj_type', 0)
|
|
|
- ->where('uf_xx_risk_assignment.IS_DELETE', 0)
|
|
|
- ->count();
|
|
|
- $result['waiwei'] = DB::connection('mysql_fwe10')->table('uf_xx_risk_assignment')
|
|
|
- ->leftJoin('uf_xx_coal_washery', 'uf_xx_risk_assignment.coal_washery_id', '=', 'uf_xx_coal_washery.id')
|
|
|
- ->whereDate('uf_xx_risk_assignment.create_time', $date)
|
|
|
- ->where('uf_xx_coal_washery.obj_type', 1)
|
|
|
- ->where('uf_xx_risk_assignment.IS_DELETE', 0)
|
|
|
- ->count();
|
|
|
-
|
|
|
- $list = [];
|
|
|
+ $classes = ['早班','中班','夜班'];
|
|
|
+ $risk_desc = ['高风险','中风险','低风险'];
|
|
|
+ // 风险类型
|
|
|
+ $risk_type = DB::connection('mysql_fwe10')->table('field_option')->where('field_id', '1055270106096394246')->get();
|
|
|
+ $risk_type_dict = [];
|
|
|
+ foreach ($risk_type as $key=>$value) {
|
|
|
+ $risk_type_key = $value->value_key;
|
|
|
+ $risk_type_name = $value->NAME;
|
|
|
+ $risk_type_dict[$risk_type_key] = $risk_type_name;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 风险数据
|
|
|
+ $risk_list = DB::connection('mysql_fwe10')->table('uf_xx_risk_assignment')->whereDate('create_time', $date)->where('is_delete',0)->get();
|
|
|
+ // 洗煤厂数据
|
|
|
+ $coal_washery_list = DB::connection('mysql_fwe10')->table('uf_xx_coal_washery')->where('is_delete',0)->orderBy('sort')->get();
|
|
|
+
|
|
|
+
|
|
|
+ $coal_washery_dict = [];
|
|
|
+ $coal_washery_type_dict = [];
|
|
|
+ foreach ($coal_washery_list as $key=>$value) {
|
|
|
+ $coal_washery_dict[$value->ID] = $value;
|
|
|
+ $coal_washery_type_dict[$value->ID] = $value->obj_type;
|
|
|
+ }
|
|
|
+
|
|
|
+ $res = [
|
|
|
+ "num" => 0,
|
|
|
+ "gao" => 0,
|
|
|
+ "zhong" => 0,
|
|
|
+ "di" => 0,
|
|
|
+ "ziying" => 0,
|
|
|
+ "waiwei" => 0,
|
|
|
+ "risk_info" => "",
|
|
|
+ "ziying_list" => [],
|
|
|
+ "waiwei_list" => [],
|
|
|
+ "table_list" => [],
|
|
|
+ ];
|
|
|
+ $risk_zhong_con = [];
|
|
|
+ $risk_gao_con = [];
|
|
|
+ $coal_washery_risk_list = [];
|
|
|
+ $coal_washery_risk_waiwei = [];
|
|
|
+ $coal_washery_risk_ziying = [];
|
|
|
+
|
|
|
+ foreach ($risk_list as $key=>$value) {
|
|
|
+ // 风险数量统计
|
|
|
+ $risk_level = $value->risk_level;
|
|
|
+ $risk_type = $risk_type_dict[$value->risk_type] ?? 2;
|
|
|
+ if($risk_level == 0) {
|
|
|
+ $res['gao']++;
|
|
|
+ if (!isset($risk_gao_con[$risk_type])) {
|
|
|
+ $risk_gao_con[$risk_type] = 1;
|
|
|
+ } else {
|
|
|
+ $risk_gao_con[$risk_type] ++;
|
|
|
+ };
|
|
|
+ } else if($risk_level == 1) {
|
|
|
+ $res['zhong']++;
|
|
|
+ if (!isset($risk_zhong_con[$risk_type])) {
|
|
|
+ $risk_zhong_con[$risk_type] = 1;
|
|
|
+ } else {
|
|
|
+ $risk_zhong_con[$risk_type] ++;
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ $res['di']++;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 洗煤厂类型统计(委外、自营)
|
|
|
+ $col_washery_id = $value->coal_washery_id;
|
|
|
+ $col_washery_type = $coal_washery_dict[$col_washery_id]->obj_type;
|
|
|
+ if($col_washery_type == 0) {
|
|
|
+ $res['ziying']++;
|
|
|
+ } else if ($col_washery_type == 1) {
|
|
|
+ $res['waiwei']++;
|
|
|
+ }
|
|
|
+ // 煤矿风险列表
|
|
|
+ $coal_washery_risk_list[$col_washery_id][] = $value;
|
|
|
+ }
|
|
|
+
|
|
|
+ $res['num'] = count($risk_list);
|
|
|
+
|
|
|
+ $coal_list = [];
|
|
|
$index = 0;
|
|
|
+ $index_ziying = 0;
|
|
|
+ $index_waiwei = 0;
|
|
|
+ foreach ($coal_washery_dict as $key => $value) {
|
|
|
+ $id = $value->ID;
|
|
|
+ if (isset($coal_washery_risk_list[$id])) {
|
|
|
+ $index++;
|
|
|
+ $people = 0;//计划人数
|
|
|
+ $gao = 0;
|
|
|
+ $zhong = 0;
|
|
|
+ $di = 0;
|
|
|
+ $content = '';//工作内容
|
|
|
+ $place = '';//作业地点
|
|
|
+ $leader = '';//负责人
|
|
|
+ $reviewer = [];//审核人
|
|
|
+ $coal_washery_risk_info_arr = $coal_washery_risk_list[$id];
|
|
|
+
|
|
|
+ $risk_index = 0;
|
|
|
+ foreach ($coal_washery_risk_info_arr as $k => $v) {
|
|
|
+ $people += $v->work_num;
|
|
|
+ $risk_info = '';
|
|
|
+ if ($v->risk_level == 0) {
|
|
|
+ $gao++;
|
|
|
+ $risk_info = '('.$risk_desc[$v->risk_level].':'.$risk_type_dict[$v->risk_type].');';
|
|
|
+ } else if ($v->risk_level == 1) {
|
|
|
+ $zhong++;
|
|
|
+ $risk_info = '('.$risk_desc[$v->risk_level].':'.$risk_type_dict[$v->risk_type].');';
|
|
|
+ } else {
|
|
|
+ $di++;
|
|
|
+ }
|
|
|
|
|
|
- $coal_list = DB::connection('mysql_fwe10')->table('uf_xx_coal_washery')->where('is_delete',0)->orderBy('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')->whereDate('create_time', $date)->where('IS_DELETE', 0)->where('coal_washery_id',$coal_list[$i]->ID)->orderBy('create_time')->get();
|
|
|
- if(count($risk_list) > 0){
|
|
|
- $index++;
|
|
|
- $people = 0;//计划人数
|
|
|
- $gao = 0;
|
|
|
- $zhong = 0;
|
|
|
- $di = 0;
|
|
|
- $content = '';//工作内容
|
|
|
- $place = '';//作业地点
|
|
|
- $leader = '';//负责人
|
|
|
- $reviewer = [];//审核人
|
|
|
-
|
|
|
- for($j=0;$j<count($risk_list);$j++){
|
|
|
- $people = $people + $risk_list[$j]->work_num;
|
|
|
-
|
|
|
- if($risk_list[$j]->risk_level == 0){
|
|
|
- $gao = $gao + 1;
|
|
|
- }
|
|
|
- if($risk_list[$j]->risk_level == 1){
|
|
|
- $zhong = $zhong + 1;
|
|
|
- }
|
|
|
- if($risk_list[$j]->risk_level == 2){
|
|
|
- $di = $di + 1;
|
|
|
- }
|
|
|
-
|
|
|
- $content = $content . ($j+1) . '.' . $risk_list[$j]->risk_name.'('.$risk_desc[$risk_list[$j]->risk_level].');';
|
|
|
-
|
|
|
- $place = $place . ($j+1) . '.' . $risk_list[$j]->risk_location.';';
|
|
|
-
|
|
|
- $leader = $leader . ($j+1) . '.' . $risk_list[$j]->work_people.';';
|
|
|
+ $content .= ++$risk_index.".".$v->risk_name.$risk_info;
|
|
|
|
|
|
- if($risk_list[$j]->shr != null){
|
|
|
- $reviewer[] = $risk_list[$j]->shr;
|
|
|
- }
|
|
|
- }
|
|
|
+ $place .= $risk_index.".".$v->risk_location;
|
|
|
+ $leader .= $risk_index.".".$v->work_people;
|
|
|
|
|
|
$reviewer = array_unique($reviewer);
|
|
|
- $reviewer = implode(',',$reviewer);
|
|
|
-
|
|
|
- $level_total = '';
|
|
|
- if($gao > 0){
|
|
|
- $level_total = $level_total . '高风险'.$gao.'项,';
|
|
|
- }
|
|
|
- if($zhong > 0){
|
|
|
- $level_total = $level_total . '中风险'.$zhong.'项,';
|
|
|
+ if (isset($v->shr) && !empty($v->shr)) {
|
|
|
+ $reviewer[] = $v->shr;
|
|
|
}
|
|
|
- if($di > 0){
|
|
|
- $level_total = $level_total . '低风险'.$di.'项';
|
|
|
+ }
|
|
|
+ $level_total = '';
|
|
|
+ if ($gao > 0) $level_total .= '高风险'.$gao.'项 ';
|
|
|
+ if ($zhong > 0) $level_total .= '中风险'.$zhong.'项 ';
|
|
|
+ if ($di > 0) $level_total .= '低风险'.$di.'项 ';
|
|
|
+ $line = [
|
|
|
+ 'index' => $index,
|
|
|
+ 'unit' => $v->unit,
|
|
|
+ 'coal_washery' => $value->title,
|
|
|
+ 'classes' => $classes[$v->classes],
|
|
|
+ 'work_num' => $people,
|
|
|
+ 'level' => $level_total,
|
|
|
+ 'content' => $content,
|
|
|
+ 'place' => $place,
|
|
|
+ 'leader' => $leader,
|
|
|
+ 'risk_dexcribe' => $v->risk_describe,
|
|
|
+ 'reviewer' => implode(',', $reviewer),
|
|
|
+ 'id' => $value->ID,
|
|
|
+ ];
|
|
|
+ $coal_list[] = $line;
|
|
|
+
|
|
|
+ // 自营、外委
|
|
|
+ if (isset($coal_washery_type_dict[$id])) {
|
|
|
+ $coal_washery_type = $coal_washery_type_dict[$id];
|
|
|
+ if ($coal_washery_type == 0) {
|
|
|
+ $line['index'] = ++ $index_ziying;
|
|
|
+ $res["ziying_list"][] = $line;
|
|
|
+ } else {
|
|
|
+ $line['index'] = ++ $index_waiwei;
|
|
|
+ $res["waiwei_list"][] = $line;
|
|
|
}
|
|
|
- $level_total = rtrim($level_total, ",");
|
|
|
-
|
|
|
- array_push($list,[
|
|
|
- 'index' => $index,
|
|
|
- 'unit' => $risk_list[0]->unit,
|
|
|
- 'coal_washery' => $coal_list[$i]->title,
|
|
|
- 'classes' => $classes[$risk_list[0]->classes],
|
|
|
- 'work_num' => $people,
|
|
|
- 'level' => $level_total,
|
|
|
- 'content' => $content,
|
|
|
- 'place' => $place,
|
|
|
- 'leader' => $leader,
|
|
|
- 'risk_describe'=> $risk_list[0]->risk_describe,
|
|
|
- 'reviewer' => $reviewer
|
|
|
- ]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ $res['table_list'] = $coal_list;
|
|
|
|
|
|
- $result['table_list'] = $list;
|
|
|
+ if ($res['gao'] > 0) {
|
|
|
+ $risk_gao_info = '(其中:';
|
|
|
+ foreach ($risk_gao_con as $key => $value) {
|
|
|
+ $risk_gao_info .= $key.$value.'项,';
|
|
|
+ }
|
|
|
+ $risk_gao_info = substr($risk_gao_info, 0, -3);
|
|
|
+ $risk_gao_info .= ');';
|
|
|
+ } else {
|
|
|
+ $risk_gao_info = ";";
|
|
|
+ }
|
|
|
|
|
|
- return $result;
|
|
|
+ if ($res['zhong'] > 0) {
|
|
|
+ $risk_zhong_info = '(其中:';
|
|
|
+ foreach ($risk_zhong_con as $key => $value) {
|
|
|
+ $risk_zhong_info .= $key.$value.'项,';
|
|
|
+ }
|
|
|
+ $risk_zhong_info = substr($risk_zhong_info, 0, -3);
|
|
|
+ $risk_zhong_info .= ');';
|
|
|
+ } else {
|
|
|
+ $risk_zhong_info = ";";
|
|
|
+ }
|
|
|
+
|
|
|
+ $res['risk_info'] = "总作业项:".$res['num']."项;高风险:".$res['gao']."项".$risk_gao_info."中风险:".$res['zhong']."项".$risk_zhong_info."低风险:".$res['di']."项。";
|
|
|
+
|
|
|
+ return $res;
|
|
|
}
|
|
|
|
|
|
//导出分类表
|
|
@@ -3106,26 +3186,34 @@ class CameraApiController extends BaseController
|
|
|
->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();
|
|
|
|
|
|
- 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++;
|
|
|
- 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,
|
|
|
- '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;
|
|
|
}
|
|
|
|
|
@@ -3140,106 +3228,80 @@ class CameraApiController extends BaseController
|
|
|
$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')
|
|
|
->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',0)
|
|
|
->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++;
|
|
|
+ $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($gao[$i]->title == '太西片区'){
|
|
|
- $taixi++;
|
|
|
+ } 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($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++;
|
|
|
- }
|
|
|
- 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, "、");
|
|
@@ -3275,9 +3337,9 @@ class CameraApiController extends BaseController
|
|
|
if($risk_list[$j]->risk_level == 1){
|
|
|
$zhong = $zhong + 1;
|
|
|
}
|
|
|
- if($risk_list[$j]->risk_level == 2){
|
|
|
- $di = $di + 1;
|
|
|
- }
|
|
|
+// if($risk_list[$j]->risk_level == 2){
|
|
|
+// $di = $di + 1;
|
|
|
+// }
|
|
|
}
|
|
|
if($gao > 0){
|
|
|
for($j=0;$j<count($risk_list);$j++){
|
|
@@ -3305,19 +3367,19 @@ class CameraApiController extends BaseController
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if($di > 0){
|
|
|
- for($j=0;$j<count($risk_list);$j++){
|
|
|
- if($risk_list[$j]->risk_level == 2){
|
|
|
- array_push($result['ziying_list'],[
|
|
|
- 'unit' => $coal_list[$i]->title,
|
|
|
- 'risk_level' => '低风险'.$di.'项',
|
|
|
- 'content' => $risk_list[$j]->risk_name,
|
|
|
- 'reason' => '按计划施工',
|
|
|
- 'people' => $risk_list[$j]->work_people
|
|
|
- ]);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// if($di > 0){
|
|
|
+// for($j=0;$j<count($risk_list);$j++){
|
|
|
+// if($risk_list[$j]->risk_level == 2){
|
|
|
+// array_push($result['ziying_list'],[
|
|
|
+// 'unit' => $coal_list[$i]->title,
|
|
|
+// 'risk_level' => '低风险'.$di.'项',
|
|
|
+// 'content' => $risk_list[$j]->risk_name,
|
|
|
+// 'reason' => '按计划施工',
|
|
|
+// 'people' => $risk_list[$j]->work_people
|
|
|
+// ]);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -3351,9 +3413,9 @@ class CameraApiController extends BaseController
|
|
|
if($risk_list[$j]->risk_level == 1){
|
|
|
$zhong = $zhong + 1;
|
|
|
}
|
|
|
- if($risk_list[$j]->risk_level == 2){
|
|
|
- $di = $di + 1;
|
|
|
- }
|
|
|
+// if($risk_list[$j]->risk_level == 2){
|
|
|
+// $di = $di + 1;
|
|
|
+// }
|
|
|
}
|
|
|
if($gao > 0){
|
|
|
for($j=0;$j<count($risk_list);$j++){
|
|
@@ -3381,19 +3443,19 @@ class CameraApiController extends BaseController
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if($di > 0){
|
|
|
- for($j=0;$j<count($risk_list);$j++){
|
|
|
- if($risk_list[$j]->risk_level == 2){
|
|
|
- array_push($result['weiwai_list'],[
|
|
|
- 'unit' => $coal_list[$i]->title,
|
|
|
- 'risk_level' => '低风险'.$di.'项',
|
|
|
- 'content' => $risk_list[$j]->risk_name,
|
|
|
- 'reason' => '按计划施工',
|
|
|
- 'people' => $risk_list[$j]->work_people
|
|
|
- ]);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// if($di > 0){
|
|
|
+// for($j=0;$j<count($risk_list);$j++){
|
|
|
+// if($risk_list[$j]->risk_level == 2){
|
|
|
+// array_push($result['weiwai_list'],[
|
|
|
+// 'unit' => $coal_list[$i]->title,
|
|
|
+// 'risk_level' => '低风险'.$di.'项',
|
|
|
+// 'content' => $risk_list[$j]->risk_name,
|
|
|
+// 'reason' => '按计划施工',
|
|
|
+// 'people' => $risk_list[$j]->work_people
|
|
|
+// ]);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -3417,4 +3479,4 @@ class CameraApiController extends BaseController
|
|
|
|
|
|
return $this->success($result);
|
|
|
}
|
|
|
-}
|
|
|
+}
|