Compare commits

...

7 Commits

Author SHA1 Message Date
492394d3a0 랜드경매 예약종료일 제거 2025-08-09 09:47:58 +09:00
11c681e1ad logTime 타입처리 수정 2025-08-06 18:51:08 +09:00
78f84bd7b8 로그 방식 변경 2025-08-06 14:39:05 +09:00
78b10e4f3a 히스토리 마이그레이션 2025-08-05 18:21:53 +09:00
b01c355492 스케줄 aop 동작안함으로 구조 변경 2025-08-05 18:21:35 +09:00
b0a99ca55f 비즈니스 로그 기준 히스토리 조정
assets DW 추가
경제지표 보유 API
게임로그 snapshot
s3 비즈니스 로그 추가
칼리움 dashboard api
2025-08-04 17:38:30 +09:00
a834c7a004 비즈니스 로그 구조 생성
서비스별 비즈니스 로그 처리
코드 정리
2025-07-29 16:14:18 +09:00
183 changed files with 5875 additions and 3767 deletions

View File

@@ -12,7 +12,6 @@ import com.caliverse.admin.domain.response.IndicatorsResponse.NRU;
import com.caliverse.admin.domain.response.IndicatorsResponse.PU;
import com.caliverse.admin.domain.response.IndicatorsResponse.Playtime;
import com.caliverse.admin.domain.response.IndicatorsResponse.Retention;
import com.caliverse.admin.domain.response.IndicatorsResponse.Segment;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -37,13 +36,10 @@ public class IndicatorsResult {
//Retention
@JsonProperty("retention")
private List<Retention> retentionList;
//Segment
@JsonProperty("start_dt")
private String startDt;
@JsonProperty("end_dt")
private String endDt;
@JsonProperty("segment")
private List<Segment> segmentList;
//플레이타임
@JsonProperty("playtime")
private List<Playtime> playtimeList;

View File

@@ -0,0 +1,131 @@
package com.caliverse.admin.Indicators.Indicatorsservice.aggregationservice;
import com.caliverse.admin.Indicators.Indicatordomain.IndicatorsLog;
import com.caliverse.admin.Indicators.Indicatorsservice.base.IndicatorsLogLoadServiceBase;
import com.caliverse.admin.global.common.constants.AdminConstants;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.aggregation.*;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class IndicatorsAssetsLoadService extends IndicatorsLogLoadServiceBase {
public IndicatorsAssetsLoadService(
@Qualifier("mongoIndicatorTemplate") MongoTemplate mongoTemplate
) {
super(mongoTemplate);
}
@Override
public <T extends IndicatorsLog> List<T> getIndicatorsLogData(String startTime, String endTime, Class<T> clazz) {
Criteria criteria = makeCriteria(startTime, endTime, "logDay");
GroupOperation groupOperation = Aggregation.group("logDay")
.sum("gold").as("gold")
.sum("sapphire").as("sapphire")
.sum("calium").as("calium")
.sum("ruby").as("ruby")
.sum("item_11570001").as("item_11570001")
.sum("item_11570002").as("item_11570002")
.sum("item_13080002").as("item_13080002")
.sum("item_13080004").as("item_13080004")
.sum("item_13080005").as("item_13080005")
.sum("item_13080006").as("item_13080006")
.sum("item_13080007").as("item_13080007")
.sum("item_13080008").as("item_13080008")
.sum("item_13080009").as("item_13080009")
.count().as("userCount");
ProjectionOperation projection = Aggregation.project()
.andExclude("_id")
.and("_id").as(AdminConstants.MONGO_DB_KEY_LOGDAY)
.and("gold").as("gold")
.and("sapphire").as("sapphire")
.and("calium").as("calium")
.and("ruby").as("ruby")
.and("item_11570001").as("item_11570001") //강화잉크
.and("item_11570002").as("item_11570002") //연성잉크
.and("item_13080002").as("item_13080002") //퀘스트 메달
.and("item_13080004").as("item_13080004") //보급품 메달
.and("item_13080005").as("item_13080005") //제작 메달
.and("item_13080006").as("item_13080006") //315 포드
.and("item_13080007").as("item_13080007") //316 포드
.and("item_13080008").as("item_13080008") //317 포드
.and("item_13080009").as("item_13080009") //318 포드
.and("userCount").as("userCount");
List<AggregationOperation> operations = List.of(
Aggregation.match(criteria),
groupOperation,
projection,
Aggregation.sort(Sort.Direction.ASC, AdminConstants.MONGO_DB_KEY_LOGDAY)
);
Aggregation aggregation = Aggregation.newAggregation(operations);
return mongoTemplate.aggregate(
aggregation.withOptions(AggregationOptions.builder().allowDiskUse(true).build())
, AdminConstants.MONGO_DB_COLLECTION_ASSETS
, clazz
).getMappedResults();
}
public <T extends IndicatorsLog> List<T> getAssetsLogData(String startTime, String endTime, Class<T> clazz) {
Criteria criteria = makeCriteria(startTime, endTime, "logDay");
GroupOperation groupOperation = Aggregation.group("logDay")
.sum("gold").as("gold")
.sum("sapphire").as("sapphire")
.sum("calium").as("calium")
.sum("ruby").as("ruby")
.sum("item_11570001").as("item_11570001")
.sum("item_11570002").as("item_11570002")
.sum("item_13080002").as("item_13080002")
.sum("item_13080004").as("item_13080004")
.sum("item_13080005").as("item_13080005")
.sum("item_13080006").as("item_13080006")
.sum("item_13080007").as("item_13080007")
.sum("item_13080008").as("item_13080008")
.sum("item_13080009").as("item_13080009")
.count().as("userCount");
ProjectionOperation projection = Aggregation.project()
.andExclude("_id")
.and("logDay").as(AdminConstants.MONGO_DB_KEY_LOGDAY)
.and("gold").as("gold")
.and("sapphire").as("sapphire")
.and("calium").as("calium")
.and("ruby").as("ruby")
.and("item_11570001").as("item_11570001")
.and("item_11570002").as("item_11570002")
.and("item_13080002").as("item_13080002")
.and("item_13080004").as("item_13080004")
.and("item_13080005").as("item_13080005")
.and("item_13080006").as("item_13080006")
.and("item_13080007").as("item_13080007")
.and("item_13080008").as("item_13080008")
.and("item_13080009").as("item_13080009")
.and("userCount").as("userCount");
List<AggregationOperation> operations = List.of(
Aggregation.match(criteria),
groupOperation,
projection,
Aggregation.sort(Sort.Direction.ASC, AdminConstants.MONGO_DB_KEY_LOGDAY)
);
Aggregation aggregation = Aggregation.newAggregation(operations);
return mongoTemplate.aggregate(
aggregation.withOptions(AggregationOptions.builder().allowDiskUse(true).build())
, AdminConstants.MONGO_DB_COLLECTION_ASSETS
, clazz
).getMappedResults();
}
}

View File

@@ -0,0 +1,90 @@
package com.caliverse.admin.Indicators.Indicatorsservice.aggregationservice;
import com.caliverse.admin.Indicators.Indicatordomain.IndicatorsLog;
import com.caliverse.admin.Indicators.Indicatorsservice.base.IndicatorsLogLoadServiceBase;
import com.caliverse.admin.global.common.constants.AdminConstants;
import org.bson.Document;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.aggregation.*;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class IndicatorsCurrencyLoadService extends IndicatorsLogLoadServiceBase {
public IndicatorsCurrencyLoadService(
@Qualifier("mongoIndicatorTemplate") MongoTemplate mongoTemplate
) {
super(mongoTemplate);
}
@Override
public <T extends IndicatorsLog> List<T> getIndicatorsLogData(String startTime, String endTime, Class<T> clazz) {
return getCurrencyLogData(startTime, endTime, "Acquire", clazz);
}
public <T extends IndicatorsLog> List<T> getCurrencyLogData(String startTime, String endTime, String deltaType, Class<T> clazz) {
Criteria criteria = makeCriteria(startTime, endTime, "logDay");
UnwindOperation unwindOperation = Aggregation.unwind("currencies");
MatchOperation matchOp = Aggregation.match(
Criteria.where("currencies.amountDeltaType").is(deltaType)
);
AggregationOperation groupOp = context -> new Document("$group",
new Document("_id", new Document("logDay", "$logDay")
.append("currencyType", "$currencies.currencyType")
.append("action", "$currencies.action")
)
.append("actionAmount", new Document("$sum", "$currencies.deltaAmount"))
);
AggregationOperation groupOp2 = context -> new Document("$group",
new Document("_id", new Document("logDay", "$_id.logDay")
.append("currencyType", "$_id.currencyType")
)
.append("totalDeltaAmount", new Document("$sum", "$actionAmount"))
.append("actions", new Document("$push",
new Document("k", "$_id.action").append("v", "$actionAmount")
))
);
AddFieldsOperation addFieldsOp = Aggregation.addFields()
.addField("actionSummary")
.withValue(ArrayOperators.ArrayToObject.arrayToObject("$actions"))
.build();
AggregationOperation projectOp = context -> new Document("$project", new Document()
.append("_id", 0)
.append("logDay", "$_id.logDay")
.append("currencyType", "$_id.currencyType")
.append("totalDeltaAmount", 1)
.append("actionSummary", 1)
);
List<AggregationOperation> operations = List.of(
Aggregation.match(criteria),
unwindOperation,
matchOp,
groupOp,
groupOp2,
addFieldsOp,
projectOp,
Aggregation.sort(Sort.Direction.ASC, AdminConstants.MONGO_DB_KEY_LOGDAY)
);
Aggregation aggregation = Aggregation.newAggregation(operations);
return mongoTemplate.aggregate(
aggregation.withOptions(AggregationOptions.builder().allowDiskUse(true).build())
, AdminConstants.MONGO_DB_COLLECTION_CURRENCY
, clazz
).getMappedResults();
}
}

View File

@@ -0,0 +1,95 @@
package com.caliverse.admin.Indicators.Indicatorsservice.aggregationservice;
import com.caliverse.admin.Indicators.Indicatordomain.IndicatorsLog;
import com.caliverse.admin.Indicators.Indicatorsservice.base.IndicatorsLogLoadServiceBase;
import com.caliverse.admin.global.common.constants.AdminConstants;
import org.bson.Document;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.aggregation.*;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class IndicatorsItemLoadService extends IndicatorsLogLoadServiceBase {
public IndicatorsItemLoadService(
@Qualifier("mongoIndicatorTemplate") MongoTemplate mongoTemplate
) {
super(mongoTemplate);
}
@Override
public <T extends IndicatorsLog> List<T> getIndicatorsLogData(String startTime, String endTime, Class<T> clazz) {
return getItemsLogData(startTime, endTime, "Acquire", clazz);
}
public <T extends IndicatorsLog> List<T> getItemsLogData(String startTime, String endTime, String deltaType, Class<T> clazz) {
Criteria criteria = makeCriteria(startTime, endTime, "logDay");
UnwindOperation unwindOperation = Aggregation.unwind("itemDetails");
UnwindOperation unwindOperation2 = Aggregation.unwind("itemDetails.items");
MatchOperation matchOp = Aggregation.match(
Criteria.where("itemDetails.items.countDeltaType").is(deltaType)
);
AggregationOperation groupOp = context -> new Document("$group",
new Document("_id", new Document("logDay", "$logDay")
.append("itemMID", "$itemDetails.items.itemMID")
.append("action", "$itemDetails.items.action")
)
.append("actionCount", new Document("$sum", "$itemDetails.items.deltaCount"))
.append("itemName", new Document("$first", "$itemDetails.items.itemName"))
);
AggregationOperation groupOp2 = context -> new Document("$group",
new Document("_id", new Document("logDay", "$_id.logDay")
.append("itemMID", "$_id.itemMID")
)
.append("totalDeltaCount", new Document("$sum", "$actionCount"))
.append("itemName", new Document("$first", "$itemName"))
.append("actions", new Document("$push",
new Document("k", "$_id.action").append("v", "$actionCount")
))
);
AddFieldsOperation addFieldsOp = Aggregation.addFields()
.addField("actionSummary")
.withValue(ArrayOperators.ArrayToObject.arrayToObject("$actions"))
.build();
AggregationOperation projectOp = context -> new Document("$project", new Document()
.append("_id", 0)
.append("logDay", "$_id.logDay")
.append("itemId", "$_id.itemMID")
.append("itemName", 1)
.append("totalDeltaCount", 1)
.append("actionSummary", 1)
);
List<AggregationOperation> operations = List.of(
Aggregation.match(criteria),
unwindOperation,
unwindOperation2,
matchOp,
groupOp,
groupOp2,
addFieldsOp,
projectOp,
Aggregation.sort(Sort.Direction.ASC, AdminConstants.MONGO_DB_KEY_LOGDAY)
);
Aggregation aggregation = Aggregation.newAggregation(operations);
return mongoTemplate.aggregate(
aggregation.withOptions(AggregationOptions.builder().allowDiskUse(true).build())
, AdminConstants.MONGO_DB_COLLECTION_ITEM
, clazz
).getMappedResults();
}
}

View File

@@ -0,0 +1,28 @@
package com.caliverse.admin.Indicators.entity;
import com.caliverse.admin.Indicators.Indicatordomain.IndicatorsLog;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.mongodb.core.index.Indexed;
@Getter
@Setter
public class AssetsIndicatorInfo implements IndicatorsLog {
@Indexed
private String logDay;
private Double gold;
private Double sapphire;
private Double calium;
private Double ruby;
private Integer item_11570001;
private Integer item_11570002;
private Integer item_13080002;
private Integer item_13080004;
private Integer item_13080005;
private Integer item_13080006;
private Integer item_13080007;
private Integer item_13080008;
private Integer item_13080009;
private Integer userCount;
}

View File

@@ -0,0 +1,19 @@
package com.caliverse.admin.Indicators.entity;
import com.caliverse.admin.Indicators.Indicatordomain.IndicatorsLog;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.mongodb.core.index.Indexed;
import java.util.Map;
@Getter
@Setter
public class CurrencyIndicatorInfo implements IndicatorsLog {
@Indexed
private String logDay;
private Double totalDeltaAmount;
private Map<String, Double> actionSummary;
private String currencyType;
}

View File

@@ -0,0 +1,20 @@
package com.caliverse.admin.Indicators.entity;
import com.caliverse.admin.Indicators.Indicatordomain.IndicatorsLog;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.mongodb.core.index.Indexed;
import java.util.Map;
@Getter
@Setter
public class ItemIndicatorInfo implements IndicatorsLog {
@Indexed
private String logDay;
private Long totalDeltaCount;
private Map<String, Double> actionSummary;
private String itemId;
private String itemName;
}

View File

@@ -0,0 +1,83 @@
package com.caliverse.admin.Indicators.entity;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import java.time.LocalDateTime;
@Getter
@Setter
@Document(collection = "assets")
@CompoundIndexes({
@CompoundIndex(name = "logDay_userGuid_idx", def = "{'logDay': 1, 'userGuid': 1}", background = true),
@CompoundIndex(name = "logDay_idx", def = "{'logDay': 1}", background = true)
})
public class SnapshotLogInfo extends LogInfoBase{
@Indexed
private String logDay;
private String accountId;
@Indexed
private String userGuid;
private String userNickname;
private Double gold;
private Double sapphire;
private Double calium;
private Double ruby;
private Integer item_11570001;
private Integer item_11570002;
private Integer item_13080002;
private Integer item_13080004;
private Integer item_13080005;
private Integer item_13080006;
private Integer item_13080007;
private Integer item_13080008;
private Integer item_13080009;
private LocalDateTime lastLogoutTime;
public SnapshotLogInfo(String logDay,
String accountId,
String userGuid,
String userNickname,
Double gold,
Double sapphire,
Double calium,
Double ruby,
Integer item_11570001,
Integer item_11570002,
Integer item_13080002,
Integer item_13080004,
Integer item_13080005,
Integer item_13080006,
Integer item_13080007,
Integer item_13080008,
Integer item_13080009,
LocalDateTime lastLogoutTime
) {
super(StatisticsType.SNAPSHOT);
this.logDay = logDay;
this.accountId = accountId;
this.userGuid = userGuid;
this.userNickname = userNickname;
this.gold = gold;
this.sapphire = sapphire;
this.calium = calium;
this.ruby = ruby;
this.item_11570001 = item_11570001;
this.item_11570002 = item_11570002;
this.item_13080002 = item_13080002;
this.item_13080004 = item_13080004;
this.item_13080005 = item_13080005;
this.item_13080006 = item_13080006;
this.item_13080007 = item_13080007;
this.item_13080008 = item_13080008;
this.item_13080009 = item_13080009;
this.lastLogoutTime = lastLogoutTime;
}
}

View File

@@ -18,7 +18,8 @@ public enum StatisticsType {
USER_CREATE,
USER_LOGIN,
CURRENCY,
ITEM
ITEM,
SNAPSHOT
;
public static StatisticsType getStatisticsType(String type) {

View File

@@ -4,4 +4,5 @@ import com.caliverse.admin.Indicators.entity.CurrencyLogInfo;
import org.springframework.data.mongodb.repository.MongoRepository;
public interface IndicatorCurrencyRepository extends MongoRepository<CurrencyLogInfo, String> {
boolean existsByLogDayAndUserGuid(String logDay, String userGuid);
}

View File

@@ -4,4 +4,5 @@ import com.caliverse.admin.Indicators.entity.ItemLogInfo;
import org.springframework.data.mongodb.repository.MongoRepository;
public interface IndicatorItemRepository extends MongoRepository<ItemLogInfo, String> {
boolean existsByLogDayAndUserGuid(String logDay, String userGuid);
}

View File

@@ -0,0 +1,8 @@
package com.caliverse.admin.Indicators.indicatorrepository;
import com.caliverse.admin.Indicators.entity.SnapshotLogInfo;
import org.springframework.data.mongodb.repository.MongoRepository;
public interface IndicatorSnapshotRepository extends MongoRepository<SnapshotLogInfo, String> {
boolean existsByLogDayAndUserGuid(String logDay, String userGuid);
}

View File

@@ -4,4 +4,5 @@ import com.caliverse.admin.Indicators.entity.UserCreateLogInfo;
import org.springframework.data.mongodb.repository.MongoRepository;
public interface IndicatorUserCreateRepository extends MongoRepository<UserCreateLogInfo, String> {
boolean existsByLogDayAndUserGuid(String logDay, String userGuid);
}

View File

@@ -4,4 +4,5 @@ import com.caliverse.admin.Indicators.entity.UserLoginLogInfo;
import org.springframework.data.mongodb.repository.MongoRepository;
public interface IndicatorUserLoginRepository extends MongoRepository<UserLoginLogInfo, String> {
boolean existsByLogDayAndUserGuid(String logDay, String userGuid);
}

View File

@@ -4,40 +4,83 @@ import com.caliverse.admin.domain.RabbitMq.message.LogoutReasonType;
import com.caliverse.admin.domain.RabbitMq.message.MailItem;
import com.caliverse.admin.domain.RabbitMq.message.OperationSystemMessage;
import com.caliverse.admin.domain.RabbitMq.message.ServerMessage;
import com.caliverse.admin.domain.entity.log.LogStatus;
import com.caliverse.admin.global.common.constants.CommonConstants;
import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.mongodb.service.BusinessLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@Slf4j
@Service
public class MessageHandlerService {
private final RabbitMqService rabbitMqService;
private final BusinessLogService businessLogService;
public MessageHandlerService(RabbitMqService rabbitMqService) {
public MessageHandlerService(RabbitMqService rabbitMqService, BusinessLogService businessLogService) {
this.rabbitMqService = rabbitMqService;
this.businessLogService = businessLogService;
}
private void logMessage(LogStatus logStatus, String message, String queName, String serverName, Object content){
CompletableFuture<String> logFuture = businessLogService.logMessageQueue(
logStatus,
message,
CommonUtils.getAdmin() == null ? CommonConstants.SYSTEM : CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp() == null ? CommonConstants.SYSTEM : CommonUtils.getClientIp(),
queName,
serverName,
content
);
logFuture.whenComplete((result, throwable) -> {
if (throwable != null) {
log.warn("MessageQueue Business log failed for info: {}, error: {}", CommonUtils.objectByString(content), throwable.getMessage());
}
});
}
public void sendUserKickMessage(String userGuid, String serverName, String reason){
try {
var user_kick_builder = ServerMessage.MOS2GS_NTF_USER_KICK.newBuilder();
user_kick_builder.setUserGuid(userGuid);
user_kick_builder.setKickReasonMsg(String.format("backoffice %s", reason));
user_kick_builder.setLogoutReasonType(LogoutReasonType.LogoutReasonType_None);
rabbitMqService.SendMessage(user_kick_builder.build(), serverName);
log.info("Send User Kick Message to Server: {}, user: {}", serverName, userGuid);
logMessage(
LogStatus.SUCCESS,
"",
"sendUserKickMessage",
serverName,
user_kick_builder
);
}catch(Exception e){
log.error(e.getMessage());
logMessage(
LogStatus.FAILURE,
String.format("User Kick Fail UserGuid: %s, reason: %s, error: %s", userGuid, reason, e.getMessage()),
"sendUserKickMessage",
serverName,
null
);
}
}
public void sendNoticeMessage(List<String> serverList, String type, List<OperationSystemMessage> msgList, List<OperationSystemMessage> senderList){
try {
var noticeBuilder = ServerMessage.MOS2GS_NTF_NOTICE_CHAT.newBuilder();
noticeBuilder.addNoticeType(type);
// noticeBuilder.setNoticeType(0, type);
// int msgIdx = 0;
for (OperationSystemMessage msg : msgList) {
noticeBuilder.addChatMessage(msg);
// noticeBuilder.setChatMessage(msgIdx, msg);
// msgIdx++;
}
for (OperationSystemMessage sender : senderList) {
noticeBuilder.addSender(sender);
@@ -45,50 +88,127 @@ public class MessageHandlerService {
for (String server : serverList) {
rabbitMqService.SendMessage(noticeBuilder.build(), server);
}
log.info("Send Notice Message to Server: {}, type: {}", serverList.toString(), type);
logMessage(
LogStatus.SUCCESS,
"",
"sendNoticeMessage",
serverList.toString(),
noticeBuilder
);
}catch (Exception e){
log.error(e.getMessage());
logMessage(
LogStatus.FAILURE,
String.format("Send Notice Fail Type: %s, senderList: %s, msgList: %s, error: %s", type, senderList.toString(), msgList.toString(), e.getMessage()),
"sendNoticeMessage",
serverList.toString(),
null
);
}
}
public void sendMailMessage(String serverName, String userGuid, String mailType, List<OperationSystemMessage> titleList, List<OperationSystemMessage> msgList
, List<MailItem> itemList, List<OperationSystemMessage> senderList){
try {
var mail_builder = ServerMessage.MOS2GS_NTF_MAIL_SEND.newBuilder();
mail_builder.setUserGuid(userGuid);
mail_builder.setMailType(mailType);
for(OperationSystemMessage title : titleList){
for (OperationSystemMessage title : titleList) {
mail_builder.addTitle(title);
}
for(OperationSystemMessage msg : msgList){
for (OperationSystemMessage msg : msgList) {
mail_builder.addMsg(msg);
}
for(MailItem item : itemList){
for (MailItem item : itemList) {
mail_builder.addItemList(item);
}
for(OperationSystemMessage sender : senderList){
for (OperationSystemMessage sender : senderList) {
mail_builder.addSender(sender);
}
rabbitMqService.SendMessage(mail_builder.build(), serverName);
log.info("Send Mail Message to Server: {}, user: {}", serverName, userGuid);
logMessage(
LogStatus.SUCCESS,
"",
"sendMailMessage",
serverName,
mail_builder
);
}catch (Exception e){
log.error(e.getMessage());
logMessage(
LogStatus.FAILURE,
String.format("Send Mail Fail UserGuid: %s, mailType: %s, senderList: %s, titleList: %s, itemList: %s, error: %s",
userGuid, mailType, senderList.toString(), titleList.toString(), itemList.toString(), e.getMessage()),
"sendMailMessage",
serverName,
null
);
}
}
public void sendBannerMessage(String serverName){
try {
var banner_builder = ServerMessage.MOS2GS_NTF_UPDATE_BANNER.newBuilder();
rabbitMqService.SendMessage(banner_builder.build(), serverName);
log.info("Send Banner Message to Server: {}", serverName);
logMessage(
LogStatus.SUCCESS,
"",
"sendBannerMessage",
serverName,
banner_builder
);
}catch(Exception e){
log.error(e.getMessage());
logMessage(
LogStatus.FAILURE,
String.format("Banner Fail error: %s", e.getMessage()),
"sendBannerMessage",
serverName,
null
);
}
}
public void sendQuestTaskCompleteMessage(String serverName, String accountId, int reqId, String questKey, int taskId){
try {
var quest_task_builder = ServerMessage.MOS2GS_NTF_QUEST_TASK_FORCE_COMPLETE.newBuilder();
quest_task_builder.setAccountId(accountId);
quest_task_builder.setReqId(reqId);
quest_task_builder.setQuestKey(questKey);
quest_task_builder.setTaskId(taskId);
rabbitMqService.SendMessage(quest_task_builder.build(), serverName);
log.info("Send Quest Task Complete Message to Server: {}, accountId: {}, questKey: {}, taskId: {}", serverName, accountId, questKey, taskId);
logMessage(
LogStatus.SUCCESS,
"",
"sendQuestTaskCompleteMessage",
serverName,
quest_task_builder
);
}catch(Exception e){
log.error(e.getMessage());
logMessage(
LogStatus.FAILURE,
String.format("Quest Task Complete Fail accountId: %s, questKey: %s, taskId: %s, error: %s", accountId, questKey, taskId, e.getMessage()),
"sendQuestTaskCompleteMessage",
serverName,
null
);
}
}
}

View File

@@ -1,17 +0,0 @@
package com.caliverse.admin.domain.adminlog;
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
public class AdminItemDeleteLog extends AdminLogBase {
public AdminItemDeleteLog(String userGuid, String itemGuid, String itemCount){
super(HISTORYTYPEDETAIL.USER_ITEM_DELETE);
var jsonObject = getJsonContentObject();
jsonObject.put("userGuid", userGuid);
jsonObject.put("itemGuid", itemGuid);
jsonObject.put("itemCount", itemCount);
}
}

View File

@@ -1,76 +0,0 @@
package com.caliverse.admin.domain.adminlog;
import com.caliverse.admin.domain.dao.admin.HistoryMapper;
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.global.component.AdminApplicationContextProvider;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.json.JSONObject;
import org.springframework.context.ApplicationContext;
import java.util.HashMap;
import java.util.Map;
@Slf4j
public abstract class AdminLogBase implements IAdminLog{
private final HistoryMapper historyMapper;
private static ApplicationContext context;
private final HISTORYTYPEDETAIL historyType;
protected Map<String, Object> map;
@Getter
protected JSONObject jsonContentObject = new JSONObject();
public AdminLogBase(HISTORYTYPEDETAIL historyType) {
this.historyMapper = AdminApplicationContextProvider.getContext().getBean(HistoryMapper.class);
this.historyType = historyType;
jsonContentObject = new JSONObject();
this.map = new HashMap<>();
makeDefaultMap();
}
//protected abstract void saveAdminLog();
private void makeDefaultMap(){
Long adminId = 0L;
String adminName = "";
String adminMail = "";
HISTORYTYPEDETAIL type = HISTORYTYPEDETAIL.NONE;
try {
adminId = CommonUtils.getAdmin().getId();
adminName = CommonUtils.getAdmin().getName();
adminMail = CommonUtils.getAdmin().getEmail();
}
catch (Exception e){
log.error("makeDefaultMap getAdmin() null error message : {}", e.getMessage());
}
this.map.put("adminId", adminId);
this.map.put("name", adminName);
this.map.put("mail", adminMail);
this.map.put("type", historyType);
}
@Override
public void saveLogToDB(){
this.map.put("content", jsonContentObject.toString());
historyMapper.saveLog(map);
}
}

View File

@@ -1,13 +0,0 @@
package com.caliverse.admin.domain.adminlog;
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
public class AdminLoginPermitLog extends AdminLogBase {
public AdminLoginPermitLog() {
super(HISTORYTYPEDETAIL.LOGIN_PERMITTED);
}
}

View File

@@ -1,16 +0,0 @@
package com.caliverse.admin.domain.adminlog;
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
public class AdminPasswordInitLog extends AdminLogBase {
public AdminPasswordInitLog(String name, String email) {
super(HISTORYTYPEDETAIL.PASSWORD_INIT);
var jsonObject = getJsonContentObject();
jsonObject.put("name", name);
jsonObject.put("email", email);
}
}

View File

@@ -1,8 +0,0 @@
package com.caliverse.admin.domain.adminlog;
import java.util.Map;
public interface IAdminLog {
public void saveLogToDB();
}

View File

@@ -1,38 +0,0 @@
package com.caliverse.admin.domain.api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.caliverse.admin.domain.service.UserItemService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Map;
@Tag(name = "비즈니스 로그 조회", description = "비즈니스 로그 조회 메뉴 api 입니다.")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v1/businesslog")
public class BusinessLogSearchController {
private final UserItemService userItemService;
@GetMapping("/useritemlist")
public String getUserItemList(@RequestParam Map<String, String> requestParams){
userItemService.getUserItemHistory(requestParams);
return null;
//return ResponseEntity.ok().body( userItemService.getUserItemList(requestParams));
}
}

View File

@@ -49,65 +49,33 @@ public class IndicatorsController {
@RequestParam Map<String, String> requestParams,HttpServletResponse res){
indicatorsService.retentionExcelDown(requestParams,res);
}
//Segment
@GetMapping("/segment/list")
public ResponseEntity<IndicatorsResponse> segmentList(
@GetMapping("/currency/list")
public ResponseEntity<IndicatorsResponse> currencyList(
@RequestParam Map<String, String> requestParams){
return ResponseEntity.ok().body( indicatorsService.segmentList(requestParams));
}
@GetMapping("/segment/excel-down")
public void segmentExcelDown(
@RequestParam Map<String, String> requestParams,HttpServletResponse res){
indicatorsService.segmentExcelDown(requestParams, res);
}
//Playtime
@GetMapping("/playtime/list")
public ResponseEntity<IndicatorsResponse> playTimeList(
@RequestParam Map<String, String> requestParams){
return ResponseEntity.ok().body( indicatorsService.playTimeList(requestParams));
}
@GetMapping("/playtime/excel-down")
public void playTimeExcelDown(
@RequestParam Map<String, String> requestParams,HttpServletResponse res){
indicatorsService.playTimeExcelDown(requestParams, res);
return ResponseEntity.ok().body( indicatorsService.currencyList(requestParams));
}
// 재화 지표
@GetMapping("/currency/use")
public ResponseEntity<IndicatorsResponse> acquire(
@RequestParam Map<String, String> requestParams){
return ResponseEntity.ok().body( indicatorsService.getCurrencyUse(requestParams));
}
@GetMapping("/currency/excel-down")
public void currencyExcelDown(
@RequestParam Map<String, String> requestParams, HttpServletResponse res){
indicatorsService.currencyExcelDown(requestParams, res);
}
// VBP 지표
@GetMapping("/currency/vbp")
public ResponseEntity<IndicatorsResponse> vbp(
@RequestParam Map<String, String> requestParams){
return ResponseEntity.ok().body( indicatorsService.getVBPList(requestParams));
}
// Item 지표
@GetMapping("/currency/item")
@GetMapping("/item/list")
public ResponseEntity<IndicatorsResponse> item(
@RequestParam Map<String, String> requestParams){
return ResponseEntity.ok().body( indicatorsService.getItemList(requestParams));
}
// 보유 지표
@GetMapping("/assets/list")
public ResponseEntity<IndicatorsResponse> assets(
@RequestParam Map<String, String> requestParams){
return ResponseEntity.ok().body( indicatorsService.getAssetsList(requestParams));
}
// 인스턴스 지표
@GetMapping("/currency/instance")
public ResponseEntity<IndicatorsResponse> instance(
@RequestParam Map<String, String> requestParams){
return ResponseEntity.ok().body( indicatorsService.getInstanceList(requestParams));
}
// 의상/타투 지표
@GetMapping("/currency/clothes")
public ResponseEntity<IndicatorsResponse> clothes(
@RequestParam Map<String, String> requestParams){
return ResponseEntity.ok().body( indicatorsService.getClothesList(requestParams));
}
// DAU 지표
@GetMapping("/dau/list")
@@ -122,7 +90,10 @@ public class IndicatorsController {
indicatorsService.dauExcelDown(requestParams, res);
}
@GetMapping("/dashboard/calium/converter")
public ResponseEntity<IndicatorsResponse> dashboardCaliumConverter(){
return ResponseEntity.ok().body( indicatorsService.getCaliumConverter());
}
/*
// DAU 지표
@GetMapping("/daily-medal/list")

View File

@@ -108,4 +108,16 @@ public class LogController {
@RequestBody LogGameRequest logGameRequest){
logService.userLoginExcelExport(response, logGameRequest);
}
@GetMapping("/user/snapshot/list")
public ResponseEntity<LogResponse> snapshotList(
@RequestParam Map<String, String> requestParams){
return ResponseEntity.ok().body( logService.getSnapshotLogList(requestParams));
}
@PostMapping("/user/snapshot/excel-export")
public void userSnapshotExcelExport(HttpServletResponse response,
@RequestBody LogGameRequest logGameRequest){
logService.SnapshotExcelExport(response, logGameRequest);
}
}

View File

@@ -1,18 +0,0 @@
package com.caliverse.admin.domain.batch;
import org.springframework.batch.item.ItemProcessor;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class CustomProcessor implements ItemProcessor<String, String> {
@Override
public String process(String data) throws Exception {
log.info("Processing data: " + data);
//data = data.toUpperCase();
return data;
}
}

View File

@@ -1,26 +0,0 @@
package com.caliverse.admin.domain.batch;
import org.springframework.batch.item.ItemReader;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class CustomReader implements ItemReader<String> {
private String[] tokens = { "Hello World!", "Hello Spring!", "Hello Batch!" };
private int index = 0;
@Override
public String read() throws Exception {
if (index >= tokens.length) {
return null;
}
String data = index + " " + tokens[index];
index++;
log.info("reading data: {}", data);
return data;
}
}

View File

@@ -1,18 +0,0 @@
package com.caliverse.admin.domain.batch;
import org.springframework.batch.item.Chunk;
import org.springframework.batch.item.ItemWriter;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class CustomWriter implements ItemWriter<String> {
@Override
public void write(Chunk<? extends String> chunk) throws Exception {
for (String data : chunk) {
log.info("Writing item: " + data.toString());
}
}
}

View File

@@ -1,64 +0,0 @@
package com.caliverse.admin.domain.batch;
// import org.springframework.batch.core.Job;
// import org.springframework.batch.core.JobExecutionException;
// import org.springframework.batch.core.JobParameters;
// import org.springframework.batch.core.JobParametersBuilder;
// import org.springframework.batch.core.Step;
// import org.springframework.batch.core.job.builder.JobBuilder;
// import org.springframework.batch.core.launch.JobLauncher;
// import org.springframework.batch.core.repository.JobRepository;
// import org.springframework.batch.core.step.builder.StepBuilder;
// import org.springframework.batch.core.step.tasklet.Tasklet;
// import org.springframework.batch.repeat.RepeatStatus;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.transaction.PlatformTransactionManager;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
//@Configuration
//@RequiredArgsConstructor
@Slf4j
@Getter
public class TestJob {
// private final JobLauncher jobLauncher;
// private final PlatformTransactionManager transactionManager;
// @Bean
// public Job testSimpleJob(PlatformTransactionManager transactionManager, JobRepository jobRepository) {
// return new JobBuilder("testSimpleJob", jobRepository)
// .start(testSimpleStep(transactionManager, jobRepository))
// .build();
// }
// @Bean
// public Step testSimpleStep(PlatformTransactionManager transactionManager, JobRepository jobRepository) {
// return new StepBuilder("testSimpleStep", jobRepository)
// .tasklet(testTasklet(), transactionManager)
// .build();
// }
// public Tasklet testTasklet() {
// return (contribution, chunkContext) -> {
// log.info("test job runned");
// return RepeatStatus.FINISHED;
// };
// }
// public void runJob() {
// try {
// JobParameters jobParameters = new JobParametersBuilder()
// .addLong("run.id", System.currentTimeMillis())
// .toJobParameters();
// jobLauncher.run(testSimpleJob(transactionManager, null), jobParameters);
// } catch (JobExecutionException e) {
// log.error("Failed to execute job", e);
// }
// }
}

View File

@@ -8,6 +8,7 @@ import com.caliverse.admin.domain.entity.STATUS;
public interface AdminMapper {
Optional<Admin> findByEmail(String email);
Optional<Admin> findById(Long id);
boolean existsByEmail(String email);
@@ -18,7 +19,6 @@ public interface AdminMapper {
void initPwd(String password,Long id, Long updateBy);
void updatePwd(String password, Long updateBy, STATUS status);
void saveHistoryPwd(String password,Long adminId);
//운영자 리스트 조회
List<Admin> getAdminList(Map<String, String> requestMap);

View File

@@ -21,7 +21,7 @@ public interface GroupMapper {
int findGroupName(String groupNm);
int getAllCnt();
// 권한 등록
void postAdminGroup(GroupRequest groupRequest);
void postGroup(GroupRequest groupRequest);
//group_auth 테이블 삭제 by groupId
void deleteGroupAuth(String groupId);

View File

@@ -1,22 +0,0 @@
package com.caliverse.admin.domain.dao.admin;
import com.caliverse.admin.domain.entity.Log;
import java.util.List;
import java.util.Map;
public interface HistoryMapper {
// 사용 이력 리스트 조회
List<Log> getHistoryList(Map map);
//전체 데이터 count
int getAllCnt(Map map);
int getTotal();
String getLogJson(String id);
void saveLog(Map map);
//임시로 Meta Data를 넣기 위한 Mepper
void truncateMetaTable();
void insertMetaData(Map map);
}

View File

@@ -1,11 +1,8 @@
package com.caliverse.admin.domain.dao.admin;
import com.caliverse.admin.domain.entity.Event;
import com.caliverse.admin.domain.entity.LandAuction;
import com.caliverse.admin.domain.entity.LandOwnerChange;
import com.caliverse.admin.domain.entity.Message;
import com.caliverse.admin.domain.request.LandRequest;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
@@ -24,8 +21,6 @@ public interface LandMapper {
LandOwnerChange getLandOwnerChangeDetail(Long id);
List<LandOwnerChange> getLandOwnerChangeInfo(int landId);
List<Message> getMessage(Long id);
int getMaxLandSeq(Integer landId);
int getPossibleLand(Integer landId);
int getPossibleLandOwnerChanges(Integer landId);
@@ -33,11 +28,9 @@ public interface LandMapper {
int postLandAuction(LandRequest landRequest);
int postLandOwnerChange(LandRequest landRequest);
void insertMessage(Map map);
int updateLandAuction(LandRequest landRequest);
int updateLandOwnerChange(LandRequest landRequest);
int deleteMessage(Map map);
int initLandAuction(Long id);
int initLandOwnedChanges(Long id);

View File

@@ -58,6 +58,7 @@ public class Admin implements UserDetails{
private LocalDateTime updateDt;
@JsonProperty("update_by")
private String updateBy;
private boolean deleted;
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {

View File

@@ -14,6 +14,7 @@ public enum EMetaData {
GAME_MODE_DATA("GameMode", true),
GAME_MODE_FFA_DATA("GameModeTpsFfa", true),
GAME_MODE_TDM_DATA("GameModeTpsTdm", true),
GAME_MODE_MATCH_DATA("GameModeMatch", true),
BATTLE_CONFIG_DATA("BattleFFAConfig", true),
BATTLE_REWARD_DATA("BattleFFAReward", true),
SYSTEM_MAIL_DATA("SystemMail", true)

View File

@@ -0,0 +1,17 @@
package com.caliverse.admin.domain.entity;
public enum EReqType {
MAIL("MAIL"),
NOTICE("NOTICE"),
QUEST_TASK("QUEST_TASK");
private final String value;
EReqType(String value) {
this.value = value;
}
public String getValue() {
return value;
}
}

View File

@@ -1,4 +1,4 @@
package com.caliverse.admin.domain.adminlog;
package com.caliverse.admin.domain.entity;
import lombok.Getter;
import lombok.Setter;

View File

@@ -1,6 +1,7 @@
package com.caliverse.admin.domain.entity;
import java.time.LocalDateTime;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -57,6 +58,10 @@ public class InGame {
@JsonProperty("send_status")
private SENDSTATUS sendStatus;
@JsonProperty("message_list")
List<Message> messageList;
private boolean deleted;
// 수정자 이메일주소
@JsonProperty("update_by")
private String updateBy;

View File

@@ -37,9 +37,6 @@ public class LandAuction {
// 예약 시작 시간
@JsonProperty("resv_start_dt")
private LocalDateTime resvStartDt;
// 예약 종료 시간
@JsonProperty("resv_end_dt")
private LocalDateTime resvEndDt;
// 경매 시작 시간
@JsonProperty("auction_start_dt")
private LocalDateTime auctionStartDt;

View File

@@ -60,6 +60,7 @@ public class Mail {
// 단일 / 복수 -> guid / 엑셀 경로
private String target;
private boolean deleted;
@JsonProperty("create_by")
private String createBy;
@JsonProperty("create_dt")

View File

@@ -0,0 +1,5 @@
package com.caliverse.admin.domain.entity.common;
public interface BeforeDataResolver {
Object resolveBeforeData(Object parameter);
}

View File

@@ -0,0 +1,57 @@
package com.caliverse.admin.domain.entity.log;
public enum LogAction {
UNKNOWN,
// 특화
LOGIN,
LOGOUT,
UPLOAD,
DOWNLOAD,
CONNECT,
DISCONNECT,
START,
STOP,
PAUSE,
RESUME,
RETRY,
CANCEL,
KICK_USER,
ADMIN_LEVEL,
NICKNAME_CHANGE,
MAIL_ITEM,
QUEST_TASK,
SCHEDULE_CLEANUP,
SCHEDULE_DATA_INIT,
SCHEDULE_LAND_OWNER_CHANGE,
SCHEDULE_BLACK_LIST,
SCHEDULE_NOTICE,
SCHEDULE_MAIL,
SCHEDULE_EVENT,
SCHEDULE_BATTLE_EVENT,
SCHEDULE_LAND_AUCTION,
BANNER,
BATTLE_EVENT,
BUILDING,
LAND_OWNER_CHANGE,
LAND_AUCTION,
GROUP,
ADMIN,
ADMIN_GROUP,
ADMIN_DELETE,
AUTH_ADMIN,
PASSWORD_INIT,
PASSWORD_CHANGE,
BLACK_LIST,
CALIUM_REQUEST,
EVENT,
MAIL,
NOTICE,
DATA_INIT,
DATA,
USER,
ITEM
}

View File

@@ -0,0 +1,13 @@
package com.caliverse.admin.domain.entity.log;
public enum LogCategory {
SCHEDULER,
DYNAMODB,
MARIADB,
MESSAGE_QUEUE,
REDIS,
S3,
BATCH_JOB,
DATA_INIT,
;
}

View File

@@ -0,0 +1,13 @@
package com.caliverse.admin.domain.entity.log;
public enum LogStatus {
SUCCESS,
FAILURE,
PENDING,
RUNNING,
CANCELLED,
TIMEOUT,
RETRY,
PARTIAL_SUCCESS,
WARNING
}

View File

@@ -0,0 +1,25 @@
package com.caliverse.admin.domain.entity.metaEnum;
import com.caliverse.admin.domain.entity.common.ValueEnum;
public enum EGameModeType implements ValueEnum {
None(0),
TPS_FFA(1),
TPS_TDM(2),
RUN_ADV(3),
RUN_RACE(4),
DANCE(5)
;
private final int value;
EGameModeType(int value) {
this.value = value;
}
@Override
public int getValue() {
return value;
}
}

View File

@@ -0,0 +1,9 @@
package com.caliverse.admin.domain.entity.metaEnum;
public enum EJoinInProgressType {
None,
JoinIn,
JoinInSnapShot,
ReEntry
;
}

View File

@@ -0,0 +1,7 @@
package com.caliverse.admin.domain.entity.metaEnum;
public enum ETeamAssignmentType {
Random,
Greedy,
;
}

View File

@@ -0,0 +1,40 @@
package com.caliverse.admin.domain.entity.metadata;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.models.security.SecurityScheme;
import lombok.Getter;
import lombok.Setter;
@Getter @Setter
public class MetaGameModeCommonData {
private Integer id;
private String desc;
@JsonProperty("ax_start_wait_time")
private Integer axStartWaitTime;
@JsonProperty("proceed_if_no_enemies")
private boolean proceedIfNoEnemies;
@JsonProperty("max_play_time")
private Integer maxPlayTime;
@JsonProperty("character_base_stat_data_id")
private Integer characterBaseStatDataID;
@JsonProperty("character_attribute_stat_data_id")
private Integer characterAttributeStatDataID;
@JsonProperty("character_ability_level_data_id")
private Integer characterAbilityLevelDataID;
@JsonProperty("attribute_func_data_id_ue")
private String attributeFuncDataID_UE;
@JsonProperty("genre_name")
private String genreName;
@JsonProperty("mode_name")
private String modeName;
@JsonProperty("map_name")
private String mapName;
@JsonProperty("map_description")
private String mapDescription;
@JsonProperty("map_image")
private String mapImage;
@JsonProperty("map_tooltip_group_id")
private Integer mapTooltipGroupID;
@JsonProperty("guide_url")
private String guideUrl;
}

View File

@@ -0,0 +1,35 @@
package com.caliverse.admin.domain.entity.metadata;
import com.caliverse.admin.domain.entity.metaEnum.EJoinInProgressType;
import com.caliverse.admin.domain.entity.metaEnum.ETeamAssignmentType;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter @Setter
public class MetaGameModeMatchData {
private Integer id;
private String desc;
@JsonProperty("mmr_check")
private boolean mmrCheck;
@JsonProperty("party_match_player_count_able_array")
private List<Integer> partyMatchPlayerCountAbleArray;
@JsonProperty("match_wait_time_sec")
private Integer matchWaitTimeSec;
@JsonProperty("game_mode_mmr_id")
private Integer gameModeMmrID;
@JsonProperty("match_retry_count")
private Integer matchRetryCount;
@JsonProperty("mmr_expansion_phase")
private Integer mmrExpansionPhase;
@JsonProperty("team_assignment")
private ETeamAssignmentType teamAssignment;
@JsonProperty("join_in_progress")
private EJoinInProgressType joinInProgress;
@JsonProperty("join_in_max_time_sec")
private Integer joinInMaxTimeSec;
@JsonProperty("entrance_closing_time")
private Integer entranceClosingTime;
}

View File

@@ -2,6 +2,8 @@ package com.caliverse.admin.domain.request;
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.entity.SEARCHTYPE;
import com.caliverse.admin.domain.entity.log.LogAction;
import com.caliverse.admin.domain.entity.log.LogCategory;
import com.caliverse.admin.mongodb.entity.DBType;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
@@ -20,6 +22,9 @@ public class HistoryRequest {
private String userMail;
@JsonProperty("db_type")
private DBType dbType;
private LogCategory category;
private LogAction action;
private String status;
@JsonProperty("search_type")
private SEARCHTYPE searchType;

View File

@@ -33,9 +33,6 @@ public class LandRequest {
// 예약 시작 시간
@JsonProperty("resv_start_dt")
private LocalDateTime resvStartDt;
// 예약 종료 시간
@JsonProperty("resv_end_dt")
private LocalDateTime resvEndDt;
// 경매 시작 시간
@JsonProperty("auction_start_dt")
private LocalDateTime auctionStartDt;
@@ -47,8 +44,6 @@ public class LandRequest {
//경매 시작가
@JsonProperty("start_price")
private Double startPrice;
@JsonProperty("message_list")
private List<Message> massageList;
//소유권 변경
@JsonProperty("user_guid")

View File

@@ -57,7 +57,7 @@ public class NoticeRequest {
@Getter
public static class MessageId{
@JsonProperty("message_id")
private Long messageId;
@JsonProperty("id")
private Long id;
}
}

View File

@@ -0,0 +1,57 @@
package com.caliverse.admin.domain.response;
import com.caliverse.admin.domain.entity.BattleEvent;
import com.caliverse.admin.domain.entity.metadata.MetaBattleConfigData;
import com.caliverse.admin.domain.entity.metadata.MetaBattleRewardData;
import com.caliverse.admin.domain.entity.metadata.MetaGameModeData;
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 GameResponse {
private int status;
private String result;
@JsonProperty("data")
private ResultData resultData;
@Data
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class ResultData {
@JsonProperty("event_detail")
private BattleEvent battleEvent;
@JsonProperty("event_list")
private List<BattleEvent> battleEventList;
@JsonProperty("battle_config_list")
private List<MetaBattleConfigData> battleConfigList;
@JsonProperty("battle_reward_list")
private List<MetaBattleRewardData> battleRewardList;
@JsonProperty("game_mode_list")
private List<MetaGameModeData> gameModeList;
private String message;
private int total;
@JsonProperty("total_all")
private int totalAll;
@JsonProperty("page_no")
private int pageNo;
}
}

View File

@@ -1,6 +1,7 @@
package com.caliverse.admin.domain.response;
import com.caliverse.admin.domain.entity.Log;
import com.caliverse.admin.mongodb.domain.BusinessLog;
import com.caliverse.admin.mongodb.domain.HistoryLogInfoBase;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -30,7 +31,8 @@ public class HistoryResponse {
@JsonProperty("list")
// private List<Log> list ;
private List<HistoryLogInfoBase> list ;
// private List<HistoryLogInfoBase> list ;
private List<BusinessLog> list ;
private String content; // db에 text유형의 데이터를 가져옴

View File

@@ -1,6 +1,9 @@
package com.caliverse.admin.domain.response;
import com.caliverse.admin.Indicators.entity.AssetsIndicatorInfo;
import com.caliverse.admin.Indicators.entity.CurrencyIndicatorInfo;
import com.caliverse.admin.Indicators.entity.DauLogInfo;
import com.caliverse.admin.Indicators.entity.ItemIndicatorInfo;
import com.caliverse.admin.domain.entity.Currencys;
import com.caliverse.admin.domain.entity.Distinct;
import com.fasterxml.jackson.annotation.JsonInclude;
@@ -21,9 +24,10 @@ public class IndicatorsResponse {
private int status;
private String result;
@JsonProperty("data")
@JsonProperty("data")
private ResultData resultData;
@Data
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
@@ -32,6 +36,8 @@ public class IndicatorsResponse {
private String message;
private Dashboard dashboard;
@JsonProperty("dashboard_calium")
private DashboardCaliumConverter dashboardCalium;
@JsonProperty("user_statistics_list")
private List<userStatistics> userStatisticsList;
@JsonProperty("dau_list")
@@ -41,13 +47,17 @@ public class IndicatorsResponse {
//Retention
@JsonProperty("retention")
private List<Retention> retentionList;
@JsonProperty("currency_list")
private List<CurrencyIndicatorInfo> currencyList;
@JsonProperty("item_list")
private List<ItemIndicatorInfo> itemList;
@JsonProperty("assets_list")
private List<AssetsIndicatorInfo> assetsList;
//Segment
@JsonProperty("start_dt")
private String startDt;
@JsonProperty("end_dt")
private String endDt;
@JsonProperty("segment")
private List<Segment> segmentList;
//플레이타임
@JsonProperty("playtime")
private List<Playtime> playtimeList;
@@ -57,9 +67,6 @@ public class IndicatorsResponse {
@JsonProperty("list")
private List<DailyGoods> dailyGoods;
// @JsonProperty("dau_list")
// private List<DailyActiveUser> dailyActiveUserList;
}
@Data
@@ -72,6 +79,21 @@ public class IndicatorsResponse {
private MCU mcu;
}
@Data
@Builder
public static class DashboardCaliumConverter{
@JsonProperty("total_calium")
private Double totalCalium;
@JsonProperty("cumulative_calium")
private Double CumulativeCalium;
@JsonProperty("daily_fill_up_calium")
private Double dailyFillUpCalium;
@JsonProperty("converter_rate")
private Double converterRate;
@JsonProperty("inflation_rate")
private Double inflationRete;
}
//이용자 지표
@Data
@Builder
@@ -129,19 +151,6 @@ public class IndicatorsResponse {
}
@Data
@Builder
public static class Dday{
private String date;
private String dif;
}
@Data
@Builder
public static class Segment{
private String type;
private String au;
private String dif;
}
@Data
@Builder
public static class Playtime{
private LocalDate date;
@JsonProperty("user_cnt")

View File

@@ -47,6 +47,8 @@ public class LogResponse {
private List<ItemDetailLogInfo> itemDetailList;
@JsonProperty("currency_item_list")
private List<CurrencyItemLogInfo> currencyItemList;
@JsonProperty("snapshot_list")
private List<SnapshotLogInfo> snapshotList;
private int total;
@JsonProperty("total_all")

View File

@@ -64,7 +64,7 @@ public class AIService {
} catch (JsonProcessingException e) {
throw new RuntimeException("JSON 변환 실패", e);
}
messages.add(CommonUtils.getAIMessage(AIRole.user, messageMerge(userMessage, dataJson)));
messages.add(getAIMessage(AIRole.user, messageMerge(userMessage, dataJson)));
return messages;
}
@@ -75,7 +75,7 @@ public class AIService {
private List<Map<String,String>> initMessage(){
List<Map<String,String>> messages = new ArrayList<>();
messages.add(CommonUtils.getAIMessage(AIRole.system,
messages.add(getAIMessage(AIRole.system,
"""
너는 프론트엔드 게시용 데이터를 생성하는 게임 데이터 분석 AI야. \
사용자는 게임 로그 데이터와 함께 다양한 질문을 보낼 수 있어. \
@@ -97,7 +97,7 @@ public class AIService {
switch (type){
case BUSINESS_LOG -> {
LogGenericRequest logReq = mapper.convertValue(conditions, LogGenericRequest.class);
List<GenericMongoLog> logs = businessLogGenericService.loadBusinessLogData(logReq, GenericMongoLog.class, true);
List<GenericMongoLog> logs = businessLogGenericService.loadBusinessLogData(logReq, GenericMongoLog.class);
return logs;
}
case MAIL -> {
@@ -107,4 +107,8 @@ public class AIService {
default -> throw new RuntimeException("Not Type");
}
}
private static Map<String, String> getAIMessage(AIRole role, String message){
return Map.of("role", role.toString(), "content", message);
}
}

View File

@@ -1,24 +1,23 @@
package com.caliverse.admin.domain.service;
import com.caliverse.admin.domain.adminlog.AdminPasswordInitLog;
import com.caliverse.admin.domain.adminlog.IAdminLog;
import com.caliverse.admin.domain.dao.admin.AdminMapper;
import com.caliverse.admin.domain.dao.admin.GroupMapper;
import com.caliverse.admin.domain.entity.*;
import com.caliverse.admin.domain.entity.log.LogAction;
import com.caliverse.admin.domain.request.AdminRequest;
import com.caliverse.admin.domain.request.AuthenticateRequest;
import com.caliverse.admin.domain.response.AdminResponse;
import com.caliverse.admin.global.common.annotation.BusinessProcess;
import com.caliverse.admin.global.common.annotation.RequestLog;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.code.SuccessCode;
import com.caliverse.admin.global.common.constants.MysqlConstants;
import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
import jakarta.mail.internet.MimeMessage;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
@@ -55,22 +54,20 @@ public class AdminService {
private String username;
@Value("${spring.mail.password}")
private String password;
// 비번 초기화
@BusinessProcess(action = LogAction.PASSWORD_INIT)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public AdminResponse initPassword(AuthenticateRequest authenticateRequest){
Optional<Admin> admin = adminMapper.findByEmail(authenticateRequest.getEmail());
String initPwd = randomPwd();
adminMapper.initPwd(passwordEncoder.encode(initPwd), admin.get().getId(), CommonUtils.getAdmin().getId());
//유저 비번 기록 남기기
adminMapper.saveHistoryPwd(passwordEncoder.encode(initPwd), admin.get().getId());
//smtp
sendMail(authenticateRequest.getEmail(),initPwd);
IAdminLog adminLog = new AdminPasswordInitLog(admin.get().getName(), admin.get().getEmail());
adminLog.saveLogToDB();
log.info("initPassword id: {}, email: {}", admin.get().getId(), admin.get().getEmail());
log.info("initPassword Complete id: {}, email: {}", admin.get().getId(), admin.get().getEmail());
return AdminResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())
@@ -80,13 +77,17 @@ public class AdminService {
}
// 비번 재설정
@BusinessProcess(action = LogAction.PASSWORD_CHANGE)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public AdminResponse updatePassword(AuthenticateRequest authenticateRequest){
String oldPwd = authenticateRequest.getPassword();
String newPwd = authenticateRequest.getNewPassword();
String pwdById = adminMapper.findPwdById(CommonUtils.getAdmin().getId());
Optional<Admin> beforeInfo = adminMapper.findByEmail(CommonUtils.getAdmin().getEmail());
/*
https://nzin-publisher-bts.atlassian.net/browse/CAL-120
임시 비밀번호 재설정 화면에서 현재 비밀번호 입력 필드가 노출되는 현상
@@ -102,8 +103,6 @@ public class AdminService {
if(count == 0){
adminMapper.updatePwd(passwordEncoder.encode(newPwd), CommonUtils.getAdmin().getId(), STATUS.PERMITTED );
//유저 비번 기록 남기기
adminMapper.saveHistoryPwd(passwordEncoder.encode(newPwd), CommonUtils.getAdmin().getId());
}else{
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.PASSWORD_INCLUDE.getMessage());
}
@@ -118,6 +117,7 @@ public class AdminService {
}
// 사용자 정보 조회
@RequestLog
public AdminResponse getAdminInfo(){
AdminResponse.ResultData resultData = null;
@@ -143,7 +143,9 @@ public class AdminService {
.resultData(resultData)
.build();
}
// 운영자 조회
@RequestLog
public AdminResponse getAdminList(Map<String, String> requestParams){
AdminResponse.ResultData adminData = null;
@@ -168,7 +170,9 @@ public class AdminService {
}
// 로그인 승인/불가
@BusinessProcess(action = LogAction.ADMIN)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public AdminResponse updateStatus(AdminRequest adminRequest){
Map<String , Object> map = new HashMap<>();
adminRequest.getList().forEach(
@@ -187,14 +191,6 @@ public class AdminService {
}
//로그인 승인
adminMapper.updateStatus(map);
mysqlHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.LOGIN_PERMITTED,
MysqlConstants.TABLE_NAME_ADMIN,
HISTORYTYPEDETAIL.LOGIN_PERMITTED.name(),
info.get(),
adminMapper.findByEmail(email)
);
}
);
@@ -207,8 +203,10 @@ public class AdminService {
.build();
}
//운영자 그룹 저장
//운영자 그룹 변경
@BusinessProcess(action = LogAction.ADMIN_GROUP)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public AdminResponse updateGroup(AdminRequest adminRequest){
Map<String , Object> map = new HashMap<>();
adminRequest.getList().forEach(
@@ -218,19 +216,9 @@ public class AdminService {
map.put("group_id", item.getGroupId());
map.put("id", CommonUtils.getAdmin().getId());
//변경전 그룹 명세 조회
Optional<Admin> info = adminMapper.findByEmail(email);
//쿼리 실행
adminMapper.updateGroup(map);
mysqlHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.ADMIN_INFO_UPDATE,
MysqlConstants.TABLE_NAME_ADMIN,
HISTORYTYPEDETAIL.ADMIN_INFO_UPDATE.name(),
info.get(),
adminMapper.findByEmail(email)
);
}
);
@@ -243,25 +231,18 @@ public class AdminService {
}
// 운영자 선택 삭제
@BusinessProcess(action = LogAction.ADMIN_DELETE)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public AdminResponse deleteAdmin(AdminRequest adminRequest){
Map<String , Object> map = new HashMap<>();
adminRequest.getList().forEach(
item -> {
map.put("email", item.getEmail());
map.put("deleted", String.valueOf(1));
//로그 기록
Optional<Admin> info = adminMapper.findByEmail(item.getEmail());
//쿼리 실행
adminMapper.deleteAdmin(map);
mysqlHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.ADMIN_INFO_DELETE,
MysqlConstants.TABLE_NAME_ADMIN,
HISTORYTYPEDETAIL.ADMIN_INFO_DELETE.name(),
info.get()
);
}
);
log.info("deleteAdmin Deleted Admin: {}", map);

View File

@@ -5,8 +5,11 @@ import com.caliverse.admin.domain.dao.admin.TokenMapper;
import com.caliverse.admin.domain.entity.Admin;
import com.caliverse.admin.domain.entity.STATUS;
import com.caliverse.admin.domain.entity.Token;
import com.caliverse.admin.domain.entity.log.LogAction;
import com.caliverse.admin.domain.request.AuthenticateRequest;
import com.caliverse.admin.domain.response.AuthenticateResponse;
import com.caliverse.admin.global.common.annotation.BusinessProcess;
import com.caliverse.admin.global.common.annotation.RequestLog;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.code.SuccessCode;
@@ -21,6 +24,7 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.time.ZoneId;
@@ -32,7 +36,7 @@ import java.time.temporal.ChronoUnit;
@RequiredArgsConstructor
public class AuthenticateService{
private final AdminMapper userMapper;
private final AdminMapper adminMapper;
private final TokenMapper tokenMapper;
private final AuthenticationManager authenticationManager;
private final JwtService jwtService;
@@ -47,7 +51,7 @@ public class AuthenticateService{
String email = authenticateRequest.getEmail();
String pw = authenticateRequest.getPassword();
// 삭제 계정 여부
if(!userMapper.existsByEmail(email)){
if(!adminMapper.existsByEmail(email)){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NOT_MATCH_USER.getMessage());
}
@@ -58,7 +62,7 @@ public class AuthenticateService{
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NOT_FOUND_USER.getMessage());
}
Admin admin = userMapper.findByEmail(authenticateRequest.getEmail())
Admin admin = adminMapper.findByEmail(authenticateRequest.getEmail())
.orElseThrow(() -> new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NOT_MATCH_USER.getMessage()));
//비번 기간 만료
@@ -93,9 +97,12 @@ public class AuthenticateService{
}
//회원가입
@BusinessProcess(action = LogAction.USER)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public AuthenticateResponse register(AuthenticateRequest authenticateRequest){
if(userMapper.existsByEmail(authenticateRequest.getEmail())){
if(adminMapper.existsByEmail(authenticateRequest.getEmail())){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DUPLICATED_EMAIL.getMessage());
}
@@ -108,7 +115,7 @@ public class AuthenticateService{
.password(passwordEncoder.encode(authenticateRequest.getPassword()))
.build();
userMapper.save(admin);
adminMapper.save(admin);
log.info("register Sign Up : {}", admin);
return AuthenticateResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())

View File

@@ -4,6 +4,8 @@ import com.caliverse.admin.domain.dao.admin.BattleMapper;
import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
import com.caliverse.admin.domain.entity.BattleEvent;
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.entity.log.LogAction;
import com.caliverse.admin.domain.entity.log.LogStatus;
import com.caliverse.admin.domain.entity.metadata.MetaBattleConfigData;
import com.caliverse.admin.domain.entity.metadata.MetaBattleRewardData;
import com.caliverse.admin.domain.entity.metadata.MetaGameFFAConfigData;
@@ -11,6 +13,8 @@ import com.caliverse.admin.domain.entity.metadata.MetaGameModeData;
import com.caliverse.admin.domain.request.BattleEventRequest;
import com.caliverse.admin.domain.response.BattleEventResponse;
import com.caliverse.admin.dynamodb.service.DynamodbBattleEventService;
import com.caliverse.admin.global.common.annotation.BusinessProcess;
import com.caliverse.admin.global.common.annotation.RequestLog;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.code.SuccessCode;
@@ -90,6 +94,7 @@ public class BattleEventService {
}
// 전투시스템 이벤트 조회
@RequestLog
public BattleEventResponse getBattleEventList(@RequestParam Map<String, String> requestParam){
requestParam = CommonUtils.pageSetting(requestParam);
@@ -113,7 +118,10 @@ public class BattleEventService {
}
// 전투시스템 이벤트 상세조회
@RequestLog
public BattleEventResponse getBattleEventDetail(Long id){
String email = CommonUtils.getAdmin() != null ? CommonUtils.getAdmin().getEmail() : "";
log.info("getBattleEventDetail user: {}, id: {}", email, id);
BattleEvent battleEvent = battleMapper.getBattleEventDetail(id);
@@ -127,7 +135,9 @@ public class BattleEventService {
}
// 전투시스템 이벤트 저장
@BusinessProcess(action = LogAction.BATTLE_EVENT)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public BattleEventResponse postBattleEvent(BattleEventRequest battleEventRequest){
if(battleEventRequest.getRepeatType().equals(BattleEvent.BATTLE_REPEAT_TYPE.NONE)){
LocalDateTime start_dt = battleEventRequest.getEventStartDt();
@@ -153,7 +163,7 @@ public class BattleEventService {
.result(ErrorCode.ERROR_BATTLE_EVENT_TIME_OVER.toString())
.build();
}
// metadata기준 되기전에 운영툴에서 입력값받아서 계산하던 부분
// int operation_time = ffACalcEndTime(battleEventRequest);
List<BattleEvent> existingList = battleMapper.getCheckBattleEventList(battleEventRequest);
@@ -171,23 +181,11 @@ public class BattleEventService {
// battleEventRequest.setEventId(next_event_id);
int result = battleMapper.postBattleEvent(battleEventRequest);
log.info("AdminToolDB BattleEvent Save: {}", battleEventRequest);
log.info("AdminToolDB BattleEvent Save id: {}", battleEventRequest.getId());
long battle_event_id = battleEventRequest.getId();
battleEventRequest.setEventId((int) battle_event_id);
HashMap<String,String> map = new HashMap<>();
map.put("id",String.valueOf(battle_event_id));
BattleEvent event_info = battleMapper.getBattleEventDetail(battle_event_id);
mysqlHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.BATTLE_EVENT_ADD,
MysqlConstants.TABLE_NAME_BATTLE_EVENT,
HISTORYTYPEDETAIL.BATTLE_EVENT_ADD.name(),
event_info
);
dynamodbBattleEventService.insertBattleEvent(battleEventRequest);
return BattleEventResponse.builder()
@@ -200,7 +198,9 @@ public class BattleEventService {
}
// 전투시스템 이벤트 수정
@BusinessProcess(action = LogAction.BATTLE_EVENT)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public BattleEventResponse updateBattleEvent(Long id, BattleEventRequest battleEventRequest) {
battleEventRequest.setId(id);
battleEventRequest.setUpdateBy(CommonUtils.getAdmin().getId());
@@ -237,20 +237,7 @@ public class BattleEventService {
battleEventRequest.setEventEndDt(end_dt_kst);
int result = battleMapper.updateBattleEvent(battleEventRequest);
log.info("AdminToolDB BattleEvent Update Complete: {}", battleEventRequest);
Map<String, String> map = new HashMap<>();
map.put("id", String.valueOf(id));
BattleEvent after_info = battleMapper.getBattleEventDetail(id);
mysqlHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE,
MysqlConstants.TABLE_NAME_BATTLE_EVENT,
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE.name(),
before_info,
after_info
);
log.info("AdminToolDB BattleEvent Update Complete id: {}", id);
dynamodbBattleEventService.updateBattleEvent(battleEventRequest);
@@ -263,7 +250,9 @@ public class BattleEventService {
}
// 전투시스템 이벤트 중단
@BusinessProcess(action = LogAction.BATTLE_EVENT)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public BattleEventResponse updateStopBattleEvent(Long id){
Map<String,Object> map = new HashMap<>();
@@ -280,19 +269,7 @@ public class BattleEventService {
map.put("status", BattleEvent.BATTLE_STATUS.STOP);
map.put("updateBy", CommonUtils.getAdmin().getId());
int result = battleMapper.updateStatusBattleEvent(map);
try{
log.info("BattleEvent Stop Complete: {}", objectMapper.writeValueAsString(info));
}catch(Exception e){
log.error("BattleEvent Stop Failed: {}", e.getMessage());
}
mysqlHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE,
MysqlConstants.TABLE_NAME_BATTLE_EVENT,
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE.name(),
info,
battleMapper.getBattleEventDetail(id)
);
log.info("BattleEvent Stop Complete id: {}", id);
dynamodbBattleEventService.updateStopBattleEvent(info);
@@ -305,7 +282,9 @@ public class BattleEventService {
}
// 전투시스템 이벤트 삭제(사용안함)
@BusinessProcess(action = LogAction.BATTLE_EVENT)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public BattleEventResponse deleteBattleEvent(BattleEventRequest battleEventRequest){
Map<String,Object> map = new HashMap<>();
AtomicBoolean is_falil = new AtomicBoolean(false);
@@ -323,14 +302,7 @@ public class BattleEventService {
map.put("id", id);
map.put("updateBy", CommonUtils.getAdmin().getId());
int result = battleMapper.deleteBattleEvent(map);
log.info("BattleEvent Delete Complete: {}", item);
mysqlHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.BATTLE_EVENT_DELETE,
MysqlConstants.TABLE_NAME_BATTLE_EVENT,
HISTORYTYPEDETAIL.BATTLE_EVENT_DELETE.name(),
info
);
log.info("BattleEvent Delete Complete id: {}", id);
// dynamodbLandAuctionService.cancelLandAuction(auction_info);
}

View File

@@ -4,9 +4,12 @@ import com.caliverse.admin.domain.dao.admin.BlackListMapper;
import com.caliverse.admin.domain.entity.BlackList;
import com.caliverse.admin.domain.entity.Excel;
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.entity.log.LogAction;
import com.caliverse.admin.domain.request.BlackListRequest;
import com.caliverse.admin.domain.response.BlackListResponse;
import com.caliverse.admin.dynamodb.service.DynamodbUserService;
import com.caliverse.admin.global.common.annotation.BusinessProcess;
import com.caliverse.admin.global.common.annotation.RequestLog;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.code.SuccessCode;
@@ -43,6 +46,7 @@ public class BlackListService {
private String excelPath;
private final ResourceLoader resourceLoader;
@RequestLog
public BlackListResponse getBlackList(Map requestParams){
//페이징 처리
requestParams = CommonUtils.pageSetting(requestParams);
@@ -64,6 +68,7 @@ public class BlackListService {
.build();
}
@RequestLog
public BlackListResponse getBlackListDetail(Long id ){
BlackList blackList = blackListMapper.getBlackListDetail(id);
List<BlackList> historyByGuid = blackListMapper.getHistoryByGuid(blackList.getGuid());
@@ -142,7 +147,9 @@ public class BlackListService {
return resourceLoader.getResource(excelPath + fileName);
}
@BusinessProcess(action = LogAction.BLACK_LIST)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public BlackListResponse postBlackList(BlackListRequest blackListRequest){
// 이용자 제재 상태를 판단하는 로직
@@ -167,16 +174,8 @@ public class BlackListService {
blackListRequest.setGuid(guid);
blackListRequest.setNickname(item.getNickname());
blackListMapper.postBlackList(blackListRequest);
logger.info("postBlackList insertBlackList: {}",blackListRequest);
logger.info("postBlackList insertBlackList id: {}",blackListRequest.getId());
BlackList info = blackListMapper.getBlackListDetail(blackListRequest.getId());
mysqlHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.BLACKLIST_ADD,
MysqlConstants.TABLE_NAME_USER_BLOCK,
HISTORYTYPEDETAIL.BLACKLIST_ADD.name(),
info
);
}
}
);
@@ -201,16 +200,8 @@ public class BlackListService {
blackListRequest.setGuid(item.getGuid());
blackListRequest.setNickname(dynamodbUserService.getGuidByName(item.getGuid()));
blackListMapper.postBlackList(blackListRequest);
logger.info("postBlackList insertBlackList: {}",blackListRequest);
logger.info("postBlackList insertBlackList id: {}",blackListRequest.getId());
BlackList info = blackListMapper.getBlackListDetail(blackListRequest.getId());
mysqlHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.BLACKLIST_ADD,
MysqlConstants.TABLE_NAME_USER_BLOCK,
HISTORYTYPEDETAIL.BLACKLIST_ADD.name(),
info
);
}
}
);
@@ -225,7 +216,9 @@ public class BlackListService {
}
@BusinessProcess(action = LogAction.BLACK_LIST)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public BlackListResponse deleteBlackList(BlackListRequest blackListRequest){
Map<String,Object> map = new HashMap<>();
@@ -238,15 +231,7 @@ public class BlackListService {
map.put("reason",item.getReason());
blackListMapper.deleteBlackList(map);
logger.info("deleteBlackList delete: {}",map);
mysqlHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.BLACKLIST_DELETE,
MysqlConstants.TABLE_NAME_USER_BLOCK,
HISTORYTYPEDETAIL.BLACKLIST_DELETE.name(),
blackList,
blackListMapper.getBlackListDetail(id)
);
logger.info("deleteBlackList delete id: {}", id);
if(dynamodbUserService.isBlockUser(blackList.getGuid()))
dynamodbUserService.updateBlockUser(BlackList.STATUSTYPE.EXPIRATION, blackList);
@@ -269,7 +254,7 @@ public class BlackListService {
blackListMapper.updateStatus(map);
logger.info("updateBlackListStatus BlackListSchedule status update: {}",map);
logger.info("updateBlackListStatus status update id: {}, status: {}", id, status.toString());
}
public List<BlackList> getScheduleBlackList(){

View File

@@ -13,19 +13,17 @@ import com.caliverse.admin.domain.request.Web3Request;
import com.caliverse.admin.domain.response.CaliumResponse;
import com.caliverse.admin.domain.response.Web3Response;
import com.caliverse.admin.dynamodb.service.DynamodbCaliumService;
import com.caliverse.admin.global.common.annotation.BusinessProcess;
import com.caliverse.admin.global.common.annotation.RequestLog;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.code.SuccessCode;
import com.caliverse.admin.global.common.constants.MysqlConstants;
import com.caliverse.admin.global.common.constants.Web3Constants;
import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.logs.Indicatordomain.GenericMongoLog;
import com.caliverse.admin.logs.entity.LogAction;
import com.caliverse.admin.logs.logservice.businesslogservice.BusinessLogGenericService;
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.json.JSONObject;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -42,11 +40,8 @@ import java.util.Optional;
public class CaliumService {
private final CaliumMapper caliumMapper;
private final HistoryService historyService;
private final Web3Service web3Service;
// private final DynamoDBService dynamoDBService;
private final DynamodbCaliumService dynamodbCaliumService;
private final MysqlHistoryLogService mysqlHistoryLogService;
private final BusinessLogGenericService businessLogGenericService;
public CaliumResponse getCaliumLimit(){
@@ -80,6 +75,7 @@ public class CaliumService {
}
}
@RequestLog
public CaliumResponse getList(Map requestParam){
//페이징 처리
requestParam = CommonUtils.pageSetting(requestParam);
@@ -125,7 +121,9 @@ public class CaliumService {
.build();
}
@BusinessProcess(action = com.caliverse.admin.domain.entity.log.LogAction.CALIUM_REQUEST)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public CaliumResponse postCaliumRequest(CaliumRequest caliumRequest){
caliumRequest.setCreateBy(CommonUtils.getAdmin().getId());
@@ -159,15 +157,6 @@ public class CaliumService {
int result = caliumMapper.postCaliumRequest(caliumRequest);
log.info("postEvent AdminToolDB Event Save: {}", caliumRequest);
Calium calium = caliumMapper.getCaliumRequestDetail(caliumRequest.getId());
mysqlHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.CALIUM_ADD,
MysqlConstants.TABLE_NAME_CALIUM_REQUEST,
HISTORYTYPEDETAIL.CALIUM_ADD.name(),
calium
);
return CaliumResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
@@ -177,7 +166,9 @@ public class CaliumService {
.build();
}
@BusinessProcess(action = com.caliverse.admin.domain.entity.log.LogAction.CALIUM_REQUEST)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public CaliumResponse updateCaliumCharged(CaliumRequest caliumRequest){
log.info("updateCaliumCharged calium Request: {}", caliumRequest);
Calium calium = caliumMapper.getCaliumRequestDetail(caliumRequest.getId());
@@ -200,25 +191,13 @@ public class CaliumService {
updateCaliumRequest(caliumRequest.getId(), Calium.CALIUMREQUESTSTATUS.FINISH);
mysqlHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE,
MysqlConstants.TABLE_NAME_CALIUM_REQUEST,
HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE.name(),
info,
caliumMapper.getCaliumRequestDetail(caliumRequest.getId())
);
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("dynamoDB_update",dynamoResult);
// historyService.setLog(HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE, jsonObject);
return CaliumResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.build();
}
@BusinessProcess(action = com.caliverse.admin.domain.entity.log.LogAction.CALIUM_REQUEST)
@Transactional(transactionManager = "transactionManager")
public void getScheduleCaliumRequestList(){
List<Calium> scheduleList = caliumMapper.getScheduleCaliumRequest();

View File

@@ -3,10 +3,12 @@ package com.caliverse.admin.domain.service;
import com.caliverse.admin.domain.dao.admin.DataMapper;
import com.caliverse.admin.domain.dao.admin.LandMapper;
import com.caliverse.admin.domain.entity.*;
import com.caliverse.admin.domain.entity.log.LogAction;
import com.caliverse.admin.domain.request.DataRequest;
import com.caliverse.admin.domain.request.LogGenericRequest;
import com.caliverse.admin.domain.response.DataResponse;
import com.caliverse.admin.dynamodb.service.DynamodbDataService;
import com.caliverse.admin.global.common.annotation.BusinessProcess;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.code.SuccessCode;
@@ -33,7 +35,6 @@ import java.util.Map;
public class DataService {
private final DynamodbDataService dynamodbDataService;
private final MysqlHistoryLogService mysqlHistoryLogService;
private final LandMapper landMapper;
private final DataMapper dataMapper;
private final DataInitializeHistoryService dataInitializeHistoryService;
@@ -78,6 +79,7 @@ public class DataService {
}
@BusinessProcess(action = LogAction.DATA)
@Transactional(transactionManager = "transactionManager")
public DataResponse initData(DataRequest dataRequest){
EInitDataType dataType = dataRequest.getInitDataType();
@@ -86,13 +88,6 @@ public class DataService {
dataMapper.postDataInit(dataRequest);
mysqlHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.DATA_INIT_ADD,
MysqlConstants.TABLE_NAME_DATA_INIT,
HISTORYTYPEDETAIL.DATA_INIT_ADD.name(),
dataMapper.getDataInitDetail(dataRequest.getId())
);
// switch(dataType){
// case LandAuction -> {
// int result = initLandAuction();
@@ -131,26 +126,6 @@ public class DataService {
long auctionId = landAuction.getId();
int result = landMapper.initLandAuction(auctionId);
List<Message> message = landMapper.getMessage(auctionId);
Map map = new HashMap();
map.put("id", landAuction.getId());
landMapper.deleteMessage(map);
mysqlHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
MysqlConstants.TABLE_NAME_LAND_AUCTION,
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
landAuction
);
if (!message.isEmpty()) {
mysqlHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
MysqlConstants.TABLE_NAME_MESSAGE,
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
message
);
}
dataInitializeHistoryService.mysqlDataInitHistory(
EInitDataType.LandAuction,
MysqlConstants.TABLE_NAME_LAND_AUCTION,
@@ -176,13 +151,6 @@ public class DataService {
long id = landOwnerChange.getId();
landMapper.initLandOwnedChanges(id);
mysqlHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE,
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE.name(),
landOwnerChange
);
dataInitializeHistoryService.mysqlDataInitHistory(
EInitDataType.LandOwned,
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
@@ -206,6 +174,7 @@ public class DataService {
return dataMapper.getDataInit();
}
@BusinessProcess(action = LogAction.DATA)
public void updateStatus(long id, DataInit.DATA_INIT_STATUS status){
dataMapper.updateStatus(id, status.toString());
}

View File

@@ -3,21 +3,28 @@ package com.caliverse.admin.domain.service;
import com.caliverse.admin.domain.dao.admin.EventMapper;
import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
import com.caliverse.admin.domain.entity.*;
import com.caliverse.admin.domain.entity.log.LogAction;
import com.caliverse.admin.domain.entity.log.LogStatus;
import com.caliverse.admin.domain.request.EventRequest;
import com.caliverse.admin.domain.response.EventResponse;
import com.caliverse.admin.dynamodb.service.DynamodbMailService;
import com.caliverse.admin.dynamodb.service.DynamodbService;
import com.caliverse.admin.global.common.annotation.BusinessProcess;
import com.caliverse.admin.global.common.annotation.RequestLog;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.code.SuccessCode;
import com.caliverse.admin.global.common.constants.MysqlConstants;
import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.global.component.manager.BusinessProcessIdManager;
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.json.JSONObject;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import java.time.LocalDateTime;
import java.util.HashMap;
@@ -33,9 +40,10 @@ public class EventService {
private final EventMapper eventMapper;
private final MetaDataHandler metaDataHandler;
private final HistoryService historyService;
private final MysqlHistoryLogService mysqlHistoryLogService;
private final BusinessProcessIdManager processIdManager;
@RequestLog
public EventResponse getList(Map requestParam){
//페이징 처리
requestParam = CommonUtils.pageSetting(requestParam);
@@ -58,6 +66,7 @@ public class EventService {
.build();
}
@RequestLog
public EventResponse getDetail(Long id){
Event event = eventMapper.getEventDetail(id);
@@ -80,12 +89,14 @@ public class EventService {
.build();
}
@BusinessProcess(action = LogAction.EVENT)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public EventResponse postEvent(EventRequest eventRequest){
eventRequest.setCreateBy(CommonUtils.getAdmin().getId());
int result = eventMapper.postEvent(eventRequest);
log.info("postEvent AdminToolDB Event Save: {}", eventRequest);
log.info("postEvent AdminToolDB Event Save id: {}", eventRequest.getId());
long event_id = eventRequest.getId();
@@ -117,14 +128,29 @@ public class EventService {
}
log.info("postEvent AdminToolDB Message Save Complete");
Event event = eventMapper.getEventDetail(event_id);
String prodId = processIdManager.getCurrentProcessId();
Event event = eventMapper.getEventDetail(event_id);
event.setMailList(eventMapper.getMessage(event_id));
event.setItemList(eventMapper.getItem(event_id));
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
try {
mysqlHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.EVENT_ADD,
prodId,
LogAction.EVENT,
LogStatus.SUCCESS,
MysqlConstants.TABLE_NAME_EVENT,
HISTORYTYPEDETAIL.EVENT_ADD.name(),
"",
event
);
} catch (Exception e) {
log.warn("Failed to log event creation: {}", e.getMessage());
}
}
});
return EventResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())
@@ -135,7 +161,9 @@ public class EventService {
.build();
}
@BusinessProcess(action = LogAction.EVENT)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public EventResponse updateEvent(Long id, EventRequest eventRequest) {
eventRequest.setId(id);
eventRequest.setUpdateBy(CommonUtils.getAdmin().getId());
@@ -147,7 +175,6 @@ public class EventService {
before_info.setItemList(eventMapper.getItem(event_id));
int result = eventMapper.updateEvent(eventRequest);
log.info("updateEvent AdminToolDB Event Update Complete: {}", eventRequest);
Map<String, String> map = new HashMap<>();
map.put("mailId", String.valueOf(event_id));
@@ -164,7 +191,6 @@ public class EventService {
eventMapper.insertItem(map);
});
}
log.info("updateEvent AdminToolDB Item Update Complete");
// message 테이블 데이터 삭제 처리 by mail_id
eventMapper.deleteMessage(map);
@@ -179,19 +205,31 @@ public class EventService {
eventMapper.insertMessage(map);
});
}
log.info("updateEvent AdminToolDB Message Update Complete");
log.info("updateEvent AdminToolDB Event Update Complete id: {}", eventRequest.getId());
Event after_event = eventMapper.getEventDetail(event_id);
after_event.setMailList(eventMapper.getMessage(event_id));
after_event.setItemList(eventMapper.getItem(event_id));
String prodId = processIdManager.getCurrentProcessId();
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
try {
mysqlHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.EVENT_UPDATE,
prodId,
LogAction.EVENT,
LogStatus.SUCCESS,
MysqlConstants.TABLE_NAME_EVENT,
HISTORYTYPEDETAIL.EVENT_UPDATE.name(),
"",
before_info,
after_event
);
} catch (Exception e) {
log.warn("Failed to log event creation: {}", e.getMessage());
}
}
});
return EventResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())
@@ -202,7 +240,9 @@ public class EventService {
.build();
}
@BusinessProcess(action = LogAction.EVENT)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public EventResponse deleteEvent(EventRequest eventRequest){
Map<String,Object> map = new HashMap<>();
@@ -213,17 +253,10 @@ public class EventService {
event.setMailList(eventMapper.getMessage(event_id));
event.setItemList(eventMapper.getItem(event_id));
map.put("mailId",event_id);
map.put("id",event_id);
map.put("desc", item.getDeleteDesc());
int result = eventMapper.deleteEvent(map);
log.info("updateEvent AdminTool Delete Complete: {}", eventRequest);
mysqlHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.EVENT_DELETE,
MysqlConstants.TABLE_NAME_EVENT,
HISTORYTYPEDETAIL.EVENT_DELETE.name(),
event
);
log.info("updateEvent AdminTool Delete Complete id: {}", event_id);
}
);

View File

@@ -0,0 +1,82 @@
package com.caliverse.admin.domain.service;
import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
import com.caliverse.admin.domain.entity.BattleEvent;
import com.caliverse.admin.domain.entity.metadata.*;
import com.caliverse.admin.domain.request.BattleEventRequest;
import com.caliverse.admin.domain.response.BattleEventResponse;
import com.caliverse.admin.dynamodb.service.DynamodbBattleEventService;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
@Service
@RequiredArgsConstructor
@Slf4j
public class GameSettingService {
private final DynamodbBattleEventService dynamodbBattleEventService;
private final MetaDataHandler metaDataHandler;
private final MysqlHistoryLogService mysqlHistoryLogService;
// 게임 셋팅 설정 조회
public BattleEventResponse getGameSettingList(@RequestParam Map<String, String> requestParam){
requestParam = CommonUtils.pageSetting(requestParam);
List<MetaGameModeMatchData> list = metaDataHandler.getMetaGameModeMatchListData();
return BattleEventResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.resultData(BattleEventResponse.ResultData.builder()
// .battleEventList(list)
.pageNo(requestParam.get("page_no")!=null?
Integer.parseInt(requestParam.get("page_no")):1)
.build()
)
.build();
}
// 게임 셋팅 설정 상세조회
public BattleEventResponse getGameSettingDetail(Long id){
BattleEvent battleEvent = null;
return BattleEventResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.resultData(BattleEventResponse.ResultData.builder()
.battleEvent(battleEvent)
.build())
.build();
}
// 게임 셋팅 설정 저장/수정
@Transactional(transactionManager = "transactionManager")
public BattleEventResponse updateGameSetting(Long id, BattleEventRequest battleEventRequest) {
battleEventRequest.setId(id);
battleEventRequest.setUpdateBy(CommonUtils.getAdmin().getId());
battleEventRequest.setUpdateDt(LocalDateTime.now());
dynamodbBattleEventService.updateBattleEvent(battleEventRequest);
return BattleEventResponse.builder()
.resultData(BattleEventResponse.ResultData.builder()
.build())
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.build();
}
}

View File

@@ -1,10 +1,12 @@
package com.caliverse.admin.domain.service;
import com.caliverse.admin.domain.dao.admin.GroupMapper;
import com.caliverse.admin.domain.dao.admin.HistoryMapper;
import com.caliverse.admin.domain.entity.*;
import com.caliverse.admin.domain.entity.log.LogAction;
import com.caliverse.admin.domain.request.GroupRequest;
import com.caliverse.admin.domain.response.GroupResponse;
import com.caliverse.admin.global.common.annotation.BusinessProcess;
import com.caliverse.admin.global.common.annotation.RequestLog;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.code.SuccessCode;
@@ -12,7 +14,6 @@ import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.json.JSONObject;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -24,7 +25,6 @@ import java.util.*;
public class GroupService {
private final GroupMapper groupMapper;
private final HistoryMapper historyMapper;
// 관리자 권한 리스트 조회
@@ -46,6 +46,7 @@ public class GroupService {
* return GroupResponse.list
*/
// 권한 설정 화면 리스트 조회
@RequestLog
public GroupResponse getGroupList(Map requestMap){
//페이징 처리
@@ -68,6 +69,7 @@ public class GroupService {
}
// 권한 설정 상세 조회
@RequestLog
public GroupResponse getGroupDetail(String groupId){
Long lid = Long.valueOf(groupId);
@@ -84,6 +86,9 @@ public class GroupService {
}
//권한 그룹 등록
@BusinessProcess(action = LogAction.GROUP)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public GroupResponse postAdminGroup(GroupRequest groupRequest){
List<Integer> authList = Arrays.asList(1, 5, 6, 9, 10, 11, 13, 14, 15, 16, 19, 22, 24, 26, 32, 36, 41,46, 49); //그룹 초기 권한
Map<String, Object> map = new HashMap<>();
@@ -92,7 +97,7 @@ public class GroupService {
int groupName = groupMapper.findGroupName(groupRequest.getGroupNm());
if(groupName == 0){
groupMapper.postAdminGroup(groupRequest);
groupMapper.postGroup(groupRequest);
map.put("groupId", groupRequest.getId());
authList.forEach(val->{
@@ -103,7 +108,7 @@ public class GroupService {
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DUPLICATED_GROUPNAME.getMessage());
}
log.info("postAdminGroup group: {}",map);
log.info("postAdminGroup group id: {}", groupRequest.getId());
return GroupResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())
@@ -111,8 +116,11 @@ public class GroupService {
.resultData(GroupResponse.ResultData.builder().message(SuccessCode.SAVE.getMessage()).build())
.build();
}
//그룹 권한 수정
@BusinessProcess(action = LogAction.GROUP)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public GroupResponse updateAdminGroup(String groupId,GroupRequest groupRequest){
Map<String , Object> map = new HashMap<>();
@@ -132,18 +140,7 @@ public class GroupService {
);
//로그 남기 before 그룹 설정
List<Authority> afterAuth = groupMapper.getGroupAuth(Long.valueOf(groupId));
log.info("updateAdminGroup after::{}",afterAuth);
//로그 기록
map.put("adminId", CommonUtils.getAdmin().getId());
map.put("name", CommonUtils.getAdmin().getName());
map.put("mail", CommonUtils.getAdmin().getEmail());
map.put("type", HISTORYTYPEDETAIL.GROUP_AUTH_UPDATE);
JSONObject jsonObject = new JSONObject();
jsonObject.put("groupNm",groupMapper.getGroupInfo(Long.valueOf(groupId)).get("name"));
jsonObject.put("auth(before)",beforeAuth);
jsonObject.put("auth(after)",afterAuth);
map.put("content",jsonObject.toString());
historyMapper.saveLog(map);
log.info("updateAdminGroup groupId: {}", groupId);
return GroupResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())
@@ -151,26 +148,19 @@ public class GroupService {
.resultData(GroupResponse.ResultData.builder().message(SuccessCode.UPDATE.getMessage()).build())
.build();
}
//그룹 삭제
@BusinessProcess(action = LogAction.GROUP)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public GroupResponse deleteAdminGroup(GroupRequest groupRequest){
Map<String, Object> map = new HashMap();
groupRequest.getGroupList().forEach(
item-> {
//순서 바뀜 안됨, 삭제 하기전 그룹명 가져오기
Map<String, String> groupInfo = groupMapper.getGroupInfo(item.getGroupId());
groupMapper.deleteGroup(item.getGroupId());
//로그 기록
JSONObject jsonObject = new JSONObject();
jsonObject.put("groupNm",groupInfo.get("name"));
map.put("adminId", CommonUtils.getAdmin().getId());
map.put("name", CommonUtils.getAdmin().getName());
map.put("mail", CommonUtils.getAdmin().getEmail());
map.put("type", HISTORYTYPEDETAIL.GROUP_DELETE);
map.put("content",jsonObject.toString());
historyMapper.saveLog(map);
}
);
log.info("deleteAdminGroup group: {}", map);

View File

@@ -3,29 +3,23 @@ package com.caliverse.admin.domain.service;
import com.caliverse.admin.domain.dao.admin.AdminMapper;
import com.caliverse.admin.domain.entity.Admin;
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.dao.admin.HistoryMapper;
import com.caliverse.admin.domain.request.HistoryRequest;
import com.caliverse.admin.domain.response.HistoryResponse;
import com.caliverse.admin.global.common.annotation.RequestLog;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.global.common.utils.DateUtils;
import com.caliverse.admin.mongodb.domain.BusinessLog;
import com.caliverse.admin.mongodb.domain.HistoryLogInfoBase;
import com.caliverse.admin.mongodb.service.HistoryLogService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.stereotype.Service;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -36,23 +30,19 @@ import java.util.Optional;
public class HistoryService {
private final AdminMapper adminMapper;
private final HistoryMapper historyMapper;
private final HistoryLogService historyLogService;
@RequestLog
public HistoryResponse getHistoryList(Map requestParams){
//페이징 처리
requestParams = CommonUtils.pageSetting(requestParams);
String searchType = requestParams.get("searchType").toString();
String searchData = requestParams.get("searchData").toString();
HISTORYTYPEDETAIL historyType = requestParams.get("historyType").equals("") ? null : HISTORYTYPEDETAIL.valueOf(requestParams.get("historyType").toString());
LocalDateTime startDt = requestParams.get("startDate").equals("") ? null : DateUtils.stringISOToLocalDateTime(requestParams.get("startDate").toString());
LocalDateTime endDt = requestParams.get("endDate").equals("") ? null : DateUtils.stringISOToLocalDateTime(requestParams.get("endDate").toString());
// List<Log> historyList = historyMapper.getHistoryList(requestParams);
HistoryRequest historyRequest = new HistoryRequest();
historyRequest.setHistoryType(historyType);
historyRequest.setStartDt(startDt);
historyRequest.setEndDt(endDt);
if(searchType.equals("NAME")){
@@ -72,13 +62,11 @@ public class HistoryService {
historyRequest.setUserMail(searchData);
}
List<HistoryLogInfoBase> historyList = historyLogService.loadHistoryData(historyRequest, HistoryLogInfoBase.class);
int allCnt = historyMapper.getAllCnt(requestParams);
List<BusinessLog> logList = historyLogService.loadHistoryData(historyRequest, BusinessLog.class);
return HistoryResponse.builder()
.resultData(HistoryResponse.ResultData.builder()
.list(historyList)
.list(logList)
.build())
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
@@ -87,11 +75,11 @@ public class HistoryService {
public HistoryResponse getHistory(HistoryRequest historyRequest){
List<HistoryLogInfoBase> historyList = historyLogService.loadHistoryData(historyRequest, HistoryLogInfoBase.class);
List<BusinessLog> logList = historyLogService.loadHistoryData(historyRequest, BusinessLog.class);
return HistoryResponse.builder()
.resultData(HistoryResponse.ResultData.builder()
.list(historyList)
.list(logList)
.build())
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
@@ -99,24 +87,11 @@ public class HistoryService {
}
public HistoryResponse getHistoryDetail(String id){
String logJson = historyMapper.getLogJson(id);
return HistoryResponse.builder()
.resultData(HistoryResponse.ResultData.builder().content(logJson).build())
.resultData(HistoryResponse.ResultData.builder().build())
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.build();
}
public void setScheduleLog(HISTORYTYPEDETAIL type, String message){
//스케줄 로그 기록
Map<String, Object> logMap = new HashMap<>();
logMap.put("adminId", 1);
logMap.put("name", "schedule");
logMap.put("mail", "schedule");
logMap.put("type", type);
JSONObject jsonObject = new JSONObject();
jsonObject.put("message",message);
logMap.put("content",jsonObject.toString());
historyMapper.saveLog(logMap);
}
}

View File

@@ -1,6 +1,5 @@
package com.caliverse.admin.domain.service;
import java.io.IOException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
@@ -8,22 +7,21 @@ import java.util.stream.Collectors;
import com.caliverse.admin.Indicators.Indicatorsservice.aggregationservice.*;
import com.caliverse.admin.Indicators.entity.*;
import com.caliverse.admin.domain.response.LogResponse;
import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
import com.caliverse.admin.dynamodb.domain.atrrib.CaliumStorageAttrib;
import com.caliverse.admin.dynamodb.service.DynamodbCaliumService;
import com.caliverse.admin.global.common.annotation.RequestLog;
import com.caliverse.admin.global.common.utils.DateUtils;
import com.caliverse.admin.logs.logservice.indicators.*;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import com.caliverse.admin.domain.entity.Currencys;
import com.caliverse.admin.domain.entity.ROUTE;
import com.caliverse.admin.domain.response.IndicatorsResponse;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.global.common.utils.ExcelUtils;
@@ -35,7 +33,7 @@ import lombok.RequiredArgsConstructor;
@Slf4j
public class IndicatorsService {
private final ExcelUtils excelUtils;
private final MetaDataHandler metaDataHandler;
private IndicatorsAuLoadService indicatorsAuLoadService;
private final IndicatorsDauLoadService indicatorsDauLoadService;
@@ -49,14 +47,19 @@ public class IndicatorsService {
private final IndicatorsUgqCreateLoadService indicatorsUgqCreateLoadService;
private final IndicatorsMetaverServerLoadService indicatorsMetaverServerLoadService;
private final IndicatorsRetentionLoadService indicatorsRetentionLoadService;
private final IndicatorsCurrencyLoadService indicatorsCurrencyLoadService;
private final IndicatorsItemLoadService indicatorsItemLoadService;
private final IndicatorsAssetsLoadService indicatorsAssetsLoadService;
private final IndicatorsDauService dauService;
private final IndicatorsNruService indicatorsNruService;
private final IndicatorsMcuService mcuService;
private final DynamoDBMetricsService dynamoDBMetricsService;
private final DynamodbCaliumService dynamodbCaliumService;
//UserStatistics
@RequestLog
public IndicatorsResponse list(Map<String, String> requestParams){
String startDt = requestParams.get("start_dt");
@@ -138,6 +141,30 @@ public class IndicatorsService {
.build();
}
public IndicatorsResponse getCaliumConverter(){
CaliumStorageAttrib storage = dynamodbCaliumService.getCaliumConverter();
CaliumStorageAttrib.CaliumConverterStorage caliumConverterStorage = storage.getCaliumConverterStorage();
CaliumStorageAttrib.CaliumExchangerStorage caliumExchangerStorage = storage.getCaliumExchangerStorage();
IndicatorsResponse.DashboardCaliumConverter dashboard = IndicatorsResponse.DashboardCaliumConverter.builder()
.converterRate(caliumConverterStorage.getConverterDailyConvertRate())
.CumulativeCalium(caliumConverterStorage.getConverterCumulativeCalium())
.totalCalium(caliumConverterStorage.getConverterTotalCalium())
.dailyFillUpCalium(caliumConverterStorage.getConverterDailyFillUpStandardCalium())
.inflationRete(caliumExchangerStorage.getExchangerDailyInflationRate())
.build();
return IndicatorsResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.resultData(IndicatorsResponse.ResultData.builder()
.dashboardCalium(dashboard)
.build()
)
.build();
}
//유저 지표 엑셀 다운로드(현재 frontend 기능으로 사용)
public void userExcelDown(Map<String, String> requestParams, HttpServletResponse res){
@@ -168,7 +195,9 @@ public class IndicatorsService {
// }
}
// 유저 지표 Retention
@RequestLog
public IndicatorsResponse retentionList(Map<String, String> requestParams){
LocalDateTime startDt = DateUtils.stringISOToLocalDateTime(requestParams.get("start_dt"));
LocalDateTime endDt = DateUtils.stringISOToLocalDateTime(requestParams.get("end_dt"));
@@ -198,144 +227,85 @@ public class IndicatorsService {
.build();
}
public void retentionExcelDown(Map<String, String> requestParams,HttpServletResponse res){
List<IndicatorsResponse.Retention> retentionList = new ArrayList<>();
String startDt = CommonUtils.objectToString(requestParams.get("start_dt"));
String endDt = CommonUtils.objectToString(requestParams.get("end_dt"));
List<LocalDate> dateRange = CommonUtils.dateRange(startDt, endDt);
// int cnt = dateRange.size();
// for (LocalDate date : dateRange) {
// List<IndicatorsResponse.Dday> dDayList = new ArrayList<>();
// for (int i = 0; i < cnt; i++){
// IndicatorsResponse.Dday dDay = IndicatorsResponse.Dday.builder()
// .date("D+" + i)
// .dif("0%")
// .build();
// dDayList.add(dDay);
// }
// cnt -- ;
// IndicatorsResponse.Retention retention = IndicatorsResponse.Retention.builder()
// .date(date)
// .dDay(dDayList)
// .build();
// retentionList.add(retention);
// }
// // 엑셀 파일 생성 및 다운로드
// try {
// ExcelUtils.exportToExcelByRentention(retentionList,res);
// }catch (IOException exception){
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.ERROR_EXCEL_DOWN.getMessage());
// }
}
// 유저 지표 Retention
public IndicatorsResponse segmentList(Map<String, String> requestParams){
// LocalDate searchDt = LocalDate.parse(CommonUtils.objectToString(requestParams.get("search_dt")));
// List<IndicatorsResponse.Segment> segmentList = Arrays.asList(
// IndicatorsResponse.Segment.builder().type("Excellent").au("0").dif("0%").build(),
// IndicatorsResponse.Segment.builder().type("Influential").au("0").dif("0%").build(),
// IndicatorsResponse.Segment.builder().type("Potential").au("0").dif("0%").build(),
// IndicatorsResponse.Segment.builder().type("Before leave").au("0").dif("0%").build(),
// IndicatorsResponse.Segment.builder().type("InActive").au("0").dif("0%").build(),
// IndicatorsResponse.Segment.builder().type("New Join").au("0").dif("0%").build()
// );
// return IndicatorsResponse.builder()
// .resultData(IndicatorsResponse.ResultData.builder()
// .segmentList(segmentList)
// .startDt(searchDt.minusDays(100))
// .endDt(searchDt)
// .build())
// .status(CommonCode.SUCCESS.getHttpStatus())
// .result(CommonCode.SUCCESS.getResult())
// .build();
return null;
// 재화 지표
@RequestLog
public IndicatorsResponse currencyList(Map<String, String> requestParams){
LocalDateTime startDt = DateUtils.stringISOToLocalDateTime(requestParams.get("start_dt"));
LocalDateTime endDt = DateUtils.stringISOToLocalDateTime(requestParams.get("end_dt"));
String currencyType = CommonUtils.objectToString(requestParams.get("currency_type"));
String deltaType = CommonUtils.objectToString(requestParams.get("delta_type"));
List<CurrencyIndicatorInfo> currencyList = indicatorsCurrencyLoadService.getCurrencyLogData(
startDt.toString().substring(0, 10),
endDt.toString().substring(0, 10),
deltaType,
CurrencyIndicatorInfo.class);
}
public void segmentExcelDown(Map<String, String> requestParams, HttpServletResponse res){
LocalDate searchDt = LocalDate.parse(CommonUtils.objectToString(requestParams.get("search_dt")));
currencyList = currencyList.stream().filter(data -> data.getCurrencyType().equals(currencyType)).toList();
List<IndicatorsResponse.Segment> segmentList = Arrays.asList(
IndicatorsResponse.Segment.builder().type("Excellent").au("0").dif("0%").build(),
IndicatorsResponse.Segment.builder().type("Influential").au("0").dif("0%").build(),
IndicatorsResponse.Segment.builder().type("Potential").au("0").dif("0%").build(),
IndicatorsResponse.Segment.builder().type("Before leave").au("0").dif("0%").build(),
IndicatorsResponse.Segment.builder().type("InActive").au("0").dif("0%").build(),
IndicatorsResponse.Segment.builder().type("New Join").au("0").dif("0%").build()
);
LocalDate startDt = searchDt.minusDays(100);
LocalDate endDt = searchDt;
// 엑셀 파일 생성 및 다운로드
try {
ExcelUtils.exportToExcelBySegment(segmentList,startDt,endDt,res);
}catch (IOException exception){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.ERROR_EXCEL_DOWN.getMessage());
}
}
// 유저 지표 플레이타임
public IndicatorsResponse playTimeList(Map<String, String> requestParams){
String startDt = CommonUtils.objectToString(requestParams.get("start_dt"));
String endDt = CommonUtils.objectToString(requestParams.get("end_dt"));
List<LocalDate> dateRange = CommonUtils.dateRange(startDt, endDt);
List<IndicatorsResponse.Playtime> playtimeList = new ArrayList<>();
for (LocalDate date : dateRange){
IndicatorsResponse.Playtime build = IndicatorsResponse.Playtime.builder()
.date(date)
.totalTime(0)
.averageTime(0)
.userCnt(Arrays.asList(0, 0, 0, 0))
.build();
playtimeList.add(build);
}
return IndicatorsResponse.builder()
.resultData(IndicatorsResponse.ResultData.builder()
.playtimeList(playtimeList)
.currencyList(currencyList)
.build())
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.build();
}
public void playTimeExcelDown(Map<String, String> requestParams, HttpServletResponse res){
String startDt = CommonUtils.objectToString(requestParams.get("start_dt"));
String endDt = CommonUtils.objectToString(requestParams.get("end_dt"));
List<LocalDate> dateRange = CommonUtils.dateRange(startDt, endDt);
List<IndicatorsResponse.Playtime> playtimeList = new ArrayList<>();
for (LocalDate date : dateRange){
IndicatorsResponse.Playtime build = IndicatorsResponse.Playtime.builder()
.date(date)
.totalTime(0)
.averageTime(0)
.userCnt(Arrays.asList(0, 0, 0, 0))
//이이템 지표
@RequestLog
public IndicatorsResponse getItemList(Map<String, String> requestParams){
LocalDateTime startDt = DateUtils.stringISOToLocalDateTime(requestParams.get("start_dt"));
LocalDateTime endDt = DateUtils.stringISOToLocalDateTime(requestParams.get("end_dt"));
String itemId = CommonUtils.objectToString(requestParams.get("item_id"));
String deltaType = CommonUtils.objectToString(requestParams.get("delta_type"));
List<ItemIndicatorInfo> itemList = indicatorsItemLoadService.getItemsLogData(
startDt.toString().substring(0, 10),
endDt.toString().substring(0, 10),
deltaType,
ItemIndicatorInfo.class);
itemList = itemList.stream()
.filter(data -> data.getItemId().equals(itemId))
.peek(data -> data.setItemName(metaDataHandler.getTextStringData(data.getItemName())))
.toList();
return IndicatorsResponse.builder()
.resultData(IndicatorsResponse.ResultData.builder()
.itemList(itemList)
.build())
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.build();
playtimeList.add(build);
}
String sheetName = "PlayTime";
//보유 지표
@RequestLog
public IndicatorsResponse getAssetsList(Map<String, String> requestParams){
LocalDateTime startDt = DateUtils.stringISOToLocalDateTime(requestParams.get("start_dt"));
LocalDateTime endDt = DateUtils.stringISOToLocalDateTime(requestParams.get("end_dt"));
List<AssetsIndicatorInfo> assetsList = indicatorsAssetsLoadService.getIndicatorsLogData(
startDt.toString().substring(0, 10),
endDt.toString().substring(0, 10),
AssetsIndicatorInfo.class);
String headerNames[] = new String[]{"일자","30분 이내","30분~1시간", "1시간~3시간", "3시간 이상"
, "총 누적 플레이타임(분)","1인당 평균 플레이타임(분)"};
String[][] bodyDatass = new String[playtimeList.size()][7];
for (int i = 0; i < playtimeList.size(); i++) {
IndicatorsResponse.Playtime entry = playtimeList.get(i);
bodyDatass[i][0] = String.valueOf(entry.getDate());
bodyDatass[i][1] = String.valueOf(entry.getUserCnt().get(0));
bodyDatass[i][2] = String.valueOf(entry.getUserCnt().get(1));
bodyDatass[i][3] = String.valueOf(entry.getUserCnt().get(2));
bodyDatass[i][4] = String.valueOf(entry.getUserCnt().get(3));
bodyDatass[i][5] = String.valueOf(entry.getTotalTime());
bodyDatass[i][6] = String.valueOf(entry.getAverageTime());
}
String outfileName = "PlayTime_"+ LocalDateTime.now().getNano();
// 엑셀 파일 생성 및 다운로드
try {
excelUtils.excelDownload(sheetName,headerNames,bodyDatass,outfileName,res);
}catch (IOException exception){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.ERROR_EXCEL_DOWN.getMessage());
}
return IndicatorsResponse.builder()
.resultData(IndicatorsResponse.ResultData.builder()
.assetsList(assetsList)
.build())
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.build();
}
@@ -463,101 +433,7 @@ public class IndicatorsService {
.collect(Collectors.toList());
return resList;
}
//재화 지표
public IndicatorsResponse getCurrencyUse(Map<String, String> requestParams) {
LocalDate startDt = LocalDate.parse(CommonUtils.objectToString(requestParams.get("start_dt")));
LocalDate endDt = LocalDate.parse(CommonUtils.objectToString(requestParams.get("end_dt")));
String currencyType = CommonUtils.objectToString(requestParams.get("currency_type"));
List<Currencys> dailyList = getCurrencyCount(startDt, endDt, currencyType);
List<Currencys> totalList = getDailyGoodsTotal(startDt, endDt, currencyType);
List<IndicatorsResponse.DailyGoods> dailyGoodsList = getDailyGoodsList(currencyType, dailyList, totalList);
return IndicatorsResponse.builder()
.resultData(IndicatorsResponse.ResultData.builder()
.dailyGoods(dailyGoodsList)
.build())
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.build();
}
//재화 지표 엑셀 다운로드
public void currencyExcelDown(Map<String, String> requestParams, HttpServletResponse res){
LocalDate startDt = LocalDate.parse(CommonUtils.objectToString(requestParams.get("start_dt")));
LocalDate endDt = LocalDate.parse(CommonUtils.objectToString(requestParams.get("end_dt")));
String currencyType = CommonUtils.objectToString(requestParams.get("currency_type"));
List<Currencys> dailyList = getCurrencyCount(startDt, endDt, currencyType);
List<Currencys> totalList = getDailyGoodsTotal(startDt, endDt, currencyType);
List<IndicatorsResponse.DailyGoods> dailyGoodsList = getDailyGoodsList(currencyType, dailyList, totalList);
// 엑셀 파일 생성 및 다운로드
try {
ExcelUtils.exportToExcelByDailyGoods(dailyGoodsList, res);
}catch (IOException exception){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.ERROR_EXCEL_DOWN.getMessage());
}
}
//VBP 지표
public IndicatorsResponse getVBPList(Map<String, String> requestParams){
String startDt = CommonUtils.objectToString(requestParams.get("start_dt"));
String endDt = CommonUtils.objectToString(requestParams.get("end_dt"));
List<LocalDate> dateRange = CommonUtils.dateRange(startDt, endDt);
List<Currencys> dailyGoods = new ArrayList<>();
for (LocalDate date : dateRange){
List<Currencys> currencysList = Arrays.asList(
Currencys.builder().route("OFFLINE_VISIT").deltaType("GET").date(date).count(0).build(),
Currencys.builder().route("OFFLINE_PAYMENT").deltaType("GET").date(date).count(0).build(),
Currencys.builder().route("ONLINE_VISIT").deltaType("GET").date(date).count(0).build(),
Currencys.builder().route("ONLINE_PAYMENT").deltaType("GET").date(date).count(0).build(),
Currencys.builder().route("STORE").deltaType("USE").date(date).count(0).build(),
Currencys.builder().route("VBP").deltaType("USE").date(date).count(0).build()
);
dailyGoods.addAll(currencysList);
}
return IndicatorsResponse.builder()
.resultData(IndicatorsResponse.ResultData.builder()
.currencysList(dailyGoods)
.build())
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.build();
}
//이이템 지표
public IndicatorsResponse getItemList(Map<String, String> requestParams){
String startDt = CommonUtils.objectToString(requestParams.get("start_dt"));
String endDt = CommonUtils.objectToString(requestParams.get("end_dt"));
List<LocalDate> dateRange = CommonUtils.dateRange(startDt, endDt);
List<Currencys> dailyGoods = new ArrayList<>();
for (LocalDate date : dateRange){
List<Currencys> currencysList = Arrays.asList(
Currencys.builder().route("Dummy_GET_1").deltaType("GET").date(date).count(0).build(),
Currencys.builder().route("Dummy_GET_2").deltaType("GET").date(date).count(0).build(),
Currencys.builder().route("Dummy_GET_3").deltaType("GET").date(date).count(0).build(),
Currencys.builder().route("Dummy_USE_1").deltaType("USE").date(date).count(0).build(),
Currencys.builder().route("Dummy_USE_2").deltaType("USE").date(date).count(0).build(),
Currencys.builder().route("Dummy_USE_3").deltaType("USE").date(date).count(0).build()
);
dailyGoods.addAll(currencysList);
}
return IndicatorsResponse.builder()
.resultData(IndicatorsResponse.ResultData.builder()
.currencysList(dailyGoods)
.build())
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.build();
}
//인스턴스 지표
public IndicatorsResponse getInstanceList(Map<String, String> requestParams){
String startDt = CommonUtils.objectToString(requestParams.get("start_dt"));
@@ -582,30 +458,6 @@ public class IndicatorsService {
}
//의상/타투 지표
public IndicatorsResponse getClothesList(Map<String, String> requestParams){
String startDt = CommonUtils.objectToString(requestParams.get("start_dt"));
String endDt = CommonUtils.objectToString(requestParams.get("end_dt"));
List<LocalDate> dateRange = CommonUtils.dateRange(startDt, endDt);
List<Currencys> dailyGoods = new ArrayList<>();
for (LocalDate date : dateRange){
List<Currencys> currencysList = Arrays.asList(
Currencys.builder().route("Dummy_Item_Id_1").date(date).count(0).build(),
Currencys.builder().route("Dummy_Item_Id_2").date(date).count(0).build()
);
dailyGoods.addAll(currencysList);
}
return IndicatorsResponse.builder()
.resultData(IndicatorsResponse.ResultData.builder()
.currencysList(dailyGoods)
.build())
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.build();
}
//DAU 지표
public IndicatorsResponse getDauDataList(Map<String, String> requestParams){
@@ -691,64 +543,6 @@ public class IndicatorsService {
}
/*
//Daily Medal 지표
public IndicatorsResponse getDailyMedalDataList(Map<String, String> requestParams){
LocalDate startDt = LocalDate.parse(CommonUtils.objectToString(requestParams.get("start_dt")));
LocalDate endDt = LocalDate.parse(CommonUtils.objectToString(requestParams.get("end_dt")));
List<DailyMedal> dailyMedal = getDailyMedal(startDt, endDt);
return IndicatorsResponse.builder()
.resultData(IndicatorsResponse.ResultData.builder()
.dailyMedalList(dailyMedal)
.build())
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.build();
}
public List<DailyMedal> getDailyMedal(LocalDate startTime, LocalDate endTime){
Map map = new HashMap();
map.put("startDt" , CommonUtils.startOfDay(startTime));
map.put("endDt" , CommonUtils.endOfDay(endTime));
List<DailyMedal> dateActive = indicatorsMapper.getDailyMedal(map);
// 결과를 처리하여 결과값 반환
return dateActive;
}
*/
public List<Object> getDauList(LocalDate startTime, LocalDate endTime){
Map map = new HashMap();
map.put("startDt" , CommonUtils.startOfDay(startTime));
map.put("endDt" , CommonUtils.endOfDay(endTime));
//List<DailyActiveUser> dateActive = indicatorsMapper.getDailyActiveUserList(map);
// 결과를 처리하여 결과값 반환
return null;
}
public List<DauLogInfo> getActiveUserCount(LocalDate startTime, String endTime){
//Map map = new HashMap();
//map.put("startDt" , CommonUtils.startOfDay(startTime));
//map.put("endDt" , CommonUtils.endOfDay(endTime));
//List<Distinct> dateActive = indicatorsMapper.getDailyActive(map);
// 결과를 처리하여 결과값 반환
List<DauLogInfo> ativeUsers = indicatorsAuLoadService.getIndicatorsLogData(endTime, endTime, DauLogInfo.class);
return ativeUsers;
}
public List<Currencys> getCurrencyCount(LocalDate startTime, LocalDate endTime, String type){
Map inputMap = new HashMap();

View File

@@ -3,6 +3,7 @@ package com.caliverse.admin.domain.service;
import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
import com.caliverse.admin.domain.entity.ITEMLARGETYPE;
import com.caliverse.admin.domain.entity.SEARCHTYPE;
import com.caliverse.admin.domain.entity.log.LogAction;
import com.caliverse.admin.domain.response.ItemDeleteResponse;
import com.caliverse.admin.domain.response.UsersResponse;
import com.caliverse.admin.dynamodb.domain.atrrib.ItemAttrib;
@@ -10,6 +11,8 @@ import com.caliverse.admin.dynamodb.domain.doc.ItemDoc;
import com.caliverse.admin.dynamodb.dto.PageResult;
import com.caliverse.admin.dynamodb.service.DynamodbItemService;
import com.caliverse.admin.dynamodb.service.DynamodbUserService;
import com.caliverse.admin.global.common.annotation.BusinessProcess;
import com.caliverse.admin.global.common.annotation.RequestLog;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.utils.CommonUtils;
import lombok.extern.slf4j.Slf4j;
@@ -38,6 +41,7 @@ public class ItemsService {
private final DynamodbItemService dynamodbItemService;
private final MetaDataHandler metaDataHandler;
@RequestLog
public ItemsResponse findItems(ItemsRequest itemDeleteRequest){
String guid = "";
String searchData = itemDeleteRequest.getSearchData();
@@ -98,8 +102,9 @@ public class ItemsService {
.build();
}
@BusinessProcess(action = LogAction.ITEM)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public ItemDeleteResponse postItemDelete(ItemsRequest itemDeleteRequest){
String userGuid = itemDeleteRequest.getUserGuid();
String itemGuid = itemDeleteRequest.getItemGuid();

View File

@@ -3,6 +3,7 @@ package com.caliverse.admin.domain.service;
import com.caliverse.admin.domain.dao.admin.LandMapper;
import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
import com.caliverse.admin.domain.entity.*;
import com.caliverse.admin.domain.entity.log.LogAction;
import com.caliverse.admin.dynamodb.domain.atrrib.LandAttrib;
import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionHighestBidUserAttrib;
import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionRegistryAttrib;
@@ -16,6 +17,8 @@ import com.caliverse.admin.dynamodb.service.DynamodbLandAuctionService;
import com.caliverse.admin.dynamodb.service.DynamodbLandService;
import com.caliverse.admin.dynamodb.service.DynamodbService;
import com.caliverse.admin.dynamodb.service.DynamodbUserService;
import com.caliverse.admin.global.common.annotation.BusinessProcess;
import com.caliverse.admin.global.common.annotation.RequestLog;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.code.SuccessCode;
@@ -45,18 +48,14 @@ import static com.caliverse.admin.global.common.utils.DateUtils.stringISOToLocal
@Slf4j
public class LandService {
// private final DynamoDBService dynamoDBService;
private final DynamodbLandAuctionService dynamodbLandAuctionService;
private final DynamodbLandService dynamodbLandService;
private final DynamodbUserService dynamodbUserService;
private final LandMapper landMapper;
private final MetaDataHandler metaDataHandler;
private final HistoryService historyService;
private final ObjectMapper objectMapper;
private final MysqlHistoryLogService mysqlHistoryLogService;
private final DynamodbService dynamodbService;
@RequestLog
public LandResponse getLandInfo(@RequestParam Map<String, String> requestParam){
String searchType = requestParam.getOrDefault("land_type", "ID");
String searchData = requestParam.getOrDefault("land_data", "");
@@ -310,12 +309,11 @@ public class LandService {
.build();
}
@RequestLog
public LandResponse getLandDetail(Long id){
LandAuction event = landMapper.getLandAuctionDetail(id);
event.setMessageList(landMapper.getMessage(id));
log.info("call User Email: {}, event_id: {}", CommonUtils.getAdmin().getEmail(), id);
return LandResponse.builder()
@@ -328,6 +326,7 @@ public class LandService {
}
// 랜드 경매 조회
@RequestLog
public LandResponse getLandAuctionList(@RequestParam Map<String, String> requestParam){
requestParam = CommonUtils.pageSetting(requestParam);
@@ -351,12 +350,11 @@ public class LandService {
}
// 랜드 경매 상세조회
@RequestLog
public LandResponse getLandAuctionDetail(Long id){
LandAuction landAuction = landMapper.getLandAuctionDetail(id);
landAuction.setMessageList(landMapper.getMessage(id));
log.info("call User Email: {}, id: {}", CommonUtils.getAdmin().getEmail(), id);
return LandResponse.builder()
@@ -368,7 +366,9 @@ public class LandService {
.build();
}
@BusinessProcess(action = LogAction.LAND_AUCTION)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public LandResponse postLandAuction(LandRequest landRequest){
Integer land_id = landRequest.getLandId();
@@ -393,35 +393,7 @@ public class LandService {
landRequest.setCreateBy(CommonUtils.getAdmin().getId());
int result = landMapper.postLandAuction(landRequest);
log.info("AdminToolDB LandAuction Save: {}", landRequest);
long auction_id = landRequest.getId();
HashMap<String,String> map = new HashMap<>();
map.put("id",String.valueOf(auction_id));
//메시지 저장
// if(landRequest.getMassageList()!= null && !landRequest.getMassageList().isEmpty()){
// landRequest.getMassageList().forEach(
// item -> {
// map.put("title",item.getTitle());
// map.put("content",item.getContent());
// map.put("language",item.getLanguage());
// landMapper.insertMessage(map);
// }
// );
// }
// log.info("AdminToolDB Message Save Complete");
LandAuction auction_info = landMapper.getLandAuctionDetail(auction_id);
auction_info.setMessageList(landMapper.getMessage(auction_id));
mysqlHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.LAND_AUCTION_ADD,
MysqlConstants.TABLE_NAME_LAND_AUCTION,
HISTORYTYPEDETAIL.LAND_AUCTION_ADD.name(),
auction_info
);
log.info("AdminToolDB LandAuction Save id: {}", landRequest.getId());
dynamodbLandAuctionService.insertLandAuctionRegistryWithActivity(landRequest);
@@ -434,7 +406,9 @@ public class LandService {
.build();
}
@BusinessProcess(action = LogAction.LAND_OWNER_CHANGE)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public LandResponse postLandOwnerChanges(LandRequest landRequest){
String guid = landRequest.getUserGuid();
String nickname = dynamodbUserService.getGuidByName(guid);
@@ -469,25 +443,7 @@ public class LandService {
}
int result = landMapper.postLandOwnerChange(landRequest);
try {
log.info("AdminToolDB LandOwnerChanges Save: {}", objectMapper.writeValueAsString(landRequest));
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
long id = landRequest.getId();
HashMap<String,Object> map = new HashMap<>();
map.put("id",String.valueOf(id));
LandOwnerChange info = landMapper.getLandOwnerChangeDetail(id);
mysqlHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD,
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD.name(),
info
);
log.info("AdminToolDB LandOwnerChanges Save id: {}", landRequest.getId());
// if(!is_reserve){
// dynamodbLandService.ChangesLandOwner(landRequest);
@@ -505,14 +461,15 @@ public class LandService {
.build();
}
@BusinessProcess(action = LogAction.LAND_AUCTION)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public LandResponse updateLandAuction(Long id, LandRequest landRequest) {
landRequest.setId(id);
landRequest.setUpdateBy(CommonUtils.getAdmin().getId());
landRequest.setUpdateDt(LocalDateTime.now());
LandAuction before_info = landMapper.getLandAuctionDetail(id);
// before_info.setMessageList(landMapper.getMessage(id));
if(!before_info.getStatus().equals(LandAuction.AUCTION_STATUS.WAIT) && !before_info.getStatus().equals(LandAuction.AUCTION_STATUS.RESV_START)){
return LandResponse.builder()
@@ -522,40 +479,10 @@ public class LandService {
}
int result = landMapper.updateLandAuction(landRequest);
log.info("AdminToolDB LandAuction Update Complete: {}", landRequest);
Map<String, String> map = new HashMap<>();
map.put("id", String.valueOf(id));
// message 테이블 데이터 삭제 처리 by mail_id
// landMapper.deleteMessage(map);
//
// // 메시지 업데이트
// if (landRequest.getMassageList() != null && !landRequest.getMassageList().isEmpty()) {
// landRequest.getMassageList().forEach(item -> {
// map.put("title", item.getTitle());
// map.put("content", item.getContent());
// map.put("language", item.getLanguage());
//
// landMapper.insertMessage(map);
// });
// }
// log.info("AdminToolDB Message Update Complete");
LandAuction after_info = landMapper.getLandAuctionDetail(id);
// after_info.setMessageList(landMapper.getMessage(id));
mysqlHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE,
MysqlConstants.TABLE_NAME_LAND_AUCTION,
HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE.name(),
before_info,
after_info
);
log.info("AdminToolDB LandAuction Update Complete id: {}", id);
dynamodbLandAuctionService.updateLandAuction(landRequest);
return LandResponse.builder()
.resultData(LandResponse.ResultData.builder()
.build())
@@ -564,29 +491,16 @@ public class LandService {
.build();
}
@BusinessProcess(action = LogAction.LAND_OWNER_CHANGE)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public LandResponse updateLandOwnerChanges(Long id, LandRequest landRequest) {
landRequest.setId(id);
landRequest.setUpdateBy(CommonUtils.getAdmin().getId());
landRequest.setUpdateDt(LocalDateTime.now());
Map<String, String> map = new HashMap<>();
map.put("id", String.valueOf(id));
LandOwnerChange before_info = landMapper.getLandOwnerChangeDetail(id);
int result = landMapper.updateLandOwnerChange(landRequest);
log.info("AdminToolDB LandOwnerChanges Update Complete: {}", landRequest);
LandOwnerChange after_info = landMapper.getLandOwnerChangeDetail(id);
mysqlHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
before_info,
after_info
);
log.info("AdminToolDB LandOwnerChanges Update Complete id: {}", id);
dynamodbLandService.ChangesLandOwner(landRequest);
@@ -598,7 +512,9 @@ public class LandService {
.build();
}
@BusinessProcess(action = LogAction.LAND_AUCTION)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public LandResponse deleteLandAuction(LandRequest landRequest){
Map<String,Object> map = new HashMap<>();
AtomicBoolean is_falil = new AtomicBoolean(false);
@@ -607,7 +523,6 @@ public class LandService {
item->{
Long auction_id = item.getId();
LandAuction auction_info = landMapper.getLandAuctionDetail(auction_id);
auction_info.setMessageList(landMapper.getMessage(auction_id));
if(!auction_info.getStatus().equals(LandAuction.AUCTION_STATUS.WAIT) && !auction_info.getStatus().equals(LandAuction.AUCTION_STATUS.RESV_START)){
is_falil.set(true);
@@ -616,15 +531,10 @@ public class LandService {
map.put("id", auction_id);
map.put("updateBy", CommonUtils.getAdmin().getId());
int result = landMapper.deleteLandAuction(map);
log.info("LandAuction Delete Complete: {}", item);
mysqlHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.LAND_AUCTION_DELETE,
MysqlConstants.TABLE_NAME_LAND_AUCTION,
HISTORYTYPEDETAIL.LAND_AUCTION_DELETE.name(),
auction_info
);
int result = landMapper.deleteLandAuction(map);
log.info("LandAuction Delete Complete id: {}", auction_id);
dynamodbLandAuctionService.cancelLandAuction(auction_info);
}
@@ -645,7 +555,9 @@ public class LandService {
.build();
}
@BusinessProcess(action = LogAction.LAND_OWNER_CHANGE)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public LandResponse deleteLandOwnerChanges(LandRequest landRequest){
Long id = landRequest.getId();
LandOwnerChange info = landMapper.getLandOwnerChangeDetail(id);
@@ -662,14 +574,7 @@ public class LandService {
map.put("id", id);
map.put("updateBy", CommonUtils.getAdmin().getId());
int result = landMapper.deleteLandOwnerChanges(map);
log.info("LandOwnerChanges Delete Complete: {}", landRequest);
mysqlHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_DELETE,
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_DELETE.name(),
info
);
log.info("LandOwnerChanges Delete Complete id: {}", id);
return LandResponse.builder()
.resultData(LandResponse.ResultData.builder()

View File

@@ -8,6 +8,7 @@ import com.caliverse.admin.domain.request.LogGameRequest;
import com.caliverse.admin.domain.request.LogGenericRequest;
import com.caliverse.admin.domain.response.IndicatorsResponse;
import com.caliverse.admin.domain.response.LogResponse;
import com.caliverse.admin.global.common.annotation.RequestLog;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.exception.RestApiException;
@@ -16,10 +17,7 @@ import com.caliverse.admin.global.common.utils.DateUtils;
import com.caliverse.admin.global.component.tracker.ExcelProgressTracker;
import com.caliverse.admin.logs.Indicatordomain.GenericMongoLog;
import com.caliverse.admin.logs.logservice.businesslogservice.BusinessLogGenericService;
import com.caliverse.admin.logs.logservice.indicators.IndicatorsCurrencyService;
import com.caliverse.admin.logs.logservice.indicators.IndicatorsItemService;
import com.caliverse.admin.logs.logservice.indicators.IndicatorsUserCreateService;
import com.caliverse.admin.logs.logservice.indicators.IndicatorsUserLoginService;
import com.caliverse.admin.logs.logservice.indicators.*;
import com.caliverse.admin.mongodb.dto.MongoPageResult;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
@@ -50,7 +48,9 @@ public class LogService {
private final IndicatorsItemService indicatorsItemService;
private final IndicatorsUserLoginService indicatorsUserLoginService;
private final IndicatorsUserCreateService indicatorsUserCreateService;
private final IndicatorsSnapshotService indicatorsSnapshotService;
@RequestLog
public LogResponse genericLogList(LogGenericRequest logGenericRequest){
int page = logGenericRequest.getPageNo();
int size = logGenericRequest.getPageSize();
@@ -306,6 +306,7 @@ public class LogService {
}
}
@RequestLog
public LogResponse getCurrencyLogList(Map<String, String> requestParams){
LocalDateTime startDt = DateUtils.stringISOToLocalDateTime(requestParams.get("start_dt"));
LocalDateTime endDt = DateUtils.stringISOToLocalDateTime(requestParams.get("end_dt"));
@@ -427,6 +428,7 @@ public class LogService {
}
@RequestLog
public LogResponse getCurrencyDetailLogList(Map<String, String> requestParams){
String searchType = requestParams.get("search_type");
String searchData = requestParams.get("search_data");
@@ -530,6 +532,7 @@ public class LogService {
}
@RequestLog
public LogResponse getItemDetailLogList(Map<String, String> requestParams){
String searchType = requestParams.get("search_type");
String searchData = requestParams.get("search_data");
@@ -636,6 +639,7 @@ public class LogService {
}
@RequestLog
public LogResponse getCurrencyItemLogList(Map<String, String> requestParams){
String searchType = requestParams.get("search_type");
String searchData = requestParams.get("search_data");
@@ -739,6 +743,7 @@ public class LogService {
}
@RequestLog
public LogResponse getUserCreateLogList(Map<String, String> requestParams){
String searchType = requestParams.get("search_type");
String searchData = requestParams.get("search_data");
@@ -830,6 +835,7 @@ public class LogService {
}
@RequestLog
public LogResponse getUserLoginDetailLogList(Map<String, String> requestParams){
String searchType = requestParams.get("search_type");
String searchData = requestParams.get("search_data");
@@ -924,4 +930,94 @@ public class LogService {
}
@RequestLog
public LogResponse getSnapshotLogList(Map<String, String> requestParams){
String searchType = requestParams.get("search_type");
String searchData = requestParams.get("search_data");
LocalDateTime startDt = DateUtils.stringISOToLocalDateTime(requestParams.get("start_dt"));
LocalDateTime endDt = DateUtils.stringISOToLocalDateTime(requestParams.get("end_dt"));
String orderBy = requestParams.get("orderby");
int pageNo = Integer.parseInt(requestParams.get("page_no"));
int pageSize = Integer.parseInt(requestParams.get("page_size"));
MongoPageResult<SnapshotLogInfo> result = indicatorsSnapshotService.getSnapshotLogData(
searchType,
searchData,
startDt.toString().substring(0, 10),
endDt.toString().substring(0, 10),
orderBy,
pageNo,
pageSize,
SnapshotLogInfo.class
);
int totalCount = result.getTotalCount();
return LogResponse.builder()
.resultData(LogResponse.ResultData.builder()
.snapshotList(result.getItems())
.total(result.getItems().size())
.totalAll(totalCount)
.pageNo(pageNo)
.build())
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.build();
}
public void SnapshotExcelExport(HttpServletResponse response, LogGameRequest logGameRequest){
String taskId = logGameRequest.getTaskId();
LocalDateTime startDt = logGameRequest.getStartDt().plusHours(9);
LocalDateTime endDt = logGameRequest.getEndDt().plusHours(9).plusDays(1);
logGameRequest.setStartDt(startDt);
logGameRequest.setEndDt(endDt);
logGameRequest.setPageNo(null);
logGameRequest.setPageSize(null);
progressTracker.updateProgress(taskId, 5, 100, "엑셀 생성 준비 중...");
MongoPageResult<SnapshotLogInfo> result = null;
try{
result = indicatorsSnapshotService.getSnapshotLogData(
logGameRequest.getSearchType().toString(),
logGameRequest.getSearchData(),
startDt.toString().substring(0, 10),
endDt.toString().substring(0, 10),
logGameRequest.getOrderBy(),
logGameRequest.getPageNo(),
logGameRequest.getPageSize(),
SnapshotLogInfo.class
);
progressTracker.updateProgress(taskId, 20, 100, "데이터 생성완료");
}catch(UncategorizedMongoDbException e){
if (e.getMessage().contains("Sort exceeded memory limit")) {
log.error("MongoDB Query memory limit error: {}", e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.ERROR_LOG_MEMORY_LIMIT.toString());
} else if (e.getMessage().contains("time limit")) {
log.error("MongoDB Query operation exceeded time limit: {}", e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.ERROR_LOG_MEMORY_LIMIT.toString());
}else {
log.error("MongoDB Query error", e);
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.ERROR_MONGODB_QUERY.toString());
}
}catch (Exception e){
log.error("SnapshotExcelExport ExcelExport Data Search Error", e);
}
List<SnapshotLogInfo> logList = result.getItems();
progressTracker.updateProgress(taskId, 30, 100, "데이터 파싱 완료...");
try{
excelService.generateExcelToResponse(
response,
logList,
"유저 스냅샷 로그 데이터",
"sheet1",
taskId
);
}catch (Exception e){
log.error("SnapshotExcelExport Excel Export Create Error", e);
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.ERROR_EXCEL_DOWN.toString());
}
}
}

View File

@@ -1,14 +1,17 @@
package com.caliverse.admin.domain.service;
import com.caliverse.admin.domain.dao.admin.HistoryMapper;
import com.caliverse.admin.domain.dao.admin.MailMapper;
import com.caliverse.admin.domain.dao.total.WalletUserMapper;
import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
import com.caliverse.admin.domain.entity.*;
import com.caliverse.admin.domain.entity.log.LogAction;
import com.caliverse.admin.domain.entity.log.LogStatus;
import com.caliverse.admin.domain.request.MailRequest;
import com.caliverse.admin.domain.response.MailResponse;
import com.caliverse.admin.dynamodb.service.DynamodbCaliumService;
import com.caliverse.admin.dynamodb.service.DynamodbUserService;
import com.caliverse.admin.global.common.annotation.BusinessProcess;
import com.caliverse.admin.global.common.annotation.RequestLog;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.code.SuccessCode;
@@ -17,6 +20,7 @@ import com.caliverse.admin.global.common.constants.MysqlConstants;
import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.global.common.utils.ExcelUtils;
import com.caliverse.admin.global.component.manager.BusinessProcessIdManager;
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
import com.caliverse.admin.scheduler.ScheduleService;
import lombok.RequiredArgsConstructor;
@@ -26,6 +30,8 @@ import org.springframework.core.io.Resource;
import org.springframework.core.io.UrlResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.core.io.ResourceLoader;
@@ -47,13 +53,13 @@ public class MailService {
private String samplePath;
private final ExcelUtils excelUtils;
private final MailMapper mailMapper;
private final HistoryMapper historyMapper;
private final MetaDataHandler metaDataHandler;
private final ResourceLoader resourceLoader;
private final ScheduleService scheduleService;
private final HistoryService historyService;
private final DynamodbCaliumService dynamodbCaliumService;
private final MysqlHistoryLogService mysqlHistoryLogService;
private final BusinessProcessIdManager processIdManager;
public MailResponse getStockCalium(){
double stock_calium = dynamodbCaliumService.getCaliumTotal();
@@ -68,6 +74,7 @@ public class MailService {
.build();
}
@RequestLog
public MailResponse getList(Map requestParam){
// gameDB 조회 및 서비스 로직
@@ -92,6 +99,7 @@ public class MailService {
.build();
}
@RequestLog
public MailResponse getdetail(Long id){
// gameDB 조회 및 서비스 로직
@@ -168,7 +176,9 @@ public class MailService {
}
}
@BusinessProcess(action = LogAction.MAIL)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public MailResponse postMail(MailRequest mailRequest){
mailRequest.setCreateBy(CommonUtils.getAdmin().getId());
if(mailRequest.isReserve()){
@@ -274,7 +284,6 @@ public class MailService {
}
}
//메시지 저장
if(mailRequest.getMailList()!= null && !mailRequest.getMailList().isEmpty()){
mailRequest.getMailList().forEach(
@@ -286,18 +295,30 @@ public class MailService {
}
);
}
log.info("postMail Insert Mail: {}", mailRequest);
log.info("postMail Insert Mail Complete id: {}", mailRequest.getId());
Mail info = mailMapper.getMailDetail(mailRequest.getId());
info.setMailList(mailMapper.getMessage(mailRequest.getId()));
info.setItemList(mailMapper.getItem(mailRequest.getId()));
String prodId = processIdManager.getCurrentProcessId();
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
try {
mysqlHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.MAIL_ADD,
prodId,
LogAction.MAIL,
LogStatus.SUCCESS,
MysqlConstants.TABLE_NAME_MAIL,
HISTORYTYPEDETAIL.MAIL_ADD.name(),
"",
info
);
} catch (Exception e) {
log.warn("Failed to log mail creation: {}", e.getMessage());
}
}
});
return MailResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())
@@ -307,7 +328,10 @@ public class MailService {
.build())
.build();
}
@BusinessProcess(action = LogAction.MAIL)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public MailResponse updateMail(Long id, MailRequest mailRequest) {
mailRequest.setId(id);
mailRequest.setUpdateBy(CommonUtils.getAdmin().getId());
@@ -341,8 +365,6 @@ public class MailService {
before_info.setMailList(mailMapper.getMessage(mail_id));
before_info.setItemList(mailMapper.getItem(mail_id));
log.info("updateMail Update Before MailInfo: {}", before_info);
mailMapper.updateMail(mailRequest);
// 스케줄에서 제거
@@ -377,30 +399,31 @@ public class MailService {
mailMapper.insertMessage(map);
});
}
log.info("updateMail Update After Mail: {}", mailRequest);
log.info("updateMail Update Complete Mail Id: {}", mailRequest.getId());
Mail after_info = mailMapper.getMailDetail(mail_id);
after_info.setMailList(mailMapper.getMessage(mail_id));
after_info.setItemList(mailMapper.getItem(mail_id));
String prodId = processIdManager.getCurrentProcessId();
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
try {
mysqlHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.MAIL_UPDATE,
prodId,
LogAction.MAIL,
LogStatus.SUCCESS,
MysqlConstants.TABLE_NAME_MAIL,
HISTORYTYPEDETAIL.MAIL_UPDATE.name(),
"",
before_info,
after_info
);
//로그 기록
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("before_info",before_info.toString());
// jsonObject.put("mail_type",mailRequest.getMailType());
// jsonObject.put("receiver",mailRequest.getTarget());
// Mail.SENDTYPE sendType = mailRequest.getSendType();
// jsonObject.put("send_type",sendType);
// if(sendType.equals(Mail.SENDTYPE.RESERVE_SEND))
// jsonObject.put("send_dt",mailRequest.getSendDt());
// historyService.setLog(HISTORYTYPE.MAIL_UPDATE, jsonObject);
} catch (Exception e) {
log.warn("Failed to log mail creation: {}", e.getMessage());
}
}
});
return MailResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())
@@ -411,7 +434,9 @@ public class MailService {
.build();
}
@BusinessProcess(action = LogAction.MAIL)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public MailResponse deleteMail(MailRequest mailRequest){
Map<String,Object> map = new HashMap<>();
@@ -419,34 +444,13 @@ public class MailService {
item->{
long id = item.getId();
Mail info = mailMapper.getMailDetail(id);
map.put("id",id);
mailMapper.deleteMail(map);
// 스케줄에서 제거
scheduleService.closeTask("mail-" + item.getId());
log.info("deleteMail Mail: {}", item);
log.info("deleteMail Mail id: {}", id);
mysqlHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.MAIL_DELETE,
MysqlConstants.TABLE_NAME_MAIL,
HISTORYTYPEDETAIL.MAIL_DELETE.name(),
info
);
//로그 기록
// List<Message> message = mailMapper.getMessage(Long.valueOf(item.getId()));
// map.put("adminId", CommonUtils.getAdmin().getId());
// map.put("name", CommonUtils.getAdmin().getName());
// map.put("mail", CommonUtils.getAdmin().getEmail());
// map.put("type", HISTORYTYPE.MAIL_DELETE);
// JSONObject jsonObject = new JSONObject();
// if(!message.isEmpty()){
// jsonObject.put("message",message.get(0).getTitle());
// }
// map.put("content",jsonObject.toString());
// historyMapper.saveLog(map);
}
);
@@ -471,6 +475,7 @@ public class MailService {
return mailMapper.getItem(id);
}
@Transactional(transactionManager = "transactionManager")
public void updateMailStatus(Long id, Mail.SENDSTATUS status){
Map<String,Object> map = new HashMap<>();
map.put("id", id);
@@ -514,9 +519,4 @@ public class MailService {
}
return target;
}
public void setScheduleLog(HISTORYTYPEDETAIL type, String message){
//스케줄 로그 기록
historyService.setScheduleLog(type, message);
}
}

View File

@@ -3,9 +3,13 @@ package com.caliverse.admin.domain.service;
import com.caliverse.admin.domain.RabbitMq.MessageHandlerService;
import com.caliverse.admin.domain.dao.admin.MenuMapper;
import com.caliverse.admin.domain.entity.*;
import com.caliverse.admin.domain.entity.log.LogAction;
import com.caliverse.admin.domain.entity.log.LogStatus;
import com.caliverse.admin.domain.request.MenuRequest;
import com.caliverse.admin.domain.response.MenuResponse;
import com.caliverse.admin.dynamodb.service.DynamodbMenuService;
import com.caliverse.admin.global.common.annotation.BusinessProcess;
import com.caliverse.admin.global.common.annotation.RequestLog;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.code.SuccessCode;
@@ -14,6 +18,7 @@ import com.caliverse.admin.global.common.constants.MysqlConstants;
import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.global.common.utils.FileUtils;
import com.caliverse.admin.global.component.manager.BusinessProcessIdManager;
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
import com.caliverse.admin.redis.service.RedisUserInfoService;
import lombok.RequiredArgsConstructor;
@@ -24,6 +29,8 @@ import org.springframework.core.io.ResourceLoader;
import org.springframework.core.io.UrlResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.web.multipart.MultipartFile;
import software.amazon.awssdk.services.s3.model.S3Exception;
@@ -53,7 +60,9 @@ public class MenuService {
private final DynamodbMenuService dynamodbMenuService;
private final MessageHandlerService messageHandlerService;
private final RedisUserInfoService redisUserInfoService;
private final BusinessProcessIdManager processIdManager;
@RequestLog
public MenuResponse getList(Map requestParam){
//페이징 처리
@@ -75,6 +84,7 @@ public class MenuService {
.build();
}
@RequestLog
public MenuResponse getdetail(Long id){
MenuBanner banner = menuMapper.getBannerDetail(id);
@@ -91,6 +101,7 @@ public class MenuService {
public MenuResponse imageUpload(MultipartFile file){
if (file.isEmpty()) {
log.error("File is empty");
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NOT_EXIT_FILE.toString());
}
@@ -151,7 +162,9 @@ public class MenuService {
}
}
@BusinessProcess(action = LogAction.BANNER)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public MenuResponse postBanner(MenuRequest menuRequest){
menuRequest.setCreateBy(CommonUtils.getAdmin().getId());
@@ -205,15 +218,36 @@ public class MenuService {
});
}
log.info("postBanner Insert MenuBanner id: {}", menuRequest.getId());
MenuBanner banner = menuMapper.getBannerDetail(menuRequest.getId());
banner.setImageList(menuMapper.getMessage(menuRequest.getId()));
String prodId = processIdManager.getCurrentProcessId();
LogAction action = processIdManager.getCurrentAction();
//message 정보까지 저장해야해서 수동 로그
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
try {
mysqlHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.MENU_BANNER_ADD,
prodId,
action,
LogStatus.SUCCESS,
MysqlConstants.TABLE_NAME_MENU_BANNER,
HISTORYTYPEDETAIL.MENU_BANNER_ADD.name(),
"",
banner
);
} catch (Exception e) {
log.warn("Failed to log banner creation: {}", e.getMessage());
}
}
});
if(redisUserInfoService.getAllServerList().isEmpty()){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NOT_FOUND_SERVER.getMessage());
}
dynamodbMenuService.insertBanner(banner);
@@ -229,7 +263,9 @@ public class MenuService {
.build();
}
@BusinessProcess(action = LogAction.BANNER)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public MenuResponse updateBanner(Long id, MenuRequest menuRequest) {
menuRequest.setId(id);
menuRequest.setUpdateBy(CommonUtils.getAdmin().getId());
@@ -240,38 +276,16 @@ public class MenuService {
List<Message> before_msg = menuMapper.getMessage(banner_id);
before_info.setImageList(before_msg);
log.info("updateBanner Update Before MenuBanner: {}, Images: {}", before_info, before_msg);
menuMapper.updateBanner(menuRequest);
// Map<String, String> map = new HashMap<>();
// map.put("id", String.valueOf(menuRequest.getId()));
// menuMapper.deleteMessage(map);
//
// if(menuRequest.getImageList()!= null && !menuRequest.getImageList().isEmpty()){
// menuRequest.getImageList().forEach(image -> {
// map.put("title", image.getContent());
// map.put("language", image.getLanguage());
// if(menuRequest.isLink() && menuRequest.getLinkList() != null && !menuRequest.getLinkList().isEmpty()){
// String link = menuRequest.getLinkList().stream().filter(data -> data.getLanguage().equals(image.getLanguage())).findFirst().get().getContent();
// map.put("content", link);
// }
// menuMapper.insertMessage(map);
// });
// }
log.info("updateBanner Update After Banner: {}", menuRequest);
log.info("updateBanner Update Banner Complete: {}", menuRequest.getId());
MenuBanner after_info = menuMapper.getBannerDetail(banner_id);
after_info.setImageList(menuMapper.getMessage(banner_id));
mysqlHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.MENU_BANNER_UPDATE,
MysqlConstants.TABLE_NAME_MENU_BANNER,
HISTORYTYPEDETAIL.MENU_BANNER_UPDATE.name(),
before_info,
after_info
);
if(redisUserInfoService.getAllServerList().isEmpty()){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NOT_FOUND_SERVER.getMessage());
}
dynamodbMenuService.updateBanner(after_info);
@@ -287,7 +301,9 @@ public class MenuService {
.build();
}
@BusinessProcess(action = LogAction.BANNER)
@Transactional(transactionManager = "transactionManager")
@RequestLog
public MenuResponse deleteBanner(Long id){
Map<String,Object> map = new HashMap<>();
map.put("id",id);
@@ -306,17 +322,17 @@ public class MenuService {
}
menuMapper.deleteBanner(map);
menuMapper.deleteMessage(map);
mysqlHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.MENU_BANNER_DELETE,
MysqlConstants.TABLE_NAME_MENU_BANNER,
HISTORYTYPEDETAIL.MENU_BANNER_DELETE.name(),
banner
);
log.info("deleteBanner Delete Banner Complete id: {}", id);
if(redisUserInfoService.getAllServerList().isEmpty()){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NOT_FOUND_SERVER.getMessage());
}
dynamodbMenuService.deleteBanner(banner.getId().intValue());
//운영DB 데이터 추가됐다고 게임서버 알림
//게임서버 알림
notifyGameServers("deleteBanner", null);
return MenuResponse.builder()

View File

@@ -1,23 +1,26 @@
package com.caliverse.admin.domain.service;
import com.caliverse.admin.domain.dao.admin.HistoryMapper;
import com.caliverse.admin.domain.dao.admin.NoticeMapper;
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.entity.InGame;
import com.caliverse.admin.domain.entity.Message;
import com.caliverse.admin.domain.entity.log.LogAction;
import com.caliverse.admin.domain.entity.log.LogStatus;
import com.caliverse.admin.domain.request.NoticeRequest;
import com.caliverse.admin.domain.response.NoticeResponse;
import com.caliverse.admin.global.common.annotation.BusinessProcess;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.SuccessCode;
import com.caliverse.admin.global.common.constants.MysqlConstants;
import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.global.component.manager.BusinessProcessIdManager;
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
import com.caliverse.admin.scheduler.ScheduleService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.json.JSONObject;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import java.util.HashMap;
import java.util.List;
@@ -30,10 +33,9 @@ import java.util.stream.Collectors;
public class NoticeService {
private final NoticeMapper noticeMapper;
private final HistoryMapper historyMapper;
private final ScheduleService scheduleService;
private final HistoryService historyService;
private final MysqlHistoryLogService mysqlHistoryLogService;
private final BusinessProcessIdManager processIdManager;
public NoticeResponse getNoticeList(){
@@ -77,6 +79,7 @@ public class NoticeService {
}
//인게임 메시지 등록
@BusinessProcess(action = LogAction.NOTICE)
@Transactional(transactionManager = "transactionManager")
public NoticeResponse postInGameMessage(NoticeRequest noticeRequest){
// 등록자는 메일로 넣어주자
@@ -98,13 +101,27 @@ public class NoticeService {
}
log.info("postInGameMessage notice: {}", noticeRequest);
mysqlHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.NOTICE_ADD,
MysqlConstants.TABLE_NAME_NOTICE,
HISTORYTYPEDETAIL.NOTICE_ADD.name(),
noticeMapper.getNoticeDetail(noticeRequest.getId())
);
InGame info = noticeMapper.getNoticeDetail(noticeRequest.getId());
info.setMessageList(noticeMapper.getMessage(noticeRequest.getId()));
String prodId = processIdManager.getCurrentProcessId();
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
try {
mysqlHistoryLogService.insertHistoryLog(
prodId,
LogAction.NOTICE,
LogStatus.SUCCESS,
MysqlConstants.TABLE_NAME_NOTICE,
"",
info
);
} catch (Exception e) {
log.warn("Failed to log notice creation: {}", e.getMessage());
}
}
});
return NoticeResponse.builder()
.resultData(NoticeResponse.ResultData.builder().message(SuccessCode.REGISTRATION.getMessage()).build())
@@ -113,16 +130,19 @@ public class NoticeService {
.build();
}
@BusinessProcess(action = LogAction.NOTICE)
@Transactional(transactionManager = "transactionManager")
public NoticeResponse updateInGameMessage(Long id, NoticeRequest noticeRequest){
noticeRequest.setId(id);
noticeRequest.setUpdateBy(CommonUtils.getAdmin().getId());
InGame before_info = noticeMapper.getNoticeDetail(id);
before_info.setMessageList(noticeMapper.getMessage(id));
int i = noticeMapper.updateNotice(noticeRequest);
// 스케줄에서 기존 등록 제거
scheduleService.closeTask(noticeRequest.getId().toString());
if(i > 0){
InGame before_notice = noticeMapper.getNoticeDetail(noticeRequest.getId());
log.info("updateInGameMessage Before notice: {}", before_notice);
@@ -148,13 +168,29 @@ public class NoticeService {
}
log.info("updateInGameMessage After notice: {}", noticeRequest);
InGame info = noticeMapper.getNoticeDetail(noticeRequest.getId());
info.setMessageList(noticeMapper.getMessage(noticeRequest.getId()));
String prodId = processIdManager.getCurrentProcessId();
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
try {
mysqlHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.NOTICE_UPDATE,
prodId,
LogAction.NOTICE,
LogStatus.SUCCESS,
MysqlConstants.TABLE_NAME_NOTICE,
HISTORYTYPEDETAIL.NOTICE_UPDATE.name(),
"",
before_info,
noticeMapper.getNoticeDetail(id)
info
);
} catch (Exception e) {
log.warn("Failed to log notice creation: {}", e.getMessage());
}
}
});
return NoticeResponse.builder()
.resultData(NoticeResponse.ResultData.builder().message(SuccessCode.UPDATE.getMessage()).build())
.result(CommonCode.SUCCESS.getResult())
@@ -162,6 +198,7 @@ public class NoticeService {
.build();
}
@BusinessProcess(action = LogAction.NOTICE)
@Transactional(transactionManager = "transactionManager")
public NoticeResponse deleteInGameMessage(NoticeRequest noticeRequest){
@@ -169,26 +206,16 @@ public class NoticeService {
noticeRequest.getList().forEach(
item->{
//사용자 로그 기록 (인게임 메시지 삭제)
String message = noticeMapper.getMessageById(item.getMessageId());
noticeMapper.deleteNotice(item.getMessageId());
noticeMapper.deleteNotice(item.getId());
// 스케줄에서 제거
scheduleService.closeTask("notice-" + item.getMessageId());
scheduleService.closeTask("notice-" + item.getId());
log.info("deleteInGameMessage notice: {}", item);
mysqlHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.NOTICE_DELETE,
MysqlConstants.TABLE_NAME_NOTICE,
HISTORYTYPEDETAIL.NOTICE_DELETE.name(),
noticeMapper.getNoticeDetail(item.getMessageId())
);
}
);
log.info("deleteInGameMessage notice: {}", noticeRequest);
log.info("deleteInGameMessage notice id: {}", noticeRequest.getList().get(0).getId());
return NoticeResponse.builder()
.resultData(NoticeResponse.ResultData.builder().message(SuccessCode.DELETE.getMessage()).build())
.result(CommonCode.SUCCESS.getResult())
@@ -204,6 +231,7 @@ public class NoticeService {
return noticeMapper.getMessage(id);
}
@Transactional(transactionManager = "transactionManager")
public void updateNoticeStatus(Long id, InGame.SENDSTATUS status){
HashMap map = new HashMap();
map.put("id", id);
@@ -215,16 +243,4 @@ public class NoticeService {
noticeMapper.updateCountNotice(id);
}
public void setScheduleLog(HISTORYTYPEDETAIL type, String message){
//스케줄 로그 기록
Map<String, Object> logMap = new HashMap<>();
logMap.put("adminId", 1);
logMap.put("name", "schedule");
logMap.put("mail", "schedule");
logMap.put("type", type);
JSONObject jsonObject = new JSONObject();
jsonObject.put("message",message);
logMap.put("content",jsonObject.toString());
historyMapper.saveLog(logMap);
}
}

View File

@@ -1,5 +1,9 @@
package com.caliverse.admin.domain.service;
import com.caliverse.admin.domain.entity.log.LogStatus;
import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.global.common.utils.FileUtils;
import com.caliverse.admin.mongodb.service.BusinessLogService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -25,6 +29,9 @@ public class S3Service {
@Autowired(required = false)
private final S3Client s3Client;
private final BusinessLogService businessLogService;
private final FileUtils fileUtils;
@Value("${amazon.s3.bucket-name}")
private String bucketName;
@@ -53,7 +60,7 @@ public class S3Service {
}
public String uploadFile(File file, String directoryName, String contentType) throws IOException, S3Exception {
String fileName = UUID.randomUUID() + "-" + file.getName();
String fileName = CommonUtils.getCreateGuId() + "-" + file.getName();
// S3 객체 키 (경로 + 파일명)
String objectKey = String.format("%s/%s/%s", activeProfile, directoryName, fileName);
@@ -72,6 +79,21 @@ public class S3Service {
RequestBody.fromBytes(Files.readAllBytes(file.toPath()))
);
log.info("Uploaded S3 object with key: {}", objectKey);
if(response.sdkHttpResponse().isSuccessful()){
businessLogService.logS3(
LogStatus.SUCCESS,
"",
CommonUtils.getAdmin().getId().toString(),
CommonUtils.getClientIp(),
bucketName,
objectKey,
file.length(),
fileUtils.getContentType(file.getName())
);
}
return cloudFrontUrl + objectKey;
}catch (S3Exception | IOException e) {
throw e;

View File

@@ -2,6 +2,8 @@ package com.caliverse.admin.domain.service;
import com.caliverse.admin.domain.RabbitMq.MessageHandlerService;
import com.caliverse.admin.domain.entity.log.LogAction;
import com.caliverse.admin.global.common.annotation.BusinessProcess;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.exception.RestApiException;

View File

@@ -1,37 +0,0 @@
package com.caliverse.admin.domain.service;
import com.caliverse.admin.global.common.constants.AdminConstants;
import com.caliverse.admin.logs.logservice.businesslogservice.BusinessLogUserItemHistoryService;
import org.springframework.stereotype.Service;
import com.caliverse.admin.global.common.utils.CommonUtils;
import java.util.Map;
@Service
public class UserItemService {
private final BusinessLogUserItemHistoryService historyService;
public UserItemService(BusinessLogUserItemHistoryService hstoryService){
this.historyService = hstoryService;
}
public String getUserItemHistory(Map<String, String> requestParams){
//페이징 처리
//requestParams =
CommonUtils.pageSetting(requestParams);
//몽고 DB 에서 호출 할수 있도록 처리
String startDate = requestParams.get(AdminConstants.INDICATORS_KEY_START_DATE);
String endDate = requestParams.get(AdminConstants.INDICATORS_KEY_END_DATE);
String itemId = requestParams.get(AdminConstants.INDICATORS_KEY_ITEM_ID);
//UserItemService.class 바꿔야 한다.
historyService.loadBusinessLogData(startDate, endDate, itemId, UserItemService.class);
return "";
}
}

View File

@@ -11,6 +11,7 @@ import com.caliverse.admin.domain.RabbitMq.MessageHandlerService;
import com.caliverse.admin.domain.entity.EReqType;
import com.caliverse.admin.domain.entity.FriendRequest;
import com.caliverse.admin.domain.entity.SEARCHTYPE;
import com.caliverse.admin.domain.entity.log.LogAction;
import com.caliverse.admin.domain.request.MailRequest;
import com.caliverse.admin.dynamodb.domain.atrrib.AccountBaseAttrib;
import com.caliverse.admin.dynamodb.domain.atrrib.MailAttrib;
@@ -19,6 +20,8 @@ import com.caliverse.admin.dynamodb.domain.atrrib.MoneyAttrib;
import com.caliverse.admin.dynamodb.domain.doc.MailDoc;
import com.caliverse.admin.dynamodb.dto.PageResult;
import com.caliverse.admin.dynamodb.service.*;
import com.caliverse.admin.global.common.annotation.BusinessProcess;
import com.caliverse.admin.global.common.annotation.RequestLog;
import com.caliverse.admin.global.common.constants.CommonConstants;
import com.caliverse.admin.redis.service.RedisUserInfoService;
import lombok.extern.slf4j.Slf4j;
@@ -61,6 +64,8 @@ public class UsersService {
private MetaDataHandler metaDataHandler;
// 닉네임 변경
@BusinessProcess(action = LogAction.NICKNAME_CHANGE)
@RequestLog
public UsersResponse changeNickname(UsersRequest usersRequest){
String guid = usersRequest.getGuid();
String nickname = usersRequest.getNickname();
@@ -75,6 +80,8 @@ public class UsersService {
userGameSessionService.kickUserSession(guid, String.format("%s User Nickname Changes", nickname));
dynamodbUserService.changesNickname(guid, nickname, newNickname);
log.info("Nickname Changed complete guid: {}", guid);
return UsersResponse.builder()
.resultData(UsersResponse.ResultData.builder()
.message(SuccessCode.UPDATE.getMessage())
@@ -86,11 +93,15 @@ public class UsersService {
}
// GM 권한 변경
@BusinessProcess(action = LogAction.ADMIN_LEVEL)
@RequestLog
public UsersResponse changeAdminLevel(UsersRequest usersRequest){
String guid = usersRequest.getGuid();
dynamodbUserService.updateAdminLevel(guid, usersRequest.getAdminLevel());
log.info("Admin Level Changed Complete guid: {}", guid);
return UsersResponse.builder()
.resultData(UsersResponse.ResultData.builder()
.message(SuccessCode.UPDATE.getMessage())
@@ -102,12 +113,16 @@ public class UsersService {
}
// 유저 킥
@BusinessProcess(action = LogAction.KICK_USER)
@RequestLog
public UsersResponse userKick(UsersRequest usersRequest){
String guid = usersRequest.getGuid();
String adminUser = CommonUtils.getAdmin().getEmail();
userGameSessionService.kickUserSession(guid, String.format("admin %s kick out", adminUser));
log.info("User Kicked Complete guid: {}", guid);
return UsersResponse.builder()
.resultData(UsersResponse.ResultData.builder()
.message(SuccessCode.SUCCESS.getMessage())
@@ -119,6 +134,7 @@ public class UsersService {
}
// 유정 정보 조회 닉네임,GUID,Account ID
@RequestLog
public UsersResponse findUsers(Map requestParam){
String searchType = requestParam.get("search_type").toString();
@@ -155,6 +171,7 @@ public class UsersService {
}
//유저 기본 정보
@RequestLog
public UsersResponse getBasicInfo(String guid){
String account_id = dynamodbUserService.getGuidByAccountId(guid);
@@ -202,6 +219,7 @@ public class UsersService {
}
//아바타 정보
@RequestLog
public UsersResponse getAvatarInfo(String guid){
//avatarInfo
@@ -220,6 +238,7 @@ public class UsersService {
}
//의상 정보
@RequestLog
public UsersResponse getClothInfo(String guid){
Map<String, Object> charInfo = dynamodbItemService.getClothItems(guid);
@@ -236,6 +255,7 @@ public class UsersService {
}
//도구 정보
@RequestLog
public UsersResponse getToolSlotInfo(String guid){
Map<String, Object> toolSlot = dynamodbItemService.getTools(guid);
@@ -252,6 +272,7 @@ public class UsersService {
}
//인벤토리 정보
@RequestLog
public UsersResponse getInventoryInfo(String guid){
UsersResponse.InventoryInfo inventoryInfo = dynamodbItemService.getInvenItems(guid);
log.info("getInventoryInfo Inventory Items: {}", inventoryInfo);
@@ -269,6 +290,8 @@ public class UsersService {
}
//인벤토리 아이템 삭제
@BusinessProcess(action = LogAction.ITEM)
@RequestLog
public UsersResponse deleteInventoryItem(Map<String, String> requestParams){
String guid = requestParams.get("guid");
String item_guid = requestParams.get("item_guid");
@@ -278,6 +301,8 @@ public class UsersService {
userGameSessionService.kickUserSession(guid, "Item delete");
if(update_cnt >= current_cnt){
dynamodbItemService.deleteItem(guid, item_guid);
log.info("Item delete complete guid: {}", guid);
return UsersResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
@@ -288,6 +313,8 @@ public class UsersService {
}else{
int cnt = current_cnt - update_cnt;
dynamodbItemService.updateItemStack(guid, item_guid, cnt);
log.info("Item update complete guid: {}", guid);
return UsersResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
@@ -299,6 +326,7 @@ public class UsersService {
}
//우편 정보
@RequestLog
public UsersResponse getMail(UsersRequest usersRequest){
PageResult<MailDoc> mailPageResult = dynamodbMailService.getMail(usersRequest.getMailType(), usersRequest.getGuid(), "", usersRequest.getPageKey());
List<UsersResponse.Mail> mailList = new ArrayList<>();
@@ -381,6 +409,8 @@ public class UsersService {
}
//우편 삭제
@BusinessProcess(action = LogAction.MAIL)
@RequestLog
public UsersResponse deleteMail(Map<String, String> requestParams){
String guid = requestParams.get("guid");
String mail_guid = requestParams.get("mail_guid");
@@ -389,6 +419,8 @@ public class UsersService {
userGameSessionService.kickUserSession(guid, "delete mail");
dynamodbMailService.deleteMail(type, guid, mail_guid);
log.info("Delete mail complete guid: {}", guid);
return UsersResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
@@ -399,11 +431,15 @@ public class UsersService {
}
//우편 아이템 삭제
@BusinessProcess(action = LogAction.MAIL_ITEM)
@RequestLog
public UsersResponse deleteMailItem(MailRequest.DeleteMailItem deleteMailItem){
userGameSessionService.kickUserSession(deleteMailItem.getGuid(), "delete mail item");
dynamodbMailService.deleteMailItem(deleteMailItem.getType(), deleteMailItem.getGuid(),
deleteMailItem.getMailGuid(), deleteMailItem.getItemId(), deleteMailItem.getParrentCount(), deleteMailItem.getCount());
log.info("Delete mail item complete guid: {}", deleteMailItem.getGuid());
return UsersResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
@@ -414,6 +450,7 @@ public class UsersService {
}
//마이홈 정보
@RequestLog
public UsersResponse getMyhome(String guid){
List<UsersResponse.Myhome> myhome = dynamodbMyHomeService.getMyHome(guid);
@@ -430,6 +467,7 @@ public class UsersService {
}
//친구 목록
@RequestLog
public UsersResponse getFriendList(String guid){
List<UsersResponse.Friend> friendList = dynamodbFriendService.getFriend(guid);
@@ -479,6 +517,7 @@ public class UsersService {
}
//타투 정보
@RequestLog
public UsersResponse getTattoo(String guid){
List<UsersResponse.Tattoo> resTatto = dynamodbItemService.getTattoo(guid);
@@ -495,6 +534,7 @@ public class UsersService {
}
//퀘스트 정보
@RequestLog
public UsersResponse getQuest(String guid){
List<UsersResponse.QuestInfo> questList = dynamodbQuestService.getQuestItems(guid);
@@ -510,6 +550,8 @@ public class UsersService {
}
@BusinessProcess(action = LogAction.QUEST_TASK)
@RequestLog
public UsersResponse CompleteQuestTask(UsersRequest usersRequest){
String serverName = redisUserInfoService.getFirstChannel();
if(serverName.isEmpty()){
@@ -539,6 +581,8 @@ public class UsersService {
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.MESSAGE_SEND_FAIL.getMessage());
}
log.info("CompleteQuestTask Quest Task forced completion guid: {}, quest: {}", guid, usersRequest.getQuestKey());
return UsersResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())

View File

@@ -77,26 +77,31 @@ public class CaliumStorageAttrib {
private String converterLastFillUpDate;
private Double converterTotalCalium;
//누적 총량
@DynamoDbAttribute("converter_cumulative_calium")
public Double getConverterCumulativeCalium() {
return converterCumulativeCalium;
}
//컨버터 칼리움 전환 비율
@DynamoDbAttribute("converter_daily_convert_rate")
public Double getConverterDailyConvertRate() {
return converterDailyConvertRate;
}
//daily 누적 칼리움 수
@DynamoDbAttribute("converter_daily_fill_up_standard_calium")
public Double getConverterDailyFillUpStandardCalium() {
return converterDailyFillUpStandardCalium;
}
//마지막 누적 시간
@DynamoDbAttribute("converter_last_fill_up_date")
public String getConverterLastFillUpDate() {
return converterLastFillUpDate;
}
//잔여 수량
@DynamoDbAttribute("converter_total_calium")
public Double getConverterTotalCalium() {
return converterTotalCalium;
@@ -109,10 +114,11 @@ public class CaliumStorageAttrib {
@DynamoDbBean
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public static class CaliumExchangerStorage {
private Integer exchangerDailyInflationRate;
private Double exchangerDailyInflationRate;
//인플레이션 가중치
@DynamoDbAttribute("exchanger_daily_inflation_rate")
public Integer getExchangerDailyInflationRate() {
public Double getExchangerDailyInflationRate() {
return exchangerDailyInflationRate;
}
}
@@ -127,16 +133,19 @@ public class CaliumStorageAttrib {
private Double operatorCalium;
private String operatorCaliumFillUpDate;
//운영용 사용 가능량
@DynamoDbAttribute("operator_calium")
public Double getOperatorCalium() {
return operatorCalium;
}
//운영용 승인 누적 날짜
@DynamoDbAttribute("operator_calium_fill_up_date")
public String getOperatorCaliumFillUpDate() {
return operatorCaliumFillUpDate;
}
//운영 승인 누적량
@DynamoDbAttribute("operator_total_calium")
public Double getOperatorTotalCalium() {
return operatorTotalCalium;

View File

@@ -1,6 +1,9 @@
package com.caliverse.admin.dynamodb.repository;
import com.caliverse.admin.domain.entity.EFilterOperator;
import com.caliverse.admin.domain.entity.log.LogAction;
import com.caliverse.admin.domain.entity.log.LogStatus;
import com.caliverse.admin.dynamodb.domain.doc.DynamoDBDocBase;
import com.caliverse.admin.dynamodb.dto.PageResult;
import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
import com.caliverse.admin.global.common.code.CommonCode;
@@ -27,6 +30,22 @@ public abstract class BaseDynamoDBRepository<T> implements DynamoDBRepository<T>
@Override
public void save(T item) {
operations.addPutItem(item, entityClass);
try {
dynamodbHistoryLogService.insertHistoryLog(
LogStatus.SUCCESS,
"",
(DynamoDBDocBase) item
);
} catch (Exception e) {
dynamodbHistoryLogService.insertHistoryLog(
LogStatus.FAILURE,
e.getMessage(),
(DynamoDBDocBase) item
);
throw e;
}
}
@Override
@@ -36,7 +55,32 @@ public abstract class BaseDynamoDBRepository<T> implements DynamoDBRepository<T>
@Override
public void update(T item) {
DynamoDBDocBase doc = (DynamoDBDocBase) item;
Key key = Key.builder()
.partitionValue(doc.getPK())
.sortValue(doc.getSK())
.build();
T beforeDoc = findById(key);
operations.addUpdateItem(item, entityClass);
try {
dynamodbHistoryLogService.updateHistoryLog(
LogStatus.SUCCESS,
"",
(DynamoDBDocBase) beforeDoc,
(DynamoDBDocBase) item
);
} catch (Exception e) {
dynamodbHistoryLogService.updateHistoryLog(
LogStatus.FAILURE,
e.getMessage(),
null,
(DynamoDBDocBase) item
);
throw e;
}
}
@Override
@@ -46,7 +90,26 @@ public abstract class BaseDynamoDBRepository<T> implements DynamoDBRepository<T>
@Override
public void delete(Key key) {
T beforeDoc = findById(key);
operations.addDeleteItem(key, entityClass);
try {
dynamodbHistoryLogService.deleteHistoryLog(
LogStatus.SUCCESS,
"",
(DynamoDBDocBase) beforeDoc
);
} catch (Exception e) {
dynamodbHistoryLogService.deleteHistoryLog(
LogStatus.FAILURE,
e.getMessage(),
(DynamoDBDocBase) beforeDoc
);
throw e;
}
}
@Override

View File

@@ -1,9 +1,11 @@
package com.caliverse.admin.dynamodb.repository;
import com.caliverse.admin.dynamodb.domain.atrrib.CaliumStorageAttrib;
import com.caliverse.admin.dynamodb.domain.doc.CaliumStorageDoc;
public interface CaliumStorageRepository extends DynamoDBRepository<CaliumStorageDoc> {
double getTotal();
CaliumStorageAttrib getStorage();
void updateTotal(double caliumCnt);
void stockDeduction(double caliumCnt);
}

View File

@@ -1,7 +1,6 @@
package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.BlackList;
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.dynamodb.domain.atrrib.AccountBaseAttrib;
import com.caliverse.admin.dynamodb.domain.doc.AccountBaseDoc;
import com.caliverse.admin.dynamodb.entity.EAuthAdminLevelType;
@@ -80,12 +79,6 @@ public class AccountBaseRepositoryImpl extends BaseDynamoDBRepository<AccountBas
log.info("updateBlockUserStart Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.BLACKLIST_UPDATE,
HISTORYTYPEDETAIL.BLACKLIST_UPDATE.name(),
beforeDoc,
afterDoc
);
}
}catch (Exception e){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
@@ -120,12 +113,6 @@ public class AccountBaseRepositoryImpl extends BaseDynamoDBRepository<AccountBas
log.info("updateBlockUserEnd Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.BLACKLIST_UPDATE,
HISTORYTYPEDETAIL.BLACKLIST_UPDATE.name(),
beforeDoc,
afterDoc
);
}
}catch (Exception e){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
@@ -155,12 +142,6 @@ public class AccountBaseRepositoryImpl extends BaseDynamoDBRepository<AccountBas
log.info("updateAdminLevel Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.USER_ADMIN_AUTH_UPDATE,
HISTORYTYPEDETAIL.USER_ADMIN_AUTH_UPDATE.name(),
beforeDoc,
afterDoc
);
}
}catch (Exception e){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());

View File

@@ -1,21 +1,13 @@
package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.RabbitMq.message.BannerType;
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.entity.MenuBanner;
import com.caliverse.admin.domain.request.LandRequest;
import com.caliverse.admin.domain.request.MenuRequest;
import com.caliverse.admin.dynamodb.domain.atrrib.BannerAttrib;
import com.caliverse.admin.dynamodb.domain.atrrib.BuildingAttrib;
import com.caliverse.admin.dynamodb.domain.doc.BannerDoc;
import com.caliverse.admin.dynamodb.domain.doc.BuildingDoc;
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRegistryDoc;
import com.caliverse.admin.dynamodb.entity.DynamodbOperationResult;
import com.caliverse.admin.dynamodb.entity.ECurrencyType;
import com.caliverse.admin.dynamodb.entity.ELanguageType;
import com.caliverse.admin.dynamodb.repository.BannerRepository;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
import com.caliverse.admin.dynamodb.repository.BuildingRepository;
import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
@@ -34,7 +26,6 @@ import java.util.HashMap;
import java.util.Map;
import static com.caliverse.admin.global.common.utils.CommonUtils.convertUTCDate;
import static com.caliverse.admin.global.common.utils.DateUtils.stringToISODateTime;
@Component
@Slf4j
@@ -105,14 +96,9 @@ public class BannerRepositoryImpl extends BaseDynamoDBRepository<BannerDoc> impl
log.info("BannerDoc Insert Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.MENU_BANNER_ADD,
HISTORYTYPEDETAIL.MENU_BANNER_ADD.name(),
doc
);
}catch (Exception e){
log.error("insert Error: {}", e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
}
@@ -143,16 +129,10 @@ public class BannerRepositoryImpl extends BaseDynamoDBRepository<BannerDoc> impl
update(afterDoc);
log.info("BannerDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.MENU_BANNER_UPDATE,
HISTORYTYPEDETAIL.MENU_BANNER_UPDATE.name(),
beforeDoc,
afterDoc
);
}
}catch (Exception e){
log.error("Update Error: {}", e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
}
@@ -171,17 +151,12 @@ public class BannerRepositoryImpl extends BaseDynamoDBRepository<BannerDoc> impl
log.info("BannerDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.MENU_BANNER_DELETE,
HISTORYTYPEDETAIL.MENU_BANNER_DELETE.name(),
doc
);
return new DynamodbOperationResult(true, "", doc);
}
return new DynamodbOperationResult(true, "null", doc);
}catch (Exception e){
log.error("Delete Error: {}", e.getMessage());
return new DynamodbOperationResult(false, e.getMessage(), null);
}
}

View File

@@ -2,6 +2,8 @@ package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.BattleEvent;
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.entity.log.LogAction;
import com.caliverse.admin.domain.entity.log.LogStatus;
import com.caliverse.admin.domain.request.BattleEventRequest;
import com.caliverse.admin.dynamodb.domain.atrrib.BattleEventAttrib;
import com.caliverse.admin.dynamodb.domain.doc.BattleEventDoc;
@@ -119,11 +121,6 @@ public class BattleEventRepositoryImpl extends BaseDynamoDBRepository<BattleEven
save(doc);
dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.BATTLE_EVENT_ADD,
HISTORYTYPEDETAIL.BATTLE_EVENT_ADD.name(),
doc
);
}catch (Exception e){
log.error("insert Error: {}", e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
@@ -166,12 +163,6 @@ public class BattleEventRepositoryImpl extends BaseDynamoDBRepository<BattleEven
log.info("BattleEventDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE,
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE.name(),
beforeDoc,
afterDoc
);
}
}catch (Exception e){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
@@ -197,12 +188,6 @@ public class BattleEventRepositoryImpl extends BaseDynamoDBRepository<BattleEven
log.info("BattleEventDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.BATTLE_EVENT_DELETE,
HISTORYTYPEDETAIL.BATTLE_EVENT_DELETE.name(),
doc
);
return new DynamodbOperationResult(true, "", doc);
}
return new DynamodbOperationResult(true, "null", doc);
@@ -235,12 +220,6 @@ public class BattleEventRepositoryImpl extends BaseDynamoDBRepository<BattleEven
log.info("BattleEventDoc Update Stop Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE,
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE.name(),
beforeDoc,
afterDoc
);
}
}catch (Exception e){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());

View File

@@ -1,6 +1,5 @@
package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.request.LandRequest;
import com.caliverse.admin.dynamodb.domain.atrrib.BuildingAttrib;
import com.caliverse.admin.dynamodb.domain.doc.BuildingDoc;
@@ -85,14 +84,8 @@ public class BuildingRepositoryImpl extends BaseDynamoDBRepository<BuildingDoc>
log.info("BuildingDoc Insert Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD,
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD.name(),
doc
);
}catch (Exception e){
log.error("insert Error: {}", e.getMessage());
log.error("insert info: {}, Error: {}", CommonUtils.objectByString(landRequest), e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
}
@@ -126,14 +119,9 @@ public class BuildingRepositoryImpl extends BaseDynamoDBRepository<BuildingDoc>
log.info("BuildingDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
beforeDoc,
afterDoc
);
}
}catch (Exception e){
log.error("update info: {}, Error: {}", CommonUtils.objectByString(landRequest), e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
}
@@ -162,12 +150,6 @@ public class BuildingRepositoryImpl extends BaseDynamoDBRepository<BuildingDoc>
log.info("BuildingDoc Owned Init Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE,
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE.name(),
beforeDoc,
afterDoc
);
return new DynamodbOperationResult(true, "", afterDoc);
}
return new DynamodbOperationResult(false, "null", null);
@@ -205,12 +187,6 @@ public class BuildingRepositoryImpl extends BaseDynamoDBRepository<BuildingDoc>
log.info("BuildingDoc Desc Init Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.LAND_DESC_INITIALIZE,
HISTORYTYPEDETAIL.LAND_DESC_INITIALIZE.name(),
beforeDoc,
afterDoc
);
return new DynamodbOperationResult(true, "Success", afterDoc);
}
return new DynamodbOperationResult(true, "null", beforeDoc);

View File

@@ -1,8 +1,9 @@
package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.dynamodb.domain.atrrib.CaliumStorageAttrib;
import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionActivityAttrib;
import com.caliverse.admin.dynamodb.domain.doc.CaliumStorageDoc;
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionActivityDoc;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
import com.caliverse.admin.dynamodb.repository.CaliumStorageRepository;
import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
@@ -45,6 +46,19 @@ public class CaliumStorageRepositoryImpl extends BaseDynamoDBRepository<CaliumSt
return total;
}
@Override
public CaliumStorageAttrib getStorage() {
Key key = Key.builder()
.partitionValue(DynamoDBConstants.PK_KEY_CALIUM)
.sortValue(DynamoDBConstants.EMPTY)
.build();
CaliumStorageDoc doc = findById(key);
if(doc == null) return null;
return doc.getAttribValue();
}
@Override
public void updateTotal(double caliumCnt) {
try{
@@ -82,12 +96,6 @@ public class CaliumStorageRepositoryImpl extends BaseDynamoDBRepository<CaliumSt
log.info("CaliumStorageDoc Calium Total Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE,
HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE.name(),
beforeDoc,
afterDoc
);
}
}catch (Exception e){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
@@ -130,12 +138,6 @@ public class CaliumStorageRepositoryImpl extends BaseDynamoDBRepository<CaliumSt
log.info("CaliumStorageDoc Calium Total Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE,
HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE.name(),
beforeDoc,
afterDoc
);
}
}catch (Exception e){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());

View File

@@ -1,7 +1,6 @@
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.ItemAttrib;
import com.caliverse.admin.dynamodb.domain.doc.ItemDoc;
import com.caliverse.admin.dynamodb.dto.PageResult;
@@ -78,12 +77,6 @@ public class ItemRepositoryImpl extends BaseDynamoDBRepository<ItemDoc> implemen
log.info("updateItemStack Update Success: {}", CommonUtils.objectByString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.ITEM_UPDATE,
HISTORYTYPEDETAIL.ITEM_UPDATE.name(),
beforeDoc,
afterDoc
);
}
}catch (Exception e){
log.error("Update Item Error: {}", e.getMessage());
@@ -106,11 +99,6 @@ public class ItemRepositoryImpl extends BaseDynamoDBRepository<ItemDoc> implemen
log.info("ItemDoc Delete Success: {}", CommonUtils.objectByString(beforeDoc));
dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.ITEM_DELETE,
HISTORYTYPEDETAIL.ITEM_DELETE.name(),
beforeDoc
);
}
}catch (Exception e){
log.error("Update LandAuctionRegistry Error: {}", e.getMessage());

View File

@@ -72,12 +72,6 @@ public class LandAuctionActivityRepositoryImpl extends BaseDynamoDBRepository<La
log.info("LandAuctionActivityDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
doc
);
return new DynamodbOperationResult(true, "delete success", doc);
}
return new DynamodbOperationResult(true, "null", doc);
@@ -107,11 +101,6 @@ public class LandAuctionActivityRepositoryImpl extends BaseDynamoDBRepository<La
log.info("LandAuctionActivityDoc Insert Success: {}", objectMapper.writeValueAsString(activityDoc));
dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.LAND_AUCTION_ADD,
HISTORYTYPEDETAIL.LAND_AUCTION_ADD.name(),
activityDoc
);
}catch (Exception e){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
@@ -131,12 +120,6 @@ public class LandAuctionActivityRepositoryImpl extends BaseDynamoDBRepository<La
log.info("LandAuctionActivityDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.LAND_AUCTION_ADD,
HISTORYTYPEDETAIL.LAND_AUCTION_ADD.name(),
existingDoc,
afterDoc
);
}catch (Exception e){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}

View File

@@ -70,12 +70,6 @@ public class LandAuctionHighestBidUserRepositoryImpl extends BaseDynamoDBReposit
log.info("LandAuctionRegistryDoc Insert Success: {}", objectMapper.writeValueAsString(registry));
dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.LAND_AUCTION_ADD,
HISTORYTYPEDETAIL.LAND_AUCTION_ADD.name(),
registry
);
save(registry);
}catch (Exception e){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
@@ -98,11 +92,6 @@ public class LandAuctionHighestBidUserRepositoryImpl extends BaseDynamoDBReposit
log.info("LandAuctionHighestBidUserDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
doc
);
return new DynamodbOperationResult(true, "delete success", doc);
}
return new DynamodbOperationResult(true, "null", doc);

View File

@@ -1,6 +1,5 @@
package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRecordDoc;
import com.caliverse.admin.dynamodb.entity.DynamodbOperationResult;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
@@ -36,11 +35,6 @@ public class LandAuctionRecordRepositoryImpl extends BaseDynamoDBRepository<Land
log.info("LandAuctionRecordDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
doc
);
return new DynamodbOperationResult(true, "delete success", doc);
}
return new DynamodbOperationResult(true, "null", doc);

View File

@@ -1,6 +1,5 @@
package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRefundBidPriceDoc;
import com.caliverse.admin.dynamodb.entity.DynamodbOperationResult;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
@@ -38,11 +37,6 @@ public class LandAuctionRefundBidPriceRepositoryImpl extends BaseDynamoDBReposit
log.info("LandAuctionRefundBidPriceDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
doc
);
return new DynamodbOperationResult(true, "delete success", doc);
}
return new DynamodbOperationResult(true, "null", doc);

View File

@@ -95,12 +95,6 @@ public class LandAuctionRegistryRepositoryImpl extends BaseDynamoDBRepository<La
log.info("LandAuctionRegistryDoc Insert Success: {}", objectMapper.writeValueAsString(registry));
dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.LAND_AUCTION_ADD,
HISTORYTYPEDETAIL.LAND_AUCTION_ADD.name(),
registry
);
}catch (Exception e){
log.error("Insert LandAuctionRegistry Error: {}", e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
@@ -134,12 +128,6 @@ public class LandAuctionRegistryRepositoryImpl extends BaseDynamoDBRepository<La
log.info("LandAuctionRegistryDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE,
HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE.name(),
beforeDoc,
afterDoc
);
}
}catch (Exception e){
log.error("Update LandAuctionRegistry Error: {}", e.getMessage());
@@ -172,12 +160,6 @@ public class LandAuctionRegistryRepositoryImpl extends BaseDynamoDBRepository<La
log.info("LandAuctionRegistryDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE,
HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE.name(),
beforeDoc,
afterDoc
);
}
}catch (Exception e){
log.error("Cancel LandAuctionRegistry Error: {}", e.getMessage());
@@ -204,12 +186,6 @@ public class LandAuctionRegistryRepositoryImpl extends BaseDynamoDBRepository<La
log.info("LandAuctionRegistryDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
doc
);
return new DynamodbOperationResult(true, "", doc);
}
return new DynamodbOperationResult(true, "null", doc);

View File

@@ -80,12 +80,6 @@ public class LandRepositoryImpl extends BaseDynamoDBRepository<LandDoc> implemen
log.info("LandDoc Insert Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD,
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD.name(),
doc
);
}catch (Exception e){
log.error("insertLand Error: {}", e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
@@ -120,13 +114,6 @@ public class LandRepositoryImpl extends BaseDynamoDBRepository<LandDoc> implemen
update(afterDoc);
log.info("LandDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
beforeDoc,
afterDoc
);
}
}catch (Exception e){
log.error("updateLand Error: {}", e.getMessage());
@@ -159,13 +146,6 @@ public class LandRepositoryImpl extends BaseDynamoDBRepository<LandDoc> implemen
log.info("LandDoc Owned Init Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE,
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE.name(),
beforeDoc,
afterDoc
);
return new DynamodbOperationResult(true, "",afterDoc);
}
return new DynamodbOperationResult(false, "null",null);
@@ -200,12 +180,6 @@ public class LandRepositoryImpl extends BaseDynamoDBRepository<LandDoc> implemen
log.info("LandDoc Desc Init Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.LAND_DESC_INITIALIZE,
HISTORYTYPEDETAIL.LAND_DESC_INITIALIZE.name(),
beforeDoc,
afterDoc
);
return new DynamodbOperationResult(true, "Success",afterDoc);
}
return new DynamodbOperationResult(false, "null",beforeDoc);

View File

@@ -81,12 +81,6 @@ public class MailJsonRepositoryImpl extends BaseDynamoDBRepository<MailJsonDoc>
log.info("MailDoc Recv Insert Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_MAIL,
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_MAIL.name(),
doc
);
}catch (Exception e){
log.error("insert Error: {}", e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
@@ -144,12 +138,6 @@ public class MailJsonRepositoryImpl extends BaseDynamoDBRepository<MailJsonDoc>
delete(key);
log.info("MailJsonDoc Delete Success: {}", objectMapper.writeValueAsString(beforeDoc));
dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.MAIL_DELETE,
HISTORYTYPEDETAIL.MAIL_DELETE.name(),
beforeDoc
);
}
}catch (Exception e){
log.error("Delete Mail Error: {}", e.getMessage());
@@ -189,13 +177,6 @@ public class MailJsonRepositoryImpl extends BaseDynamoDBRepository<MailJsonDoc>
update(afterDoc);
log.info("MailJsonDoc Item Update Success: {}", objectMapper.writeValueAsString(beforeDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.MAIL_ITEM_DELETE,
HISTORYTYPEDETAIL.MAIL_ITEM_DELETE.name(),
beforeDoc,
afterDoc
);
}
}catch (Exception e){
log.error("Update Mail Item Error: {}", e.getMessage());

View File

@@ -82,12 +82,6 @@ public class MailRepositoryImpl extends BaseDynamoDBRepository<MailDoc> implemen
log.info("MailDoc Recv Insert Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_MAIL,
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_MAIL.name(),
doc
);
}catch (Exception e){
log.error("RECV Mail Insert Error: {}", e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_PROCESS_ERROR.getMessage());
@@ -146,11 +140,6 @@ public class MailRepositoryImpl extends BaseDynamoDBRepository<MailDoc> implemen
log.info("MailDoc Delete Success: {}", objectMapper.writeValueAsString(beforeDoc));
dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.MAIL_DELETE,
HISTORYTYPEDETAIL.MAIL_DELETE.name(),
beforeDoc
);
}
}catch (Exception e){
log.error("Delete Mail Error: {}", e.getMessage());
@@ -191,12 +180,6 @@ public class MailRepositoryImpl extends BaseDynamoDBRepository<MailDoc> implemen
log.info("MailDoc Item Update Success: {}", objectMapper.writeValueAsString(beforeDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.MAIL_ITEM_DELETE,
HISTORYTYPEDETAIL.MAIL_ITEM_DELETE.name(),
beforeDoc,
afterDoc
);
}
}catch (Exception e){
log.error("Update Mail Item Error: {}", e.getMessage());

View File

@@ -1,6 +1,5 @@
package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.dynamodb.domain.atrrib.NicknameAttrib;
import com.caliverse.admin.dynamodb.domain.doc.NicknameDoc;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
@@ -68,12 +67,6 @@ public class NicknameRepositoryImpl extends BaseDynamoDBRepository<NicknameDoc>
log.info("NicknameDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.NICKNAME_UPDATE,
HISTORYTYPEDETAIL.NICKNAME_UPDATE.name(),
beforeDoc,
afterDoc
);
}
}catch (Exception e){
log.error("Update Nickname Error: {}", e.getMessage());

View File

@@ -1,6 +1,5 @@
package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.dynamodb.domain.atrrib.OwnedBuildingAttrib;
import com.caliverse.admin.dynamodb.domain.doc.OwnedBuildingDoc;
import com.caliverse.admin.dynamodb.entity.EOwnedType;
@@ -71,12 +70,6 @@ public class OwnedBuildingRepositoryImpl extends BaseDynamoDBRepository<OwnedBui
log.info("OwnedBuildingDoc Insert Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD,
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD.name(),
doc
);
}catch (Exception e){
log.error("insert Error: {}", e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
@@ -97,11 +90,6 @@ public class OwnedBuildingRepositoryImpl extends BaseDynamoDBRepository<OwnedBui
log.info("OwnedBuildingDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
doc
);
}catch (Exception e){
log.error("delete Error: {}", e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
@@ -122,12 +110,6 @@ public class OwnedBuildingRepositoryImpl extends BaseDynamoDBRepository<OwnedBui
log.info("OwnedBuildingDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE,
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE.name(),
doc
);
return new DynamodbOperationResult(true, "", doc);
}catch (Exception e){
log.error("Init OwnedBuilding Error: {}", e.getMessage());

View File

@@ -1,6 +1,5 @@
package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.dynamodb.domain.atrrib.OwnedLandAttrib;
import com.caliverse.admin.dynamodb.domain.doc.OwnedLandDoc;
import com.caliverse.admin.dynamodb.entity.EOwnedType;
@@ -71,12 +70,6 @@ public class OwnedLandRepositoryImpl extends BaseDynamoDBRepository<OwnedLandDoc
log.info("OwnedLandDoc Insert Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD,
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD.name(),
doc
);
}catch (Exception e){
log.error("insert Error: {}", e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
@@ -97,11 +90,6 @@ public class OwnedLandRepositoryImpl extends BaseDynamoDBRepository<OwnedLandDoc
log.info("OwnedLandDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
doc
);
}catch (Exception e){
log.error("delete Error: {}", e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
@@ -122,11 +110,6 @@ public class OwnedLandRepositoryImpl extends BaseDynamoDBRepository<OwnedLandDoc
log.info("OwnedLandDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
doc
);
return new DynamodbOperationResult(true, "", doc);
}catch (Exception e){
log.error("Init OwnedLand Error: {}", e.getMessage());

View File

@@ -1,7 +1,6 @@
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;
@@ -68,12 +67,6 @@ public class QuestRepositoryImpl extends BaseDynamoDBRepository<QuestDoc> implem
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());
@@ -96,11 +89,6 @@ public class QuestRepositoryImpl extends BaseDynamoDBRepository<QuestDoc> implem
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());

View File

@@ -1,10 +1,8 @@
package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.Event;
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.entity.Message;
import com.caliverse.admin.dynamodb.domain.atrrib.SystemMetaMailAttrib;
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRegistryDoc;
import com.caliverse.admin.dynamodb.domain.doc.SystemMetaMailDoc;
import com.caliverse.admin.dynamodb.entity.DynamodbOperationResult;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
@@ -61,12 +59,6 @@ public class SystemMetaMailRepositoryImpl extends BaseDynamoDBRepository<SystemM
save(doc);
dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.EVENT_ADD,
HISTORYTYPEDETAIL.EVENT_ADD.name(),
doc
);
}catch (Exception e){
log.error("insert Error: {}", e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
@@ -92,12 +84,6 @@ public class SystemMetaMailRepositoryImpl extends BaseDynamoDBRepository<SystemM
log.info("SystemMetaMailDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.SYSTEM_META_MAIL_DELETE,
HISTORYTYPEDETAIL.SYSTEM_META_MAIL_DELETE.name(),
doc
);
return new DynamodbOperationResult(true, "", doc);
}
return new DynamodbOperationResult(true, "null", doc);

View File

@@ -1,6 +1,5 @@
package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.dynamodb.domain.atrrib.UserNicknameRegistryAttrib;
import com.caliverse.admin.dynamodb.domain.doc.UserNicknameRegistryDoc;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
@@ -106,11 +105,6 @@ public class UserNicknameRegistryRepositoryImpl extends BaseDynamoDBRepository<U
log.info("UserNicknameRegistryDoc Delete Success: {}", objectMapper.writeValueAsString(beforeDoc));
dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.NICKNAME_REGISTRY_DELETE,
HISTORYTYPEDETAIL.NICKNAME_REGISTRY_DELETE.name(),
beforeDoc
);
}
}catch (Exception e){
log.error("Delete UserNicknameRegistry Error: {}", e.getMessage());
@@ -138,11 +132,6 @@ public class UserNicknameRegistryRepositoryImpl extends BaseDynamoDBRepository<U
log.info("UserNicknameRegistryDoc Insert Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.NICKNAME_REGISTRY_ADD,
HISTORYTYPEDETAIL.NICKNAME_REGISTRY_ADD.name(),
afterDoc
);
}
}catch (Exception e){
log.error("Insert UserNicknameRegistry Error: {}", e.getMessage());

View File

@@ -3,7 +3,7 @@ package com.caliverse.admin.dynamodb.service;
import com.caliverse.admin.domain.entity.EFilterOperator;
import com.caliverse.admin.dynamodb.dto.PageResult;
import com.caliverse.admin.global.common.constants.CommonConstants;
import com.caliverse.admin.global.component.transaction.DynamoDBTransactionContext;
import com.caliverse.admin.global.component.manager.DynamoDBTransactionContext;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.code.ErrorCode;

Some files were not shown because too many files have changed in this diff Show More