루징 관리 기본 데이터 뷰 진행중

This commit is contained in:
Park Byung Eun 2022-08-03 06:52:00 +00:00
parent c7e45f48f0
commit a629f3bd95
10 changed files with 386 additions and 116 deletions

View File

@ -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];
});
// -----------------------------------------------------------------------------------------------------

View File

@ -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',
},
},
];

View File

@ -46,27 +46,41 @@
[dataSource]="loosingDataSource"
>
<!-- 아이디 -->
<ng-container matColumnDef="userId">
<th
mat-header-cell
*matHeaderCellDef
[ngStyle]="{ display: 'none' }"
></th>
<td mat-cell *matCellDef="let info; let i = index">
<span class="font-medium text-right">
{{ info.signinId }}
</span>
</td>
</ng-container>
<ng-container matColumnDef="signinId">
<th mat-header-cell *matHeaderCellDef [attr.rowspan]="2">
아이디
</th>
<td mat-cell *matCellDef="let info; let i = index">
<span class="font-medium text-right">
{{ i + 1 }}
</span>
</td>
</ng-container>
<!-- 코드 -->
<ng-container matColumnDef="userCode">
<th
mat-header-cell
*matHeaderCellDef
[ngStyle]="{ display: 'none' }"
></th>
<td mat-cell *matCellDef="let info">
<span class="font-medium text-right">
{{ info.code }}
</span>
</td>
</ng-container>
<ng-container matColumnDef="code">
<th mat-header-cell *matHeaderCellDef [attr.rowspan]="2">
코드
</th>
<td mat-cell *matCellDef="let info">
<span class="font-medium text-right">
{{ info.startDate }}
</span>
</td>
</ng-container>
<!-- 카지노루징 시작-->
@ -75,7 +89,13 @@
<th mat-header-cell *matHeaderCellDef>베팅</th>
<td mat-cell *matCellDef="let info">
<span class="font-medium text-right">
{{ info.endDate }}
{{ info.casinoReport.betMoneny }}
<hr style="margin: 7px 0px" />
{{ info.casinoReport.betTieMoneny }}
<hr style="margin: 7px 0px" />
{{ info.casinoReport.betCancelMoneny }}
<hr style="margin: 7px 0px" />
{{ info.casinoReport.validMoneny }}
</span>
</td>
</ng-container>
@ -85,7 +105,7 @@
<th mat-header-cell *matHeaderCellDef>당첨</th>
<td mat-cell *matCellDef="let info">
<span class="font-medium text-right">{{
info.defaultCount
info.casinoReport.betWinMoneny
}}</span>
</td>
</ng-container>
@ -95,7 +115,7 @@
<th mat-header-cell *matHeaderCellDef>윈로스</th>
<td mat-cell *matCellDef="let info">
<span class="font-medium text-right">{{
info.loosingCount
info.casinoReport.betWinLossMoneny
}}</span>
</td>
</ng-container>
@ -104,9 +124,13 @@
<ng-container matColumnDef="casinoRolling">
<th mat-header-cell *matHeaderCellDef>롤링</th>
<td mat-cell *matCellDef="let info">
<span class="font-medium text-right">{{
info.loosingCount
}}</span>
<span class="font-medium text-right">
{{ info.casinoReport.rollingMoney }}
<hr style="margin: 7px 0px" />
{{ info.casinoReport.rollingBottomMoney }}
<hr style="margin: 7px 0px" />
{{ info.casinoReport.rollingMeMoney }}
</span>
</td>
</ng-container>
@ -115,7 +139,7 @@
<th mat-header-cell *matHeaderCellDef>루징요율</th>
<td mat-cell *matCellDef="let info">
<span class="font-medium text-right">{{
info.loosingCount
info.casinoReport.loosingRate
}}</span>
</td>
</ng-container>
@ -124,7 +148,7 @@
<th mat-header-cell *matHeaderCellDef>본인</th>
<td mat-cell *matCellDef="let info">
<span class="font-medium text-right">{{
info.loosingCount
info.casinoReport.meMoney
}}</span>
</td>
</ng-container>
@ -133,10 +157,16 @@
<!-- 슬롯루징 시작-->
<!-- 베팅 -->
<ng-container matColumnDef="slotBet">
<th mat-header-cell *matHeaderCellDef>베팅</th>
<th
mat-header-cell
*matHeaderCellDef
style="border-left: 1px solid #e0e0e0; padding-left: 30px"
>
베팅
</th>
<td mat-cell *matCellDef="let info">
<span class="font-medium text-right">
{{ info.endDate }}
{{ info.slotReport.betMoneny }}
</span>
</td>
</ng-container>
@ -146,7 +176,7 @@
<th mat-header-cell *matHeaderCellDef>당첨</th>
<td mat-cell *matCellDef="let info">
<span class="font-medium text-right">{{
info.defaultCount
info.slotReport.betWinMoneny
}}</span>
</td>
</ng-container>
@ -156,7 +186,7 @@
<th mat-header-cell *matHeaderCellDef>윈로스</th>
<td mat-cell *matCellDef="let info">
<span class="font-medium text-right">{{
info.loosingCount
info.slotReport.betWinLossMoneny
}}</span>
</td>
</ng-container>
@ -165,9 +195,13 @@
<ng-container matColumnDef="slotRolling">
<th mat-header-cell *matHeaderCellDef>롤링</th>
<td mat-cell *matCellDef="let info">
<span class="font-medium text-right">{{
info.loosingCount
}}</span>
<span class="font-medium text-right">
{{ info.slotReport.rollingMoney }}
<hr style="margin: 7px 0px" />
{{ info.slotReport.rollingBottomMoney }}
<hr style="margin: 7px 0px" />
{{ info.slotReport.rollingMeMoney }}
</span>
</td>
</ng-container>
@ -176,7 +210,7 @@
<th mat-header-cell *matHeaderCellDef>루징요율</th>
<td mat-cell *matCellDef="let info">
<span class="font-medium text-right">{{
info.loosingCount
info.slotReport.loosingRate
}}</span>
</td>
</ng-container>
@ -185,22 +219,47 @@
<th mat-header-cell *matHeaderCellDef>본인</th>
<td mat-cell *matCellDef="let info">
<span class="font-medium text-right">{{
info.loosingCount
info.slotReport.meMoney
}}</span>
</td>
</ng-container>
<!-- 슬롯루징 끝-->
<!-- Star Column -->
<!-- <ng-container matColumnDef="star" stickyEnd>
<th
mat-header-cell
*matHeaderCellDef
aria-label="row actions"
[attr.rowspan]="2"
style="border-left: 1px solid #e0e0e0; padding-left: 30px"
>
&nbsp;
</th>
<td mat-cell *matCellDef="let element">
<mat-icon>more_vert</mat-icon>
</td>
</ng-container> -->
<!-- Header row second group -->
<ng-container matColumnDef="header-row-casino-group">
<th mat-header-cell *matHeaderCellDef [attr.colspan]="6">
<th
mat-header-cell
*matHeaderCellDef
[attr.colspan]="6"
style="text-align: center"
>
카지노루징
</th>
</ng-container>
<!-- Header row second group -->
<ng-container matColumnDef="header-row-slot-group">
<th mat-header-cell *matHeaderCellDef [attr.colspan]="6">
<th
mat-header-cell
*matHeaderCellDef
[attr.colspan]="6"
style="text-align: center; border-left: 1px solid #e0e0e0"
>
슬롯루징
</th>
</ng-container>

View File

@ -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<any> = new Subject<any>();
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();
});

View File

@ -19,8 +19,8 @@ export const loosingRoutes: Route[] = [
{
path: ':id',
component: ViewComponent,
// resolve: {
// loosing: LoosingResolver,
// },
resolve: {
loosing: LoosingResolver,
},
},
];

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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<any> {
resolve(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
): Observable<Loosing | undefined> {
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<LoosingReport[] | undefined> {
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);
})
);
}
}

View File

@ -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<LoosingPagination | undefined>(
undefined
);
private __loosing = new BehaviorSubject<Loosing | undefined>(undefined);
private __loosing = new BehaviorSubject<LoosingReport[] | undefined>(
undefined
);
private __loosings = new BehaviorSubject<Loosing[] | undefined>(undefined);
/**
@ -45,7 +48,7 @@ export class LoosingService {
/**
* Getter for loosing
*/
get loosing$(): Observable<Loosing | undefined> {
get loosing$(): Observable<LoosingReport[] | undefined> {
return this.__loosing.asObservable();
}
@ -104,27 +107,16 @@ export class LoosingService {
/**
* Get product by id
*/
getLoosingById(id: string | null): Observable<Loosing> {
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<LoosingReport[]> {
return this._httpClient
.get<LoosingReport[]>('api/apps/report/loosing/loosing', {
params: { id },
})
);
.pipe(
tap((response: LoosingReport[]) => {
this.__loosing.next(response);
})
);
}
/**