소스 검색

快递同步 周旭需求发布

ANG YU 4 년 전
부모
커밋
6ca2020abc

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

@@ -16,6 +16,7 @@ use App\Jobs\StoreCreateInstantBill;
 use App\MaterialBox;
 use App\MaterialBoxModel;
 use App\Order;
+use App\OrderPackage;
 use App\Owner;
 use App\OwnerFeeDetail;
 use App\OwnerFeeDetailLogistic;
@@ -177,4 +178,9 @@ class TestController extends Controller
         $service->recordReport('2021-08-01');
     }
 
+    public function order_packages_sync_routes_flag_init()
+    {
+        OrderPackage::query()->whereNotNull('transfer_status')->update(['sync_routes_flag'=>true]);
+    }
+
 }

+ 0 - 52
app/Jobs/SettlementBillCountingTask.php

@@ -1,52 +0,0 @@
-<?php
-
-namespace App\Jobs;
-
-use Illuminate\Bus\Queueable;
-use Illuminate\Contracts\Queue\ShouldQueue;
-use Illuminate\Foundation\Bus\Dispatchable;
-use Illuminate\Queue\InteractsWithQueue;
-use Illuminate\Queue\SerializesModels;
-
-/**
- * 生成结算账单统计数据
- * 每月初始执行
- * 统计上月的账单数据
- * Class SettlementBillCountingTask
- * @package App\Jobs
- */
-class SettlementBillCountingTask implements ShouldQueue
-{
-    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
-
-    //货主
-    private $owner_id;
-    //统计月份
-    private $counting_month;
-
-    /**
-     * SettlementBillCountingTask constructor.
-     * @param $owner_id
-     * @param $counting_month
-     */
-    public function __construct($owner_id, $counting_month)
-    {
-        $this->owner_id = $owner_id;
-        $this->counting_month = $counting_month;
-    }
-
-
-    /**
-     * Execute the job.
-     *
-     * @return void
-     */
-    public function handle()
-    {
-        if (is_null($this->owner_id)&&is_null($this->counting_month)) {//未指定统计的参数
-        } else {
-            //清除历史统计记录
-
-        }
-    }
-}

+ 1 - 1
app/Jobs/SettlementBillReportTask.php

@@ -21,7 +21,7 @@ class SettlementBillReportTask implements ShouldQueue
 {
     use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
 
-    public $timeout = 120;
+    public $timeout = 3600;
 
     public $maxExceptions = 3;
 

+ 0 - 62
app/Services/OwnerLogisticFeeReportService.php

@@ -63,68 +63,6 @@ class OwnerLogisticFeeReportService implements \App\Interfaces\SettlementBillRep
         $this->confirmBillFeeTotal($counting_month, $owner_id);
     }
 
-
-//    /**
-//     * 生成报表数据
-//     * 如果参数$counting_month为空 统计上一个月的
-//     * 如果参数$counting_month为2021-01-01 则统计2021-01-01 -- 2021-01-31之间的数据
-//     * @param null $counting_month 统计月份,默认统计上个月的 2021-05-01
-//     */
-//    public function recordReport($counting_month = null)
-//    {
-//        if (is_null($counting_month)) {
-//            //默认统计上个月的数据
-//            $counting_month = now()->subMonth()->startOfMonth()->toDateTimeString();
-//        }
-//        $this->reportDate = $counting_month;
-//
-//        $start = $this->reportDate;
-//        $end = Carbon::parse($this->reportDate)->endOfMonth()->toDateTimeString();
-//
-//
-//        $ownerLogisticFeeDetails = OwnerLogisticFeeDetail::query()
-//            ->selectRaw("logistic_id,
-//            province,
-//            DATE_FORMAT(created_at,
-//            '%Y-%m') as counted_date,
-//            initial_weight,
-//            initial_weight_price,
-//            count(1) as initial_amount,
-//            additional_price,
-//            additional_weight,
-//            sum(additional_weigh_weight) as additional_amount,
-//            sum(tax_fee) as tax_fee,
-//            sum(fee) as fee,
-//            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->fee,
-//                'tax_fee' => $ownerLogisticFeeDetail->tax_fee,
-//                'owner_id' => $ownerLogisticFeeDetail->owner_id,
-//            ];
-//        }
-//        //保证接口幂等性 删除统计月的数据
-//        OwnerLogisticFeeReport::query()->where('counted_date', $counting_month)->delete();
-//
-//        OwnerLogisticFeeReport::query()->insertOrIgnore($ownerLogisticFeeReportArray);
-//    }
-
-
     public function recordReport($counting_month = null)
     {
         if (is_null($counting_month)) {

+ 0 - 65
app/Services/OwnerStoreFeeReportService.php

@@ -95,71 +95,6 @@ class OwnerStoreFeeReportService implements \App\Interfaces\SettlementBillReport
         }
     }
 
-//    /**
-//     * 生成报表数据
-//     * 如果参数$counting_month为空 统计上一个月的
-//     * 如果参数$counting_month为2021-01-01 则统计2021-01-01 -- 2021-01-31之间的数据
-//     * @param null $counting_month 统计月份,默认统计上个月的 2021-05-01
-//     */
-//    public function recordReport($counting_month = null)
-//    {
-//        $this->detailService = app('OwnerStoreFeeDetailService');
-//        if (is_null($counting_month)) {
-//            //默认统计上个月的数据
-//            $counting_month = now()->subMonth()->startOfMonth()->toDateString();
-//        }
-//        $this->reportDate = $counting_month;
-//
-//        $start = $this->reportDate;
-//        $end = Carbon::parse($this->reportDate)->endOfMonth()->toDateString();
-//        $details =
-//            DB::table('owner_store_fee_details')
-//                ->selectRaw("
-//                DATE_FORMAT(owner_store_fee_details.created_at,'%Y-%m') as counting_month,
-//                unit_id,
-//                unit_price,
-//                work_name,
-//                sum(amount) as amounts ,
-//                owner_store_fee_details.owner_id,
-//                owner_fee_detail_id,
-//                sum(owner_store_fee_details.fee) as fee
-//                ")
-//                ->whereBetween('owner_store_fee_details.created_at', [$start, $end])
-//                ->groupBy(
-//                    'counting_month',
-//                    'owner_id',
-//                    'unit_id',
-//                    'unit_price',
-//                    'work_name'
-//                )
-//                ->get();
-//        $reports = [];
-//        foreach ($details as $detail) {
-//            $counting_month = Carbon::parse($detail->counting_month)->startOfMonth()->toDateString();
-//            $ownerBillReport = OwnerBillReport::query()
-//                ->selectRaw("id")
-//                ->where('owner_id', $detail->owner_id)
-//                ->where('counting_month', $counting_month)->first();
-//            $reports[] = [
-//                'owner_bill_report_id' => $ownerBillReport->id ?? null,
-//                'owner_id' => $detail->owner_id,
-//                'counting_month' => $counting_month,
-//                'unit_id' => $detail->unit_id,
-//                'unit_price' => $detail->unit_price,
-//                'amount' => $detail->amounts,
-//                'fee' => $detail->fee,
-//                'work_name' => $detail->work_name,
-//            ];
-//        }
-//        $reports_chunked = array_chunk($reports, 1000);
-//        //保证幂等性 插入前删除该月的统计数据
-//        OwnerStoreFeeReport::query()->where('counting_month', $counting_month)->delete();
-//
-//        foreach ($reports_chunked as $items) {
-//            OwnerStoreFeeReport::query()->insertOrIgnore($items);
-//        }
-//    }
-
     public function get(array $kvPairs): array
     {
         $this->archiveService = app('OwnerBillReportArchiveService');

+ 2 - 2
resources/views/package/logistic/index.blade.php

@@ -157,8 +157,8 @@
                             </label>
                         </div>
                     </td>
-{{--                    @can('包裹管理-快递-客服备注')--}}
                     <td  class="m-0 p-0 order-package-remarks" style="padding-left: 0 !important;padding-right: 0 !important">
+                        @can('包裹管理-快递-客服备注')
                         <label :for="'create_remark_'+package.id" class="btn-create-remark" @click="package.input_remark=!package.input_remark">
                         </label>
@@ -187,8 +187,8 @@
                                     v-else>展开</span>&nbsp;@{{ package.order_package_remarks.length }} 条
                             </label>
                         </div>
+                        @endcan
                     </td>
-{{--                    @endcan--}}
                     <td class="text-overflow-warp-200"><span v-if="package.order && package.order.issue">@{{ package.order.issue.result_explain }}</span>
                     </td>
                     <td class="text-overflow-warp-200"><span