dynamodb 랭커, 랭킹 스케줄, 월드이벤트 추가

This commit is contained in:
2025-09-15 15:58:32 +09:00
parent a5f21f6000
commit d74c1b67e3
16 changed files with 607 additions and 48 deletions

View File

@@ -0,0 +1,32 @@
package com.caliverse.admin.dynamodb.domain.atrrib;
import com.caliverse.admin.dynamodb.entity.EIntervalType;
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.Map;
@Getter
@Setter
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@DynamoDbBean
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class RankerAttrib extends DynamoDBAttribBase{
@JsonProperty("ranking_guid")
private String rankingGuid;
@JsonProperty("ranker_guid")
private String rankerGuid;
@JsonProperty("ranker_entity_type")
private String rankerEntityType;
private Integer score;
@JsonProperty("score_type")
private String scoreType;
@JsonProperty("update_time")
private String updateTime;
}

View File

@@ -0,0 +1,34 @@
package com.caliverse.admin.dynamodb.domain.atrrib;
import com.caliverse.admin.dynamodb.entity.EIntervalType;
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.Map;
@Getter
@Setter
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@DynamoDbBean
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class RankingScheduleAttrib extends DynamoDBAttribBase{
@JsonProperty("ranking_guid")
private String rankingGuid;
@JsonProperty("ranking_meta_id")
private Integer rankingMetaId;
@JsonProperty("event_action_score_group_id")
private Integer eventActionScoreGroupId;
@JsonProperty("start_time")
private String startTime;
@JsonProperty("end_time")
private String endTime;
@JsonProperty("interval_base_time")
private String intervalBaseTime;
private Map<EIntervalType, Integer> interval;
}

View File

@@ -0,0 +1,30 @@
package com.caliverse.admin.dynamodb.domain.atrrib;
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;
@Getter
@Setter
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@DynamoDbBean
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class WorldEventScheduleAttrib extends DynamoDBAttribBase{
private Integer id;
@JsonProperty("global_event_action_group_id")
private Integer globalEventActionGroupId;
@JsonProperty("personal_event_action_group_id")
private Integer personalEventActionGroupId;
@JsonProperty("global_event_contribution_point_max")
private Integer globalEventContributionPointMax;
@JsonProperty("start_time")
private String startTime;
@JsonProperty("end_time")
private String endTime;
@JsonProperty("is_active")
private boolean isActive;
}

View File

@@ -0,0 +1,33 @@
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 lombok.Setter;
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 RankerDoc extends DynamoDBDocBase {
private String attrib;
@Setter
private long ttl;
public String getAttribFieldName() {
return DynamoDBConstants.ATTRIB_RANKER;
}
@DynamoDbAttribute(DynamoDBConstants.ATTRIB_RANKER)
@JsonProperty(DynamoDBConstants.ATTRIB_RANKER)
public String getAttribValue() {
return attrib;
}
public void setAttribValue(String value) {
this.attrib = value;
}
}

View File

@@ -0,0 +1,33 @@
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 lombok.Setter;
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 RankingScheduleDoc extends DynamoDBDocBase {
private String attrib;
@Setter
private long ttl;
public String getAttribFieldName() {
return DynamoDBConstants.ATTRIB_RANKING_SCHEDULER;
}
@DynamoDbAttribute(DynamoDBConstants.ATTRIB_RANKING_SCHEDULER)
@JsonProperty(DynamoDBConstants.ATTRIB_RANKING_SCHEDULER)
public String getAttribValue() {
return attrib;
}
public void setAttribValue(String value) {
this.attrib = value;
}
}

View File

@@ -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 WorldEventScheduleDoc extends DynamoDBDocBase {
private String battleEventAttrib;
public String getAttribFieldName() {
return DynamoDBConstants.ATTRIB_RANKING_SCHEDULER;
}
@DynamoDbAttribute("BattleEventAttrib")
@JsonProperty("BattleEventAttrib")
public String getAttribValue() {
return battleEventAttrib;
}
public void setAttribValue(String value) {
this.battleEventAttrib = value;
}
}

View File

@@ -0,0 +1,23 @@
package com.caliverse.admin.dynamodb.entity;
import com.caliverse.admin.domain.entity.common.ValueEnum;
public enum EIntervalType implements ValueEnum {
None(0),
Refresh(1),
Initialization (2),
Snapshot (3),
;
private final int value;
EIntervalType(int value) {
this.value = value;
}
@Override
public int getValue() {
return value;
}
}

View File

@@ -0,0 +1,158 @@
package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.request.RankRequest;
import com.caliverse.admin.dynamodb.domain.atrrib.RankingScheduleAttrib;
import com.caliverse.admin.dynamodb.domain.doc.RankingScheduleDoc;
import com.caliverse.admin.dynamodb.entity.DynamodbOperationResult;
import com.caliverse.admin.dynamodb.entity.EIntervalType;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
import com.caliverse.admin.dynamodb.repository.RankingSchedulerRepository;
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 java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import static com.caliverse.admin.global.common.utils.CommonUtils.convertUTCDate;
@Component
@Slf4j
public class RankingScheduleRepositoryImpl extends BaseDynamoDBRepository<RankingScheduleDoc> implements RankingSchedulerRepository {
public RankingScheduleRepositoryImpl(DynamoDBOperations operations, DynamodbHistoryLogService dynamodbHistoryLogService, ObjectMapper objectMapper) {
super(operations, RankingScheduleDoc.class, dynamodbHistoryLogService, objectMapper);
}
private boolean isEvent(Integer sk){
Key key = Key.builder()
.partitionValue(DynamoDBConstants.PK_KEY_RANKING_SCHEDULER)
.sortValue(String.valueOf(sk))
.build();
RankingScheduleDoc doc = findById(key);
return doc != null;
}
@Override
public void insert(RankRequest rankRequest) {
if(isEvent(rankRequest.getId().intValue())){
log.error("insert EventId: {} is duplication", rankRequest.getId());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
LocalDateTime nowDate = LocalDateTime.now();
try {
RankingScheduleAttrib attrib = new RankingScheduleAttrib();
attrib.setAttribType(DynamoDBConstants.ATTRIB_RANKING_SCHEDULER);
attrib.setStartTime(convertUTCDate(rankRequest.getStartDt()));
attrib.setEndTime(convertUTCDate(rankRequest.getEndDt()));
attrib.setIntervalBaseTime(convertUTCDate(rankRequest.getBaseDt()));
attrib.setRankingGuid(rankRequest.getGuid());
attrib.setRankingMetaId(rankRequest.getMetaId());
attrib.setEventActionScoreGroupId(rankRequest.getEventActionId());
Map<EIntervalType, Integer> intervalList = new HashMap<>();
intervalList.put(EIntervalType.Refresh, rankRequest.getRefreshInterval());
intervalList.put(EIntervalType.Initialization, rankRequest.getInitializationInterval());
intervalList.put(EIntervalType.Snapshot, rankRequest.getSnapshotInterval());
attrib.setInterval(intervalList);
RankingScheduleDoc doc = new RankingScheduleDoc();
doc.setPK(DynamoDBConstants.PK_KEY_RANKING_SCHEDULER);
doc.setSK(rankRequest.getGuid());
doc.setDocType(DynamoDBConstants.DOC_RANKING_SCHEDULER);
doc.setAttribValue(objectMapper.writeValueAsString(attrib));
doc.setCreatedDateTime(convertUTCDate(nowDate));
doc.setUpdatedDateTime(convertUTCDate(nowDate));
doc.setDeletedDateTime(DynamoDBConstants.MIN_DATE);
doc.setRestoredDateTime(DynamoDBConstants.MIN_DATE);
save(doc);
}catch (Exception e){
log.error("insert Error: {}", e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
}
@Override
public void update(RankRequest rankRequest) {
LocalDateTime nowDate = LocalDateTime.now();
try {
Key key = Key.builder()
.partitionValue(DynamoDBConstants.PK_KEY_RANKING_SCHEDULER)
.sortValue(rankRequest.getGuid())
.build();
RankingScheduleDoc beforeDoc = findById(key);
if (beforeDoc != null) {
RankingScheduleDoc afterDoc = deepCopy(beforeDoc, RankingScheduleDoc.class);
RankingScheduleAttrib attrib = objectMapper.readValue(afterDoc.getAttribValue(), RankingScheduleAttrib.class);
attrib.setStartTime(convertUTCDate(rankRequest.getStartDt()));
attrib.setEndTime(convertUTCDate(rankRequest.getEndDt()));
attrib.setIntervalBaseTime(convertUTCDate(rankRequest.getBaseDt()));
attrib.setRankingGuid(rankRequest.getGuid());
attrib.setRankingMetaId(rankRequest.getMetaId());
attrib.setEventActionScoreGroupId(rankRequest.getEventActionId());
Map<EIntervalType, Integer> intervalList = new HashMap<>();
intervalList.put(EIntervalType.Refresh, rankRequest.getRefreshInterval());
intervalList.put(EIntervalType.Initialization, rankRequest.getInitializationInterval());
intervalList.put(EIntervalType.Snapshot, rankRequest.getSnapshotInterval());
attrib.setInterval(intervalList);
afterDoc.setAttribValue(objectMapper.writeValueAsString(attrib));
afterDoc.setUpdatedDateTime(CommonUtils.convertUTCDate(nowDate));
update(afterDoc);
log.info("RankingScheduleDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
}
}catch (Exception e){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
}
@Override
public DynamodbOperationResult delete(String guid) {
try{
Key key = Key.builder()
.partitionValue(DynamoDBConstants.PK_KEY_RANKING_SCHEDULER)
.sortValue(guid)
.build();
RankingScheduleDoc doc = findById(key);
if(doc != null) {
Key detailKey = Key.builder()
.partitionValue(doc.getPK())
.sortValue(doc.getSK())
.build();
delete(detailKey);
log.info("RankingScheduleDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
return new DynamodbOperationResult(true, "", doc);
}
return new DynamodbOperationResult(true, "null", null);
}catch (Exception e){
log.error("delete RankingScheduleDoc Error: {}", e.getMessage());
return new DynamodbOperationResult(false, e.getMessage(), null);
}
}
}

View File

@@ -1,6 +1,6 @@
package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.Event;
import com.caliverse.admin.domain.entity.RewardEvent;
import com.caliverse.admin.domain.entity.Message;
import com.caliverse.admin.dynamodb.domain.atrrib.SystemMetaMailAttrib;
import com.caliverse.admin.dynamodb.domain.doc.SystemMetaMailDoc;
@@ -33,23 +33,23 @@ public class SystemMetaMailRepositoryImpl extends BaseDynamoDBRepository<SystemM
}
@Override
public void insert(Event event) {
public void insert(RewardEvent rewardEvent) {
try {
LocalDateTime nowDate = LocalDateTime.now();
SystemMetaMailAttrib attrib = new SystemMetaMailAttrib();
attrib.setAttribType(DynamoDBConstants.ATTRIB_SYSTEMMAIL);
attrib.setMailId(event.getId().intValue());
attrib.setStartTime(convertUTCDate(event.getStartDt()));
attrib.setEndTime(convertUTCDate(event.getEndDt()));
attrib.setSenderNickName(createSystemMessages(event.getMailList(), DynamodbUtil::getSenderByLanguage));
attrib.setTitle(createSystemMessages(event.getMailList(), Message::getTitle));
attrib.setText(createSystemMessages(event.getMailList(), Message::getContent));
attrib.setItemList(createMailItems(event.getItemList()));
attrib.setMailId(rewardEvent.getId().intValue());
attrib.setStartTime(convertUTCDate(rewardEvent.getStartDt()));
attrib.setEndTime(convertUTCDate(rewardEvent.getEndDt()));
attrib.setSenderNickName(createSystemMessages(rewardEvent.getMailList(), DynamodbUtil::getSenderByLanguage));
attrib.setTitle(createSystemMessages(rewardEvent.getMailList(), Message::getTitle));
attrib.setText(createSystemMessages(rewardEvent.getMailList(), Message::getContent));
attrib.setItemList(createMailItems(rewardEvent.getItemList()));
SystemMetaMailDoc doc = new SystemMetaMailDoc();
doc.setPK(DynamoDBConstants.PK_KEY_SYSTEM_MAIL);
doc.setSK(String.valueOf(event.getId()));
doc.setSK(String.valueOf(rewardEvent.getId()));
doc.setDocType(DynamoDBConstants.DOC_SYSTEMMAIL);
doc.setAttribValue(objectMapper.writeValueAsString(attrib));
doc.setCreatedDateTime(convertUTCDate(nowDate));

View File

@@ -0,0 +1,144 @@
package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.request.WorldEventRequest;
import com.caliverse.admin.dynamodb.domain.atrrib.WorldEventScheduleAttrib;
import com.caliverse.admin.dynamodb.domain.doc.WorldEventScheduleDoc;
import com.caliverse.admin.dynamodb.entity.DynamodbOperationResult;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
import com.caliverse.admin.dynamodb.repository.WorldEventScheduleRepository;
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 java.time.LocalDateTime;
import static com.caliverse.admin.global.common.utils.CommonUtils.convertUTCDate;
@Component
@Slf4j
public class WorldEventRepositoryImpl extends BaseDynamoDBRepository<WorldEventScheduleDoc> implements WorldEventScheduleRepository {
public WorldEventRepositoryImpl(DynamoDBOperations operations, DynamodbHistoryLogService dynamodbHistoryLogService, ObjectMapper objectMapper) {
super(operations, WorldEventScheduleDoc.class, dynamodbHistoryLogService, objectMapper);
}
private boolean isEvent(Integer sk){
Key key = Key.builder()
.partitionValue(DynamoDBConstants.PK_KEY_WORLD_EVENT_SCHEDULER)
.sortValue(String.valueOf(sk))
.build();
WorldEventScheduleDoc doc = findById(key);
return doc != null;
}
@Override
public void insert(WorldEventRequest worldEventRequest) {
if(isEvent(worldEventRequest.getId().intValue())){
log.error("insert EventId: {} is duplication", worldEventRequest.getId());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
LocalDateTime nowDate = LocalDateTime.now();
try {
WorldEventScheduleAttrib attrib = new WorldEventScheduleAttrib();
attrib.setAttribType(DynamoDBConstants.ATTRIB_WORLD_EVENT_SCHEDULER);
attrib.setActive(true);
attrib.setId(worldEventRequest.getId().intValue());
attrib.setStartTime(convertUTCDate(worldEventRequest.getStartDt()));
attrib.setEndTime(convertUTCDate(worldEventRequest.getEndDt()));
attrib.setGlobalEventContributionPointMax(worldEventRequest.getMaxPoint());
attrib.setGlobalEventActionGroupId(worldEventRequest.getGlobalEventActionId());
attrib.setPersonalEventActionGroupId(worldEventRequest.getPersonalEventActionId());
WorldEventScheduleDoc doc = new WorldEventScheduleDoc();
doc.setPK(DynamoDBConstants.PK_KEY_WORLD_EVENT_SCHEDULER);
doc.setSK(String.valueOf(worldEventRequest.getId()));
doc.setDocType(DynamoDBConstants.DOC_WORLD_EVENT_SCHEDULER);
doc.setAttribValue(objectMapper.writeValueAsString(attrib));
doc.setCreatedDateTime(convertUTCDate(nowDate));
doc.setUpdatedDateTime(convertUTCDate(nowDate));
doc.setDeletedDateTime(DynamoDBConstants.MIN_DATE);
doc.setRestoredDateTime(DynamoDBConstants.MIN_DATE);
save(doc);
}catch (Exception e){
log.error("insert Error: {}", e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
}
@Override
public void update(WorldEventRequest worldEventRequest) {
LocalDateTime nowDate = LocalDateTime.now();
try {
Key key = Key.builder()
.partitionValue(DynamoDBConstants.PK_KEY_WORLD_EVENT_SCHEDULER)
.sortValue(String.valueOf(worldEventRequest.getId()))
.build();
WorldEventScheduleDoc beforeDoc = findById(key);
if (beforeDoc != null) {
WorldEventScheduleDoc afterDoc = deepCopy(beforeDoc, WorldEventScheduleDoc.class);
WorldEventScheduleAttrib attrib = objectMapper.readValue(afterDoc.getAttribValue(), WorldEventScheduleAttrib.class);
attrib.setActive(true);
attrib.setStartTime(convertUTCDate(worldEventRequest.getStartDt()));
attrib.setEndTime(convertUTCDate(worldEventRequest.getEndDt()));
attrib.setGlobalEventContributionPointMax(worldEventRequest.getMaxPoint());
attrib.setGlobalEventActionGroupId(worldEventRequest.getGlobalEventActionId());
attrib.setPersonalEventActionGroupId(worldEventRequest.getPersonalEventActionId());
afterDoc.setAttribValue(objectMapper.writeValueAsString(attrib));
afterDoc.setUpdatedDateTime(CommonUtils.convertUTCDate(nowDate));
update(afterDoc);
log.info("WorldEventScheduleDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
}
}catch (Exception e){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
}
@Override
public DynamodbOperationResult delete(String id) {
try{
Key key = Key.builder()
.partitionValue(DynamoDBConstants.PK_KEY_BATTLE_EVENT)
.sortValue(id)
.build();
WorldEventScheduleDoc doc = findById(key);
if(doc != null) {
Key detailKey = Key.builder()
.partitionValue(doc.getPK())
.sortValue(doc.getSK())
.build();
delete(detailKey);
log.info("WorldEventScheduleDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
return new DynamodbOperationResult(true, "", doc);
}
return new DynamodbOperationResult(true, "null", null);
}catch (Exception e){
log.error("delete WorldEventScheduleDoc Error: {}", e.getMessage());
return new DynamodbOperationResult(false, e.getMessage(), null);
}
}
}

View File

@@ -0,0 +1,11 @@
package com.caliverse.admin.dynamodb.repository;
import com.caliverse.admin.domain.request.RankRequest;
import com.caliverse.admin.dynamodb.domain.doc.RankingScheduleDoc;
import com.caliverse.admin.dynamodb.entity.DynamodbOperationResult;
public interface RankingSchedulerRepository extends DynamoDBRepository<RankingScheduleDoc> {
void insert(RankRequest rankRequest);
void update(RankRequest rankRequest);
DynamodbOperationResult delete(String id);
}

View File

@@ -1,14 +1,10 @@
package com.caliverse.admin.dynamodb.repository;
import com.caliverse.admin.domain.entity.Event;
import com.caliverse.admin.domain.entity.Item;
import com.caliverse.admin.domain.entity.Message;
import com.caliverse.admin.domain.entity.RewardEvent;
import com.caliverse.admin.dynamodb.domain.doc.SystemMetaMailDoc;
import com.caliverse.admin.dynamodb.entity.DynamodbOperationResult;
import java.util.List;
public interface SystemMetaMailRepository extends DynamoDBRepository<SystemMetaMailDoc> {
void insert(Event event);
void insert(RewardEvent rewardEvent);
DynamodbOperationResult delete(String id);
}

View File

@@ -0,0 +1,11 @@
package com.caliverse.admin.dynamodb.repository;
import com.caliverse.admin.domain.request.WorldEventRequest;
import com.caliverse.admin.dynamodb.domain.doc.WorldEventScheduleDoc;
import com.caliverse.admin.dynamodb.entity.DynamodbOperationResult;
public interface WorldEventScheduleRepository extends DynamoDBRepository<WorldEventScheduleDoc> {
void insert(WorldEventRequest worldEventRequest);
void update(WorldEventRequest worldEventRequest);
DynamodbOperationResult delete(String id);
}

View File

@@ -1,8 +1,7 @@
package com.caliverse.admin.dynamodb.service;
import com.caliverse.admin.Indicators.entity.MoneyLogInfo;
import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
import com.caliverse.admin.domain.entity.Event;
import com.caliverse.admin.domain.entity.RewardEvent;
import com.caliverse.admin.domain.entity.SEARCHTYPE;
import com.caliverse.admin.domain.entity.metadata.MetaLandData;
import com.caliverse.admin.domain.entity.metadata.MetaSystemMailData;
@@ -15,15 +14,10 @@ import com.caliverse.admin.dynamodb.dto.PageResult;
import com.caliverse.admin.dynamodb.entity.KeyParam;
import com.caliverse.admin.dynamodb.repository.*;
import com.caliverse.admin.global.common.annotation.DynamoDBTransaction;
import com.caliverse.admin.global.common.constants.AdminConstants;
import com.caliverse.admin.global.common.constants.CommonConstants;
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.global.common.utils.DateUtils;
import com.caliverse.admin.logs.Indicatordomain.StartEndTime;
import com.caliverse.admin.logs.logservice.LogServiceHelper;
import com.caliverse.admin.logs.logservice.indicators.IndicatorsMoneyService;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -47,8 +41,8 @@ public class DynamodbMailService {
private final MetaDataHandler metaDataHandler;
@DynamoDBTransaction
public void insertSystemMail(Event event){
systemMetaMailRepository.insert(event);
public void insertSystemMail(RewardEvent rewardEvent){
systemMetaMailRepository.insert(rewardEvent);
}
@DynamoDBTransaction

View File

@@ -0,0 +1,34 @@
package com.caliverse.admin.dynamodb.service;
import com.caliverse.admin.domain.entity.RankingSchedule;
import com.caliverse.admin.domain.request.RankRequest;
import com.caliverse.admin.dynamodb.repository.RankingSchedulerRepository;
import com.caliverse.admin.global.common.annotation.DynamoDBTransaction;
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import software.amazon.awssdk.enhanced.dynamodb.Key;
@Service
@RequiredArgsConstructor
@Slf4j
public class DynamodbRankService {
private final RankingSchedulerRepository rankingScheduleRepository;
@DynamoDBTransaction
public void insertRankingSchedule(RankRequest rankRequest) {
rankingScheduleRepository.insert(rankRequest);
}
@DynamoDBTransaction
public void updateRankingSchedule(RankRequest rankRequest) {
rankingScheduleRepository.update(rankRequest);
}
@DynamoDBTransaction
public void deleteRankingSchedule(RankingSchedule rankingSchedule) {
rankingScheduleRepository.delete(rankingSchedule.getGuid());
}
}

View File

@@ -2,42 +2,22 @@ package com.caliverse.admin.dynamodb.service;
import com.caliverse.admin.Indicators.entity.MoneyLogInfo;
import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
import com.caliverse.admin.domain.entity.Event;
import com.caliverse.admin.domain.entity.SEARCHTYPE;
import com.caliverse.admin.domain.entity.metadata.MetaLandData;
import com.caliverse.admin.domain.entity.metadata.MetaSystemMailData;
import com.caliverse.admin.domain.request.LandRequest;
import com.caliverse.admin.dynamodb.domain.atrrib.MailItemAttrib;
import com.caliverse.admin.dynamodb.domain.atrrib.MailJsonAttrib;
import com.caliverse.admin.domain.entity.WorldEvent;
import com.caliverse.admin.domain.request.RankRequest;
import com.caliverse.admin.domain.request.WorldEventRequest;
import com.caliverse.admin.dynamodb.domain.atrrib.MoneyAttrib;
import com.caliverse.admin.dynamodb.domain.atrrib.UserNicknameRegistryAttrib;
import com.caliverse.admin.dynamodb.domain.doc.MailDoc;
import com.caliverse.admin.dynamodb.domain.doc.MailJsonDoc;
import com.caliverse.admin.dynamodb.dto.PageResult;
import com.caliverse.admin.dynamodb.entity.KeyParam;
import com.caliverse.admin.dynamodb.entity.MailItem;
import com.caliverse.admin.dynamodb.repository.*;
import com.caliverse.admin.global.common.annotation.DynamoDBTransaction;
import com.caliverse.admin.global.common.constants.AdminConstants;
import com.caliverse.admin.global.common.constants.CommonConstants;
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.logs.Indicatordomain.StartEndTime;
import com.caliverse.admin.logs.logservice.LogServiceHelper;
import com.caliverse.admin.logs.logservice.indicators.IndicatorsMoneyService;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import software.amazon.awssdk.enhanced.dynamodb.Key;
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
@Service
@@ -49,6 +29,7 @@ public class DynamodbService {
private final SystemMetaMailRepository systemMetaMailRepository;
private final MailRepository mailRepository;
private final MailJsonRepository mailJsonRepository;
private final WorldEventScheduleRepository worldEventScheduleRepository;
private final IndicatorsMoneyService moneyService;
@@ -71,4 +52,19 @@ public class DynamodbService {
log.error(e.getMessage());
}
}
@DynamoDBTransaction
public void insertWorldEventSchedule(WorldEventRequest worldEventRequest) {
worldEventScheduleRepository.insert(worldEventRequest);
}
@DynamoDBTransaction
public void updateWorldEventSchedule(WorldEventRequest worldEventRequest) {
worldEventScheduleRepository.update(worldEventRequest);
}
@DynamoDBTransaction
public void deleteWorldEventSchedule(WorldEvent worldEvent) {
worldEventScheduleRepository.delete(worldEvent.getId().toString());
}
}