메타데이터 호출 추가
This commit is contained in:
@@ -45,6 +45,8 @@ public class MetaDataFileLoader {
|
|||||||
private final List<MetaBrandData> brands;
|
private final List<MetaBrandData> brands;
|
||||||
private final List<MetaCraftingData> craftings;
|
private final List<MetaCraftingData> craftings;
|
||||||
private final List<MetaCurrencyData> currencies;
|
private final List<MetaCurrencyData> currencies;
|
||||||
|
private final List<MetaRankingData> rankings;
|
||||||
|
private final List<MetaEventActionScoreData> eventActionScoreDatas;
|
||||||
|
|
||||||
public MetaDataFileLoader(JsonFileReader jsonFileReader) {
|
public MetaDataFileLoader(JsonFileReader jsonFileReader) {
|
||||||
this.jsonFileReader = jsonFileReader;
|
this.jsonFileReader = jsonFileReader;
|
||||||
@@ -70,6 +72,8 @@ public class MetaDataFileLoader {
|
|||||||
this.brands = new ArrayList<>();
|
this.brands = new ArrayList<>();
|
||||||
this.craftings = new ArrayList<>();
|
this.craftings = new ArrayList<>();
|
||||||
this.currencies = new ArrayList<>();
|
this.currencies = new ArrayList<>();
|
||||||
|
this.rankings = new ArrayList<>();
|
||||||
|
this.eventActionScoreDatas = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
@@ -112,6 +116,8 @@ public class MetaDataFileLoader {
|
|||||||
loadWebLinkLocalize();
|
loadWebLinkLocalize();
|
||||||
loadCrafting();
|
loadCrafting();
|
||||||
loadCurrency();
|
loadCurrency();
|
||||||
|
loadRanking();
|
||||||
|
loadEventActionScore();
|
||||||
}catch(MetaDataException e){
|
}catch(MetaDataException e){
|
||||||
log.error("Failed to initialize metadata", e);
|
log.error("Failed to initialize metadata", e);
|
||||||
throw e;
|
throw e;
|
||||||
@@ -253,6 +259,14 @@ public class MetaDataFileLoader {
|
|||||||
return currencies.stream().filter(data -> data.getId() == id).findFirst();
|
return currencies.stream().filter(data -> data.getId() == id).findFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Optional<MetaRankingData> getMetaRanking(int id) {
|
||||||
|
if(id == 0) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
return rankings.stream().filter(data -> data.getId() == id).findFirst();
|
||||||
|
}
|
||||||
|
|
||||||
//////////////// 리스트 조회
|
//////////////// 리스트 조회
|
||||||
public List<MetaLandData> getMetaLands() {
|
public List<MetaLandData> getMetaLands() {
|
||||||
return new ArrayList<>(lands.values());
|
return new ArrayList<>(lands.values());
|
||||||
@@ -292,6 +306,19 @@ public class MetaDataFileLoader {
|
|||||||
return brands;
|
return brands;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<MetaRankingData> getMetaRanking() {
|
||||||
|
return rankings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MetaEventActionScoreData> getMetaEventActionScore() {
|
||||||
|
return eventActionScoreDatas.stream()
|
||||||
|
.collect(Collectors.groupingBy(MetaEventActionScoreData::getGroupId)) // groupId로 그룹화
|
||||||
|
.values().stream()
|
||||||
|
.map(group -> group.get(0))
|
||||||
|
.sorted(Comparator.comparing(MetaEventActionScoreData::getGroupId)) // groupId 기준으로 정렬
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1045,4 +1072,60 @@ public class MetaDataFileLoader {
|
|||||||
|
|
||||||
log.info("loadCurrency {} Load Complete", EMetaData.CURRENCY_DATA.getFileName());
|
log.info("loadCurrency {} Load Complete", EMetaData.CURRENCY_DATA.getFileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 랜덤박스 데이터 로드
|
||||||
|
public void loadRanking(){
|
||||||
|
List<Map<String, Object>> metaList = jsonFileReader.readJsonFile(EMetaData.RANKING_DATA.getFileName());
|
||||||
|
if(metaList == null || metaList.isEmpty()) {
|
||||||
|
log.warn("Ranking data is empty or file not found: {}", EMetaData.RANKING_DATA.getFileName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
metaList.forEach(meta -> {
|
||||||
|
MetaRankingData item = new MetaRankingData();
|
||||||
|
|
||||||
|
item.setId((Integer) meta.get("RankingId"));
|
||||||
|
item.setDesc((String) meta.get("desc_"));
|
||||||
|
item.setRankingType((String) meta.get("RankingType"));
|
||||||
|
item.setTypeId((Integer) meta.get("TypeId"));
|
||||||
|
item.setTypeValue((Integer) meta.get("TypeValue"));
|
||||||
|
item.setEventType((String) meta.get("EventType"));
|
||||||
|
item.setSortType((String) meta.get("SortType"));
|
||||||
|
item.setScoreType((String) meta.get("ScoreType"));
|
||||||
|
item.setScoreModifyType((String) meta.get("ScoreModifyType"));
|
||||||
|
|
||||||
|
rankings.add(item);
|
||||||
|
});
|
||||||
|
|
||||||
|
log.info("loadRanking {} Load Complete", EMetaData.RANKING_DATA.getFileName());
|
||||||
|
}
|
||||||
|
|
||||||
|
//이벤트 스코어
|
||||||
|
public void loadEventActionScore(){
|
||||||
|
List<Map<String, Object>> metaList = jsonFileReader.readJsonFile(EMetaData.EVENT_ACTION_SCORE_DATA.getFileName());
|
||||||
|
if(metaList == null || metaList.isEmpty()) {
|
||||||
|
log.warn("Event Action Score data is empty or file not found: {}", EMetaData.EVENT_ACTION_SCORE_DATA.getFileName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
metaList.forEach(meta -> {
|
||||||
|
MetaEventActionScoreData item = new MetaEventActionScoreData();
|
||||||
|
|
||||||
|
item.setId((Integer) meta.get("Index"));
|
||||||
|
item.setDescription((String) meta.get("desc_"));
|
||||||
|
item.setGroupId((Integer) meta.get("GroupId"));
|
||||||
|
item.setEventTarget((String) meta.get("EventTarget"));
|
||||||
|
item.setEvent((String) meta.get("Event"));
|
||||||
|
item.setEventCondition1((String) meta.get("EventCondition1"));
|
||||||
|
item.setEventCondition2((String) meta.get("EventCondition2"));
|
||||||
|
item.setEventCondition3((String) meta.get("EventCondition3"));
|
||||||
|
item.setScore((Integer) meta.get("Score"));
|
||||||
|
item.setScoreModifyType((String) meta.get("ScoreModifyType"));
|
||||||
|
item.setActive((Boolean) meta.get("Active"));
|
||||||
|
|
||||||
|
eventActionScoreDatas.add(item);
|
||||||
|
});
|
||||||
|
|
||||||
|
log.info("loadEventActionScore {} Load Complete", EMetaData.EVENT_ACTION_SCORE_DATA.getFileName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,6 +149,12 @@ public class MetaDataHandler {
|
|||||||
public List<MetaBrandData> getMetaBrandListData() {
|
public List<MetaBrandData> getMetaBrandListData() {
|
||||||
return metadataFileLoader.getMetaBrand();
|
return metadataFileLoader.getMetaBrand();
|
||||||
}
|
}
|
||||||
|
public List<MetaRankingData> getMetaRankingListData() {
|
||||||
|
return metadataFileLoader.getMetaRanking();
|
||||||
|
}
|
||||||
|
public List<MetaEventActionScoreData> getMetaEventActionScoreListData() {
|
||||||
|
return metadataFileLoader.getMetaEventActionScore();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,6 @@ public enum CLOTHSMALLTYPE {
|
|||||||
NECKLACE,
|
NECKLACE,
|
||||||
SHOES,
|
SHOES,
|
||||||
SOCKS,
|
SOCKS,
|
||||||
ANKLET,
|
ANKLET
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ public enum EMetaData {
|
|||||||
ATTRIBUTE_RANDOM_GROUP_DATA("AttributeRandomGroup", true),
|
ATTRIBUTE_RANDOM_GROUP_DATA("AttributeRandomGroup", true),
|
||||||
CRAFTING_DATA("Crafting", true),
|
CRAFTING_DATA("Crafting", true),
|
||||||
CURRENCY_DATA("Currency", true),
|
CURRENCY_DATA("Currency", true),
|
||||||
GACHA_DATA("Gacha", true)
|
GACHA_DATA("Gacha", true),
|
||||||
|
RANKING_DATA("Ranking", true),
|
||||||
|
EVENT_ACTION_SCORE_DATA("EventActionScore", true)
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.caliverse.admin.domain.entity.metadata;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MetaEventActionScoreData {
|
||||||
|
private int id;
|
||||||
|
private String description;
|
||||||
|
private int groupId;
|
||||||
|
private String eventTarget;
|
||||||
|
private String event;
|
||||||
|
private String eventCondition1;
|
||||||
|
private String eventCondition2;
|
||||||
|
private String eventCondition3;
|
||||||
|
private int score;
|
||||||
|
private String scoreModifyType;
|
||||||
|
private boolean active;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.caliverse.admin.domain.entity.metadata;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MetaRankingData {
|
||||||
|
private int id;
|
||||||
|
private String desc;
|
||||||
|
private String rankingType;
|
||||||
|
private Integer typeId;
|
||||||
|
private Integer typeValue;
|
||||||
|
private String eventType;
|
||||||
|
private String sortType;
|
||||||
|
private String scoreType;
|
||||||
|
private String scoreModifyType;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user