added protocol > query > dept, deptUser
This commit is contained in:
parent
1c2c457187
commit
d4abaeea32
|
@ -0,0 +1,199 @@
|
|||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage,
|
||||
PacketBodyValue,
|
||||
BodyStringDivider,
|
||||
ProtocolStream
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
import {
|
||||
DeviceType,
|
||||
FileTransferPermissions,
|
||||
OrganizationChartPermissions,
|
||||
DefaultScreen,
|
||||
VideoConferenceType
|
||||
} from '@ucap-webmessenger/core';
|
||||
import { DeptType, DeptSearchType } from '../types/dept.type';
|
||||
import { EmployeeType } from '@ucap-webmessenger/protocol-room';
|
||||
import { RoleCode } from '@ucap-webmessenger/protocol-authentication';
|
||||
|
||||
export interface DeptUserRequest extends ProtocolRequest {
|
||||
// DivCD(s)
|
||||
divCd: string;
|
||||
// 기관코드(s)
|
||||
companyCode: string;
|
||||
// 부서SEQ(n)
|
||||
seq?: number;
|
||||
// 검색string(s)
|
||||
search?: string;
|
||||
// 검색범위(s)
|
||||
searchRange: DeptSearchType;
|
||||
// 요청리스트(n) 사용안하면 0 최대 200
|
||||
pageListCount?: number;
|
||||
// 요청페이지(n) 사용안하면 0 처음은 1
|
||||
pageCurrent?: number;
|
||||
// 발신자회사코드(s)
|
||||
senderCompanyCode: string;
|
||||
// 발신자임직원유형(s)
|
||||
senderEmployeeType: EmployeeType;
|
||||
}
|
||||
|
||||
export interface UserInfoSS {
|
||||
// 사용자SEQ
|
||||
seq: number;
|
||||
// 사용자명
|
||||
name: string;
|
||||
// 사진파일
|
||||
profileImageFile: string;
|
||||
// 직급
|
||||
grade: string;
|
||||
// 업무소개
|
||||
intro: string;
|
||||
// 기관코드
|
||||
companyCode: string;
|
||||
// 핸드폰번호
|
||||
hpNumber: string;
|
||||
// 내선번호
|
||||
lineNumber: string;
|
||||
// 이메일
|
||||
email: string;
|
||||
// 모바일YN
|
||||
isMobile: boolean;
|
||||
// 부서명
|
||||
deptName: string;
|
||||
// 조회순서
|
||||
order: string;
|
||||
// ActiveYN
|
||||
isActive: boolean;
|
||||
// 역할코드
|
||||
roleCd: RoleCode;
|
||||
// 사번
|
||||
employeeNum: string;
|
||||
// MADN
|
||||
madn: string;
|
||||
// HARDPHONE_SADN
|
||||
hardSadn: string;
|
||||
// FMC_SADN
|
||||
fmcSadn: string;
|
||||
// CALL_MODE
|
||||
callMode: string;
|
||||
// 사용자명(영어)
|
||||
nameEn: string;
|
||||
// 사용자명(중국어)
|
||||
nameCn: string;
|
||||
// 직급(영어)
|
||||
gradeEn: string;
|
||||
// 직급(중국어)
|
||||
gradeCn: string;
|
||||
// 부서명(영어)
|
||||
deptNameEn: string;
|
||||
// 부서명(중국어)
|
||||
deptNameCn: string;
|
||||
// 부서SEQ
|
||||
deptSeq: number;
|
||||
// 이용약관동의여부YN
|
||||
isPrivacyAgree: boolean;
|
||||
// 유효접속여부YN
|
||||
isValidLogin: boolean;
|
||||
// 임직원유형(s)
|
||||
employeeType: EmployeeType;
|
||||
}
|
||||
export interface DeptUserData extends ProtocolStream {
|
||||
// DivCD(s)
|
||||
divCd: string;
|
||||
// {부서정보-S}...
|
||||
userInfos: UserInfoSS[];
|
||||
}
|
||||
export interface DeptUserResponse extends ProtocolResponse {
|
||||
// DivCD(s)
|
||||
divCd: string;
|
||||
// 전체갯수(n)
|
||||
pageTotalCount: number;
|
||||
// 요청리스트(n)
|
||||
pageListCount?: number;
|
||||
// 페이지(n)
|
||||
pageCurrent?: number;
|
||||
}
|
||||
|
||||
export const encodeDeptUser: ProtocolEncoder<DeptUserRequest> = (
|
||||
req: DeptUserRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.companyCode });
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: req.seq || 0 });
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.search || '' });
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.searchRange });
|
||||
bodyList.push({
|
||||
type: PacketBodyValue.Integer,
|
||||
value: req.pageListCount || 0
|
||||
});
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: req.pageCurrent || 0 });
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.senderCompanyCode });
|
||||
bodyList.push({
|
||||
type: PacketBodyValue.String,
|
||||
value: req.senderEmployeeType
|
||||
});
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeDeptUserData: ProtocolDecoder<DeptUserData> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
const userInfos: UserInfoSS[] = [];
|
||||
message.bodyList.slice(1).forEach(userInfo => {
|
||||
const info = userInfo.split(BodyStringDivider);
|
||||
let i = 0;
|
||||
userInfos.push({
|
||||
seq: 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++] === 'Y' ? true : false,
|
||||
deptName: info[i++],
|
||||
order: info[i++],
|
||||
isActive: info[i++] === 'Y' ? true : false,
|
||||
roleCd: info[i++] as RoleCode,
|
||||
employeeNum: info[i++],
|
||||
madn: info[i++],
|
||||
hardSadn: info[i++],
|
||||
fmcSadn: info[i++],
|
||||
callMode: info[i++],
|
||||
nameEn: info[i++],
|
||||
nameCn: info[i++],
|
||||
gradeEn: info[i++],
|
||||
gradeCn: info[i++],
|
||||
deptNameEn: info[i++],
|
||||
deptNameCn: info[i++],
|
||||
deptSeq: info[i++],
|
||||
isPrivacyAgree: info[i++] === 'Y' ? true : false,
|
||||
isValidLogin: info[i++] === 'Y' ? true : false,
|
||||
employeeType: info[i++] as EmployeeType
|
||||
});
|
||||
});
|
||||
return {
|
||||
divCd: message.bodyList[0],
|
||||
userInfos
|
||||
} as DeptUserData;
|
||||
};
|
||||
|
||||
export const decodeDeptUser: ProtocolDecoder<DeptUserResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
divCd: message.bodyList[0],
|
||||
pageTotalCount: message.bodyList[1],
|
||||
pageListCount: message.bodyList[2],
|
||||
pageCurrent: message.bodyList[3]
|
||||
} as DeptUserResponse;
|
||||
};
|
|
@ -0,0 +1,95 @@
|
|||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage,
|
||||
PacketBodyValue,
|
||||
BodyStringDivider,
|
||||
ProtocolStream
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
import { DeptType } from '../types/dept.type';
|
||||
|
||||
export interface DeptRequest extends ProtocolRequest {
|
||||
// DivCD(s)
|
||||
divCd: string;
|
||||
// 기관코드(s)
|
||||
companyCode: string;
|
||||
}
|
||||
|
||||
export interface DeptInfo {
|
||||
// 부서SEQ
|
||||
seq: number;
|
||||
// 부서명
|
||||
name: string;
|
||||
// 기관코드
|
||||
companyCode: string;
|
||||
// 부서타입
|
||||
type: DeptType;
|
||||
// 본부SEQ
|
||||
rootSeq: number;
|
||||
// 상위부서SEQ
|
||||
parentSeq: number;
|
||||
// 조회순서
|
||||
order: string;
|
||||
// 조회레벨
|
||||
depth: number;
|
||||
// ActiveYN
|
||||
isActive: boolean;
|
||||
// 부서명(영어)
|
||||
nameEn: string;
|
||||
// 부서명(중국어)
|
||||
nameCn: string;
|
||||
}
|
||||
export interface DeptData extends ProtocolStream {
|
||||
// DivCD(s)
|
||||
divCd: string;
|
||||
// {부서정보-S}...
|
||||
departmentInfos: DeptInfo[];
|
||||
}
|
||||
export interface DeptResponse extends ProtocolResponse {
|
||||
// DivCD(s)
|
||||
divCd: string;
|
||||
}
|
||||
|
||||
export const encodeDept: ProtocolEncoder<DeptRequest> = (req: DeptRequest) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.companyCode });
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeDeptData: ProtocolDecoder<DeptData> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
const departmentInfos: DeptInfo[] = [];
|
||||
message.bodyList.slice(1).forEach(deptInfo => {
|
||||
const info = deptInfo.split(BodyStringDivider);
|
||||
let i = 0;
|
||||
departmentInfos.push({
|
||||
seq: info[i],
|
||||
name: info[i++],
|
||||
companyCode: info[i++],
|
||||
type: info[i++] as DeptType,
|
||||
rootSeq: info[i++],
|
||||
parentSeq: info[i++],
|
||||
order: info[i++],
|
||||
depth: info[i++],
|
||||
isActive: info[i++] === 'Y' ? true : false,
|
||||
nameEn: info[i++],
|
||||
nameCn: info[i++]
|
||||
});
|
||||
});
|
||||
return {
|
||||
divCd: message.bodyList[0],
|
||||
departmentInfos
|
||||
} as DeptData;
|
||||
};
|
||||
|
||||
export const decodeDept: ProtocolDecoder<DeptResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return { divCd: message.bodyList[0] } as DeptResponse;
|
||||
};
|
|
@ -1,7 +1,7 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { ProtocolService } from '@ucap-webmessenger/protocol';
|
||||
import { Observable } from 'rxjs';
|
||||
import { take, map } from 'rxjs/operators';
|
||||
import { take, map, takeWhile } from 'rxjs/operators';
|
||||
import {
|
||||
AuthRequest,
|
||||
AuthResponse,
|
||||
|
@ -10,8 +10,30 @@ import {
|
|||
} from '../models/auth';
|
||||
import {
|
||||
SVC_TYPE_QUERY_DATA,
|
||||
SSVC_TYPE_QUERY_AUTH_REQ
|
||||
SSVC_TYPE_QUERY_AUTH_REQ,
|
||||
SSVC_TYPE_QUERY_DEPT_REQ,
|
||||
SSVC_TYPE_QUERY_DEPT_RES,
|
||||
SSVC_TYPE_QUERY_DEPT_DATA,
|
||||
SSVC_TYPE_QUERY_DEPT_USER_RES,
|
||||
SSVC_TYPE_QUERY_DEPT_USER_DATA,
|
||||
SSVC_TYPE_QUERY_DEPT_USER_REQ
|
||||
} from '../types/service';
|
||||
import {
|
||||
DeptRequest,
|
||||
DeptResponse,
|
||||
encodeDept,
|
||||
decodeDept,
|
||||
decodeDeptData,
|
||||
DeptData
|
||||
} from '../models/dept';
|
||||
import {
|
||||
encodeDeptUser,
|
||||
decodeDeptUser,
|
||||
decodeDeptUserData,
|
||||
DeptUserRequest,
|
||||
DeptUserData,
|
||||
DeptUserResponse
|
||||
} from '../models/dept-user';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@ -27,4 +49,48 @@ export class QueryProtocolService {
|
|||
map(res => decodeAuth(res))
|
||||
);
|
||||
}
|
||||
|
||||
public dept(req: DeptRequest): Observable<DeptResponse | DeptData> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_QUERY_DATA, SSVC_TYPE_QUERY_DEPT_REQ, ...encodeDept(req))
|
||||
.pipe(
|
||||
takeWhile(res => SSVC_TYPE_QUERY_DEPT_RES !== res.subServiceType, true),
|
||||
map(res => {
|
||||
if (SSVC_TYPE_QUERY_DEPT_DATA === res.subServiceType) {
|
||||
return { ...decodeDeptData(res), Type: SSVC_TYPE_QUERY_DEPT_DATA };
|
||||
}
|
||||
|
||||
return { ...decodeDept(res), Type: SSVC_TYPE_QUERY_DEPT_RES };
|
||||
})
|
||||
);
|
||||
}
|
||||
public deptUser(
|
||||
req: DeptUserRequest
|
||||
): Observable<DeptUserResponse | DeptUserData> {
|
||||
return this.protocolService
|
||||
.call(
|
||||
SVC_TYPE_QUERY_DATA,
|
||||
SSVC_TYPE_QUERY_DEPT_USER_REQ,
|
||||
...encodeDeptUser(req)
|
||||
)
|
||||
.pipe(
|
||||
takeWhile(
|
||||
res => SSVC_TYPE_QUERY_DEPT_USER_RES !== res.subServiceType,
|
||||
true
|
||||
),
|
||||
map(res => {
|
||||
if (SSVC_TYPE_QUERY_DEPT_USER_DATA === res.subServiceType) {
|
||||
return {
|
||||
...decodeDeptUserData(res),
|
||||
Type: SSVC_TYPE_QUERY_DEPT_USER_DATA
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
...decodeDeptUser(res),
|
||||
Type: SSVC_TYPE_QUERY_DEPT_USER_RES
|
||||
};
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
export enum DeptType {
|
||||
// R: 기관Root
|
||||
Root = 'R',
|
||||
// D: 본부
|
||||
Department = 'D',
|
||||
// T: 부서
|
||||
Team = 'T'
|
||||
}
|
||||
|
||||
export enum DeptSearchType {
|
||||
// A: 부서, 인원
|
||||
All = 'A',
|
||||
// U: 인원
|
||||
User = 'U',
|
||||
// D: 부서
|
||||
Department = 'D',
|
||||
// M: 다중부서 cf) 여러 부서(하위전체)를 쿼리할 때 1, 2, 3, 4..이렇게 부서SEQ들을, 로 연결해서 보냄 (검색string 필드를 사용함)
|
||||
MultiDepartment = 'M'
|
||||
}
|
|
@ -3,9 +3,12 @@
|
|||
*/
|
||||
|
||||
export * from './lib/models/auth';
|
||||
export * from './lib/models/dept';
|
||||
export * from './lib/models/dept-user';
|
||||
|
||||
export * from './lib/services/query-protocol.service';
|
||||
|
||||
export * from './lib/types/dept.type';
|
||||
export * from './lib/types/service';
|
||||
|
||||
export * from './lib/ucap-query-protocol.module';
|
||||
|
|
Loading…
Reference in New Issue
Block a user