This commit is contained in:
병준 박 2019-12-15 22:50:56 +09:00
commit 2baae8e81c
12 changed files with 328 additions and 44 deletions

View File

@ -27,13 +27,14 @@ import {
} from '../chat/create-chat.dialog.component'; } from '../chat/create-chat.dialog.component';
import { UserSelectDialogType, EnvironmentsInfo } from '@app/types'; import { UserSelectDialogType, EnvironmentsInfo } from '@app/types';
import { take } from 'rxjs/operators'; import { take } from 'rxjs/operators';
import { UserInfoSS } from '@ucap-webmessenger/protocol-query';
export interface MessageWriteDialogData { export interface MessageWriteDialogData {
loginRes: LoginResponse; loginRes: LoginResponse;
environmentsInfo: EnvironmentsInfo; environmentsInfo: EnvironmentsInfo;
detail?: DetailResponse; detail?: DetailResponse;
detailContents?: string; detailContents?: string;
receiverList?: UserInfo[]; receiverList?: (UserInfo | UserInfoSS)[];
} }
// tslint:disable-next-line: no-empty-interface // tslint:disable-next-line: no-empty-interface

View File

@ -5,7 +5,7 @@ import { DebugElement } from '@angular/core';
import { NoticeDetailDialogComponent } from './notice-detail.dialog.component'; import { NoticeDetailDialogComponent } from './notice-detail.dialog.component';
describe('ProfileDialogComponent', () => { describe('NoticeDialogComponent', () => {
let component: NoticeDetailDialogComponent; let component: NoticeDetailDialogComponent;
let fixture: ComponentFixture<NoticeDetailDialogComponent>; let fixture: ComponentFixture<NoticeDetailDialogComponent>;

View File

@ -111,7 +111,7 @@ export class ProfileDialogComponent implements OnInit, OnDestroy {
} }
} }
onClickChat(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) { onClickChat(userInfo: UserInfoSS) {
if (userInfo.seq === this.loginRes.userSeq) { if (userInfo.seq === this.loginRes.userSeq) {
this.store.dispatch( this.store.dispatch(
ChatStore.openRoom({ userSeqList: [this.loginRes.talkWithMeBotSeq] }) ChatStore.openRoom({ userSeqList: [this.loginRes.talkWithMeBotSeq] })
@ -123,7 +123,7 @@ export class ProfileDialogComponent implements OnInit, OnDestroy {
this.dialogRef.close(); this.dialogRef.close();
} }
onClickSendMessage(userInfo: UserInfo) { onClickSendMessage(userInfo: UserInfoSS) {
if (userInfo.seq !== this.loginRes.userSeq) { if (userInfo.seq !== this.loginRes.userSeq) {
this.dialogRef.close(); this.dialogRef.close();
@ -145,10 +145,7 @@ export class ProfileDialogComponent implements OnInit, OnDestroy {
} }
} }
onClickToggleFavorit(param: { onClickToggleFavorit(param: { userInfo: UserInfoSS; isFavorit: boolean }) {
userInfo: UserInfo | UserInfoF;
isFavorit: boolean;
}) {
this.store.dispatch( this.store.dispatch(
SyncStore.updateBuddy({ SyncStore.updateBuddy({
seq: param.userInfo.seq, seq: param.userInfo.seq,
@ -157,10 +154,7 @@ export class ProfileDialogComponent implements OnInit, OnDestroy {
); );
} }
async onClickToggleBuddy(param: { async onClickToggleBuddy(param: { userInfo: UserInfoSS; isBuddy: boolean }) {
userInfo: UserInfo | UserInfoF;
isBuddy: boolean;
}) {
if (param.isBuddy) { if (param.isBuddy) {
// 동료추가. // 동료추가.
const result = await this.dialogService.open< const result = await this.dialogService.open<

View File

@ -1,22 +1,19 @@
import { map, tap } from 'rxjs/operators'; import { map, tap, take } from 'rxjs/operators';
import { Component, OnInit, Inject, OnDestroy, ViewChild } from '@angular/core'; import { Component, OnInit, Inject, OnDestroy, ViewChild } from '@angular/core';
import { Store, select } from '@ngrx/store'; import { Store, select } from '@ngrx/store';
import * as AppSotre from '@app/store'; import * as AppStore from '@app/store';
import * as ChatStore from '@app/store/messenger/chat'; import * as ChatStore from '@app/store/messenger/chat';
import { Observable, Subscription } from 'rxjs'; import { Observable, Subscription } from 'rxjs';
import { import { UCAP_NATIVE_SERVICE, NativeService } from '@ucap-webmessenger/native';
WindowIdle,
UCAP_NATIVE_SERVICE,
NativeService
} from '@ucap-webmessenger/native';
import { UserInfo } from '@ucap-webmessenger/protocol-sync'; import { UserInfo } from '@ucap-webmessenger/protocol-sync';
import { import {
UserInfoSS, UserInfoSS,
UserInfoF, UserInfoF,
UserInfoDN UserInfoDN,
QueryProtocolService
} from '@ucap-webmessenger/protocol-query'; } from '@ucap-webmessenger/protocol-query';
import { StatusProtocolService } from '@ucap-webmessenger/protocol-status'; import { StatusProtocolService } from '@ucap-webmessenger/protocol-status';
import { StatusType, StatusCode } from '@ucap-webmessenger/core'; import { StatusType, StatusCode } from '@ucap-webmessenger/core';
@ -26,9 +23,10 @@ import {
ProfileDialogData, ProfileDialogData,
ProfileDialogResult ProfileDialogResult
} from '@app/layouts/messenger/dialogs/profile/profile.dialog.component'; } from '@app/layouts/messenger/dialogs/profile/profile.dialog.component';
import { MatSidenav, MatDrawer } from '@angular/material'; import { MatDrawer } from '@angular/material';
import { SplitAreaDirective } from 'angular-split';
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { DaesangProtocolService } from '@ucap-webmessenger/daesang';
@Component({ @Component({
selector: 'app-page-messenger-main', selector: 'app-page-messenger-main',
@ -44,19 +42,23 @@ export class MainPageComponent implements OnInit, OnDestroy {
defaultLeftSideComponentWidth = 380; defaultLeftSideComponentWidth = 380;
leftSideComponentWidth = this.defaultLeftSideComponentWidth; leftSideComponentWidth = this.defaultLeftSideComponentWidth;
loginRes: LoginResponse;
loginResSubscription: Subscription;
@ViewChild('rightDrawer', { static: true }) rightDrawer: MatDrawer; @ViewChild('rightDrawer', { static: true }) rightDrawer: MatDrawer;
constructor( constructor(
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService, @Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService,
private store: Store<any>, private store: Store<any>,
private statusProtocolService: StatusProtocolService, private statusProtocolService: StatusProtocolService,
private daesangProtocolService: DaesangProtocolService,
private dialogService: DialogService, private dialogService: DialogService,
private logger: NGXLogger private logger: NGXLogger
) {} ) {}
ngOnInit(): void { ngOnInit(): void {
this.selectedChat$ = this.store.pipe( this.selectedChat$ = this.store.pipe(
select(AppSotre.MessengerSelector.ChatSelector.selectedRoom), select(AppStore.MessengerSelector.ChatSelector.selectedRoom),
tap(selectedRoom => { tap(selectedRoom => {
if (!selectedRoom) { if (!selectedRoom) {
this.rightDrawer.close(); this.rightDrawer.close();
@ -65,7 +67,7 @@ export class MainPageComponent implements OnInit, OnDestroy {
}) })
); );
this.selectedRightDrawer$ = this.store.pipe( this.selectedRightDrawer$ = this.store.pipe(
select(AppSotre.MessengerSelector.ChatSelector.selectedRightDrawer), select(AppStore.MessengerSelector.ChatSelector.selectedRightDrawer),
tap(selectedRightDrawer => { tap(selectedRightDrawer => {
if (!!selectedRightDrawer) { if (!!selectedRightDrawer) {
this.rightDrawer.open(); this.rightDrawer.open();
@ -101,6 +103,15 @@ export class MainPageComponent implements OnInit, OnDestroy {
.subscribe(roomSeq => { .subscribe(roomSeq => {
this.store.dispatch(ChatStore.selectedRoom({ roomSeq })); this.store.dispatch(ChatStore.selectedRoom({ roomSeq }));
}); });
this.loginResSubscription = this.store
.pipe(
select(AppStore.AccountSelector.AuthenticationSelector.loginRes),
tap(loginRes => {
this.loginRes = loginRes;
})
)
.subscribe();
} }
ngOnDestroy(): void { ngOnDestroy(): void {
@ -112,6 +123,10 @@ export class MainPageComponent implements OnInit, OnDestroy {
this.chatOpenRoomSubscription.unsubscribe(); this.chatOpenRoomSubscription.unsubscribe();
} }
if (!!this.loginResSubscription) {
this.loginResSubscription.unsubscribe();
}
this.logger.debug('-----------------------MainPageComponent ngOnDestroy'); this.logger.debug('-----------------------MainPageComponent ngOnDestroy');
} }
@ -133,16 +148,59 @@ export class MainPageComponent implements OnInit, OnDestroy {
} }
onClickOpenProfile(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) { onClickOpenProfile(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) {
// [GROUP]
// this.queryProtocolService
// .dataUser({
// divCd: 'OPENPROF',
// seq: userInfo.seq,
// senderCompanyCode: this.loginRes.userInfo.companyCode,
// senderEmployeeType: this.loginRes.userInfo.employeeType
// })
// .pipe(
// take(1),
// map(res => {
// if (!!res && !!res.userInfo) {
// this.dialogService.open<
// ProfileDialogComponent,
// ProfileDialogData,
// ProfileDialogResult
// >(ProfileDialogComponent, {
// data: {
// userInfo: res.userInfo
// }
// });
// }
// })
// )
// .subscribe();
// [Daesang]
this.daesangProtocolService
.dataUserDaesang({
divCd: 'OPENPROF',
seq: userInfo.seq,
senderCompanyCode: this.loginRes.userInfo.companyCode,
senderEmployeeType: this.loginRes.userInfo.employeeType
})
.pipe(
take(1),
map(res => {
console.log(res);
if (!!res && !!res.userInfo) {
this.dialogService.open< this.dialogService.open<
ProfileDialogComponent, ProfileDialogComponent,
ProfileDialogData, ProfileDialogData,
ProfileDialogResult ProfileDialogResult
>(ProfileDialogComponent, { >(ProfileDialogComponent, {
data: { data: {
userInfo userInfo: res.userInfo
} }
}); });
} }
})
)
.subscribe();
}
onCloseRightDrawer() { onCloseRightDrawer() {
this.rightDrawer.close(); this.rightDrawer.close();

View File

@ -26,7 +26,6 @@ import {
SSVC_TYPE_QUERY_DEPT_USER_RES, SSVC_TYPE_QUERY_DEPT_USER_RES,
DeptUserResponse DeptUserResponse
} from '@ucap-webmessenger/protocol-query'; } from '@ucap-webmessenger/protocol-query';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
@ -106,7 +105,6 @@ export class Effects {
constructor( constructor(
private actions$: Actions, private actions$: Actions,
private store: Store<any>, private store: Store<any>,
private sessionStorageService: SessionStorageService,
private queryProtocolService: QueryProtocolService private queryProtocolService: QueryProtocolService
) {} ) {}
} }

View File

@ -0,0 +1,77 @@
import {
ProtocolDecoder,
ProtocolMessage,
BodyStringDivider,
decodeProtocolMessage,
ProtocolResponse
} from '@ucap-webmessenger/protocol';
import { EmployeeType } from '@ucap-webmessenger/protocol-room';
import { RoleCode } from '@ucap-webmessenger/protocol-authentication';
import {
UserInfoSS,
DataUserResponse
} from '@ucap-webmessenger/protocol-query';
// export interface UserInfoSSForDaesang extends UserInfoSS {
// /****** For daesang ******/
// /** 사업장 */
// workplace: string;
// /** 담당업무 */
// responsibilities: string;
// /** 업무 상태 */
// workstatus: string;
// }
// export interface DataUserResponse extends ProtocolResponse {
// // DivCD(s)
// divCd: string;
// // {사용자정보-SS}
// userInfo?: UserInfoSS;
// }
export const decodeDataUser: ProtocolDecoder<DataUserResponse> = (
message: ProtocolMessage
) => {
let userInfo: UserInfoSS;
if (message.bodyList.length > 1) {
const info = message.bodyList[1].split(BodyStringDivider);
userInfo = {
seq: Number(info[0]),
name: info[1],
profileImageFile: info[2],
grade: info[3],
intro: info[4],
companyCode: info[5],
hpNumber: info[6],
lineNumber: info[7],
email: info[8],
isMobile: info[9] === 'Y' ? true : false,
deptName: info[10],
order: info[11],
isActive: info[12] === 'Y' ? true : false,
roleCd: info[13] as RoleCode,
employeeNum: info[14],
madn: info[15],
hardSadn: info[16],
fmcSadn: info[17],
callMode: info[18],
nameEn: info[19],
nameCn: info[20],
gradeEn: info[21],
gradeCn: info[22],
deptNameEn: info[23],
deptNameCn: info[24],
deptSeq: info[25],
isPrivacyAgree: info[26] === 'Y' ? true : false,
isValidLogin: info[27] === 'Y' ? true : false,
employeeType: info[28] as EmployeeType,
workplace: info[29],
responsibilities: info[30],
workstatus: info[31]
};
}
return decodeProtocolMessage(message, {
divCd: message.bodyList[0],
userInfo
} as DataUserResponse);
};

View File

@ -0,0 +1,33 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { take, map } from 'rxjs/operators';
import { ProtocolService } from '@ucap-webmessenger/protocol';
import {
DataUserRequest,
SSVC_TYPE_QUERY_DATA_USER_REQ,
SVC_TYPE_QUERY_DATA,
encodeDataUser,
DataUserResponse
} from '@ucap-webmessenger/protocol-query';
import { decodeDataUser } from '../protocols/data-user';
@Injectable({
providedIn: 'root'
})
export class DaesangProtocolService {
constructor(private protocolService: ProtocolService) {}
public dataUserDaesang(req: DataUserRequest): Observable<DataUserResponse> {
return this.protocolService
.call(
SVC_TYPE_QUERY_DATA,
SSVC_TYPE_QUERY_DATA_USER_REQ,
...encodeDataUser(req)
)
.pipe(
take(1),
map(res => decodeDataUser(res))
);
}
}

View File

@ -1,8 +1,9 @@
import { NgModule, ModuleWithProviders } from '@angular/core'; import { NgModule, ModuleWithProviders } from '@angular/core';
import { DaesangCipherService } from './services/daesang-cipher.service'; import { DaesangCipherService } from './services/daesang-cipher.service';
import { DaesangProtocolService } from './services/daesang-protocol.service';
const SERVICES = [DaesangCipherService]; const SERVICES = [DaesangCipherService, DaesangProtocolService];
@NgModule({ @NgModule({
declarations: [], declarations: [],

View File

@ -3,5 +3,8 @@
*/ */
export * from './lib/services/daesang-cipher.service'; export * from './lib/services/daesang-cipher.service';
export * from './lib/services/daesang-protocol.service';
export * from './lib/ucap-daesang.module'; export * from './lib/ucap-daesang.module';
export * from './lib/protocols/data-user';

View File

@ -61,4 +61,11 @@ export interface UserInfoSS {
isValidLogin: boolean; isValidLogin: boolean;
/** 임직원유형(s) */ /** 임직원유형(s) */
employeeType: EmployeeType; employeeType: EmployeeType;
/** 사업장 */
workplace?: string;
/** 담당업무 */
responsibilities?: string;
/** 업무 상태 */
workstatus?: string;
} }

View File

@ -116,6 +116,28 @@
</div> </div>
<ul style="padding-top: 20px;"> <ul style="padding-top: 20px;">
<li>
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="20"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="butt"
stroke-linejoin="round"
>
<path
d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"
></path>
</svg>
<!-- <mat-form-field ucapInlineEditInput style="width: 100%;">
<input matInput [formControl]="userIntroFormControl" />
</mat-form-field> -->
<!-- <ucap-inline-edit ([value])="(userInfo.intro)"></ucap-inline-edit> -->
{{ userInfo.workplace }}
</li>
<li> <li>
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
@ -192,6 +214,50 @@
</svg> </svg>
{{ userInfo.hpNumber }} {{ userInfo.hpNumber }}
</li> </li>
<li>
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="20"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="butt"
stroke-linejoin="round"
>
<path
d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"
></path>
</svg>
<!-- <mat-form-field ucapInlineEditInput style="width: 100%;">
<input matInput [formControl]="userIntroFormControl" />
</mat-form-field> -->
<!-- <ucap-inline-edit ([value])="(userInfo.intro)"></ucap-inline-edit> -->
{{ userInfo.responsibilities }}
</li>
<li>
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="20"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="butt"
stroke-linejoin="round"
>
<path
d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"
></path>
</svg>
<!-- <mat-form-field ucapInlineEditInput style="width: 100%;">
<input matInput [formControl]="userIntroFormControl" />
</mat-form-field> -->
<!-- <ucap-inline-edit ([value])="(userInfo.intro)"></ucap-inline-edit> -->
{{ getWorkstatus(userInfo) }}
</li>
</ul> </ul>
</mat-card-content> </mat-card-content>
@ -227,7 +293,7 @@
*ngIf="!isMe" *ngIf="!isMe"
matTooltip="전화" matTooltip="전화"
matTooltipPosition="above" matTooltipPosition="above"
(click)="onClickCall()" (click)="onClickCall('LINE')"
> >
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
@ -246,6 +312,28 @@
</svg> </svg>
</button> </button>
<button
mat-mini-fab
class="mat-elevation-z"
*ngIf="!isMe"
matTooltip="모바일"
matTooltipPosition="above"
(click)="onClickCall('MOBILE')"
>
<span class="mdi mdi-cellphone-android mdi-24px"></span>
</button>
<button
mat-mini-fab
class="mat-elevation-z"
*ngIf="!isMe"
matTooltip="SMS"
matTooltipPosition="above"
(click)="onClickSMS()"
>
<span class="mdi mdi-email-outline mdi-24px"></span>
</button>
<button <button
mat-mini-fab mat-mini-fab
class="mat-elevation-z" class="mat-elevation-z"

View File

@ -9,7 +9,7 @@ import {
} from '@angular/core'; } from '@angular/core';
import { UserInfo } from '@ucap-webmessenger/protocol-sync'; import { UserInfo } from '@ucap-webmessenger/protocol-sync';
import { UserInfoF } from '@ucap-webmessenger/protocol-query'; import { UserInfoF, UserInfoSS } from '@ucap-webmessenger/protocol-query';
import { FileUploadItem } from '@ucap-webmessenger/api'; import { FileUploadItem } from '@ucap-webmessenger/api';
import { FormControl } from '@angular/forms'; import { FormControl } from '@angular/forms';
@ -28,20 +28,20 @@ export class ProfileComponent implements OnInit {
@Input() @Input()
isFavorit: boolean; isFavorit: boolean;
@Input() @Input()
userInfo: UserInfo | UserInfoF; userInfo: UserInfoSS;
@Output() @Output()
openChat = new EventEmitter<UserInfo | UserInfoF>(); openChat = new EventEmitter<UserInfoSS>();
@Output() @Output()
sendMessage = new EventEmitter<UserInfo | UserInfoF>(); sendMessage = new EventEmitter<UserInfoSS>();
@Output() @Output()
toggleFavorit = new EventEmitter<{ toggleFavorit = new EventEmitter<{
userInfo: UserInfo | UserInfoF; userInfo: UserInfoSS;
isFavorit: boolean; isFavorit: boolean;
}>(); }>();
@Output() @Output()
toggleBuddy = new EventEmitter<{ toggleBuddy = new EventEmitter<{
userInfo: UserInfo | UserInfoF; userInfo: UserInfoSS;
isBuddy: boolean; isBuddy: boolean;
}>(); }>();
@ -63,7 +63,9 @@ export class ProfileComponent implements OnInit {
this.openChat.emit(this.userInfo); this.openChat.emit(this.userInfo);
} }
onClickCall() {} onClickCall(type: string) {}
onClickSMS() {}
onClickVideoConference() {} onClickVideoConference() {}
@ -103,4 +105,26 @@ export class ProfileComponent implements OnInit {
this.profileImageFileInput.nativeElement.value = ''; this.profileImageFileInput.nativeElement.value = '';
} }
getWorkstatus(userInfo: UserInfoSS): string {
let workstatus = '';
if (!!userInfo && !!userInfo.workstatus) {
switch (userInfo.workstatus) {
case 'V01':
workstatus = '오전휴가';
break;
case 'V02':
workstatus = '오후휴가';
break;
case 'V03':
workstatus = '종일휴가';
break;
case 'V04':
workstatus = '장기휴가';
break;
}
}
return workstatus;
}
} }