fix: 补齐抖音亿家达乐简七月期初 (#1048)
This commit is contained in:
parent
1c7a93b0a8
commit
d132cd1c4d
@ -26,6 +26,10 @@ class DouyinAuthoritativeBillRepository
|
||||
'balance' => 287706.90,
|
||||
'source' => 'merchant_backoffice_june_ending',
|
||||
],
|
||||
'亿家达乐简家具专卖店' => [
|
||||
'balance' => 0.0,
|
||||
'source' => 'merchant_backoffice_zero',
|
||||
],
|
||||
];
|
||||
|
||||
public function __construct(
|
||||
|
||||
@ -5,6 +5,7 @@ namespace Tests\Unit\EcommerceFinance;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Modules\EcommerceFinance\Repositories\DouyinAuthoritativeBillRepository;
|
||||
use Modules\EcommerceFinance\Repositories\StoreReceivingDouyinBillMirrorRepository;
|
||||
use Modules\EcommerceFinance\Repositories\StoreReceivingAlipayBillMirrorRepository;
|
||||
use Modules\EcommerceFinance\Services\DouyinAuthoritativeBillImporter;
|
||||
@ -298,6 +299,59 @@ class DouyinAuthoritativeBillTest extends TestCase
|
||||
$this->assertSame(22870.22, $august['summary']['balance']);
|
||||
}
|
||||
|
||||
public function test_lejian_uses_confirmed_zero_backoffice_opening_and_preserves_store_name(): void
|
||||
{
|
||||
$store = '抖音-亿家达乐简家具专卖店';
|
||||
$septemberIncome = array_replace($this->row('2000000000000000501', '288.00'), [
|
||||
'店铺' => $store,
|
||||
'结算时间' => '2026-09-02 09:06:52',
|
||||
]);
|
||||
$septemberExpense = array_replace($this->row('2000000000000000502', '0.00', '288.00'), [
|
||||
'店铺' => $store,
|
||||
'账单项目' => '平台服务费',
|
||||
'结算时间' => '2026-09-02 09:06:52',
|
||||
]);
|
||||
$this->import([$septemberIncome, $septemberExpense], 2, '288.00', '288.00', null, '2026-09');
|
||||
|
||||
$repo = app(StoreReceivingDouyinBillMirrorRepository::class);
|
||||
$july = $repo->paginate([
|
||||
'store_name' => $store,
|
||||
'start' => '2026-07-01',
|
||||
'end' => '2026-07-31',
|
||||
], 'occurred_at', 'asc', 1, 10);
|
||||
$september = $repo->paginate([
|
||||
'store_name' => $store,
|
||||
'start' => '2026-09-01',
|
||||
'end' => '2026-09-30',
|
||||
], 'occurred_at', 'asc', 1, 10);
|
||||
$october = $repo->paginate([
|
||||
'store_name' => $store,
|
||||
'start' => '2026-10-01',
|
||||
'end' => '2026-10-31',
|
||||
], 'occurred_at', 'asc', 1, 10);
|
||||
$storeBalances = app(DouyinAuthoritativeBillRepository::class)->storeBalances([
|
||||
'start' => '2026-10-01',
|
||||
'end' => '2026-10-31',
|
||||
]);
|
||||
$lejian = array_values(array_filter(
|
||||
$storeBalances,
|
||||
static fn (array $row): bool => $row['store_name'] === $store,
|
||||
));
|
||||
|
||||
$this->assertSame(0.0, $july['summary']['opening_balance']);
|
||||
$this->assertSame('2026-06-30', $july['summary']['opening_balance_date']);
|
||||
$this->assertSame('merchant_backoffice_zero', $july['summary']['opening_balance_source']);
|
||||
$this->assertSame(0.0, $september['summary']['opening_balance']);
|
||||
$this->assertSame(288.0, $september['summary']['income']);
|
||||
$this->assertSame(288.0, $september['summary']['expense']);
|
||||
$this->assertSame(0.0, $september['summary']['balance']);
|
||||
$this->assertSame(0.0, $october['summary']['opening_balance']);
|
||||
$this->assertSame(0.0, $october['summary']['balance']);
|
||||
$this->assertCount(1, $lejian);
|
||||
$this->assertSame(0.0, $lejian[0]['opening_balance']);
|
||||
$this->assertNotContains('未标注店铺', array_column($storeBalances, 'store_name'));
|
||||
}
|
||||
|
||||
private function import(
|
||||
array $rows,
|
||||
int $count,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user