비즈니스로그 멀티필터
This commit is contained in:
@@ -45,11 +45,10 @@ public class LogService {
|
|||||||
int page = logGenericRequest.getPageNo();
|
int page = logGenericRequest.getPageNo();
|
||||||
int size = logGenericRequest.getPageSize();
|
int size = logGenericRequest.getPageSize();
|
||||||
|
|
||||||
LocalDateTime startDt = logGenericRequest.getStartDt().plusHours(9);
|
// LocalDateTime startDt = logGenericRequest.getStartDt().plusHours(9);
|
||||||
LocalDateTime endDt = logGenericRequest.getEndDt().plusHours(9).plusDays(1);
|
// LocalDateTime endDt = logGenericRequest.getEndDt().plusHours(9).plusDays(1);
|
||||||
|
// logGenericRequest.setStartDt(startDt);
|
||||||
logGenericRequest.setStartDt(startDt);
|
// logGenericRequest.setEndDt(endDt);
|
||||||
logGenericRequest.setEndDt(endDt);
|
|
||||||
|
|
||||||
// List<Map<String, Object>> logList = businessLogGenericService.loadBusinessLogData(logGenericRequest);
|
// List<Map<String, Object>> logList = businessLogGenericService.loadBusinessLogData(logGenericRequest);
|
||||||
List<GenericMongoLog> logList = new ArrayList<>();
|
List<GenericMongoLog> logList = new ArrayList<>();
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import org.springframework.data.mongodb.core.query.Criteria;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@@ -36,11 +37,17 @@ public class BusinessLogGenericService extends BusinessLogServiceBase {
|
|||||||
super(mongoTemplate);
|
super(mongoTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <T> List<T> loadBusinessLogData(LogGenericRequest logGenericRequest, Class<T> class1){
|
||||||
|
return loadBusinessLogData(logGenericRequest, class1, false);
|
||||||
|
}
|
||||||
|
|
||||||
// public List<Map<String, Object>> loadBusinessLogData(LogGenericRequest logGenericRequest) {
|
// public List<Map<String, Object>> loadBusinessLogData(LogGenericRequest logGenericRequest) {
|
||||||
public <T> List<T> loadBusinessLogData(LogGenericRequest logGenericRequest, Class<T> class1) {
|
public <T> List<T> loadBusinessLogData(LogGenericRequest logGenericRequest, Class<T> class1, boolean isSimple) {
|
||||||
String startTime = logGenericRequest.getStartDt().toString().substring(0, 10);
|
LocalDateTime startDt = logGenericRequest.getStartDt().plusHours(9);
|
||||||
String endTime = logGenericRequest.getEndDt().toString().substring(0, 10);
|
LocalDateTime endDt = logGenericRequest.getEndDt().plusHours(9).plusDays(1);
|
||||||
|
|
||||||
|
String startTime = startDt.toString().substring(0, 10);
|
||||||
|
String endTime = endDt.toString().substring(0, 10);
|
||||||
LogAction logAction = logGenericRequest.getLogAction();
|
LogAction logAction = logGenericRequest.getLogAction();
|
||||||
LogDomain logDomain = logGenericRequest.getLogDomain();
|
LogDomain logDomain = logGenericRequest.getLogDomain();
|
||||||
SearchUserType searchUserType = logGenericRequest.getSearchType();
|
SearchUserType searchUserType = logGenericRequest.getSearchType();
|
||||||
@@ -223,25 +230,17 @@ public class BusinessLogGenericService extends BusinessLogServiceBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(filters != null && !filters.isEmpty()) {
|
if(isSimple){
|
||||||
// List<Document> filterDocuments = new ArrayList<>();
|
operations.add(context ->
|
||||||
//
|
new Document("$project",
|
||||||
// for (LogGenericRequest.LogFilter filter : filters) {
|
new Document(AdminConstants.MONGO_DB_KEY_ACCOUNT_ID, 1)
|
||||||
// if (filter.getFieldName() != null && !filter.getFieldName().isEmpty() &&
|
.append(AdminConstants.MONGO_DB_KEY_USER_GUID, 1)
|
||||||
// filter.getValue() != null) {
|
.append(AdminConstants.MONGO_DB_KEY_USER_NICKNAME, 1)
|
||||||
// Document filterDoc = new Document(filter.getFieldName(), filter.getValue());
|
.append(AdminConstants.MONGO_DB_KEY_LOGTIME, 1)
|
||||||
// filterDocuments.add(filterDoc);
|
.append("body", 1)
|
||||||
// }
|
)
|
||||||
// }
|
);
|
||||||
//
|
}
|
||||||
// if (!filterDocuments.isEmpty()) {
|
|
||||||
// operations.add(context ->
|
|
||||||
// new Document("$match",
|
|
||||||
// new Document("$and", filterDocuments)
|
|
||||||
// )
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 최종 출력 형식
|
// 최종 출력 형식
|
||||||
operations.add(context ->
|
operations.add(context ->
|
||||||
|
|||||||
Reference in New Issue
Block a user