dynamodb 퀘스트, 캐릭터 domain 형식으로 변경
This commit is contained in:
@@ -146,86 +146,86 @@ public class DynamoDBService {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// 유저조회 - 아바타
|
// 유저조회 - 아바타
|
||||||
public Map<String, Object> getAvatarInfo(String guid){
|
// public Map<String, Object> getAvatarInfo(String guid){
|
||||||
Map<String, Object> resMap = new HashMap<>();
|
// Map<String, Object> resMap = new HashMap<>();
|
||||||
|
//
|
||||||
String key = "PK = :pkValue";
|
// String key = "PK = :pkValue";
|
||||||
Map<String, AttributeValue> values = Map.of(":pkValue", AttributeValue.builder().s("character_base#"+guid).build());
|
// Map<String, AttributeValue> values = Map.of(":pkValue", AttributeValue.builder().s("character_base#"+guid).build());
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
excuteItems(executeQuery(key, values), "CharacterBaseAttrib")
|
// excuteItems(executeQuery(key, values), "CharacterBaseAttrib")
|
||||||
.forEach(attrMap -> {
|
// .forEach(attrMap -> {
|
||||||
Map<String, Object> profile = (Map<String, Object>) attrMap.get("appearance_profile");
|
// Map<String, Object> profile = (Map<String, Object>) attrMap.get("appearance_profile");
|
||||||
|
//
|
||||||
//Object customValue = attrMap.get("CustomValue");
|
// //Object customValue = attrMap.get("CustomValue");
|
||||||
resMap.put("avatarInfo", UsersResponse.AvatarInfo.builder()
|
// resMap.put("avatarInfo", UsersResponse.AvatarInfo.builder()
|
||||||
.characterId(CommonUtils.objectToString(attrMap.get("character_guid")))
|
// .characterId(CommonUtils.objectToString(attrMap.get("character_guid")))
|
||||||
.basicstyle(CommonUtils.objectToString(profile.get("basic_style")))
|
// .basicstyle(CommonUtils.objectToString(profile.get("basic_style")))
|
||||||
.hairstyle(CommonUtils.objectToString(profile.get("hair_style")))
|
// .hairstyle(CommonUtils.objectToString(profile.get("hair_style")))
|
||||||
.facesCustomizing(CommonUtils.objectToIntArray(profile.get("custom_values")))
|
// .facesCustomizing(CommonUtils.objectToIntArray(profile.get("custom_values")))
|
||||||
.bodyshape(CommonUtils.objectToString(profile.get("body_shape")))
|
// .bodyshape(CommonUtils.objectToString(profile.get("body_shape")))
|
||||||
.build());
|
// .build());
|
||||||
});
|
// });
|
||||||
log.info("getAvatarInfo AvatarInfo: {}", resMap);
|
// log.info("getAvatarInfo AvatarInfo: {}", resMap);
|
||||||
|
//
|
||||||
return resMap;
|
// return resMap;
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
//퀘스트 조회
|
//퀘스트 조회
|
||||||
public List<UsersResponse.QuestInfo> getQuest(String guid){
|
// public List<UsersResponse.QuestInfo> getQuest(String guid){
|
||||||
List<UsersResponse.QuestInfo> res = new ArrayList<>();
|
// List<UsersResponse.QuestInfo> res = new ArrayList<>();
|
||||||
String key = "PK = :pkValue";
|
// String key = "PK = :pkValue";
|
||||||
Map<String, AttributeValue> values = Map.of(":pkValue", AttributeValue.builder().s("quest#"+guid).build());
|
// Map<String, AttributeValue> values = Map.of(":pkValue", AttributeValue.builder().s("quest#"+guid).build());
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
excuteItems(executeQuery(key, values), "QuestAttrib")
|
// excuteItems(executeQuery(key, values), "QuestAttrib")
|
||||||
.forEach(attrMap -> {
|
// .forEach(attrMap -> {
|
||||||
Integer questId = (Integer) attrMap.get("quest_id");
|
// Integer questId = (Integer) attrMap.get("quest_id");
|
||||||
Integer current_task_no = (Integer)attrMap.get("current_task_num");
|
// Integer current_task_no = (Integer)attrMap.get("current_task_num");
|
||||||
List<MetaQuestData> metaQuests = metaDataHandler.getMetaQuestData(questId);
|
// List<MetaQuestData> metaQuests = metaDataHandler.getMetaQuestData(questId);
|
||||||
// 상세보기 퀘스트 전체 리스트
|
// // 상세보기 퀘스트 전체 리스트
|
||||||
|
//
|
||||||
List<UsersResponse.Quest> detailQuests = metaQuests.stream()
|
// List<UsersResponse.Quest> detailQuests = metaQuests.stream()
|
||||||
.map(metaData -> UsersResponse.Quest.builder()
|
// .map(metaData -> UsersResponse.Quest.builder()
|
||||||
.questId(metaData.getQuestId())
|
// .questId(metaData.getQuestId())
|
||||||
.taskNo(metaData.getTaskNum())
|
// .taskNo(metaData.getTaskNum())
|
||||||
.questName(metaDataHandler.getTextStringData(metaData.getTaskName()))
|
// .questName(metaDataHandler.getTextStringData(metaData.getTaskName()))
|
||||||
.counter(metaData.getCounter())
|
// .counter(metaData.getCounter())
|
||||||
.status(current_task_no > metaData.getTaskNum() ? "완료" : "미완료" )
|
// .status(current_task_no > metaData.getTaskNum() ? "완료" : "미완료" )
|
||||||
.build())
|
// .build())
|
||||||
.toList();
|
// .toList();
|
||||||
|
//
|
||||||
//퀘스트 명칭
|
// //퀘스트 명칭
|
||||||
String taskName = metaQuests.stream()
|
// String taskName = metaQuests.stream()
|
||||||
.filter(attr -> attr.getTaskNum().equals(current_task_no))
|
// .filter(attr -> attr.getTaskNum().equals(current_task_no))
|
||||||
.map(MetaQuestData::getTaskName)
|
// .map(MetaQuestData::getTaskName)
|
||||||
.findFirst().orElse(null);
|
// .findFirst().orElse(null);
|
||||||
|
//
|
||||||
UsersResponse.QuestInfo questInfo = UsersResponse.QuestInfo.builder()
|
// UsersResponse.QuestInfo questInfo = UsersResponse.QuestInfo.builder()
|
||||||
.questId(questId)
|
// .questId(questId)
|
||||||
.questName(metaDataHandler.getTextStringData(taskName))
|
// .questName(metaDataHandler.getTextStringData(taskName))
|
||||||
.status(CommonUtils.objectToString(attrMap.get("is_complete")))
|
// .status(CommonUtils.objectToString(attrMap.get("is_complete")))
|
||||||
.assignTime((String) attrMap.get("quest_assign_time"))
|
// .assignTime((String) attrMap.get("quest_assign_time"))
|
||||||
.type((String) attrMap.get("quest_type"))
|
// .type((String) attrMap.get("quest_type"))
|
||||||
.startTime((String) attrMap.get("task_start_time"))
|
// .startTime((String) attrMap.get("task_start_time"))
|
||||||
.completeTime((String) attrMap.get("quest_complete_time"))
|
// .completeTime((String) attrMap.get("quest_complete_time"))
|
||||||
.currentTaskNum((Integer) attrMap.get("current_task_num"))
|
// .currentTaskNum((Integer) attrMap.get("current_task_num"))
|
||||||
.detailQuest(detailQuests)
|
// .detailQuest(detailQuests)
|
||||||
.build();
|
// .build();
|
||||||
|
//
|
||||||
res.add(questInfo);
|
// res.add(questInfo);
|
||||||
});
|
// });
|
||||||
log.info("getQuest QuestInfo: {}", res);
|
// log.info("getQuest QuestInfo: {}", res);
|
||||||
|
//
|
||||||
return res;
|
// return res;
|
||||||
|
//
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// dynamoDB 쿼리 리턴
|
// dynamoDB 쿼리 리턴
|
||||||
public QueryResponse executeQuery(String key, Map<String, AttributeValue> values) {
|
public QueryResponse executeQuery(String key, Map<String, AttributeValue> values) {
|
||||||
|
|||||||
@@ -16,10 +16,7 @@ import com.caliverse.admin.dynamodb.domain.atrrib.MailJsonAttrib;
|
|||||||
import com.caliverse.admin.dynamodb.domain.atrrib.MoneyAttrib;
|
import com.caliverse.admin.dynamodb.domain.atrrib.MoneyAttrib;
|
||||||
import com.caliverse.admin.dynamodb.domain.doc.MailDoc;
|
import com.caliverse.admin.dynamodb.domain.doc.MailDoc;
|
||||||
import com.caliverse.admin.dynamodb.dto.PageResult;
|
import com.caliverse.admin.dynamodb.dto.PageResult;
|
||||||
import com.caliverse.admin.dynamodb.service.DynamodbItemService;
|
import com.caliverse.admin.dynamodb.service.*;
|
||||||
import com.caliverse.admin.dynamodb.service.DynamodbMailService;
|
|
||||||
import com.caliverse.admin.dynamodb.service.DynamodbService;
|
|
||||||
import com.caliverse.admin.dynamodb.service.DynamodbUserService;
|
|
||||||
import com.caliverse.admin.redis.service.RedisUserInfoService;
|
import com.caliverse.admin.redis.service.RedisUserInfoService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -52,6 +49,7 @@ public class UsersService {
|
|||||||
private final DynamodbUserService dynamodbUserService;
|
private final DynamodbUserService dynamodbUserService;
|
||||||
private final DynamodbItemService dynamodbItemService;
|
private final DynamodbItemService dynamodbItemService;
|
||||||
private final DynamodbMailService dynamodbMailService;
|
private final DynamodbMailService dynamodbMailService;
|
||||||
|
private final DynamodbQuestService dynamodbQuestService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MetaDataHandler metaDataHandler;
|
private MetaDataHandler metaDataHandler;
|
||||||
@@ -202,7 +200,8 @@ public class UsersService {
|
|||||||
public UsersResponse getAvatarInfo(String guid){
|
public UsersResponse getAvatarInfo(String guid){
|
||||||
|
|
||||||
//avatarInfo
|
//avatarInfo
|
||||||
Map<String, Object> charInfo = dynamoDBService.getAvatarInfo(guid);
|
// Map<String, Object> charInfo = dynamoDBService.getAvatarInfo(guid);
|
||||||
|
Map<String, Object> charInfo = dynamodbUserService.getAvatarInfo(guid);
|
||||||
|
|
||||||
return UsersResponse.builder()
|
return UsersResponse.builder()
|
||||||
.resultData(
|
.resultData(
|
||||||
@@ -495,7 +494,8 @@ public class UsersService {
|
|||||||
//퀘스트 정보
|
//퀘스트 정보
|
||||||
public UsersResponse getQuest(String guid){
|
public UsersResponse getQuest(String guid){
|
||||||
|
|
||||||
List<UsersResponse.QuestInfo> questList = dynamoDBService.getQuest(guid);
|
// List<UsersResponse.QuestInfo> questList = dynamoDBService.getQuest(guid);
|
||||||
|
List<UsersResponse.QuestInfo> questList = dynamodbQuestService.getQuestItems(guid);
|
||||||
|
|
||||||
return UsersResponse.builder()
|
return UsersResponse.builder()
|
||||||
.resultData(
|
.resultData(
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.caliverse.admin.dynamodb.domain.atrrib;
|
||||||
|
|
||||||
|
import com.caliverse.admin.dynamodb.entity.*;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||||
|
import lombok.*;
|
||||||
|
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@NoArgsConstructor
|
||||||
|
@DynamoDbBean
|
||||||
|
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
|
||||||
|
public class CharacterBaseAttrib extends DynamoDBAttribBase {
|
||||||
|
@JsonProperty("character_guid")
|
||||||
|
private String characterGuid;
|
||||||
|
@JsonProperty("user_guid")
|
||||||
|
private String userGuid;
|
||||||
|
@JsonProperty("state_info")
|
||||||
|
private StateInfo stateInfo;
|
||||||
|
@JsonProperty("appearance_profile")
|
||||||
|
private AppearanceProfile appearanceProfile;
|
||||||
|
}
|
||||||
@@ -0,0 +1,146 @@
|
|||||||
|
package com.caliverse.admin.dynamodb.domain.atrrib;
|
||||||
|
|
||||||
|
import com.caliverse.admin.domain.entity.EQuestType;
|
||||||
|
import com.caliverse.admin.dynamodb.entity.UgqQuestInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||||
|
import lombok.*;
|
||||||
|
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbAttribute;
|
||||||
|
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@NoArgsConstructor
|
||||||
|
@DynamoDbBean
|
||||||
|
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
|
||||||
|
public class QuestAttrib{
|
||||||
|
@JsonProperty("quest_id")
|
||||||
|
private Integer questId;
|
||||||
|
@JsonProperty("quest_type")
|
||||||
|
private EQuestType questType;
|
||||||
|
@JsonProperty("ugq_quest_info")
|
||||||
|
private UgqQuestInfo ugqQuestInfo;
|
||||||
|
@JsonProperty("quest_assign_time")
|
||||||
|
private String questAssignTime;
|
||||||
|
@JsonProperty("current_task_num")
|
||||||
|
private Integer currentTaskNum;
|
||||||
|
@JsonProperty("task_start_time")
|
||||||
|
private String taskStartTime;
|
||||||
|
@JsonProperty("quest_complete_time")
|
||||||
|
private String questCompleteTime;
|
||||||
|
@JsonProperty("active_events")
|
||||||
|
private List<String> activeEvents;
|
||||||
|
@JsonProperty("has_counter")
|
||||||
|
private Integer hasCounter;
|
||||||
|
@JsonProperty("min_counter")
|
||||||
|
private Integer minCounter;
|
||||||
|
@JsonProperty("max_counter")
|
||||||
|
private Integer maxCounter;
|
||||||
|
@JsonProperty("current_counter")
|
||||||
|
private Integer currentCounter;
|
||||||
|
@JsonProperty("is_complete")
|
||||||
|
private Integer isComplete;
|
||||||
|
@JsonProperty("replaced_reward_groupId")
|
||||||
|
private Integer replacedRewardGroupId;
|
||||||
|
@JsonProperty("has_timer")
|
||||||
|
private Integer hasTimer;
|
||||||
|
@JsonProperty("timer_complete_time")
|
||||||
|
private String timerCompleteTime;
|
||||||
|
@JsonProperty("is_current_task_complete")
|
||||||
|
private Integer isCurrentTaskComplete;
|
||||||
|
@JsonProperty("completed_idx_strings")
|
||||||
|
private List<String> completedIdxStrings;
|
||||||
|
|
||||||
|
@DynamoDbAttribute("quest_id")
|
||||||
|
public Integer getQuestId() {
|
||||||
|
return questId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DynamoDbAttribute("quest_type")
|
||||||
|
public EQuestType getQuestType() {
|
||||||
|
return questType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DynamoDbAttribute("ugq_quest_info")
|
||||||
|
public UgqQuestInfo getUgqQuestInfo() {
|
||||||
|
return ugqQuestInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DynamoDbAttribute("quest_assign_time")
|
||||||
|
public String getQuestAssignTime() {
|
||||||
|
return questAssignTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DynamoDbAttribute("current_task_num")
|
||||||
|
public Integer getCurrentTaskNum() {
|
||||||
|
return currentTaskNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DynamoDbAttribute("task_start_time")
|
||||||
|
public String getTaskStartTime() {
|
||||||
|
return taskStartTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DynamoDbAttribute("quest_complete_time")
|
||||||
|
public String getQuestCompleteTime() {
|
||||||
|
return questCompleteTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DynamoDbAttribute("active_events")
|
||||||
|
public List<String> getActiveEvents() {
|
||||||
|
return activeEvents;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DynamoDbAttribute("has_counter")
|
||||||
|
public Integer getHasCounter() {
|
||||||
|
return hasCounter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DynamoDbAttribute("min_counter")
|
||||||
|
public Integer getMinCounter() {
|
||||||
|
return minCounter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DynamoDbAttribute("max_counter")
|
||||||
|
public Integer getMaxCounter() {
|
||||||
|
return maxCounter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DynamoDbAttribute("current_counter")
|
||||||
|
public Integer getCurrentCounter() {
|
||||||
|
return currentCounter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DynamoDbAttribute("is_complete")
|
||||||
|
public Integer getIsComplete() {
|
||||||
|
return isComplete;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DynamoDbAttribute("replaced_reward_groupId")
|
||||||
|
public Integer getReplacedRewardGroupId() {
|
||||||
|
return replacedRewardGroupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DynamoDbAttribute("has_timer")
|
||||||
|
public Integer getHasTimer() {
|
||||||
|
return hasTimer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DynamoDbAttribute("timer_complete_time")
|
||||||
|
public String getTimerCompleteTime() {
|
||||||
|
return timerCompleteTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DynamoDbAttribute("is_current_task_complete")
|
||||||
|
public Integer getIsCurrentTaskComplete() {
|
||||||
|
return isCurrentTaskComplete;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DynamoDbAttribute("completed_idx_strings")
|
||||||
|
public List<String> getCompletedIdxStrings() {
|
||||||
|
return completedIdxStrings;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.caliverse.admin.dynamodb.domain.doc;
|
||||||
|
|
||||||
|
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbAttribute;
|
||||||
|
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@NoArgsConstructor
|
||||||
|
@DynamoDbBean
|
||||||
|
public class CharacterBaseDoc extends DynamoDBDocBase {
|
||||||
|
private String characterBaseAttrib;
|
||||||
|
|
||||||
|
public String getAttribFieldName() {
|
||||||
|
return DynamoDBConstants.ATTRIB_CHARACTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DynamoDbAttribute(DynamoDBConstants.ATTRIB_CHARACTER)
|
||||||
|
@JsonProperty(DynamoDBConstants.ATTRIB_CHARACTER)
|
||||||
|
public String getAttribValue() {
|
||||||
|
return characterBaseAttrib;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAttribValue(String value) {
|
||||||
|
this.characterBaseAttrib = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.caliverse.admin.dynamodb.domain.doc;
|
||||||
|
|
||||||
|
import com.caliverse.admin.dynamodb.domain.atrrib.QuestAttrib;
|
||||||
|
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbAttribute;
|
||||||
|
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@NoArgsConstructor
|
||||||
|
@DynamoDbBean
|
||||||
|
public class QuestDoc extends DynamoDBDocBase {
|
||||||
|
private QuestAttrib questAttrib;
|
||||||
|
|
||||||
|
public String getAttribFieldName() {
|
||||||
|
return DynamoDBConstants.ATTRIB_QUEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DynamoDbAttribute(DynamoDBConstants.ATTRIB_QUEST)
|
||||||
|
public QuestAttrib getAttribValue() {
|
||||||
|
return questAttrib;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAttribValue(QuestAttrib value) {
|
||||||
|
this.questAttrib = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.caliverse.admin.dynamodb.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@DynamoDbBean
|
||||||
|
public class AppearanceProfile {
|
||||||
|
@JsonProperty("basic_style")
|
||||||
|
private Integer basicStyle;
|
||||||
|
@JsonProperty("body_shape")
|
||||||
|
private Integer bodyShape;
|
||||||
|
@JsonProperty("hair_style")
|
||||||
|
private Integer hairStyle;
|
||||||
|
@JsonProperty("custom_values")
|
||||||
|
private List<Integer> customValues;
|
||||||
|
@JsonProperty("is_custom_completed")
|
||||||
|
private boolean isCustomCompleted;
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.caliverse.admin.dynamodb.entity;
|
||||||
|
|
||||||
|
import com.caliverse.admin.domain.entity.common.ValueEnum;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
|
||||||
|
public enum ECountDeltaType implements ValueEnum {
|
||||||
|
None(0),
|
||||||
|
New(1),
|
||||||
|
Update(2),
|
||||||
|
Acquire(3),
|
||||||
|
Consume(4),
|
||||||
|
Delete(5),
|
||||||
|
;
|
||||||
|
|
||||||
|
private final int value;
|
||||||
|
|
||||||
|
ECountDeltaType(int value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonCreator
|
||||||
|
public static ECountDeltaType fromValue(Object value) {
|
||||||
|
if (value instanceof Number) {
|
||||||
|
int intValue = ((Number) value).intValue();
|
||||||
|
for (ECountDeltaType type : values()) {
|
||||||
|
if (type.value == intValue) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (value instanceof String) {
|
||||||
|
String stringValue = (String) value;
|
||||||
|
for (ECountDeltaType type : values()) {
|
||||||
|
if (type.name().equalsIgnoreCase(stringValue)) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("Invalid EAmountDeltaType value: " + value);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.caliverse.admin.dynamodb.entity;
|
||||||
|
|
||||||
|
|
||||||
|
import com.caliverse.admin.domain.entity.common.ValueEnum;
|
||||||
|
|
||||||
|
public enum EUgqStateType implements ValueEnum {
|
||||||
|
None(0),
|
||||||
|
Test(1),
|
||||||
|
Live(2),
|
||||||
|
Shutdown(3),
|
||||||
|
RevisionChanged(4),
|
||||||
|
Standby(5),
|
||||||
|
;
|
||||||
|
|
||||||
|
private final int value;
|
||||||
|
|
||||||
|
EUgqStateType(int value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package com.caliverse.admin.dynamodb.entity;
|
||||||
|
|
||||||
|
|
||||||
|
import com.caliverse.admin.domain.entity.common.ValueEnum;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
|
||||||
|
public enum EntityStateType implements ValueEnum {
|
||||||
|
None(0),
|
||||||
|
Created(1),
|
||||||
|
Initializing(2),
|
||||||
|
Loading(3),
|
||||||
|
Login(11),
|
||||||
|
Logout(111),
|
||||||
|
GameZoneEnter(15),
|
||||||
|
PlayReady(16),
|
||||||
|
Spawning(17),
|
||||||
|
SpawnedCutScene(18),
|
||||||
|
Alive(51),
|
||||||
|
Idle(511),
|
||||||
|
Think(512),
|
||||||
|
Move(513),
|
||||||
|
Roam(5131),
|
||||||
|
Walk(5132),
|
||||||
|
Run(5133),
|
||||||
|
Patrol(5134),
|
||||||
|
Chase(5135),
|
||||||
|
Dash(5136),
|
||||||
|
GoHome(5137),
|
||||||
|
Dancing(5138),
|
||||||
|
Battle(514),
|
||||||
|
SkillFire(5141),
|
||||||
|
Uncontrol(515),
|
||||||
|
Hide(516),
|
||||||
|
Pause(519),
|
||||||
|
Dead(61),
|
||||||
|
Revive(611),
|
||||||
|
GameZoneExit(99),
|
||||||
|
Activate(101),
|
||||||
|
Deactivate(102),
|
||||||
|
Drop(201),
|
||||||
|
UsingByCrafting(301),
|
||||||
|
UsingByFarming(302),
|
||||||
|
UsingByMyHome(303)
|
||||||
|
;
|
||||||
|
|
||||||
|
private final int value;
|
||||||
|
|
||||||
|
EntityStateType(int value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonCreator
|
||||||
|
public static EntityStateType fromValue(Object value) {
|
||||||
|
if (value instanceof Number) {
|
||||||
|
int intValue = ((Number) value).intValue();
|
||||||
|
for (EntityStateType type : values()) {
|
||||||
|
if (type.value == intValue) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (value instanceof String) {
|
||||||
|
String stringValue = (String) value;
|
||||||
|
for (EntityStateType type : values()) {
|
||||||
|
if (type.name().equalsIgnoreCase(stringValue)) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("Invalid ECurrencyType value: " + value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.caliverse.admin.dynamodb.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@DynamoDbBean
|
||||||
|
public class StateInfo {
|
||||||
|
@JsonProperty("StateType")
|
||||||
|
private Integer stateType;
|
||||||
|
|
||||||
|
@JsonProperty("AnchorMetaGuid")
|
||||||
|
private String anchorMetaGuid;
|
||||||
|
|
||||||
|
@JsonProperty("MetaIdOfStateType")
|
||||||
|
private Integer metaIdOfStateType;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.caliverse.admin.dynamodb.entity;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@DynamoDbBean
|
||||||
|
public class UgqQuestInfo {
|
||||||
|
private Integer QuestRevision;
|
||||||
|
private Integer QuestCost;
|
||||||
|
private EUgqStateType UqgState;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.caliverse.admin.dynamodb.repository;
|
||||||
|
|
||||||
|
import com.caliverse.admin.dynamodb.domain.atrrib.CharacterBaseAttrib;
|
||||||
|
import com.caliverse.admin.dynamodb.domain.doc.CharacterBaseDoc;
|
||||||
|
|
||||||
|
public interface CharacterBaseRepository extends DynamoDBRepository<CharacterBaseDoc> {
|
||||||
|
CharacterBaseAttrib findCharacter(String guid);
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.caliverse.admin.dynamodb.repository.Impl;
|
||||||
|
|
||||||
|
import com.caliverse.admin.dynamodb.domain.atrrib.CharacterBaseAttrib;
|
||||||
|
import com.caliverse.admin.dynamodb.domain.doc.CharacterBaseDoc;
|
||||||
|
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
|
||||||
|
import com.caliverse.admin.dynamodb.repository.CharacterBaseRepository;
|
||||||
|
import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
|
||||||
|
import com.caliverse.admin.global.common.code.CommonCode;
|
||||||
|
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||||
|
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
||||||
|
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||||
|
import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import software.amazon.awssdk.enhanced.dynamodb.Key;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class CharacterBaseRepositoryImpl extends BaseDynamoDBRepository<CharacterBaseDoc> implements CharacterBaseRepository {
|
||||||
|
public CharacterBaseRepositoryImpl(DynamoDBOperations operations, DynamodbHistoryLogService dynamodbHistoryLogService, ObjectMapper objectMapper) {
|
||||||
|
super(operations, CharacterBaseDoc.class, dynamodbHistoryLogService, objectMapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CharacterBaseAttrib findCharacter(String guid) {
|
||||||
|
Key key = Key.builder()
|
||||||
|
.partitionValue(DynamoDBConstants.PK_KEY_CHARACTER + guid)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
List<CharacterBaseDoc> docList = findAll(key);
|
||||||
|
CharacterBaseDoc doc = docList.get(0);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return objectMapper.readValue(doc.getAttribValue(), CharacterBaseAttrib.class);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
package com.caliverse.admin.dynamodb.repository.Impl;
|
||||||
|
|
||||||
|
import com.caliverse.admin.domain.entity.EFilterOperator;
|
||||||
|
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||||
|
import com.caliverse.admin.dynamodb.domain.atrrib.QuestAttrib;
|
||||||
|
import com.caliverse.admin.dynamodb.domain.doc.QuestDoc;
|
||||||
|
import com.caliverse.admin.dynamodb.dto.PageResult;
|
||||||
|
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
|
||||||
|
import com.caliverse.admin.dynamodb.repository.QuestRepository;
|
||||||
|
import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
|
||||||
|
import com.caliverse.admin.global.common.code.CommonCode;
|
||||||
|
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||||
|
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
||||||
|
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||||
|
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||||
|
import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import software.amazon.awssdk.enhanced.dynamodb.Key;
|
||||||
|
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class QuestRepositoryImpl extends BaseDynamoDBRepository<QuestDoc> implements QuestRepository {
|
||||||
|
public QuestRepositoryImpl(DynamoDBOperations operations, DynamodbHistoryLogService dynamodbHistoryLogService, ObjectMapper objectMapper) {
|
||||||
|
super(operations, QuestDoc.class, dynamodbHistoryLogService, objectMapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<QuestDoc> getQuestListWithPaging(String userGuid, String sortKeyPrefix, String filterAttributeName, EFilterOperator filterOperator, String filterAttributeValue, Map<String, AttributeValue> exclusiveStartKey, boolean sortIndex) {
|
||||||
|
String pk = DynamoDBConstants.PK_KEY_QUEST + userGuid;;
|
||||||
|
|
||||||
|
return findByPaging(
|
||||||
|
pk,
|
||||||
|
sortKeyPrefix,
|
||||||
|
filterAttributeName,
|
||||||
|
filterOperator,
|
||||||
|
filterAttributeValue,
|
||||||
|
exclusiveStartKey,
|
||||||
|
sortIndex
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateQuest(String guid, Integer questId) {
|
||||||
|
try {
|
||||||
|
Key key = Key.builder()
|
||||||
|
.partitionValue(DynamoDBConstants.PK_KEY_QUEST + guid)
|
||||||
|
.sortValue(questId)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
QuestDoc beforeDoc = findById(key);
|
||||||
|
|
||||||
|
if (beforeDoc != null) {
|
||||||
|
QuestDoc afterDoc = deepCopy(beforeDoc, QuestDoc.class);
|
||||||
|
|
||||||
|
QuestAttrib attrib = afterDoc.getAttribValue();
|
||||||
|
|
||||||
|
afterDoc.setAttribValue(attrib);
|
||||||
|
afterDoc.setUpdatedDateTime(CommonUtils.convertUTCDate(LocalDateTime.now()));
|
||||||
|
|
||||||
|
update(afterDoc);
|
||||||
|
|
||||||
|
log.info("updateQuest Update Success: {}", CommonUtils.objectByString(afterDoc));
|
||||||
|
|
||||||
|
dynamodbHistoryLogService.updateHistoryLog(
|
||||||
|
HISTORYTYPEDETAIL.QUEST_UPDATE,
|
||||||
|
HISTORYTYPEDETAIL.QUEST_UPDATE.name(),
|
||||||
|
beforeDoc,
|
||||||
|
afterDoc
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("Update Quest Error: {}", e.getMessage());
|
||||||
|
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_ITEM_UPDATE_ERROR.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteItem(String userGuid, Integer questId) {
|
||||||
|
try {
|
||||||
|
Key key = Key.builder()
|
||||||
|
.partitionValue(DynamoDBConstants.PK_KEY_QUEST + userGuid)
|
||||||
|
.sortValue(questId)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
QuestDoc beforeDoc = findById(key);
|
||||||
|
|
||||||
|
if (beforeDoc != null) {
|
||||||
|
delete(key);
|
||||||
|
|
||||||
|
log.info("QuestDoc Delete Success: {}", CommonUtils.objectByString(beforeDoc));
|
||||||
|
|
||||||
|
dynamodbHistoryLogService.deleteHistoryLog(
|
||||||
|
HISTORYTYPEDETAIL.QUEST_DELETE,
|
||||||
|
HISTORYTYPEDETAIL.QUEST_DELETE.name(),
|
||||||
|
beforeDoc
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("Update QuestRegistry Error: {}", e.getMessage());
|
||||||
|
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_ITEM_DELETE_ERROR.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.caliverse.admin.dynamodb.repository;
|
||||||
|
|
||||||
|
import com.caliverse.admin.domain.entity.EFilterOperator;
|
||||||
|
import com.caliverse.admin.dynamodb.domain.doc.ItemDoc;
|
||||||
|
import com.caliverse.admin.dynamodb.domain.doc.QuestDoc;
|
||||||
|
import com.caliverse.admin.dynamodb.dto.PageResult;
|
||||||
|
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface QuestRepository extends DynamoDBRepository<QuestDoc> {
|
||||||
|
PageResult<QuestDoc> getQuestListWithPaging(
|
||||||
|
String userGuid,
|
||||||
|
String sortKeyPrefix,
|
||||||
|
String filterAttributeName,
|
||||||
|
EFilterOperator filterOperator,
|
||||||
|
String filterAttributeValue,
|
||||||
|
Map<String, AttributeValue> exclusiveStartKey,
|
||||||
|
boolean sortIndex
|
||||||
|
);
|
||||||
|
void updateQuest(String guid, Integer questId);
|
||||||
|
void deleteItem(String userGuid, Integer questId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
package com.caliverse.admin.dynamodb.service;
|
||||||
|
|
||||||
|
import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
|
||||||
|
import com.caliverse.admin.domain.entity.EFilterOperator;
|
||||||
|
import com.caliverse.admin.domain.entity.ITEMLARGETYPE;
|
||||||
|
import com.caliverse.admin.domain.entity.STATUSTYPE;
|
||||||
|
import com.caliverse.admin.domain.entity.metadata.MetaQuestData;
|
||||||
|
import com.caliverse.admin.domain.response.UsersResponse;
|
||||||
|
import com.caliverse.admin.dynamodb.domain.atrrib.ItemAttrib;
|
||||||
|
import com.caliverse.admin.dynamodb.domain.atrrib.QuestAttrib;
|
||||||
|
import com.caliverse.admin.dynamodb.domain.doc.ItemDoc;
|
||||||
|
import com.caliverse.admin.dynamodb.domain.doc.QuestDoc;
|
||||||
|
import com.caliverse.admin.dynamodb.dto.PageResult;
|
||||||
|
import com.caliverse.admin.dynamodb.entity.KeyParam;
|
||||||
|
import com.caliverse.admin.dynamodb.repository.QuestRepository;
|
||||||
|
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
||||||
|
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class DynamodbQuestService {
|
||||||
|
private final QuestRepository questRepository;
|
||||||
|
private final MetaDataHandler metaDataHandler;
|
||||||
|
|
||||||
|
public List<UsersResponse.QuestInfo> getQuestItems(String guid){
|
||||||
|
List<UsersResponse.QuestInfo> questInfoList = new ArrayList<>();
|
||||||
|
|
||||||
|
Map<String, AttributeValue> pageKey = null;
|
||||||
|
do {
|
||||||
|
PageResult<QuestDoc> questList = questRepository.getQuestListWithPaging(guid, "", DynamoDBConstants.ATTRIB_QUEST, null,"", pageKey, false);
|
||||||
|
|
||||||
|
questList.getItems().forEach(quest -> {
|
||||||
|
QuestAttrib attrib = quest.getAttribValue();
|
||||||
|
|
||||||
|
Integer questId = attrib.getQuestId();
|
||||||
|
Integer currentTaskNo = attrib.getCurrentTaskNum();
|
||||||
|
List<MetaQuestData> metaQuests = metaDataHandler.getMetaQuestData(questId);
|
||||||
|
|
||||||
|
List<UsersResponse.Quest> detailQuests = metaQuests.stream()
|
||||||
|
.map(metaData -> UsersResponse.Quest.builder()
|
||||||
|
.questId(metaData.getQuestId())
|
||||||
|
.taskNo(metaData.getTaskNum())
|
||||||
|
.questName(metaDataHandler.getTextStringData(metaData.getTaskName()))
|
||||||
|
.counter(metaData.getCounter())
|
||||||
|
.status(Objects.equals(currentTaskNo, metaData.getTaskNum()) ? "RUNNING" : currentTaskNo > metaData.getTaskNum() ? "COMPLETE" : "WAIT" )
|
||||||
|
.build())
|
||||||
|
.sorted(Comparator.comparing(UsersResponse.Quest::getTaskNo))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
String taskName = metaQuests.stream()
|
||||||
|
.filter(attr -> attr.getTaskNum().equals(currentTaskNo))
|
||||||
|
.map(MetaQuestData::getTaskName)
|
||||||
|
.findFirst().orElse(null);
|
||||||
|
|
||||||
|
UsersResponse.QuestInfo questInfo = UsersResponse.QuestInfo.builder()
|
||||||
|
.questId(questId)
|
||||||
|
.questName(metaDataHandler.getTextStringData(taskName))
|
||||||
|
.status(attrib.getIsComplete())
|
||||||
|
.assignTime(attrib.getQuestAssignTime())
|
||||||
|
.type(attrib.getQuestType().name())
|
||||||
|
.startTime(attrib.getTaskStartTime())
|
||||||
|
.completeTime(attrib.getQuestCompleteTime())
|
||||||
|
.currentTaskNum(attrib.getCurrentTaskNum())
|
||||||
|
.detailQuest(detailQuests)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
questInfoList.add(questInfo);
|
||||||
|
});
|
||||||
|
|
||||||
|
pageKey = questList.getLastEvaluatedKey();
|
||||||
|
} while (pageKey != null);
|
||||||
|
|
||||||
|
return questInfoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
package com.caliverse.admin.dynamodb.service;
|
package com.caliverse.admin.dynamodb.service;
|
||||||
|
|
||||||
import com.caliverse.admin.domain.entity.BlackList;
|
import com.caliverse.admin.domain.entity.BlackList;
|
||||||
|
import com.caliverse.admin.domain.response.UsersResponse;
|
||||||
import com.caliverse.admin.dynamodb.domain.atrrib.*;
|
import com.caliverse.admin.dynamodb.domain.atrrib.*;
|
||||||
|
import com.caliverse.admin.dynamodb.domain.doc.CharacterBaseDoc;
|
||||||
import com.caliverse.admin.dynamodb.domain.doc.UserNicknameRegistryDoc;
|
import com.caliverse.admin.dynamodb.domain.doc.UserNicknameRegistryDoc;
|
||||||
|
import com.caliverse.admin.dynamodb.entity.AppearanceProfile;
|
||||||
import com.caliverse.admin.dynamodb.entity.EAuthAdminLevelType;
|
import com.caliverse.admin.dynamodb.entity.EAuthAdminLevelType;
|
||||||
import com.caliverse.admin.dynamodb.repository.*;
|
import com.caliverse.admin.dynamodb.repository.*;
|
||||||
import com.caliverse.admin.global.common.annotation.DynamoDBTransaction;
|
import com.caliverse.admin.global.common.annotation.DynamoDBTransaction;
|
||||||
@@ -10,11 +13,16 @@ import com.caliverse.admin.global.common.code.CommonCode;
|
|||||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||||
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
||||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||||
|
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import software.amazon.awssdk.enhanced.dynamodb.Key;
|
import software.amazon.awssdk.enhanced.dynamodb.Key;
|
||||||
|
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -22,6 +30,7 @@ import software.amazon.awssdk.enhanced.dynamodb.Key;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class DynamodbUserService {
|
public class DynamodbUserService {
|
||||||
private final AccountBaseRepository accountBaseRepository;
|
private final AccountBaseRepository accountBaseRepository;
|
||||||
|
private final CharacterBaseRepository characterBaseRepository;
|
||||||
private final UserBaseRepository userBaseRepository;
|
private final UserBaseRepository userBaseRepository;
|
||||||
private final UserNicknameRegistryRepository userNicknameRegistryRepository;
|
private final UserNicknameRegistryRepository userNicknameRegistryRepository;
|
||||||
private final NicknameRepository nicknameRepository;
|
private final NicknameRepository nicknameRepository;
|
||||||
@@ -152,4 +161,31 @@ public class DynamodbUserService {
|
|||||||
nicknameRepository.updateNickname(guid, newNickname);
|
nicknameRepository.updateNickname(guid, newNickname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> getAvatarInfo(String guid){
|
||||||
|
Map<String, Object> resMap = new HashMap<>();
|
||||||
|
|
||||||
|
CharacterBaseAttrib characterBaseAttrib = characterBaseRepository.findCharacter(guid);
|
||||||
|
if(characterBaseAttrib == null){
|
||||||
|
log.error("getAvatarInfo characterBase Null guid: {}", guid);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
AppearanceProfile profile = characterBaseAttrib.getAppearanceProfile();
|
||||||
|
|
||||||
|
resMap.put("avatarInfo", UsersResponse.AvatarInfo.builder()
|
||||||
|
.characterId(characterBaseAttrib.getCharacterGuid())
|
||||||
|
.basicstyle(profile.getBasicStyle())
|
||||||
|
.hairstyle(profile.getHairStyle())
|
||||||
|
.facesCustomizing(profile.getCustomValues())
|
||||||
|
.bodyshape(profile.getBodyShape())
|
||||||
|
.build());
|
||||||
|
log.info("getAvatarInfo AvatarInfo: {}", resMap);
|
||||||
|
|
||||||
|
return resMap;
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ public class AdminConstants {
|
|||||||
public static final String MONGO_DB_COLLECTION_API_LOG = "apiLog";
|
public static final String MONGO_DB_COLLECTION_API_LOG = "apiLog";
|
||||||
public static final String MONGO_DB_COLLECTION_HISTORY_LOG = "historyLog";
|
public static final String MONGO_DB_COLLECTION_HISTORY_LOG = "historyLog";
|
||||||
public static final String MONGO_DB_COLLECTION_CURRENCY = "currency";
|
public static final String MONGO_DB_COLLECTION_CURRENCY = "currency";
|
||||||
|
public static final String MONGO_DB_COLLECTION_ITEM = "item";
|
||||||
|
|
||||||
public static final String MONGO_DB_KEY_LOGTIME = "logTime";
|
public static final String MONGO_DB_KEY_LOGTIME = "logTime";
|
||||||
public static final String MONGO_DB_KEY_LOGMONTH = "logMonth";
|
public static final String MONGO_DB_KEY_LOGMONTH = "logMonth";
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ public class DynamoDBConstants {
|
|||||||
public static final String PK_KEY_SENT_MAIL = "sent_mail#";
|
public static final String PK_KEY_SENT_MAIL = "sent_mail#";
|
||||||
public static final String PK_KEY_ITEM = "item#";
|
public static final String PK_KEY_ITEM = "item#";
|
||||||
public static final String PK_KEY_BANNER = "banner#global";
|
public static final String PK_KEY_BANNER = "banner#global";
|
||||||
|
public static final String PK_KEY_QUEST = "quest#";
|
||||||
|
public static final String PK_KEY_CHARACTER = "character_base#";
|
||||||
|
|
||||||
//SK
|
//SK
|
||||||
public static final String SK_KEY_NAME = "SK";
|
public static final String SK_KEY_NAME = "SK";
|
||||||
@@ -47,6 +49,8 @@ public class DynamoDBConstants {
|
|||||||
public static final String ATTRIB_MAIL = "MailAttrib";
|
public static final String ATTRIB_MAIL = "MailAttrib";
|
||||||
public static final String ATTRIB_ITEM = "ItemAttrib";
|
public static final String ATTRIB_ITEM = "ItemAttrib";
|
||||||
public static final String ATTRIB_BANNER = "BannerAttrib";
|
public static final String ATTRIB_BANNER = "BannerAttrib";
|
||||||
|
public static final String ATTRIB_QUEST = "QuestAttrib";
|
||||||
|
public static final String ATTRIB_CHARACTER = "CharacterBaseAttrib";
|
||||||
|
|
||||||
//DOC
|
//DOC
|
||||||
public static final String DOC_SYSTEMMAIL = "SystemMetaMailDoc";
|
public static final String DOC_SYSTEMMAIL = "SystemMetaMailDoc";
|
||||||
@@ -62,6 +66,8 @@ public class DynamoDBConstants {
|
|||||||
public static final String DOC_Mail = "MailDoc";
|
public static final String DOC_Mail = "MailDoc";
|
||||||
public static final String DOC_ITEM = "ItemDoc";
|
public static final String DOC_ITEM = "ItemDoc";
|
||||||
public static final String DOC_BANNER = "BannerDoc";
|
public static final String DOC_BANNER = "BannerDoc";
|
||||||
|
public static final String DOC_QUEST = "QuestDoc";
|
||||||
|
public static final String DOC_CHARACTER = "CharacterBaseDoc";
|
||||||
|
|
||||||
//SCHEMA
|
//SCHEMA
|
||||||
public static final String SCHEMA_UPDATE_TIME = "UpdatedDateTime";
|
public static final String SCHEMA_UPDATE_TIME = "UpdatedDateTime";
|
||||||
|
|||||||
Reference in New Issue
Block a user