zioinfo-mail/zioinfo/js/number.js
DESKTOP-TKLFCPR\ython e228faabf5 feat(itsm): G-1~G-12 확장 기능 + 하네스/봇/설치스크립트 구현
G-1: 메신저 Webhook Relay + _send_to_room 실제 httpx 호출 구현
G-2: POST /api/tasks/bulk SR 대량작업 엔드포인트 (최대 100건)
G-3: 라이선스 만료 알림 스케줄러 (매일 09:00 KST)
G-4: 체험판 upgrade_banner 필드 + license.py 배너 로직
G-5: core/auto_rca.py + incidents/problem auto-rca 엔드포인트
G-6: core/deploy_impact.py + vibe impact-analysis 엔드포인트
G-7: core/ticket_classifier.py + SR 생성 시 AI 분류 + ai-suggestion API
G-8: VulnPatchRecord 모델 + vuln_scan 패치추적 4개 엔드포인트
G-9: core/jira_sync.py + gateway Jira/Confluence 연동 엔드포인트
G-10: core/push_notify.py + routers/push.py + PushSubscription 모델
G-11: approvals 다중승인 (위임/서명/기한초과/마감연장)
G-12: alembic.ini + migrations/ + cicd/migrate_to_postgres.sh

하네스: guardia-orchestrator 확장기능 Phase 반영
봇명령어: /sr /status /license /bulk 슬래시 명령어 추가
설치스크립트: setup/ (Ubuntu, CentOS, RHEL, Windows) --test 옵션 포함

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 18:18:52 +09:00

130 lines
2.6 KiB
JavaScript

/*-------------------------------------------------------------------+
* 1. 파일명: number.js
* 2. 설 명: 수치 계산 및 형식화(Formatting)을 위한 함수를 정의한다.
* 3. 의존성: string.js
* 4. 작성자:
* 5. 작성일: 2006.10.10.
-------------------------------------------------------------------*/
var DIGIT_COMMA = ",";
/**
* 소수점 이하 index자리에서 반올림
*
* @param num 원 수치값
* @param index 소수점이하 유효자리수
*/
function round (num, index) {
var pow = Math.pow(10, parseInt(index));
return Math.round(parseFloat(num) * pow) / pow;
}
/**
* 소수점 이하 index자리에서 버림
*
* @param num 원 수치값
* @param index 소수점이하 유효자리수
*/
function floor (num, index) {
var pow = Math.pow(10, parseInt(index));
return Math.floor(parseFloat(num) * pow) / pow;
}
/**
* 소수점 이하 index자리에서 올림
*
* @param num 원 수치값
* @param index 소수점이하 유효자리수
*/
function ceil (num, index) {
var pow = Math.pow(10, parseInt(index));
return Math.ceil(parseFloat(num) * pow) / pow;
}
/**
* JavaScript인 경우
*/
function getCorrectPow(no) {
var noStr = new String(no);
var dotIndex = noStr.lastIndexOf(".");
var correctPow = 1;
if ( dotIndex > -1 ) {
correctPow = Math.pow(10, noStr.length - dotIndex - 1);
}
return correctPow;
}
/**
* 주어진 수치 문자열에, 뒤에서 3자리씩 마다 컴마(,)를
* 삽입한다.
*
* @param noStr 컴마를 삽입할 문자열
*/
function formatNo(noStr) {
if ( event != undefined && isControlKey() ) return;
//if ( isControlKey() ) return true;
var noStr = removeChar(noStr, ',');
var signPart = ""; // 기호부
var intPart = ""; // 정수부
var floatPat = ""; // 소수부
// 기호부, 정수부, 소수부를 분리한다.
if ( noStr.charAt(0) == '-' ) {
signPart = "-";
}
var dotIndex = noStr.lastIndexOf('.');
if ( dotIndex == -1 ) {
dotIndex = noStr.length;
}
intPart = noStr.substring(signPart.length, dotIndex);
floatPart = noStr.substring(dotIndex);
// 정수부에 3자리마다 컴마(,)를 삽입한다.
var buff = "";
for (var i = 1, index = intPart.length - 1; i <= intPart.length; i++, index--) {
buff = intPart.charAt(index) + buff;
// 가장 마지막 자리 앞에는 컴마를 넣지 않는다.
if ( i % 3 == 0 && i < intPart.length ) {
buff = ',' + buff;
}
}
// 기호부, 컴마가 들어간 정수부, 소수부를 합쳐 돌려준다.
return signPart + buff + floatPart;
}
/**
* Text형 입력폼의 값을 3자리마다 컴마를 찍은 값으로
* 세팅한다.
*
* @param obj Text형 입력폼 객체
*/
function formatNoObj(obj) {
if ( event != undefined && isControlKey() ) return;
//if ( isControlKey() ) return true;
obj.value = formatNo(obj.value);
}