로그 일자 시간 추가

메타데이터 api 추가
사용이력 조회 조건 수정
s3 비즈니스로그 수정
유저 조회 수정
This commit is contained in:
2025-09-15 16:10:15 +09:00
parent 60f84112c6
commit 728b1abebc
7 changed files with 177 additions and 31 deletions

View File

@@ -1,6 +1,5 @@
package com.caliverse.admin.domain.api; package com.caliverse.admin.domain.api;
import com.caliverse.admin.domain.request.LogGenericRequest;
import com.caliverse.admin.domain.response.DictionaryResponse; import com.caliverse.admin.domain.response.DictionaryResponse;
import com.caliverse.admin.domain.service.MetaDataService; import com.caliverse.admin.domain.service.MetaDataService;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
@@ -11,7 +10,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.Map; import java.util.Map;
@Tag(name = "백과사전", description = "백과사전 api") @Tag(name = "메타데이터", description = "백과사전 api")
@RestController @RestController
@RequiredArgsConstructor @RequiredArgsConstructor
@RequestMapping("/api/v1/dictionary") @RequestMapping("/api/v1/dictionary")
@@ -23,6 +22,31 @@ public class DictionaryController {
return ResponseEntity.ok().body( metaDataService.getBrandList()); return ResponseEntity.ok().body( metaDataService.getBrandList());
} }
@GetMapping("/ranking/list")
public ResponseEntity<DictionaryResponse> rankingList(){
return ResponseEntity.ok().body( metaDataService.getRankingList());
}
@GetMapping("/battle-config/list")
public ResponseEntity<DictionaryResponse> battleConfigList(){
return ResponseEntity.ok().body( metaDataService.getBattleConfigList());
}
@GetMapping("/battle-reward/list")
public ResponseEntity<DictionaryResponse> battleRewardList(){
return ResponseEntity.ok().body( metaDataService.getBattleRewardList());
}
@GetMapping("/game-mode/list")
public ResponseEntity<DictionaryResponse> gameModeList(){
return ResponseEntity.ok().body( metaDataService.getGameModeList());
}
@GetMapping("/event-action/list")
public ResponseEntity<DictionaryResponse> eventActionList(){
return ResponseEntity.ok().body( metaDataService.getEventActionList());
}
@GetMapping("/item/list") @GetMapping("/item/list")
public ResponseEntity<DictionaryResponse> itemList( public ResponseEntity<DictionaryResponse> itemList(
@RequestParam Map<String, String> requestParams){ @RequestParam Map<String, String> requestParams){

View File

@@ -1,8 +1,6 @@
package com.caliverse.admin.domain.api; package com.caliverse.admin.domain.api;
import com.caliverse.admin.domain.request.EventRequest;
import com.caliverse.admin.domain.request.LandRequest; import com.caliverse.admin.domain.request.LandRequest;
import com.caliverse.admin.domain.response.EventResponse;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;

View File

@@ -45,21 +45,23 @@ public class HistoryService {
HistoryRequest historyRequest = new HistoryRequest(); HistoryRequest historyRequest = new HistoryRequest();
historyRequest.setStartDt(startDt); historyRequest.setStartDt(startDt);
historyRequest.setEndDt(endDt); historyRequest.setEndDt(endDt);
if(searchType.equals("NAME")){ if(searchData != null && !searchData.isEmpty()) {
Optional<Admin> admin = adminMapper.findByEmail(searchData); if (searchType.equals("NAME")) {
if(admin.isPresent()){ Optional<Admin> admin = adminMapper.findByEmail(searchData);
if (admin.isPresent()) {
historyRequest.setUserMail(searchData);
} else {
return HistoryResponse.builder()
.resultData(HistoryResponse.ResultData.builder()
.message(ErrorCode.NOT_USER.toString())
.build())
.status(CommonCode.ERROR.getHttpStatus())
.result(CommonCode.ERROR.getResult())
.build();
}
} else {
historyRequest.setUserMail(searchData); historyRequest.setUserMail(searchData);
}else{
return HistoryResponse.builder()
.resultData(HistoryResponse.ResultData.builder()
.message(ErrorCode.NOT_USER.toString())
.build())
.status(CommonCode.ERROR.getHttpStatus())
.result(CommonCode.ERROR.getResult())
.build();
} }
}else{
historyRequest.setUserMail(searchData);
} }
List<BusinessLog> logList = historyLogService.loadHistoryData(historyRequest, BusinessLog.class); List<BusinessLog> logList = historyLogService.loadHistoryData(historyRequest, BusinessLog.class);
@@ -67,6 +69,8 @@ public class HistoryService {
return HistoryResponse.builder() return HistoryResponse.builder()
.resultData(HistoryResponse.ResultData.builder() .resultData(HistoryResponse.ResultData.builder()
.list(logList) .list(logList)
.total(logList.size())
.totalAll(logList.size())
.build()) .build())
.status(CommonCode.SUCCESS.getHttpStatus()) .status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult()) .result(CommonCode.SUCCESS.getResult())

View File

@@ -56,7 +56,7 @@ public class LogService {
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);
logGenericRequest.setStartDt(startDt); logGenericRequest.setStartDt(startDt);
logGenericRequest.setEndDt(endDt); logGenericRequest.setEndDt(endDt);
@@ -270,7 +270,7 @@ public class LogService {
excelService.generateExcelToResponse( excelService.generateExcelToResponse(
response, response,
excelList, excelList,
"비즈니스 로그 데이터", "Business Log Data",
"sheet1", "sheet1",
taskId taskId
); );
@@ -416,7 +416,7 @@ public class LogService {
excelService.generateExcelToResponse( excelService.generateExcelToResponse(
response, response,
currencyList, currencyList,
"재화 지표 데이터", "Currency Index Data",
"sheet1", "sheet1",
taskId taskId
); );
@@ -520,7 +520,7 @@ public class LogService {
excelService.generateExcelToResponse( excelService.generateExcelToResponse(
response, response,
currencyLogList, currencyLogList,
"게임 재화 로그 데이터", "Game Currency Log Data",
"sheet1", "sheet1",
taskId taskId
); );
@@ -537,6 +537,7 @@ public class LogService {
String searchType = requestParams.get("search_type"); String searchType = requestParams.get("search_type");
String searchData = requestParams.get("search_data"); String searchData = requestParams.get("search_data");
String tranId = requestParams.get("tran_id"); String tranId = requestParams.get("tran_id");
String itemId = requestParams.get("item_id");
String logAction = requestParams.get("log_action"); String logAction = requestParams.get("log_action");
String itemLargeType = requestParams.get("item_large_type"); String itemLargeType = requestParams.get("item_large_type");
String itemSmallType = requestParams.get("item_small_type"); String itemSmallType = requestParams.get("item_small_type");
@@ -550,6 +551,7 @@ public class LogService {
searchType, searchType,
searchData, searchData,
tranId, tranId,
itemId,
logAction, logAction,
itemLargeType, itemLargeType,
itemSmallType, itemSmallType,
@@ -593,6 +595,7 @@ public class LogService {
logGameRequest.getSearchType().toString(), logGameRequest.getSearchType().toString(),
logGameRequest.getSearchData(), logGameRequest.getSearchData(),
logGameRequest.getTranId(), logGameRequest.getTranId(),
logGameRequest.getItemId(),
logGameRequest.getLogAction().name(), logGameRequest.getLogAction().name(),
logGameRequest.getItemTypeLarge(), logGameRequest.getItemTypeLarge(),
logGameRequest.getItemTypeSmall(), logGameRequest.getItemTypeSmall(),
@@ -627,7 +630,7 @@ public class LogService {
excelService.generateExcelToResponse( excelService.generateExcelToResponse(
response, response,
currencyLogList, currencyLogList,
"게임 아이템 로그 데이터", "Game Item Log Data",
"sheet1", "sheet1",
taskId taskId
); );
@@ -652,6 +655,7 @@ public class LogService {
String orderBy = requestParams.get("orderby"); String orderBy = requestParams.get("orderby");
int pageNo = Integer.parseInt(requestParams.get("page_no")); int pageNo = Integer.parseInt(requestParams.get("page_no"));
int pageSize = Integer.parseInt(requestParams.get("page_size")); int pageSize = Integer.parseInt(requestParams.get("page_size"));
MongoPageResult<CurrencyItemLogInfo> result = indicatorsCurrencyService.getCurrencyItemLogData( MongoPageResult<CurrencyItemLogInfo> result = indicatorsCurrencyService.getCurrencyItemLogData(
searchType, searchType,
searchData, searchData,
@@ -667,6 +671,19 @@ public class LogService {
CurrencyItemLogInfo.class CurrencyItemLogInfo.class
); );
Set<String> tranIds = result.getItems().stream()
.map(CurrencyItemLogInfo::getTranId)
.collect(Collectors.toSet());
Map<String, String> items = indicatorsItemService.getCurrencyItemLogData(tranIds, startDt.toString().substring(0, 10), endDt.toString().substring(0, 10));
result.getItems().forEach(item -> {
String itemTranId = item.getTranId();
String itemIDs = items.getOrDefault(itemTranId, "");
item.setItemIDs(itemIDs);
});
List<CurrencyItemLogInfo> currencyItemLogList = result.getItems(); List<CurrencyItemLogInfo> currencyItemLogList = result.getItems();
int totalCount = result.getTotalCount(); int totalCount = result.getTotalCount();
@@ -708,6 +725,19 @@ public class LogService {
logGameRequest.getPageSize(), logGameRequest.getPageSize(),
CurrencyItemLogInfo.class CurrencyItemLogInfo.class
); );
Set<String> tranIds = result.getItems().stream()
.map(CurrencyItemLogInfo::getTranId)
.collect(Collectors.toSet());
Map<String, String> items = indicatorsItemService.getCurrencyItemLogData(tranIds, startDt.toString().substring(0, 10), endDt.toString().substring(0, 10));
result.getItems().forEach(item -> {
String itemTranId = item.getTranId();
String itemIDs = items.getOrDefault(itemTranId, "");
item.setItemIDs(itemIDs);
});
progressTracker.updateProgress(taskId, 20, 100, "데이터 생성완료"); progressTracker.updateProgress(taskId, 20, 100, "데이터 생성완료");
}catch(UncategorizedMongoDbException e){ }catch(UncategorizedMongoDbException e){
if (e.getMessage().contains("Sort exceeded memory limit")) { if (e.getMessage().contains("Sort exceeded memory limit")) {
@@ -731,7 +761,7 @@ public class LogService {
excelService.generateExcelToResponse( excelService.generateExcelToResponse(
response, response,
currencyLogList, currencyLogList,
"게임 재화(아이템) 로그 데이터", "Game CurrencyItem Log Data",
"sheet1", "sheet1",
taskId taskId
); );
@@ -823,7 +853,7 @@ public class LogService {
excelService.generateExcelToResponse( excelService.generateExcelToResponse(
response, response,
logList, logList,
"유저 생성 로그 데이터", "User Create Log Data",
"sheet1", "sheet1",
taskId taskId
); );
@@ -918,7 +948,7 @@ public class LogService {
excelService.generateExcelToResponse( excelService.generateExcelToResponse(
response, response,
logList, logList,
"유저 로그인 로그 데이터", "User Login Log Data",
"sheet1", "sheet1",
taskId taskId
); );
@@ -1009,7 +1039,7 @@ public class LogService {
excelService.generateExcelToResponse( excelService.generateExcelToResponse(
response, response,
logList, logList,
"유저 스냅샷 로그 데이터", "User Snapshot Log Data",
"sheet1", "sheet1",
taskId taskId
); );

View File

@@ -4,9 +4,7 @@ import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
import com.caliverse.admin.domain.entity.*; import com.caliverse.admin.domain.entity.*;
import com.caliverse.admin.domain.entity.excel.ExcelBusinessLog; import com.caliverse.admin.domain.entity.excel.ExcelBusinessLog;
import com.caliverse.admin.domain.entity.log.GenericLog; import com.caliverse.admin.domain.entity.log.GenericLog;
import com.caliverse.admin.domain.entity.metadata.MetaBattleConfigData; import com.caliverse.admin.domain.entity.metadata.*;
import com.caliverse.admin.domain.entity.metadata.MetaBrandData;
import com.caliverse.admin.domain.entity.metadata.MetaItemData;
import com.caliverse.admin.domain.request.LogGenericRequest; import com.caliverse.admin.domain.request.LogGenericRequest;
import com.caliverse.admin.domain.response.BattleEventResponse; import com.caliverse.admin.domain.response.BattleEventResponse;
import com.caliverse.admin.domain.response.DictionaryResponse; import com.caliverse.admin.domain.response.DictionaryResponse;
@@ -37,6 +35,7 @@ public class MetaDataService {
private final ExcelService excelService; private final ExcelService excelService;
private final ExcelProgressTracker progressTracker; private final ExcelProgressTracker progressTracker;
//브랜드 데이터
public DictionaryResponse getBrandList(){ public DictionaryResponse getBrandList(){
List<MetaBrandData> list = metaDataHandler.getMetaBrandListData(); List<MetaBrandData> list = metaDataHandler.getMetaBrandListData();
@@ -57,6 +56,81 @@ public class MetaDataService {
.build(); .build();
} }
//랭킹 데이터
public DictionaryResponse getRankingList(){
List<MetaRankingData> list = metaDataHandler.getMetaRankingListData();
return DictionaryResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.resultData(DictionaryResponse.ResultData.builder()
.rankingList(list)
.build()
)
.build();
}
//전투시스템 설정 데이터
public DictionaryResponse getBattleConfigList(){
List<MetaBattleConfigData> list = metaDataHandler.getMetaBattleConfigsListData();
return DictionaryResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.resultData(DictionaryResponse.ResultData.builder()
.battleConfigList(list)
.build()
)
.build();
}
//전투시스템 보상 데이터
public DictionaryResponse getBattleRewardList(){
List<MetaBattleRewardData> list = metaDataHandler.getMetaBattleRewardsListData();
return DictionaryResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.resultData(DictionaryResponse.ResultData.builder()
.battleRewardList(list)
.build()
)
.build();
}
//전투시스템 게임모드 데이터
public DictionaryResponse getGameModeList(){
List<MetaGameModeData> list = metaDataHandler.getMetaGameModeListData();
return DictionaryResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.resultData(DictionaryResponse.ResultData.builder()
.gameModeList(list)
.build()
)
.build();
}
//이벤트 액션 데이터
public DictionaryResponse getEventActionList(){
List<MetaEventActionScoreData> list = metaDataHandler.getMetaEventActionScoreListData();
return DictionaryResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.resultData(DictionaryResponse.ResultData.builder()
.eventActionList(list)
.build()
)
.build();
}
//아이템 백과사전 //아이템 백과사전
@RequestLog @RequestLog
public DictionaryResponse getItemDictList(@RequestParam Map<String, String> requestParam){ public DictionaryResponse getItemDictList(@RequestParam Map<String, String> requestParam){

View File

@@ -85,7 +85,7 @@ public class S3Service {
businessLogService.logS3( businessLogService.logS3(
LogStatus.SUCCESS, LogStatus.SUCCESS,
"", "",
CommonUtils.getAdmin().getId().toString(), CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp(), CommonUtils.getClientIp(),
bucketName, bucketName,
objectKey, objectKey,

View File

@@ -11,6 +11,7 @@ import com.caliverse.admin.domain.RabbitMq.MessageHandlerService;
import com.caliverse.admin.domain.entity.EReqType; import com.caliverse.admin.domain.entity.EReqType;
import com.caliverse.admin.domain.entity.FriendRequest; import com.caliverse.admin.domain.entity.FriendRequest;
import com.caliverse.admin.domain.entity.SEARCHTYPE; import com.caliverse.admin.domain.entity.SEARCHTYPE;
import com.caliverse.admin.domain.entity.common.SearchUserType;
import com.caliverse.admin.domain.entity.log.LogAction; import com.caliverse.admin.domain.entity.log.LogAction;
import com.caliverse.admin.domain.request.MailRequest; import com.caliverse.admin.domain.request.MailRequest;
import com.caliverse.admin.dynamodb.domain.atrrib.AccountBaseAttrib; import com.caliverse.admin.dynamodb.domain.atrrib.AccountBaseAttrib;
@@ -141,23 +142,38 @@ public class UsersService {
String searchKey = requestParam.get("search_key").toString(); String searchKey = requestParam.get("search_key").toString();
Map<String,String> resultMap = new HashMap<>(); Map<String,String> resultMap = new HashMap<>();
if(searchType.equals(SEARCHTYPE.NAME.name())){ if(searchType.equals(SEARCHTYPE.NAME.name()) || searchType.equals(SearchUserType.NICKNAME.name())){
String name_guid = dynamodbUserService.getNameByGuid(searchKey.toLowerCase()); String name_guid = dynamodbUserService.getNameByGuid(searchKey.toLowerCase());
if(!name_guid.isEmpty()){ if(!name_guid.isEmpty()){
resultMap.put("guid", name_guid); //nickname은 무조건 소문자 resultMap.put("guid", name_guid); //nickname은 무조건 소문자
resultMap.put("nickname", searchKey); resultMap.put("nickname", searchKey);
}else{
return UsersResponse.builder()
.status(CommonCode.ERROR.getHttpStatus())
.result(ErrorCode.NOT_USER.name())
.build();
} }
}else if(searchType.equals(SEARCHTYPE.GUID.name())){ }else if(searchType.equals(SEARCHTYPE.GUID.name())){
String guid_name = dynamodbUserService.getGuidByName(searchKey); String guid_name = dynamodbUserService.getGuidByName(searchKey);
if(!guid_name.isEmpty()){ if(!guid_name.isEmpty()){
resultMap.put("guid", searchKey); resultMap.put("guid", searchKey);
resultMap.put("nickname", guid_name); resultMap.put("nickname", guid_name);
}else{
return UsersResponse.builder()
.status(CommonCode.ERROR.getHttpStatus())
.result(ErrorCode.NOT_USER.name())
.build();
} }
}else if(searchType.equals(SEARCHTYPE.ACCOUNT.name())){ }else if(searchType.equals(SEARCHTYPE.ACCOUNT.name())){
String account_guid = dynamodbUserService.getAccountIdByGuid(searchKey); String account_guid = dynamodbUserService.getAccountIdByGuid(searchKey);
if(!account_guid.isEmpty()){ if(!account_guid.isEmpty()){
resultMap.put("guid", account_guid); resultMap.put("guid", account_guid);
resultMap.put("nickname", dynamodbUserService.getAccountIdByName(searchKey)); resultMap.put("nickname", dynamodbUserService.getAccountIdByName(searchKey));
}else{
return UsersResponse.builder()
.status(CommonCode.ERROR.getHttpStatus())
.result(ErrorCode.NOT_USER.name())
.build();
} }
} }