| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -61,6 +61,7 @@ class ReportCommunity extends EloquentRepository | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            'user_id' => $params['user_id'] ?? request()->input('user_id', null), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            'market_id' => $params['market_id'] ?? request()->input('market_id',null), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            'name' => $params['name'] ?? request()->input('name',false), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            'position' => $params['position'] ?? request()->input('position',false), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ]; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if(empty($startTime) && empty($endTime)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return []; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -76,9 +77,10 @@ class ReportCommunity extends EloquentRepository | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }else{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            $endTime = $endTime . ' 23:59:59'; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 获取懒族员工
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        $employeesData = $this->getEmployeesData($selectsEmp,$params); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        $employeesData->orderBy('id','desc'); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if($isPerPage){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            $employeeList = $employeesData->paginate($this->perPage); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -90,7 +92,7 @@ class ReportCommunity extends EloquentRepository | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                'data'  => $list | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ]; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if(!isset($employeeList['data']) || count($employeeList['data']) <= 0 ) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return $employeeList; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -169,7 +171,8 @@ class ReportCommunity extends EloquentRepository | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public function getEmployeesData($selects, $params = []) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					         | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        $departments = config('role.department_value'); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        $positions = explode(',', $departments[9]); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        $model = Model::select(DB::raw($selects)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if(isset($params['status']) && is_numeric($params['status'])){ | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -185,6 +188,23 @@ class ReportCommunity extends EloquentRepository | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if(isset($params['market_id']) && is_numeric($params['market_id'])){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            $model->where('market_id', $params['market_id']);  | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					         | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if(!(isset($params['position']) && $params['position'] == 0)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // $model->whereJsonContains('position', $positions);
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					             | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            $model->where(function ($query) use ($positions) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                foreach($positions as $key => $value){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if($key == 0){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        $query->whereJsonContains('position', [$value]); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    }else{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        $query->orWhere(function ($query) use($value){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            $query->whereJsonContains('position', $value); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return $model; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
					 | 
				
				 | 
				
					
  |