From a629f3bd951516ec3c048e6328e1747f064900eb Mon Sep 17 00:00:00 2001 From: Park Byung Eun Date: Wed, 3 Aug 2022 06:52:00 +0000 Subject: [PATCH] =?UTF-8?q?=EB=A3=A8=EC=A7=95=20=EA=B4=80=EB=A6=AC=20?= =?UTF-8?q?=EA=B8=B0=EB=B3=B8=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EB=B7=B0=20?= =?UTF-8?q?=EC=A7=84=ED=96=89=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/mock-api/apps/report/loosing/api.ts | 13 +- src/app/mock-api/apps/report/loosing/data.ts | 225 +++++++++++++++++- .../loosing/components/view.component.html | 117 ++++++--- .../loosing/components/view.component.ts | 20 +- .../admin/report/loosing/loosing.routing.ts | 6 +- .../report/loosing/models/bet-calculate.ts | 14 ++ .../report/loosing/models/loosing-report.ts | 12 + .../admin/report/loosing/models/loosing.ts | 28 +-- .../loosing/resolvers/loosing.resolver.ts | 31 +-- .../loosing/services/loosing.service.ts | 36 ++- 10 files changed, 386 insertions(+), 116 deletions(-) create mode 100644 src/app/modules/admin/report/loosing/models/bet-calculate.ts create mode 100644 src/app/modules/admin/report/loosing/models/loosing-report.ts diff --git a/src/app/mock-api/apps/report/loosing/api.ts b/src/app/mock-api/apps/report/loosing/api.ts index c44541c..85343a3 100644 --- a/src/app/mock-api/apps/report/loosing/api.ts +++ b/src/app/mock-api/apps/report/loosing/api.ts @@ -1,14 +1,17 @@ import { Injectable } from '@angular/core'; import { assign, cloneDeep } from 'lodash-es'; import { FuseMockApiService, FuseMockApiUtils } from '@fuse/lib/mock-api'; -import { loosings as loosingsData } from './data'; +import { + loosings as loosingsData, + loosingReports as loosingReportsData, +} from './data'; @Injectable({ providedIn: 'root', }) export class ReportLoosingMockApi { private _loosings: any[] = loosingsData; - + private _loosingReports: any[] = loosingReportsData; /** * Constructor */ @@ -106,13 +109,13 @@ export class ReportLoosingMockApi { const id = request.params.get('id'); // Clone the loosings - const loosings = cloneDeep(this._loosings); + const loosingReports = cloneDeep(this._loosingReports); // Find the loosing - const loosing = loosings.find((item: any) => item.id === id); + // const loosing = loosings.find((item: any) => item.id === id); // Return the response - return [200, loosing]; + return [200, loosingReports]; }); // ----------------------------------------------------------------------------------------------------- diff --git a/src/app/mock-api/apps/report/loosing/data.ts b/src/app/mock-api/apps/report/loosing/data.ts index c8fcf26..88bb12d 100644 --- a/src/app/mock-api/apps/report/loosing/data.ts +++ b/src/app/mock-api/apps/report/loosing/data.ts @@ -2,7 +2,7 @@ export const loosings = [ { - id: '1', + id: 'loosing_1', startDate: '2022-06-01 15:38', endDate: '2022-06-12 15:38', registDate: '2022-06-12 15:38', @@ -10,7 +10,7 @@ export const loosings = [ loosingCount: '15', }, { - id: '2', + id: 'loosing_2', startDate: '2022-06-01 15:38', endDate: '2022-06-12 15:38', registDate: '2022-06-12 15:38', @@ -18,7 +18,7 @@ export const loosings = [ loosingCount: '16', }, { - id: '3', + id: 'loosing_3', startDate: '2022-06-01 15:38', endDate: '2022-06-12 15:38', registDate: '2022-06-12 15:38', @@ -26,3 +26,222 @@ export const loosings = [ loosingCount: '11', }, ]; + +export const loosingReports = [ + { + id: 'lossingReports_1', + parentId: '0', + signinId: 'kgon1', + code: 'AAA', + depth: 0, + rank: '본사', + casinoReport: { + id: '1', + betMoneny: '123,000', + betTieMoneny: '6,000', + betCancelMoneny: '0', + validMoneny: '117,000', + betWinMoneny: '121,900', + betWinLossMoneny: '1,100', + rollingMoney: '2,340', + rollingBottomMoney: '1,755', + rollingMeMoney: '585', + loosingRate: '50%', + meMoney: '-620', + }, + slotReport: { + id: '2', + betMoneny: '75,400', + betTieMoneny: '', + betCancelMoneny: '', + validMoneny: '', + betWinMoneny: '181,100', + betWinLossMoneny: '-105,700', + rollingMoney: '3,770', + rollingBottomMoney: '1,659', + rollingMeMoney: '2,111', + loosingRate: '50%', + meMoney: '-54,735', + }, + }, + { + id: 'lossingReports_2', + parentId: 'lossingReports_1', + signinId: 'kgon2', + code: 'AAAAA', + depth: 1, + rank: '대본', + casinoReport: { + id: '1', + betMoneny: '123,000', + betTieMoneny: '6,000', + betCancelMoneny: '0', + validMoneny: '117,000', + betWinMoneny: '121,900', + betWinLossMoneny: '1,100', + rollingMoney: '2,340', + rollingBottomMoney: '1,755', + rollingMeMoney: '585', + loosingRate: '50%', + meMoney: '-620', + }, + slotReport: { + id: '2', + betMoneny: '75,400', + betTieMoneny: '', + betCancelMoneny: '', + validMoneny: '', + betWinMoneny: '181,100', + betWinLossMoneny: '-105,700', + rollingMoney: '3,770', + rollingBottomMoney: '1,659', + rollingMeMoney: '2,111', + loosingRate: '50%', + meMoney: '-54,735', + }, + }, + { + id: 'lossingReports_3', + parentId: 'lossingReports_2', + signinId: 'kgon2', + code: 'AAAAA', + depth: 1, + rank: '부본', + casinoReport: { + id: '3', + betMoneny: '123,000', + betTieMoneny: '6,000', + betCancelMoneny: '0', + validMoneny: '117,000', + betWinMoneny: '121,900', + betWinLossMoneny: '1,100', + rollingMoney: '2,340', + rollingBottomMoney: '1,755', + rollingMeMoney: '585', + loosingRate: '50%', + meMoney: '-620', + }, + slotReport: { + id: '4', + betMoneny: '75,400', + betTieMoneny: '', + betCancelMoneny: '', + validMoneny: '', + betWinMoneny: '181,100', + betWinLossMoneny: '-105,700', + rollingMoney: '3,770', + rollingBottomMoney: '1,659', + rollingMeMoney: '2,111', + loosingRate: '50%', + meMoney: '-54,735', + }, + }, + { + id: 'lossingReports_4', + parentId: '0', + signinId: 'test1', + code: 'AAAB', + depth: 0, + rank: '본사', + casinoReport: { + id: '1', + betMoneny: '123,000', + betTieMoneny: '6,000', + betCancelMoneny: '0', + validMoneny: '117,000', + betWinMoneny: '121,900', + betWinLossMoneny: '1,100', + rollingMoney: '2,340', + rollingBottomMoney: '1,755', + rollingMeMoney: '585', + loosingRate: '50%', + meMoney: '-620', + }, + slotReport: { + id: '2', + betMoneny: '75,400', + betTieMoneny: '', + betCancelMoneny: '', + validMoneny: '', + betWinMoneny: '181,100', + betWinLossMoneny: '-105,700', + rollingMoney: '3,770', + rollingBottomMoney: '1,659', + rollingMeMoney: '2,111', + loosingRate: '50%', + meMoney: '-54,735', + }, + }, + { + id: 'lossingReports_5', + parentId: 'lossingReports_4', + signinId: 'kgon2', + code: 'AAAAA', + depth: 1, + rank: '대본', + casinoReport: { + id: '1', + betMoneny: '123,000', + betTieMoneny: '6,000', + betCancelMoneny: '0', + validMoneny: '117,000', + betWinMoneny: '121,900', + betWinLossMoneny: '1,100', + rollingMoney: '2,340', + rollingBottomMoney: '1,755', + rollingMeMoney: '585', + loosingRate: '50%', + meMoney: '-620', + }, + slotReport: { + id: '2', + betMoneny: '75,400', + betTieMoneny: '', + betCancelMoneny: '', + validMoneny: '', + betWinMoneny: '181,100', + betWinLossMoneny: '-105,700', + rollingMoney: '3,770', + rollingBottomMoney: '1,659', + rollingMeMoney: '2,111', + loosingRate: '50%', + meMoney: '-54,735', + }, + }, + { + id: 'lossingReports_6', + parentId: 'lossingReports_5', + signinId: 'kgon2', + code: 'AAAAA', + depth: 1, + rank: '부본', + casinoReport: { + id: '3', + betMoneny: '123,000', + betTieMoneny: '6,000', + betCancelMoneny: '0', + validMoneny: '117,000', + betWinMoneny: '121,900', + betWinLossMoneny: '1,100', + rollingMoney: '2,340', + rollingBottomMoney: '1,755', + rollingMeMoney: '585', + loosingRate: '50%', + meMoney: '-620', + }, + slotReport: { + id: '4', + betMoneny: '75,400', + betTieMoneny: '', + betCancelMoneny: '', + validMoneny: '', + betWinMoneny: '181,100', + betWinLossMoneny: '-105,700', + rollingMoney: '3,770', + rollingBottomMoney: '1,659', + rollingMeMoney: '2,111', + loosingRate: '50%', + meMoney: '-54,735', + }, + }, +]; diff --git a/src/app/modules/admin/report/loosing/components/view.component.html b/src/app/modules/admin/report/loosing/components/view.component.html index 5dbdf90..0e5b02a 100644 --- a/src/app/modules/admin/report/loosing/components/view.component.html +++ b/src/app/modules/admin/report/loosing/components/view.component.html @@ -46,27 +46,41 @@ [dataSource]="loosingDataSource" > + + + + + {{ info.signinId }} + + + 아이디 - - - {{ i + 1 }} - - + + + + + {{ info.code }} + + + 코드 - - - {{ info.startDate }} - - @@ -75,7 +89,13 @@ 베팅 - {{ info.endDate }} + {{ info.casinoReport.betMoneny }} +
+ {{ info.casinoReport.betTieMoneny }} +
+ {{ info.casinoReport.betCancelMoneny }} +
+ {{ info.casinoReport.validMoneny }}
@@ -85,7 +105,7 @@ 당첨 {{ - info.defaultCount + info.casinoReport.betWinMoneny }} @@ -95,7 +115,7 @@ 윈로스 {{ - info.loosingCount + info.casinoReport.betWinLossMoneny }} @@ -104,9 +124,13 @@ 롤링 - {{ - info.loosingCount - }} + + {{ info.casinoReport.rollingMoney }} +
+ {{ info.casinoReport.rollingBottomMoney }} +
+ {{ info.casinoReport.rollingMeMoney }} +
@@ -115,7 +139,7 @@ 루징요율 {{ - info.loosingCount + info.casinoReport.loosingRate }} @@ -124,7 +148,7 @@ 본인 {{ - info.loosingCount + info.casinoReport.meMoney }} @@ -133,10 +157,16 @@ - 베팅 + + 베팅 + - {{ info.endDate }} + {{ info.slotReport.betMoneny }} @@ -146,7 +176,7 @@ 당첨 {{ - info.defaultCount + info.slotReport.betWinMoneny }} @@ -156,7 +186,7 @@ 윈로스 {{ - info.loosingCount + info.slotReport.betWinLossMoneny }} @@ -165,9 +195,13 @@ 롤링 - {{ - info.loosingCount - }} + + {{ info.slotReport.rollingMoney }} +
+ {{ info.slotReport.rollingBottomMoney }} +
+ {{ info.slotReport.rollingMeMoney }} +
@@ -176,7 +210,7 @@ 루징요율 {{ - info.loosingCount + info.slotReport.loosingRate }} @@ -185,22 +219,47 @@ 본인 {{ - info.loosingCount + info.slotReport.meMoney }} + + - + 카지노루징 - + 슬롯루징 diff --git a/src/app/modules/admin/report/loosing/components/view.component.ts b/src/app/modules/admin/report/loosing/components/view.component.ts index a3c4dcc..7c6b7e6 100644 --- a/src/app/modules/admin/report/loosing/components/view.component.ts +++ b/src/app/modules/admin/report/loosing/components/view.component.ts @@ -20,6 +20,7 @@ import { Loosing } from '../models/loosing'; import { LoosingService } from '../services/loosing.service'; import { Router } from '@angular/router'; import { MatTableDataSource } from '@angular/material/table'; +import { LoosingReport } from '../models/loosing-report'; @Component({ selector: 'loosing-view', @@ -60,16 +61,9 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { private _unsubscribeAll: Subject = new Subject(); - headerTableColumns: string[] = [ - 'index', - 'startDate', - 'endDate', - 'defaultDataTotalCount', - 'loosingDataTotalCount', - 'removeBtn', - ]; - displayedTableColumns: string[] = [ + 'userId', + 'userCode', 'casinoBet', 'casinoWin', 'casinoWinLoss', @@ -103,14 +97,14 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { */ ngOnInit(): void { // Get the products - this._loosingService.loosings$ + this._loosingService.loosing$ .pipe(takeUntil(this._unsubscribeAll)) - .subscribe((loosings: Loosing[] | undefined) => { - if (!loosings) { + .subscribe((loosingReport: LoosingReport[] | undefined) => { + if (!loosingReport) { return; } - this.loosingDataSource.data = loosings; + this.loosingDataSource.data = loosingReport; // Mark for check this._changeDetectorRef.markForCheck(); }); diff --git a/src/app/modules/admin/report/loosing/loosing.routing.ts b/src/app/modules/admin/report/loosing/loosing.routing.ts index 666ffdd..92c7c01 100644 --- a/src/app/modules/admin/report/loosing/loosing.routing.ts +++ b/src/app/modules/admin/report/loosing/loosing.routing.ts @@ -19,8 +19,8 @@ export const loosingRoutes: Route[] = [ { path: ':id', component: ViewComponent, - // resolve: { - // loosing: LoosingResolver, - // }, + resolve: { + loosing: LoosingResolver, + }, }, ]; diff --git a/src/app/modules/admin/report/loosing/models/bet-calculate.ts b/src/app/modules/admin/report/loosing/models/bet-calculate.ts new file mode 100644 index 0000000..0c60cb0 --- /dev/null +++ b/src/app/modules/admin/report/loosing/models/bet-calculate.ts @@ -0,0 +1,14 @@ +export interface BetCalculate { + id: string; + betMoneny?: string; + betTieMoneny?: string; + betCancelMoneny?: string; + validMoneny?: string; + betWinMoneny?: string; + betWinLossMoneny?: string; + rollingMoney?: string; + rollingBottomMoney?: string; + rollingMeMoney?: string; + loosingRate?: string; + meMoney?: string; +} diff --git a/src/app/modules/admin/report/loosing/models/loosing-report.ts b/src/app/modules/admin/report/loosing/models/loosing-report.ts new file mode 100644 index 0000000..c7f1206 --- /dev/null +++ b/src/app/modules/admin/report/loosing/models/loosing-report.ts @@ -0,0 +1,12 @@ +import { BetCalculate } from './bet-calculate'; + +export interface LoosingReport { + id: string; + parentId: string; + signinId?: string; + code?: string; + depth?: number; + rank?: string; + casinoCalculate?: BetCalculate; + slotCalculate?: BetCalculate; +} diff --git a/src/app/modules/admin/report/loosing/models/loosing.ts b/src/app/modules/admin/report/loosing/models/loosing.ts index 03909f5..09a6724 100644 --- a/src/app/modules/admin/report/loosing/models/loosing.ts +++ b/src/app/modules/admin/report/loosing/models/loosing.ts @@ -1,33 +1,7 @@ export interface Loosing { id?: string; - totalPartnerCount?: number; - totalHoldingMoney?: number; - totalComp?: number; - total?: number; - branchCount?: number; - divisionCount?: number; - officeCount?: number; - storeCount?: number; - memberCount?: number; - nickname?: string; - accountHolder?: string; - phoneNumber?: string; - calculateType?: string; - ownCash?: number; - ownComp?: number; - ownCoupon?: number; - gameMoney?: number; - todayComp?: number; - totalDeposit?: number; - totalWithdraw?: number; - balance?: number; + signinId?: string; startDate?: string; endDate?: string; registDate?: string; - defaultCount?: string; - loosingCount?: string; - finalSigninDate?: string; - ip?: string; - state?: string; - note?: string; } diff --git a/src/app/modules/admin/report/loosing/resolvers/loosing.resolver.ts b/src/app/modules/admin/report/loosing/resolvers/loosing.resolver.ts index c1a0d3d..9a84bb5 100644 --- a/src/app/modules/admin/report/loosing/resolvers/loosing.resolver.ts +++ b/src/app/modules/admin/report/loosing/resolvers/loosing.resolver.ts @@ -9,6 +9,7 @@ import { catchError, Observable, throwError } from 'rxjs'; import { Loosing } from '../models/loosing'; import { LoosingPagination } from '../models/loosing-pagination'; +import { LoosingReport } from '../models/loosing-report'; import { LoosingService } from '../services/loosing.service'; @Injectable({ @@ -36,23 +37,25 @@ export class LoosingResolver implements Resolve { resolve( route: ActivatedRouteSnapshot, state: RouterStateSnapshot - ): Observable { - return this._loosingService.getLoosingById(route.paramMap.get('id')).pipe( - // Error here means the requested product is not available - catchError((error) => { - // Log the error - console.error(error); + ): Observable { + return this._loosingService + .getLoosingById(route.paramMap.get('id') as string) + .pipe( + // Error here means the requested product is not available + catchError((error) => { + // Log the error + console.error(error); - // Get the parent url - const parentUrl = state.url.split('/').slice(0, -1).join('/'); + // Get the parent url + const parentUrl = state.url.split('/').slice(0, -1).join('/'); - // Navigate to there - this._router.navigateByUrl(parentUrl); + // Navigate to there + this._router.navigateByUrl(parentUrl); - // Throw an error - return throwError(error); - }) - ); + // Throw an error + return throwError(error); + }) + ); } } diff --git a/src/app/modules/admin/report/loosing/services/loosing.service.ts b/src/app/modules/admin/report/loosing/services/loosing.service.ts index 8bd9d1e..dea5ce1 100644 --- a/src/app/modules/admin/report/loosing/services/loosing.service.ts +++ b/src/app/modules/admin/report/loosing/services/loosing.service.ts @@ -14,6 +14,7 @@ import { import { Loosing } from '../models/loosing'; import { LoosingPagination } from '../models/loosing-pagination'; +import { LoosingReport } from '../models/loosing-report'; @Injectable({ providedIn: 'root', @@ -23,7 +24,9 @@ export class LoosingService { private __pagination = new BehaviorSubject( undefined ); - private __loosing = new BehaviorSubject(undefined); + private __loosing = new BehaviorSubject( + undefined + ); private __loosings = new BehaviorSubject(undefined); /** @@ -45,7 +48,7 @@ export class LoosingService { /** * Getter for loosing */ - get loosing$(): Observable { + get loosing$(): Observable { return this.__loosing.asObservable(); } @@ -104,27 +107,16 @@ export class LoosingService { /** * Get product by id */ - getLoosingById(id: string | null): Observable { - return this.__loosings.pipe( - take(1), - map((loosings) => { - // Find the product - const loosing = loosings?.find((item) => item.id === id) || undefined; - - // Update the product - this.__loosing.next(loosing); - - // Return the product - return loosing; - }), - switchMap((product) => { - if (!product) { - return throwError('Could not found product with id of ' + id + '!'); - } - - return of(product); + getLoosingById(id: string = '1'): Observable { + return this._httpClient + .get('api/apps/report/loosing/loosing', { + params: { id }, }) - ); + .pipe( + tap((response: LoosingReport[]) => { + this.__loosing.next(response); + }) + ); } /**