...
|
...
|
@@ -1039,9 +1039,11 @@ class CommonController extends RestBaseController |
|
|
$startTime = isset($data['start_time'])&&!empty($data['start_time'])?$data['start_time']:'';
|
|
|
$endTime = isset($data['end_time'])&&!empty($data['end_time'])?$data['end_time']:'';
|
|
|
if (!empty($startTime)) {
|
|
|
$startTime = strtotime(date('Y-m-d',$startTime));
|
|
|
$query->where('i.create_time', '>=', $startTime);
|
|
|
}
|
|
|
if (!empty($endTime)) {
|
|
|
$endTime = strtotime(date('Y-m-d',$endTime));
|
|
|
$query->where('i.create_time', '<=', $endTime);
|
|
|
}
|
|
|
})
|
...
|
...
|
@@ -1070,9 +1072,11 @@ class CommonController extends RestBaseController |
|
|
$startTime = isset($data['start_time'])&&!empty($data['start_time'])?$data['start_time']:'';
|
|
|
$endTime = isset($data['end_time'])&&!empty($data['end_time'])?$data['end_time']:'';
|
|
|
if (!empty($startTime)) {
|
|
|
$startTime = strtotime(date('Y-m-d',$startTime));
|
|
|
$query->where('i.create_time', '>=', $startTime);
|
|
|
}
|
|
|
if (!empty($endTime)) {
|
|
|
$endTime = strtotime(date('Y-m-d',$endTime));
|
|
|
$query->where('i.create_time', '<=', $endTime);
|
|
|
}
|
|
|
})
|
...
|
...
|
@@ -1099,9 +1103,11 @@ class CommonController extends RestBaseController |
|
|
$startTime = isset($data['start_time'])&&!empty($data['start_time'])?$data['start_time']:'';
|
|
|
$endTime = isset($data['end_time'])&&!empty($data['end_time'])?$data['end_time']:'';
|
|
|
if (!empty($startTime)) {
|
|
|
$startTime = strtotime(date('Y-m-d',$startTime));
|
|
|
$query->where('t.test_time', '>=', $startTime);
|
|
|
}
|
|
|
if (!empty($endTime)) {
|
|
|
$endTime = strtotime(date('Y-m-d',$endTime));
|
|
|
$query->where('t.test_time', '<=', $endTime);
|
|
|
}
|
|
|
})
|
...
|
...
|
@@ -1128,9 +1134,11 @@ class CommonController extends RestBaseController |
|
|
$startTime = isset($data['start_time'])&&!empty($data['start_time'])?$data['start_time']:'';
|
|
|
$endTime = isset($data['end_time'])&&!empty($data['end_time'])?$data['end_time']:'';
|
|
|
if (!empty($startTime)) {
|
|
|
$startTime = strtotime(date('Y-m-d',$startTime));
|
|
|
$query->where('t.test_time', '>=', $startTime);
|
|
|
}
|
|
|
if (!empty($endTime)) {
|
|
|
$endTime = strtotime(date('Y-m-d',$endTime));
|
|
|
$query->where('t.test_time', '<=', $endTime);
|
|
|
}
|
|
|
})
|
...
|
...
|
@@ -1282,9 +1290,11 @@ class CommonController extends RestBaseController |
|
|
$startTime = isset($data['start_time'])&&!empty($data['start_time'])?$data['start_time']:'';
|
|
|
$endTime = isset($data['end_time'])&&!empty($data['end_time'])?$data['end_time']:'';
|
|
|
if (!empty($startTime)) {
|
|
|
$startTime = strtotime(date('Y-m-d',$startTime));
|
|
|
$query->where('c.ins_m_time', '>=', $startTime);
|
|
|
}
|
|
|
if (!empty($endTime)) {
|
|
|
$endTime = strtotime(date('Y-m-d',$endTime));
|
|
|
$query->where('c.ins_m_time', '<=', $endTime);
|
|
|
}
|
|
|
})
|
...
|
...
|
@@ -1324,9 +1334,11 @@ class CommonController extends RestBaseController |
|
|
$startTime = isset($data['start_time'])&&!empty($data['start_time'])?$data['start_time']:'';
|
|
|
$endTime = isset($data['end_time'])&&!empty($data['end_time'])?$data['end_time']:'';
|
|
|
if (!empty($startTime)) {
|
|
|
$startTime = strtotime(date('Y-m-d',$startTime));
|
|
|
$query->where('c.ins_m_time', '>=', $startTime);
|
|
|
}
|
|
|
if (!empty($endTime)) {
|
|
|
$endTime = strtotime(date('Y-m-d',$endTime));
|
|
|
$query->where('c.ins_m_time', '<=', $endTime);
|
|
|
}
|
|
|
})
|
...
|
...
|
@@ -1366,9 +1378,11 @@ class CommonController extends RestBaseController |
|
|
$startTime = isset($data['start_time'])&&!empty($data['start_time'])?$data['start_time']:'';
|
|
|
$endTime = isset($data['end_time'])&&!empty($data['end_time'])?$data['end_time']:'';
|
|
|
if (!empty($startTime)) {
|
|
|
$startTime = strtotime(date('Y-m-d',$startTime));
|
|
|
$query->where('r.create_time', '>=', $startTime);
|
|
|
}
|
|
|
if (!empty($endTime)) {
|
|
|
$endTime = strtotime(date('Y-m-d',$endTime));
|
|
|
$query->where('r.create_time', '<=', $endTime);
|
|
|
}
|
|
|
})
|
...
|
...
|
@@ -1411,9 +1425,11 @@ class CommonController extends RestBaseController |
|
|
$startTime = isset($data['start_time'])&&!empty($data['start_time'])?$data['start_time']:'';
|
|
|
$endTime = isset($data['end_time'])&&!empty($data['end_time'])?$data['end_time']:'';
|
|
|
if (!empty($startTime)) {
|
|
|
$startTime = strtotime(date('Y-m-d',$startTime));
|
|
|
$query->where('r.create_time', '>=', $startTime);
|
|
|
}
|
|
|
if (!empty($endTime)) {
|
|
|
$endTime = strtotime(date('Y-m-d',$endTime));
|
|
|
$query->where('r.create_time', '<=', $endTime);
|
|
|
}
|
|
|
})
|
...
|
...
|
@@ -1456,9 +1472,11 @@ class CommonController extends RestBaseController |
|
|
$startTime = isset($data['start_time'])&&!empty($data['start_time'])?$data['start_time']:'';
|
|
|
$endTime = isset($data['end_time'])&&!empty($data['end_time'])?$data['end_time']:'';
|
|
|
if (!empty($startTime)) {
|
|
|
$startTime = strtotime(date('Y-m-d',$startTime));
|
|
|
$query->where($train_time, '>=', $startTime);
|
|
|
}
|
|
|
if (!empty($endTime)) {
|
|
|
$endTime = strtotime(date('Y-m-d',$endTime));
|
|
|
$query->where($train_time, '<=', $endTime);
|
|
|
}
|
|
|
})
|
...
|
...
|
@@ -1503,9 +1521,11 @@ class CommonController extends RestBaseController |
|
|
$startTime = isset($data['start_time'])&&!empty($data['start_time'])?$data['start_time']:'';
|
|
|
$endTime = isset($data['end_time'])&&!empty($data['end_time'])?$data['end_time']:'';
|
|
|
if (!empty($startTime)) {
|
|
|
$startTime = strtotime(date('Y-m-d',$startTime));
|
|
|
$query->where($train_time, '>=', $startTime);
|
|
|
}
|
|
|
if (!empty($endTime)) {
|
|
|
$endTime = strtotime(date('Y-m-d',$endTime));
|
|
|
$query->where($train_time, '<=', $endTime);
|
|
|
}
|
|
|
})
|
...
|
...
|
@@ -1601,28 +1621,6 @@ class CommonController extends RestBaseController |
|
|
return $arr;
|
|
|
}
|
|
|
|
|
|
//按照日期进行排序
|
|
|
public function getDayImages($images){
|
|
|
$arr1 = [];
|
|
|
foreach($images as &$value){
|
|
|
$value['file_time'] = date('Y/m/d',$value['file_time']);
|
|
|
}
|
|
|
//去重后的日期
|
|
|
$res = array_values(array_unique(array_column($images,'file_time')));//array_values键名从0开始
|
|
|
foreach($res as $key1=>$value1){
|
|
|
$k = 0;
|
|
|
foreach($images as $value2){
|
|
|
if($value1 == $value2['file_time']){
|
|
|
$k+=0;
|
|
|
$arr1[$key1]['day'] = $value2['file_time'];
|
|
|
$arr1[$key1]['image'][$k]['image_url'] = $value2['image_url'];
|
|
|
$k++;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return $arr1;
|
|
|
}
|
|
|
|
|
|
//获取报修改造报表详情
|
|
|
public function getRepairReportDetail($res,$data,$flag){
|
|
|
$arr = [];
|
...
|
...
|
@@ -2016,14 +2014,14 @@ class CommonController extends RestBaseController |
|
|
//年检检测
|
|
|
$where = ['project_id'=>$res['project_id'],'test_id'=>$res['id']];
|
|
|
$field = 'id,status,uid,spot_id,images,create_time';
|
|
|
$arr['years'] = $this->getTestYearsList($where,$field,$res['project_id'],'years',$res['create_time']);
|
|
|
$arr['years'] = $this->getTestYearsList($where,$field,'years',$res['create_time']);
|
|
|
|
|
|
//检测时间
|
|
|
$arr['test_time'] = $res['test_time'];
|
|
|
}
|
|
|
|
|
|
if($flag == 'inspect'){
|
|
|
//月检人员(乙方项目组)
|
|
|
//日检人员(乙方项目组)
|
|
|
if($res['party'] == 0){
|
|
|
//甲方
|
|
|
$arr['inspect_name'] = $this->getUserByProject($res['project_id'],'id,a_sid');
|
...
|
...
|
@@ -2124,8 +2122,8 @@ class CommonController extends RestBaseController |
|
|
}
|
|
|
|
|
|
//获取年检列表
|
|
|
public function getTestYearsList($where,$field,$project_id,$table,$ins_time){
|
|
|
$time = $this->getDate($ins_time);
|
|
|
public function getTestYearsList($where,$field,$table,$years_time){
|
|
|
$time = $this->getDate($years_time);
|
|
|
$res = Db::name($table)
|
|
|
->where($where)
|
|
|
->whereTime('create_time', $time)
|
...
|
...
|
@@ -2133,92 +2131,55 @@ class CommonController extends RestBaseController |
|
|
->select()
|
|
|
->toArray();
|
|
|
$arr1 = [];
|
|
|
foreach($res as &$value){
|
|
|
$value['create_time'] = date('Y/m/d',$value['create_time']);
|
|
|
}
|
|
|
//去重后的日期
|
|
|
$result1 = array_values(array_unique(array_column($res,'create_time')));//array_values键名从0开始
|
|
|
//获取巡检点列表
|
|
|
if($table == 'inspect'){
|
|
|
//日检
|
|
|
$point_list = $this->getPoint(['p_id'=>$project_id],'id,point_name');
|
|
|
}else{
|
|
|
//年检
|
|
|
$point_list = $this->getSpot(['project_id'=>$project_id],'id,spot_name');
|
|
|
//获取检测年检点列表
|
|
|
$spot_list = $this->getSpot($where,'id,spot_name');
|
|
|
foreach($res as $k=>$value2) {
|
|
|
$arr1[$k]['spot_id'] = $value2['spot_id'];
|
|
|
//状态
|
|
|
$arr1[$k]['status'] = $value2['status'];
|
|
|
//巡检人
|
|
|
$user = $this->getUserById(['id' => $value2['uid']]);
|
|
|
if ($user) {
|
|
|
$arr1[$k]['user_login'] = $user['user_login'];
|
|
|
} else {
|
|
|
$arr1[$k]['user_login'] = '';
|
|
|
}
|
|
|
//图片
|
|
|
$arr1[$k]['images'] = $this->absolutionUrl($value2['images']);
|
|
|
}
|
|
|
|
|
|
|
|
|
foreach($result1 as $key1=>$value1){
|
|
|
$k = 0;
|
|
|
foreach($res as $key2=>$value2){
|
|
|
$k+=0;
|
|
|
if($value1 == $value2['create_time']){
|
|
|
$arr1[$key1]['day'] = $value2['create_time'];
|
|
|
if($table == 'inspect'){
|
|
|
//日检点id
|
|
|
$arr1[$key1]['point'][$k]['point_id'] = $value2['point_id'];
|
|
|
}else{
|
|
|
//年检点id
|
|
|
$arr1[$key1]['point'][$k]['spot_id'] = $value2['spot_id'];
|
|
|
}
|
|
|
//状态
|
|
|
$arr1[$key1]['point'][$k]['status'] = $value2['status'];
|
|
|
//巡检人
|
|
|
$user = $this->getUserById(['id'=>$value2['uid']]);
|
|
|
if($user){
|
|
|
$arr1[$key1]['point'][$k]['user_login'] = $user['user_login'];
|
|
|
}else{
|
|
|
$arr1[$key1]['point'][$k]['user_login'] = '';
|
|
|
}
|
|
|
//图片
|
|
|
$arr1[$key1]['point'][$k]['images'] = $this->absolutionUrl($value2['images']);
|
|
|
$k++;
|
|
|
foreach ($spot_list as &$list_value){
|
|
|
$list_value['status'] = 2;
|
|
|
$list_value['user_login'] = '';
|
|
|
$list_value['images'] = [];
|
|
|
foreach($arr1 as $key1=>$value1){
|
|
|
//日检
|
|
|
if($value1['spot_id'] == $list_value['id']){
|
|
|
$list_value['status'] = $value1['status'];
|
|
|
$list_value['user_login'] = $value1['user_login'];
|
|
|
$images = $this->getDayImages($value1['images']);
|
|
|
$list_value['images'] = $images;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return $spot_list;
|
|
|
}
|
|
|
|
|
|
foreach ($point_list as $key=>$list_value){
|
|
|
foreach($arr1 as $key1=>$value1){
|
|
|
foreach ($value1['point'] as $key2=>$item){
|
|
|
if($table == 'inspect'){
|
|
|
//日检
|
|
|
if(isset($item['point_id'])){
|
|
|
if($item['point_id'] == $list_value['id']){
|
|
|
$arr1[$key1]['point'][$key]['point_name'] = $list_value['point_name'];
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
//年检
|
|
|
if(isset($item['spot_id'])){
|
|
|
if($item['spot_id'] == $list_value['id']){
|
|
|
$arr1[$key1]['point'][$key]['spot_name'] = $list_value['spot_name'];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if(!isset($arr1[$key1]['point'][$key])){
|
|
|
if($table == 'inspect'){
|
|
|
//日检点id
|
|
|
$arr1[$key1]['point'][$key]['point_id'] = $list_value['id'];
|
|
|
}else{
|
|
|
//年检点id
|
|
|
$arr1[$key1]['point'][$key]['spot_id'] = $list_value['id'];
|
|
|
}
|
|
|
|
|
|
//巡检点状态
|
|
|
$arr1[$key1]['point'][$key]['status'] = 2;
|
|
|
// 巡检人
|
|
|
$arr1[$key1]['point'][$key]['user_login'] = '';
|
|
|
//巡检图片
|
|
|
$arr1[$key1]['point'][$key]['images'] = [];
|
|
|
if($table == 'inspect'){
|
|
|
//日检点名称
|
|
|
$arr1[$key1]['point'][$key]['point_name'] = $list_value['point_name'];
|
|
|
}else{
|
|
|
//年检点名称
|
|
|
$arr1[$key1]['point'][$key]['spot_name'] = $list_value['spot_name'];
|
|
|
}
|
|
|
}
|
|
|
//按照日期进行排序
|
|
|
public function getDayImages($images){
|
|
|
$arr1 = [];
|
|
|
foreach($images as &$value){
|
|
|
$value['file_time'] = date('Y/m/d',$value['file_time']);
|
|
|
}
|
|
|
//去重后的日期
|
|
|
$res = array_values(array_unique(array_column($images,'file_time')));//array_values键名从0开始
|
|
|
foreach($res as $key1=>$value1){
|
|
|
$k = 0;
|
|
|
foreach($images as $value2){
|
|
|
if($value1 == $value2['file_time']){
|
|
|
$k+=0;
|
|
|
$arr1[$key1]['day'] = $value2['file_time'];
|
|
|
$arr1[$key1]['image'][$k]['image_url'] = $value2['image_url'];
|
|
|
$k++;
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
|