ソースを参照

Merge branch 'master' into zengjun

ajun 4 年 前
コミット
410c69da85
44 ファイル変更1537 行追加830 行削除
  1. 1 0
      app/Console/Commands/SyncOrderPackageLogisticRouteTask.php
  2. 2 7
      app/Http/Controllers/LaborReportController.php
  3. 48 59
      app/Http/Controllers/OwnerLogisticFeeDetailController.php
  4. 59 56
      app/Http/Controllers/OwnerLogisticFeeReportController.php
  5. 63 0
      app/Http/Controllers/SettlementBillOwnerAreaFeeController.php
  6. 18 0
      app/Http/Controllers/TestController.php
  7. 8 6
      app/Http/Controllers/UserLaborController.php
  8. 5 9
      app/Jobs/LogisticYTOSync.php
  9. 11 5
      app/OwnerLogisticFeeDetail.php
  10. 8 1
      app/OwnerLogisticFeeReport.php
  11. 11 45
      app/Providers/AppServiceProvider.php
  12. 7 7
      app/Services/LaborReportService.php
  13. 57 0
      app/Services/LogisticSyncRecordService.php
  14. 7 4
      app/Services/LogisticYTOService.php
  15. 2 2
      app/Services/MenuService.php
  16. 53 16
      app/Services/OrderPackageReceivedSyncService.php
  17. 66 58
      app/Services/OwnerLogisticFeeDetailService.php
  18. 103 3
      app/Services/OwnerLogisticFeeReportService.php
  19. 66 484
      composer.lock
  20. 17 14
      database/factories/OwnerFeeDetailFactory.php
  21. 13 5
      database/factories/OwnerLogisticFeeDetailFactory.php
  22. 14 1
      database/factories/OwnerLogisticFeeReportFactory.php
  23. 38 0
      database/migrations/2021_06_08_140312_add_logistic_id_to_owner_logistic_fee_details.php
  24. 60 0
      database/migrations/2021_06_08_144247_add_column_to_owner_logistic_fee_reports.php
  25. 54 1
      database/seeds/OwnerLogisticFeeDetailSeeder.php
  26. 1 1
      database/seeds/OwnerLogisticFeeReportSeeder.php
  27. 5 5
      package-lock.json
  28. BIN
      public/images/QRCodeIMG/4.png
  29. 20 0
      resources/views/finance/menu.blade.php
  30. 171 0
      resources/views/finance/settlementBills/areaFee/index.blade.php
  31. 180 0
      resources/views/finance/settlementBills/logisticFee/detail/index.blade.php
  32. 193 0
      resources/views/finance/settlementBills/logisticFee/report/index.blade.php
  33. 3 3
      resources/views/finance/settlementBills/ownerSundryFee/index.blade.php
  34. 29 1
      resources/views/maintenance/userLabor/index.blade.php
  35. 11 11
      resources/views/personnel/laborReport/index.blade.php
  36. 0 0
      resources/views/personnel/laborReport/menu.blade.php
  37. 1 1
      resources/views/personnel/laborReport/recycle.blade.php
  38. 0 0
      resources/views/personnel/menu.blade.php
  39. 1 0
      resources/views/transport/waybill/index.blade.php
  40. 25 20
      routes/web.php
  41. 3 3
      tests/Services/LogisticAliJiSuApiService/FormatTest.php
  42. 2 2
      tests/Services/LogisticYTOService/FormatTest.php
  43. 96 0
      tests/Services/OwnerLogisticFeeReportService/RecordReportTest.php
  44. 5 0
      yarn.lock

+ 1 - 0
app/Console/Commands/SyncOrderPackageLogisticRouteTask.php

@@ -46,6 +46,7 @@ class SyncOrderPackageLogisticRouteTask extends Command
         LogService::log(SyncOrderPackageLogisticRouteTask::class, "同步快递信息定时任务启动", '');
         LogService::log(SyncOrderPackageLogisticRouteTask::class, "同步快递信息定时任务启动", '');
         ini_set('memory_limit', '2226M');
         ini_set('memory_limit', '2226M');
         $this->service = app('OrderPackageReceivedSyncService');
         $this->service = app('OrderPackageReceivedSyncService');
+        $this->service->syncLogisticRouteYTO();
         $this->service->syncLogisticRouteByAliJiSu();
         $this->service->syncLogisticRouteByAliJiSu();
         $this->service->syncLogisticRoute();
         $this->service->syncLogisticRoute();
     }
     }

+ 2 - 7
app/Http/Controllers/LaborReportController.php

@@ -24,12 +24,7 @@ class LaborReportController extends Controller
     {
     {
         app()->singleton('laborReportService',LaborReportService::class);
         app()->singleton('laborReportService',LaborReportService::class);
     }
     }
-    /**
-     * Display a listing of the resource.
-     * @param  Request $request
-     * @return void
-     * 临时工报表
-     */
+
     public function index(Request $request)
     public function index(Request $request)
     {
     {
         if(!Gate::allows('人事管理-临时工报表')){ view('personnel/index');  }
         if(!Gate::allows('人事管理-临时工报表')){ view('personnel/index');  }
@@ -278,7 +273,7 @@ class LaborReportController extends Controller
     function recycle(Request $request){
     function recycle(Request $request){
         if(!Gate::allows('人事管理-临时工报表-删除')){ return redirect('/');  }
         if(!Gate::allows('人事管理-临时工报表-删除')){ return redirect('/');  }
         $paginateParams=$request->input();
         $paginateParams=$request->input();
-        $laborReports=LaborReport::query()->with(['user','userDutyCheck','userWorkgroup','laborCompany'])->onlyTrashed()->paginate($request->paginate??50);
+        $laborReports=LaborReport::query()->with(['user','userDutyCheck','userWorkgroup','laborCompany'])->orderByDesc('id')->onlyTrashed()->paginate($request->paginate??50);
         return view('personnel.laborReport.recycle',compact('laborReports','paginateParams'));
         return view('personnel.laborReport.recycle',compact('laborReports','paginateParams'));
     }
     }
 
 

+ 48 - 59
app/Http/Controllers/OwnerLogisticFeeDetailController.php

@@ -2,84 +2,73 @@
 
 
 namespace App\Http\Controllers;
 namespace App\Http\Controllers;
 
 
+use App\Owner;
 use App\OwnerLogisticFeeDetail;
 use App\OwnerLogisticFeeDetail;
+use App\Services\OwnerLogisticFeeDetailService;
 use Illuminate\Http\Request;
 use Illuminate\Http\Request;
+use Oursdreams\Export\Export;
 
 
 class OwnerLogisticFeeDetailController extends Controller
 class OwnerLogisticFeeDetailController extends Controller
 {
 {
+    /** @var $service OwnerLogisticFeeDetailService */
+    private $service;
+
     /**
     /**
      * Display a listing of the resource.
      * Display a listing of the resource.
      *
      *
-     * @return \Illuminate\Http\Response
      */
      */
-    public function index()
+    public function index(Request $request)
     {
     {
-        //
+        $paginateParams = $request->input();
+        list($permittingOwnerIds, $owner_id, $start, $end) = $this->getRequestParams($request);
+        $details = $this->service->getDetails($owner_id, $start, $end, $paginateParams);
+        $owners = Owner::query()->selectRaw("id,name")->whereIn('id', $permittingOwnerIds)->get();
+        $owner = Owner::query()->selectRaw("name")->find($owner_id);
+        return view('finance.settlementBills.logisticFee.detail.index', compact('details', 'paginateParams', 'owners', 'owner'));
     }
     }
 
 
-    /**
-     * Show the form for creating a new resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function create()
+    public function export(Request $request)
     {
     {
-        //
+        list($permittingOwnerIds, $owner_id, $start, $end) = $this->getRequestParams($request);
+        $query = $this->service->getSql($owner_id, $start, $end);
+        if (!$request->exists('checkAllSign')) {
+            $query->whereIn('id', explode(',', $request['data']));
+        }
+        $details = $this->service->buildDetails($query->get());
+        $json = [];
+        foreach ($details as $detail) {
+            $json[] = array_values($detail);
+        }
+        $row = ['主键', '快递公司', '省份', '快递单号', '重量', '首重价格', '续重价格', '快递费',];
+        return Export::make($row, $json, "快递费用详情");
     }
     }
 
 
     /**
     /**
-     * Store a newly created resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @return \Illuminate\Http\Response
+     * @param Request $request
+     * @return array
      */
      */
-    public function store(Request $request)
+    private function getRequestParams(Request $request): array
     {
     {
-        //
-    }
+        $this->service = app('OwnerLogisticFeeDetailService');
+        $this->userService = app('UserService');
+        $permittingOwnerIds = $this->userService->getPermittingOwnerIds(auth()->user());
 
 
-    /**
-     * Display the specified resource.
-     *
-     * @param  \App\OwnerLogisticFeeDetail  $ownerLogisticFeeDetail
-     * @return \Illuminate\Http\Response
-     */
-    public function show(OwnerLogisticFeeDetail $ownerLogisticFeeDetail)
-    {
-        //
-    }
+        if (is_null($request->owner_id)) {
+            $owner_id = $permittingOwnerIds[0];
+        } else {
+            $owner_id = $request->owner_id;
+        }
+        if (is_null($request->start)) {
+            $start = now()->subMonth()->startOfMonth()->toDateString();
+        } else {
+            $start = $request->start;
+        }
 
 
-    /**
-     * Show the form for editing the specified resource.
-     *
-     * @param  \App\OwnerLogisticFeeDetail  $ownerLogisticFeeDetail
-     * @return \Illuminate\Http\Response
-     */
-    public function edit(OwnerLogisticFeeDetail $ownerLogisticFeeDetail)
-    {
-        //
-    }
-
-    /**
-     * Update the specified resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  \App\OwnerLogisticFeeDetail  $ownerLogisticFeeDetail
-     * @return \Illuminate\Http\Response
-     */
-    public function update(Request $request, OwnerLogisticFeeDetail $ownerLogisticFeeDetail)
-    {
-        //
-    }
-
-    /**
-     * Remove the specified resource from storage.
-     *
-     * @param  \App\OwnerLogisticFeeDetail  $ownerLogisticFeeDetail
-     * @return \Illuminate\Http\Response
-     */
-    public function destroy(OwnerLogisticFeeDetail $ownerLogisticFeeDetail)
-    {
-        //
+        if (is_null($request->end)) {
+            $end = now()->subMonth()->endOfMonth()->toDateString();
+        } else {
+            $end = $request->end;
+        }
+        return array($permittingOwnerIds, $owner_id, $start, $end);
     }
     }
 }
 }

+ 59 - 56
app/Http/Controllers/OwnerLogisticFeeReportController.php

@@ -2,84 +2,87 @@
 
 
 namespace App\Http\Controllers;
 namespace App\Http\Controllers;
 
 
+use App\Owner;
 use App\OwnerLogisticFeeReport;
 use App\OwnerLogisticFeeReport;
+use App\Services\common\ExportService;
+use App\Services\OwnerLogisticFeeReportService;
+use App\Services\UserService;
 use Illuminate\Http\Request;
 use Illuminate\Http\Request;
+use Oursdreams\Export\Export;
 
 
 class OwnerLogisticFeeReportController extends Controller
 class OwnerLogisticFeeReportController extends Controller
 {
 {
-    /**
-     * Display a listing of the resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function index()
-    {
-        //
-    }
+    /* @var OwnerLogisticFeeReportService $service */
+    private $service;
+    /* @var UserService $userService */
+    private $userService;
 
 
     /**
     /**
-     * Show the form for creating a new resource.
-     *
-     * @return \Illuminate\Http\Response
+     * OwnerLogisticFeeReportController constructor.
      */
      */
-    public function create()
+    public function __construct()
     {
     {
-        //
+        $this->middleware('auth');
     }
     }
 
 
-    /**
-     * Store a newly created resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @return \Illuminate\Http\Response
-     */
-    public function store(Request $request)
-    {
-        //
-    }
 
 
     /**
     /**
-     * Display the specified resource.
-     *
-     * @param  \App\OwnerLogisticFeeReport  $ownerLogisticFeeReport
-     * @return \Illuminate\Http\Response
-     */
-    public function show(OwnerLogisticFeeReport $ownerLogisticFeeReport)
-    {
-        //
-    }
-
-    /**
-     * Show the form for editing the specified resource.
-     *
-     * @param  \App\OwnerLogisticFeeReport  $ownerLogisticFeeReport
-     * @return \Illuminate\Http\Response
+     * Display a listing of the resource.
      */
      */
-    public function edit(OwnerLogisticFeeReport $ownerLogisticFeeReport)
+    public function index(Request $request)
     {
     {
-        //
+        $paginateParams = $request->input();
+        list($permittingOwnerIds, $date, $owner_id) = $this->getRequestParams($request);
+        $reports = $this->service->getRecordPagination($owner_id, $date, $paginateParams);
+        $recordTotal = $this->service->getRecordTotal($owner_id, $date);
+        $owner = Owner::query()->selectRaw("name")->find($owner_id);
+        $owners = Owner::query()->selectRaw("id,name")->whereIn('id', $permittingOwnerIds)->get();
+        return view('finance.settlementBills.logisticFee.report.index', compact('reports', 'recordTotal', 'paginateParams', 'owners', 'owner'));
     }
     }
 
 
-    /**
-     * Update the specified resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  \App\OwnerLogisticFeeReport  $ownerLogisticFeeReport
-     * @return \Illuminate\Http\Response
-     */
-    public function update(Request $request, OwnerLogisticFeeReport $ownerLogisticFeeReport)
+    public function export(Request $request)
     {
     {
-        //
+        list($permittingOwnerIds, $date, $owner_id) = $this->getRequestParams($request);
+        $query = $this->service->getSql($owner_id, $date);
+        if (!$request->exists('checkAllSign')) {
+            $query->whereIn('id', explode(',', $request['data']));
+        }
+        $reports = $query->get();
+        $json = [];
+        foreach ($reports as $report) {
+            $json[] = [
+                $report->logistic->name ?? '',
+                $report->province,
+                $report->initial_weight,
+                $report->initial_amount,
+                $report->additional_weight,
+                $report->additional_amount,
+                $report->fee,
+            ];
+        }
+        $row = ['快递公司', '地区', '首重', '订单数', '续重', '续重合计', '(省份)合计'];
+        return Export::make($row, $json, "快递费用合计");
     }
     }
 
 
     /**
     /**
-     * Remove the specified resource from storage.
-     *
-     * @param  \App\OwnerLogisticFeeReport  $ownerLogisticFeeReport
-     * @return \Illuminate\Http\Response
+     * @param Request $request
+     * @return array
      */
      */
-    public function destroy(OwnerLogisticFeeReport $ownerLogisticFeeReport)
+    private function getRequestParams(Request $request): array
     {
     {
-        //
+        $this->service = app('OwnerLogisticFeeReportService');
+        $this->userService = app('UserService');
+        $permittingOwnerIds = $this->userService->getPermittingOwnerIds(auth()->user());
+        if (is_null($request->year) || is_null($request->month)) {
+            $date = now()->subMonth()->startOfMonth()->toDateString();
+        } else {
+            $date = $request->year . '-' . $request->month . '-' . '01';
+        }
+        if (is_null($request->owner_id)) {
+            $owner_id = $permittingOwnerIds[0];
+        } else {
+            $owner_id = $request->owner_id;
+        }
+        return array($permittingOwnerIds, $date, $owner_id);
     }
     }
 }
 }

+ 63 - 0
app/Http/Controllers/SettlementBillOwnerAreaFeeController.php

@@ -0,0 +1,63 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\OwnerAreaReport;
+use Illuminate\Http\Request;
+
+/**
+ * 结算管理-结算账单-仓储费
+ * Class SettlementBillOwnerAreaFeeController
+ * @package App\Http\Controllers
+ */
+class SettlementBillOwnerAreaFeeController extends Controller
+{
+    /**
+     * SettlementBillOwnerAreaFeeController constructor.
+     */
+    public function __construct()
+    {
+        $this->middleware('auth');
+    }
+
+    public function index(Request $request)
+    {
+        list($permittingOwnerIds, $date, $owner_id) = $this->getRequestParams($request);
+        $owners = \App\Owner::query()->find($permittingOwnerIds);
+        $owner = \App\Owner::query()->find($owner_id);
+        $ownerAreas = OwnerAreaReport::query()
+            ->with('ownerStoragePriceModel:id,using_type')
+            ->where('owner_id', $owner_id)
+            ->where('counting_month', $date)
+            ->get();
+
+        $ownerBillReport = \App\OwnerBillReport::query()
+            ->selectRaw('storage_fee')
+            ->where('owner_id', $owner_id)
+            ->where('counting_month', $date)
+            ->first();
+
+    }
+
+    /**
+     * @param Request $request
+     * @return array
+     */
+    private function getRequestParams(Request $request): array
+    {
+        $this->service = app('OwnerLogisticFeeReportService');
+        $this->userService = app('UserService');
+        $permittingOwnerIds = $this->userService->getPermittingOwnerIds(auth()->user());
+        if (is_null($request->year) || is_null($request->month)) {
+            $date = now()->subMonth()->startOfMonth()->toDateString();
+        } else {
+            $date = $request->year . '-' . $request->month . '-' . '01';
+        }
+        if (is_null($request->owner_id)) {
+            $owner_id = $permittingOwnerIds[0];
+        } else {
+            $owner_id = $request->owner_id;
+        }
+        return array($permittingOwnerIds, $date, $owner_id);
+    }
+}

+ 18 - 0
app/Http/Controllers/TestController.php

@@ -18,6 +18,7 @@ use App\Http\Controllers\api\thirdPart\haiq\PickStationController;
 use App\Http\Controllers\api\thirdPart\hengli\PackageController;
 use App\Http\Controllers\api\thirdPart\hengli\PackageController;
 use App\Http\Controllers\api\thirdPart\weight\WeightBaseController;
 use App\Http\Controllers\api\thirdPart\weight\WeightBaseController;
 use App\Jobs\DeleteRepetitionSkuItem;
 use App\Jobs\DeleteRepetitionSkuItem;
+use App\Jobs\LogisticAliJiSuSync;
 use App\Jobs\LogisticYTOSync;
 use App\Jobs\LogisticYTOSync;
 use App\Jobs\OrderCreateInstantBill;
 use App\Jobs\OrderCreateInstantBill;
 use App\Jobs\OrderFreeze;
 use App\Jobs\OrderFreeze;
@@ -112,6 +113,7 @@ use Mockery\Mock;
 use Oursdreams\Export\Export;
 use Oursdreams\Export\Export;
 use Overtrue\LaravelPinyin\Facades\Pinyin;
 use Overtrue\LaravelPinyin\Facades\Pinyin;
 use PhpMyAdmin\Server\Status\Data;
 use PhpMyAdmin\Server\Status\Data;
+use PhpParser\Node\Stmt\DeclareDeclare;
 use Ramsey\Collection\Collection;
 use Ramsey\Collection\Collection;
 use Zttp\Zttp;
 use Zttp\Zttp;
 
 
@@ -196,6 +198,22 @@ class TestController extends Controller
         app("MenuService")->setMenu();//重建菜单缓存
         app("MenuService")->setMenu();//重建菜单缓存
         app("AuthorityService")->removeAllAuth();//移除所有用户权限缓存,这将在用户下次访问时重新建立
         app("AuthorityService")->removeAllAuth();//移除所有用户权限缓存,这将在用户下次访问时重新建立
     }
     }
+    public function test1(){
+        DB::beginTransaction();
+        try{
+            DB::beginTransaction();
+            try{
+                $unit = Unit::query()->first();
+                $unit->update(["name"=>"xxx"]);
+                DB::commit();
+            }catch (\Exception $e){
+                DB::rollBack();
+            }
+            DB::commit();
+        }catch (\Exception $e){
+            DB::rollBack();
+        }
+    }
     public function orderCreateBill()
     public function orderCreateBill()
     {
     {
         $order = Order::query()->find(\request("id"));
         $order = Order::query()->find(\request("id"));

+ 8 - 6
app/Http/Controllers/UserLaborController.php

@@ -155,12 +155,6 @@ class UserLaborController extends Controller
         return redirect('maintenance/userLabor')->with('successTip','临时工“'.$userDetail->full_name.'”信息修改成功!');
         return redirect('maintenance/userLabor')->with('successTip','临时工“'.$userDetail->full_name.'”信息修改成功!');
     }
     }
 
 
-    /**
-     * Remove the specified resource from storage.
-     *
-     * @param  int  $id
-     * @return \Illuminate\Http\Response|array
-     */
     public function destroy($id)
     public function destroy($id)
     {
     {
         if(!Gate::allows('临时工-删除')){ return redirect(url('/'));  }
         if(!Gate::allows('临时工-删除')){ return redirect(url('/'));  }
@@ -178,4 +172,12 @@ class UserLaborController extends Controller
         app('LogService')->log(__METHOD__,"删除临时工".__FUNCTION__,json_encode($userLabor),Auth::user()['id']);
         app('LogService')->log(__METHOD__,"删除临时工".__FUNCTION__,json_encode($userLabor),Auth::user()['id']);
         return ['success'=>true];
         return ['success'=>true];
     }
     }
+    public function conversion(Request $request)
+    {
+        if(!Gate::allows('临时工-编辑')){ return redirect(url('/'));  }
+        $userDetail=UserDetail::query()
+            ->where('user_id',$request->input('user_id'))
+            ->update(['type'=>'无']);
+        if ($userDetail)  return ['success'=>true];
+    }
 }
 }

+ 5 - 9
app/Jobs/LogisticYTOSync.php

@@ -2,7 +2,6 @@
 
 
 namespace App\Jobs;
 namespace App\Jobs;
 
 
-use App\Services\LogisticYDService;
 use App\Services\LogisticYTOService;
 use App\Services\LogisticYTOService;
 use App\Services\LogService;
 use App\Services\LogService;
 use App\Services\OrderPackageReceivedSyncService;
 use App\Services\OrderPackageReceivedSyncService;
@@ -14,9 +13,6 @@ use Illuminate\Queue\SerializesModels;
 
 
 class LogisticYTOSync implements ShouldQueue
 class LogisticYTOSync implements ShouldQueue
 {
 {
-    public $tries = 2;
-    public $timeout = 10;
-
     use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
     use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
 
 
     /**
     /**
@@ -48,13 +44,13 @@ class LogisticYTOSync implements ShouldQueue
     {
     {
         LogService::log(LogisticYTOSync::class, "JOB-YTO", $this->logistic_number);
         LogService::log(LogisticYTOSync::class, "JOB-YTO", $this->logistic_number);
         $this->logisticYTOService = app('LogisticYTOService');
         $this->logisticYTOService = app('LogisticYTOService');
+        $this->orderPackageReceivedSyncService = app('OrderPackageReceivedSyncService');
         $nativeResponse = $this->logisticYTOService->query($this->logistic_number);
         $nativeResponse = $this->logisticYTOService->query($this->logistic_number);
         $formattedData = $this->logisticYTOService->format($nativeResponse,$this->logistic_number);
         $formattedData = $this->logisticYTOService->format($nativeResponse,$this->logistic_number);
-        $this->orderPackageReceivedSyncService = app('OrderPackageReceivedSyncService');
-        if (count($formattedData)>0 && $formattedData['logistic_number']??false){
-            $this->orderPackageReceivedSyncService->update([$formattedData]);
-        }else{
-            LogService::log(LogisticYTOService::class, "YTO快递无快递单号异常", $formattedData);
+        try {
+            if ($formattedData && isset($formattedData['logistic_number'])) $this->orderPackageReceivedSyncService->update([$formattedData]);
+        } catch (\Exception $e) {
+            LogService::log(LogisticYTOService::class, "YTO快递无快递单号异常", json_encode($formattedData));
         }
         }
     }
     }
 }
 }

+ 11 - 5
app/OwnerLogisticFeeDetail.php

@@ -5,22 +5,28 @@ namespace App;
 use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\Model;
 
 
 use App\Traits\ModelLogChanging;
 use App\Traits\ModelLogChanging;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
 use Illuminate\Database\Eloquent\Relations\HasOne;
 use Illuminate\Database\Eloquent\Relations\HasOne;
 
 
 class OwnerLogisticFeeDetail extends Model
 class OwnerLogisticFeeDetail extends Model
 {
 {
     use ModelLogChanging;
     use ModelLogChanging;
 
 
-    public $fillable = ['owner_fee_detail_id', 'logistic_bill', 'initial_weight', 'initial_weight_price', 'additional_weight', 'additional_price'];
+    public $fillable = ['owner_fee_detail_id', 'logistic_bill', 'initial_weight', 'initial_weight_price', 'additional_weight', 'additional_price','logistic_id','owner_id','additional_weigh_weight'];
 
 
-    public function ownerFeeDetail(): HasOne
+    public function ownerFeeDetail(): BelongsTo
     {
     {
-        return $this->hasOne(OwnerFeeDetail::class);
+        return $this->belongsTo(OwnerFeeDetail::class);
     }
     }
 
 
 
 
-    public function ownerFeeDetailLogistic(): HasOne
+    public function ownerFeeDetailLogistic(): BelongsTo
     {
     {
-        return $this->hasOne(OwnerFeeDetailLogistic::class,'logistic_bill', 'logistic_bill');
+        return $this->belongsTo(OwnerFeeDetailLogistic::class,'logistic_bill', 'logistic_bill');
+    }
+
+    public function logistic(): BelongsTo
+    {
+        return $this->belongsTo(Logistic::class);
     }
     }
 }
 }

+ 8 - 1
app/OwnerLogisticFeeReport.php

@@ -5,10 +5,17 @@ namespace App;
 use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\Model;
 
 
 use App\Traits\ModelLogChanging;
 use App\Traits\ModelLogChanging;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
 
 
 class OwnerLogisticFeeReport extends Model
 class OwnerLogisticFeeReport extends Model
 {
 {
     use ModelLogChanging;
     use ModelLogChanging;
 
 
-    //
+    public $fillable = ['owner_logistic_sum_fee_report_id', 'logistic_id', 'province', 'counted_date', 'initial_weight', 'initial_weight_price', 'initial_amount', 'additional_weight', 'additional_price', 'additional_amount', 'fee','owner_id'];
+    public $timestamps = false;
+
+    public function logistic(): BelongsTo
+    {
+        return $this->belongsTo(Logistic::class);
+    }
 }
 }

+ 11 - 45
app/Providers/AppServiceProvider.php

@@ -141,6 +141,7 @@ use App\Services\LogisticAliJiSuApiService;
 use App\Services\CommodityMaterialBoxModelService;
 use App\Services\CommodityMaterialBoxModelService;
 use App\Services\OwnerLogisticFeeDetailService;
 use App\Services\OwnerLogisticFeeDetailService;
 use App\Services\OwnerLogisticFeeReportService;
 use App\Services\OwnerLogisticFeeReportService;
+use App\Services\LogisticSyncRecordService;
 
 
 class AppServiceProvider extends ServiceProvider
 class AppServiceProvider extends ServiceProvider
 {
 {
@@ -169,8 +170,10 @@ class AppServiceProvider extends ServiceProvider
             $payload = $event->job->payload();
             $payload = $event->job->payload();
             $displayName = $payload['displayName'];
             $displayName = $payload['displayName'];
             //快递信息同步失败计数
             //快递信息同步失败计数
-            if ($this->isLogisticSyncJob($displayName)) {
-                $this->logisticSyncRecord($displayName, 'failed_count');
+            /** @var  $logisticSyncRecordService  LogisticSyncRecordService*/
+            $logisticSyncRecordService = app("LogisticSyncRecordService");
+            if ($logisticSyncRecordService->isLogisticSyncJob($displayName)) {
+                $logisticSyncRecordService->logisticSyncRecord($displayName, 'failed_count');
             }
             }
         });
         });
         //扩展身份证验证规则
         //扩展身份证验证规则
@@ -197,8 +200,10 @@ class AppServiceProvider extends ServiceProvider
             //快递信息同步成功计数
             //快递信息同步成功计数
             $payload = $event->job->payload();
             $payload = $event->job->payload();
             $displayName = $payload['displayName'];
             $displayName = $payload['displayName'];
-            if ($this->isLogisticSyncJob($displayName)) {
-                $this->logisticSyncRecord($displayName, 'succeed_count');
+            /** @var  $logisticSyncRecordService  LogisticSyncRecordService*/
+            $logisticSyncRecordService = app("LogisticSyncRecordService");
+            if ($logisticSyncRecordService->isLogisticSyncJob($displayName)) {
+                $logisticSyncRecordService->logisticSyncRecord($displayName, 'succeed_count');
             }
             }
         });
         });
     }
     }
@@ -206,7 +211,6 @@ class AppServiceProvider extends ServiceProvider
     private function loadingService(){
     private function loadingService(){
         app()->singleton('AllInventoryService',AllInventoryService::class);
         app()->singleton('AllInventoryService',AllInventoryService::class);
         app()->singleton('AuthorityService',AuthorityService::class);
         app()->singleton('AuthorityService',AuthorityService::class);
-        app()->singleton('NewOrderCountingRecordService',NewOrderCountingRecordService::class);
         app()->singleton('BatchService',BatchService::class);
         app()->singleton('BatchService',BatchService::class);
         app()->singleton('BatchUpdateService', BatchUpdateService::class);
         app()->singleton('BatchUpdateService', BatchUpdateService::class);
         app()->singleton('CacheService',CacheService::class);
         app()->singleton('CacheService',CacheService::class);
@@ -233,10 +237,12 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('LogisticZopService', LogisticZopService::class);
         app()->singleton('LogisticZopService', LogisticZopService::class);
         app()->singleton('InventoryCompareService', InventoryCompareService::class);
         app()->singleton('InventoryCompareService', InventoryCompareService::class);
         app()->singleton('InventoryDailyLogService', InventoryDailyLogService::class);
         app()->singleton('InventoryDailyLogService', InventoryDailyLogService::class);
+        app()->singleton('LaborCompanyService',LaborCompanyService::class);
         app()->singleton('LaborReportsCountingRecordService', LaborReportsCountingRecordService::class);
         app()->singleton('LaborReportsCountingRecordService', LaborReportsCountingRecordService::class);
         app()->singleton('LogService', LogService::class);
         app()->singleton('LogService', LogService::class);
         app()->singleton('LogisticAliJiSuApiService',LogisticAliJiSuApiService::class);
         app()->singleton('LogisticAliJiSuApiService',LogisticAliJiSuApiService::class);
         app()->singleton('LogisticSFService', LogisticSFService::class);
         app()->singleton('LogisticSFService', LogisticSFService::class);
+        app()->singleton('LogisticSyncRecordService', LogisticSyncRecordService::class);
         app()->singleton('LogisticService', LogisticService::class);
         app()->singleton('LogisticService', LogisticService::class);
         app()->singleton('LogisticYDService', LogisticYDService::class);
         app()->singleton('LogisticYDService', LogisticYDService::class);
         app()->singleton('LogisticYTOService', LogisticYTOService::class);
         app()->singleton('LogisticYTOService', LogisticYTOService::class);
@@ -335,44 +341,4 @@ class AppServiceProvider extends ServiceProvider
         Owner::observe(OwnerObserver::class);
         Owner::observe(OwnerObserver::class);
         UserWorkgroup::observe(UserWorkGroupObserver::class);
         UserWorkgroup::observe(UserWorkGroupObserver::class);
     }
     }
-
-    /**
-     * 快递同步接口 同步情况统计
-     */
-    private function logisticSyncRecord($displayName, $column_name): void
-    {
-        /**
-         * @var OrderPackageReceivedSyncRecordService $orderPackageReceivedSyncRecordService
-         */
-        $orderPackageReceivedSyncRecordService = app('OrderPackageReceivedSyncRecordService');
-        switch ($displayName) {
-            case LogisticZopSync::class:
-                $orderPackageReceivedSyncRecordService->createOrIncrementSucceededCount('中通', now()->toDateString(), $column_name);
-                break;
-            case LogisticSFSync::class:
-                $orderPackageReceivedSyncRecordService->createOrIncrementSucceededCount('顺丰', now()->toDateString(), $column_name);
-                break;
-            case LogisticYDSync::class:
-                $orderPackageReceivedSyncRecordService->createOrIncrementSucceededCount('韵达', now()->toDateString(), $column_name);
-                break;
-            case LogisticYTOSync::class:
-                $orderPackageReceivedSyncRecordService->createOrIncrementSucceededCount('圆通', now()->toDateString(), $column_name);
-                break;
-            default:
-                $orderPackageReceivedSyncRecordService->createOrIncrementSucceededCount('其他', now()->toDateString(), $column_name);
-        }
-    }
-
-    /**
-     * 判断当前任务类型是否为快递信息同步
-     * @param $displayName
-     * @return bool
-     */
-    private function isLogisticSyncJob($displayName): bool
-    {
-        return ($displayName == LogisticZopSync::class)
-            || ($displayName == LogisticSFSync::class)
-            || ($displayName == LogisticYDSync::class)
-            || ($displayName == LogisticYTOSync::class);
-    }
 }
 }

+ 7 - 7
app/Services/LaborReportService.php

@@ -51,8 +51,8 @@ class LaborReportService
             'labor_company_id' => ['multi' => ','],
             'labor_company_id' => ['multi' => ','],
             'id' => ['multi' => ',']
             'id' => ['multi' => ',']
         ];
         ];
-        $laborReports = app(QueryService::class)->query($params,$laborReports,$columnQueryRules,'labor_reports');
-        if((Gate::allows('人事管理-临时工报表-可见全部组')||Gate::allows('人事管理-门卫审核')) && !($params["user_workgroup_id"] ?? false)){
+//        if((Gate::allows('人事管理-临时工报表-可见全部组')||Gate::allows('人事管理-门卫审核')) && !($params["user_workgroup_id"] ?? false)){
+        if(Gate::allows('人事管理-门卫审核') && !($params["user_workgroup_id"] ?? false)){
             $laborReports->where(function ($query)use($user){
             $laborReports->where(function ($query)use($user){
                 $query->whereIn('labor_reports.user_workgroup_id',$user?$user->getPermittingWorkgroupIds(Gate::allows('人事管理-临时工报表-可见全部组')):[])
                 $query->whereIn('labor_reports.user_workgroup_id',$user?$user->getPermittingWorkgroupIds(Gate::allows('人事管理-临时工报表-可见全部组')):[])
                     ->whereIn('labor_reports.labor_company_id',$user?$user->getPermittingLaborCompanyIdsAttribute():[])
                     ->whereIn('labor_reports.labor_company_id',$user?$user->getPermittingLaborCompanyIdsAttribute():[])
@@ -202,11 +202,11 @@ class LaborReportService
     }
     }
     public function 删除($id){
     public function 删除($id){
         $laborReport=LaborReport::query()->where('id',$id)->delete();
         $laborReport=LaborReport::query()->where('id',$id)->delete();
-        if ($laborReport>0)LaborReportStatus::create([
-            'labor_report_id'=>$id,
-            'status'=>'已删除',
-        ]);
-        Controller::logS(__METHOD__,'删除盘点记录时修改盘点任务信息'.__FUNCTION__,json_encode($id));
+//        if ($laborReport>0)LaborReportStatus::create([
+//            'labor_report_id'=>$id,
+//            'status'=>'已删除',
+//        ]);
+        Controller::logS(__METHOD__,'删除临时工报表记录'.__FUNCTION__,json_encode($id));
         return $laborReport;
         return $laborReport;
     }
     }
 
 

+ 57 - 0
app/Services/LogisticSyncRecordService.php

@@ -0,0 +1,57 @@
+<?php
+
+namespace App\Services;
+
+use App\Jobs\LogisticSFSync;
+use App\Jobs\LogisticYDSync;
+use App\Jobs\LogisticYTOSync;
+use App\Jobs\LogisticZopSync;
+use App\Traits\ServiceAppAop;
+
+class LogisticSyncRecordService
+{
+    use ServiceAppAop;
+
+
+    /**
+     * 快递同步接口 同步情况统计
+     */
+    public function logisticSyncRecord($displayName, $column_name): void
+    {
+
+
+        /**
+         * @var OrderPackageReceivedSyncRecordService $orderPackageReceivedSyncRecordService
+         */
+        $orderPackageReceivedSyncRecordService = app('OrderPackageReceivedSyncRecordService');
+        switch ($displayName) {
+            case LogisticZopSync::class:
+                $orderPackageReceivedSyncRecordService->createOrIncrementSucceededCount('中通', now()->toDateString(), $column_name);
+                break;
+            case LogisticSFSync::class:
+                $orderPackageReceivedSyncRecordService->createOrIncrementSucceededCount('顺丰', now()->toDateString(), $column_name);
+                break;
+            case LogisticYDSync::class:
+                $orderPackageReceivedSyncRecordService->createOrIncrementSucceededCount('韵达', now()->toDateString(), $column_name);
+                break;
+            case LogisticYTOSync::class:
+                $orderPackageReceivedSyncRecordService->createOrIncrementSucceededCount('圆通', now()->toDateString(), $column_name);
+                break;
+            default:
+                $orderPackageReceivedSyncRecordService->createOrIncrementSucceededCount('其他', now()->toDateString(), $column_name);
+        }
+    }
+
+    /**
+     * 判断当前任务类型是否为快递信息同步
+     * @param $displayName
+     * @return bool
+     */
+    public function isLogisticSyncJob($displayName): bool
+    {
+        return ($displayName == LogisticZopSync::class)
+            || ($displayName == LogisticSFSync::class)
+            || ($displayName == LogisticYDSync::class)
+            || ($displayName == LogisticYTOSync::class);
+    }
+}

+ 7 - 4
app/Services/LogisticYTOService.php

@@ -2,10 +2,9 @@
 
 
 namespace App\Services;
 namespace App\Services;
 
 
-use App\OrderPackage;
+
 use App\Traits\ServiceAppAop;
 use App\Traits\ServiceAppAop;
 use Carbon\Carbon;
 use Carbon\Carbon;
-use Doctrine\DBAL\Connection;
 use Illuminate\Support\Facades\Http;
 use Illuminate\Support\Facades\Http;
 
 
 class LogisticYTOService
 class LogisticYTOService
@@ -56,7 +55,12 @@ class LogisticYTOService
             try {
             try {
                 if (is_array($response))$result['logistic_number'] = $response[0]->waybill_No;
                 if (is_array($response))$result['logistic_number'] = $response[0]->waybill_No;
             } catch (\Exception $e) {
             } catch (\Exception $e) {
-                LogService::log(LogisticYTOService::class, "YTO快递信息异常", $response);
+                LogService::log(LogisticYTOService::class, "YTO快递信息异常", $logistic_number);
+                return [
+                    'logistic_number' => $logistic_number,
+                    'exception_type' => '其他',
+                    'exception' => '是',
+                ];
             }
             }
             if (!empty($response) && is_array($response)) {
             if (!empty($response) && is_array($response)) {
                 $lastNativeRoute = $response[count($response) - 1];
                 $lastNativeRoute = $response[count($response) - 1];
@@ -68,7 +72,6 @@ class LogisticYTOService
                 $exceptionData = $orderPackageReceivedSyncService->setExceptionType($result, $lastNativeRoute ? $lastNativeRoute->upload_Time : null);
                 $exceptionData = $orderPackageReceivedSyncService->setExceptionType($result, $lastNativeRoute ? $lastNativeRoute->upload_Time : null);
                 $result['exception_type'] = $exceptionData['exception_type'];
                 $result['exception_type'] = $exceptionData['exception_type'];
                 $result['exception'] = $exceptionData['exception'];
                 $result['exception'] = $exceptionData['exception'];
-
             } else {
             } else {
                 $result['status'] = null;
                 $result['status'] = null;
                 $result['transfer_status'] = [];
                 $result['transfer_status'] = [];

+ 2 - 2
app/Services/MenuService.php

@@ -1,4 +1,4 @@
-<?php 
+<?php
 
 
 namespace App\Services;
 namespace App\Services;
 
 
@@ -124,4 +124,4 @@ class MenuService
         $this->getVisibleFunctionList(Authority::query()->get(),$mapping);
         $this->getVisibleFunctionList(Authority::query()->get(),$mapping);
         return $mapping;
         return $mapping;
     }
     }
-}
+}

+ 53 - 16
app/Services/OrderPackageReceivedSyncService.php

@@ -49,7 +49,7 @@ class OrderPackageReceivedSyncService
             //sf
             //sf
             if (array_key_exists('SF', $logisticNumbers)) {
             if (array_key_exists('SF', $logisticNumbers)) {
                 $SFLogisticNumbers = $logisticNumbers['SF'];
                 $SFLogisticNumbers = $logisticNumbers['SF'];
-                LogService::log(OrderPackageReceivedSyncService::class, "同步快递信息定时方法-SF", $SFLogisticNumbers);
+                LogService::log(OrderPackageReceivedSyncService::class, "同步快递信息定时方法-SF", '');
                 foreach ($SFLogisticNumbers as $logisticNumber) {
                 foreach ($SFLogisticNumbers as $logisticNumber) {
                     LogisticSFSync::dispatch($logisticNumber);
                     LogisticSFSync::dispatch($logisticNumber);
                 }
                 }
@@ -57,7 +57,7 @@ class OrderPackageReceivedSyncService
             //更新中通
             //更新中通
             if (array_key_exists('ZTO', $logisticNumbers)) {
             if (array_key_exists('ZTO', $logisticNumbers)) {
                 $ZTOLogisticNumbers = $logisticNumbers['ZTO'];
                 $ZTOLogisticNumbers = $logisticNumbers['ZTO'];
-                LogService::log(OrderPackageReceivedSyncService::class, "同步快递信息定时方法-ZTO", $ZTOLogisticNumbers);
+                LogService::log(OrderPackageReceivedSyncService::class, "同步快递信息定时方法-ZTO", '');
                 foreach ($ZTOLogisticNumbers as $logisticNumber) {
                 foreach ($ZTOLogisticNumbers as $logisticNumber) {
                     LogisticZopSync::dispatch($logisticNumber);
                     LogisticZopSync::dispatch($logisticNumber);
                 }
                 }
@@ -65,40 +65,77 @@ class OrderPackageReceivedSyncService
             //更新韵达
             //更新韵达
             if (array_key_exists('YUNDA', $logisticNumbers)) {
             if (array_key_exists('YUNDA', $logisticNumbers)) {
                 $YDLogisticNumbers = $logisticNumbers['YUNDA'];
                 $YDLogisticNumbers = $logisticNumbers['YUNDA'];
-                LogService::log(OrderPackageReceivedSyncService::class, "同步快递信息定时方法-YUNDA", $YDLogisticNumbers);
+                LogService::log(OrderPackageReceivedSyncService::class, "同步快递信息定时方法-YUNDA", '');
                 foreach ($YDLogisticNumbers as $logistic_number) {
                 foreach ($YDLogisticNumbers as $logistic_number) {
                     LogisticYDSync::dispatch($logistic_number);
                     LogisticYDSync::dispatch($logistic_number);
                 }
                 }
             }
             }
             //更新圆通
             //更新圆通
-            if (array_key_exists('YTO', $logisticNumbers)) {
-                $YTOLogisticNumbers = $logisticNumbers['YTO'];
-                LogService::log(OrderPackageReceivedSyncService::class, "同步快递信息定时方法-YTO", $YTOLogisticNumbers);
-                foreach ($YTOLogisticNumbers as $logistic_number) {
-                    LogisticYTOSync::dispatch($logistic_number);
-                }
-            }
+//            if (array_key_exists('YTO', $logisticNumbers)) {
+//                $YTOLogisticNumbers = $logisticNumbers['YTO'];
+//                LogService::log(OrderPackageReceivedSyncService::class, "同步快递信息定时方法-YTO", $YTOLogisticNumbers);
+//                foreach ($YTOLogisticNumbers as $logistic_number) {
+//                    LogisticYTOSync::dispatch($logistic_number);
+//                }
+//            }
         });
         });
     }
     }
 
 
     public function syncLogisticRouteByAliJiSu()
     public function syncLogisticRouteByAliJiSu()
     {
     {
-        ini_set('max_execution_time', 60);
-        LogService::log(OrderPackageReceivedSyncService::class, "阿里同步快递信息定时方法", '');
+        ini_set('max_execution_time', 2 * 60 * 60);
         $query = OrderPackage::query()
         $query = OrderPackage::query()
             ->select(['logistic_number', 'order_id'])
             ->select(['logistic_number', 'order_id'])
             ->whereIn('order_id',function ($query){
             ->whereIn('order_id',function ($query){
                 $query->from('orders')->selectRaw('id')->whereIn('logistic_id',function ($builder){
                 $query->from('orders')->selectRaw('id')->whereIn('logistic_id',function ($builder){
-                    $builder->from('logistics')->selectRaw('id')->where('type','!=','物流')->whereNotIn('belong_company',['顺丰','中通','韵达','圆通']);
+                    $builder->from('logistics')->selectRaw('id')->where('type','!=','物流')->whereNotIn('belong_company',['顺丰','中通','韵达','圆通','京东']);
                 });
                 });
             });
             });
         $query = $query->where('sent_at', '>=', now()->subDays(20))
         $query = $query->where('sent_at', '>=', now()->subDays(20))
             ->whereNull('received_at');
             ->whereNull('received_at');
         $query->chunk(200, function ($orderPackages) {
         $query->chunk(200, function ($orderPackages) {
+            LogService::log(OrderPackageReceivedSyncService::class, "同步快递信息定时方法-阿里公用接口", json_encode($orderPackages));
             foreach ($orderPackages as $orderPackage){
             foreach ($orderPackages as $orderPackage){
                 if ($orderPackage && $orderPackage->logistic_number)LogisticAliJiSuSync::dispatch($orderPackage->logistic_number);
                 if ($orderPackage && $orderPackage->logistic_number)LogisticAliJiSuSync::dispatch($orderPackage->logistic_number);
             }
             }
         });
         });
+        $this->syncLogisticRouteJD();
+    }
+    public function syncLogisticRouteJD(){
+        ini_set('max_execution_time', 60);
+        $query = OrderPackage::query()
+            ->select(['logistic_number', 'order_id'])
+            ->whereIn('order_id',function ($query){
+                $query->from('orders')->selectRaw('id')->whereIn('logistic_id',function ($builder){
+                    $builder->from('logistics')->selectRaw('id')->where('type','!=','物流')->where('belong_company','京东');
+                });
+            });
+        $query = $query->where('created_at', '>=', now()->subDays(20))
+            ->whereNull('received_at')->where('logistic_number','like','JD%');
+        $query->chunk(200, function ($orderPackages) {
+            LogService::log(OrderPackageReceivedSyncService::class, "同步快递信息定时方法-JD", json_encode($orderPackages));
+            foreach ($orderPackages as $orderPackage){
+                if ($orderPackage && $orderPackage->logistic_number)LogisticAliJiSuSync::dispatch($orderPackage->logistic_number);
+            }
+        });
+    }
+    public function syncLogisticRouteYTO(){
+        ini_set('max_execution_time', 120);
+        $query = OrderPackage::query()
+            ->select(['logistic_number', 'order_id'])
+            ->whereIn('order_id',function ($query){
+                $query->from('orders')->selectRaw('id')->whereIn('logistic_id',function ($builder){
+                    $builder->from('logistics')->selectRaw('id')->where('type','!=','物流')->where('belong_company','圆通');
+                });
+            });
+        $query = $query->where('sent_at', '>=', now()->subDays(20))
+            ->whereNull('received_at');
+        $query->chunk(1000, function ($orderPackages) {
+            LogService::log(OrderPackageReceivedSyncService::class, "同步快递信息定时方法-YTO", json_encode($orderPackages));
+            foreach ($orderPackages as $orderPackage){
+                if ($orderPackage && $orderPackage->logistic_number)LogisticYTOSync::dispatch($orderPackage->logistic_number);
+            }
+        });
     }
     }
     /**
     /**
      * 根据传递的承运商与快递单号更新快递信息
      * 根据传递的承运商与快递单号更新快递信息
@@ -190,7 +227,6 @@ class OrderPackageReceivedSyncService
             try {
             try {
                 $logisticCode = $orderPackage->order->logistic->code;
                 $logisticCode = $orderPackage->order->logistic->code;
             } catch (Exception $e) {
             } catch (Exception $e) {
-                LogService::log(OrderPackageReceivedSyncService::class, "快递同步按照承运商分组异常", $orderPackage->id);
                 continue;
                 continue;
             }
             }
             $key = config('api_logistic.logistic.' . $logisticCode);
             $key = config('api_logistic.logistic.' . $logisticCode);
@@ -211,6 +247,7 @@ class OrderPackageReceivedSyncService
     public function setExceptionType(array $data, $lastRouteDate): array
     public function setExceptionType(array $data, $lastRouteDate): array
     {
     {
         //设置默认异常为否
         //设置默认异常为否
+
         $data['exception_type'] = '无';
         $data['exception_type'] = '无';
         $data['exception'] = '否';
         $data['exception'] = '否';
         $logistic_number = $data['logistic_number'];
         $logistic_number = $data['logistic_number'];
@@ -325,7 +362,7 @@ class OrderPackageReceivedSyncService
             $conclusion |= ($last_routed_duration > $SHORT_RESPONSE_HOURS && $last_routed_duration < $LONG_RESPONSE_HOURS) ? $IS_SHORT_NO_RESPONSE : 0;
             $conclusion |= ($last_routed_duration > $SHORT_RESPONSE_HOURS && $last_routed_duration < $LONG_RESPONSE_HOURS) ? $IS_SHORT_NO_RESPONSE : 0;
             $conclusion |= ($last_routed_duration > $LONG_RESPONSE_HOURS) ? $IS_LONG_NO_RESPONSE : 0;
             $conclusion |= ($last_routed_duration > $LONG_RESPONSE_HOURS) ? $IS_LONG_NO_RESPONSE : 0;
             $conclusion |= ($last_routed_duration > $SENDING_RESPONSE_HOURS && $data['status'] == '派送中') ? $IS_SENDING_NO_RESPONSE : 0;
             $conclusion |= ($last_routed_duration > $SENDING_RESPONSE_HOURS && $data['status'] == '派送中') ? $IS_SENDING_NO_RESPONSE : 0;
-            $conclusion |= ($delivered_duration > $HAVEN_SECOND_GOT_HOURS && $data['routes_length'] < 3) ? $IS_SECOND_ROUTE_HAVE : 0;//和出库时间比较 超过指定时间,路由信息小于三
+            $conclusion |= ($delivered_duration > $HAVEN_SECOND_GOT_HOURS && $data['routes_length'] < 3) ? $IS_SECOND_ROUTE_HAVE : 0;//超过指定时间,路由信息小于两
             return $conclusion;
             return $conclusion;
         })();
         })();
         switch ($conclusion) {
         switch ($conclusion) {
@@ -352,7 +389,7 @@ class OrderPackageReceivedSyncService
         }
         }
         if ($conclusion
         if ($conclusion
             == ($conclusion | $IS_SECOND_ROUTE_HAVE)) {
             == ($conclusion | $IS_SECOND_ROUTE_HAVE)) {
-            $data['exception_type'] = '件异常';
+            $data['exception_type'] = '件异常';
             $data['exception'] = '是';
             $data['exception'] = '是';
 
 
         }
         }

+ 66 - 58
app/Services/OwnerLogisticFeeDetailService.php

@@ -2,11 +2,13 @@
 
 
 namespace App\Services;
 namespace App\Services;
 
 
+use App\Logistic;
 use App\OwnerFeeDetail;
 use App\OwnerFeeDetail;
 use App\Traits\ServiceAppAop;
 use App\Traits\ServiceAppAop;
 use App\OwnerLogisticFeeDetail;
 use App\OwnerLogisticFeeDetail;
 use Carbon\Carbon;
 use Carbon\Carbon;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Pagination\LengthAwarePaginator;
 use Illuminate\Support\Collection;
 use Illuminate\Support\Collection;
 
 
 class OwnerLogisticFeeDetailService
 class OwnerLogisticFeeDetailService
@@ -25,71 +27,77 @@ class OwnerLogisticFeeDetailService
      * @param string $owner_id
      * @param string $owner_id
      * @param string $start
      * @param string $start
      * @param string $end
      * @param string $end
-     * @return array
+     * @param $paginateParams
+     * @return LengthAwarePaginator
      */
      */
-    public function getDetails(string $owner_id, string $start, string $end): array
+    public function getDetails(string $owner_id, string $start, string $end, $paginateParams): LengthAwarePaginator
     {
     {
-        $ownerFeeDetailIds = OwnerFeeDetail::query()->selectRaw('id')
+        $ownerLogisticFeeDetails = $this->getSql($owner_id, $start, $end)
+            ->paginate($paginateParams['paginate'] ?? 50);
+        $items = $this->buildDetails($ownerLogisticFeeDetails);
+        return new LengthAwarePaginator(
+            $items,
+            $ownerLogisticFeeDetails->total(),
+            $ownerLogisticFeeDetails->perPage(),
+            $ownerLogisticFeeDetails->currentPage(),
+            ["path" => $ownerLogisticFeeDetails->path(), "pageName" => "page"]
+        );
+    }
+
+    /**
+     * @param Builder $logistic_ids
+     * @param string $owner_id
+     * @param string $start
+     * @param string $end
+     * @return Builder
+     */
+    private function getOwnerFeeDetailQuery(Builder $logistic_ids, string $owner_id, string $start, string $end): Builder
+    {
+        return OwnerFeeDetail::query()->selectRaw('id')
             ->where('type', '发货')
             ->where('type', '发货')
             ->where('outer_table_name', 'orders')
             ->where('outer_table_name', 'orders')
-            ->whereHas('logistic', function (Builder $query) {
-                $query->where('type', '快递');
-            })
+            ->whereIn('logistic_id', $logistic_ids)
             ->where('owner_id', $owner_id)
             ->where('owner_id', $owner_id)
             ->where('worked_at', '>=', Carbon::parse($start)->startOfDay())
             ->where('worked_at', '>=', Carbon::parse($start)->startOfDay())
-            ->where('worked_at', '<=', Carbon::parse($end)->endOfDay())->pluck('id');
-        $ownerLogisticFeeDetails = OwnerLogisticFeeDetail::query()->with(['ownerFeeDetail.logistic', 'ownerFeeDetailLogistic'])->whereIn('owner_fee_detail_id', $ownerFeeDetailIds)->paginate();
-        dd($ownerLogisticFeeDetails);
+            ->where('worked_at', '<=', Carbon::parse($end)->endOfDay());
+    }
+
+    /**
+     * @param string $owner_id
+     * @param string $start
+     * @param string $end
+     * @return Builder
+     */
+    public function getSql(string $owner_id, string $start, string $end): Builder
+    {
+        return OwnerLogisticFeeDetail::query()->with([
+            'ownerFeeDetail:id,province,weight,logistic_fee',
+            'ownerFeeDetailLogistic:id,weight,logistic_fee,logistic_bill',
+            'logistic:id,name'
+        ])
+            ->whereIn('owner_fee_detail_id', $this->getOwnerFeeDetailQuery(Logistic::query()->selectRaw('id')->where('type', '快递'), $owner_id, $start, $end))
+            ->orderBy('logistic_id');
+    }
 
 
-//         $ownerFeeDetails = OwnerFeeDetail::query()
-//            ->with(['ownerLogisticFeeDetail:id,logistic_bill,initial_weight_price,additional_price', 'items.logistic:id,name','items.ownerLogisticFeeDetail:id,logistic_bill,initial_weight_price,additional_price', 'logistic:id,name,type'])
-//            ->where('type', '发货')
-//            ->where('outer_table_name', 'orders')
-//            ->whereHas('logistic', function (Builder $query) {
-//                $query->where('type', '快递');
-//            })
-//            ->where('owner_id', $owner_id)
-//            ->where('worked_at', '>=', Carbon::parse($start)->startOfDay())
-//            ->where('worked_at', '<=', Carbon::parse($end)->endOfDay())
-//            ->get();
-//        $result = [];
-//        foreach ($ownerFeeDetails as $ownerFeeDetail) {
-//            if ($ownerFeeDetail->items->count()==0) {//只有一个包裹
-//                $result[] = [
-//                    'logistic_name' => $ownerFeeDetail->logistic->name ?? '',//快递公司
-//                    'province' => $ownerFeeDetail->province,//省份
-//                    'logistic_bill' => $ownerFeeDetail->logistic_bill ?? '',//快递单号
-//                    'weight' => $ownerFeeDetail->weight,//重量
-//                    'logistic_fee' => $ownerFeeDetail->logistic_fee,//快递费
-//                    'initial_weight_price' => $ownerFeeDetail->ownerLogisticFeeDetail->initial_weight_price ?? '',//首重价格
-//                    'additional_price' => $ownerFeeDetail->ownerLogisticFeeDetail->additional_price ?? '',//续重价格
-//                ];
-//            } else {//多个包裹
-//                foreach ($ownerFeeDetail->items as $ownerFeeDetailLogistic) {
-//                    $result[] = [
-//                        'logistic_name' => $ownerFeeDetail->logistic->name ?? '',//快递公司
-//                        'province' => $ownerFeeDetail->province,//省份
-//                        'logistic_bill' => $ownerFeeDetailLogistic->logistic_bill,//快递单号
-//                        'weight' => $ownerFeeDetailLogistic->weight,//重量
-//                        'logistic_fee' => $ownerFeeDetailLogistic->logistic_fee,//快递费
-//                        'initial_weight_price' => $ownerFeeDetailLogistic->ownerLogisticFeeDetail->initial_weight_price ?? '',//首重价格
-//                        'additional_price' => $ownerFeeDetailLogistic->ownerLogisticFeeDetail->additional_price ?? '',//续重价格
-//                    ];
-//                }
-//            }
-//        }
-        $result = [];
-        foreach ($ownerLogisticFeeDetails->items() as $ownerLogisticFeeDetail) {
-                $result[] = [
-                    'logistic_name' => $ownerLogisticFeeDetail->ownerFeeDetail->logistic->name ?? '',//快递公司
-                    'province' => $ownerLogisticFeeDetail->ownerFeeDetail->province,//省份
-                    'logistic_bill' => $ownerLogisticFeeDetail->logistic_bill ?? '',//快递单号
-                    'weight' => $ownerLogisticFeeDetail->ownerFeeDetailLogistic->weight,//重量
-                    'logistic_fee' => $ownerLogisticFeeDetail->ownerFeeDetailLogistic->logistic_fee,//快递费
-                    'initial_weight_price' => $ownerLogisticFeeDetail->initial_weight_price ?? '',//首重价格
-                    'additional_price' => $ownerLogisticFeeDetail->additional_price ?? '',//续重价格
-                ];
+    /**
+     * @param  $ownerLogisticFeeDetails
+     * @return array
+     */
+    public function buildDetails($ownerLogisticFeeDetails): array
+    {
+        $items = [];
+        foreach ($ownerLogisticFeeDetails as $ownerLogisticFeeDetail) {
+            $items[] = [
+                'id' => $ownerLogisticFeeDetail->id,
+                'logistic_name' => $ownerLogisticFeeDetail->logistic->name ?? '',//快递公司
+                'province' => $ownerLogisticFeeDetail->province,//省份
+                'logistic_bill' => $ownerLogisticFeeDetail->logistic_bill ?? '',//快递单号
+                'weight' => $ownerLogisticFeeDetail->ownerFeeDetailLogistic->weight ?? $ownerLogisticFeeDetail->ownerFeeDetail->weight ?? '0.00',//重量
+                'initial_weight_price' => $ownerLogisticFeeDetail->initial_weight_price ?? '',//首重价格
+                'additional_price' => $ownerLogisticFeeDetail->additional_price ?? '',//续重价格
+                'logistic_fee' => $ownerLogisticFeeDetail->ownerFeeDetailLogistic->logistic_fee ?? $ownerLogisticFeeDetail->ownerFeeDetail->logistic_fee ?? '0.00',//快递费
+            ];
         }
         }
-        return $result;
+        return $items;
     }
     }
 }
 }

+ 103 - 3
app/Services/OwnerLogisticFeeReportService.php

@@ -1,13 +1,113 @@
-<?php 
+<?php
 
 
 namespace App\Services;
 namespace App\Services;
 
 
+use App\OwnerLogisticFeeDetail;
 use App\Traits\ServiceAppAop;
 use App\Traits\ServiceAppAop;
 use App\OwnerLogisticFeeReport;
 use App\OwnerLogisticFeeReport;
+use Carbon\Carbon;
+use Illuminate\Contracts\Pagination\LengthAwarePaginator;
+use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Database\Eloquent\Collection;
 
 
 class OwnerLogisticFeeReportService
 class OwnerLogisticFeeReportService
 {
 {
     use ServiceAppAop;
     use ServiceAppAop;
-    protected $modelClass=OwnerLogisticFeeReport::class;
 
 
-}
+    protected $modelClass = OwnerLogisticFeeReport::class;
+
+    private $reportDate;
+
+    /**
+     * 生成报表数据
+     * 如果参数$date为空 统计上一个月的
+     * 如果参数$date为2021-01-01 则统计2021-01-01 -- 2021-01-31之间的数据
+     * @param null $date 统计月份,默认统计上个月的 2021-05-01
+     */
+    public function recordReport($date = null)
+    {
+        if (is_null($date)) {
+            //默认统计上个月的数据
+            $date = now()->subMonth()->startOfMonth()->toDateTimeString();
+        }
+        $this->reportDate = $date;
+
+        $start = $this->reportDate;
+        $end = Carbon::parse($this->reportDate)->endOfMonth()->toDateTimeString();
+
+
+        $ownerLogisticFeeDetails = OwnerLogisticFeeDetail::query()
+            ->selectRaw("logistic_id,province,DATE_FORMAT(created_at,'%Y-%m-%d') as counted_date,initial_weight,initial_weight_price,count(1) as initial_amount,additional_price,additional_weight,sum(additional_weigh_weight) as additional_amount,created_at,owner_id")
+            ->whereBetween('created_at', [$start, $end])
+            ->groupBy('initial_weight', 'initial_weight_price', 'additional_price', 'additional_weight', 'logistic_id', 'province', 'counted_date', 'owner_id')
+            ->get();
+        $ownerLogisticFeeReportArray = [];
+
+        foreach ($ownerLogisticFeeDetails as $ownerLogisticFeeDetail) {
+            $ownerLogisticFeeReportArray[] = [
+                'logistic_id' => $ownerLogisticFeeDetail->logistic_id,
+                'province' => $ownerLogisticFeeDetail->province,
+                'counted_date' => Carbon::parse($ownerLogisticFeeDetail->counted_date)->firstOfMonth()->toDateString(),
+                'initial_weight' => $ownerLogisticFeeDetail->initial_weight,
+                'initial_weight_price' => $ownerLogisticFeeDetail->initial_weight_price,
+                'initial_amount' => $ownerLogisticFeeDetail->initial_amount,
+                'additional_weight' => $ownerLogisticFeeDetail->additional_weight,
+                'additional_price' => $ownerLogisticFeeDetail->additional_price,
+                'additional_amount' => $ownerLogisticFeeDetail->additional_amount,
+                'fee' => ($ownerLogisticFeeDetail['initial_weight_price'] * $ownerLogisticFeeDetail['initial_amount']) + ($ownerLogisticFeeDetail['additional_amount'] * $ownerLogisticFeeDetail['additional_price']),
+                'owner_id' => $ownerLogisticFeeDetail->owner_id,
+            ];
+        }
+        OwnerLogisticFeeReport::query()->insertOrIgnore($ownerLogisticFeeReportArray);
+    }
+
+    /**
+     * 订单统计分页查询
+     * @param $owner_id
+     * @param $date string 查询的年月 2021-05-01
+     * @param $paginateParams
+     * @return LengthAwarePaginator
+     */
+    public function getRecordPagination($owner_id, string $date,$paginateParams): LengthAwarePaginator
+    {
+        return $this->getSql($owner_id, $date)
+            ->paginate($paginateParams['paginate']??50);
+    }
+
+    /**
+     * 订单总计查询
+     * @param $owner_id
+     * @param $date string 查询的年月 2021-05-01
+     * @return array
+     */
+    public function getRecordTotal($owner_id, string $date): array
+    {
+        $logistic_fee = OwnerLogisticFeeReport::query()
+            ->where('owner_id', $owner_id)
+            ->where('counted_date', $date)
+            ->sum('fee');
+        $order_count = (int)OwnerLogisticFeeReport::query()
+            ->where('owner_id', $owner_id)
+            ->where('counted_date', $date)
+            ->sum('initial_amount');
+        return [
+            'logistic_fee' => $logistic_fee,
+            'order_count' => $order_count,
+        ];
+    }
+
+    /**
+     * @param $owner_id
+     * @param string $date
+     * @return Builder
+     */
+    public function getSql($owner_id, string $date): Builder
+    {
+        return OwnerLogisticFeeReport::query()
+            ->with('logistic:id,name')
+            ->where('owner_id', $owner_id)
+            ->where('counted_date', $date)
+            ->orderByDesc('logistic_id')
+            ->orderByDesc('province');
+    }
+}

ファイルの差分が大きいため隠しています
+ 66 - 484
composer.lock


+ 17 - 14
database/factories/OwnerFeeDetailFactory.php

@@ -6,20 +6,23 @@ use App\OwnerFeeDetail;
 use Faker\Generator as Faker;
 use Faker\Generator as Faker;
 
 
 $factory->define(OwnerFeeDetail::class, function (Faker $faker) {
 $factory->define(OwnerFeeDetail::class, function (Faker $faker) {
-    $type = ["发货","收货","增值服务"];
+    $type = ["发货", "收货", "增值服务"];
+    $province = ['北京', '广东省', '湖北省', '广东省', '四川省', '上海', '山西省', '上海', '江西省', '贵州省', '湖南省', '广东省', '云南省', '山东省', '贵州省', '云南省', '新疆维吾尔自治区', '辽宁省', '福建省'];
+
     return [
     return [
-        "owner_id"          => factory(\App\Owner::class),         //货主ID
-        "worked_at"         => $faker->date(),//作业时间
-        "type"              => $type[array_rand($type)],//类型
-        "shop_id"           => factory(\App\Shop::class),//店铺ID
-        "operation_bill"    => \Illuminate\Support\Str::random(10),//发/收/退/提货单号
-        "consignee_name"    => $faker->name,   //收件人
-        "consignee_phone"   => $faker->phoneNumber,  //收件人电话
-        "commodity_amount"  => mt_rand(0,100), //商品数量
-        "logistic_bill"     => \Illuminate\Support\Str::random(12),    //快递单号
-        "volume"            => mt_rand(10,2600) / 88,//体积
-        "weight"            => mt_rand(10,2600) / 88,           //重量
-        "work_fee"          =>mt_rand(100,10000) / 10,         //作业费
-        "logistic_fee"      =>mt_rand(100,10000) / 10,     //物流费
+        "owner_id" => factory(\App\Owner::class),         //货主ID
+        "worked_at" => $faker->date(),//作业时间
+        "type" => $type[array_rand($type)],//类型
+        "shop_id" => factory(\App\Shop::class),//店铺ID
+        "operation_bill" => \Illuminate\Support\Str::random(10),//发/收/退/提货单号
+        "consignee_name" => $faker->name,   //收件人
+        "consignee_phone" => $faker->phoneNumber,  //收件人电话
+        "commodity_amount" => mt_rand(0, 100), //商品数量
+        "logistic_bill" => \Illuminate\Support\Str::random(12),    //快递单号
+        "volume" => mt_rand(10, 2600) / 88,//体积
+        "weight" => mt_rand(10, 2600) / 88,           //重量
+        "work_fee" => mt_rand(100, 10000) / 10,         //作业费
+        "logistic_fee" => mt_rand(100, 10000) / 10,     //物流费
+        "province" => $faker->randomElement($province),     //物流费
     ];
     ];
 });
 });

+ 13 - 5
database/factories/OwnerLogisticFeeDetailFactory.php

@@ -6,12 +6,20 @@ use App\OwnerLogisticFeeDetail;
 use Faker\Generator as Faker;
 use Faker\Generator as Faker;
 
 
 $factory->define(OwnerLogisticFeeDetail::class, function (Faker $faker) {
 $factory->define(OwnerLogisticFeeDetail::class, function (Faker $faker) {
+    $province = ['北京', '广东省', '湖北省', '广东省', '四川省', '上海', '山西省', '上海', '江西省', '贵州省', '湖南省', '广东省', '云南省', '山东省', '贵州省', '云南省', '新疆维吾尔自治区', '辽宁省', '福建省'];
+    $logistic_ids = \App\Logistic::query()->pluck('id')->toArray();
     return [
     return [
-        'owner_fee_detail_id'=>random_int(1,100),
-        'logistic_bill'=>$faker->uuid,
-        'initial_weight'=>random_int(1,100),
-        'initial_weight_price'=>random_int(1,100),
-        'additional_weight'=>random_int(1,100),
+        'owner_fee_detail_id' => random_int(1, 100),
+        'logistic_bill' => $faker->uuid,
+        'initial_weight' => random_int(1, 100),
+        'initial_weight_price' => random_int(1, 100),
+        'additional_weight' => random_int(1, 100),
         'additional_price' => random_int(1, 100),
         'additional_price' => random_int(1, 100),
+        'logistic_id' => $faker->randomElement($logistic_ids),
+        'province' => $faker->randomElement($province),
+        'owner_id' => 8,
+        'additional_weigh_weight' => random_int(1, 100),
+        'created_at' => now()->subMonth()->startOfMonth()->addDays(random_int(1, 28))->toDateTimeString(),
+        'updated_at' => now()->subMonth()->startOfMonth()->addDays(random_int(1, 28))->toDateTimeString(),
     ];
     ];
 });
 });

+ 14 - 1
database/factories/OwnerLogisticFeeReportFactory.php

@@ -6,7 +6,20 @@ use App\OwnerLogisticFeeReport;
 use Faker\Generator as Faker;
 use Faker\Generator as Faker;
 
 
 $factory->define(OwnerLogisticFeeReport::class, function (Faker $faker) {
 $factory->define(OwnerLogisticFeeReport::class, function (Faker $faker) {
+    $province = ['北京', '广东省', '湖北省', '广东省', '四川省', '上海', '山西省', '上海', '江西省', '贵州省', '湖南省', '广东省', '云南省', '山东省', '贵州省', '云南省', '新疆维吾尔自治区', '辽宁省', '福建省'];
+    $logistic_ids = \App\Logistic::query()->pluck('id')->toArray();
     return [
     return [
-        //
+        'owner_logistic_sum_fee_report_id' => random_int(1, 100),
+        'logistic_id' => $faker->randomElement($logistic_ids),
+        'province' => $faker->randomElement($province),
+        'counted_date' => now()->subMonths(random_int(1,12))->startOfMonth()->toDateString(),
+        'initial_weight' => random_int(1, 100),
+        'initial_weight_price' => random_int(1, 100),
+        'initial_amount' => random_int(1, 100),
+        'additional_weight' => random_int(1, 100),
+        'additional_price' => random_int(1, 100),
+        'additional_amount' => random_int(1, 100),
+        'fee' => random_int(1, 100),
+        'owner_id' => 8,
     ];
     ];
 });
 });

+ 38 - 0
database/migrations/2021_06_08_140312_add_logistic_id_to_owner_logistic_fee_details.php

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddLogisticIdToOwnerLogisticFeeDetails extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('owner_logistic_fee_details', function (Blueprint $table) {
+            $table->integer('logistic_id');
+            $table->integer('owner_id');
+            $table->string('province')->comment('省份');
+            $table->decimal('additional_weigh_weight')->comment('续重重量');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('owner_logistic_fee_details', function (Blueprint $table) {
+            $table->dropColumn('logistic_id');
+            $table->dropColumn('province');
+            $table->dropColumn('owner_id');
+            $table->dropColumn('additional_weigh_weight');
+        });
+    }
+}

+ 60 - 0
database/migrations/2021_06_08_144247_add_column_to_owner_logistic_fee_reports.php

@@ -0,0 +1,60 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddColumnToOwnerLogisticFeeReports extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('owner_logistic_fee_reports', function (Blueprint $table) {
+            $table->integer('owner_logistic_sum_fee_report_id');
+            $table->integer('logistic_id');
+            $table->string('province');
+            $table->date('counted_date')->comment('统计年月');
+            $table->decimal('initial_weight')->comment('首重');
+            $table->decimal('initial_weight_price')->comment('首重价格');
+            $table->integer('initial_amount')->comment('首重计量');
+            $table->decimal('additional_weight')->comment('续重');
+            $table->decimal('additional_price')->comment('续重价格');
+            $table->decimal('additional_amount')->comment('续重计量');
+            $table->decimal('fee')->comment('费用');
+            $table->integer('owner_id')->comment('货主');
+
+            $table->dropColumn('created_at');
+            $table->dropColumn('updated_at');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('owner_logistic_fee_reports', function (Blueprint $table) {
+            $table->dropColumn('owner_logistic_sum_fee_report_id');
+            $table->dropColumn('logistic_id');
+            $table->dropColumn('province');
+            $table->dropColumn('counted_date');
+            $table->dropColumn('initial_weight');
+            $table->dropColumn('initial_weight_price');
+            $table->dropColumn('initial_amount');
+            $table->dropColumn('additional_weight');
+            $table->dropColumn('additional_price');
+            $table->dropColumn('additional_amount');
+            $table->dropColumn('fee');
+            $table->dropColumn('owner_id');
+
+            $table->timestamp('created_at');
+            $table->timestamp('updated_at');
+        });
+    }
+}

+ 54 - 1
database/seeds/OwnerLogisticFeeDetailSeeder.php

@@ -1,5 +1,8 @@
 <?php
 <?php
 
 
+use App\OwnerFeeDetail;
+use App\OwnerLogisticFeeDetail;
+use Carbon\Carbon;
 use Illuminate\Database\Seeder;
 use Illuminate\Database\Seeder;
 
 
 class OwnerLogisticFeeDetailSeeder extends Seeder
 class OwnerLogisticFeeDetailSeeder extends Seeder
@@ -11,6 +14,56 @@ class OwnerLogisticFeeDetailSeeder extends Seeder
      */
      */
     public function run()
     public function run()
     {
     {
-        //
+//        $ownerFeeDetails = OwnerFeeDetail::query()
+//            ->with('items')
+//            ->where('type', '发货')
+//            ->where('outer_table_name', 'orders')
+//            ->whereHas('logistic', function ($query) {
+//                $query->where('type', '快递');
+//            })
+//            ->where('owner_id', [12])
+//            ->where('worked_at', '>=', Carbon::parse('2021-05-30')->startOfDay())
+//            ->where('worked_at', '<=', Carbon::parse('2021-05-31')->endOfDay())
+//            ->get();
+//        foreach ($ownerFeeDetails as $ownerFeeDetail) {
+//            factory(\App\OwnerLogisticFeeDetail::class)->create([
+//                'owner_fee_detail_id' => $ownerFeeDetail->id,
+//                'logistic_bill' => $ownerFeeDetail->items->first()->logistic_bill??$ownerFeeDetail->logistic_bill,
+//                'logistic_id'=>$ownerFeeDetail->logistic_id,
+//                'province'=>$ownerFeeDetail->province
+//            ]);
+//        }
+//        factory(\App\OwnerLogisticFeeDetail::class)->times(200)->create(
+//            [
+//                'created_at' =>now()->subMonth()->startOfMonth()->addDays(1),
+//                'updated_at' => now()->subMonth()->startOfMonth()->addDays(2)
+//            ]
+//        );
+//
+//        factory(\App\OwnerLogisticFeeDetail::class)->times(200)->create(
+//            [
+//                'created_at' =>now()->subMonth()->startOfMonth()->addDays(2),
+//                'updated_at' => now()->subMonth()->startOfMonth()->addDays(3)
+//            ]
+//        );
+//
+//        factory(\App\OwnerLogisticFeeDetail::class)->times(200)->create(
+//            [
+//                'created_at' =>now()->subMonth()->startOfMonth()->addDays(3),
+//                'updated_at' => now()->subMonth()->startOfMonth()->addDays(4)
+//            ]
+//        );
+
+        factory(OwnerLogisticFeeDetail::class)->times(200)->create();
+        $details = OwnerLogisticFeeDetail::all();
+        foreach ($details as $detail) {
+            factory(OwnerFeeDetail::class)->create([
+                'type' => '发货',
+                'outer_table_name'=>'orders',
+                'logistic_id'=>$detail->logistic_id,
+                'owner_id'=>$detail->owner_id,
+                'worked_at'=>now()->subMonth()->startOfMonth()->addDays(random_int(1,28)) ->toDateTimeString(),
+            ]);
+        }
     }
     }
 }
 }

+ 1 - 1
database/seeds/OwnerLogisticFeeReportSeeder.php

@@ -11,6 +11,6 @@ class OwnerLogisticFeeReportSeeder extends Seeder
      */
      */
     public function run()
     public function run()
     {
     {
-        //
+        factory(\App\OwnerLogisticFeeReport::class)->times(100)->create(['counted_date'=>'2021-05-01']);
     }
     }
 }
 }

+ 5 - 5
package-lock.json

@@ -1801,7 +1801,7 @@
     },
     },
     "babel-runtime": {
     "babel-runtime": {
       "version": "6.26.0",
       "version": "6.26.0",
-      "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz",
+      "resolved": "https://registry.npm.taobao.org/babel-runtime/download/babel-runtime-6.26.0.tgz",
       "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
       "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
       "requires": {
       "requires": {
         "core-js": "^2.4.0",
         "core-js": "^2.4.0",
@@ -3161,13 +3161,13 @@
     },
     },
     "cyclist": {
     "cyclist": {
       "version": "1.0.1",
       "version": "1.0.1",
-      "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-1.0.1.tgz",
+      "resolved": "https://registry.npm.taobao.org/cyclist/download/cyclist-1.0.1.tgz",
       "integrity": "sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=",
       "integrity": "sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=",
       "dev": true
       "dev": true
     },
     },
     "davidshimjs-qrcodejs": {
     "davidshimjs-qrcodejs": {
       "version": "0.0.2",
       "version": "0.0.2",
-      "resolved": "https://registry.npmjs.org/davidshimjs-qrcodejs/-/davidshimjs-qrcodejs-0.0.2.tgz",
+      "resolved": "https://registry.npm.taobao.org/davidshimjs-qrcodejs/download/davidshimjs-qrcodejs-0.0.2.tgz",
       "integrity": "sha1-LrRCpElWcQed9/eCDM/nT0Wp3sA="
       "integrity": "sha1-LrRCpElWcQed9/eCDM/nT0Wp3sA="
     },
     },
     "de-indent": {
     "de-indent": {
@@ -5441,7 +5441,7 @@
     },
     },
     "jquery.cookie": {
     "jquery.cookie": {
       "version": "1.4.1",
       "version": "1.4.1",
-      "resolved": "https://registry.npmjs.org/jquery.cookie/-/jquery.cookie-1.4.1.tgz",
+      "resolved": "https://registry.npm.taobao.org/jquery.cookie/download/jquery.cookie-1.4.1.tgz",
       "integrity": "sha1-1j3OIJ6raR/mMxbbCMqeR+D5OFs="
       "integrity": "sha1-1j3OIJ6raR/mMxbbCMqeR+D5OFs="
     },
     },
     "js-cookie": {
     "js-cookie": {
@@ -6258,7 +6258,7 @@
     },
     },
     "normalize-wheel": {
     "normalize-wheel": {
       "version": "1.0.1",
       "version": "1.0.1",
-      "resolved": "https://registry.npmjs.org/normalize-wheel/-/normalize-wheel-1.0.1.tgz",
+      "resolved": "https://registry.npm.taobao.org/normalize-wheel/download/normalize-wheel-1.0.1.tgz",
       "integrity": "sha1-rsiGr/2wRQcNhWRH32Ls+GFG7EU="
       "integrity": "sha1-rsiGr/2wRQcNhWRH32Ls+GFG7EU="
     },
     },
     "npm-run-path": {
     "npm-run-path": {

BIN
public/images/QRCodeIMG/4.png


+ 20 - 0
resources/views/finance/menu.blade.php

@@ -0,0 +1,20 @@
+<div class="container-fluid nav2" id="nav2">
+    <div class="card">
+        <ul class="nav nav-pills">
+            @can('结算管理-即时账单')
+            <li class="nav-item">
+                <a target="finance/instantBill" class="nav-link" href="{{url('finance/instantBill')}}" :class="{active:isActive('instantBill',2)}">即时账单</a>
+            </li>@endcan
+            @can('结算管理-即时账单')
+            <li class="nav-item">
+                <a target="finance/billConfirmation" class="nav-link" href="{{url('finance/billConfirmation')}}" :class="{active:isActive('billConfirmation',2)}">账单确认</a>
+            </li>@endcan
+{{--            @can('结算管理-结算账单')--}}
+                <li class="nav-item">
+                    <a target="finance/settlementBills" class="nav-link" href="{{url('finance/settlementBills/logisticFee/report')}}" :class="{active:isActive('settlementBills',2)}">结算账单</a>
+                </li>
+{{--                @endcan--}}
+        </ul>
+    </div>
+</div>
+

+ 171 - 0
resources/views/finance/settlementBills/areaFee/index.blade.php

@@ -0,0 +1,171 @@
+@extends('layouts.app')
+
+@section('content')
+    @include('shared._messages')
+    @include('shared._error')
+    <div id="list" class="d-none">
+        <div class="container-fluid">
+            <div id="form_div"></div>
+            <div class="ml-3 form-inline" id="btn">
+                    <span class="dropdown">
+                        <button type="button"
+                                class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
+                                data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">导出Excel
+                        </button>
+                        <div class="dropdown-menu">
+                            <a class="dropdown-item" @click="ownerFeeExport(false)" href="javascript:">导出勾选内容</a>
+                            <a class="dropdown-item" @click="ownerFeeExport(true)" href="javascript:">导出所有页</a>
+                        </div>
+                    </span>
+            </div>
+            <div class="row">
+                <span class="fa fa-user fa-4x offset-md-3" style="color: #4c2584;opacity: 0.3"></span>
+                <span class="ml-4 mt-2">
+                                <h5 class="font-weight-bold">{{ $owner->name }}</h5>
+                                <p class="text-muted">货主</p>
+                            </span>
+            </div>
+            <table class="table table-striped table-sm text-nowrap table-hover table-bordered" id="table">
+                <tr v-for="(ownerFee,i) in ownerFees"
+                    @click="selectTr===i+1?selectTr=0:selectTr=i+1"
+                    :class="selectTr===i+1?'focusing' : ''">
+                    <td><input class="checkItem" type="checkbox" :value="ownerFee.id"></td>
+                    <td>@{{ i+1 }}</td>
+                    <td v-if="i==0 || ownerFee.logistic_name!== ownerFees[i-1].logistic_name"
+                        :rowspan="calRowspan(ownerFee.logistic_name)" class="text-center pt-4 bg-light">@{{
+                        ownerFee.logistic_name }}
+                    </td>
+                    <td>@{{ ownerFee.province }}</td>
+                    <td>@{{ ownerFee.logistic_bill }}</td>
+                    <td>@{{ ownerFee.weight }}</td>
+                    <td>@{{ ownerFee.initial_weight_price }}</td>
+                    <td>@{{ ownerFee.additional_price }}</td>
+                    <td>@{{ ownerFee.logistic_fee }}</td>
+                </tr>
+            </table>
+            <div class="text-info h5 btn btn">{{$ownerFees->count()}}/{{$ownerFees->total()}}</div>
+            {{$ownerFees->appends($paginateParams)->links()}}
+        </div>
+        <textarea id="clipboardDiv" style="opacity:0"></textarea>
+    </div>
+@endsection
+@section('lastScript')
+    <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
+    <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
+    <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
+    <script>
+        let vue = new Vue({
+            el: "#list",
+            data: {
+                ownerFees: [
+                    @foreach($ownerFees as $ownerFee)
+                        {!! $ownerFee !!}
+                    @endforeach
+                ],
+                owners: [@foreach($owners as $owner){name: '{{ $owner->id }}', value: '{{ $owner->name}}'},@endforeach],
+                selectTr: 0,
+            },
+            created() {
+            },
+            mounted() {
+                $('#list').removeClass('d-none');
+                let _this = this;
+                $(".up").slideUp();
+                let data = [
+                    [
+                        {
+                            name: 'owner_id',
+                            type: 'select',
+                            tip: ['多货主权限选择查看指定货主,默认为权限下的第一个货主'],
+                            placeholder: ['货主'],
+                            data: _this.owners,
+                        },
+                        {
+                            name: 'year',
+                            type: 'select',
+                            tip: ['默认为时间上一个月所属年份'],
+                            placeholder: ['年'],
+                            data: [
+                                {name: 2021, value: 2021},
+                                {name: 2022, value: 2022},
+                                {name: 2023, value: 2023},
+                                {name: 2024, value: 2024},
+                                {name: 2025, value: 2025},
+                                {name: 2026, value: 2026},
+                                {name: 2027, value: 2027},
+                                {name: 2028, value: 2028},
+                                {name: 2029, value: 2029},
+                                {name: 2030, value: 2030},
+                                {name: 2031, value: 2031},
+                                {name: 2032, value: 2032},
+                                {name: 2033, value: 2033},
+                                {name: 2034, value: 2034},
+                                {name: 2035, value: 2035},
+                                {name: 2036, value: 2036},
+
+                            ],
+                        },
+                        {
+                            name: 'month',
+                            type: 'select',
+                            tip: ['默认为上一月'],
+                            placeholder: ['月'],
+                            data: [
+                                {name: 1, value: 1},
+                                {name: 2, value: 2},
+                                {name: 3, value: 3},
+                                {name: 4, value: 4},
+                                {name: 5, value: 5},
+                                {name: 6, value: 6},
+                                {name: 7, value: 7},
+                                {name: 8, value: 8},
+                                {name: 9, value: 9},
+                                {name: 10, value: 10},
+                                {name: 11, value: 11},
+                                {name: 12, value: 12},
+                            ],
+                        },
+                    ]
+                ];
+                _this.form = new query({
+                    el: '#form_div',
+                    condition: data,
+                    appendDom: "btn",
+                });
+                _this.form.init();
+                let column = [
+                    {name: 'index', value: '序号', neglect: true},
+                    {name: 'logistic_name', value: '仓库类型'},
+                    {name: 'province', value: '使用区域'},
+                    {name: 'logistic_bill', value: '数量'},
+                    {name: 'weight', value: '合计面积'},
+                    {name: 'initial_weight_price', value: '单价'},
+                    {name: 'additional_price', value: '金额'},
+                ];
+                new Header({
+                    el: "table",
+                    name: "ownerFee",
+                    column: column,
+                    data: this.ownerFees,
+                    restorationColumn: 'addtime',
+                    fixedTop: ($('#form_div').height()) + ($('#btn').height()) + 1,
+                }).init();
+            },
+            methods: {
+                calRowspan(logistic_name) {
+                    return this.ownerFees.filter(item => item.logistic_name === logistic_name).length;
+                },
+                ownerFeeExport(sign) {
+                    let url = '{{url('finance/settlementBills/logisticFee/ownerFee/export')}}';
+                    let token = '{{ csrf_token() }}';
+                    if (sign) {
+                        excelExport(true, checkData, url, this.total, token);
+                    } else {
+                        excelExport(false, checkData, url, null, token);
+                    }
+                },
+            },
+            filters: {},
+        });
+    </script>
+@endsection

+ 180 - 0
resources/views/finance/settlementBills/logisticFee/detail/index.blade.php

@@ -0,0 +1,180 @@
+@extends('layouts.app')
+
+@section('content')
+    @include('shared._messages')
+    @include('shared._error')
+    <div id="list" class="d-none">
+        <div class="container-fluid">
+            <div id="form_div"></div>
+            <div class="ml-3 form-inline" id="btn">
+                    <span class="dropdown">
+                        <button type="button"
+                                class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
+                                data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">导出Excel
+                        </button>
+                        <div class="dropdown-menu">
+                            <a class="dropdown-item" @click="detailExport(false)" href="javascript:">导出勾选内容</a>
+                            <a class="dropdown-item" @click="detailExport(true)" href="javascript:">导出所有页</a>
+                        </div>
+                    </span>
+            </div>
+            <div class="row">
+                <span class="fa fa-user fa-4x offset-md-3" style="color: #4c2584;opacity: 0.3"></span>
+                <span class="ml-4 mt-2">
+                                <h5 class="font-weight-bold">{{ $owner->name }}</h5>
+                                <p class="text-muted">货主</p>
+                            </span>
+            </div>
+            <table class="table table-striped table-sm text-nowrap table-hover table-bordered" id="table">
+                <tr v-for="(detail,i) in details"
+                    @click="selectTr===i+1?selectTr=0:selectTr=i+1"
+                    :class="selectTr===i+1?'focusing' : ''">
+                    <td><input class="checkItem" type="checkbox" :value="detail.id"></td>
+                    <td>@{{ i+1 }}</td>
+                    <td v-if="i==0 || detail.logistic_name!== details[i-1].logistic_name"
+                        :rowspan="calRowspan(detail.logistic_name)" class="text-center pt-4 bg-light">@{{ detail.logistic_name }}
+                    </td>
+                    <td>@{{ detail.province }}</td>
+                    <td>@{{ detail.logistic_bill }}</td>
+                    <td>@{{ detail.weight }}</td>
+                    <td>@{{ detail.initial_weight_price }}</td>
+                    <td>@{{ detail.additional_price }}</td>
+                    <td>@{{ detail.logistic_fee }}</td>
+                </tr>
+            </table>
+            <div class="text-info h5 btn btn">{{$details->count()}}/{{$details->total()}}</div>
+            {{$details->appends($paginateParams)->links()}}
+        </div>
+        <textarea id="clipboardDiv" style="opacity:0"></textarea>
+    </div>
+@endsection
+@section('lastScript')
+    <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
+    <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
+    <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
+    <script>
+        let vue = new Vue({
+            el: "#list",
+            data: {
+                details: [
+                        @foreach($details as $detail)
+                    {
+                        id: " {!! $detail['id'] !!}",
+                        logistic_name: " {!! $detail['logistic_name'] !!}",
+                        province: " {!! $detail['province'] !!}",
+                        logistic_bill: "{!! $detail['logistic_bill'] !!}",
+                        weight: "{!! $detail['weight'] !!}",
+                        logistic_fee: "{!! $detail['logistic_fee'] !!}",
+                        initial_weight_price: "{!! $detail['initial_weight_price'] !!}",
+                        additional_price: "{!! $detail['additional_price'] !!}"
+                    },
+                    @endforeach
+                ],
+                owners: [@foreach($owners as $owner){name: '{{ $owner->id }}', value: '{{ $owner->name}}'},@endforeach],
+                selectTr: 0,
+            },
+            created() {
+            },
+            mounted() {
+                $('#list').removeClass('d-none');
+                let _this = this;
+                $(".up").slideUp();
+                let data = [
+                    [
+                        {
+                            name: 'owner_id',
+                            type: 'select',
+                            tip: ['多货主权限选择查看指定货主,默认为权限下的第一个货主'],
+                            placeholder: ['货主'],
+                            data: _this.owners,
+                        },
+                        {
+                            name: 'year',
+                            type: 'select',
+                            tip: ['默认为时间上一个月所属年份'],
+                            placeholder: ['年'],
+                            data: [
+                                {name: 2021, value: 2021},
+                                {name: 2022, value: 2022},
+                                {name: 2023, value: 2023},
+                                {name: 2024, value: 2024},
+                                {name: 2025, value: 2025},
+                                {name: 2026, value: 2026},
+                                {name: 2027, value: 2027},
+                                {name: 2028, value: 2028},
+                                {name: 2029, value: 2029},
+                                {name: 2030, value: 2030},
+                                {name: 2031, value: 2031},
+                                {name: 2032, value: 2032},
+                                {name: 2033, value: 2033},
+                                {name: 2034, value: 2034},
+                                {name: 2035, value: 2035},
+                                {name: 2036, value: 2036},
+
+                            ],
+                        },
+                        {
+                            name: 'month',
+                            type: 'select',
+                            tip: ['默认为上一月'],
+                            placeholder: ['月'],
+                            data: [
+                                {name: 1, value: 1},
+                                {name: 2, value: 2},
+                                {name: 3, value: 3},
+                                {name: 4, value: 4},
+                                {name: 5, value: 5},
+                                {name: 6, value: 6},
+                                {name: 7, value: 7},
+                                {name: 8, value: 8},
+                                {name: 9, value: 9},
+                                {name: 10, value: 10},
+                                {name: 11, value: 11},
+                                {name: 12, value: 12},
+                            ],
+                        },
+                    ]
+                ];
+                _this.form = new query({
+                    el: '#form_div',
+                    condition: data,
+                    appendDom : "btn",
+                });
+                _this.form.init();
+                let column = [
+                    {name: 'index', value: '序号', neglect: true},
+                    {name: 'logistic_name', value: '快递公司'},
+                    {name: 'province', value: '省份'},
+                    {name: 'logistic_bill', value: '快递单号'},
+                    {name: 'weight', value: '重量'},
+                    {name: 'initial_weight_price', value: '首重价格'},
+                    {name: 'additional_price', value: '续重价格'},
+                    {name: 'logistic_fee', value: '快递费'},
+                ];
+                new Header({
+                    el: "table",
+                    name: "detail",
+                    column: column,
+                    data: this.details,
+                    restorationColumn: 'addtime',
+                    fixedTop: ($('#form_div').height()) + ($('#btn').height()) + 1,
+                }).init();
+            },
+            methods: {
+                calRowspan(logistic_name) {
+                    return this.details.filter(item => item.logistic_name === logistic_name).length;
+                },
+                detailExport(sign) {
+                    let url = '{{url('finance/settlementBills/logisticFee/detail/export')}}';
+                    let token = '{{ csrf_token() }}';
+                    if (sign) {
+                        excelExport(true, checkData, url, this.total, token);
+                    } else {
+                        excelExport(false, checkData, url, null, token);
+                    }
+                },
+            },
+            filters: {},
+        });
+    </script>
+@endsection

+ 193 - 0
resources/views/finance/settlementBills/logisticFee/report/index.blade.php

@@ -0,0 +1,193 @@
+@extends('layouts.app')
+
+@section('content')
+    @include('shared._messages')
+    @include('shared._error')
+    <div id="list" class="d-none">
+        <div class="container-fluid">
+            <div id="form_div"></div>
+            <div class="ml-3 form-inline" id="btn">
+                    <span class="dropdown">
+                        <button type="button"
+                                class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
+                                data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">导出Excel
+                        </button>
+                        <div class="dropdown-menu">
+                            <a class="dropdown-item" @click="reportExport(false)" href="javascript:">导出勾选内容</a>
+                            <a class="dropdown-item" @click="reportExport(true)" href="javascript:">导出所有页</a>
+                        </div>
+                    </span>
+            </div>
+            <div class="row">
+                <div class="col-4">
+                    <div class="row pt-2">
+                        <span class="fa fa-user fa-4x offset-md-3" style="color: #4c2584;opacity: 0.3"></span>
+                        <span class="ml-4 mt-2">
+                                <h5 class="font-weight-bold">{{ $owner->name }}</h5>
+                                <p class="text-muted">货主</p>
+                            </span>
+                    </div>
+                </div>
+                <div class="col-4">
+                    <div class="row pt-2">
+                        <span class="fa fa-cubes fa-4x offset-md-3" style="color: #9fcdff;opacity: 0.3"></span>
+                        <span class="ml-4 mt-2">
+                                <h5 class="font-weight-bold">{{ $recordTotal['order_count'] }}</h5>
+                                <p class="text-muted">订单量总计</p>
+                            </span>
+                    </div>
+                </div>
+                <div class="col-4">
+                    <div class="row pt-2">
+                        <span class="fa fa-jpy fa-4x offset-md-3" style="color: #2ca02c;opacity: 0.3"></span>
+                        <span class="ml-4 mt-2">
+                        <h5 class="font-weight-bold">{{ $recordTotal['logistic_fee'] }}</h5>
+                        <p class="text-muted">快递金额总计</p>
+                        </span>
+                    </div>
+                </div>
+            </div>
+            <table class="table table-striped table-sm text-nowrap table-hover table-bordered" id="table">
+                <tr v-for="(report,i) in reports"
+                    @click="selectTr===i+1?selectTr=0:selectTr=i+1"
+                    :class="selectTr===i+1?'focusing' : ''">
+                    <td><input class="checkItem" type="checkbox" :value="report.id"></td>
+                    <td>@{{ i+1 }}</td>
+                    <td v-if="i==0 || report.logistic.name!== reports[i-1].logistic.name"
+                        :rowspan="calRowspan(report.logistic.name)" class="text-center pt-4 bg-light">@{{ report.logistic.name }}
+                    </td>
+                    <td>@{{ report.province }}</td>
+                    <td>@{{ report.initial_weight }}</td>
+                    <td>@{{ report.initial_amount }}</td>
+                    <td>@{{ report.additional_weight }}</td>
+                    <td>@{{ report.additional_amount }}</td>
+                    <td>@{{ report.fee }}</td>
+                </tr>
+            </table>
+            <div class="text-info h5 btn btn">{{$reports->count()}}/{{$reports->total()}}</div>
+            {{$reports->appends($paginateParams)->links()}}
+        </div>
+        <textarea id="clipboardDiv" style="opacity:0"></textarea>
+    </div>
+@endsection
+@section('lastScript')
+    <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
+    <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
+    <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
+    <script>
+        let vue = new Vue({
+            el: "#list",
+            data: {
+                reports: [
+                    @foreach($reports as $report)
+                        {!! $report !!},
+                    @endforeach
+                ],
+                owners: [@foreach($owners as $owner){name: '{{ $owner->id }}', value: '{{ $owner->name}}'},@endforeach],
+                selectTr: 0,
+            },
+            created() {
+            },
+            mounted() {
+                $('#list').removeClass('d-none');
+                let _this = this;
+                $(".up").slideUp();
+                let data = [
+                    [
+                        {
+                            name: 'owner_id',
+                            type: 'select',
+                            tip: ['多货主权限选择查看指定货主,默认为权限下的第一个货主'],
+                            placeholder: ['货主'],
+                            data: _this.owners,
+                        },
+                        {
+                            name: 'year',
+                            type: 'select',
+                            tip: ['默认为时间上一个月所属年份'],
+                            placeholder: ['年'],
+                            data: [
+                                {name: 2021, value: 2021},
+                                {name: 2022, value: 2022},
+                                {name: 2023, value: 2023},
+                                {name: 2024, value: 2024},
+                                {name: 2025, value: 2025},
+                                {name: 2026, value: 2026},
+                                {name: 2027, value: 2027},
+                                {name: 2028, value: 2028},
+                                {name: 2029, value: 2029},
+                                {name: 2030, value: 2030},
+                                {name: 2031, value: 2031},
+                                {name: 2032, value: 2032},
+                                {name: 2033, value: 2033},
+                                {name: 2034, value: 2034},
+                                {name: 2035, value: 2035},
+                                {name: 2036, value: 2036},
+
+                            ],
+                        },
+                        {
+                            name: 'month',
+                            type: 'select',
+                            tip: ['默认为上一月'],
+                            placeholder: ['月'],
+                            data: [
+                                {name: 1, value: 1},
+                                {name: 2, value: 2},
+                                {name: 3, value: 3},
+                                {name: 4, value: 4},
+                                {name: 5, value: 5},
+                                {name: 6, value: 6},
+                                {name: 7, value: 7},
+                                {name: 8, value: 8},
+                                {name: 9, value: 9},
+                                {name: 10, value: 10},
+                                {name: 11, value: 11},
+                                {name: 12, value: 12},
+                            ],
+                        },
+                    ]
+                ];
+                _this.form = new query({
+                    el: '#form_div',
+                    condition: data,
+                    appendDom: 'btn'
+                });
+                _this.form.init();
+                let column = [
+                    {name: 'index', value: '序号', neglect: true},
+                    {name: 'logistic.name', value: '快递公司'},
+                    {name: 'province', value: '地区'},
+                    {name: 'initial_weight', value: '首重'},
+                    {name: 'initial_amount', value: '订单数'},
+                    {name: 'additional_weight', value: '续重'},
+                    {name: 'additional_amount', value: '续重合计'},
+                    {name: 'fee', value: '(省份)合计'},
+                ];
+                new Header({
+                    el: "table",
+                    name: "report",
+                    column: column,
+                    data: this.reports,
+                    restorationColumn: 'addtime',
+                    fixedTop: ($('#form_div').height()) + ($('#btn').height()) + 1,
+                }).init();
+            },
+            methods: {
+                calRowspan(logistic_name) {
+                    return this.reports.filter(item => item.logistic.name === logistic_name).length;
+                },
+                reportExport(sign) {
+                    let url = '{{url('finance/settlementBills/logisticFee/report/export')}}';
+                    let token = '{{ csrf_token() }}';
+                    if (sign) {
+                        excelExport(true, checkData, url, this.total, token);
+                    } else {
+                        excelExport(false, checkData, url, null, token);
+                    }
+                },
+            },
+            filters: {},
+        });
+    </script>
+@endsection

+ 3 - 3
resources/views/finance/settlementBills/ownerSundryFee/index.blade.php

@@ -4,9 +4,9 @@
     @include('shared._messages')
     @include('shared._messages')
     @include('shared._error')
     @include('shared._error')
     <div id="list" class="d-none">
     <div id="list" class="d-none">
-        <div class="container-fluid">
-            <div id="form_div"></div>
-            <div class="form-inline" id="btn"></div>
+                <div class="container-fluid">
+                    <div id="form_div"></div>
+                    <div class="form-inline" id="btn"></div>
             <table class="table table-striped table-sm text-nowrap table-hover" id="table">
             <table class="table table-striped table-sm text-nowrap table-hover" id="table">
                 <tr v-for="(owner_sundry_fee_detail,i) in owner_sundry_fee_details"
                 <tr v-for="(owner_sundry_fee_detail,i) in owner_sundry_fee_details"
                     @click="selectTr===i+1?selectTr=0:selectTr=i+1"
                     @click="selectTr===i+1?selectTr=0:selectTr=i+1"

+ 29 - 1
resources/views/maintenance/userLabor/index.blade.php

@@ -92,7 +92,9 @@
                     <td><u class="text-info" style="cursor:pointer" @click="show(userLabor.user_id)">查看详情</u></td>
                     <td><u class="text-info" style="cursor:pointer" @click="show(userLabor.user_id)">查看详情</u></td>
                     <td>
                     <td>
                         @can('临时工-编辑')
                         @can('临时工-编辑')
-                            <button class="btn btn-sm btn-outline-primary" @click="edit(userLabor.user_id)">改</button>@endcan
+                            <button class="btn btn-sm btn-outline-primary" @click="edit(userLabor.user_id)">改</button>
+                            <button class="btn btn-sm btn-outline-success" @click="conversion(userLabor)">转正</button>
+                        @endcan
                         @can('临时工-删除')
                         @can('临时工-删除')
                             <button class="btn btn-sm btn-outline-danger" @click="destroy(userLabor)">删</button> @endcan
                             <button class="btn btn-sm btn-outline-danger" @click="destroy(userLabor)">删</button> @endcan
                             <button class="btn btn-sm btn-outline-dark" @click="workRecord(userLabor.user_id)">劳务记录</button>
                             <button class="btn btn-sm btn-outline-dark" @click="workRecord(userLabor.user_id)">劳务记录</button>
@@ -208,6 +210,32 @@
                             tempTip.show('删除临时工失败!'+'网络错误:' + err);
                             tempTip.show('删除临时工失败!'+'网络错误:' + err);
                         });
                         });
                 },
                 },
+                conversion:function(userLabor){
+                    if(!confirm('确定要将临时工“' + userLabor.user_detail.full_name + '”转正吗?')){return};
+                    let _this=this;
+                    let user_id=userLabor.user_id;
+                    let url = "{{url('maintenance/userLabor/conversion')}}";
+                    axios.post(url,{user_id:user_id}).then(function (response) {
+                            if(response.data.success){
+                                _this.userLabors.every(function (userLabor,i) {
+                                    if (userLabor.user_id==user_id){
+                                        _this.userLabors.splice(i,1);
+                                        return false;
+                                    }
+                                    return true;
+                                });
+                                tempTip.setDuration(3000);
+                                tempTip.showSuccess('转正临时工成功!');
+                                return;
+                            }
+                            tempTip.setDuration(3000);
+                            tempTip.show('转正临时工失败!');
+                        })
+                        .catch(function (err) {
+                            tempTip.setDuration(3000);
+                            tempTip.show('转正临时工失败!'+'网络错误:' + err);
+                        });
+                },
                 relieve(user_id,full_name){
                 relieve(user_id,full_name){
                     let _this=this;
                     let _this=this;
                     axios.post('{{url('maintenance/userLabor/relieve')}}',{user_id:user_id})
                     axios.post('{{url('maintenance/userLabor/relieve')}}',{user_id:user_id})

+ 11 - 11
resources/views/personnel/laborReport/index.blade.php

@@ -522,7 +522,7 @@
                         let oldRemark = span.text();
                         let oldRemark = span.text();
                         let remark = target.val();
                         let remark = target.val();
                         if(remark !== span.text()){
                         if(remark !== span.text()){
-                            let ajaxUrl= '{{url("laborReport/changeLaborReportRemark")}}';
+                            let ajaxUrl= '{{url("personnel/laborReport/changeLaborReportRemark")}}';
                             axios.post(ajaxUrl,{'id':id,'remark':remark}).then(function (response) {
                             axios.post(ajaxUrl,{'id':id,'remark':remark}).then(function (response) {
                                 if(response.data.success){
                                 if(response.data.success){
                                     _this.updateLaborReports(id,remark);
                                     _this.updateLaborReports(id,remark);
@@ -548,7 +548,7 @@
                         let _this = this;
                         let _this = this;
                         let id = target.attr('data_id');
                         let id = target.attr('data_id');
                         let remark = target.val();
                         let remark = target.val();
-                        let ajaxUrl= '{{url("laborReport/changeLaborReportRemark")}}';
+                        let ajaxUrl= '{{url("personnel/laborReport/changeLaborReportRemark")}}';
                         if(remark === ''|| remark === null){
                         if(remark === ''|| remark === null){
                             target.css('width','75px');
                             target.css('width','75px');
                             return;
                             return;
@@ -586,13 +586,13 @@
                         this.selectedStyle=id;
                         this.selectedStyle=id;
                     },
                     },
                     laborReportExport(checkAllSign){
                     laborReportExport(checkAllSign){
-                        let url = '{{url('laborReport/export')}}';
+                        let url = '{{url('personnel/laborReport/export')}}';
                         let token='{{ csrf_token() }}';
                         let token='{{ csrf_token() }}';
                         excelExport(checkAllSign,checkData,url,this.sum,token);
                         excelExport(checkAllSign,checkData,url,this.sum,token);
                     },
                     },
                     //门卫审核
                     //门卫审核
                     guardClockAudit(id,user_duty_check_id){
                     guardClockAudit(id,user_duty_check_id){
-                        let url='{{url("laborReport/guardClockAudit")}}';
+                        let url='{{url("personnel/laborReport/guardClockAudit")}}';
                         let _this=this;
                         let _this=this;
                         axios.post(url,{id:id,user_duty_check_id:user_duty_check_id})
                         axios.post(url,{id:id,user_duty_check_id:user_duty_check_id})
                             .then(function (response) {
                             .then(function (response) {
@@ -620,7 +620,7 @@
                         let _this=this;
                         let _this=this;
                         let id = getSelectId();
                         let id = getSelectId();
                         let remark=document.getElementById('remark').value;
                         let remark=document.getElementById('remark').value;
-                        let url='{{url("laborReport/addRemarkAndGroupClock")}}';
+                        let url='{{url("personnel/laborReport/addRemarkAndGroupClock")}}';
                         if (remark==null|| remark=='' || remark=="undefined"){
                         if (remark==null|| remark=='' || remark=="undefined"){
                             tempTip.setDuration(3000);
                             tempTip.setDuration(3000);
                             tempTip.show("您还未添加任何备注");
                             tempTip.show("您还未添加任何备注");
@@ -653,7 +653,7 @@
                     },
                     },
                     //组长打卡审核
                     //组长打卡审核
                     groupClockAudit(id,userWorkgroupNeedRemark){
                     groupClockAudit(id,userWorkgroupNeedRemark){
-                        let url='{{url("laborReport/groupClockAudit")}}';
+                        let url='{{url("personnel/laborReport/groupClockAudit")}}';
                         let _this=this;
                         let _this=this;
                         if (userWorkgroupNeedRemark){
                         if (userWorkgroupNeedRemark){
                             selectId(id);
                             selectId(id);
@@ -690,7 +690,7 @@
                     noDinner(){
                     noDinner(){
                         let _this=this;
                         let _this=this;
                         let id = _this.laborReportId;
                         let id = _this.laborReportId;
-                        let url='{{url("laborReport/groupExport")}}';
+                        let url='{{url("personnel/laborReport/groupExport")}}';
                         axios.post(url,{id:id})
                         axios.post(url,{id:id})
                             .then(function (response) {
                             .then(function (response) {
                                 if (!response.data.success){
                                 if (!response.data.success){
@@ -717,7 +717,7 @@
                     },
                     },
                     //退场有晚饭时间
                     //退场有晚饭时间
                     makeSureRelax_time(){
                     makeSureRelax_time(){
-                        let url='{{url("laborReport/groupExportEnsure")}}';
+                        let url='{{url("personnel/laborReport/groupExportEnsure")}}';
                         let _this=this;
                         let _this=this;
                         let id = _this.laborReportId;
                         let id = _this.laborReportId;
                         axios.post(url,{id:id,relax_time:_this.relax_time})
                         axios.post(url,{id:id,relax_time:_this.relax_time})
@@ -763,7 +763,7 @@
                             $('#dinnerModal').modal('show');
                             $('#dinnerModal').modal('show');
                             return;
                             return;
                         }
                         }
-                        let url='{{url("laborReport/groupExport")}}';
+                        let url='{{url("personnel/laborReport/groupExport")}}';
                         axios.post(url,{id:id})
                         axios.post(url,{id:id})
                             .then(function (response) {
                             .then(function (response) {
                                 if (!response.data.success){
                                 if (!response.data.success){
@@ -801,7 +801,7 @@
                     },
                     },
                     updateLaborCompany(laborCompanyId,enter_number){
                     updateLaborCompany(laborCompanyId,enter_number){
                         let _this=this;
                         let _this=this;
-                        let url='{{url("laborReport/updateLaborCompany")}}';
+                        let url='{{url("personnel/laborReport/updateLaborCompany")}}';
                         axios.post(url,{enter_number:enter_number,laborCompanyId:laborCompanyId}).then(function (response) {
                         axios.post(url,{enter_number:enter_number,laborCompanyId:laborCompanyId}).then(function (response) {
                             if (!response.data.success){
                             if (!response.data.success){
                                 tempTip.setDuration(3000);
                                 tempTip.setDuration(3000);
@@ -826,7 +826,7 @@
                     删除(id,name){
                     删除(id,name){
                         let _this=this;
                         let _this=this;
                         if(!confirm('确定要删除临时工为:“'+name+'”的报表记录吗?')){return};
                         if(!confirm('确定要删除临时工为:“'+name+'”的报表记录吗?')){return};
-                        let url='{{url("laborReport/删除")}}/'+id;
+                        let url='{{url("personnel/laborReport/删除")}}/'+id;
                         axios.delete(url).then(
                         axios.delete(url).then(
                             function (response) {
                             function (response) {
                                 if(!response.data.success){
                                 if(!response.data.success){

+ 0 - 0
resources/views/personnel/laborReport/menu.blade.php


+ 1 - 1
resources/views/personnel/laborReport/recycle.blade.php

@@ -128,7 +128,7 @@
                     let _this=this;
                     let _this=this;
                     let delArr=[];
                     let delArr=[];
                     if (!confirm('确定要恢复所选内容吗?'))return;
                     if (!confirm('确定要恢复所选内容吗?'))return;
-                    axios.post('{{url('laborReport/recover')}}',{checkData:checkData})
+                    axios.post('{{url('personnel/laborReport/recover')}}',{checkData:checkData})
                         .then(function (response) {
                         .then(function (response) {
                             if (response.data.success){
                             if (response.data.success){
                                 checkData.forEach(function (data) {
                                 checkData.forEach(function (data) {

+ 0 - 0
resources/views/personnel/menu.blade.php


+ 1 - 0
resources/views/transport/waybill/index.blade.php

@@ -5,6 +5,7 @@
     <div class="container-fluid" style="min-width: 1500px;">
     <div class="container-fluid" style="min-width: 1500px;">
         <div class="d-none" id="list">
         <div class="d-none" id="list">
             @include("transport.waybill._batchUploadImg")
             @include("transport.waybill._batchUploadImg")
+            @include("transport.waybill._dailyBilling")
             <div class="container-fluid nav3">
             <div class="container-fluid nav3">
                 <div class="card menu-third" >
                 <div class="card menu-third" >
                     <ul class="nav nav-pills">
                     <ul class="nav nav-pills">

+ 25 - 20
routes/web.php

@@ -92,6 +92,7 @@ Route::group(['prefix'=>'maintenance'],function(){
         Route::post('getWorkRecord', 'UserLaborController@getWorkRecord');
         Route::post('getWorkRecord', 'UserLaborController@getWorkRecord');
         Route::post('getClockRecord', 'UserLaborController@getClockRecord');
         Route::post('getClockRecord', 'UserLaborController@getClockRecord');
         Route::post('relieve', 'UserLaborController@relieve');
         Route::post('relieve', 'UserLaborController@relieve');
+        Route::post('conversion', 'UserLaborController@conversion');
     });
     });
     /** 纸箱 */
     /** 纸箱 */
     Route::group(['prefix'=>'paperBox'],function(){
     Route::group(['prefix'=>'paperBox'],function(){
@@ -588,7 +589,6 @@ Route::group(['prefix'=>'personnel'],function(){
 
 
     Route::get('relating',function (){return view('personnel/menuPersonnel');});
     Route::get('relating',function (){return view('personnel/menuPersonnel');});
 
 
-    Route::resource('laborReport','LaborReportController');
     Route::group(['prefix'=>'discharge'],function(){
     Route::group(['prefix'=>'discharge'],function(){
         /** 卸货任务 */
         /** 卸货任务 */
         Route::group(['prefix'=>'task'],function(){
         Route::group(['prefix'=>'task'],function(){
@@ -612,24 +612,24 @@ Route::group(['prefix'=>'personnel'],function(){
             });
             });
         });
         });
     });
     });
+    /** 临时工报表 */
+    Route::group(['prefix'=>'laborReport'],function(){
+        Route::get('index','LaborReportController@index');
+        Route::post('recover','LaborReportController@recover');
+        Route::get('recycle','LaborReportController@recycle');
+        Route::post('guardClockAudit','LaborReportController@guardClockAudit');
+        Route::post('groupClockAudit','LaborReportController@groupClockAudit');
+        Route::post('addRemarkAndGroupClock','LaborReportController@addRemarkAndGroupClock');
+        Route::post('groupExport','LaborReportController@groupExport');
+        Route::post('groupExportEnsure','LaborReportController@groupExportEnsure');
+        Route::any('export','LaborReportController@export');
+        Route::post('updateLaborCompany','LaborReportController@updateLaborCompany');
+        Route::any('删除/{id}','LaborReportController@删除');
+        Route::post('changeLaborReportRemark', 'LaborReportController@changeLaborReportRemark');
+    });
 });
 });
 
 
-Route::get('getLaborReport','LaborReportController@getDailyLabor');
-
-/** 临时工报表 */
-Route::group(['prefix'=>'laborReport'],function(){
-    Route::post('recover','LaborReportController@recover');
-    Route::get('recycle','LaborReportController@recycle');
-    Route::post('guardClockAudit','LaborReportController@guardClockAudit');
-    Route::post('groupClockAudit','LaborReportController@groupClockAudit');
-    Route::post('addRemarkAndGroupClock','LaborReportController@addRemarkAndGroupClock');
-    Route::post('groupExport','LaborReportController@groupExport');
-    Route::post('groupExportEnsure','LaborReportController@groupExportEnsure');
-    Route::any('export','LaborReportController@export');
-    Route::post('updateLaborCompany','LaborReportController@updateLaborCompany');
-    Route::any('删除/{id}','LaborReportController@删除');
-    Route::post('changeLaborReportRemark', 'LaborReportController@changeLaborReportRemark');
-});
+
 
 
 /** 库存 */
 /** 库存 */
 Route::group(['prefix'=>'inventory'],function(){
 Route::group(['prefix'=>'inventory'],function(){
@@ -779,9 +779,15 @@ Route::group(['prefix'=>'finance'],function(){
     Route::get('billConfirmation','CustomerController@financeBillConfirmation');
     Route::get('billConfirmation','CustomerController@financeBillConfirmation');
     Route::post('updateBillReport','CustomerController@updateBillReport');
     Route::post('updateBillReport','CustomerController@updateBillReport');
     Route::post('billConfirm','CustomerController@billConfirm');
     Route::post('billConfirm','CustomerController@billConfirm');
-//    Route::group(['prefix'=>'settlementBills'],function(){
+    Route::group(['prefix'=>'settlementBills'],function(){
 //        Route::resource('ownerSundryFeeDetails', 'OwnerSundryFeeDetailsController', ['only' => ['index', 'create', 'store', 'update', 'edit','destroy']]);
 //        Route::resource('ownerSundryFeeDetails', 'OwnerSundryFeeDetailsController', ['only' => ['index', 'create', 'store', 'update', 'edit','destroy']]);
-//    });
+        Route::group(['prefix' => 'logisticFee'], function () {
+            Route::any('detail/export', 'OwnerLogisticFeeDetailController@export');
+            Route::any('report/export', 'OwnerLogisticFeeReportController@export');
+            Route::resource('detail', 'OwnerLogisticFeeDetailController', ['only' => ['index']]);
+            Route::resource('report', 'OwnerLogisticFeeReportController', ['only' => ['index']]);
+        });
+    });
 });
 });
 
 
 /** 客户 */
 /** 客户 */
@@ -904,4 +910,3 @@ Route::group(['prefix'=>'procurement'],function () {
 Route::group(['prefix'=>'demand'],function (){
 Route::group(['prefix'=>'demand'],function (){
     Route::get('/','DemandController@index');
     Route::get('/','DemandController@index');
 });
 });
-

+ 3 - 3
tests/Services/LogisticAliJiSuApiService/FormatTest.php

@@ -2,6 +2,7 @@
 
 
 namespace Tests\Services\LogisticAliJiSuApiService;
 namespace Tests\Services\LogisticAliJiSuApiService;
 
 
+use App\Services\LogisticAliJiSuApiService;
 use App\Services\LogisticYDService;
 use App\Services\LogisticYDService;
 use App\Services\LogisticYTOService;
 use App\Services\LogisticYTOService;
 use BeyondCode\DumpServer\DumpServerServiceProvider;
 use BeyondCode\DumpServer\DumpServerServiceProvider;
@@ -13,7 +14,7 @@ class FormatTest extends TestCase
 {
 {
     use TestMockSubServices;
     use TestMockSubServices;
 
 
-    /** @var LogisticYTOService $service */
+    /** @var LogisticAliJiSuApiService $service */
     public $service;
     public $service;
     private $data;
     private $data;
     private $amount = 2;
     private $amount = 2;
@@ -29,10 +30,9 @@ class FormatTest extends TestCase
      */
      */
     public function format_test()
     public function format_test()
     {
     {
-        $response=$this->service->query('9882749294945');
+        $response=$this->service->query('JDVB09966674081');
         if ($response && $response->status==0){
         if ($response && $response->status==0){
             $result = $this->service->format($response);
             $result = $this->service->format($response);
-//            dd($result);
             $this->assertNotEmpty($result);
             $this->assertNotEmpty($result);
         }
         }
 
 

+ 2 - 2
tests/Services/LogisticYTOService/FormatTest.php

@@ -28,11 +28,11 @@ class FormatTest extends TestCase
      */
      */
     public function format_test()
     public function format_test()
     {
     {
-        $response=$this->service->query('YT5481469185320');
+        $response=$this->service->query('YT5555835896970');
         if (is_object($response))$this->assertEquals('1001', $response->code);
         if (is_object($response))$this->assertEquals('1001', $response->code);
         if (!is_object($response)){
         if (!is_object($response)){
             $this->assertNotEmpty($response);
             $this->assertNotEmpty($response);
-            $result = $this->service->format($response);
+            $result = $this->service->format($response,'YT5555835896970');
             $this->assertNotEmpty($result);
             $this->assertNotEmpty($result);
         }
         }
 
 

+ 96 - 0
tests/Services/OwnerLogisticFeeReportService/RecordReportTest.php

@@ -0,0 +1,96 @@
+<?php
+
+namespace Tests\Services\OwnerLogisticFeeReportService;
+
+use App\OwnerLogisticFeeDetail;
+use App\Services\OwnerLogisticFeeReportService;
+use Tests\TestCase;
+use App\OwnerLogisticFeeReport;
+use App\Traits\TestMockSubServices;
+
+class RecordReportTest extends TestCase
+{
+    use TestMockSubServices;
+
+    /** @var OwnerLogisticFeeReportService $service */
+    public $service;
+    private $data;
+    private $amount = 2;
+
+    function setUp(): void
+    {
+        parent::setUp();
+        $this->service = app('OwnerLogisticFeeReportService');
+
+//        $this->data['OwnerLogisticFeeDetail']
+//            = factory(\App\OwnerLogisticFeeDetail::class, $this->amount)
+//            ->create([
+//                'created_at' => now()->subMonth()->startOfMonth()->addDays(1),
+//                'province' => '北京',
+//                'initial_weight_price' => '20',
+//                'additional_price' => '20',
+//                'logistic_id' => '20',
+//            ]);
+    }
+
+    public function testReturned()
+    {
+        $this->assertTrue(true);
+    }
+
+    function tearDown(): void
+    {
+//        OwnerLogisticFeeDetail::query()
+//            ->whereIn('id', data_get($this->data['OwnerLogisticFeeDetail'], '*.id') ?? [])
+//            ->delete();
+        parent::tearDown();
+    }
+
+    /**
+     * @test
+     */
+    public function get_test()
+    {
+        OwnerLogisticFeeDetail::query()->truncate();
+        OwnerLogisticFeeReport::query()->truncate();
+        factory(OwnerLogisticFeeDetail::class)->create([
+            'created_at' => now()->subMonth(),
+            'updated_at' => now()->subMonth(),
+            'province' => '北京',
+            'initial_weight' => '10',
+            'initial_weight_price' => '10',
+            'additional_price' => '10',
+            'additional_weight' => '10',
+
+            'logistic_id' => '1',
+            'owner_id' => '1',
+            'additional_weigh_weight' => '1',
+        ]);
+        factory(OwnerLogisticFeeDetail::class)->create([
+            'created_at' => now()->subMonth(),
+            'updated_at' => now()->subMonth(),
+            'province' => '北京',
+            'initial_weight' => '10',
+            'initial_weight_price' => '10',
+            'additional_price' => '10',
+            'additional_weight' => '10',
+            'logistic_id' => '1',
+            'owner_id' => '1',
+            'additional_weigh_weight' => '1',
+        ]);
+        $this->service->recordReport();
+        $this->assertDatabaseHas('owner_logistic_fee_reports', [
+            'logistic_id' => '1',
+            'province' => '北京',
+            'counted_date' => now()->subMonth()->startOfMonth()->toDateString(),
+            'initial_weight' => '10',
+            'initial_weight_price' => '10',
+            'initial_amount' => '2',
+            'additional_weight' => '10',
+            'additional_price' => '10',
+            'additional_amount' => '2',
+            'fee' => '40',
+            'owner_id' => '1',
+        ]);
+    }
+}

+ 5 - 0
yarn.lock

@@ -3514,6 +3514,11 @@ http-proxy@^1.17.0:
     follow-redirects "^1.0.0"
     follow-redirects "^1.0.0"
     requires-port "^1.0.0"
     requires-port "^1.0.0"
 
 
+http-vue-loader@^1.4.2:
+  version "1.4.2"
+  resolved "https://registry.npm.taobao.org/http-vue-loader/download/http-vue-loader-1.4.2.tgz#98e8c3304f5c1351858eaca60c5d80bf6a244196"
+  integrity sha1-mOjDME9cE1GFjqymDF2Av2okQZY=
+
 https-browserify@^1.0.0:
 https-browserify@^1.0.0:
   version "1.0.0"
   version "1.0.0"
   resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73"
   resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73"

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません