비즈니스로그 조회 수정
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package com.caliverse.admin.domain.entity;
|
||||
|
||||
public enum EInputType {
|
||||
None,
|
||||
String,
|
||||
Number,
|
||||
Boolean,
|
||||
Null
|
||||
;
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.caliverse.admin.domain.request;
|
||||
|
||||
import com.caliverse.admin.domain.entity.EInputType;
|
||||
import com.caliverse.admin.domain.entity.common.SearchUserType;
|
||||
import com.caliverse.admin.logs.entity.LogAction;
|
||||
import com.caliverse.admin.logs.entity.LogDomain;
|
||||
@@ -10,6 +11,8 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@@ -24,6 +27,7 @@ public class LogGenericRequest {
|
||||
private LogAction logAction;
|
||||
@JsonProperty("log_domain")
|
||||
private LogDomain logDomain;
|
||||
private List<LogFilter> filters;
|
||||
@JsonProperty("tran_id")
|
||||
private String tranId;
|
||||
@JsonProperty("start_dt")
|
||||
@@ -36,4 +40,13 @@ public class LogGenericRequest {
|
||||
private Integer pageSize;
|
||||
@JsonProperty("order_by")
|
||||
private String orderBy;
|
||||
|
||||
@Data
|
||||
public static class LogFilter{
|
||||
@JsonProperty("field_name")
|
||||
private String fieldName;
|
||||
@JsonProperty("field_type")
|
||||
private EInputType fieldType;
|
||||
private String value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,17 +74,11 @@ public class LogService {
|
||||
}
|
||||
|
||||
int totalItems = logList.size();
|
||||
int totalPages = (int) Math.ceil((double) totalItems / size);
|
||||
page = (totalItems > 0 && page > totalPages) ? totalPages : page;
|
||||
|
||||
List<GenericMongoLog> pagedList = (totalItems == 0) ?
|
||||
new ArrayList<>() :
|
||||
logList.subList((page - 1) * size, Math.min((page - 1) * size + size, totalItems));
|
||||
|
||||
return LogResponse.builder()
|
||||
.resultData(LogResponse.ResultData.builder()
|
||||
.genericList(pagedList)
|
||||
.total(pagedList.size())
|
||||
.genericList(logList)
|
||||
.total(totalItems)
|
||||
.totalAll(totalItems)
|
||||
.pageNo(logGenericRequest.getPageNo() != null ?
|
||||
page : 1)
|
||||
|
||||
@@ -371,4 +371,16 @@ public class CommonUtils {
|
||||
LocalDate localDate = date.minusMonths(1);
|
||||
return localDate.lengthOfMonth();
|
||||
}
|
||||
|
||||
public static String formatValueForRegex(Object value) {
|
||||
if (value == null) {
|
||||
return "null";
|
||||
} else if (value instanceof String) {
|
||||
return "\"" + value.toString().replace("\"", "\\\"") + "\"";
|
||||
} else if (value instanceof Boolean || value instanceof Number) {
|
||||
return value.toString();
|
||||
} else {
|
||||
return "\"" + value.toString().replace("\"", "\\\"") + "\"";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user