425 lines
13 KiB
Plaintext
425 lines
13 KiB
Plaintext
<%@ page language="java" contentType="text/html; charset=utf-8"%>
|
|
<%@ page import="java.io.*"%>
|
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
|
<%@ include file="/jsp/common/include/localemessage.jsp" %>
|
|
<%
|
|
response.setHeader("Pragma", "No-cache");
|
|
response.setHeader("Cache-Control", "no-cache");
|
|
response.setHeader("Expires", "0");
|
|
request.setCharacterEncoding("UTF-8");
|
|
%>
|
|
<html>
|
|
<head>
|
|
<title>API 통계 집계 실행</title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<jsp:include page="/jsp/common/include/css.jsp"/>
|
|
<style>
|
|
.aggregation-section {
|
|
background: #fff;
|
|
border: 1px solid #ddd;
|
|
border-radius: 4px;
|
|
padding: 20px;
|
|
margin-bottom: 20px;
|
|
}
|
|
.aggregation-section h3 {
|
|
margin: 0 0 15px 0;
|
|
padding-bottom: 10px;
|
|
border-bottom: 2px solid #4CAF50;
|
|
color: #333;
|
|
font-size: 16px;
|
|
}
|
|
.aggregation-form {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
margin-bottom: 10px;
|
|
}
|
|
.aggregation-form label {
|
|
font-weight: bold;
|
|
min-width: 80px;
|
|
}
|
|
.aggregation-form input[type="text"] {
|
|
width: 150px;
|
|
padding: 5px 10px;
|
|
}
|
|
.aggregation-form .cssbtn {
|
|
min-width: 120px;
|
|
}
|
|
.result-area {
|
|
margin-top: 15px;
|
|
padding: 10px;
|
|
border-radius: 4px;
|
|
display: none;
|
|
}
|
|
.result-area.success {
|
|
background: #d4edda;
|
|
border: 1px solid #c3e6cb;
|
|
color: #155724;
|
|
}
|
|
.result-area.error {
|
|
background: #f8d7da;
|
|
border: 1px solid #f5c6cb;
|
|
color: #721c24;
|
|
}
|
|
.result-area pre {
|
|
margin: 5px 0 0 0;
|
|
white-space: pre-wrap;
|
|
font-size: 12px;
|
|
}
|
|
.info-box {
|
|
background: #e7f3ff;
|
|
border-left: 4px solid #2196F3;
|
|
padding: 12px;
|
|
margin-bottom: 20px;
|
|
}
|
|
.info-box ul {
|
|
margin: 5px 0 0 20px;
|
|
padding: 0;
|
|
}
|
|
.info-box li {
|
|
margin: 3px 0;
|
|
}
|
|
</style>
|
|
<jsp:include page="/jsp/common/include/script.jsp"/>
|
|
<script language="javascript">
|
|
function executeAggregationHourly() {
|
|
var targetDate = $("#targetHour").val().replace(/-/g, "");
|
|
var resultDiv = $("#hourlyResult");
|
|
|
|
// 날짜 입력 검증
|
|
if (!targetDate || targetDate.trim() === '') {
|
|
alert('대상 날짜를 입력하세요. (예: 20250120)');
|
|
$("#targetHour").focus();
|
|
return;
|
|
}
|
|
|
|
resultDiv.hide();
|
|
$("#btn_execute_hourly").prop("disabled", true).text("실행중...");
|
|
|
|
$.ajax({
|
|
url: '<c:url value="/onl/kjb/statistics/apiStatsAggregationMan.json"/>',
|
|
type: 'POST',
|
|
data: {
|
|
cmd: 'AGGREGATION_HOUR',
|
|
targetDate: targetDate,
|
|
serviceType: '${param.serviceType}'
|
|
},
|
|
success: function(response) {
|
|
resultDiv.removeClass("error").addClass("success");
|
|
var message = response.message + "\n";
|
|
message += "대상 날짜: " + response.targetDate + "\n";
|
|
message += "처리 건수: " + response.processedCount;
|
|
resultDiv.find("pre").text(message);
|
|
resultDiv.show();
|
|
},
|
|
error: function(xhr) {
|
|
resultDiv.removeClass("success").addClass("error");
|
|
var message = "집계 실행 실패\n";
|
|
try {
|
|
var error = JSON.parse(xhr.responseText);
|
|
message += error.message;
|
|
} catch(e) {
|
|
message += xhr.responseText || "알 수 없는 오류가 발생했습니다.";
|
|
}
|
|
resultDiv.find("pre").text(message);
|
|
resultDiv.show();
|
|
},
|
|
complete: function() {
|
|
$("#btn_execute_hourly").prop("disabled", false).text("집계 실행");
|
|
}
|
|
});
|
|
}
|
|
|
|
function executeHourlyToDaily() {
|
|
var targetDate = $("#targetDate").val().replace(/-/g, "");
|
|
var resultDiv = $("#dailyResult");
|
|
|
|
// 날짜 입력 검증
|
|
if (!targetDate || targetDate.trim() === '') {
|
|
alert('대상 날짜를 입력하세요. (예: 20250120)');
|
|
$("#targetDate").focus();
|
|
return;
|
|
}
|
|
|
|
resultDiv.hide();
|
|
$("#btn_execute_daily").prop("disabled", true).text("실행중...");
|
|
|
|
$.ajax({
|
|
url: '<c:url value="/onl/kjb/statistics/apiStatsAggregationMan.json"/>',
|
|
type: 'POST',
|
|
data: {
|
|
cmd: 'AGGREGATION_DAY',
|
|
targetDate: targetDate,
|
|
serviceType: '${param.serviceType}'
|
|
},
|
|
success: function(response) {
|
|
resultDiv.removeClass("error").addClass("success");
|
|
var message = response.message + "\n";
|
|
message += "대상 날짜: " + response.targetDate + "\n";
|
|
message += "처리 건수: " + response.processedCount;
|
|
resultDiv.find("pre").text(message);
|
|
resultDiv.show();
|
|
},
|
|
error: function(xhr) {
|
|
resultDiv.removeClass("success").addClass("error");
|
|
var message = "집계 실행 실패\n";
|
|
try {
|
|
var error = JSON.parse(xhr.responseText);
|
|
message += error.message;
|
|
} catch(e) {
|
|
message += xhr.responseText || "알 수 없는 오류가 발생했습니다.";
|
|
}
|
|
resultDiv.find("pre").text(message);
|
|
resultDiv.show();
|
|
},
|
|
complete: function() {
|
|
$("#btn_execute_daily").prop("disabled", false).text("집계 실행");
|
|
}
|
|
});
|
|
}
|
|
|
|
function executeDailyToMonthly() {
|
|
var targetMonth = $("#targetMonth").val().replace(/-/g, "");
|
|
var resultDiv = $("#monthlyResult");
|
|
|
|
// 월 입력 검증
|
|
if (!targetMonth || targetMonth.trim() === '') {
|
|
alert('대상 월을 입력하세요. (예: 202501)');
|
|
$("#targetMonth").focus();
|
|
return;
|
|
}
|
|
|
|
resultDiv.hide();
|
|
$("#btn_execute_monthly").prop("disabled", true).text("실행중...");
|
|
|
|
$.ajax({
|
|
url: '<c:url value="/onl/kjb/statistics/apiStatsAggregationMan.json"/>',
|
|
type: 'POST',
|
|
data: {
|
|
cmd: 'AGGREGATION_MONTH',
|
|
targetMonth: targetMonth,
|
|
serviceType: '${param.serviceType}'
|
|
},
|
|
success: function(response) {
|
|
resultDiv.removeClass("error").addClass("success");
|
|
var message = response.message + "\n";
|
|
message += "대상 월: " + response.targetMonth + "\n";
|
|
message += "처리 건수: " + response.processedCount;
|
|
resultDiv.find("pre").text(message);
|
|
resultDiv.show();
|
|
},
|
|
error: function(xhr) {
|
|
resultDiv.removeClass("success").addClass("error");
|
|
var message = "집계 실행 실패\n";
|
|
try {
|
|
var error = JSON.parse(xhr.responseText);
|
|
message += error.message;
|
|
} catch(e) {
|
|
message += xhr.responseText || "알 수 없는 오류가 발생했습니다.";
|
|
}
|
|
resultDiv.find("pre").text(message);
|
|
resultDiv.show();
|
|
},
|
|
complete: function() {
|
|
$("#btn_execute_monthly").prop("disabled", false).text("집계 실행");
|
|
}
|
|
});
|
|
}
|
|
|
|
function executeMonthlyToYearly() {
|
|
var targetYear = $("#targetYear").val();
|
|
var resultDiv = $("#yearlyResult");
|
|
|
|
// 연도 입력 검증
|
|
if (!targetYear || targetYear.trim() === '') {
|
|
alert('대상 연도를 입력하세요. (예: 2024)');
|
|
$("#targetYear").focus();
|
|
return;
|
|
}
|
|
|
|
resultDiv.hide();
|
|
$("#btn_execute_yearly").prop("disabled", true).text("실행중...");
|
|
|
|
$.ajax({
|
|
url: '<c:url value="/onl/kjb/statistics/apiStatsAggregationMan.json"/>',
|
|
type: 'POST',
|
|
data: {
|
|
cmd: 'AGGREGATION_YEAR',
|
|
targetYear: targetYear,
|
|
serviceType: '${param.serviceType}'
|
|
},
|
|
success: function(response) {
|
|
resultDiv.removeClass("error").addClass("success");
|
|
var message = response.message + "\n";
|
|
message += "대상 연도: " + response.targetYear + "\n";
|
|
message += "처리 건수: " + response.processedCount;
|
|
resultDiv.find("pre").text(message);
|
|
resultDiv.show();
|
|
},
|
|
error: function(xhr) {
|
|
resultDiv.removeClass("success").addClass("error");
|
|
var message = "집계 실행 실패\n";
|
|
try {
|
|
var error = JSON.parse(xhr.responseText);
|
|
message += error.message;
|
|
} catch(e) {
|
|
message += xhr.responseText || "알 수 없는 오류가 발생했습니다.";
|
|
}
|
|
resultDiv.find("pre").text(message);
|
|
resultDiv.show();
|
|
},
|
|
complete: function() {
|
|
$("#btn_execute_yearly").prop("disabled", false).text("집계 실행");
|
|
}
|
|
});
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
// 날짜 입력 마스크
|
|
$("#targetDate").inputmask("99999999", { 'autoUnmask': true, 'placeholder': '' });
|
|
$("#targetMonth").inputmask("999999", { 'autoUnmask': true, 'placeholder': '' });
|
|
$("#targetYear").inputmask("9999", { 'autoUnmask': true, 'placeholder': '' });
|
|
|
|
// 초기값 설정 (전일, 전월, 전년)
|
|
var today = new Date();
|
|
|
|
// 전일
|
|
var yesterday = new Date(today);
|
|
yesterday.setDate(yesterday.getDate() - 1);
|
|
var year = yesterday.getFullYear();
|
|
var month = String(yesterday.getMonth() + 1).padStart(2, '0');
|
|
var day = String(yesterday.getDate()).padStart(2, '0');
|
|
$("#targetDate").val(year + month + day);
|
|
|
|
// 전월
|
|
var lastMonth = new Date(today);
|
|
lastMonth.setMonth(lastMonth.getMonth() - 1);
|
|
var lastMonthYear = lastMonth.getFullYear();
|
|
var lastMonthMonth = String(lastMonth.getMonth() + 1).padStart(2, '0');
|
|
$("#targetMonth").val(lastMonthYear + lastMonthMonth);
|
|
|
|
// 전년
|
|
var lastYear = today.getFullYear() - 1;
|
|
$("#targetYear").val(lastYear);
|
|
|
|
// 버튼 이벤트
|
|
$("#btn_execute_hourly").click(function() {
|
|
if (confirm("시간별 통계 집계를 실행하시겠습니까?")) {
|
|
executeAggregationHourly();
|
|
}
|
|
});
|
|
|
|
$("#btn_execute_daily").click(function() {
|
|
if (confirm("시간별→일별 통계 집계를 실행하시겠습니까?")) {
|
|
executeHourlyToDaily();
|
|
}
|
|
});
|
|
|
|
$("#btn_execute_monthly").click(function() {
|
|
if (confirm("일별→월별 통계 집계를 실행하시겠습니까?")) {
|
|
executeDailyToMonthly();
|
|
}
|
|
});
|
|
|
|
$("#btn_execute_yearly").click(function() {
|
|
if (confirm("월별→연별 통계 집계를 실행하시겠습니까?")) {
|
|
executeMonthlyToYearly();
|
|
}
|
|
});
|
|
|
|
buttonControl();
|
|
});
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div class="right_box">
|
|
<div class="content_top">
|
|
<ul class="path">
|
|
<li><a href="#">${rmsMenuPath}</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="content_middle" id="content_middle">
|
|
<div class="title" id="title">API 통계 집계 수동 실행</div>
|
|
|
|
<div class="info-box">
|
|
<strong>⚠️ 주의사항</strong>
|
|
<ul>
|
|
<li>통계 집계는 스케줄러에 의해 자동으로 실행됩니다.</li>
|
|
<li>수동 실행은 누락된 기간이나 재집계가 필요한 경우에만 사용하세요.</li>
|
|
<li>집계 대상 기간의 원본 데이터가 존재해야 합니다.</li>
|
|
<li>대상 날짜/월/연도를 반드시 입력해야 합니다.</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<!-- 거래로그 → 시간별 집계 -->
|
|
<div class="aggregation-section">
|
|
<h3>1. 거래로그 → 시간별 통계 집계</h3>
|
|
<div class="aggregation-form">
|
|
<label>대상 날짜:</label>
|
|
<input type="text" id="targetHour" placeholder="yyyyMMdd" maxlength="8">
|
|
<span style="color: #666; font-size: 12px;">(예: 20250120)</span>
|
|
<button type="button" class="cssbtn" id="btn_execute_hourly" level="W">
|
|
<i class="material-icons">play_arrow</i> 집계 실행
|
|
</button>
|
|
</div>
|
|
<div id="hourlyResult" class="result-area">
|
|
<strong>실행 결과:</strong>
|
|
<pre></pre>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 시간별 → 일별 집계 -->
|
|
<div class="aggregation-section">
|
|
<h3>2. 시간별 → 일별 통계 집계</h3>
|
|
<div class="aggregation-form">
|
|
<label>대상 날짜:</label>
|
|
<input type="text" id="targetDate" placeholder="yyyyMMdd" maxlength="8">
|
|
<span style="color: #666; font-size: 12px;">(예: 20250120)</span>
|
|
<button type="button" class="cssbtn" id="btn_execute_daily" level="W">
|
|
<i class="material-icons">play_arrow</i> 집계 실행
|
|
</button>
|
|
</div>
|
|
<div id="dailyResult" class="result-area">
|
|
<strong>실행 결과:</strong>
|
|
<pre></pre>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 일별 → 월별 집계 -->
|
|
<div class="aggregation-section">
|
|
<h3>3. 일별 → 월별 통계 집계</h3>
|
|
<div class="aggregation-form">
|
|
<label>대상 월:</label>
|
|
<input type="text" id="targetMonth" placeholder="yyyyMM" maxlength="6">
|
|
<span style="color: #666; font-size: 12px;">(예: 202501)</span>
|
|
<button type="button" class="cssbtn" id="btn_execute_monthly" level="W">
|
|
<i class="material-icons">play_arrow</i> 집계 실행
|
|
</button>
|
|
</div>
|
|
<div id="monthlyResult" class="result-area">
|
|
<strong>실행 결과:</strong>
|
|
<pre></pre>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 월별 → 연별 집계 -->
|
|
<div class="aggregation-section">
|
|
<h3>4. 월별 → 연별 통계 집계</h3>
|
|
<div class="aggregation-form">
|
|
<label>대상 연도:</label>
|
|
<input type="text" id="targetYear" placeholder="yyyy" maxlength="4">
|
|
<span style="color: #666; font-size: 12px;">(예: 2024)</span>
|
|
<button type="button" class="cssbtn" id="btn_execute_yearly" level="W">
|
|
<i class="material-icons">play_arrow</i> 집계 실행
|
|
</button>
|
|
</div>
|
|
<div id="yearlyResult" class="result-area">
|
|
<strong>실행 결과:</strong>
|
|
<pre></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|