|
@@ -143,6 +143,7 @@ class ApiController extends BaseController
|
|
public function peopleRecordByMonth(Request $request){
|
|
public function peopleRecordByMonth(Request $request){
|
|
$result['status'] = true;
|
|
$result['status'] = true;
|
|
$result['msg'] = ApiEnum::RETURN_SUCCESS;
|
|
$result['msg'] = ApiEnum::RETURN_SUCCESS;
|
|
|
|
+ $result['data'] = [];
|
|
|
|
|
|
$depart = Input::get('depart', '');
|
|
$depart = Input::get('depart', '');
|
|
$people = Input::get('people', '');
|
|
$people = Input::get('people', '');
|
|
@@ -158,11 +159,69 @@ class ApiController extends BaseController
|
|
return self::errorResponse(ApiEnum::STATUS_CODE_EMPTY);
|
|
return self::errorResponse(ApiEnum::STATUS_CODE_EMPTY);
|
|
}
|
|
}
|
|
|
|
|
|
- $record_list = DB::connection('mysql_fwe10')->table('uf_zhxx_qlcxjjl')
|
|
|
|
|
|
+ $timestamp = strtotime($ym);
|
|
|
|
+ $ny = date('Y年n月', $timestamp);
|
|
|
|
+ $result['data']['title'] = $ny.$depart.$people.'的巡检记录';
|
|
|
|
+
|
|
|
|
+ if($depart == '羊二洗煤厂' || $depart == '羊场湾二分区洗煤厂'){
|
|
|
|
+ $where = ['羊二洗煤厂','羊场湾二分区洗煤厂'];
|
|
|
|
+ $people_info = DB::connection('mysql_fwe10')->table('uf_zhxx_qlczgry')->where('zgrxm',$people)->whereIn('dwmc',$where)->where('IS_DELETE',0)->first();
|
|
|
|
+ }else{
|
|
|
|
+ $people_info = DB::connection('mysql_fwe10')->table('uf_zhxx_qlczgry')->where('zgrxm',$people)->where('dwmc',$depart)->where('IS_DELETE',0)->first();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $person_id = $people_info->zgrxm.'|'.$people_info->zgrgh;
|
|
|
|
+
|
|
|
|
+ //全部单位
|
|
|
|
+ $unit_list = DB::connection('mysql_fwe10')->table('uf_zhxx_qlcqyzd')->where('szxmc',$depart)->where('IS_DELETE',0)->pluck('qymc');
|
|
|
|
+
|
|
|
|
+ $record_list = DB::connection('mysql_fwe10')
|
|
|
|
+ ->table('uf_zhxx_qlcxjjl')
|
|
->where('xjdw', $depart)
|
|
->where('xjdw', $depart)
|
|
- ->where('lrsj', 'like', '%' . $ym . '%')
|
|
|
|
|
|
+ ->where('lrr', 'like', '%'.$people.'%')
|
|
|
|
+ ->where('lrsj', 'like', '%'.$ym.'%')
|
|
|
|
+ ->distinct() // 改用 distinct 去重
|
|
|
|
+ ->select('lrsj')
|
|
|
|
+ ->orderBy('lrsj') // 改为按分组字段排序
|
|
->get();
|
|
->get();
|
|
- dd($record_list);
|
|
|
|
|
|
+
|
|
|
|
+ $list = [];
|
|
|
|
+ if(count($record_list) > 0){
|
|
|
|
+ for($i=0;$i<count($record_list);$i++){
|
|
|
|
+ $record = DB::connection('mysql_fwe10')
|
|
|
|
+ ->table('uf_zhxx_qlcxjjl')
|
|
|
|
+ ->where('xjdw', $depart)
|
|
|
|
+ ->where('lrr', 'like', '%'.$people.'%')
|
|
|
|
+ ->where('lrsj', $record_list[$i]->lrsj)
|
|
|
|
+ ->distinct()
|
|
|
|
+ ->select('xjqy')
|
|
|
|
+ ->get();
|
|
|
|
+
|
|
|
|
+ if(count($record) == count($unit_list)){
|
|
|
|
+ $color = 'green';
|
|
|
|
+ }else{
|
|
|
|
+ $color = 'red';
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $timestamp = strtotime($record_list[$i]->lrsj);
|
|
|
|
+ $riqi = date('n月j日', $timestamp);
|
|
|
|
+ $date = date('Y-m-d', $timestamp);
|
|
|
|
+
|
|
|
|
+ $list[] = [
|
|
|
|
+ 'riqi' => $riqi,
|
|
|
|
+ 'depart' => $depart,
|
|
|
|
+ 'name' => $people,
|
|
|
|
+ 'zw' => $people_info->zw,
|
|
|
|
+ 'ys' => $color,
|
|
|
|
+ 'date' => $date,
|
|
|
|
+ 'person_id' => $person_id
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $result['data']['list'] = $list;
|
|
|
|
+
|
|
|
|
+ return self::successResponse($result);
|
|
}
|
|
}
|
|
|
|
|
|
//根据单位查人员列表
|
|
//根据单位查人员列表
|