백과사전 api 생성
아이템 백과사전 조회 API 생성 메타데이터 로드 추가
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package com.caliverse.admin.domain.api;
|
||||
|
||||
import com.caliverse.admin.domain.response.DictionaryResponse;
|
||||
import com.caliverse.admin.domain.service.MetaDataService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Tag(name = "백과사전", description = "백과사전 api")
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/v1/dictionary")
|
||||
public class DictionaryController {
|
||||
private final MetaDataService metaDataService;
|
||||
|
||||
@GetMapping("/brand/list")
|
||||
public ResponseEntity<DictionaryResponse> brandList(){
|
||||
return ResponseEntity.ok().body( metaDataService.getBrandList());
|
||||
}
|
||||
|
||||
@GetMapping("/item/list")
|
||||
public ResponseEntity<DictionaryResponse> itemList(
|
||||
@RequestParam Map<String, String> requestParams){
|
||||
return ResponseEntity.ok().body( metaDataService.getItemDictList(requestParams));
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.caliverse.admin.domain.entity.metaEnum.EJoinInProgressType;
|
||||
import com.caliverse.admin.domain.entity.metaEnum.ETeamAssignmentType;
|
||||
import com.caliverse.admin.domain.entity.metadata.*;
|
||||
import com.caliverse.admin.global.common.exception.MetaDataException;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
@@ -14,6 +16,9 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import com.caliverse.admin.domain.entity.EMetaData;
|
||||
|
||||
import static com.caliverse.admin.global.common.utils.DataHelper.parseDateTime;
|
||||
import static com.caliverse.admin.global.common.utils.DataHelper.parseFloat;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class MetaDataFileLoader {
|
||||
@@ -31,6 +36,15 @@ public class MetaDataFileLoader {
|
||||
private final Map<Integer, MetaBattleConfigData> battleConfigs;
|
||||
private final Map<Integer, MetaBattleRewardData> battleRewards;
|
||||
private final Map<String, MetaSystemMailData> systemMails;
|
||||
private final Map<Integer, MetaGameModeMatchData> gameModeMatches;
|
||||
private final List<MetaBuffData> buffs;
|
||||
private final List<MetaGachaData> gachas;
|
||||
private final List<MetaItemSetData> itemSets;
|
||||
private final List<MetaAttributeRandomGroupData> attributeRandomGroups;
|
||||
private final List<MetaWebLinkData> webLinks;
|
||||
private final List<MetaBrandData> brands;
|
||||
private final List<MetaCraftingData> craftings;
|
||||
private final List<MetaCurrencyData> currencies;
|
||||
|
||||
public MetaDataFileLoader(JsonFileReader jsonFileReader) {
|
||||
this.jsonFileReader = jsonFileReader;
|
||||
@@ -47,6 +61,15 @@ public class MetaDataFileLoader {
|
||||
this.battleRewards = new ConcurrentHashMap<>();
|
||||
this.systemMails = new ConcurrentHashMap<>();
|
||||
this.gameFFAConfigs = new ConcurrentHashMap<>();
|
||||
this.gameModeMatches = new ConcurrentHashMap<>();
|
||||
this.buffs = new ArrayList<>();
|
||||
this.gachas = new ArrayList<>();
|
||||
this.itemSets = new ArrayList<>();
|
||||
this.attributeRandomGroups = new ArrayList<>();
|
||||
this.webLinks = new ArrayList<>();
|
||||
this.brands = new ArrayList<>();
|
||||
this.craftings = new ArrayList<>();
|
||||
this.currencies = new ArrayList<>();
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
@@ -80,6 +103,15 @@ public class MetaDataFileLoader {
|
||||
loadSystemMail();
|
||||
loadGameMode();
|
||||
loadGameModeFFAConfig();
|
||||
loadGameModeMatch();
|
||||
loadBuff();
|
||||
loadBrand();
|
||||
loadAttributeRandomGroup();
|
||||
loadGacha();
|
||||
loadItemSet();
|
||||
loadWebLinkLocalize();
|
||||
loadCrafting();
|
||||
loadCurrency();
|
||||
}catch(MetaDataException e){
|
||||
log.error("Failed to initialize metadata", e);
|
||||
throw e;
|
||||
@@ -99,6 +131,10 @@ public class MetaDataFileLoader {
|
||||
return Optional.ofNullable(items.get(itemId));
|
||||
}
|
||||
|
||||
public List<MetaItemData> getMetaItems() {
|
||||
return new ArrayList<>(items.values());
|
||||
}
|
||||
|
||||
//의상 타입 가져오기
|
||||
public Optional<MetaClothTypeData> getMetaClothType(int id) {
|
||||
if(id == 0) return Optional.empty();
|
||||
@@ -145,6 +181,79 @@ public class MetaDataFileLoader {
|
||||
return Optional.ofNullable(lands.get(id));
|
||||
}
|
||||
|
||||
public Optional<MetaGachaData> getMetaGacha(int id) {
|
||||
if(id == 0){
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
return gachas.stream().filter(data -> data.getId() == id).findFirst();
|
||||
}
|
||||
|
||||
public Optional<MetaItemSetData> getMetaItemSet(int id) {
|
||||
if(id == 0){
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
return itemSets.stream().filter(data -> data.getId() == id).findFirst();
|
||||
}
|
||||
|
||||
public Optional<MetaCraftingData> getMetaCrafting(int id) {
|
||||
if(id == 0){
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
return craftings.stream().filter(data -> data.getId() == id).findFirst();
|
||||
}
|
||||
|
||||
public Optional<MetaAttributeRandomGroupData> getMetaAttributeRandomGroup(String groupId) {
|
||||
if(groupId.isEmpty()){
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
return attributeRandomGroups.stream().filter(data -> data.getGroupId().equals(groupId)).findFirst();
|
||||
}
|
||||
|
||||
public Optional<MetaAttributeRandomGroupData> getMetaAttributeRandomGroup(int id) {
|
||||
if(id == 0){
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
return attributeRandomGroups.stream().filter(data -> data.getKey() == id).findFirst();
|
||||
}
|
||||
|
||||
public Optional<MetaBuffData> getMetaBuff(int id) {
|
||||
if(id == 0){
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
return buffs.stream().filter(data -> data.getBuffId() == id).findFirst();
|
||||
}
|
||||
|
||||
public Optional<MetaBrandData> getMetaBrand(int id) {
|
||||
if(id == 0){
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
return brands.stream().filter(data -> data.getId() == id).findFirst();
|
||||
}
|
||||
|
||||
public Optional<MetaWebLinkData> getMetaWebLinkLocalize(String key) {
|
||||
if(key.isEmpty()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
return webLinks.stream().filter(data -> data.getKey().equals(key)).findFirst();
|
||||
}
|
||||
|
||||
public Optional<MetaCurrencyData> getMetaCurrency(int id) {
|
||||
if(id == 0) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
return currencies.stream().filter(data -> data.getId() == id).findFirst();
|
||||
}
|
||||
|
||||
//////////////// 리스트 조회
|
||||
public List<MetaLandData> getMetaLands() {
|
||||
return new ArrayList<>(lands.values());
|
||||
}
|
||||
@@ -157,6 +266,10 @@ public class MetaDataFileLoader {
|
||||
return new ArrayList<>(gameFFAConfigs.values());
|
||||
}
|
||||
|
||||
public List<MetaGameModeMatchData> getMetaGameModeMatchs() {
|
||||
return new ArrayList<>(gameModeMatches.values());
|
||||
}
|
||||
|
||||
// 추후 없어질것
|
||||
public List<MetaBattleConfigData> getMetaBattleConfigs() {
|
||||
return new ArrayList<>(battleConfigs.values());
|
||||
@@ -175,7 +288,9 @@ public class MetaDataFileLoader {
|
||||
return new ArrayList<>(systemMails.values());
|
||||
}
|
||||
|
||||
|
||||
public List<MetaBrandData> getMetaBrand() {
|
||||
return brands;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -213,10 +328,89 @@ public class MetaDataFileLoader {
|
||||
|
||||
metaList.forEach(meta -> {
|
||||
MetaItemData item = new MetaItemData();
|
||||
item.setItemId((Integer)meta.get("item_id"));
|
||||
item.setName((String)meta.get("name"));
|
||||
item.setLargeType((String)meta.get("type_large"));
|
||||
item.setGender((String)meta.get("gender"));
|
||||
|
||||
// 기본 정보
|
||||
item.setItemId((Integer) meta.get("item_id"));
|
||||
item.setName((String) meta.get("name"));
|
||||
item.setDesc((String) meta.get("desc"));
|
||||
item.setGender((String) meta.get("gender"));
|
||||
|
||||
// 이미지 정보
|
||||
item.setImage3dDp((String) meta.get("image_3D_DP"));
|
||||
item.setImage3dDpOpacity((String) meta.get("image_3D_DP_opacity"));
|
||||
item.setImage3d((String) meta.get("image_3D"));
|
||||
item.setImage3dOpacity((String) meta.get("image_3D_opacity"));
|
||||
item.setImage2d((String) meta.get("image_2D"));
|
||||
|
||||
// 출시 정보
|
||||
item.setReleaseDate(parseDateTime(meta.get("release_date")));
|
||||
item.setBrand((Integer) meta.get("Brand"));
|
||||
item.setIsNft((Boolean) meta.get("isNFT"));
|
||||
|
||||
// 타입 정보
|
||||
item.setLargeType((String) meta.get("type_large"));
|
||||
item.setSmallType((String) meta.get("type_small"));
|
||||
item.setRegisterId((Integer) meta.get("register_id"));
|
||||
|
||||
// 수량 정보
|
||||
item.setMaxCount((Integer) meta.get("max_count"));
|
||||
item.setStackMaxCount((Integer) meta.get("stack_max_count"));
|
||||
|
||||
// 만료 정보
|
||||
item.setExpireType((String) meta.get("expire_type"));
|
||||
item.setExpireFixedTermStart(parseDateTime(meta.get("expire_fixedTerm_start")));
|
||||
item.setExpireFixedTermEnd(parseDateTime(meta.get("expire_fixedTerm_end")));
|
||||
item.setExpireTimeSec((Integer) meta.get("expire_time_sec"));
|
||||
|
||||
// 거래 정보
|
||||
item.setIsUserTradable((Boolean) meta.get("is_user_tradable"));
|
||||
item.setIsSystemTradable((Boolean) meta.get("is_system_tradable"));
|
||||
item.setSellPriceType((String) meta.get("sell_price_type"));
|
||||
item.setSellId((Integer) meta.get("sell_id"));
|
||||
item.setSellPrice((Integer) meta.get("sell_price"));
|
||||
|
||||
// UI 관련
|
||||
item.setOrder((Integer) meta.get("order"));
|
||||
item.setIsThrowable((Boolean) meta.get("is_throwable"));
|
||||
|
||||
// 액션 정보
|
||||
item.setActionType((String) meta.get("ActionType"));
|
||||
item.setActionValue((Integer) meta.get("ActionValue"));
|
||||
|
||||
// 디테일 뷰 정보
|
||||
item.setDetailOffset(parseFloat(meta.get("DetailOffset")));
|
||||
item.setDetailScale(parseFloat(meta.get("DetailScale")));
|
||||
item.setGuidePopup((Integer) meta.get("GuidePopup"));
|
||||
item.setDetailRoll(parseFloat(meta.get("DetailRoll")));
|
||||
item.setDetailPitch(parseFloat(meta.get("DetailPitch")));
|
||||
item.setDetailCameraRight(parseFloat(meta.get("DetailCameraRight")));
|
||||
item.setDetailCameraHeight(parseFloat(meta.get("DetailCameraHeight")));
|
||||
item.setDetailCameraAngle(parseFloat(meta.get("DetailCameraAngle")));
|
||||
|
||||
// 속성 정보
|
||||
item.setRarity((String) meta.get("Rarity"));
|
||||
item.setDefaultAttribute((String) meta.get("DefaultAttribute"));
|
||||
item.setAttributeRandomGroupId((String) meta.get("AttributeRandomGroupID"));
|
||||
item.setItemSetId((Integer) meta.get("ItemSetID"));
|
||||
item.setGachaGroupId((Integer) meta.get("GachaGroupId"));
|
||||
|
||||
// 구매 정보
|
||||
item.setBuyPriceType((String) meta.get("Buy_Price_Type"));
|
||||
item.setBuyId((Integer) meta.get("Buy_id"));
|
||||
item.setBuyPrice((Integer) meta.get("Buy_price"));
|
||||
item.setBuffId((Integer) meta.get("buff_id"));
|
||||
item.setProductLink((String) meta.get("ProductLink"));
|
||||
item.setIsCartNBuy((Boolean) meta.get("is_CartNBuy"));
|
||||
item.setBuyDiscountRate((Integer) meta.get("Buy_Discount_Rate"));
|
||||
|
||||
// 기타
|
||||
item.setPropSmallType((String) meta.get("PropSmallType"));
|
||||
item.setUgqAction((String) meta.get("UGQAction"));
|
||||
item.setLinkedLand((Integer) meta.get("LinkedLand"));
|
||||
item.setIsUiOnly((Boolean) meta.get("IsUiOnly"));
|
||||
item.setBeaconShopGoldFee((Integer) meta.get("BeaconShopGoldFee"));
|
||||
item.setIsBeaconShop((Boolean) meta.get("is_BeaconShop"));
|
||||
|
||||
items.put(item.getItemId(), item);
|
||||
});
|
||||
|
||||
@@ -387,6 +581,34 @@ public class MetaDataFileLoader {
|
||||
log.info("loadGameMode {} Load Complete", EMetaData.GAME_MODE_DATA.getFileName());
|
||||
}
|
||||
|
||||
// 게임 모드 매칭 데이터 로드
|
||||
public void loadGameModeMatch(){
|
||||
List<Map<String, Object>> metaList = jsonFileReader.readJsonFile(EMetaData.GAME_MODE_MATCH_DATA.getFileName());
|
||||
if(metaList == null || metaList.isEmpty()) {
|
||||
log.warn("Game Mode Match data is empty or file not found: {}", EMetaData.GAME_MODE_MATCH_DATA.getFileName());
|
||||
return;
|
||||
}
|
||||
|
||||
metaList.forEach(meta -> {
|
||||
MetaGameModeMatchData item = new MetaGameModeMatchData();
|
||||
item.setId((Integer)meta.get("GameModeMatchID"));
|
||||
item.setDesc((String)meta.get("GameModeMatchDescription"));
|
||||
item.setMmrCheck((Boolean)meta.get("MmrCheck"));
|
||||
item.setPartyMatchPlayerCountAbleArray((List<Integer>) meta.get("PartyMatchPlayerCountAbleArray"));
|
||||
item.setMatchWaitTimeSec((Integer)meta.get("MatchWaitTimeSec"));
|
||||
item.setGameModeMmrID((Integer)meta.get("GameModeMmrID"));
|
||||
item.setMatchRetryCount((Integer)meta.get("MatchRetryCount"));
|
||||
item.setMmrExpansionPhase((Integer)meta.get("MmrExpansionPhase"));
|
||||
item.setTeamAssignment(ETeamAssignmentType.valueOf((String)meta.get("TeamAssignment")));
|
||||
item.setJoinInProgress(EJoinInProgressType.valueOf((String)meta.get("JoinInProgress")));
|
||||
item.setJoinInMaxTimeSec((Integer)meta.get("JoinInMaxTimeSec"));
|
||||
item.setEntranceClosingTime((Integer)meta.get("EntranceClosingTime"));
|
||||
gameModeMatches.put((Integer)meta.get("GameModeMatchID"), item);
|
||||
});
|
||||
|
||||
log.info("loadGameModeMatch {} Load Complete", EMetaData.GAME_MODE_DATA.getFileName());
|
||||
}
|
||||
|
||||
// 게임 TPS_FFA 설정 데이터 로드
|
||||
public void loadGameModeFFAConfig(){
|
||||
List<Map<String, Object>> metaList = jsonFileReader.readJsonFile(EMetaData.GAME_MODE_FFA_DATA.getFileName());
|
||||
@@ -501,4 +723,326 @@ public class MetaDataFileLoader {
|
||||
|
||||
log.info("loadSystemMail {} Load Complete", EMetaData.SYSTEM_MAIL_DATA.getFileName());
|
||||
}
|
||||
|
||||
// 웹링크 데이터 로드
|
||||
public void loadWebLinkLocalize(){
|
||||
List<Map<String, Object>> metaList = jsonFileReader.readJsonFile(EMetaData.WEB_LINK_DATA.getFileName());
|
||||
if(metaList == null || metaList.isEmpty()) {
|
||||
log.warn("Web Link Localize data is empty or file not found: {}", EMetaData.WEB_LINK_DATA.getFileName());
|
||||
return;
|
||||
}
|
||||
|
||||
metaList.forEach(meta -> {
|
||||
MetaWebLinkData item = new MetaWebLinkData();
|
||||
|
||||
item.setKey((String) meta.get("Key"));
|
||||
item.setKo((String) meta.get("Ko"));
|
||||
item.setEn((String) meta.get("En"));
|
||||
item.setJa((String) meta.get("Ja"));
|
||||
|
||||
webLinks.add(item);
|
||||
});
|
||||
|
||||
log.info("loadWebLinkLocalize {} Load Complete", EMetaData.WEB_LINK_DATA.getFileName());
|
||||
}
|
||||
|
||||
// 브랜드 데이터 로드
|
||||
public void loadBrand(){
|
||||
List<Map<String, Object>> metaList = jsonFileReader.readJsonFile(EMetaData.BRAND_DATA.getFileName());
|
||||
if(metaList == null || metaList.isEmpty()) {
|
||||
log.warn("Brand data is empty or file not found: {}", EMetaData.BRAND_DATA.getFileName());
|
||||
return;
|
||||
}
|
||||
|
||||
metaList.forEach(meta -> {
|
||||
MetaBrandData item = new MetaBrandData();
|
||||
|
||||
item.setId((Integer) meta.get("ID"));
|
||||
item.setBrandName((String) meta.get("BrandName"));
|
||||
item.setLogoLeft((String) meta.get("LogoLeft"));
|
||||
item.setLogoCenter((String) meta.get("LogoCenter"));
|
||||
item.setLogoRight((String) meta.get("LogoRight"));
|
||||
item.setLogoText((String) meta.get("LogoText"));
|
||||
|
||||
brands.add(item);
|
||||
});
|
||||
|
||||
log.info("loadBrand {} Load Complete", EMetaData.BRAND_DATA.getFileName());
|
||||
}
|
||||
|
||||
// 버프 데이터 로드
|
||||
public void loadBuff(){
|
||||
List<Map<String, Object>> metaList = jsonFileReader.readJsonFile(EMetaData.BUFF_DATA.getFileName());
|
||||
if(metaList == null || metaList.isEmpty()) {
|
||||
log.warn("Buff data is empty or file not found: {}", EMetaData.BUFF_DATA.getFileName());
|
||||
return;
|
||||
}
|
||||
|
||||
metaList.forEach(meta -> {
|
||||
MetaBuffData item = new MetaBuffData();
|
||||
|
||||
item.setBuffId((Integer) meta.get("buff_id"));
|
||||
item.setBuffName((String) meta.get("buff_name"));
|
||||
item.setBuffDescription((String) meta.get("buff_description"));
|
||||
item.setBuffCategory((String) meta.get("buff_category"));
|
||||
item.setBuffChannel((Integer) meta.get("buff_channel"));
|
||||
item.setBuffPriority((Integer) meta.get("buff_priority"));
|
||||
item.setActionBuffId((Integer) meta.get("action_buff_id"));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Map<String, Object>> traitsData = (List<Map<String, Object>>) meta.get("Traits");
|
||||
if (traitsData != null) {
|
||||
List<MetaBuffData.Trait> traits = new ArrayList<>();
|
||||
traitsData.forEach(traitMap -> {
|
||||
MetaBuffData.Trait trait = new MetaBuffData.Trait();
|
||||
trait.setAttribute((String) traitMap.get("Attribute"));
|
||||
trait.setValue((Integer) traitMap.get("Value"));
|
||||
trait.setOperation((String) traitMap.get("Operation"));
|
||||
traits.add(trait);
|
||||
});
|
||||
item.setTraits(traits);
|
||||
}
|
||||
|
||||
// 프롭 관련
|
||||
item.setPropmeshName((String) meta.get("propmesh_name"));
|
||||
item.setPropmeshNameOpacity((String) meta.get("propmesh_name_opacity"));
|
||||
item.setUseRequired((Integer) meta.get("use_required"));
|
||||
|
||||
// 가이드 관련
|
||||
item.setInactiveRange((Integer) meta.get("InactiveRange"));
|
||||
item.setGuideHeight((Integer) meta.get("GuideHeight"));
|
||||
item.setGuideOffset((Integer) meta.get("GuideOffset"));
|
||||
Number guideScaleValue = (Number) meta.get("GuideScale");
|
||||
item.setGuideScale(guideScaleValue.doubleValue());
|
||||
item.setPropEffect((String) meta.get("prop_effect"));
|
||||
|
||||
// 시작/종료 조건
|
||||
item.setBuffStartCondition((String) meta.get("buff_start_condition"));
|
||||
item.setBuffStartConditionValue((Integer) meta.get("buff_start_condition_value"));
|
||||
item.setBuffEndCondition((String) meta.get("buff_end_condition"));
|
||||
item.setBuffEndConditionValue((Integer) meta.get("buff_end_condition_value"));
|
||||
item.setDurationTime((Integer) meta.get("duration_time"));
|
||||
|
||||
// 실행 관련
|
||||
item.setBuffEndExecutionType((String) meta.get("buff_end_execution_type"));
|
||||
item.setBuffEndExecutionValue((Integer) meta.get("buff_end_execution_value"));
|
||||
|
||||
// 어태치 관련
|
||||
item.setAttachEffectBp((String) meta.get("attach_effect_bp"));
|
||||
item.setAttachAvatarSocket((String) meta.get("attach_avatar_socket"));
|
||||
item.setToolId((Integer) meta.get("tool_id"));
|
||||
|
||||
// 액션/모션 관련
|
||||
item.setBuffActionName((String) meta.get("buff_action_name"));
|
||||
item.setBuffMotionSet((String) meta.get("buff_motion_set"));
|
||||
item.setBuffHandType((String) meta.get("buff_hand_type"));
|
||||
item.setBuffActivateName((String) meta.get("buff_activate_name"));
|
||||
item.setBuffDeactivateName((String) meta.get("buff_deactivate_name"));
|
||||
item.setBuffSwapName((String) meta.get("buff_swap_name"));
|
||||
|
||||
// UI 관련
|
||||
item.setBuffIcon2D((String) meta.get("buff_icon_2D"));
|
||||
item.setBuffActionCooltime((Integer) meta.get("buff_action_cooltime"));
|
||||
item.setUsingAimOffset((String) meta.get("using_aim_offset"));
|
||||
|
||||
// 플래그들
|
||||
item.setUserDetachable((Boolean) meta.get("user_detachable"));
|
||||
item.setNormalRemain((Boolean) meta.get("is_normal_remain"));
|
||||
item.setConcertRemain((Boolean) meta.get("is_concert_remain"));
|
||||
item.setMovieRemain((Boolean) meta.get("is_movie_remain"));
|
||||
item.setMeetingRemain((Boolean) meta.get("is_meeting_remain"));
|
||||
item.setMyhomeRemain((Boolean) meta.get("is_myhome_remain"));
|
||||
item.setBeaconRemain((Boolean) meta.get("is_beacon_remain"));
|
||||
item.setDressroomRemain((Boolean) meta.get("is_dressroom_remain"));
|
||||
|
||||
buffs.add(item);
|
||||
});
|
||||
|
||||
log.info("loadBuff {} Load Complete", EMetaData.BUFF_DATA.getFileName());
|
||||
}
|
||||
|
||||
// 속성랜덤그룹 데이터 로드
|
||||
public void loadAttributeRandomGroup(){
|
||||
List<Map<String, Object>> metaList = jsonFileReader.readJsonFile(EMetaData.ATTRIBUTE_RANDOM_GROUP_DATA.getFileName());
|
||||
if(metaList == null || metaList.isEmpty()) {
|
||||
log.warn("Attribute Random Group data is empty or file not found: {}", EMetaData.ATTRIBUTE_RANDOM_GROUP_DATA.getFileName());
|
||||
return;
|
||||
}
|
||||
|
||||
metaList.forEach(meta -> {
|
||||
MetaAttributeRandomGroupData item = new MetaAttributeRandomGroupData();
|
||||
|
||||
item.setKey((Integer) meta.get("Key"));
|
||||
item.setGroupId((String) meta.get("GroupID"));
|
||||
item.setAttribute((String) meta.get("Attribute"));
|
||||
item.setWeight((Integer) meta.get("Weight"));
|
||||
|
||||
attributeRandomGroups.add(item);
|
||||
});
|
||||
|
||||
log.info("loadAttributeRandomGroup {} Load Complete", EMetaData.ATTRIBUTE_RANDOM_GROUP_DATA.getFileName());
|
||||
}
|
||||
|
||||
// 아이템세트 데이터 로드
|
||||
public void loadItemSet(){
|
||||
List<Map<String, Object>> metaList = jsonFileReader.readJsonFile(EMetaData.ITEM_SET_DATA.getFileName());
|
||||
if(metaList == null || metaList.isEmpty()) {
|
||||
log.warn("Item Set data is empty or file not found: {}", EMetaData.ITEM_SET_DATA.getFileName());
|
||||
return;
|
||||
}
|
||||
|
||||
metaList.forEach(meta -> {
|
||||
MetaItemSetData item = new MetaItemSetData();
|
||||
|
||||
item.setId((Integer) meta.get("ID"));
|
||||
item.setName((String) meta.get("Name"));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> itemsData = (List<String>) meta.get("Items");
|
||||
item.setItems(itemsData);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Map<String, Object>> setEffectsData = (List<Map<String, Object>>) meta.get("SetEfffects");
|
||||
if (setEffectsData != null) {
|
||||
List<MetaItemSetData.SetEffect> setEffects = new ArrayList<>();
|
||||
setEffectsData.forEach(effectMap -> {
|
||||
MetaItemSetData.SetEffect setEffect = new MetaItemSetData.SetEffect();
|
||||
setEffect.setRequirementCount((Integer) effectMap.get("RequirementCount"));
|
||||
setEffect.setAttributeName((String) effectMap.get("AttributeName"));
|
||||
setEffect.setAttributeValue((Integer) effectMap.get("AttributeValue"));
|
||||
setEffects.add(setEffect);
|
||||
});
|
||||
item.setSetEffects(setEffects);
|
||||
}
|
||||
|
||||
itemSets.add(item);
|
||||
});
|
||||
|
||||
log.info("loadItemSet {} Load Complete", EMetaData.ITEM_SET_DATA.getFileName());
|
||||
}
|
||||
|
||||
// 랜덤박스 데이터 로드
|
||||
public void loadGacha(){
|
||||
List<Map<String, Object>> metaList = jsonFileReader.readJsonFile(EMetaData.GACHA_DATA.getFileName());
|
||||
if(metaList == null || metaList.isEmpty()) {
|
||||
log.warn("Gacha data is empty or file not found: {}", EMetaData.GACHA_DATA.getFileName());
|
||||
return;
|
||||
}
|
||||
|
||||
metaList.forEach(meta -> {
|
||||
MetaGachaData item = new MetaGachaData();
|
||||
|
||||
item.setId((Integer) meta.get("Id"));
|
||||
item.setGroupId((Integer) meta.get("GroupId"));
|
||||
item.setWeight((Integer) meta.get("Weight"));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> rewardData = (Map<String, Object>) meta.get("Reward");
|
||||
if (rewardData != null) {
|
||||
MetaGachaData.Reward reward = new MetaGachaData.Reward();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> currencyData = (Map<String, Object>) rewardData.get("Currency");
|
||||
if (currencyData != null) {
|
||||
MetaGachaData.Currency currency = new MetaGachaData.Currency();
|
||||
currency.setId((Integer) currencyData.get("Id"));
|
||||
currency.setValue(((Number) currencyData.get("Value")).doubleValue());
|
||||
reward.setCurrency(currency);
|
||||
}
|
||||
|
||||
item.setReward(reward);
|
||||
}
|
||||
|
||||
gachas.add(item);
|
||||
});
|
||||
|
||||
log.info("loadGacha {} Load Complete", EMetaData.GACHA_DATA.getFileName());
|
||||
}
|
||||
|
||||
// 제작 데이터 로드
|
||||
public void loadCrafting(){
|
||||
List<Map<String, Object>> metaList = jsonFileReader.readJsonFile(EMetaData.CRAFTING_DATA.getFileName());
|
||||
if(metaList == null || metaList.isEmpty()) {
|
||||
log.warn("Crafting data is empty or file not found: {}", EMetaData.CRAFTING_DATA.getFileName());
|
||||
return;
|
||||
}
|
||||
|
||||
metaList.forEach(meta -> {
|
||||
MetaCraftingData item = new MetaCraftingData();
|
||||
|
||||
// 기본 정보
|
||||
item.setId((Integer) meta.get("Id"));
|
||||
item.setPropSmallType((String) meta.get("PropSmallType"));
|
||||
item.setCraftingItemId((Integer) meta.get("Crafting_ItemId"));
|
||||
item.setCraftingItemValue((Integer) meta.get("Crafting_ItemValue"));
|
||||
item.setRecipeType((String) meta.get("RecipeType"));
|
||||
item.setRecipeItemId((Integer) meta.get("Recipe_ItemId"));
|
||||
|
||||
// Material 배열 처리
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Map<String, Object>> materialData = (List<Map<String, Object>>) meta.get("Material");
|
||||
if (materialData != null) {
|
||||
List<MetaCraftingData.Material> materials = new ArrayList<>();
|
||||
materialData.forEach(materialMap -> {
|
||||
MetaCraftingData.Material material = new MetaCraftingData.Material();
|
||||
material.setItemId((Integer) materialMap.get("ItemId"));
|
||||
material.setItemValue((Integer) materialMap.get("ItemValue"));
|
||||
materials.add(material);
|
||||
});
|
||||
item.setMaterials(materials);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Map<String, Object>> attributeData = (List<Map<String, Object>>) meta.get("Attribute");
|
||||
if (attributeData != null) {
|
||||
List<MetaCraftingData.Attribute> attributes = new ArrayList<>();
|
||||
attributeData.forEach(attributeMap -> {
|
||||
MetaCraftingData.Attribute attribute = new MetaCraftingData.Attribute();
|
||||
attribute.setAttributeName((String) attributeMap.get("AttributeName"));
|
||||
attribute.setAttributeValue((Integer) attributeMap.get("AttributeValue"));
|
||||
attributes.add(attribute);
|
||||
});
|
||||
item.setAttributes(attributes);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Integer> propData = (List<Integer>) meta.get("Prop");
|
||||
item.setProps(propData);
|
||||
|
||||
// 시간 및 제한 정보
|
||||
item.setCraftingTime((Integer) meta.get("CraftingTime"));
|
||||
item.setBeaconReduceTime((Integer) meta.get("Beacon_ReduceTime"));
|
||||
item.setBeaconBonusItemId((Integer) meta.get("Beacon_BonusItemId"));
|
||||
item.setMaxCraftLimit((Integer) meta.get("max_craft_limit"));
|
||||
|
||||
craftings.add(item);
|
||||
});
|
||||
|
||||
log.info("loadCrafting {} Load Complete", EMetaData.CRAFTING_DATA.getFileName());
|
||||
}
|
||||
|
||||
// 랜덤박스 데이터 로드
|
||||
public void loadCurrency(){
|
||||
List<Map<String, Object>> metaList = jsonFileReader.readJsonFile(EMetaData.CURRENCY_DATA.getFileName());
|
||||
if(metaList == null || metaList.isEmpty()) {
|
||||
log.warn("Currency data is empty or file not found: {}", EMetaData.CURRENCY_DATA.getFileName());
|
||||
return;
|
||||
}
|
||||
|
||||
metaList.forEach(meta -> {
|
||||
MetaCurrencyData item = new MetaCurrencyData();
|
||||
|
||||
item.setId((Integer) meta.get("Id"));
|
||||
item.setCurrencyType((String) meta.get("CurrencyType"));
|
||||
item.setName((String) meta.get("Name"));
|
||||
item.setDescription((String) meta.get("Description"));
|
||||
item.setMaxCount((Integer) meta.get("MaxCount"));
|
||||
item.setIconPath((String) meta.get("IconPath"));
|
||||
item.setItemId((Integer) meta.get("ItemID"));
|
||||
|
||||
currencies.add(item);
|
||||
});
|
||||
|
||||
log.info("loadCurrency {} Load Complete", EMetaData.CURRENCY_DATA.getFileName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,361 +0,0 @@
|
||||
package com.caliverse.admin.domain.datacomponent;
|
||||
|
||||
|
||||
import com.caliverse.admin.domain.entity.EMetaData;
|
||||
import com.caliverse.admin.domain.entity.metadata.*;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
@Getter
|
||||
@Slf4j
|
||||
public class MetaDataFileLoader_old {
|
||||
@Value("${caliverse.metadata.path}")
|
||||
private String metaDataPath;
|
||||
|
||||
// private Map<Integer, MetaItemData> items;
|
||||
// private Map<String, MetaTextStringData> textStrings;
|
||||
// private Map<Integer, MetaClothTypeData> clothTypes;
|
||||
// private Map<Integer, MetaToolData> toolItems;
|
||||
// private Map<Integer, String> banWords;
|
||||
// private Map<MetaQuestKey, MetaQuestData> quests;
|
||||
// private Map<Integer, MetaBuildingData> buildings;
|
||||
// private Map<Integer, MetaLandData> lands;
|
||||
//
|
||||
// public MetaTextStringData getName(String text){
|
||||
// if(textStrings == null) parseMetaString();
|
||||
// if(text == null) return null;
|
||||
//
|
||||
// MetaTextStringData name = textStrings.get(text);
|
||||
//
|
||||
// return name;
|
||||
// }
|
||||
//
|
||||
// //아이템 가져오기
|
||||
// public MetaItemData getMetaItem(int itemId) {
|
||||
// if(textStrings == null) parseMetaString();
|
||||
// if(items == null){
|
||||
// parseMetaItems();
|
||||
// }
|
||||
// if(itemId == 0) return null;
|
||||
//
|
||||
// MetaItemData itemData = items.get(itemId);
|
||||
//
|
||||
// return itemData;
|
||||
// }
|
||||
//
|
||||
// //의상 타입 가져오기
|
||||
// public MetaClothTypeData getMetaClothType(int id) {
|
||||
// if(clothTypes == null ){
|
||||
// parseMetaClothTypes();
|
||||
// }
|
||||
// if(id == 0) return null;
|
||||
//
|
||||
// return clothTypes.get(id);
|
||||
// }
|
||||
//
|
||||
// //도구 정보 가져오기
|
||||
// public MetaToolData getMetaToolItem(int id) {
|
||||
// if(textStrings == null) parseMetaString();
|
||||
// if(toolItems == null ){
|
||||
// parseMetaToolItems();
|
||||
// }
|
||||
// if(id == 0){
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// return toolItems.get(id);
|
||||
// }
|
||||
//
|
||||
// //퀘스트 정보 가져오기
|
||||
// public List<MetaQuestData> getMetaQuests(int id) {
|
||||
// if(textStrings == null) parseMetaString();
|
||||
// if(quests == null ) parseMetaQuests();
|
||||
// if(id == 0) return null;
|
||||
//
|
||||
// List<MetaQuestData> quest = new ArrayList<>();
|
||||
// quests.forEach((key,val)->{
|
||||
// if(key.getQeustId().equals(id)) quest.add(val);
|
||||
// });
|
||||
//
|
||||
// return quest;
|
||||
// }
|
||||
//
|
||||
// //빌딩 정보 가져오기
|
||||
// public MetaBuildingData getMetaBuildingItem(int id) {
|
||||
// if(textStrings == null) parseMetaString();
|
||||
// if(buildings == null ){
|
||||
// parseMetaBuilding();
|
||||
// }
|
||||
// if(id == 0){
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// return buildings.get(id);
|
||||
// }
|
||||
//
|
||||
// //랜드 정보 가져오기
|
||||
// public MetaLandData getMetaLandItem(int id) {
|
||||
// if(textStrings == null) parseMetaString();
|
||||
// if(lands == null ){
|
||||
// parseMetaLand();
|
||||
// }
|
||||
// if(id == 0){
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// return lands.get(id);
|
||||
// }
|
||||
//
|
||||
// // 아이템 정보 데이터 저장
|
||||
// public void parseMetaItems(){
|
||||
// items = new HashMap<>();
|
||||
//
|
||||
// List<Map<String, Object>> itemInfos = loadDataFromJsonFile(EMetaData.ITEM_DATA.getFileName(), "ItemMetaDataList");
|
||||
//
|
||||
// for (Map<String, Object> itemInfo : itemInfos) {
|
||||
// MetaItemData item = new MetaItemData();
|
||||
// item.setItemId((Integer)itemInfo.get("item_id"));
|
||||
// item.setName((String)itemInfo.get("name"));
|
||||
// item.setLargeType((String)itemInfo.get("type_large"));
|
||||
// item.setGender((String)itemInfo.get("gender"));
|
||||
// items.put(item.getItemId(), item);
|
||||
// }
|
||||
//
|
||||
// log.info("parseMetaItems ItemMetaDataList.json Load Complete");
|
||||
//
|
||||
// }
|
||||
//
|
||||
// // 의상 타입 데이터 저장
|
||||
// public void parseMetaClothTypes(){
|
||||
// clothTypes = new HashMap<>();
|
||||
//
|
||||
// List<Map<String, Object>> itemInfos = loadDataFromJsonFile(EMetaData.CLOTH_TYPE_DATA.getFileName(), "ClothEquipTypeDataList");
|
||||
//
|
||||
// for (Map<String, Object> itemInfo : itemInfos) {
|
||||
// MetaClothTypeData item = new MetaClothTypeData();
|
||||
// item.setMetaId((Integer)itemInfo.get("Meta_id"));
|
||||
// item.setSmallType((String)itemInfo.get("SmallType"));
|
||||
// item.setEquipSlotType((String)itemInfo.get("EquipSlotType"));
|
||||
// clothTypes.put(item.getMetaId(), item);
|
||||
// }
|
||||
// log.info("parseMetaClothTypes ClothEquipTypeDataList.json Load Complete");
|
||||
// }
|
||||
//
|
||||
// // 도구 정보 데이터 저장
|
||||
// public void parseMetaToolItems(){
|
||||
// toolItems = new HashMap<>();
|
||||
//
|
||||
// List<Map<String, Object>> itemInfos = loadDataFromJsonFile(EMetaData.TOOL_DATA.getFileName(), "ToolMetaDataList");
|
||||
//
|
||||
// for (Map<String, Object> itemInfo : itemInfos) {
|
||||
// MetaToolData item = new MetaToolData();
|
||||
// item.setToolId((Integer)itemInfo.get("tool_id"));
|
||||
// item.setToolName((String)itemInfo.get("tool_name"));
|
||||
// toolItems.put(item.getToolId(), item);
|
||||
// }
|
||||
// log.info("parseMetaToolItems ToolMetaDataList.json Load Complete");
|
||||
// }
|
||||
//
|
||||
// // 금지어 데이터 저장
|
||||
// public void parseMetaBanWord(){
|
||||
// banWords = new HashMap<>();
|
||||
//
|
||||
// List<Map<String, Object>> itemInfos = loadDataFromJsonFile(EMetaData.BAN_WORD_DATA.getFileName(), "BanWordMetaDataList");
|
||||
//
|
||||
// for (Map<String, Object> itemInfo : itemInfos) {
|
||||
// banWords.put((Integer)itemInfo.get("Id"), (String)itemInfo.get("Ban_Word"));
|
||||
// }
|
||||
// log.info("parseMetaBanWord BanWordMetaDataList.json Load Complete");
|
||||
// }
|
||||
//
|
||||
// // String 데이터 저장
|
||||
// public void parseMetaString(){
|
||||
// textStrings = new HashMap<>();
|
||||
//
|
||||
// List<Map<String, Object>> itemInfos = loadDataFromJsonFile(EMetaData.TEXT_STRING_DATA.getFileName(), "TextStringMetaDataList");
|
||||
//
|
||||
// for (Map<String, Object> itemInfo : itemInfos) {
|
||||
// MetaTextStringData item = new MetaTextStringData();
|
||||
// item.setKey((String)itemInfo.get("Key"));
|
||||
// item.setKor((String)itemInfo.get("SourceString"));
|
||||
// item.setEn((String)itemInfo.get("en"));
|
||||
// textStrings.put((String)itemInfo.get("Key"), item);
|
||||
// }
|
||||
// log.info("parseMetaString TextStringMetaDataList.json Load Complete");
|
||||
// }
|
||||
//
|
||||
// // 퀘스트 데이터 저장
|
||||
// public void parseMetaQuests(){
|
||||
// quests = new HashMap<>();
|
||||
//
|
||||
// List<Map<String, Object>> itemInfos = loadDataFromJsonFile(EMetaData.QUEST_DATA.getFileName(), "QuestMetaDataList");
|
||||
//
|
||||
// for (Map<String, Object> itemInfo : itemInfos) {
|
||||
// MetaQuestData item = new MetaQuestData();
|
||||
// Integer questId = (Integer)itemInfo.get("QuestID");
|
||||
// Integer taskNum = (Integer)itemInfo.get("TaskNum");
|
||||
// item.setQuestId(questId);
|
||||
// item.setTaskNum(taskNum);
|
||||
// item.setTaskName((String)itemInfo.get("TaskName"));
|
||||
// item.setCounter((Integer) itemInfo.get("SetCounter"));
|
||||
// quests.put(new MetaQuestKey(questId, taskNum), item);
|
||||
// }
|
||||
// log.info("parseMetaQuests QuestMetaDataList.json Load Complete");
|
||||
// }
|
||||
//
|
||||
// // 빌딩 데이터 저장
|
||||
// public void parseMetaBuilding(){
|
||||
// buildings = new HashMap<>();
|
||||
//
|
||||
// List<Map<String, Object>> buildingInfos = loadDataFromJsonFile(EMetaData.BUILDING_DATA.getFileName(), "BuildingMetaDataList");
|
||||
//
|
||||
// for (Map<String, Object> itemInfo : buildingInfos) {
|
||||
// MetaBuildingData item = new MetaBuildingData();
|
||||
// item.setBuildingId((Integer)itemInfo.get("BuildingId"));
|
||||
// item.setBuildingOpen((Boolean)itemInfo.get("BuildingOpen"));
|
||||
// item.setOwner((String)itemInfo.get("Owner"));
|
||||
// item.setBuildingName((String)itemInfo.get("BuildingName"));
|
||||
// item.setBuildingDesc((String)itemInfo.get("BuildingDesc"));
|
||||
// item.setBuildingSize((String)itemInfo.get("BuildingSize"));
|
||||
// item.setInstanceSocket((Integer)itemInfo.get("InstanceSocket"));
|
||||
// item.setInstanceSocketLink((Integer)itemInfo.get("InstanceSocketLink"));
|
||||
// buildings.put((Integer)itemInfo.get("BuildingId"), item);
|
||||
// }
|
||||
// log.info("parseMetaBuilding BuildingMetaDataList.json Load Complete");
|
||||
// }
|
||||
//
|
||||
// // 랜드 데이터 저장
|
||||
// public void parseMetaLand(){
|
||||
// lands = new HashMap<>();
|
||||
//
|
||||
// List<Map<String, Object>> landInfos = loadDataFromJsonFile(EMetaData.LAND_DATA.getFileName(), "LandMetaDataList");
|
||||
//
|
||||
// for (Map<String, Object> itemInfo : landInfos) {
|
||||
// MetaLandData item = new MetaLandData();
|
||||
// item.setLandId((Integer)itemInfo.get("LandId"));
|
||||
// item.setOwner((String)itemInfo.get("Owner"));
|
||||
// item.setLandName((String)itemInfo.get("LandName"));
|
||||
// item.setLandDesc((String)itemInfo.get("LandDesc"));
|
||||
// item.setLandSize((String)itemInfo.get("LandSize"));
|
||||
// item.setLandType((String)itemInfo.get("LandType"));
|
||||
// item.setBuildingSocket((Integer)itemInfo.get("BuildingSocket"));
|
||||
// lands.put((Integer)itemInfo.get("LandId"), item);
|
||||
// }
|
||||
// log.info("parseMetaLand LandMetaDataList.json Load Complete");
|
||||
// }
|
||||
//
|
||||
// // resource json 파일 정보 읽어오기(resource)
|
||||
//// public List<Map<String, Object>> loadDataFromJsonFile(String fileName, String listName) {
|
||||
//// List<Map<String, Object>> resultMap = new ArrayList<>();
|
||||
////
|
||||
//// URL resourceUrl = getClass().getClassLoader().getResource("metadata/" + fileName);
|
||||
//// log.info("loadDataFromJsonFile path: {}", resourceUrl.getPath());
|
||||
////
|
||||
//// try (InputStream inputStream = resourceUrl.openStream()) {
|
||||
//// if (inputStream != null) {
|
||||
//// boolean isRequired = EMetaData.getIsRequired(fileName);
|
||||
//// if (isRequired) {
|
||||
//// String str = new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
|
||||
//// ObjectMapper objectMapper = new ObjectMapper();
|
||||
//// try {
|
||||
//// JsonNode rootNode = objectMapper.readTree(str);
|
||||
////
|
||||
//// resultMap = objectMapper.readValue(rootNode.get(listName).toString(), new TypeReference<List<Map<String, Object>>>() {});
|
||||
//// } catch (JsonMappingException e) {
|
||||
//// log.error("loadDataFromJsonFile JsonMappingException: {}", e.getMessage());
|
||||
//// } catch (JsonProcessingException e) {
|
||||
//// log.error("loadDataFromJsonFile JsonProcessingException: {}", e.getMessage());
|
||||
//// }
|
||||
//// }
|
||||
//// } else {
|
||||
//// log.error("Resource not found: {}", fileName);
|
||||
//// }
|
||||
//// } catch (IOException e) {
|
||||
//// log.error("loadDataFromJsonFile IOException: {}", e.getMessage());
|
||||
//// }
|
||||
////
|
||||
//// return resultMap;
|
||||
//// }
|
||||
// // json 파일 정보 읽어오기
|
||||
// public List<Map<String, Object>> loadDataFromJsonFile(String fileName, String listName) {
|
||||
// List<Map<String, Object>> resultMap = new ArrayList<>();
|
||||
//
|
||||
// File file = new File(metaDataPath, fileName);
|
||||
// log.info("loadDataFromJsonFile path: {}", file.getPath());
|
||||
// if (file.isFile()) {
|
||||
// boolean isRequired = EMetaData.getIsRequired(fileName);
|
||||
// if (isRequired) {
|
||||
// String str = readFileAsString(file);
|
||||
// ObjectMapper objectMapper = new ObjectMapper();
|
||||
// try {
|
||||
// JsonNode rootNode = objectMapper.readTree(str);
|
||||
//
|
||||
// resultMap = objectMapper.readValue(rootNode.get(listName).toString(), new TypeReference<List<Map<String, Object>>>() {});
|
||||
// } catch (JsonMappingException e) {
|
||||
// log.error("loadDataFromJsonFile JsonMappingException: {}", e.getMessage());
|
||||
// } catch (JsonProcessingException e) {
|
||||
// log.error("loadDataFromJsonFile JsonProcessingException: {}", e.getMessage());
|
||||
// }
|
||||
// finally {
|
||||
// file = null;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return resultMap;
|
||||
// }
|
||||
//// public List<Map<String, Object>> loadDataFromJsonFile(String fileName, String listName) {
|
||||
//// List<Map<String, Object>> resultMap = new ArrayList<>();
|
||||
//// File file = new File(getClass().getClassLoader().getResource("metadata").getPath(), fileName);
|
||||
////// File file = new File(metaDataPath, fileName);
|
||||
//// if (file.isFile()) {
|
||||
//// boolean isRequired = EMetaData.getIsRequired(fileName);
|
||||
//// if (isRequired) {
|
||||
////
|
||||
//// String str = readFileAsString(file);
|
||||
//// ObjectMapper objectMapper = new ObjectMapper();
|
||||
//// try {
|
||||
//// // Parse the JSON object
|
||||
//// JsonNode rootNode = objectMapper.readTree(str);
|
||||
////
|
||||
////// jsonMap = objectMapper.readValue(str, new TypeReference<Map<String, Object>>() {});
|
||||
//// resultMap = objectMapper.readValue(rootNode.get(listName).toString(), new TypeReference<List<Map<String, Object>>>() {});
|
||||
//// } catch (JsonMappingException e) {
|
||||
//// e.printStackTrace();
|
||||
//// } catch (JsonProcessingException e) {
|
||||
//// e.printStackTrace();
|
||||
//// }
|
||||
//// finally {
|
||||
//// file = null;
|
||||
//// }
|
||||
//// }
|
||||
//// }
|
||||
//// return resultMap;
|
||||
//// }
|
||||
//
|
||||
// private String readFileAsString(File file) {
|
||||
// StringBuilder fileContents = new StringBuilder((int)file.length());
|
||||
// try (BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"))) {
|
||||
// String line;
|
||||
// while((line = br.readLine()) != null) {
|
||||
// fileContents.append(line);
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// log.error("readFileAsString IOException: {}", e.getMessage());
|
||||
// }
|
||||
// return fileContents.toString();
|
||||
// }
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.caliverse.admin.domain.datacomponent;
|
||||
import com.caliverse.admin.domain.entity.LANGUAGETYPE;
|
||||
import com.caliverse.admin.domain.entity.metadata.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -25,6 +24,12 @@ public class MetaDataHandler {
|
||||
.orElse("");
|
||||
}
|
||||
|
||||
public String getTextStringData(String text, LANGUAGETYPE lang) {
|
||||
return metadataFileLoader.getName(text)
|
||||
.map(data -> lang.equals(LANGUAGETYPE.JA) ? data.getJa() : lang.equals(LANGUAGETYPE.EN) ? data.getEn() : data.getKor())
|
||||
.orElse("");
|
||||
}
|
||||
|
||||
public String getMetaItemNameData(int itemId) {
|
||||
return metadataFileLoader.getMetaItem(itemId)
|
||||
.map(MetaItemData::getName)
|
||||
@@ -63,6 +68,50 @@ public class MetaDataHandler {
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
public String getMetaWebLinkData(String key, LANGUAGETYPE lang) {
|
||||
return metadataFileLoader.getMetaWebLinkLocalize(key)
|
||||
.map(data -> lang.equals(LANGUAGETYPE.EN) ? data.getEn() : lang.equals(LANGUAGETYPE.JA) ? data.getJa() : data.getKo())
|
||||
.orElse("");
|
||||
}
|
||||
|
||||
public String getMetaBuffName(int metaId){
|
||||
return metadataFileLoader.getMetaBuff(metaId)
|
||||
.map(MetaBuffData::getBuffName)
|
||||
.orElse("");
|
||||
}
|
||||
|
||||
public String getMetaAttribData(String groupId){
|
||||
return metadataFileLoader.getMetaAttributeRandomGroup(groupId)
|
||||
.map(MetaAttributeRandomGroupData::getAttribute)
|
||||
.orElse("");
|
||||
}
|
||||
|
||||
public String getMetaItemSetName(int metaId){
|
||||
return metadataFileLoader.getMetaItemSet(metaId)
|
||||
.map(MetaItemSetData::getName)
|
||||
.orElse("");
|
||||
}
|
||||
|
||||
public Integer getMetaGachaGroupId(int metaId){
|
||||
return metadataFileLoader.getMetaGacha(metaId)
|
||||
.map(MetaGachaData::getGroupId)
|
||||
.orElse(0);
|
||||
}
|
||||
|
||||
public String getMetaBrandName(int metaId){
|
||||
return metadataFileLoader.getMetaBrand(metaId)
|
||||
.map(MetaBrandData::getBrandName)
|
||||
.orElse("");
|
||||
}
|
||||
|
||||
public String getMetaCurrencyName(int metaId){
|
||||
return metadataFileLoader.getMetaCurrency(metaId)
|
||||
.map(MetaCurrencyData::getName)
|
||||
.orElse("");
|
||||
}
|
||||
|
||||
//전체 리스트
|
||||
|
||||
public List<MetaBuildingData> getMetaBuildingListData() {
|
||||
return metadataFileLoader.getMetaBuildings();
|
||||
}
|
||||
@@ -83,6 +132,10 @@ public class MetaDataHandler {
|
||||
return metadataFileLoader.getMetaGameModes();
|
||||
}
|
||||
|
||||
public List<MetaGameModeMatchData> getMetaGameModeMatchListData() {
|
||||
return metadataFileLoader.getMetaGameModeMatchs();
|
||||
}
|
||||
|
||||
public List<MetaGameFFAConfigData> getMetaGameFFAConfigListData() {
|
||||
return metadataFileLoader.getMetaGameFFAConfigs();
|
||||
}
|
||||
@@ -90,5 +143,12 @@ public class MetaDataHandler {
|
||||
public List<MetaSystemMailData> getMetaSystemMailListData() {
|
||||
return metadataFileLoader.getMetaSystemMail();
|
||||
}
|
||||
public List<MetaItemData> getMetaItemListData() {
|
||||
return metadataFileLoader.getMetaItems();
|
||||
}
|
||||
public List<MetaBrandData> getMetaBrandListData() {
|
||||
return metadataFileLoader.getMetaBrand();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
package com.caliverse.admin.domain.datacomponent;
|
||||
import com.caliverse.admin.domain.entity.metadata.MetaClothTypeData;
|
||||
import com.caliverse.admin.domain.entity.metadata.MetaItemData;
|
||||
import com.caliverse.admin.domain.entity.metadata.MetaQuestData;
|
||||
import com.caliverse.admin.domain.entity.metadata.MetaTextStringData;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@EnableCaching(proxyTargetClass = true)
|
||||
public class MetaDataHandler_bak {
|
||||
|
||||
@Autowired private MetaDataFileLoader metadataFileLoader;
|
||||
|
||||
/**
|
||||
* text에 대한 명칭 정보 캐싱
|
||||
* @param text
|
||||
* @return 명칭(String)
|
||||
*/
|
||||
// @Cacheable(cacheNames = "admintool:metaTextStringData", key = "#p0")
|
||||
// public String getTextStringData(String text) {
|
||||
// log.info("getTextStringData text: {}", text);
|
||||
// MetaTextStringData data = metadataFileLoader.getName(text);
|
||||
// log.info("getTextStringData data: {}", data);
|
||||
// return data == null ? "" : data.getKor();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 아이템에 대한 이름 정보 캐싱
|
||||
// * @param itemId
|
||||
// * @return 아이템 명칭(String)
|
||||
// */
|
||||
// @Cacheable(cacheNames = "admintool:metaItemNameData", key = "#p0", unless = "#result == null")
|
||||
// public String getMetaItemNameData(int itemId) {
|
||||
// MetaItemData item = metadataFileLoader.getMetaItem(itemId);
|
||||
// log.info("getMetaItemNameData data: {}", item);
|
||||
// return item == null ? "" : item.getName();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 아이템에 대한 타입 정보 캐싱
|
||||
// * @param itemId
|
||||
// * @return 아이템 타입(String)
|
||||
// */
|
||||
// @Cacheable(cacheNames = "admintool:metaItemLargeTypeData", key = "#p0", unless = "#result == null")
|
||||
// public String getMetaItemLargeTypeData(int itemId) {
|
||||
// MetaItemData item = metadataFileLoader.getMetaItem(itemId);
|
||||
// return item == null ? "" : item.getLargeType();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 의상 슬롯타입 정보 캐싱
|
||||
// * @param metaId
|
||||
// * @return 의상 슬롯타입(String)
|
||||
// */
|
||||
// @Cacheable(cacheNames = "admintool:metaClothSlotTypeData", key = "#p0", unless = "#result == null")
|
||||
// public String getMetaClothSlotTypeData(int metaId) {
|
||||
// MetaClothTypeData clothType = metadataFileLoader.getMetaClothType(metaId);
|
||||
// return clothType == null ? "" : clothType.getEquipSlotType();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 의상 타입 정보 캐싱
|
||||
// * @param metaId
|
||||
// * @return 의상 타입(String)
|
||||
// */
|
||||
// @Cacheable(cacheNames = "admintool:metaClothSmallTypeData", key = "#p0", unless = "#result == null", sync = true)
|
||||
// public String getMetaClothSmallTypeData(int metaId) {
|
||||
// log.info("getMetaClothSmallTypeData metaId: {}", metaId);
|
||||
// MetaClothTypeData clothType = metadataFileLoader.getMetaClothType(metaId);
|
||||
// log.info("getMetaClothSmallTypeData data: {}", clothType);
|
||||
// return clothType == null ? "" : clothType.getSmallType();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 퀘스트 정보
|
||||
// * @param questId
|
||||
// * @return 퀘스트 정보(List)
|
||||
// */
|
||||
// public List<MetaQuestData> getMetaQuestData(int questId) {
|
||||
// return metadataFileLoader.getMetaQuests(questId);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,6 @@ public enum CLOTHSMALLTYPE {
|
||||
NECKLACE,
|
||||
SHOES,
|
||||
SOCKS,
|
||||
ANKLET
|
||||
ANKLET,
|
||||
;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,15 @@ public enum EMetaData {
|
||||
GAME_MODE_MATCH_DATA("GameModeMatch", true),
|
||||
BATTLE_CONFIG_DATA("BattleFFAConfig", true),
|
||||
BATTLE_REWARD_DATA("BattleFFAReward", true),
|
||||
SYSTEM_MAIL_DATA("SystemMail", true)
|
||||
SYSTEM_MAIL_DATA("SystemMail", true),
|
||||
BRAND_DATA("Brand", true),
|
||||
BUFF_DATA("Buff", true),
|
||||
ITEM_SET_DATA("ItemSet", true),
|
||||
WEB_LINK_DATA("WeblinkLocalize", true),
|
||||
ATTRIBUTE_RANDOM_GROUP_DATA("AttributeRandomGroup", true),
|
||||
CRAFTING_DATA("Crafting", true),
|
||||
CURRENCY_DATA("Currency", true),
|
||||
GACHA_DATA("Gacha", true)
|
||||
|
||||
;
|
||||
|
||||
|
||||
130
src/main/java/com/caliverse/admin/domain/entity/ItemDict.java
Normal file
130
src/main/java/com/caliverse/admin/domain/entity/ItemDict.java
Normal file
@@ -0,0 +1,130 @@
|
||||
package com.caliverse.admin.domain.entity;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public class ItemDict {
|
||||
//대분류
|
||||
@JsonProperty("type_large")
|
||||
private String typeLarge;
|
||||
//소분류
|
||||
@JsonProperty("type_small")
|
||||
private String typeSmall;
|
||||
//아이템명
|
||||
@JsonProperty("item_name")
|
||||
private String itemName;
|
||||
//아이템아이디
|
||||
@JsonProperty("item_id")
|
||||
private Integer itemId;
|
||||
//브랜드
|
||||
private String brand;
|
||||
//성별
|
||||
private String gender;
|
||||
//판매시 획득 재화
|
||||
@JsonProperty("sell_type")
|
||||
private String sellType;
|
||||
//판매시 획득 재화량
|
||||
@JsonProperty("sell_price")
|
||||
private Integer sellPrice;
|
||||
//구매시 필요 재화
|
||||
@JsonProperty("buy_type")
|
||||
private String buyType;
|
||||
//구매시 필요 재화량
|
||||
@JsonProperty("buy_price")
|
||||
private Integer buyPrice;
|
||||
//구매시 할인율
|
||||
@JsonProperty("buy_discount_rate")
|
||||
private Integer buyDiscountRate;
|
||||
|
||||
private Country country;
|
||||
private Expire expire;
|
||||
private Trade trade;
|
||||
private Attrib attrib;
|
||||
private Etc etc;
|
||||
|
||||
@Builder
|
||||
public static class Country{
|
||||
//최대 보유 가능 수량
|
||||
@JsonProperty("max_count")
|
||||
private Integer maxCount;
|
||||
//최대 스택 가능 수량
|
||||
@JsonProperty("stack_max_count")
|
||||
private Integer stackMaxCount;
|
||||
}
|
||||
|
||||
@Builder
|
||||
public static class Expire{
|
||||
//아이템 만료 타입
|
||||
@JsonProperty("expire_type")
|
||||
private String expireType;
|
||||
//만료 시작 시간
|
||||
@JsonProperty("expire_start_dt")
|
||||
private LocalDateTime expireStartDt;
|
||||
//만료 종료 시간
|
||||
@JsonProperty("expire_end_dt")
|
||||
private LocalDateTime expireEndDt;
|
||||
//만료 시간 연장 여부
|
||||
@JsonProperty("expire_time_sec")
|
||||
private Integer expireTimeSec;
|
||||
}
|
||||
|
||||
@Builder
|
||||
public static class Trade{
|
||||
//유저 간 거래 가능 여부
|
||||
@JsonProperty("user_tradable")
|
||||
private boolean userTradable;
|
||||
//상점에서 판매 가능 여부
|
||||
@JsonProperty("system_tradable")
|
||||
private boolean systemTradable;
|
||||
//버리기 가능 여부
|
||||
private boolean throwable;
|
||||
//상점에서 구매 가능 여부
|
||||
@JsonProperty("cart_buy")
|
||||
private boolean cartBuy;
|
||||
}
|
||||
|
||||
@Builder
|
||||
public static class Attrib{
|
||||
//희귀도
|
||||
private String rarity;
|
||||
//기본 속성
|
||||
@JsonProperty("default_attrib")
|
||||
private String defaultAttrib;
|
||||
//랜덤 그룹
|
||||
@JsonProperty("attrib_random_group")
|
||||
private String attribRandomGroup;
|
||||
//아이템 세트
|
||||
@JsonProperty("item_set")
|
||||
private String itemSet;
|
||||
//아이템 사용 시 획득 버프
|
||||
@JsonProperty("buff")
|
||||
private String buff;
|
||||
}
|
||||
|
||||
@Builder
|
||||
public static class Etc{
|
||||
//착용 부위
|
||||
@JsonProperty("dress_slot_type")
|
||||
private String dressSlotType;
|
||||
//제품 URL
|
||||
@JsonProperty("product_link")
|
||||
private String productLink;
|
||||
//제작 아이템 그룹
|
||||
@JsonProperty("prop_small_type")
|
||||
private String propSmallType;
|
||||
//랜덤박스 그룹 ID
|
||||
@JsonProperty("gacha_group_id")
|
||||
private Integer gachaGroupId;
|
||||
//UGQ 사용 가능 여부
|
||||
@JsonProperty("ugq_action")
|
||||
private String ugqAction;
|
||||
//연결된 랜드 ID
|
||||
@JsonProperty("linked_land")
|
||||
private Integer linkedLand;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.caliverse.admin.domain.entity.metadata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MetaAttributeRandomGroupData {
|
||||
@JsonProperty("Key")
|
||||
private int key;
|
||||
|
||||
@JsonProperty("GroupID")
|
||||
private String groupId;
|
||||
|
||||
@JsonProperty("Attribute")
|
||||
private String attribute;
|
||||
|
||||
@JsonProperty("Weight")
|
||||
private int weight;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.caliverse.admin.domain.entity.metadata;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MetaBrandData {
|
||||
private int id;
|
||||
private String brandName;
|
||||
private String brandDesc;
|
||||
private String logoLeft;
|
||||
private String logoCenter;
|
||||
private String logoRight;
|
||||
private String logoText;
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package com.caliverse.admin.domain.entity.metadata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class MetaBuffData {
|
||||
@JsonProperty("buff_id")
|
||||
private int buffId;
|
||||
|
||||
@JsonProperty("buff_name")
|
||||
private String buffName;
|
||||
|
||||
@JsonProperty("buff_description")
|
||||
private String buffDescription;
|
||||
|
||||
@JsonProperty("buff_category")
|
||||
private String buffCategory;
|
||||
|
||||
@JsonProperty("buff_channel")
|
||||
private int buffChannel;
|
||||
|
||||
@JsonProperty("buff_priority")
|
||||
private int buffPriority;
|
||||
|
||||
@JsonProperty("action_buff_id")
|
||||
private int actionBuffId;
|
||||
|
||||
@JsonProperty("Traits")
|
||||
private List<Trait> traits;
|
||||
|
||||
@JsonProperty("propmesh_name")
|
||||
private String propmeshName;
|
||||
|
||||
@JsonProperty("propmesh_name_opacity")
|
||||
private String propmeshNameOpacity;
|
||||
|
||||
@JsonProperty("use_required")
|
||||
private int useRequired;
|
||||
|
||||
@JsonProperty("InactiveRange")
|
||||
private int inactiveRange;
|
||||
|
||||
@JsonProperty("GuideHeight")
|
||||
private int guideHeight;
|
||||
|
||||
@JsonProperty("GuideOffset")
|
||||
private int guideOffset;
|
||||
|
||||
@JsonProperty("GuideScale")
|
||||
private double guideScale;
|
||||
|
||||
@JsonProperty("prop_effect")
|
||||
private String propEffect;
|
||||
|
||||
@JsonProperty("buff_start_condition")
|
||||
private String buffStartCondition;
|
||||
|
||||
@JsonProperty("buff_start_condition_value")
|
||||
private int buffStartConditionValue;
|
||||
|
||||
@JsonProperty("buff_end_condition")
|
||||
private String buffEndCondition;
|
||||
|
||||
@JsonProperty("buff_end_condition_value")
|
||||
private int buffEndConditionValue;
|
||||
|
||||
@JsonProperty("duration_time")
|
||||
private int durationTime;
|
||||
|
||||
@JsonProperty("buff_end_execution_type")
|
||||
private String buffEndExecutionType;
|
||||
|
||||
@JsonProperty("buff_end_execution_value")
|
||||
private int buffEndExecutionValue;
|
||||
|
||||
@JsonProperty("attach_effect_bp")
|
||||
private String attachEffectBp;
|
||||
|
||||
@JsonProperty("attach_avatar_socket")
|
||||
private String attachAvatarSocket;
|
||||
|
||||
@JsonProperty("tool_id")
|
||||
private int toolId;
|
||||
|
||||
@JsonProperty("buff_action_name")
|
||||
private String buffActionName;
|
||||
|
||||
@JsonProperty("buff_motion_set")
|
||||
private String buffMotionSet;
|
||||
|
||||
@JsonProperty("buff_hand_type")
|
||||
private String buffHandType;
|
||||
|
||||
@JsonProperty("buff_activate_name")
|
||||
private String buffActivateName;
|
||||
|
||||
@JsonProperty("buff_deactivate_name")
|
||||
private String buffDeactivateName;
|
||||
|
||||
@JsonProperty("buff_swap_name")
|
||||
private String buffSwapName;
|
||||
|
||||
@JsonProperty("buff_icon_2D")
|
||||
private String buffIcon2D;
|
||||
|
||||
@JsonProperty("buff_action_cooltime")
|
||||
private int buffActionCooltime;
|
||||
|
||||
@JsonProperty("using_aim_offset")
|
||||
private String usingAimOffset;
|
||||
|
||||
@JsonProperty("user_detachable")
|
||||
private boolean userDetachable;
|
||||
|
||||
@JsonProperty("is_normal_remain")
|
||||
private boolean isNormalRemain;
|
||||
|
||||
@JsonProperty("is_concert_remain")
|
||||
private boolean isConcertRemain;
|
||||
|
||||
@JsonProperty("is_movie_remain")
|
||||
private boolean isMovieRemain;
|
||||
|
||||
@JsonProperty("is_meeting_remain")
|
||||
private boolean isMeetingRemain;
|
||||
|
||||
@JsonProperty("is_myhome_remain")
|
||||
private boolean isMyhomeRemain;
|
||||
|
||||
@JsonProperty("is_beacon_remain")
|
||||
private boolean isBeaconRemain;
|
||||
|
||||
@JsonProperty("is_dressroom_remain")
|
||||
private boolean isDressroomRemain;
|
||||
|
||||
@Data
|
||||
public static class Trait {
|
||||
@JsonProperty("Attribute")
|
||||
private String attribute;
|
||||
|
||||
@JsonProperty("Value")
|
||||
private int value;
|
||||
|
||||
@JsonProperty("Operation")
|
||||
private String operation;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.caliverse.admin.domain.entity.metadata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class MetaCraftingData {
|
||||
@JsonProperty("Id")
|
||||
private int id;
|
||||
|
||||
@JsonProperty("PropSmallType")
|
||||
private String propSmallType;
|
||||
|
||||
@JsonProperty("Crafting_ItemId")
|
||||
private int craftingItemId;
|
||||
|
||||
@JsonProperty("Crafting_ItemValue")
|
||||
private int craftingItemValue;
|
||||
|
||||
@JsonProperty("RecipeType")
|
||||
private String recipeType;
|
||||
|
||||
@JsonProperty("Recipe_ItemId")
|
||||
private int recipeItemId;
|
||||
|
||||
@JsonProperty("Material")
|
||||
private List<Material> materials;
|
||||
|
||||
@JsonProperty("Attribute")
|
||||
private List<Attribute> attributes;
|
||||
|
||||
@JsonProperty("Prop")
|
||||
private List<Integer> props;
|
||||
|
||||
@JsonProperty("CraftingTime")
|
||||
private int craftingTime;
|
||||
|
||||
@JsonProperty("Beacon_ReduceTime")
|
||||
private int beaconReduceTime;
|
||||
|
||||
@JsonProperty("Beacon_BonusItemId")
|
||||
private int beaconBonusItemId;
|
||||
|
||||
@JsonProperty("max_craft_limit")
|
||||
private int maxCraftLimit;
|
||||
@Data
|
||||
public static class Material {
|
||||
@JsonProperty("ItemId")
|
||||
private int itemId;
|
||||
|
||||
@JsonProperty("ItemValue")
|
||||
private int itemValue;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Attribute {
|
||||
@JsonProperty("AttributeName")
|
||||
private String attributeName;
|
||||
|
||||
@JsonProperty("AttributeValue")
|
||||
private int attributeValue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.caliverse.admin.domain.entity.metadata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MetaCurrencyData {
|
||||
@JsonProperty("Id")
|
||||
private int id;
|
||||
|
||||
@JsonProperty("CurrencyType")
|
||||
private String currencyType;
|
||||
|
||||
@JsonProperty("Name")
|
||||
private String name;
|
||||
|
||||
@JsonProperty("Description")
|
||||
private String description;
|
||||
|
||||
@JsonProperty("MaxCount")
|
||||
private Integer maxCount;
|
||||
|
||||
@JsonProperty("IconPath")
|
||||
private String iconPath;
|
||||
|
||||
@JsonProperty("ItemID")
|
||||
private Integer itemId;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.caliverse.admin.domain.entity.metadata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MetaGachaData {
|
||||
@JsonProperty("Id")
|
||||
private int id;
|
||||
|
||||
@JsonProperty("GroupId")
|
||||
private int groupId;
|
||||
|
||||
@JsonProperty("Reward")
|
||||
private Reward reward;
|
||||
|
||||
@JsonProperty("Weight")
|
||||
private int weight;
|
||||
|
||||
@Data
|
||||
public static class Reward {
|
||||
@JsonProperty("Currency")
|
||||
private Currency currency;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Currency {
|
||||
@JsonProperty("Id")
|
||||
private int id;
|
||||
|
||||
@JsonProperty("Value")
|
||||
private double value;
|
||||
}
|
||||
}
|
||||
@@ -5,15 +5,177 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
@Getter @Setter
|
||||
public class MetaItemData {
|
||||
|
||||
@JsonProperty("item_id")
|
||||
private Integer itemId;
|
||||
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
|
||||
@JsonProperty("desc")
|
||||
private String desc;
|
||||
|
||||
@JsonProperty("gender")
|
||||
private String gender;
|
||||
|
||||
@JsonProperty("image_3D_DP")
|
||||
private String image3dDp;
|
||||
|
||||
@JsonProperty("image_3D_DP_opacity")
|
||||
private String image3dDpOpacity;
|
||||
|
||||
@JsonProperty("image_3D")
|
||||
private String image3d;
|
||||
|
||||
@JsonProperty("image_3D_opacity")
|
||||
private String image3dOpacity;
|
||||
|
||||
@JsonProperty("image_2D")
|
||||
private String image2d;
|
||||
|
||||
@JsonProperty("release_date")
|
||||
private LocalDateTime releaseDate;
|
||||
|
||||
@JsonProperty("Brand")
|
||||
private Integer brand;
|
||||
|
||||
@JsonProperty("isNFT")
|
||||
private Boolean isNft;
|
||||
|
||||
@JsonProperty("type_large")
|
||||
private String largeType;
|
||||
private String gender;
|
||||
|
||||
@JsonProperty("type_small")
|
||||
private String smallType;
|
||||
|
||||
@JsonProperty("register_id")
|
||||
private Integer registerId;
|
||||
|
||||
@JsonProperty("max_count")
|
||||
private Integer maxCount;
|
||||
|
||||
@JsonProperty("stack_max_count")
|
||||
private Integer stackMaxCount;
|
||||
|
||||
@JsonProperty("expire_type")
|
||||
private String expireType;
|
||||
|
||||
@JsonProperty("expire_fixedTerm_start")
|
||||
private LocalDateTime expireFixedTermStart;
|
||||
|
||||
@JsonProperty("expire_fixedTerm_end")
|
||||
private LocalDateTime expireFixedTermEnd;
|
||||
|
||||
@JsonProperty("expire_time_sec")
|
||||
private Integer expireTimeSec;
|
||||
|
||||
@JsonProperty("is_user_tradable")
|
||||
private Boolean isUserTradable;
|
||||
|
||||
@JsonProperty("is_system_tradable")
|
||||
private Boolean isSystemTradable;
|
||||
|
||||
@JsonProperty("sell_price_type")
|
||||
private String sellPriceType;
|
||||
|
||||
@JsonProperty("sell_id")
|
||||
private Integer sellId;
|
||||
|
||||
@JsonProperty("sell_price")
|
||||
private Integer sellPrice;
|
||||
|
||||
@JsonProperty("order")
|
||||
private Integer order;
|
||||
|
||||
@JsonProperty("is_throwable")
|
||||
private Boolean isThrowable;
|
||||
|
||||
@JsonProperty("ActionType")
|
||||
private String actionType;
|
||||
|
||||
@JsonProperty("ActionValue")
|
||||
private Integer actionValue;
|
||||
|
||||
@JsonProperty("DetailOffset")
|
||||
private Float detailOffset;
|
||||
|
||||
@JsonProperty("DetailScale")
|
||||
private Float detailScale;
|
||||
|
||||
@JsonProperty("GuidePopup")
|
||||
private Integer guidePopup;
|
||||
|
||||
@JsonProperty("DetailRoll")
|
||||
private Float detailRoll;
|
||||
|
||||
@JsonProperty("DetailPitch")
|
||||
private Float detailPitch;
|
||||
|
||||
@JsonProperty("DetailCameraRight")
|
||||
private Float detailCameraRight;
|
||||
|
||||
@JsonProperty("DetailCameraHeight")
|
||||
private Float detailCameraHeight;
|
||||
|
||||
@JsonProperty("DetailCameraAngle")
|
||||
private Float detailCameraAngle;
|
||||
|
||||
@JsonProperty("Rarity")
|
||||
private String rarity;
|
||||
|
||||
@JsonProperty("DefaultAttribute")
|
||||
private String defaultAttribute;
|
||||
|
||||
@JsonProperty("AttributeRandomGroupID")
|
||||
private String attributeRandomGroupId;
|
||||
|
||||
@JsonProperty("ItemSetID")
|
||||
private Integer itemSetId;
|
||||
|
||||
@JsonProperty("GachaGroupId")
|
||||
private Integer gachaGroupId;
|
||||
|
||||
@JsonProperty("Buy_Price_Type")
|
||||
private String buyPriceType;
|
||||
|
||||
@JsonProperty("Buy_id")
|
||||
private Integer buyId;
|
||||
|
||||
@JsonProperty("Buy_price")
|
||||
private Integer buyPrice;
|
||||
|
||||
@JsonProperty("buff_id")
|
||||
private Integer buffId;
|
||||
|
||||
@JsonProperty("ProductLink")
|
||||
private String productLink;
|
||||
|
||||
@JsonProperty("is_CartNBuy")
|
||||
private Boolean isCartNBuy;
|
||||
|
||||
@JsonProperty("Buy_Discount_Rate")
|
||||
private Integer buyDiscountRate;
|
||||
|
||||
@JsonProperty("PropSmallType")
|
||||
private String propSmallType;
|
||||
|
||||
@JsonProperty("UGQAction")
|
||||
private String ugqAction;
|
||||
|
||||
@JsonProperty("LinkedLand")
|
||||
private Integer linkedLand;
|
||||
|
||||
@JsonProperty("IsUiOnly")
|
||||
private Boolean isUiOnly;
|
||||
|
||||
@JsonProperty("BeaconShopGoldFee")
|
||||
private Integer beaconShopGoldFee;
|
||||
|
||||
@JsonProperty("is_BeaconShop")
|
||||
private Boolean isBeaconShop;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.caliverse.admin.domain.entity.metadata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class MetaItemSetData {
|
||||
@JsonProperty("ID")
|
||||
private int id;
|
||||
|
||||
@JsonProperty("Name")
|
||||
private String name;
|
||||
|
||||
@JsonProperty("Items")
|
||||
private List<String> items;
|
||||
|
||||
@JsonProperty("SetEfffects")
|
||||
private List<SetEffect> setEffects;
|
||||
|
||||
@Data
|
||||
public static class SetEffect {
|
||||
@JsonProperty("RequirementCount")
|
||||
private int requirementCount;
|
||||
|
||||
@JsonProperty("AttributeName")
|
||||
private String attributeName;
|
||||
|
||||
@JsonProperty("AttributeValue")
|
||||
private int attributeValue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.caliverse.admin.domain.entity.metadata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MetaWebLinkData {
|
||||
@JsonProperty("Key")
|
||||
private String key;
|
||||
|
||||
@JsonProperty("Ko")
|
||||
private String ko;
|
||||
|
||||
@JsonProperty("En")
|
||||
private String en;
|
||||
|
||||
@JsonProperty("Ja")
|
||||
private String ja;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.caliverse.admin.domain.response;
|
||||
|
||||
import com.caliverse.admin.domain.entity.ItemDict;
|
||||
import com.caliverse.admin.domain.entity.metadata.MetaBrandData;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DictionaryResponse {
|
||||
private int status;
|
||||
|
||||
private String result;
|
||||
@JsonProperty("data")
|
||||
private ResultData resultData;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public static class ResultData {
|
||||
|
||||
@JsonProperty("item_list")
|
||||
private ItemList itemList;
|
||||
|
||||
@JsonProperty("brand_list")
|
||||
private List<MetaBrandData> brandList;
|
||||
|
||||
private String message;
|
||||
|
||||
private int total;
|
||||
@JsonProperty("total_all")
|
||||
private int totalAll;
|
||||
@JsonProperty("page_no")
|
||||
private int pageNo;
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public static class ItemList {
|
||||
@JsonProperty("ko")
|
||||
private List<ItemDict> ko;
|
||||
|
||||
@JsonProperty("en")
|
||||
private List<ItemDict> en;
|
||||
|
||||
@JsonProperty("ja")
|
||||
private List<ItemDict> ja;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
package com.caliverse.admin.domain.service;
|
||||
|
||||
import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
|
||||
import com.caliverse.admin.domain.entity.*;
|
||||
import com.caliverse.admin.domain.entity.metadata.MetaBattleConfigData;
|
||||
import com.caliverse.admin.domain.entity.metadata.MetaBrandData;
|
||||
import com.caliverse.admin.domain.entity.metadata.MetaItemData;
|
||||
import com.caliverse.admin.domain.response.BattleEventResponse;
|
||||
import com.caliverse.admin.domain.response.DictionaryResponse;
|
||||
import com.caliverse.admin.global.common.annotation.RequestLog;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class MetaDataService {
|
||||
|
||||
@Autowired
|
||||
private MetaDataHandler metaDataHandler;
|
||||
|
||||
public DictionaryResponse getBrandList(){
|
||||
|
||||
List<MetaBrandData> list = metaDataHandler.getMetaBrandListData();
|
||||
|
||||
List<MetaBrandData> items = list.stream()
|
||||
.peek(data -> {
|
||||
String name = metaDataHandler.getTextStringData(data.getBrandName());
|
||||
data.setBrandDesc(name);
|
||||
}).toList();
|
||||
|
||||
return DictionaryResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
.resultData(DictionaryResponse.ResultData.builder()
|
||||
.brandList(items)
|
||||
.build()
|
||||
)
|
||||
.build();
|
||||
}
|
||||
|
||||
//아이템 백과사전
|
||||
@RequestLog
|
||||
public DictionaryResponse getItemDictList(@RequestParam Map<String, String> requestParam){
|
||||
String searchType = requestParam.get("search_type");
|
||||
String searchData = requestParam.get("search_data").trim();
|
||||
String largeType = requestParam.get("large_type");
|
||||
String smallType = requestParam.get("small_type");
|
||||
String brand = requestParam.get("brand");
|
||||
String gender = requestParam.get("gender");
|
||||
String orderBy = requestParam.get("orderby");
|
||||
String pageNo = requestParam.get("page_no");
|
||||
String pageSize = requestParam.get("page_size");
|
||||
|
||||
List<MetaItemData> items = metaDataHandler.getMetaItemListData();
|
||||
|
||||
List<ItemDict> itemDictListKo = createItemDictList(items, LANGUAGETYPE.KO, searchType, searchData, largeType, smallType, brand, gender);
|
||||
List<ItemDict> itemDictListEn = createItemDictList(items, LANGUAGETYPE.EN, searchType, searchData, largeType, smallType, brand, gender);
|
||||
List<ItemDict> itemDictListJa = createItemDictList(items, LANGUAGETYPE.JA, searchType, searchData, largeType, smallType, brand, gender);
|
||||
|
||||
int totalAll = itemDictListKo.size();
|
||||
|
||||
if(orderBy != null && !orderBy.isEmpty()) {
|
||||
Comparator<ItemDict> comparator = null;
|
||||
|
||||
if(orderBy.equalsIgnoreCase("ASC")) {
|
||||
comparator = Comparator.comparing(ItemDict::getItemId);
|
||||
} else if(orderBy.equalsIgnoreCase("DESC")) {
|
||||
comparator = Comparator.comparing(ItemDict::getItemId).reversed();
|
||||
}
|
||||
|
||||
if(comparator != null) {
|
||||
itemDictListKo = itemDictListKo.stream().sorted(comparator).toList();
|
||||
itemDictListEn = itemDictListEn.stream().sorted(comparator).toList();
|
||||
itemDictListJa = itemDictListJa.stream().sorted(comparator).toList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 페이징 처리
|
||||
int currentPageNo = 1;
|
||||
int currentPageSize = 10; // 기본값
|
||||
|
||||
if(pageNo != null && !pageNo.isEmpty()) {
|
||||
try {
|
||||
currentPageNo = Integer.parseInt(pageNo);
|
||||
} catch(NumberFormatException e) {
|
||||
currentPageNo = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(pageSize != null && !pageSize.isEmpty()) {
|
||||
try {
|
||||
currentPageSize = Integer.parseInt(pageSize);
|
||||
} catch(NumberFormatException e) {
|
||||
currentPageSize = 10;
|
||||
}
|
||||
}
|
||||
|
||||
// offset 계산
|
||||
int offset = (currentPageNo - 1) * currentPageSize;
|
||||
|
||||
// 페이징 적용
|
||||
List<ItemDict> pagedItemDictListKo = itemDictListKo.stream()
|
||||
.skip(offset)
|
||||
.limit(currentPageSize)
|
||||
.toList();
|
||||
|
||||
List<ItemDict> pagedItemDictListEn = itemDictListEn.stream()
|
||||
.skip(offset)
|
||||
.limit(currentPageSize)
|
||||
.toList();
|
||||
|
||||
List<ItemDict> pagedItemDictListJa = itemDictListJa.stream()
|
||||
.skip(offset)
|
||||
.limit(currentPageSize)
|
||||
.toList();
|
||||
|
||||
DictionaryResponse.ItemList itemTotalList = DictionaryResponse.ItemList.builder()
|
||||
.ko(pagedItemDictListKo)
|
||||
.en(pagedItemDictListEn)
|
||||
.ja(pagedItemDictListJa)
|
||||
.build();
|
||||
|
||||
|
||||
return DictionaryResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
.resultData(DictionaryResponse.ResultData.builder()
|
||||
.itemList(itemTotalList)
|
||||
.totalAll(totalAll)
|
||||
.total(pagedItemDictListKo.size())
|
||||
.pageNo(currentPageNo)
|
||||
.build()
|
||||
)
|
||||
.build();
|
||||
}
|
||||
|
||||
private List<ItemDict> createItemDictList(List<MetaItemData> items, LANGUAGETYPE languageType,
|
||||
String searchType, String searchData, String largeType,
|
||||
String smallType, String brand, String gender) {
|
||||
return items.stream()
|
||||
.filter(data -> {
|
||||
boolean result = true;
|
||||
|
||||
if(!largeType.equals("ALL")){
|
||||
result = data.getLargeType().equals(largeType);
|
||||
}
|
||||
|
||||
if(!smallType.equals("ALL")){
|
||||
result = result && data.getSmallType().equals(smallType);
|
||||
}
|
||||
|
||||
if(!brand.equals("ALL")){
|
||||
result = result && data.getBrand().equals(Integer.valueOf(brand));
|
||||
}
|
||||
|
||||
if(!gender.equals("ALL")){
|
||||
result = result && data.getGender().equals(gender);
|
||||
}
|
||||
|
||||
return result;
|
||||
})
|
||||
.map(item -> {
|
||||
String buffName = metaDataHandler.getMetaBuffName(item.getBuffId());
|
||||
String brandName = metaDataHandler.getMetaBrandName(item.getBrand());
|
||||
String randomGroupAttribName = metaDataHandler.getMetaAttribData(item.getAttributeRandomGroupId());
|
||||
String itemSetName = metaDataHandler.getMetaItemSetName(item.getItemSetId());
|
||||
Integer gachaGroupId = metaDataHandler.getMetaGachaGroupId(item.getGachaGroupId());
|
||||
String webLink = metaDataHandler.getMetaWebLinkData(item.getProductLink(), languageType);
|
||||
String currencySellName = metaDataHandler.getMetaCurrencyName(item.getSellId());
|
||||
String currencyBuyName = metaDataHandler.getMetaCurrencyName(item.getBuyId());
|
||||
|
||||
ItemDict.Country country = ItemDict.Country.builder()
|
||||
.maxCount(item.getMaxCount())
|
||||
.stackMaxCount(item.getStackMaxCount())
|
||||
.build();
|
||||
|
||||
ItemDict.Attrib attrib = ItemDict.Attrib.builder()
|
||||
.rarity(item.getRarity())
|
||||
.defaultAttrib(item.getDefaultAttribute())
|
||||
.attribRandomGroup(randomGroupAttribName)
|
||||
.itemSet(metaDataHandler.getTextStringData(itemSetName, languageType))
|
||||
.buff(metaDataHandler.getTextStringData(buffName, languageType))
|
||||
.build();
|
||||
|
||||
ItemDict.Expire expire = ItemDict.Expire.builder()
|
||||
.expireType(item.getExpireType())
|
||||
.expireStartDt(item.getExpireFixedTermStart())
|
||||
.expireEndDt(item.getExpireFixedTermEnd())
|
||||
.expireTimeSec(item.getExpireTimeSec())
|
||||
.build();
|
||||
|
||||
ItemDict.Trade trade = ItemDict.Trade.builder()
|
||||
.userTradable(item.getIsUserTradable())
|
||||
.cartBuy(item.getIsCartNBuy())
|
||||
.throwable(item.getIsThrowable())
|
||||
.systemTradable(item.getIsSystemTradable())
|
||||
.build();
|
||||
|
||||
ItemDict.Etc etc = ItemDict.Etc.builder()
|
||||
.productLink(webLink)
|
||||
.propSmallType(item.getPropSmallType())
|
||||
.gachaGroupId(gachaGroupId)
|
||||
.ugqAction(item.getUgqAction())
|
||||
.linkedLand(item.getLinkedLand())
|
||||
.build();
|
||||
|
||||
return ItemDict.builder()
|
||||
.itemId(item.getItemId())
|
||||
.itemName(metaDataHandler.getTextStringData(item.getName(), languageType))
|
||||
.gender(item.getGender())
|
||||
.typeLarge(item.getLargeType())
|
||||
.typeSmall(item.getSmallType())
|
||||
.brand(metaDataHandler.getTextStringData(brandName, languageType))
|
||||
.sellType(metaDataHandler.getTextStringData(currencySellName, LANGUAGETYPE.KO))
|
||||
.sellPrice(item.getSellPrice())
|
||||
.buyType(metaDataHandler.getTextStringData(currencyBuyName, LANGUAGETYPE.KO))
|
||||
.buyPrice(item.getBuyPrice())
|
||||
.buyDiscountRate(item.getBuyDiscountRate())
|
||||
.country(country)
|
||||
.attrib(attrib)
|
||||
.expire(expire)
|
||||
.trade(trade)
|
||||
.etc(etc)
|
||||
.build();
|
||||
}).filter(data -> {
|
||||
boolean result = true;
|
||||
|
||||
if(!searchData.isEmpty()){
|
||||
if(searchType.equals("NAME")){
|
||||
result = data.getItemName().contains(searchData);
|
||||
}
|
||||
|
||||
if(searchType.equals("ID")){
|
||||
result = data.getItemId().toString().equals(searchData);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.caliverse.admin.global.common.utils;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DataHelper {
|
||||
public static LocalDateTime parseDateTime(Object dateObj) {
|
||||
if (dateObj == null || dateObj.toString().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return LocalDateTime.parse(dateObj.toString().replace("+00:00", ""));
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to parse date: {}", dateObj);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Float parseFloat(Object floatObj) {
|
||||
if (floatObj == null) {
|
||||
return null;
|
||||
}
|
||||
if (floatObj instanceof Number) {
|
||||
return ((Number) floatObj).floatValue();
|
||||
}
|
||||
try {
|
||||
return Float.parseFloat(floatObj.toString());
|
||||
} catch (NumberFormatException e) {
|
||||
log.warn("Failed to parse float: {}", floatObj);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Double convertToDouble(Object value) {
|
||||
if (value == null) return null;
|
||||
if (value instanceof Double) return (Double) value;
|
||||
if (value instanceof Integer) return ((Integer) value).doubleValue();
|
||||
if (value instanceof Long) return ((Long) value).doubleValue();
|
||||
if (value instanceof String) {
|
||||
try {
|
||||
return Double.valueOf((String) value);
|
||||
} catch (NumberFormatException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user