@@ -31,7 +31,7 @@ function init(){
|
||||
new makeOptions("CODE","NAME").setObj($("select[name=searchJobInst]")).setNoValueInclude(true).setNoValue("",
|
||||
"<%= localeMessage.getString("combo.all")%>").setData(json.instanceList).rendering();
|
||||
|
||||
$("select[name=searchJobUseYn]").val("Y");
|
||||
//$("select[name=searchJobUseYn]").val("Y");
|
||||
|
||||
putSelectFromParam();
|
||||
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
<%@ page language="java" contentType="text/html; charset=utf-8" %>
|
||||
<%@ page import="java.io.*" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
|
||||
<%@ include file="/jsp/common/include/localemessage.jsp" %>
|
||||
<%
|
||||
response.setHeader("Pragma", "No-cache");
|
||||
response.setHeader("Cache-Control", "no-cache");
|
||||
response.setHeader("Expires", "0");
|
||||
%>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<jsp:include page="/jsp/common/include/css.jsp"/>
|
||||
<jsp:include page="/jsp/common/include/script.jsp"/>
|
||||
<style>
|
||||
.status-N { color:#1a73e8; font-weight:bold; }
|
||||
.status-C { color:#9aa0a6; font-weight:bold; }
|
||||
.status-D { color:#e8710a; font-weight:bold; }
|
||||
.status-E { color:#d93025; font-weight:bold; }
|
||||
</style>
|
||||
<script language="javascript">
|
||||
var url = '<c:url value="/onl/apim/apistatus/hist/apiStatusHistMan.json" />';
|
||||
|
||||
// 상태코드(N:정상, C:점검, D:지연, E:장애) 한글 라벨
|
||||
var STATUS_NAME = {N: '정상', C: '점검', D: '지연', E: '장애'};
|
||||
|
||||
function escapeHtmlJs(s) { return $('<div>').text(s == null ? '' : s).html(); }
|
||||
|
||||
function formatStatus(cellvalue, options, rowObject) {
|
||||
if (!cellvalue) return '';
|
||||
var name = STATUS_NAME[cellvalue] || cellvalue;
|
||||
return '<span class="status-' + cellvalue + '">' + escapeHtmlJs(name) + '</span>';
|
||||
}
|
||||
|
||||
function init() {
|
||||
$("#startDatepicker").datepicker().inputmask("yyyy-mm-dd", {'autoUnmask': true});
|
||||
$("#endDatepicker").datepicker().inputmask("yyyy-mm-dd", {'autoUnmask': true});
|
||||
|
||||
var today = getToday();
|
||||
|
||||
$("input[name=searchStartYYYYMMDD]").val(today.substring(0, 6) + "01");
|
||||
$("input[name=searchEndYYYYMMDD]").val(today);
|
||||
$("input[name=searchStartDate]").val(today.substring(0, 6) + "01");
|
||||
$("input[name=searchEndDate]").val(today);
|
||||
|
||||
// 뒤로가기 등으로 이전 검색조건 파라미터가 있으면 기본값을 덮어씀
|
||||
putSelectFromParam();
|
||||
|
||||
buildGrid();
|
||||
}
|
||||
|
||||
function buildGrid() {
|
||||
$('#grid').jqGrid({
|
||||
datatype: "json",
|
||||
mtype: 'POST',
|
||||
url: url,
|
||||
postData: getSearchForJqgrid("cmd", "LIST"),
|
||||
colNames: ['histSeq', 'No.', 'API ID', '이전상태', '변경상태', 'Job명', '인스턴스명', '등록자', '등록일시'],
|
||||
colModel: [
|
||||
{name: 'histSeq', align: 'center', key: true, hidden: true},
|
||||
{name: 'rowNum', align: 'center', width: 45, sortable: false},
|
||||
{name: 'eaisvcname', align: 'left', width: 160},
|
||||
{name: 'prevStatusCode', align: 'center', width: 70, formatter: formatStatus},
|
||||
{name: 'statusCode', align: 'center', width: 70, formatter: formatStatus},
|
||||
{name: 'jobname', align: 'left', width: 160},
|
||||
{name: 'instancename', align: 'center', width: 100},
|
||||
{name: 'createdBy', align: 'center', width: 90},
|
||||
{name: 'createdDate', align: 'center', width: 150}
|
||||
],
|
||||
jsonReader: {repeatitems: false},
|
||||
pager: $('#pager'),
|
||||
page: '${param.page}',
|
||||
rowNum: '${rmsDefaultRowNum}',
|
||||
autoheight: true,
|
||||
height: $("#container").height(),
|
||||
autowidth: true,
|
||||
viewrecords: true,
|
||||
rowList: eval('[${rmsDefaultRowList}]'),
|
||||
loadComplete: function () {
|
||||
var page = $(this).getGridParam('page');
|
||||
var rowNum = $(this).getGridParam('rowNum');
|
||||
var rows = $(this).getDataIDs();
|
||||
var colModel = $(this).getGridParam("colModel");
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var number = ((page - 1) * rowNum + i) + 1;
|
||||
$(this).setCell(rows[i], 'rowNum', number);
|
||||
}
|
||||
// 서버 고정 정렬(등록일시 역순) - 컬럼 정렬 비활성
|
||||
for (var i = 0; i < colModel.length; i++) {
|
||||
$(this).setColProp(colModel[i].name, {sortable: false});
|
||||
}
|
||||
},
|
||||
loadError: function (jqXHR, textStatus, errorThrown) {
|
||||
var location = '<%=request.getContextPath()%>/';
|
||||
comloadError(jqXHR, textStatus, errorThrown, location);
|
||||
}
|
||||
});
|
||||
resizeJqGridWidth('grid', 'content_middle', '1000');
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
init();
|
||||
|
||||
$("#btn_search").click(function () {
|
||||
var start = $("input[name=searchStartYYYYMMDD]").val().replace(/-/gi, "");
|
||||
var end = $("input[name=searchEndYYYYMMDD]").val().replace(/-/gi, "");
|
||||
|
||||
if (start && start > getToday()) {
|
||||
alert("시작일이 오늘 이후입니다. 시작일을 확인해주세요.");
|
||||
$("input[name=searchStartYYYYMMDD]").focus();
|
||||
return false;
|
||||
}
|
||||
if (start && end && start > end) {
|
||||
alert("조회기간 종료일은 시작일보다 커야합니다.");
|
||||
$("input[name=searchEndYYYYMMDD]").focus();
|
||||
return false;
|
||||
}
|
||||
$("input[name=searchStartDate]").val(start);
|
||||
$("input[name=searchEndDate]").val(end);
|
||||
|
||||
var postData = getSearchForJqgrid("cmd", "LIST");
|
||||
$("#grid").setGridParam({url: url, postData: postData, page: 1}).trigger("reloadGrid");
|
||||
});
|
||||
|
||||
$("select[name^=search]").change(function () { $("#btn_search").click(); });
|
||||
$("input[name^=search]").keydown(function (key) {
|
||||
if (key.keyCode == 13) { $("#btn_search").click(); }
|
||||
});
|
||||
|
||||
buttonControl();
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="right_box">
|
||||
<div class="content_top">
|
||||
<ul class="path"><li><a href="#">${rmsMenuPath}</a></li></ul>
|
||||
</div><!-- end content_top -->
|
||||
<div class="content_middle" id="content_middle">
|
||||
<div class="search_wrap">
|
||||
<button type="button" class="cssbtn" id="btn_search" level="R"><i class="material-icons">search</i> <%= localeMessage.getString("button.search") %></button>
|
||||
</div>
|
||||
<div class="title">API 상태 변경 히스토리<span class="tooltip">API 장애/지연/점검 상태 변경 이력을 조회합니다.</span></div>
|
||||
<form id="ajaxForm" onsubmit="return false;">
|
||||
<table class="search_condition" cellspacing=0;>
|
||||
<colgroup>
|
||||
<col style="width:120px;"><col style="width:200px;">
|
||||
<col style="width:120px;"><col style="width:200px;">
|
||||
<col style="width:120px;"><col style="width:200px;">
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>API ID</th>
|
||||
<td><input type="text" name="searchEaisvcname" autocomplete="off"></td>
|
||||
<th>변경상태</th>
|
||||
<td>
|
||||
<div class="select-style">
|
||||
<select name="searchStatusCode">
|
||||
<option value="">전체</option>
|
||||
<option value="N">정상</option>
|
||||
<option value="C">점검</option>
|
||||
<option value="D">지연</option>
|
||||
<option value="E">장애</option>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
<th>Job명</th>
|
||||
<td><input type="text" name="searchJobname" autocomplete="off"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>인스턴스명</th>
|
||||
<td><input type="text" name="searchInstancename" autocomplete="off"></td>
|
||||
<th>등록기간</th>
|
||||
<td>
|
||||
<input type="text" name="searchStartYYYYMMDD" id="startDatepicker" readonly="readonly" value="" size="10" style="width:100px; border:1px solid #ebebec;">
|
||||
~
|
||||
<input type="text" name="searchEndYYYYMMDD" value="" id="endDatepicker" size="10" readonly="readonly" style="width:100px; border:1px solid #ebebec;">
|
||||
<input type="hidden" name="searchStartDate" value="">
|
||||
<input type="hidden" name="searchEndDate" value="">
|
||||
</td>
|
||||
<th></th>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
<table id="grid"></table>
|
||||
<div id="pager"></div>
|
||||
</div><!-- end content_middle -->
|
||||
</div><!-- end right_box -->
|
||||
</body>
|
||||
</html>
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.djb.apistatus.hist;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* API 상태 변경 히스토리(API_STATUS_HIST) - 조회 전용 엔티티.
|
||||
*
|
||||
* <p>{@code ApiStatusService.updateApiStatus()}에서 상태 전이 CAS 선점에 성공한 건에 대해
|
||||
* {@code ApiStatusRepository.insertHistory()}(native INSERT)로 1건씩 적재된다. 이 엔티티는
|
||||
* 그 적재 결과를 조회하는 용도로만 쓴다.</p>
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "API_STATUS_HIST")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class ApiStatusHist {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "api_status_hist_seq")
|
||||
@SequenceGenerator(
|
||||
name = "api_status_hist_seq",
|
||||
sequenceName = "API_STATUS_HIST_SEQ",
|
||||
allocationSize = 1
|
||||
)
|
||||
@Column(name = "HIST_SEQ")
|
||||
private Long histSeq;
|
||||
|
||||
@Column(name = "EAISVCNAME", length = 30)
|
||||
private String eaisvcname;
|
||||
|
||||
@Column(name = "STATUS_CODE", length = 1)
|
||||
private String statusCode;
|
||||
|
||||
@Column(name = "PREV_STATUS_CODE", length = 1)
|
||||
private String prevStatusCode;
|
||||
|
||||
@Column(name = "JOBNAME", length = 40)
|
||||
private String jobname;
|
||||
|
||||
@Column(name = "INSTANCENAME", length = 20)
|
||||
private String instancename;
|
||||
|
||||
@Column(name = "CREATED_BY", length = 20)
|
||||
private String createdBy;
|
||||
|
||||
@Column(name = "CREATED_DATE")
|
||||
private LocalDateTime createdDate;
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package com.eactive.eai.rms.ext.djb.apistatus.hist;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.web.SortDefault;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import com.eactive.eai.rms.common.base.BaseAnnotationController;
|
||||
import com.eactive.eai.rms.common.vo.GridResponse;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* API 상태 변경 히스토리(API_STATUS_HIST) 조회 화면 컨트롤러.
|
||||
*
|
||||
* <p>조회 전용 (등록/수정/삭제 없음) - 데이터는 {@code ApiStatusService.updateApiStatus()}에서
|
||||
* 상태 전이가 감지될 때마다 자동 적재된다.</p>
|
||||
*/
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
public class ApiStatusHistManController extends BaseAnnotationController {
|
||||
|
||||
private final ApiStatusHistManService apiStatusHistManService;
|
||||
|
||||
@GetMapping(value = "/onl/apim/apistatus/hist/apiStatusHistMan.view")
|
||||
public void view() {
|
||||
// 목록 view
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/apim/apistatus/hist/apiStatusHistMan.json", params = "cmd=LIST")
|
||||
public ResponseEntity<GridResponse<ApiStatusHistUI>> selectList(
|
||||
@SortDefault(sort = "createdDate", direction = Sort.Direction.DESC) Pageable pageable,
|
||||
ApiStatusHistUISearch search) {
|
||||
Page<ApiStatusHistUI> page = apiStatusHistManService.selectList(pageable, search);
|
||||
return ResponseEntity.ok(new GridResponse<>(page));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.eactive.eai.rms.ext.djb.apistatus.hist;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.rms.common.base.BaseService;
|
||||
import com.eactive.eai.rms.common.util.StringUtils;
|
||||
import com.eactive.eai.rms.data.entity.onl.djb.apistatus.hist.ApiStatusHist;
|
||||
import com.eactive.eai.rms.data.entity.onl.djb.apistatus.hist.QApiStatusHist;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* API 상태 변경 히스토리(API_STATUS_HIST) 조회 화면 서비스. 조회 전용.
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional
|
||||
public class ApiStatusHistManService extends BaseService {
|
||||
|
||||
private static final DateTimeFormatter FMT_DATETIME = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
private static final DateTimeFormatter FMT_YYYYMMDD = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
|
||||
private final ApiStatusHistRepository apiStatusHistRepository;
|
||||
|
||||
public Page<ApiStatusHistUI> selectList(Pageable pageable, ApiStatusHistUISearch search) {
|
||||
QApiStatusHist hist = QApiStatusHist.apiStatusHist;
|
||||
BooleanBuilder predicate = new BooleanBuilder();
|
||||
|
||||
if (StringUtils.isNotBlank(search.getSearchEaisvcname())) {
|
||||
predicate.and(hist.eaisvcname.containsIgnoreCase(search.getSearchEaisvcname()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(search.getSearchStatusCode())) {
|
||||
predicate.and(hist.statusCode.eq(search.getSearchStatusCode()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(search.getSearchJobname())) {
|
||||
predicate.and(hist.jobname.containsIgnoreCase(search.getSearchJobname()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(search.getSearchInstancename())) {
|
||||
predicate.and(hist.instancename.eq(search.getSearchInstancename()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(search.getSearchStartDate())) {
|
||||
predicate.and(hist.createdDate.goe(parseYYYYMMDD(search.getSearchStartDate()).atStartOfDay()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(search.getSearchEndDate())) {
|
||||
predicate.and(hist.createdDate.loe(parseYYYYMMDD(search.getSearchEndDate()).atTime(23, 59, 59)));
|
||||
}
|
||||
|
||||
Page<ApiStatusHist> page = apiStatusHistRepository.findAll(predicate, pageable);
|
||||
return page.map(this::convertToUI);
|
||||
}
|
||||
|
||||
private static LocalDate parseYYYYMMDD(String yyyyMMdd) {
|
||||
return LocalDate.parse(yyyyMMdd, FMT_YYYYMMDD);
|
||||
}
|
||||
|
||||
private ApiStatusHistUI convertToUI(ApiStatusHist e) {
|
||||
ApiStatusHistUI ui = new ApiStatusHistUI();
|
||||
ui.setHistSeq(e.getHistSeq());
|
||||
ui.setEaisvcname(e.getEaisvcname());
|
||||
ui.setStatusCode(e.getStatusCode());
|
||||
ui.setPrevStatusCode(e.getPrevStatusCode());
|
||||
ui.setJobname(e.getJobname());
|
||||
ui.setInstancename(e.getInstancename());
|
||||
ui.setCreatedBy(e.getCreatedBy());
|
||||
ui.setCreatedDate(e.getCreatedDate() == null ? "" : e.getCreatedDate().format(FMT_DATETIME));
|
||||
return ui;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.eactive.eai.rms.ext.djb.apistatus.hist;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.entity.onl.djb.apistatus.hist.ApiStatusHist;
|
||||
|
||||
@Repository
|
||||
public interface ApiStatusHistRepository extends BaseRepository<ApiStatusHist, Long> {
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.eactive.eai.rms.ext.djb.apistatus.hist;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* API 상태 변경 히스토리(API_STATUS_HIST) 화면 응답 DTO.
|
||||
*
|
||||
* <p>상태코드(N/C/D/E)의 한글 라벨은 화면(JS)에서 매핑한다. 등록일시는 yyyy-MM-dd HH:mm:ss
|
||||
* 형식 문자열로 제공한다.</p>
|
||||
*/
|
||||
@Data
|
||||
public class ApiStatusHistUI {
|
||||
|
||||
private Long histSeq;
|
||||
private String eaisvcname;
|
||||
private String statusCode;
|
||||
private String prevStatusCode;
|
||||
private String jobname;
|
||||
private String instancename;
|
||||
private String createdBy;
|
||||
private String createdDate;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.eactive.eai.rms.ext.djb.apistatus.hist;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApiStatusHistUISearch {
|
||||
|
||||
/* API ID(EAISVCNAME), LIKE 검색 */
|
||||
private String searchEaisvcname;
|
||||
|
||||
/* 변경후 상태코드 (N/C/D/E, 공백=전체) */
|
||||
private String searchStatusCode;
|
||||
|
||||
/* Job명(스케줄러 등록명), LIKE 검색 */
|
||||
private String searchJobname;
|
||||
|
||||
/* 실행 인스턴스명 */
|
||||
private String searchInstancename;
|
||||
|
||||
/* 등록일시 기간 검색 (yyyyMMdd, 8자리) */
|
||||
private String searchStartDate;
|
||||
private String searchEndDate;
|
||||
}
|
||||
Reference in New Issue
Block a user