|
|
@@ -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)) {
|