거래로그>시간별 수동집계 기능 추가
This commit is contained in:
@@ -82,6 +82,54 @@
|
|||||||
</style>
|
</style>
|
||||||
<jsp:include page="/jsp/common/include/script.jsp"/>
|
<jsp:include page="/jsp/common/include/script.jsp"/>
|
||||||
<script language="javascript">
|
<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() {
|
function executeHourlyToDaily() {
|
||||||
var targetDate = $("#targetDate").val().replace(/-/g, "");
|
var targetDate = $("#targetDate").val().replace(/-/g, "");
|
||||||
var resultDiv = $("#dailyResult");
|
var resultDiv = $("#dailyResult");
|
||||||
@@ -255,6 +303,12 @@
|
|||||||
$("#targetYear").val(lastYear);
|
$("#targetYear").val(lastYear);
|
||||||
|
|
||||||
// 버튼 이벤트
|
// 버튼 이벤트
|
||||||
|
$("#btn_execute_hourly").click(function() {
|
||||||
|
if (confirm("시간별 통계 집계를 실행하시겠습니까?")) {
|
||||||
|
executeAggregationHourly();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$("#btn_execute_daily").click(function() {
|
$("#btn_execute_daily").click(function() {
|
||||||
if (confirm("시간별→일별 통계 집계를 실행하시겠습니까?")) {
|
if (confirm("시간별→일별 통계 집계를 실행하시겠습니까?")) {
|
||||||
executeHourlyToDaily();
|
executeHourlyToDaily();
|
||||||
@@ -297,9 +351,26 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</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">
|
<div class="aggregation-section">
|
||||||
<h3>1. 시간별 → 일별 통계 집계</h3>
|
<h3>2. 시간별 → 일별 통계 집계</h3>
|
||||||
<div class="aggregation-form">
|
<div class="aggregation-form">
|
||||||
<label>대상 날짜:</label>
|
<label>대상 날짜:</label>
|
||||||
<input type="text" id="targetDate" placeholder="yyyyMMdd" maxlength="8">
|
<input type="text" id="targetDate" placeholder="yyyyMMdd" maxlength="8">
|
||||||
@@ -316,7 +387,7 @@
|
|||||||
|
|
||||||
<!-- 일별 → 월별 집계 -->
|
<!-- 일별 → 월별 집계 -->
|
||||||
<div class="aggregation-section">
|
<div class="aggregation-section">
|
||||||
<h3>2. 일별 → 월별 통계 집계</h3>
|
<h3>3. 일별 → 월별 통계 집계</h3>
|
||||||
<div class="aggregation-form">
|
<div class="aggregation-form">
|
||||||
<label>대상 월:</label>
|
<label>대상 월:</label>
|
||||||
<input type="text" id="targetMonth" placeholder="yyyyMM" maxlength="6">
|
<input type="text" id="targetMonth" placeholder="yyyyMM" maxlength="6">
|
||||||
@@ -333,7 +404,7 @@
|
|||||||
|
|
||||||
<!-- 월별 → 연별 집계 -->
|
<!-- 월별 → 연별 집계 -->
|
||||||
<div class="aggregation-section">
|
<div class="aggregation-section">
|
||||||
<h3>3. 월별 → 연별 통계 집계</h3>
|
<h3>4. 월별 → 연별 통계 집계</h3>
|
||||||
<div class="aggregation-form">
|
<div class="aggregation-form">
|
||||||
<label>대상 연도:</label>
|
<label>대상 연도:</label>
|
||||||
<input type="text" id="targetYear" placeholder="yyyy" maxlength="4">
|
<input type="text" id="targetYear" placeholder="yyyy" maxlength="4">
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import com.eactive.eai.rms.ext.djb.job.ApiStatsHourlyAggregationJob;
|
||||||
import com.eactive.ext.kjb.statistics.job.DailyToMonthlyAggregationJob;
|
import com.eactive.ext.kjb.statistics.job.DailyToMonthlyAggregationJob;
|
||||||
import com.eactive.ext.kjb.statistics.job.HourlyToDailyAggregationJob;
|
import com.eactive.ext.kjb.statistics.job.HourlyToDailyAggregationJob;
|
||||||
import com.eactive.ext.kjb.statistics.job.MonthlyToYearlyAggregationJob;
|
import com.eactive.ext.kjb.statistics.job.MonthlyToYearlyAggregationJob;
|
||||||
@@ -33,12 +34,62 @@ public class ApiStatsAggregationController {
|
|||||||
private final HourlyToDailyAggregationJob hourlyToDailyAggregationJob;
|
private final HourlyToDailyAggregationJob hourlyToDailyAggregationJob;
|
||||||
private final DailyToMonthlyAggregationJob dailyToMonthlyAggregationJob;
|
private final DailyToMonthlyAggregationJob dailyToMonthlyAggregationJob;
|
||||||
private final MonthlyToYearlyAggregationJob monthlyToYearlyAggregationJob;
|
private final MonthlyToYearlyAggregationJob monthlyToYearlyAggregationJob;
|
||||||
|
|
||||||
|
private final ApiStatsHourlyAggregationJob apiStatsHourlyAggregationJob;
|
||||||
|
|
||||||
@GetMapping(value = "/onl/kjb/statistics/apiStatsAggregationMan.view")
|
@GetMapping(value = "/onl/kjb/statistics/apiStatsAggregationMan.view")
|
||||||
public String view() {
|
public String view() {
|
||||||
return "/onl/kjb/statistics/apiStatsAggregationMan";
|
return "/onl/kjb/statistics/apiStatsAggregationMan";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 거래로그→시간별 통계 집계 수동 실행
|
||||||
|
* @param targetDate 집계 대상 날짜 (yyyyMMdd 형식, 예: 20250120)
|
||||||
|
* @return 처리 결과
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/onl/kjb/statistics/apiStatsAggregationMan.json", params = "cmd=AGGREGATION_HOUR")
|
||||||
|
public ResponseEntity<Map<String, Object>> executeAggregationHourly(
|
||||||
|
@RequestParam(required = false) String targetDate) {
|
||||||
|
|
||||||
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 날짜 입력 검증
|
||||||
|
if (targetDate == null || targetDate.trim().isEmpty()) {
|
||||||
|
log.error("targetDate 미입력");
|
||||||
|
result.put("success", false);
|
||||||
|
result.put("message", "대상 날짜를 입력하세요. (예: 20250120)");
|
||||||
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
LocalDate date;
|
||||||
|
try {
|
||||||
|
date = LocalDate.parse(targetDate, DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||||
|
} catch (DateTimeParseException e) {
|
||||||
|
log.error("잘못된 날짜 형식: {}", targetDate);
|
||||||
|
result.put("success", false);
|
||||||
|
result.put("message", "잘못된 날짜 형식입니다. yyyyMMdd 형식으로 입력하세요. (예: 20250120)");
|
||||||
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("거래로그→시간별 통계 집계 수동 실행 시작. targetDate: {}", date);
|
||||||
|
int count = apiStatsHourlyAggregationJob.executeManual(date);
|
||||||
|
|
||||||
|
result.put("success", true);
|
||||||
|
result.put("message", "거래로그→시간별 통계 집계가 완료되었습니다.");
|
||||||
|
result.put("targetDate", date.format(DateTimeFormatter.ofPattern("yyyyMMdd")));
|
||||||
|
result.put("processedCount", count);
|
||||||
|
|
||||||
|
return ResponseEntity.ok(result);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("거래로그→시간별 통계 집계 실행 중 오류 발생", e);
|
||||||
|
result.put("success", false);
|
||||||
|
result.put("message", "집계 실행 중 오류가 발생했습니다: " + e.getMessage());
|
||||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 시간별→일별 통계 집계 수동 실행
|
* 시간별→일별 통계 집계 수동 실행
|
||||||
* @param targetDate 집계 대상 날짜 (yyyyMMdd 형식, 예: 20250120)
|
* @param targetDate 집계 대상 날짜 (yyyyMMdd 형식, 예: 20250120)
|
||||||
|
|||||||
Reference in New Issue
Block a user