Merge branch 'master' of http://10.81.13.221:6990/Web/next-ucap-messenger
This commit is contained in:
commit
6e7b38bbbb
|
@ -0,0 +1,41 @@
|
|||
import { DeviceType, LocaleCode } from '@ucap-webmessenger/core';
|
||||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface BuddyAddRequest extends ProtocolRequest {
|
||||
// 0n. 사용자SEQ(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface BuddyAddResponse extends ProtocolResponse {
|
||||
// 0n. 사용자SEQ(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export const encodeBuddyAdd: ProtocolEncoder<BuddyAddRequest> = (
|
||||
req: BuddyAddRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
for (const userSeq of req.userSeqs) {
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
|
||||
}
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeBuddyAdd: ProtocolDecoder<BuddyAddResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
const userSeqArray: number[] = [...message.bodyList];
|
||||
return {
|
||||
userSeqs: userSeqArray
|
||||
} as BuddyAddResponse;
|
||||
};
|
|
@ -0,0 +1,41 @@
|
|||
import { DeviceType, LocaleCode } from '@ucap-webmessenger/core';
|
||||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface BuddyDelRequest extends ProtocolRequest {
|
||||
// 0n. 사용자SEQ(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface BuddyDelResponse extends ProtocolResponse {
|
||||
// 0n. 사용자SEQ(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export const encodeBuddyDel: ProtocolEncoder<BuddyDelRequest> = (
|
||||
req: BuddyDelRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
for (const userSeq of req.userSeqs) {
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
|
||||
}
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeBuddyDel: ProtocolDecoder<BuddyDelResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
const userSeqArray: number[] = [...message.bodyList];
|
||||
return {
|
||||
userSeqs: userSeqArray
|
||||
} as BuddyDelResponse;
|
||||
};
|
|
@ -0,0 +1,47 @@
|
|||
import { DeviceType, LocaleCode } from '@ucap-webmessenger/core';
|
||||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface BuddyUpdateRequest extends ProtocolRequest {
|
||||
// 0. 사용자SEQ(n)
|
||||
userSeq: number;
|
||||
// 1. 즐겨찾기여부(y)
|
||||
isFavorit: boolean;
|
||||
}
|
||||
|
||||
export interface BuddyUpdateResponse extends ProtocolResponse {
|
||||
// 0. 사용자SEQ(n)
|
||||
userSeq: number;
|
||||
// 1. 즐겨찾기여부(y)
|
||||
isFavorit: boolean;
|
||||
}
|
||||
|
||||
export const encodeBuddyUpdate: ProtocolEncoder<BuddyUpdateRequest> = (
|
||||
req: BuddyUpdateRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: req.userSeq });
|
||||
bodyList.push({
|
||||
type: PacketBodyValue.String,
|
||||
value: req.isFavorit ? 'Y' : 'N'
|
||||
});
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeBuddyUpdate: ProtocolDecoder<BuddyUpdateResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
userSeq: message.bodyList[0],
|
||||
isFavorit: message.bodyList[1] === 'Y' ? true : false
|
||||
} as BuddyUpdateResponse;
|
||||
};
|
|
@ -1,8 +1,66 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, take } from 'rxjs/operators';
|
||||
|
||||
import { ProtocolService } from '@ucap-webmessenger/protocol';
|
||||
|
||||
import {
|
||||
SVC_TYPE_BUDDY,
|
||||
SSVC_TYPE_BUDDY_ADD_REQ,
|
||||
SSVC_TYPE_BUDDY_DEL_REQ,
|
||||
SSVC_TYPE_BUDDY_UPD_REQ
|
||||
} from '../types/service';
|
||||
|
||||
import {
|
||||
BuddyAddRequest,
|
||||
encodeBuddyAdd,
|
||||
decodeBuddyAdd,
|
||||
BuddyAddResponse
|
||||
} from '../models/buddy-add';
|
||||
import {
|
||||
BuddyDelRequest,
|
||||
encodeBuddyDel,
|
||||
decodeBuddyDel,
|
||||
BuddyDelResponse
|
||||
} from '../models/buddy-del';
|
||||
import {
|
||||
BuddyUpdateRequest,
|
||||
decodeBuddyUpdate,
|
||||
encodeBuddyUpdate,
|
||||
BuddyUpdateResponse
|
||||
} from '../models/buddy-update';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class BuddyProtocolService {
|
||||
constructor() {}
|
||||
constructor(private protocolService: ProtocolService) {}
|
||||
|
||||
public buddyAdd(req: BuddyAddRequest): Observable<BuddyAddResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_BUDDY, SSVC_TYPE_BUDDY_ADD_REQ, ...encodeBuddyAdd(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeBuddyAdd(res))
|
||||
);
|
||||
}
|
||||
|
||||
public buddyDel(req: BuddyDelRequest): Observable<BuddyDelResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_BUDDY, SSVC_TYPE_BUDDY_DEL_REQ, ...encodeBuddyDel(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeBuddyDel(res))
|
||||
);
|
||||
}
|
||||
|
||||
public buddyUpdate(req: BuddyUpdateRequest): Observable<BuddyUpdateResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_BUDDY, SSVC_TYPE_BUDDY_UPD_REQ, ...encodeBuddyUpdate(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeBuddyUpdate(res))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
export const SVC_TYPE_BUDDY = 4; // 동료 관리
|
||||
export const SSVC_TYPE_BUDDY_ADD_REQ = 1; // 동료추가
|
||||
export const SSVC_TYPE_BUDDY_ADD_RES = 2;
|
||||
export const SSVC_TYPE_BUDDY_DEL_REQ = 11; // 동료삭제
|
||||
export const SSVC_TYPE_BUDDY_DEL_RES = 12;
|
||||
export const SSVC_TYPE_BUDDY_UPD_REQ = 21; // 동료변경
|
||||
export const SSVC_TYPE_BUDDY_UPD_RES = 22;
|
|
@ -1,6 +1,9 @@
|
|||
/*
|
||||
* Public API Surface of ucap-webmessenger-protocol-buddy
|
||||
*/
|
||||
export * from './lib/models/buddy-add';
|
||||
export * from './lib/models/buddy-del';
|
||||
export * from './lib/models/buddy-update';
|
||||
|
||||
export * from './lib/services/buddy-protocol.service';
|
||||
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage,
|
||||
ProtocolStream,
|
||||
PacketBodyValue
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
import { EventType } from '../types/event.type';
|
||||
import { PushStatus } from '../types/pushStatus.type';
|
||||
|
||||
export interface EventSendRequest extends ProtocolRequest {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 1. 이벤트타입(s)
|
||||
type: EventType;
|
||||
// 2. 이벤트내용(s)
|
||||
sentMessage: string;
|
||||
}
|
||||
|
||||
export interface EventSendResponse {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 이벤트SEQ(n)
|
||||
seq: number;
|
||||
// 이벤트타입(s)
|
||||
type: EventType;
|
||||
// 발생일시(s)
|
||||
sendDate: string;
|
||||
// 이벤트내용(s)
|
||||
message: string;
|
||||
// 수신자수
|
||||
receiverCount: number;
|
||||
// 알림상태(s) PC 경우에만 관여됨 N: 푸시를 보내지 않은 이벤트 S: 푸시를 보낸 이벤트
|
||||
pushStatus: PushStatus;
|
||||
// 강퇴 타입(s)
|
||||
ForcedExitType: string;
|
||||
// 요청자 이름(s)
|
||||
senderName: string;
|
||||
}
|
||||
|
||||
export interface EventSendNotification extends EventSendResponse {
|
||||
// 대화방SEQ(s)
|
||||
// 이벤트SEQ(n)
|
||||
// 이벤트타입(s)
|
||||
// 발생일시(s)
|
||||
// 이벤트내용(s)
|
||||
// 수신자수
|
||||
// 알림상태(s) PC 경우에만 관여됨 N: 푸시를 보내지 않은 이벤트 S: 푸시를 보낸 이벤트
|
||||
// 강퇴 타입(s)
|
||||
// 요청자 이름(s)
|
||||
|
||||
// 사용자아이디(s)
|
||||
id?: string;
|
||||
// 회사코드(s)
|
||||
companyCode?: string;
|
||||
}
|
||||
|
||||
export const encodeEventSend: ProtocolEncoder<EventSendRequest> = (
|
||||
req: EventSendRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push(
|
||||
{ type: PacketBodyValue.String, value: req.roomSeq },
|
||||
{ type: PacketBodyValue.String, value: req.type },
|
||||
{ type: PacketBodyValue.String, value: req.sentMessage }
|
||||
);
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeEventSend: ProtocolDecoder<EventSendResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
seq: message.bodyList[1],
|
||||
type: message.bodyList[2] as EventType,
|
||||
sendDate: message.bodyList[3],
|
||||
message: message.bodyList[4],
|
||||
receiverCount: message.bodyList[5] || 0,
|
||||
pushStatus: message.bodyList[6] as PushStatus,
|
||||
ForcedExitType: message.bodyList[7],
|
||||
senderName: message.bodyList[8]
|
||||
} as EventSendResponse;
|
||||
};
|
||||
|
||||
export const decodeEventSendNotification: ProtocolDecoder<
|
||||
EventSendNotification
|
||||
> = (message: ProtocolMessage) => {
|
||||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
seq: message.bodyList[1],
|
||||
type: message.bodyList[2] as EventType,
|
||||
sendDate: message.bodyList[3],
|
||||
message: message.bodyList[4],
|
||||
receiverCount: message.bodyList[5] || 0,
|
||||
pushStatus: message.bodyList[6] as PushStatus,
|
||||
ForcedExitType: message.bodyList[7],
|
||||
senderName: message.bodyList[8],
|
||||
id: message.bodyList[9],
|
||||
companyCode: message.bodyList[10]
|
||||
} as EventSendNotification;
|
||||
};
|
|
@ -1,7 +1,7 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, takeWhile, timeout } from 'rxjs/operators';
|
||||
import { map, takeWhile, timeout, take } from 'rxjs/operators';
|
||||
|
||||
import { ProtocolService } from '@ucap-webmessenger/protocol';
|
||||
|
||||
|
@ -17,8 +17,15 @@ import {
|
|||
SVC_TYPE_EVENT,
|
||||
SSVC_TYPE_EVENT_INFO_REQ,
|
||||
SSVC_TYPE_EVENT_INFO_RES,
|
||||
SSVC_TYPE_EVENT_INFO_DATA
|
||||
SSVC_TYPE_EVENT_INFO_DATA,
|
||||
SSVC_TYPE_EVENT_SEND_REQ
|
||||
} from '../types/service';
|
||||
import {
|
||||
EventSendRequest,
|
||||
EventSendResponse,
|
||||
decodeEventSend,
|
||||
encodeEventSend
|
||||
} from '../models/event-send';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@ -39,4 +46,15 @@ export class EventProtocolService {
|
|||
})
|
||||
);
|
||||
}
|
||||
|
||||
public eventSend(req: EventSendRequest): Observable<EventSendResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_EVENT, SSVC_TYPE_EVENT_SEND_REQ, ...encodeEventSend(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => {
|
||||
return decodeEventSend(res);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
export enum PushStatus {
|
||||
// PC 경우에만 관여됨
|
||||
// N: 푸시를 보내지 않은 이벤트
|
||||
NotSent = 'N',
|
||||
// S: 푸시를 보낸 이벤트
|
||||
Sent = 'S'
|
||||
}
|
|
@ -5,3 +5,5 @@
|
|||
export * from './lib/services/event-protocol.service';
|
||||
|
||||
export * from './lib/ucap-event-protocol.module';
|
||||
|
||||
export * from './lib/types/event.type';
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
import { DeviceType, LocaleCode } from '@ucap-webmessenger/core';
|
||||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface GroupAddRequest extends ProtocolRequest {
|
||||
// 0. 동료그룹이름
|
||||
groupName: string;
|
||||
}
|
||||
|
||||
export interface GroupAddResponse extends ProtocolResponse {
|
||||
// 0: 동료그룹SEQ(n)
|
||||
groupSeq: number;
|
||||
// 1: 동료그룹이름(s)
|
||||
groupName: string;
|
||||
}
|
||||
|
||||
export const encodeGroupAdd: ProtocolEncoder<GroupAddRequest> = (
|
||||
req: GroupAddRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.groupName });
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeGroupAdd: ProtocolDecoder<GroupAddResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
groupSeq: message.bodyList[0],
|
||||
groupName: message.bodyList[1]
|
||||
} as GroupAddResponse;
|
||||
};
|
|
@ -0,0 +1,38 @@
|
|||
import { DeviceType, LocaleCode } from '@ucap-webmessenger/core';
|
||||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface GroupDelRequest extends ProtocolRequest {
|
||||
// 0: 동료그룹SEQ(n)
|
||||
groupSeq: number;
|
||||
}
|
||||
|
||||
export interface GroupDelResponse extends ProtocolResponse {
|
||||
// 0: 동료그룹SEQ(n)
|
||||
groupSeq: number;
|
||||
}
|
||||
|
||||
export const encodeGroupDel: ProtocolEncoder<GroupDelRequest> = (
|
||||
req: GroupDelRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: req.groupSeq });
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeGroupDel: ProtocolDecoder<GroupDelResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
groupSeq: message.bodyList[0]
|
||||
} as GroupDelResponse;
|
||||
};
|
|
@ -0,0 +1,91 @@
|
|||
import { DeviceType, LocaleCode } from '@ucap-webmessenger/core';
|
||||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface GroupUpdateRequest extends ProtocolRequest {
|
||||
// 0: 동료그룹SEQ(n)
|
||||
groupSeq: number;
|
||||
// 1: 동료그룹이름(s)
|
||||
groupName: string;
|
||||
// 2n: 사용자SEQ(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface GroupUpdateResponse extends ProtocolResponse {
|
||||
// 0: 동료그룹SEQ(n)
|
||||
groupSeq: number;
|
||||
// 1: 동료그룹이름(s)
|
||||
groupName: string;
|
||||
// 2n: 사용자SEQ(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export const encodeGroupUpdate: ProtocolEncoder<GroupUpdateRequest> = (
|
||||
req: GroupUpdateRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push(
|
||||
{ type: PacketBodyValue.Integer, value: req.groupSeq },
|
||||
{ type: PacketBodyValue.String, value: req.groupName },
|
||||
{ type: PacketBodyValue.String, value: req.userSeqs.join(',') }
|
||||
);
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeGroupUpdate: ProtocolDecoder<GroupUpdateResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
let userSeqArray: number[] = [];
|
||||
if (message.bodyList.length > 2 && !message.bodyList[2].empty()) {
|
||||
userSeqArray = message.bodyList[2].split(',').map((v: any) => Number(v));
|
||||
}
|
||||
|
||||
return {
|
||||
groupSeq: message.bodyList[0],
|
||||
groupName: message.bodyList[1],
|
||||
userSeqs: userSeqArray
|
||||
} as GroupUpdateResponse;
|
||||
};
|
||||
|
||||
export const encodeGroupUpdate2: ProtocolEncoder<GroupUpdateRequest> = (
|
||||
req: GroupUpdateRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push(
|
||||
{ type: PacketBodyValue.Integer, value: req.groupSeq },
|
||||
{ type: PacketBodyValue.String, value: req.groupName }
|
||||
);
|
||||
|
||||
if (req.userSeqs.length > 0) {
|
||||
req.userSeqs.forEach(userSeq => {
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
|
||||
});
|
||||
}
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeGroupUpdate2: ProtocolDecoder<GroupUpdateResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
let userSeqArray: number[] = [];
|
||||
if (message.bodyList.length > 2) {
|
||||
userSeqArray = message.bodyList.slice(2);
|
||||
}
|
||||
|
||||
return {
|
||||
groupSeq: message.bodyList[0],
|
||||
groupName: message.bodyList[1],
|
||||
userSeqs: userSeqArray
|
||||
} as GroupUpdateResponse;
|
||||
};
|
|
@ -1,8 +1,81 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, take } from 'rxjs/operators';
|
||||
|
||||
import { ProtocolService } from '@ucap-webmessenger/protocol';
|
||||
import {
|
||||
GroupAddRequest,
|
||||
encodeGroupAdd,
|
||||
decodeGroupAdd,
|
||||
GroupAddResponse
|
||||
} from '../models/group-add';
|
||||
import {
|
||||
SVC_TYPE_GROUP,
|
||||
SSVC_TYPE_GROUP_ADD_REQ,
|
||||
SSVC_TYPE_GROUP_DEL_REQ,
|
||||
SSVC_TYPE_GROUP_UPD_REQ,
|
||||
SSVC_TYPE_GROUP_UPD_REQ2
|
||||
} from '../types/service';
|
||||
import {
|
||||
GroupDelRequest,
|
||||
encodeGroupDel,
|
||||
decodeGroupDel,
|
||||
GroupDelResponse
|
||||
} from '../models/group-del';
|
||||
import {
|
||||
GroupUpdateRequest,
|
||||
encodeGroupUpdate,
|
||||
decodeGroupUpdate,
|
||||
encodeGroupUpdate2,
|
||||
decodeGroupUpdate2,
|
||||
GroupUpdateResponse
|
||||
} from '../models/group-update';
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class GroupProtocolService {
|
||||
constructor() {}
|
||||
constructor(private protocolService: ProtocolService) {}
|
||||
|
||||
public groupAdd(req: GroupAddRequest): Observable<GroupAddResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_GROUP, SSVC_TYPE_GROUP_ADD_REQ, ...encodeGroupAdd(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeGroupAdd(res))
|
||||
);
|
||||
}
|
||||
|
||||
public groupDel(req: GroupDelRequest): Observable<GroupDelResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_GROUP, SSVC_TYPE_GROUP_DEL_REQ, ...encodeGroupDel(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeGroupDel(res))
|
||||
);
|
||||
}
|
||||
|
||||
public groupUpdate(req: GroupUpdateRequest): Observable<GroupUpdateResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_GROUP, SSVC_TYPE_GROUP_UPD_REQ, ...encodeGroupUpdate(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeGroupUpdate(res))
|
||||
);
|
||||
}
|
||||
|
||||
public groupUpdate2(
|
||||
req: GroupUpdateRequest
|
||||
): Observable<GroupUpdateResponse> {
|
||||
return this.protocolService
|
||||
.call(
|
||||
SVC_TYPE_GROUP,
|
||||
SSVC_TYPE_GROUP_UPD_REQ2,
|
||||
...encodeGroupUpdate2(req)
|
||||
)
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeGroupUpdate2(res))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
export const SVC_TYPE_GROUP = 5; // 동료 그룹 관리
|
||||
export const SSVC_TYPE_GROUP_ADD_REQ = 1; // 동료 그룹 추가
|
||||
export const SSVC_TYPE_GROUP_ADD_RES = 2;
|
||||
export const SSVC_TYPE_GROUP_DEL_REQ = 11; // 동료 그룹 삭제
|
||||
export const SSVC_TYPE_GROUP_DEL_RES = 12;
|
||||
export const SSVC_TYPE_GROUP_UPD_REQ = 21; // 동료 그룹 변경
|
||||
export const SSVC_TYPE_GROUP_UPD_RES = 22;
|
||||
export const SSVC_TYPE_GROUP_UPD_REQ2 = 23;
|
||||
export const SSVC_TYPE_GROUP_UPD_RES2 = 24;
|
|
@ -1,6 +1,9 @@
|
|||
/*
|
||||
* Public API Surface of ucap-webmessenger-protocol-group
|
||||
*/
|
||||
export * from './lib/models/group-add';
|
||||
export * from './lib/models/group-del';
|
||||
export * from './lib/models/group-update';
|
||||
|
||||
export * from './lib/services/group-protocol.service';
|
||||
|
||||
|
|
|
@ -0,0 +1,302 @@
|
|||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage,
|
||||
BodyStringDivider
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
import { LocaleCode } from '@ucap-webmessenger/core';
|
||||
import { RoomType } from '../types/room.type';
|
||||
import { EventType } from '@ucap-webmessenger/protocol-event';
|
||||
import { EmployeeType } from '../types/employee.type';
|
||||
import { RoleCode } from '@ucap-webmessenger/protocol-authentication';
|
||||
|
||||
export interface RoomInfo {
|
||||
// 0. 대화방SEQ
|
||||
roomSeq: string;
|
||||
// 1. 대화방종류
|
||||
roomType: RoomType;
|
||||
// 2. 대화방명
|
||||
roomName: string;
|
||||
// 3. 최종타입
|
||||
finalEventType: EventType;
|
||||
// 4. 최종대화
|
||||
finalEventMessage: string;
|
||||
// 5. 최종시간
|
||||
finalEventDate: string;
|
||||
// 6. 참여인원수
|
||||
joinUserCount: number;
|
||||
// 7. 안읽은수
|
||||
noReadCnt: number;
|
||||
// 8. 알람여부
|
||||
isAlarm: boolean;
|
||||
// 9. 참여여부
|
||||
isJoinRoom: boolean;
|
||||
// 10. 유효한파일 이벤트 기준 SEQ
|
||||
expiredFileStdSeq: number;
|
||||
// 11. 타이머대화방여부YN
|
||||
isTimeRoom: boolean;
|
||||
// 12. 타이머시간(n)
|
||||
timeRoomInterval: number;
|
||||
}
|
||||
|
||||
export interface UserInfoShort {
|
||||
// 0. 사용자SEQ
|
||||
userSeq: number;
|
||||
// 1. 사용자명
|
||||
name: string;
|
||||
// 2. 사진파일
|
||||
profileImageFile: string;
|
||||
// 3. 참여여부
|
||||
isJoinRoom: boolean;
|
||||
// 4. 최종확인SEQ
|
||||
lastReadEventSeq: number;
|
||||
// 5. MADN
|
||||
madn: string;
|
||||
// 6. HARDPHONE_SADN
|
||||
hardSadn: string;
|
||||
// 7. FMC_SADN
|
||||
fmcSadn: string;
|
||||
// 8. 사용자명(영어)
|
||||
nameEn: string;
|
||||
// 9. 사용자명(중국어)
|
||||
nameCn: string;
|
||||
// 10. 이용약관동의여부YN
|
||||
isPrivacyAgree: boolean;
|
||||
// 11. 유효접속여부YN
|
||||
isValidLogin: boolean;
|
||||
// 12. 임직원유형(s)
|
||||
employeeType: EmployeeType;
|
||||
// 13. 폰트색(s)
|
||||
fontColor: string;
|
||||
}
|
||||
|
||||
export interface UserInfo {
|
||||
// 0. 사용자SEQ
|
||||
userSeq: number;
|
||||
// 1. 사용자명
|
||||
name: string;
|
||||
// 2. 사진파일
|
||||
profileImageFile: string;
|
||||
// 3. 직급
|
||||
grade: string;
|
||||
// 4. 업무소개
|
||||
intro: string;
|
||||
// 5. 기관코드
|
||||
companyCode: string;
|
||||
// 6. 핸드폰번호
|
||||
hpNumber: string;
|
||||
// 7. 내선번호
|
||||
lineNumber: string;
|
||||
// 8. 이메일
|
||||
email: string;
|
||||
// 9. 모바일YN
|
||||
isMobile: boolean;
|
||||
// 10. 부서명
|
||||
deptName: string;
|
||||
// 11. 참여 여부 <<<<
|
||||
isJoinRoom: boolean;
|
||||
// 12. 최종확인SEQ <<<<
|
||||
lastReadEventSeq: number;
|
||||
// 13. ActiveYN
|
||||
isActive: boolean;
|
||||
// 14. 역할코드
|
||||
roleCd: RoleCode;
|
||||
// 15. 사번
|
||||
employeeNum: string;
|
||||
// 16. MADN
|
||||
madn: string;
|
||||
// 17. HARDPHONE_SADN
|
||||
hardSadn: string;
|
||||
// 18. FMC_SADN
|
||||
fmcSadn: string;
|
||||
// 19. 사용자명(영어)
|
||||
nameEn: string;
|
||||
// 20. 사용자명(중국어)
|
||||
nameCn: string;
|
||||
// 21. 직급(영어)
|
||||
gradeEn: string;
|
||||
// 22. 직급(중국어)
|
||||
gradeCn: string;
|
||||
// 23. 부서명(영어)
|
||||
deptNameEn: string;
|
||||
// 24. 부서명(중국어)
|
||||
deptNameCn: string;
|
||||
// 25. CALL_MODE <<<
|
||||
callMode: string;
|
||||
// 26. 이용약관동의여부YN
|
||||
isPrivacyAgree: boolean;
|
||||
// 27. 유효접속여부YN
|
||||
isValidLogin: boolean;
|
||||
// 28. 임직원유형(s)
|
||||
employeeType: EmployeeType;
|
||||
// 29. 사용자아이디(s) <<<
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface RoomInfoRequest extends ProtocolRequest {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 1. 상세정보여부(y)
|
||||
isDetail: boolean;
|
||||
// 2. 언어코드(s)
|
||||
localeCode: LocaleCode;
|
||||
}
|
||||
|
||||
export interface RoomInfoResponse extends ProtocolResponse {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
}
|
||||
|
||||
export interface RoomInfoDataResponse extends ProtocolResponse {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 1. {대화방정보}
|
||||
roomInfo: RoomInfo;
|
||||
}
|
||||
|
||||
export interface RoomUserShortDataResponse extends ProtocolResponse {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 1n. {참여자정보}
|
||||
userInfos: UserInfoShort[];
|
||||
}
|
||||
export interface RoomUserDataResponse extends ProtocolResponse {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 1n. {참여자정보-D}
|
||||
userInfos: UserInfo[];
|
||||
}
|
||||
|
||||
export const encodeRoomInfo: ProtocolEncoder<RoomInfoRequest> = (
|
||||
req: RoomInfoRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq });
|
||||
bodyList.push({
|
||||
type: PacketBodyValue.String,
|
||||
value: req.isDetail !== true ? 'N' : 'Y'
|
||||
}); // 요청응답을 상세로 받는것을 default
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.localeCode });
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomInfo: ProtocolDecoder<RoomInfoResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
roomSeq: message.bodyList[0]
|
||||
} as RoomInfoResponse;
|
||||
};
|
||||
|
||||
export const decodeRoomInfoData: ProtocolDecoder<RoomInfoDataResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
let roomInfo: RoomInfo = null;
|
||||
if (message.bodyList.length > 1) {
|
||||
const info = message.bodyList[1].split(BodyStringDivider);
|
||||
if (info.length > 11) {
|
||||
roomInfo = {
|
||||
roomSeq: info[0],
|
||||
roomType: info[1],
|
||||
roomName: info[2],
|
||||
finalEventType: info[3] as EventType,
|
||||
finalEventMessage: info[4],
|
||||
finalEventDate: info[5],
|
||||
joinUserCount: info[6],
|
||||
noReadCnt: info[7],
|
||||
isAlarm: info[8] !== 'N' ? true : false,
|
||||
isJoinRoom: info[9] === 'Y' ? true : false,
|
||||
expiredFileStdSeq: info[10],
|
||||
isTimeRoom: info[11] === 'Y' ? true : false,
|
||||
timeRoomInterval: info[11] !== 'Y' ? 0 : info[12] || 0
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
roomInfo
|
||||
} as RoomInfoDataResponse;
|
||||
};
|
||||
|
||||
export const decodeRoomUserShortData: ProtocolDecoder<
|
||||
RoomUserShortDataResponse
|
||||
> = (message: ProtocolMessage) => {
|
||||
const userInfos: UserInfoShort[] = [];
|
||||
message.bodyList.slice(1).forEach(userInfo => {
|
||||
const info = userInfo.split(BodyStringDivider);
|
||||
userInfos.push({
|
||||
userSeq: info[0],
|
||||
name: info[1],
|
||||
profileImageFile: info[2],
|
||||
isJoinRoom: info[3],
|
||||
lastReadEventSeq: info[4],
|
||||
madn: info[5],
|
||||
hardSadn: info[6],
|
||||
fmcSadn: info[7],
|
||||
nameEn: info[8],
|
||||
nameCn: info[9],
|
||||
isPrivacyAgree: info[10] === 'Y' ? true : false,
|
||||
isValidLogin: info[11] === 'Y' ? true : false,
|
||||
employeeType: info[12] as EmployeeType,
|
||||
fontColor: info[13]
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
userInfos
|
||||
} as RoomUserShortDataResponse;
|
||||
};
|
||||
|
||||
export const decodeRoomUserData: ProtocolDecoder<RoomUserDataResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
const userInfos: UserInfo[] = [];
|
||||
message.bodyList.slice(1).forEach(userInfo => {
|
||||
const info = userInfo.split(BodyStringDivider);
|
||||
userInfos.push({
|
||||
userSeq: 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],
|
||||
isJoinRoom: info[11] === 'Y' ? true : false,
|
||||
lastReadEventSeq: info[12],
|
||||
isActive: info[13] === 'Y' ? true : false,
|
||||
roleCd: info[14] as RoleCode,
|
||||
employeeNum: info[15],
|
||||
madn: info[16],
|
||||
hardSadn: info[17],
|
||||
fmcSadn: info[18],
|
||||
nameEn: info[19],
|
||||
nameCn: info[20],
|
||||
gradeEn: info[21],
|
||||
gradeCn: info[22],
|
||||
deptNameEn: info[23],
|
||||
deptNameCn: info[24],
|
||||
callMode: info[25],
|
||||
isPrivacyAgree: info[26] === 'Y' ? true : false,
|
||||
isValidLogin: info[27] === 'Y' ? true : false,
|
||||
employeeType: info[28] as EmployeeType,
|
||||
id: info[29]
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
userInfos
|
||||
} as RoomUserDataResponse;
|
||||
};
|
|
@ -0,0 +1,50 @@
|
|||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface RoomInviteRequest extends ProtocolRequest {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 1n. 초대자 userSeq(n)...
|
||||
inviteUserSeqs: number[];
|
||||
}
|
||||
|
||||
export interface RoomInviteResponse extends ProtocolResponse {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
}
|
||||
|
||||
export const encodeRoomInvite: ProtocolEncoder<RoomInviteRequest> = (
|
||||
req: RoomInviteRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq });
|
||||
for (const userSeq of req.inviteUserSeqs) {
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
|
||||
}
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomInvite: ProtocolDecoder<RoomInviteResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
roomSeq: message.bodyList[0]
|
||||
} as RoomInviteResponse;
|
||||
};
|
||||
|
||||
export const decodeRoomInviteNotification: ProtocolDecoder<
|
||||
RoomInviteResponse
|
||||
> = (message: ProtocolMessage) => {
|
||||
return {
|
||||
roomSeq: message.bodyList[0]
|
||||
} as RoomInviteResponse;
|
||||
};
|
|
@ -0,0 +1,48 @@
|
|||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface RoomOpenRequest extends ProtocolRequest {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1n. 초대자 userSeq(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface RoomOpenResponse extends ProtocolResponse {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 2. 신규여부(y)
|
||||
newRoom: boolean;
|
||||
}
|
||||
|
||||
export const encodeRoomOpen: ProtocolEncoder<RoomOpenRequest> = (
|
||||
req: RoomOpenRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
|
||||
for (const userSeq of req.userSeqs) {
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
|
||||
}
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomOpen: ProtocolDecoder<RoomOpenResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
divCd: message.bodyList[0],
|
||||
roomSeq: message.bodyList[1],
|
||||
newRoom: message.bodyList[2] === 'Y' ? true : false
|
||||
} as RoomOpenResponse;
|
||||
};
|
|
@ -0,0 +1,54 @@
|
|||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface RoomOpen2Request extends ProtocolRequest {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방제목(s)
|
||||
roomName: string;
|
||||
// 2n. 초대자 userSeq(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface RoomOpen2Response extends ProtocolResponse {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방제목(s)
|
||||
roomName: string;
|
||||
// 2. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 3. 신규여부(y)
|
||||
newRoom: boolean;
|
||||
}
|
||||
|
||||
export const encodeRoomOpen2: ProtocolEncoder<RoomOpen2Request> = (
|
||||
req: RoomOpen2Request
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomName.trim() });
|
||||
for (const userSeq of req.userSeqs) {
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
|
||||
}
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomOpen2: ProtocolDecoder<RoomOpen2Response> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
divCd: message.bodyList[0],
|
||||
roomName: message.bodyList[1],
|
||||
roomSeq: message.bodyList[2],
|
||||
newRoom: message.bodyList[3] === 'Y' ? true : false
|
||||
} as RoomOpen2Response;
|
||||
};
|
|
@ -0,0 +1,72 @@
|
|||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface RoomOpen3Request extends ProtocolRequest {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방제목(s)
|
||||
roomName: string;
|
||||
// 2. 타이머대화방여부YN(s)
|
||||
isTimerRoom: boolean;
|
||||
// 3. 타이머시간(n)
|
||||
timerRoomInterval: number;
|
||||
// 4n. 초대자 userSeq(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface RoomOpen3Response extends ProtocolResponse {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방제목(s)
|
||||
roomName: string;
|
||||
// 2. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 3. 신규여부(y)
|
||||
newRoom: boolean;
|
||||
// 4. 타이머대화방여부YN(s)
|
||||
isTimerRoom: boolean;
|
||||
// 5. 타이머시간(n)
|
||||
timerRoomInterval: number;
|
||||
}
|
||||
|
||||
export const encodeRoomOpen3: ProtocolEncoder<RoomOpen3Request> = (
|
||||
req: RoomOpen3Request
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomName.trim() });
|
||||
bodyList.push({
|
||||
type: PacketBodyValue.String,
|
||||
value: req.isTimerRoom === true ? 'Y' : 'N'
|
||||
});
|
||||
bodyList.push({
|
||||
type: PacketBodyValue.Integer,
|
||||
value: req.isTimerRoom !== true ? 0 : req.timerRoomInterval
|
||||
});
|
||||
for (const userSeq of req.userSeqs) {
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
|
||||
}
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomOpen3: ProtocolDecoder<RoomOpen3Response> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
divCd: message.bodyList[0],
|
||||
roomName: message.bodyList[1],
|
||||
roomSeq: message.bodyList[2],
|
||||
newRoom: message.bodyList[3] === 'Y' ? true : false,
|
||||
isTimerRoom: message.bodyList[4] === 'Y' ? true : false,
|
||||
timerRoomInterval: message.bodyList[5] || 0
|
||||
} as RoomOpen3Response;
|
||||
};
|
|
@ -0,0 +1,73 @@
|
|||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface RoomOpen4Request extends ProtocolRequest {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방제목(s)
|
||||
roomName: string;
|
||||
// 2. 타이머대화방여부YN(s)
|
||||
isTimerRoom: boolean;
|
||||
// 3. 타이머시간(n)
|
||||
timerRoomInterval: number;
|
||||
// 4n. 초대자 userSeq(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface RoomOpen4Response extends ProtocolResponse {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방제목(s)
|
||||
roomName: string;
|
||||
// 2. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 3. 신규여부(y)
|
||||
newRoom: boolean;
|
||||
// 4. 타이머대화방여부YN(s)
|
||||
isTimerRoom: boolean;
|
||||
// 5. 타이머시간(n)
|
||||
timerRoomInterval: number;
|
||||
}
|
||||
|
||||
export const encodeRoomOpen4: ProtocolEncoder<RoomOpen4Request> = (
|
||||
req: RoomOpen4Request
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomName.trim() });
|
||||
bodyList.push({
|
||||
type: PacketBodyValue.String,
|
||||
value: req.isTimerRoom === true ? 'Y' : 'N'
|
||||
});
|
||||
bodyList.push({
|
||||
type: PacketBodyValue.Integer,
|
||||
value: req.isTimerRoom !== true ? 0 : req.timerRoomInterval
|
||||
});
|
||||
for (const userSeq of req.userSeqs) {
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
|
||||
}
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomOpen4: ProtocolDecoder<RoomOpen4Response> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
divCd: message.bodyList[0],
|
||||
roomName: message.bodyList[1],
|
||||
roomSeq: message.bodyList[2],
|
||||
newRoom: message.bodyList[3] === 'Y' ? true : false,
|
||||
isTimerRoom: message.bodyList[4] === 'Y' ? true : false,
|
||||
timerRoomInterval:
|
||||
message.bodyList[4] !== 'Y' ? 0 : message.bodyList[5] || 0
|
||||
} as RoomOpen4Response;
|
||||
};
|
|
@ -1,8 +1,139 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, take, takeWhile } from 'rxjs/operators';
|
||||
|
||||
import { ProtocolService } from '@ucap-webmessenger/protocol';
|
||||
import {
|
||||
SVC_TYPE_ROOM,
|
||||
SSVC_TYPE_ROOM_OPEN_REQ,
|
||||
SSVC_TYPE_ROOM_OPEN2_REQ,
|
||||
SSVC_TYPE_ROOM_OPEN3_REQ,
|
||||
SSVC_TYPE_ROOM_OPEN4_REQ,
|
||||
SSVC_TYPE_ROOM_INVITE_REQ,
|
||||
SSVC_TYPE_ROOM_INFO_ROOM,
|
||||
SSVC_TYPE_ROOM_INFO_RES,
|
||||
SSVC_TYPE_ROOM_INFO_REQ,
|
||||
SSVC_TYPE_ROOM_INFO_USER,
|
||||
SSVC_TYPE_ROOM_INFO_USER2
|
||||
} from '../types/service';
|
||||
import {
|
||||
RoomOpenRequest,
|
||||
encodeRoomOpen,
|
||||
decodeRoomOpen,
|
||||
RoomOpenResponse
|
||||
} from '../models/room-open';
|
||||
import {
|
||||
RoomOpen2Request,
|
||||
RoomOpen2Response,
|
||||
decodeRoomOpen2,
|
||||
encodeRoomOpen2
|
||||
} from '../models/room-open2';
|
||||
import {
|
||||
RoomOpen3Request,
|
||||
RoomOpen3Response,
|
||||
encodeRoomOpen3,
|
||||
decodeRoomOpen3
|
||||
} from '../models/room-open3';
|
||||
import {
|
||||
RoomOpen4Request,
|
||||
RoomOpen4Response,
|
||||
encodeRoomOpen4,
|
||||
decodeRoomOpen4
|
||||
} from '../models/room-open4';
|
||||
import {
|
||||
RoomInviteRequest,
|
||||
RoomInviteResponse,
|
||||
encodeRoomInvite,
|
||||
decodeRoomInvite
|
||||
} from '../models/room-invite';
|
||||
import {
|
||||
RoomInfoRequest,
|
||||
RoomInfoResponse,
|
||||
RoomInfoDataResponse,
|
||||
RoomUserShortDataResponse,
|
||||
RoomUserDataResponse,
|
||||
encodeRoomInfo,
|
||||
decodeRoomInfoData,
|
||||
decodeRoomInfo,
|
||||
decodeRoomUserShortData,
|
||||
decodeRoomUserData
|
||||
} from '../models/room-info';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class RoomProtocolService {
|
||||
constructor() {}
|
||||
constructor(private protocolService: ProtocolService) {}
|
||||
|
||||
public roomOpen(req: RoomOpenRequest): Observable<RoomOpenResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN_REQ, ...encodeRoomOpen(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeRoomOpen(res))
|
||||
);
|
||||
}
|
||||
|
||||
public roomOpen2(req: RoomOpen2Request): Observable<RoomOpen2Response> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN2_REQ, ...encodeRoomOpen2(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeRoomOpen2(res))
|
||||
);
|
||||
}
|
||||
|
||||
public roomOpen3(req: RoomOpen3Request): Observable<RoomOpen3Response> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN3_REQ, ...encodeRoomOpen3(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeRoomOpen3(res))
|
||||
);
|
||||
}
|
||||
|
||||
public roomOpen4(req: RoomOpen4Request): Observable<RoomOpen4Response> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN4_REQ, ...encodeRoomOpen4(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeRoomOpen4(res))
|
||||
);
|
||||
}
|
||||
|
||||
public roomInvite(req: RoomInviteRequest): Observable<RoomInviteResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_INVITE_REQ, ...encodeRoomInvite(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeRoomInvite(res))
|
||||
);
|
||||
}
|
||||
|
||||
public roomInfo(
|
||||
req: RoomInfoRequest
|
||||
): Observable<
|
||||
| RoomInfoResponse
|
||||
| RoomInfoDataResponse
|
||||
| RoomUserShortDataResponse
|
||||
| RoomUserDataResponse
|
||||
> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_INFO_REQ, ...encodeRoomInfo(req))
|
||||
.pipe(
|
||||
takeWhile(res => SSVC_TYPE_ROOM_INFO_RES !== res.subServiceType),
|
||||
map(res => {
|
||||
if (SSVC_TYPE_ROOM_INFO_ROOM === res.subServiceType) {
|
||||
return decodeRoomInfoData(res);
|
||||
} else if (SSVC_TYPE_ROOM_INFO_USER === res.subServiceType) {
|
||||
return decodeRoomUserShortData(res);
|
||||
} else if (SSVC_TYPE_ROOM_INFO_USER2 === res.subServiceType) {
|
||||
return decodeRoomUserData(res);
|
||||
}
|
||||
|
||||
return decodeRoomInfo(res);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
export enum EmployeeType {
|
||||
// R(정규직)
|
||||
Regular = 'R',
|
||||
// P(파트너)
|
||||
Partner = 'P',
|
||||
// M(현장대리인)
|
||||
Manager = 'M'
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
export enum RoomType {
|
||||
// S: 1: 1 대화
|
||||
Single = 'S',
|
||||
// M: 멀티대화
|
||||
Multi = 'M',
|
||||
// B: Bot대화
|
||||
Bot = 'B',
|
||||
// A: 알림방
|
||||
Allim = 'A',
|
||||
|
||||
// // X: 확장대화 deprecated
|
||||
// Extend = 'E',
|
||||
// // N: 공지대화 deprecated
|
||||
// Notice = 'N',
|
||||
|
||||
// L: 링크(Legacy)
|
||||
Link = 'L',
|
||||
// K: MyTalk(나와의 대화)
|
||||
Mytalk = 'K'
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
export const SVC_TYPE_ROOM = 10; // 대화방
|
||||
export const SSVC_TYPE_ROOM_OPEN_REQ = 1; // 대화방 개설 요청
|
||||
export const SSVC_TYPE_ROOM_OPEN_RES = 2;
|
||||
export const SSVC_TYPE_ROOM_OPEN2_REQ = 3; // 대화방 개설 요청2
|
||||
export const SSVC_TYPE_ROOM_OPEN2_RES = 4;
|
||||
export const SSVC_TYPE_ROOM_OPEN3_REQ = 5; // 대화방 개설 요청3
|
||||
export const SSVC_TYPE_ROOM_OPEN3_RES = 6;
|
||||
export const SSVC_TYPE_ROOM_OPEN4_REQ = 7; // 대화방 개설 요청4
|
||||
export const SSVC_TYPE_ROOM_OPEN4_RES = 8;
|
||||
export const SSVC_TYPE_ROOM_INVITE_REQ = 11; // 초대 요청
|
||||
export const SSVC_TYPE_ROOM_INVITE_RES = 12;
|
||||
export const SSVC_TYPE_ROOM_INVITE_NOTI = 13;
|
||||
|
||||
export const SSVC_TYPE_ROOM_INFO_REQ = 21; // 대화방 정보 요청
|
||||
export const SSVC_TYPE_ROOM_INFO_ROOM = 22; // 대화방 정보
|
||||
export const SSVC_TYPE_ROOM_INFO_USER = 23; // 참가자 정보
|
||||
export const SSVC_TYPE_ROOM_INFO_USER2 = 25; // 참가자 정보(상세)
|
||||
export const SSVC_TYPE_ROOM_INFO_RES = 24; // 대화방 정보 완료
|
||||
export const SSVC_TYPE_ROOM_INFO_SIMPLE_REQ = 26; // 대화방 정보 요청
|
||||
// export const SSVC_TYPE_ROOM_INFO_ROOM = 22; // 대화방 정보
|
||||
// export const SSVC_TYPE_ROOM_INFO_USER = 25; // 참가자 정보(상세)
|
||||
export const SSVC_TYPE_ROOM_INFO_SIMPLE_RES = 27; // 대화방 정보 완료
|
||||
export const SSVC_TYPE_ROOM_UPD_REQ = 31; // 대화방 변경 요청
|
||||
export const SSVC_TYPE_ROOM_UPD_RES = 32;
|
||||
export const SSVC_TYPE_ROOM_INFO_UPD_REQ = 33; // 대화방 정보 변경 요청
|
||||
export const SSVC_TYPE_ROOM_INFO_UPD_RES = 34; // 대화방 정보 변경 응답
|
||||
export const SSVC_TYPE_ROOM_FONT_UPD_REQ = 35; // 대화방 옵션 변경 요청
|
||||
export const SSVC_TYPE_ROOM_FONT_UPD_NOTI = 36; // 대화방 옵션 변경 알림
|
||||
export const SSVC_TYPE_ROOM_FONT_UPD_RES = 37; // 대화방 옵션 변경 응답
|
||||
export const SSVC_TYPE_ROOM_DEL_REQ = 41; // 대화방 삭제 요청
|
||||
export const SSVC_TYPE_ROOM_DEL_RES = 42;
|
||||
export const SSVC_TYPE_ROOM_EXIT_REQ = 51; // 퇴장 요청
|
||||
export const SSVC_TYPE_ROOM_EXIT_RES = 52;
|
||||
export const SSVC_TYPE_ROOM_EXIT_NOTI = 53;
|
||||
|
||||
export const SSVC_TYPE_ROOM_EXIT_ALL_REQ = 61; // 전체 대화방 퇴장 요청
|
||||
export const SSVC_TYPE_ROOM_EXIT_ALL_RES = 62; // 전체 대화방 퇴장 응답
|
||||
|
||||
export const SSVC_TYPE_ROOM_EXIT_FORCING_REQ = 54; // 대화상대 강퇴 요청
|
||||
export const SSVC_TYPE_ROOM_EXIT_FORCING_NOTI = 55; // 대화상대 강퇴 알림
|
||||
export const SSVC_TYPE_ROOM_EXIT_FORCING_RES = 56; // 대화상대 강퇴 응답
|
||||
export const SSVC_TYPE_ROOM_USER_STATUS_REQ = 71; // 대화상대 오프라인 체크 요청
|
||||
export const SSVC_TYPE_ROOM_USER_STATUS_RES = 72; // 대화상대 오프라인 체크 응답
|
|
@ -2,6 +2,15 @@
|
|||
* Public API Surface of ucap-webmessenger-protocol-room
|
||||
*/
|
||||
|
||||
export * from './lib/models/room-info';
|
||||
export * from './lib/models/room-invite';
|
||||
export * from './lib/models/room-open';
|
||||
export * from './lib/models/room-open2';
|
||||
export * from './lib/models/room-open3';
|
||||
export * from './lib/models/room-open4';
|
||||
|
||||
export * from './lib/services/room-protocol.service';
|
||||
export * from './lib/types/employee.type';
|
||||
export * from './lib/types/room.type';
|
||||
|
||||
export * from './lib/ucap-room-protocol.module';
|
||||
|
|
118
projects/ucap-webmessenger-protocol-sync/src/lib/models/buddy.ts
Normal file
118
projects/ucap-webmessenger-protocol-sync/src/lib/models/buddy.ts
Normal file
|
@ -0,0 +1,118 @@
|
|||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage,
|
||||
BodyStringDivider
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
import { UserInfo } from '../types/userInfo';
|
||||
|
||||
export interface BuddyInfo {
|
||||
// 사용자SEQ
|
||||
userSeq: number;
|
||||
// 즐.찾 여부
|
||||
isFavorit: boolean;
|
||||
// 친구여부
|
||||
isBuddy: boolean;
|
||||
}
|
||||
|
||||
export interface SyncBuddyRequest extends ProtocolRequest {
|
||||
// 0. 동료 씽크일시(s) cf)2019-09-24 16:51:42
|
||||
syncDate: string;
|
||||
}
|
||||
|
||||
export interface SyncBuddyDataResponse extends ProtocolResponse {
|
||||
// n. {동료정보-S}...
|
||||
buddyInfos: BuddyInfo[];
|
||||
}
|
||||
|
||||
export interface SyncBuddyDataDetailResponse extends ProtocolResponse {
|
||||
// n. {동료정보-S}...
|
||||
buddyInfos: UserInfo[];
|
||||
}
|
||||
|
||||
export interface SyncBuddyResponse extends ProtocolResponse {
|
||||
// 0. 동료 씽크일시(s) cf)2019-09-24 16:51:42
|
||||
syncDate: string;
|
||||
}
|
||||
|
||||
export const encodeSyncBuddy: ProtocolEncoder<SyncBuddyRequest> = (
|
||||
req: SyncBuddyRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.syncDate || '' });
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeSyncBuddy: ProtocolDecoder<SyncBuddyResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
syncDate: message.bodyList[0]
|
||||
} as SyncBuddyResponse;
|
||||
};
|
||||
|
||||
export const decodeSyncBuddyData: ProtocolDecoder<SyncBuddyDataResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
const buddyInfos: BuddyInfo[] = [];
|
||||
message.bodyList.forEach(buddyinfo => {
|
||||
const info = buddyinfo.split(BodyStringDivider);
|
||||
buddyInfos.push({
|
||||
userSeq: info[0],
|
||||
isFavorit: info[1] === 'Y' ? true : false,
|
||||
isBuddy: info[2] === 'Y' ? true : false
|
||||
});
|
||||
});
|
||||
return {
|
||||
buddyInfos
|
||||
} as SyncBuddyDataResponse;
|
||||
};
|
||||
|
||||
export const decodeSyncBuddyDataDetail: ProtocolDecoder<
|
||||
SyncBuddyDataDetailResponse
|
||||
> = (message: ProtocolMessage) => {
|
||||
const buddyInfos: UserInfo[] = [];
|
||||
message.bodyList.forEach(buddyinfo => {
|
||||
const info = buddyinfo.split(BodyStringDivider);
|
||||
let i = 0;
|
||||
buddyInfos.push({
|
||||
userSeq: info[i],
|
||||
name: info[i++],
|
||||
profileImageFile: info[i++],
|
||||
grade: info[i++],
|
||||
intro: info[i++],
|
||||
companyCode: info[i++],
|
||||
hpNumber: info[i++],
|
||||
lineNumber: info[i++],
|
||||
email: info[i++],
|
||||
isMobile: info[i++],
|
||||
deptName: info[i++],
|
||||
isFavorit: info[i++],
|
||||
isBuddy: info[i++],
|
||||
isActive: info[i++],
|
||||
roleCd: info[i++],
|
||||
employeeNum: info[i++],
|
||||
madn: info[i++],
|
||||
hardSadn: info[i++],
|
||||
fmcSadn: info[i++],
|
||||
nameEn: info[i++],
|
||||
nameCn: info[i++],
|
||||
gradeEn: info[i++],
|
||||
gradeCn: info[i++],
|
||||
deptNameEn: info[i++],
|
||||
deptNameCn: info[i++],
|
||||
isPrivacyAgree: info[i++],
|
||||
isValidLogin: info[i++],
|
||||
employeeType: info[i++],
|
||||
nickName: info[i++]
|
||||
});
|
||||
});
|
||||
return {
|
||||
buddyInfos
|
||||
} as SyncBuddyDataDetailResponse;
|
||||
};
|
101
projects/ucap-webmessenger-protocol-sync/src/lib/models/group.ts
Normal file
101
projects/ucap-webmessenger-protocol-sync/src/lib/models/group.ts
Normal file
|
@ -0,0 +1,101 @@
|
|||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage,
|
||||
BodyStringDivider
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface GroupInfo {
|
||||
// 그룹SEQ(n)
|
||||
seq: number;
|
||||
// 그룹이름(s)
|
||||
name: string;
|
||||
// ActiveYN(s)
|
||||
isActive: boolean;
|
||||
// 사용자SEQ(s)
|
||||
userSeqStr: string;
|
||||
}
|
||||
export interface SyncGroupRequest extends ProtocolRequest {
|
||||
// 0. 동료 씽크일시(s) cf)2019-09-24 16:51:42
|
||||
syncDate: string;
|
||||
}
|
||||
|
||||
export interface SyncGroupDataResponse extends ProtocolResponse {
|
||||
// n. {동료그룹정보}...
|
||||
groupInfos: GroupInfo[];
|
||||
}
|
||||
|
||||
export interface SyncGroupDataDetailResponse extends ProtocolResponse {
|
||||
// 그룹SEQ(n)
|
||||
seq: number;
|
||||
// 그룹이름(s)
|
||||
name: string;
|
||||
// ActiveYN(s)
|
||||
isActive: boolean;
|
||||
// 사용자SEQ(n)1
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface SyncGroupResponse extends ProtocolResponse {
|
||||
// 0. 동료 씽크일시(s) cf)2019-09-24 16:51:42
|
||||
syncDate: string;
|
||||
}
|
||||
|
||||
export const encodeSyncGroup: ProtocolEncoder<SyncGroupRequest> = (
|
||||
req: SyncGroupRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.syncDate || '' });
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeSyncGroup: ProtocolDecoder<SyncGroupResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
syncDate: message.bodyList[0]
|
||||
} as SyncGroupResponse;
|
||||
};
|
||||
|
||||
export const decodeSyncGroupData: ProtocolDecoder<SyncGroupDataResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
const groupInfos: GroupInfo[] = [];
|
||||
message.bodyList.forEach(buddyinfo => {
|
||||
const info = buddyinfo.split(BodyStringDivider);
|
||||
groupInfos.push({
|
||||
seq: info[0],
|
||||
name: info[1],
|
||||
isActive: info[2] === 'Y' ? true : false,
|
||||
userSeqStr: info[3]
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
groupInfos
|
||||
} as SyncGroupDataResponse;
|
||||
};
|
||||
|
||||
export const decodeSyncGroupDataDetail: ProtocolDecoder<
|
||||
SyncGroupDataDetailResponse
|
||||
> = (message: ProtocolMessage) => {
|
||||
let userSeqs: number[] = [];
|
||||
if (message.bodyList.length > 3) {
|
||||
userSeqs = message.bodyList.slice(3);
|
||||
}
|
||||
return {
|
||||
// 그룹SEQ(n)
|
||||
seq: message.bodyList[0],
|
||||
// 그룹이름(s)
|
||||
name: message.bodyList[1],
|
||||
// ActiveYN(s)
|
||||
isActive: message.bodyList[2] === 'Y' ? true : false,
|
||||
// 사용자SEQ(n)1
|
||||
userSeqs
|
||||
} as SyncGroupDataDetailResponse;
|
||||
};
|
175
projects/ucap-webmessenger-protocol-sync/src/lib/models/room.ts
Normal file
175
projects/ucap-webmessenger-protocol-sync/src/lib/models/room.ts
Normal file
|
@ -0,0 +1,175 @@
|
|||
import { LocaleCode } from '@ucap-webmessenger/core';
|
||||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage,
|
||||
BodyStringDivider
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
import {
|
||||
RoomInfo,
|
||||
UserInfoShort,
|
||||
UserInfo,
|
||||
EmployeeType
|
||||
} from '@ucap-webmessenger/protocol-room';
|
||||
import { RoleCode } from '@ucap-webmessenger/protocol-authentication';
|
||||
import { EventType } from '@ucap-webmessenger/protocol-event';
|
||||
|
||||
export interface SyncRoomRequest extends ProtocolRequest {
|
||||
// 0. 동료 씽크일시(s) cf)2019-09-24 16:51:42
|
||||
syncDate: string;
|
||||
// 언어코드
|
||||
localeCode: LocaleCode;
|
||||
}
|
||||
|
||||
export interface SyncRoomDataResponse extends ProtocolResponse {
|
||||
// n. {대화방정보}...
|
||||
roomInfos: RoomInfo[];
|
||||
}
|
||||
|
||||
export interface SyncRoomUserDataResponse extends ProtocolResponse {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 1n. {참여자정보}
|
||||
userInfos: UserInfoShort[];
|
||||
}
|
||||
|
||||
export interface SyncRoomUserDataDetailResponse extends ProtocolResponse {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 1n. {참여자정보-D}
|
||||
userInfos: UserInfo[];
|
||||
}
|
||||
|
||||
export interface SyncRoomResponse extends ProtocolResponse {
|
||||
// 0. 동료 씽크일시(s) cf)2019-09-24 16:51:42
|
||||
syncDate: string;
|
||||
}
|
||||
|
||||
export const encodeSyncRoom: ProtocolEncoder<SyncRoomRequest> = (
|
||||
req: SyncRoomRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.syncDate || '' });
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.localeCode });
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeSyncRoom: ProtocolDecoder<SyncRoomResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
syncDate: message.bodyList[0]
|
||||
} as SyncRoomResponse;
|
||||
};
|
||||
|
||||
export const decodeSyncRoomData: ProtocolDecoder<SyncRoomDataResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
const roomInfos: RoomInfo[] = [];
|
||||
if (message.bodyList.length > 1) {
|
||||
const info = message.bodyList[1].split(BodyStringDivider);
|
||||
if (info.length > 11) {
|
||||
roomInfos.push({
|
||||
roomSeq: info[0],
|
||||
roomType: info[1],
|
||||
roomName: info[2],
|
||||
finalEventType: info[3] as EventType,
|
||||
finalEventMessage: info[4],
|
||||
finalEventDate: info[5],
|
||||
joinUserCount: info[6],
|
||||
noReadCnt: info[7],
|
||||
isAlarm: info[8] !== 'N' ? true : false,
|
||||
isJoinRoom: info[9] === 'Y' ? true : false,
|
||||
expiredFileStdSeq: info[10],
|
||||
isTimeRoom: info[11] === 'Y' ? true : false,
|
||||
timeRoomInterval: info[11] !== 'Y' ? 0 : info[12] || 0
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
roomInfos
|
||||
} as SyncRoomDataResponse;
|
||||
};
|
||||
|
||||
export const decodeSyncRoomUserData: ProtocolDecoder<
|
||||
SyncRoomUserDataResponse
|
||||
> = (message: ProtocolMessage) => {
|
||||
const userInfos: UserInfoShort[] = [];
|
||||
message.bodyList.slice(1).forEach(userInfo => {
|
||||
const info = userInfo.split(BodyStringDivider);
|
||||
userInfos.push({
|
||||
userSeq: info[0],
|
||||
name: info[1],
|
||||
profileImageFile: info[2],
|
||||
isJoinRoom: info[3],
|
||||
lastReadEventSeq: info[4],
|
||||
madn: info[5],
|
||||
hardSadn: info[6],
|
||||
fmcSadn: info[7],
|
||||
nameEn: info[8],
|
||||
nameCn: info[9],
|
||||
isPrivacyAgree: info[10] === 'Y' ? true : false,
|
||||
isValidLogin: info[11] === 'Y' ? true : false,
|
||||
employeeType: info[12] as EmployeeType,
|
||||
fontColor: info[13]
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
userInfos
|
||||
} as SyncRoomUserDataResponse;
|
||||
};
|
||||
|
||||
export const decodeSyncRoomUserDataDetail: ProtocolDecoder<
|
||||
SyncRoomUserDataDetailResponse
|
||||
> = (message: ProtocolMessage) => {
|
||||
const userInfos: UserInfo[] = [];
|
||||
message.bodyList.slice(1).forEach(userInfo => {
|
||||
const info = userInfo.split(BodyStringDivider);
|
||||
userInfos.push({
|
||||
userSeq: 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],
|
||||
isJoinRoom: info[11] === 'Y' ? true : false,
|
||||
lastReadEventSeq: info[12],
|
||||
isActive: info[13] === 'Y' ? true : false,
|
||||
roleCd: info[14] as RoleCode,
|
||||
employeeNum: info[15],
|
||||
madn: info[16],
|
||||
hardSadn: info[17],
|
||||
fmcSadn: info[18],
|
||||
nameEn: info[19],
|
||||
nameCn: info[20],
|
||||
gradeEn: info[21],
|
||||
gradeCn: info[22],
|
||||
deptNameEn: info[23],
|
||||
deptNameCn: info[24],
|
||||
callMode: info[25],
|
||||
isPrivacyAgree: info[26] === 'Y' ? true : false,
|
||||
isValidLogin: info[27] === 'Y' ? true : false,
|
||||
employeeType: info[28] as EmployeeType,
|
||||
id: info[29]
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
userInfos
|
||||
} as SyncRoomUserDataDetailResponse;
|
||||
};
|
|
@ -1,8 +1,211 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, take, takeWhile } from 'rxjs/operators';
|
||||
|
||||
import { ProtocolService } from '@ucap-webmessenger/protocol';
|
||||
import {
|
||||
SyncBuddyRequest,
|
||||
SyncBuddyResponse,
|
||||
SyncBuddyDataResponse,
|
||||
encodeSyncBuddy,
|
||||
decodeSyncBuddyData,
|
||||
decodeSyncBuddy,
|
||||
decodeSyncBuddyDataDetail
|
||||
} from '../models/buddy';
|
||||
import {
|
||||
SVC_TYPE_SYNC_BUDDY,
|
||||
SSVC_TYPE_SYNC_BUDDY_REQ,
|
||||
SSVC_TYPE_SYNC_BUDDY_RES,
|
||||
SSVC_TYPE_SYNC_BUDDY_DATA,
|
||||
SSVC_TYPE_SYNC_BUDDY2_REQ,
|
||||
SSVC_TYPE_SYNC_BUDDY2_RES,
|
||||
SSVC_TYPE_SYNC_BUDDY2_DATA,
|
||||
SVC_TYPE_SYNC_GROUP,
|
||||
SSVC_TYPE_SYNC_GROUP_REQ,
|
||||
SSVC_TYPE_SYNC_GROUP_RES,
|
||||
SSVC_TYPE_SYNC_GROUP_DATA,
|
||||
SSVC_TYPE_SYNC_GROUP_REQ2,
|
||||
SSVC_TYPE_SYNC_GROUP_RES2,
|
||||
SSVC_TYPE_SYNC_GROUP_DATA2,
|
||||
SVC_TYPE_SYNC_ROOM,
|
||||
SSVC_TYPE_SYNC_ROOM_REQ,
|
||||
SSVC_TYPE_SYNC_ROOM_RES,
|
||||
SSVC_TYPE_SYNC_ROOM_DATA,
|
||||
SSVC_TYPE_SYNC_ROOM_USER,
|
||||
SSVC_TYPE_SYNC_ROOM_USER2,
|
||||
SSVC_TYPE_SYNC_ROOM2_REQ,
|
||||
SSVC_TYPE_SYNC_ROOM2_RES,
|
||||
SSVC_TYPE_SYNC_ROOM2_DATA,
|
||||
SSVC_TYPE_SYNC_ROOM2_USER,
|
||||
SSVC_TYPE_SYNC_ROOM2_USER2
|
||||
} from '../types/service';
|
||||
import {
|
||||
SyncGroupRequest,
|
||||
SyncGroupResponse,
|
||||
SyncGroupDataResponse,
|
||||
encodeSyncGroup,
|
||||
decodeSyncGroupDataDetail,
|
||||
decodeSyncGroup,
|
||||
decodeSyncGroupData,
|
||||
SyncGroupDataDetailResponse
|
||||
} from '../models/group';
|
||||
import {
|
||||
SyncRoomRequest,
|
||||
SyncRoomResponse,
|
||||
encodeSyncRoom,
|
||||
decodeSyncRoom,
|
||||
SyncRoomUserDataResponse,
|
||||
SyncRoomUserDataDetailResponse,
|
||||
SyncRoomDataResponse,
|
||||
decodeSyncRoomData,
|
||||
decodeSyncRoomUserData,
|
||||
decodeSyncRoomUserDataDetail
|
||||
} from '../models/room';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class SyncProtocolService {
|
||||
constructor() {}
|
||||
constructor(private protocolService: ProtocolService) {}
|
||||
|
||||
public syncBuddy(
|
||||
req: SyncBuddyRequest
|
||||
): Observable<SyncBuddyResponse | SyncBuddyDataResponse> {
|
||||
return this.protocolService
|
||||
.call(
|
||||
SVC_TYPE_SYNC_BUDDY,
|
||||
SSVC_TYPE_SYNC_BUDDY_REQ,
|
||||
...encodeSyncBuddy(req)
|
||||
)
|
||||
.pipe(
|
||||
takeWhile(res => SSVC_TYPE_SYNC_BUDDY_RES !== res.subServiceType),
|
||||
map(res => {
|
||||
if (SSVC_TYPE_SYNC_BUDDY_DATA === res.subServiceType) {
|
||||
return decodeSyncBuddyData(res);
|
||||
}
|
||||
|
||||
return decodeSyncBuddy(res);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
public syncBuddy2(
|
||||
req: SyncBuddyRequest
|
||||
): Observable<SyncBuddyResponse | SyncBuddyDataResponse> {
|
||||
return this.protocolService
|
||||
.call(
|
||||
SVC_TYPE_SYNC_BUDDY,
|
||||
SSVC_TYPE_SYNC_BUDDY2_REQ,
|
||||
...encodeSyncBuddy(req)
|
||||
)
|
||||
.pipe(
|
||||
takeWhile(res => SSVC_TYPE_SYNC_BUDDY2_RES !== res.subServiceType),
|
||||
map(res => {
|
||||
if (SSVC_TYPE_SYNC_BUDDY2_DATA === res.subServiceType) {
|
||||
return decodeSyncBuddyDataDetail(res);
|
||||
}
|
||||
|
||||
return decodeSyncBuddy(res);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
public syncGroup(
|
||||
req: SyncGroupRequest
|
||||
): Observable<SyncGroupResponse | SyncGroupDataResponse> {
|
||||
return this.protocolService
|
||||
.call(
|
||||
SVC_TYPE_SYNC_GROUP,
|
||||
SSVC_TYPE_SYNC_GROUP_REQ,
|
||||
...encodeSyncGroup(req)
|
||||
)
|
||||
.pipe(
|
||||
takeWhile(res => SSVC_TYPE_SYNC_GROUP_RES !== res.subServiceType),
|
||||
map(res => {
|
||||
if (SSVC_TYPE_SYNC_GROUP_DATA === res.subServiceType) {
|
||||
return decodeSyncGroupData(res);
|
||||
}
|
||||
|
||||
return decodeSyncGroup(res);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
public syncGroup2(
|
||||
req: SyncGroupRequest
|
||||
): Observable<SyncGroupResponse | SyncGroupDataDetailResponse> {
|
||||
return this.protocolService
|
||||
.call(
|
||||
SVC_TYPE_SYNC_GROUP,
|
||||
SSVC_TYPE_SYNC_GROUP_REQ2,
|
||||
...encodeSyncGroup(req)
|
||||
)
|
||||
.pipe(
|
||||
takeWhile(res => SSVC_TYPE_SYNC_GROUP_RES2 !== res.subServiceType),
|
||||
map(res => {
|
||||
if (SSVC_TYPE_SYNC_GROUP_DATA2 === res.subServiceType) {
|
||||
return decodeSyncGroupDataDetail(res);
|
||||
}
|
||||
|
||||
return decodeSyncGroup(res);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
public syncRoom(
|
||||
req: SyncRoomRequest
|
||||
): Observable<
|
||||
| SyncRoomResponse
|
||||
| SyncRoomDataResponse
|
||||
| SyncRoomUserDataResponse
|
||||
| SyncRoomUserDataDetailResponse
|
||||
> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_SYNC_ROOM, SSVC_TYPE_SYNC_ROOM_REQ, ...encodeSyncRoom(req))
|
||||
.pipe(
|
||||
takeWhile(res => SSVC_TYPE_SYNC_ROOM_RES !== res.subServiceType),
|
||||
map(res => {
|
||||
if (SSVC_TYPE_SYNC_ROOM_DATA === res.subServiceType) {
|
||||
return decodeSyncRoomData(res);
|
||||
} else if (SSVC_TYPE_SYNC_ROOM_USER === res.subServiceType) {
|
||||
return decodeSyncRoomUserData(res);
|
||||
} else if (SSVC_TYPE_SYNC_ROOM_USER2 === res.subServiceType) {
|
||||
return decodeSyncRoomUserDataDetail(res);
|
||||
}
|
||||
|
||||
return decodeSyncRoom(res);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
public syncRoom2(
|
||||
req: SyncRoomRequest
|
||||
): Observable<
|
||||
| SyncRoomResponse
|
||||
| SyncRoomDataResponse
|
||||
| SyncRoomUserDataResponse
|
||||
| SyncRoomUserDataDetailResponse
|
||||
> {
|
||||
return this.protocolService
|
||||
.call(
|
||||
SVC_TYPE_SYNC_ROOM,
|
||||
SSVC_TYPE_SYNC_ROOM2_REQ,
|
||||
...encodeSyncRoom(req)
|
||||
)
|
||||
.pipe(
|
||||
takeWhile(res => SSVC_TYPE_SYNC_ROOM2_RES !== res.subServiceType),
|
||||
map(res => {
|
||||
if (SSVC_TYPE_SYNC_ROOM2_DATA === res.subServiceType) {
|
||||
return decodeSyncRoomData(res);
|
||||
} else if (SSVC_TYPE_SYNC_ROOM2_USER === res.subServiceType) {
|
||||
return decodeSyncRoomUserData(res);
|
||||
} else if (SSVC_TYPE_SYNC_ROOM2_USER2 === res.subServiceType) {
|
||||
return decodeSyncRoomUserDataDetail(res);
|
||||
}
|
||||
|
||||
return decodeSyncRoom(res);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
export const SVC_TYPE_SYNC_BUDDY = 81; // 동료 씽크
|
||||
export const SSVC_TYPE_SYNC_BUDDY_REQ = 1; // 동료목록 씽크 요청
|
||||
export const SSVC_TYPE_SYNC_BUDDY_DATA = 2; // 동료목록 Data
|
||||
export const SSVC_TYPE_SYNC_BUDDY_RES = 3; // 동료목록 씽크 완료
|
||||
export const SSVC_TYPE_SYNC_BUDDY2_REQ = 11; // 동료목록 씽크 요청(상세)
|
||||
export const SSVC_TYPE_SYNC_BUDDY2_DATA = 12; // 동료 정보 Data(상세)
|
||||
export const SSVC_TYPE_SYNC_BUDDY2_RES = 13; // 동료 정보 쿼리 완료(상세)
|
||||
|
||||
export const SVC_TYPE_SYNC_GROUP = 82; // 동료 씽크
|
||||
export const SSVC_TYPE_SYNC_GROUP_REQ = 1; // 그룹목록 씽크 요청
|
||||
export const SSVC_TYPE_SYNC_GROUP_DATA = 2; // 그룹 Data
|
||||
export const SSVC_TYPE_SYNC_GROUP_RES = 3; // 그룹목록 씽크 완료
|
||||
export const SSVC_TYPE_SYNC_GROUP_REQ2 = 4; // 그룹목록 씽크 요청
|
||||
export const SSVC_TYPE_SYNC_GROUP_DATA2 = 5; // 그룹 Data
|
||||
export const SSVC_TYPE_SYNC_GROUP_RES2 = 6; // 그룹목록 씽크 완료
|
||||
|
||||
export const SVC_TYPE_SYNC_ROOM = 83; // 대화방 씽크
|
||||
export const SSVC_TYPE_SYNC_ROOM_REQ = 1; // 대화방 목록 씽크 요청
|
||||
export const SSVC_TYPE_SYNC_ROOM_DATA = 2; // 대화방 목록 Data
|
||||
export const SSVC_TYPE_SYNC_ROOM_USER = 3; // 참여 정보(방갯수만큼)
|
||||
export const SSVC_TYPE_SYNC_ROOM_USER2 = 5; // 참여 정보(방갯수만큼)
|
||||
export const SSVC_TYPE_SYNC_ROOM_RES = 4; // 대화방 목록 씽크 완료
|
||||
export const SSVC_TYPE_SYNC_ROOM2_REQ = 11; // 대화방 목록 씽크 요청
|
||||
export const SSVC_TYPE_SYNC_ROOM2_DATA = 12; // 대화방 목록 Data
|
||||
export const SSVC_TYPE_SYNC_ROOM2_USER = 13; // 참여 정보(방갯수만큼)
|
||||
export const SSVC_TYPE_SYNC_ROOM2_USER2 = 15; // 참여 정보(방갯수만큼)
|
||||
export const SSVC_TYPE_SYNC_ROOM2_RES = 14; // 대화방 목록 씽크 완료
|
|
@ -0,0 +1,63 @@
|
|||
import { RoleCode } from '@ucap-webmessenger/protocol-authentication';
|
||||
import { EmployeeType } from '@ucap-webmessenger/protocol-room';
|
||||
|
||||
export interface UserInfo {
|
||||
// 사용자SEQ
|
||||
userSeq: number;
|
||||
// 사용자명
|
||||
name: string;
|
||||
// 사진파일
|
||||
profileImageFile: string;
|
||||
// 직급
|
||||
grade: string;
|
||||
// 업무소개
|
||||
intro: string;
|
||||
// 기관코드
|
||||
companyCode: string;
|
||||
// 핸드폰번호
|
||||
hpNumber: string;
|
||||
// 내선번호
|
||||
lineNumber: string;
|
||||
// 이메일
|
||||
email: string;
|
||||
// 모바일YN
|
||||
isMobile: boolean;
|
||||
// 부서명
|
||||
deptName: string;
|
||||
// 즐.찾 여부
|
||||
isFavorit: boolean;
|
||||
// 친구여부
|
||||
isBuddy: boolean;
|
||||
// ActiveYN
|
||||
isActive: boolean;
|
||||
// 역할코드
|
||||
roleCd: RoleCode;
|
||||
// 사번
|
||||
employeeNum: string;
|
||||
// MADN
|
||||
madn: string;
|
||||
// HARDPHONE_SADN
|
||||
hardSadn: string;
|
||||
// FMC_SADN
|
||||
fmcSadn: string;
|
||||
// 사용자명(영어)
|
||||
nameEn: string;
|
||||
// 사용자명(중국어)
|
||||
nameCn: string;
|
||||
// 직급(영어)
|
||||
gradeEn: string;
|
||||
// 직급(중국어)
|
||||
gradeCn: string;
|
||||
// 부서명(영어)
|
||||
deptNameEn: string;
|
||||
// 부서명(중국어)
|
||||
deptNameCn: string;
|
||||
// 이용약관동의여부YN
|
||||
isPrivacyAgree: boolean;
|
||||
// 유효접속여부YN
|
||||
isValidLogin: boolean;
|
||||
// 임직원유형(s)
|
||||
employeeType: EmployeeType;
|
||||
// 별명
|
||||
nickName: string;
|
||||
}
|
|
@ -1,7 +1,11 @@
|
|||
/*
|
||||
* Public API Surface of ucap-webmessenger-protocol-sync
|
||||
*/
|
||||
export * from './lib/models/buddy';
|
||||
export * from './lib/models/group';
|
||||
|
||||
export * from './lib/services/sync-protocol.service';
|
||||
|
||||
export * from './lib/ucap-sync-protocol.module';
|
||||
|
||||
export * from './lib/types/userInfo';
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
export const PacketBodyDivider = '\f';
|
||||
export const PacketBodyValueDivider = '\t';
|
||||
|
||||
export const BodyStringDivider = '\b';
|
||||
|
|
Loading…
Reference in New Issue
Block a user