프로필 정보 팝업 정보 수집방식 변경.

>> 기존 여려 type 으로 유입되는 userInfo 들을 SSVC_TYPE_QUERY_DATA_USER_REQ 프로토콜을 통한 {사용자정보SS} 타입으로 일괄처리하도록 수정.

>> 대상향으로 추가정보 추가 수집하도록 커스터마이징
This commit is contained in:
leejinho 2019-12-15 21:36:12 +09:00
parent 497f04efca
commit c193020409
12 changed files with 328 additions and 44 deletions

View File

@ -27,13 +27,14 @@ import {
} from '../chat/create-chat.dialog.component';
import { UserSelectDialogType, EnvironmentsInfo } from '@app/types';
import { take } from 'rxjs/operators';
import { UserInfoSS } from '@ucap-webmessenger/protocol-query';
export interface MessageWriteDialogData {
loginRes: LoginResponse;
environmentsInfo: EnvironmentsInfo;
detail?: DetailResponse;
detailContents?: string;
receiverList?: UserInfo[];
receiverList?: (UserInfo | UserInfoSS)[];
}
// 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';
describe('ProfileDialogComponent', () => {
describe('NoticeDialogComponent', () => {
let component: 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) {
this.store.dispatch(
ChatStore.openRoom({ userSeqList: [this.loginRes.talkWithMeBotSeq] })
@ -123,7 +123,7 @@ export class ProfileDialogComponent implements OnInit, OnDestroy {
this.dialogRef.close();
}
onClickSendMessage(userInfo: UserInfo) {
onClickSendMessage(userInfo: UserInfoSS) {
if (userInfo.seq !== this.loginRes.userSeq) {
this.dialogRef.close();
@ -145,10 +145,7 @@ export class ProfileDialogComponent implements OnInit, OnDestroy {
}
}
onClickToggleFavorit(param: {
userInfo: UserInfo | UserInfoF;
isFavorit: boolean;
}) {
onClickToggleFavorit(param: { userInfo: UserInfoSS; isFavorit: boolean }) {
this.store.dispatch(
SyncStore.updateBuddy({
seq: param.userInfo.seq,
@ -157,10 +154,7 @@ export class ProfileDialogComponent implements OnInit, OnDestroy {
);
}
async onClickToggleBuddy(param: {
userInfo: UserInfo | UserInfoF;
isBuddy: boolean;
}) {
async onClickToggleBuddy(param: { userInfo: UserInfoSS; isBuddy: boolean }) {
if (param.isBuddy) {
// 동료추가.
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 { 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 { Observable, Subscription } from 'rxjs';
import {
WindowIdle,
UCAP_NATIVE_SERVICE,
NativeService
} from '@ucap-webmessenger/native';
import { UCAP_NATIVE_SERVICE, NativeService } from '@ucap-webmessenger/native';
import { UserInfo } from '@ucap-webmessenger/protocol-sync';
import {
UserInfoSS,
UserInfoF,
UserInfoDN
UserInfoDN,
QueryProtocolService
} from '@ucap-webmessenger/protocol-query';
import { StatusProtocolService } from '@ucap-webmessenger/protocol-status';
import { StatusType, StatusCode } from '@ucap-webmessenger/core';
@ -26,9 +23,10 @@ import {
ProfileDialogData,
ProfileDialogResult
} from '@app/layouts/messenger/dialogs/profile/profile.dialog.component';
import { MatSidenav, MatDrawer } from '@angular/material';
import { SplitAreaDirective } from 'angular-split';
import { MatDrawer } from '@angular/material';
import { NGXLogger } from 'ngx-logger';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { DaesangProtocolService } from '@ucap-webmessenger/daesang';
@Component({
selector: 'app-page-messenger-main',
@ -44,19 +42,23 @@ export class MainPageComponent implements OnInit, OnDestroy {
defaultLeftSideComponentWidth = 380;
leftSideComponentWidth = this.defaultLeftSideComponentWidth;
loginRes: LoginResponse;
loginResSubscription: Subscription;
@ViewChild('rightDrawer', { static: true }) rightDrawer: MatDrawer;
constructor(
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService,
private store: Store<any>,
private statusProtocolService: StatusProtocolService,
private daesangProtocolService: DaesangProtocolService,
private dialogService: DialogService,
private logger: NGXLogger
) {}
ngOnInit(): void {
this.selectedChat$ = this.store.pipe(
select(AppSotre.MessengerSelector.ChatSelector.selectedRoom),
select(AppStore.MessengerSelector.ChatSelector.selectedRoom),
tap(selectedRoom => {
if (!selectedRoom) {
this.rightDrawer.close();
@ -65,7 +67,7 @@ export class MainPageComponent implements OnInit, OnDestroy {
})
);
this.selectedRightDrawer$ = this.store.pipe(
select(AppSotre.MessengerSelector.ChatSelector.selectedRightDrawer),
select(AppStore.MessengerSelector.ChatSelector.selectedRightDrawer),
tap(selectedRightDrawer => {
if (!!selectedRightDrawer) {
this.rightDrawer.open();
@ -101,6 +103,15 @@ export class MainPageComponent implements OnInit, OnDestroy {
.subscribe(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 {
@ -112,6 +123,10 @@ export class MainPageComponent implements OnInit, OnDestroy {
this.chatOpenRoomSubscription.unsubscribe();
}
if (!!this.loginResSubscription) {
this.loginResSubscription.unsubscribe();
}
this.logger.debug('-----------------------MainPageComponent ngOnDestroy');
}
@ -133,16 +148,59 @@ export class MainPageComponent implements OnInit, OnDestroy {
}
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<
ProfileDialogComponent,
ProfileDialogData,
ProfileDialogResult
>(ProfileDialogComponent, {
data: {
userInfo
userInfo: res.userInfo
}
});
}
})
)
.subscribe();
}
onCloseRightDrawer() {
this.rightDrawer.close();

View File

@ -26,7 +26,6 @@ import {
SSVC_TYPE_QUERY_DEPT_USER_RES,
DeptUserResponse
} from '@ucap-webmessenger/protocol-query';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { Store } from '@ngrx/store';
@ -106,7 +105,6 @@ export class Effects {
constructor(
private actions$: Actions,
private store: Store<any>,
private sessionStorageService: SessionStorageService,
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 { DaesangCipherService } from './services/daesang-cipher.service';
import { DaesangProtocolService } from './services/daesang-protocol.service';
const SERVICES = [DaesangCipherService];
const SERVICES = [DaesangCipherService, DaesangProtocolService];
@NgModule({
declarations: [],

View File

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

View File

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

View File

@ -116,6 +116,28 @@
</div>
<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>
<svg
xmlns="http://www.w3.org/2000/svg"
@ -192,6 +214,50 @@
</svg>
{{ userInfo.hpNumber }}
</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>
</mat-card-content>
@ -227,7 +293,7 @@
*ngIf="!isMe"
matTooltip="전화"
matTooltipPosition="above"
(click)="onClickCall()"
(click)="onClickCall('LINE')"
>
<svg
xmlns="http://www.w3.org/2000/svg"
@ -246,6 +312,28 @@
</svg>
</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
mat-mini-fab
class="mat-elevation-z"

View File

@ -9,7 +9,7 @@ import {
} from '@angular/core';
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 { FormControl } from '@angular/forms';
@ -28,20 +28,20 @@ export class ProfileComponent implements OnInit {
@Input()
isFavorit: boolean;
@Input()
userInfo: UserInfo | UserInfoF;
userInfo: UserInfoSS;
@Output()
openChat = new EventEmitter<UserInfo | UserInfoF>();
openChat = new EventEmitter<UserInfoSS>();
@Output()
sendMessage = new EventEmitter<UserInfo | UserInfoF>();
sendMessage = new EventEmitter<UserInfoSS>();
@Output()
toggleFavorit = new EventEmitter<{
userInfo: UserInfo | UserInfoF;
userInfo: UserInfoSS;
isFavorit: boolean;
}>();
@Output()
toggleBuddy = new EventEmitter<{
userInfo: UserInfo | UserInfoF;
userInfo: UserInfoSS;
isBuddy: boolean;
}>();
@ -63,7 +63,9 @@ export class ProfileComponent implements OnInit {
this.openChat.emit(this.userInfo);
}
onClickCall() {}
onClickCall(type: string) {}
onClickSMS() {}
onClickVideoConference() {}
@ -103,4 +105,26 @@ export class ProfileComponent implements OnInit {
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;
}
}