Browse Source

添加网格化接口

qiuzijian 1 year atrás
parent
commit
7d0ac25c51

+ 16 - 4
Modules/Admin/Http/Controllers/Api/ApiController.php

@@ -85,15 +85,27 @@ class ApiController extends BaseController
         return self::successResponse($result);
     }
 
-    //网格化巡检记录列表
+    //网格化巡检记录列表明细
     public function getResultDlist()
     {
-
+        $person_id = Input::get('person_id', '');
+        $depart = Input::get('depart', '');
+        $date = Input::get('date', '');
+        if (!$person_id || !$depart || !$date) {
+            return self::errorResponse(ApiEnum::STATUS_CODE_EMPTY);
+        }
+        $result = ApiService::getResultDlist($person_id, $depart, $date);
+        return self::successResponse($result);
     }
 
-    //网格化巡检记录列表
+    //网格化巡检记录明细
     public function getResultDetail()
     {
-
+        $id = Input::get('id', '');
+        if (!$id) {
+            return self::errorResponse(ApiEnum::STATUS_CODE_EMPTY);
+        }
+        $result = ApiService::getResultDetails($id);
+        return self::successResponse($result);
     }
 }

+ 64 - 2
Modules/Admin/Services/ApiService.php

@@ -231,7 +231,7 @@ class ApiService{
         return $result;
     }
 
-    //网格化巡检记录查询
+    //网格化巡检记录列表
     public static function getResultList($person_id, $depart = 'all', $date_type = 'week')
     {
         $result['status'] = true;
@@ -275,7 +275,7 @@ class ApiService{
                         ->where('lrr', $person_id)->count();
 
             if ($detail >= $allcount) {
-                $data[$val->xjdw] = [
+                $data[] = [
                     'lastname'   => $lastname,
                     'person_id'  => $person_id,
                     'depart'     => $val->xjdw,
@@ -293,4 +293,66 @@ class ApiService{
 
         return $result;
     }
+
+    //网格化巡检记录列表明细
+    public static function getResultDlist($person_id, $depart, $date)
+    {
+
+        $result['status'] = true;
+        $result['msg']    = ApiEnum::RETURN_SUCCESS;
+        $result['data']   = [];
+-
+        $query = DB::connection('mysql_fwview')->table('uf_wghgl_new')
+                   ->join('hrmresource', 'uf_wghgl_new.lrr', '=', 'hrmresource.id')
+                   ->where('lrr', $person_id)
+                   ->where('xjdw', $depart)
+                   ->where('date', 'like', $date . '%')
+                   ->orderBy('lrsj', 'desc')
+                   ->select(
+                       [
+                           'uf_wghgl_new.id',
+                           'lastname',
+                           'xjdw',
+                           'jcqy',
+                       ]
+                   )
+                   ->get();
+
+        $query = json_decode($query);
+
+        $result['data'] = $query;
+
+        return $result;
+    }
+
+    //网格化巡检记录明细
+    public static function getResultDetails($id)
+    {
+        $result['status'] = true;
+        $result['msg']    = ApiEnum::RETURN_SUCCESS;
+        $result['data']   = [];
+
+        $query = DB::connection('mysql_fwview')->table('uf_wghgl_new')
+                   ->join('hrmresource', 'uf_wghgl_new.lrr', '=', 'hrmresource.id')
+                   ->where('uf_wghgl_new.id', $id)
+                   ->select(
+                       [
+                           'lastname',
+                           'dwmc',
+                           'xjdw',
+                           'jcqy',
+                           'jclx',
+                           'lrsj',
+                           'jcwt',
+                           'wtms',
+                           'dkpz'
+                       ]
+                   )->get();
+
+        $query = json_decode($query);
+
+        $result['data'] = $query;
+
+        return $result;
+    }
 }