Compare commits

...

18 Commits

Author SHA1 Message Date
01271cbf72 우편 칼리움 첨부 및 차감 처리
아이템 수량 타입 int > double 변경
2025-02-24 17:47:42 +09:00
1a19b21f9a 전투시스템 버그 수정 2025-02-24 17:46:52 +09:00
2b77a46ab6 전투시스템 상태 체크 스케줄 2025-02-24 17:46:28 +09:00
cdea8e1780 전투시스템 업데이트 부분 수정 2025-02-24 16:00:50 +09:00
c50a26743a 전투시스템 중지 처리 2025-02-20 11:14:41 +09:00
255c2e13c9 전투시스템 중복 시간체크
전투시스템 이벤트 아이디 dynamodb 기준관리
2025-02-18 15:54:26 +09:00
78cc70488a 메타데이터 로드 예외처리 2025-02-18 15:52:16 +09:00
f38f86f5e5 경매 종료일자 체크 제외 2025-02-18 14:15:09 +09:00
0b5c300fb1 이용자 제재 스케줄 처리 수정 2025-02-17 15:15:17 +09:00
889455a379 dynamodb nickname 추가 2025-02-15 03:57:25 +09:00
c10228f31c BuildingAttrib 수정 2025-02-15 02:23:14 +09:00
d31778293a user block 처리 수정
dynamodb UserBase 변경부분으로 교체
2025-02-15 02:21:19 +09:00
62ba0c760e dynamodb userBase 추가 2025-02-15 01:36:26 +09:00
e59b323ef7 dynamodb accountBase 관련 처리 2025-02-15 01:13:43 +09:00
2f1e2c654c object 정수 변환 수정 2025-02-14 12:02:03 +09:00
f5060e81b9 battleEvent dynamoDB 저장 처리 2025-02-13 12:28:23 +09:00
071a84f376 날짜 포맷 추가 2025-02-13 12:05:22 +09:00
702b867ee3 battleevent instance_id 추가 2025-02-13 10:48:54 +09:00
70 changed files with 2217 additions and 281 deletions

View File

@@ -23,6 +23,8 @@ private static final long serialVersionUID = 0L;
isTextByMetaData_ = 0;
itemList_ = java.util.Collections.emptyList();
guid_ = "";
isPermanentMail_ = 0;
contentsArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
}
@java.lang.Override
@@ -400,6 +402,76 @@ private static final long serialVersionUID = 0L;
}
}
public static final int ISPERMANENTMAIL_FIELD_NUMBER = 14;
private int isPermanentMail_ = 0;
/**
* <code>.BoolType isPermanentMail = 14;</code>
* @return The enum numeric value on the wire for isPermanentMail.
*/
@java.lang.Override public int getIsPermanentMailValue() {
return isPermanentMail_;
}
/**
* <code>.BoolType isPermanentMail = 14;</code>
* @return The isPermanentMail.
*/
@java.lang.Override public com.caliverse.admin.domain.RabbitMq.message.BoolType getIsPermanentMail() {
com.caliverse.admin.domain.RabbitMq.message.BoolType result = com.caliverse.admin.domain.RabbitMq.message.BoolType.forNumber(isPermanentMail_);
return result == null ? com.caliverse.admin.domain.RabbitMq.message.BoolType.UNRECOGNIZED : result;
}
public static final int CONTENTSARGUMENTS_FIELD_NUMBER = 15;
@SuppressWarnings("serial")
private com.google.protobuf.LazyStringList contentsArguments_;
/**
* <pre>
* isTextByMetaData == true <20>϶<EFBFBD> TextString.SourceString<6E><67> {index} ... <20><> <20>Ѱ<EFBFBD><D1B0>ֱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ε<EFBFBD><CEB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
* </pre>
*
* <code>repeated string contentsArguments = 15;</code>
* @return A list containing the contentsArguments.
*/
public com.google.protobuf.ProtocolStringList
getContentsArgumentsList() {
return contentsArguments_;
}
/**
* <pre>
* isTextByMetaData == true <20>϶<EFBFBD> TextString.SourceString<6E><67> {index} ... <20><> <20>Ѱ<EFBFBD><D1B0>ֱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ε<EFBFBD><CEB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
* </pre>
*
* <code>repeated string contentsArguments = 15;</code>
* @return The count of contentsArguments.
*/
public int getContentsArgumentsCount() {
return contentsArguments_.size();
}
/**
* <pre>
* isTextByMetaData == true <20>϶<EFBFBD> TextString.SourceString<6E><67> {index} ... <20><> <20>Ѱ<EFBFBD><D1B0>ֱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ε<EFBFBD><CEB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
* </pre>
*
* <code>repeated string contentsArguments = 15;</code>
* @param index The index of the element to return.
* @return The contentsArguments at the given index.
*/
public java.lang.String getContentsArguments(int index) {
return contentsArguments_.get(index);
}
/**
* <pre>
* isTextByMetaData == true <20>϶<EFBFBD> TextString.SourceString<6E><67> {index} ... <20><> <20>Ѱ<EFBFBD><D1B0>ֱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ε<EFBFBD><CEB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
* </pre>
*
* <code>repeated string contentsArguments = 15;</code>
* @param index The index of the value to return.
* @return The bytes of the contentsArguments at the given index.
*/
public com.google.protobuf.ByteString
getContentsArgumentsBytes(int index) {
return contentsArguments_.getByteString(index);
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
@@ -453,6 +525,12 @@ private static final long serialVersionUID = 0L;
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(guid_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 13, guid_);
}
if (isPermanentMail_ != com.caliverse.admin.domain.RabbitMq.message.BoolType.BoolType_None.getNumber()) {
output.writeEnum(14, isPermanentMail_);
}
for (int i = 0; i < contentsArguments_.size(); i++) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 15, contentsArguments_.getRaw(i));
}
getUnknownFields().writeTo(output);
}
@@ -509,6 +587,18 @@ private static final long serialVersionUID = 0L;
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(guid_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(13, guid_);
}
if (isPermanentMail_ != com.caliverse.admin.domain.RabbitMq.message.BoolType.BoolType_None.getNumber()) {
size += com.google.protobuf.CodedOutputStream
.computeEnumSize(14, isPermanentMail_);
}
{
int dataSize = 0;
for (int i = 0; i < contentsArguments_.size(); i++) {
dataSize += computeStringSizeNoTag(contentsArguments_.getRaw(i));
}
size += dataSize;
size += 1 * getContentsArgumentsList().size();
}
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
@@ -555,6 +645,9 @@ private static final long serialVersionUID = 0L;
.equals(other.getItemListList())) return false;
if (!getGuid()
.equals(other.getGuid())) return false;
if (isPermanentMail_ != other.isPermanentMail_) return false;
if (!getContentsArgumentsList()
.equals(other.getContentsArgumentsList())) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@@ -598,6 +691,12 @@ private static final long serialVersionUID = 0L;
}
hash = (37 * hash) + GUID_FIELD_NUMBER;
hash = (53 * hash) + getGuid().hashCode();
hash = (37 * hash) + ISPERMANENTMAIL_FIELD_NUMBER;
hash = (53 * hash) + isPermanentMail_;
if (getContentsArgumentsCount() > 0) {
hash = (37 * hash) + CONTENTSARGUMENTS_FIELD_NUMBER;
hash = (53 * hash) + getContentsArgumentsList().hashCode();
}
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
@@ -754,6 +853,9 @@ private static final long serialVersionUID = 0L;
}
bitField0_ = (bitField0_ & ~0x00000800);
guid_ = "";
isPermanentMail_ = 0;
contentsArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
bitField0_ = (bitField0_ & ~0x00004000);
return this;
}
@@ -796,6 +898,11 @@ private static final long serialVersionUID = 0L;
} else {
result.itemList_ = itemListBuilder_.build();
}
if (((bitField0_ & 0x00004000) != 0)) {
contentsArguments_ = contentsArguments_.getUnmodifiableView();
bitField0_ = (bitField0_ & ~0x00004000);
}
result.contentsArguments_ = contentsArguments_;
}
private void buildPartial0(com.caliverse.admin.domain.RabbitMq.message.MailInfo result) {
@@ -840,6 +947,9 @@ private static final long serialVersionUID = 0L;
if (((from_bitField0_ & 0x00001000) != 0)) {
result.guid_ = guid_;
}
if (((from_bitField0_ & 0x00002000) != 0)) {
result.isPermanentMail_ = isPermanentMail_;
}
}
@java.lang.Override
@@ -958,6 +1068,19 @@ private static final long serialVersionUID = 0L;
bitField0_ |= 0x00001000;
onChanged();
}
if (other.isPermanentMail_ != 0) {
setIsPermanentMailValue(other.getIsPermanentMailValue());
}
if (!other.contentsArguments_.isEmpty()) {
if (contentsArguments_.isEmpty()) {
contentsArguments_ = other.contentsArguments_;
bitField0_ = (bitField0_ & ~0x00004000);
} else {
ensureContentsArgumentsIsMutable();
contentsArguments_.addAll(other.contentsArguments_);
}
onChanged();
}
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
@@ -1061,6 +1184,17 @@ private static final long serialVersionUID = 0L;
bitField0_ |= 0x00001000;
break;
} // case 106
case 112: {
isPermanentMail_ = input.readEnum();
bitField0_ |= 0x00002000;
break;
} // case 112
case 122: {
java.lang.String s = input.readStringRequireUtf8();
ensureContentsArgumentsIsMutable();
contentsArguments_.add(s);
break;
} // case 122
default: {
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
done = true; // was an endgroup tag
@@ -2096,6 +2230,199 @@ private static final long serialVersionUID = 0L;
onChanged();
return this;
}
private int isPermanentMail_ = 0;
/**
* <code>.BoolType isPermanentMail = 14;</code>
* @return The enum numeric value on the wire for isPermanentMail.
*/
@java.lang.Override public int getIsPermanentMailValue() {
return isPermanentMail_;
}
/**
* <code>.BoolType isPermanentMail = 14;</code>
* @param value The enum numeric value on the wire for isPermanentMail to set.
* @return This builder for chaining.
*/
public Builder setIsPermanentMailValue(int value) {
isPermanentMail_ = value;
bitField0_ |= 0x00002000;
onChanged();
return this;
}
/**
* <code>.BoolType isPermanentMail = 14;</code>
* @return The isPermanentMail.
*/
@java.lang.Override
public com.caliverse.admin.domain.RabbitMq.message.BoolType getIsPermanentMail() {
com.caliverse.admin.domain.RabbitMq.message.BoolType result = com.caliverse.admin.domain.RabbitMq.message.BoolType.forNumber(isPermanentMail_);
return result == null ? com.caliverse.admin.domain.RabbitMq.message.BoolType.UNRECOGNIZED : result;
}
/**
* <code>.BoolType isPermanentMail = 14;</code>
* @param value The isPermanentMail to set.
* @return This builder for chaining.
*/
public Builder setIsPermanentMail(com.caliverse.admin.domain.RabbitMq.message.BoolType value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00002000;
isPermanentMail_ = value.getNumber();
onChanged();
return this;
}
/**
* <code>.BoolType isPermanentMail = 14;</code>
* @return This builder for chaining.
*/
public Builder clearIsPermanentMail() {
bitField0_ = (bitField0_ & ~0x00002000);
isPermanentMail_ = 0;
onChanged();
return this;
}
private com.google.protobuf.LazyStringList contentsArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
private void ensureContentsArgumentsIsMutable() {
if (!((bitField0_ & 0x00004000) != 0)) {
contentsArguments_ = new com.google.protobuf.LazyStringArrayList(contentsArguments_);
bitField0_ |= 0x00004000;
}
}
/**
* <pre>
* isTextByMetaData == true <20>϶<EFBFBD> TextString.SourceString<6E><67> {index} ... <20><> <20>Ѱ<EFBFBD><D1B0>ֱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ε<EFBFBD><CEB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
* </pre>
*
* <code>repeated string contentsArguments = 15;</code>
* @return A list containing the contentsArguments.
*/
public com.google.protobuf.ProtocolStringList
getContentsArgumentsList() {
return contentsArguments_.getUnmodifiableView();
}
/**
* <pre>
* isTextByMetaData == true <20>϶<EFBFBD> TextString.SourceString<6E><67> {index} ... <20><> <20>Ѱ<EFBFBD><D1B0>ֱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ε<EFBFBD><CEB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
* </pre>
*
* <code>repeated string contentsArguments = 15;</code>
* @return The count of contentsArguments.
*/
public int getContentsArgumentsCount() {
return contentsArguments_.size();
}
/**
* <pre>
* isTextByMetaData == true <20>϶<EFBFBD> TextString.SourceString<6E><67> {index} ... <20><> <20>Ѱ<EFBFBD><D1B0>ֱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ε<EFBFBD><CEB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
* </pre>
*
* <code>repeated string contentsArguments = 15;</code>
* @param index The index of the element to return.
* @return The contentsArguments at the given index.
*/
public java.lang.String getContentsArguments(int index) {
return contentsArguments_.get(index);
}
/**
* <pre>
* isTextByMetaData == true <20>϶<EFBFBD> TextString.SourceString<6E><67> {index} ... <20><> <20>Ѱ<EFBFBD><D1B0>ֱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ε<EFBFBD><CEB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
* </pre>
*
* <code>repeated string contentsArguments = 15;</code>
* @param index The index of the value to return.
* @return The bytes of the contentsArguments at the given index.
*/
public com.google.protobuf.ByteString
getContentsArgumentsBytes(int index) {
return contentsArguments_.getByteString(index);
}
/**
* <pre>
* isTextByMetaData == true <20>϶<EFBFBD> TextString.SourceString<6E><67> {index} ... <20><> <20>Ѱ<EFBFBD><D1B0>ֱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ε<EFBFBD><CEB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
* </pre>
*
* <code>repeated string contentsArguments = 15;</code>
* @param index The index to set the value at.
* @param value The contentsArguments to set.
* @return This builder for chaining.
*/
public Builder setContentsArguments(
int index, java.lang.String value) {
if (value == null) { throw new NullPointerException(); }
ensureContentsArgumentsIsMutable();
contentsArguments_.set(index, value);
onChanged();
return this;
}
/**
* <pre>
* isTextByMetaData == true <20>϶<EFBFBD> TextString.SourceString<6E><67> {index} ... <20><> <20>Ѱ<EFBFBD><D1B0>ֱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ε<EFBFBD><CEB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
* </pre>
*
* <code>repeated string contentsArguments = 15;</code>
* @param value The contentsArguments to add.
* @return This builder for chaining.
*/
public Builder addContentsArguments(
java.lang.String value) {
if (value == null) { throw new NullPointerException(); }
ensureContentsArgumentsIsMutable();
contentsArguments_.add(value);
onChanged();
return this;
}
/**
* <pre>
* isTextByMetaData == true <20>϶<EFBFBD> TextString.SourceString<6E><67> {index} ... <20><> <20>Ѱ<EFBFBD><D1B0>ֱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ε<EFBFBD><CEB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
* </pre>
*
* <code>repeated string contentsArguments = 15;</code>
* @param values The contentsArguments to add.
* @return This builder for chaining.
*/
public Builder addAllContentsArguments(
java.lang.Iterable<java.lang.String> values) {
ensureContentsArgumentsIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, contentsArguments_);
onChanged();
return this;
}
/**
* <pre>
* isTextByMetaData == true <20>϶<EFBFBD> TextString.SourceString<6E><67> {index} ... <20><> <20>Ѱ<EFBFBD><D1B0>ֱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ε<EFBFBD><CEB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
* </pre>
*
* <code>repeated string contentsArguments = 15;</code>
* @return This builder for chaining.
*/
public Builder clearContentsArguments() {
contentsArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
bitField0_ = (bitField0_ & ~0x00004000);
onChanged();
return this;
}
/**
* <pre>
* isTextByMetaData == true <20>϶<EFBFBD> TextString.SourceString<6E><67> {index} ... <20><> <20>Ѱ<EFBFBD><D1B0>ֱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ε<EFBFBD><CEB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
* </pre>
*
* <code>repeated string contentsArguments = 15;</code>
* @param value The bytes of the contentsArguments to add.
* @return This builder for chaining.
*/
public Builder addContentsArgumentsBytes(
com.google.protobuf.ByteString value) {
if (value == null) { throw new NullPointerException(); }
checkByteStringIsUtf8(value);
ensureContentsArgumentsIsMutable();
contentsArguments_.add(value);
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {

View File

@@ -155,4 +155,56 @@ public interface MailInfoOrBuilder extends
*/
com.google.protobuf.ByteString
getGuidBytes();
/**
* <code>.BoolType isPermanentMail = 14;</code>
* @return The enum numeric value on the wire for isPermanentMail.
*/
int getIsPermanentMailValue();
/**
* <code>.BoolType isPermanentMail = 14;</code>
* @return The isPermanentMail.
*/
com.caliverse.admin.domain.RabbitMq.message.BoolType getIsPermanentMail();
/**
* <pre>
* isTextByMetaData == true <20>϶<EFBFBD> TextString.SourceString<6E><67> {index} ... <20><> <20>Ѱ<EFBFBD><D1B0>ֱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ε<EFBFBD><CEB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
* </pre>
*
* <code>repeated string contentsArguments = 15;</code>
* @return A list containing the contentsArguments.
*/
java.util.List<java.lang.String>
getContentsArgumentsList();
/**
* <pre>
* isTextByMetaData == true <20>϶<EFBFBD> TextString.SourceString<6E><67> {index} ... <20><> <20>Ѱ<EFBFBD><D1B0>ֱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ε<EFBFBD><CEB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
* </pre>
*
* <code>repeated string contentsArguments = 15;</code>
* @return The count of contentsArguments.
*/
int getContentsArgumentsCount();
/**
* <pre>
* isTextByMetaData == true <20>϶<EFBFBD> TextString.SourceString<6E><67> {index} ... <20><> <20>Ѱ<EFBFBD><D1B0>ֱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ε<EFBFBD><CEB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
* </pre>
*
* <code>repeated string contentsArguments = 15;</code>
* @param index The index of the element to return.
* @return The contentsArguments at the given index.
*/
java.lang.String getContentsArguments(int index);
/**
* <pre>
* isTextByMetaData == true <20>϶<EFBFBD> TextString.SourceString<6E><67> {index} ... <20><> <20>Ѱ<EFBFBD><D1B0>ֱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ε<EFBFBD><CEB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
* </pre>
*
* <code>repeated string contentsArguments = 15;</code>
* @param index The index of the value to return.
* @return The bytes of the contentsArguments at the given index.
*/
com.google.protobuf.ByteString
getContentsArgumentsBytes(int index);
}

View File

@@ -55,13 +55,13 @@ private static final long serialVersionUID = 0L;
}
public static final int COUNT_FIELD_NUMBER = 2;
private int count_ = 0;
private double count_ = 0D;
/**
* <code>int32 count = 2;</code>
* <code>double count = 2;</code>
* @return The count.
*/
@java.lang.Override
public int getCount() {
public double getCount() {
return count_;
}
@@ -82,8 +82,8 @@ private static final long serialVersionUID = 0L;
if (itemId_ != 0) {
output.writeInt32(1, itemId_);
}
if (count_ != 0) {
output.writeInt32(2, count_);
if (java.lang.Double.doubleToRawLongBits(count_) != 0) {
output.writeDouble(2, count_);
}
getUnknownFields().writeTo(output);
}
@@ -98,9 +98,9 @@ private static final long serialVersionUID = 0L;
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(1, itemId_);
}
if (count_ != 0) {
if (java.lang.Double.doubleToRawLongBits(count_) != 0) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(2, count_);
.computeDoubleSize(2, count_);
}
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
@@ -119,8 +119,9 @@ private static final long serialVersionUID = 0L;
if (getItemId()
!= other.getItemId()) return false;
if (getCount()
!= other.getCount()) return false;
if (java.lang.Double.doubleToLongBits(getCount())
!= java.lang.Double.doubleToLongBits(
other.getCount())) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@@ -135,7 +136,8 @@ private static final long serialVersionUID = 0L;
hash = (37 * hash) + ITEMID_FIELD_NUMBER;
hash = (53 * hash) + getItemId();
hash = (37 * hash) + COUNT_FIELD_NUMBER;
hash = (53 * hash) + getCount();
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
java.lang.Double.doubleToLongBits(getCount()));
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
@@ -266,7 +268,7 @@ private static final long serialVersionUID = 0L;
super.clear();
bitField0_ = 0;
itemId_ = 0;
count_ = 0;
count_ = 0D;
return this;
}
@@ -355,7 +357,7 @@ private static final long serialVersionUID = 0L;
if (other.getItemId() != 0) {
setItemId(other.getItemId());
}
if (other.getCount() != 0) {
if (other.getCount() != 0D) {
setCount(other.getCount());
}
this.mergeUnknownFields(other.getUnknownFields());
@@ -389,11 +391,11 @@ private static final long serialVersionUID = 0L;
bitField0_ |= 0x00000001;
break;
} // case 8
case 16: {
count_ = input.readInt32();
case 17: {
count_ = input.readDouble();
bitField0_ |= 0x00000002;
break;
} // case 16
} // case 17
default: {
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
done = true; // was an endgroup tag
@@ -443,21 +445,21 @@ private static final long serialVersionUID = 0L;
return this;
}
private int count_ ;
private double count_ ;
/**
* <code>int32 count = 2;</code>
* <code>double count = 2;</code>
* @return The count.
*/
@java.lang.Override
public int getCount() {
public double getCount() {
return count_;
}
/**
* <code>int32 count = 2;</code>
* <code>double count = 2;</code>
* @param value The count to set.
* @return This builder for chaining.
*/
public Builder setCount(int value) {
public Builder setCount(double value) {
count_ = value;
bitField0_ |= 0x00000002;
@@ -465,12 +467,12 @@ private static final long serialVersionUID = 0L;
return this;
}
/**
* <code>int32 count = 2;</code>
* <code>double count = 2;</code>
* @return This builder for chaining.
*/
public Builder clearCount() {
bitField0_ = (bitField0_ & ~0x00000002);
count_ = 0;
count_ = 0D;
onChanged();
return this;
}

View File

@@ -14,8 +14,8 @@ public interface MailItemOrBuilder extends
int getItemId();
/**
* <code>int32 count = 2;</code>
* <code>double count = 2;</code>
* @return The count.
*/
int getCount();
double getCount();
}

View File

@@ -52,6 +52,13 @@ public class BattleController {
return ResponseEntity.ok().body(battleEventService.updateBattleEvent(id, battleEventRequest));
}
@PutMapping("/event/stop/{id}")
public ResponseEntity<BattleEventResponse> updateStopBattleEvent(
@PathVariable("id")Long id){
return ResponseEntity.ok().body(battleEventService.updateStopBattleEvent(id));
}
@DeleteMapping("/event/delete")
public ResponseEntity<BattleEventResponse> deleteBattleEvent(

View File

@@ -30,6 +30,7 @@ import lombok.RequiredArgsConstructor;
public class MailController {
private final MailService mailService;
// 우편 조회
@GetMapping("/list")
public ResponseEntity<MailResponse> getList(
@@ -83,4 +84,10 @@ public class MailController {
@RequestBody Map<String, String> item) {
return ResponseEntity.ok().body(mailService.getMetaItem(item.get("item")));
}
// 칼리움 수량 조회
@GetMapping("/calium")
public ResponseEntity<MailResponse> getCalium(){
return ResponseEntity.ok().body(mailService.getStockCalium());
}
}

View File

@@ -22,5 +22,6 @@ public interface BattleMapper {
int updateStatusBattleEvent(Map map);
List<BattleEvent> getCheckBattleEventList(BattleEventRequest battleEventRequest);
List<BattleEvent> getScheduleBattleEventList();
}

View File

@@ -35,7 +35,8 @@ public class JsonFileReader {
log.info("loadDataFromJsonFile path: {}", file.getPath());
if (!file.exists()) {
throw new MetaDataException("File not found: " + fileName);
log.error("File not found: {}", fileName);
return null;
}
String fileContent = readFileAsString(file);

View File

@@ -167,6 +167,10 @@ public class MetaDataFileLoader {
EMetaData.TEXT_STRING_DATA.getFileName(),
MetadataConstants.JSON_LIST_TEXT_STRING
);
if(metaList == null || metaList.isEmpty()) {
log.warn("textStrings data is empty or file not found: {}", EMetaData.TOOL_DATA.getFileName());
return;
}
metaList.forEach(meta -> {
MetaTextStringData textString = new MetaTextStringData();
@@ -183,6 +187,10 @@ public class MetaDataFileLoader {
// 아이템 정보 데이터 로드
public void loadItems(){
List<Map<String, Object>> metaList = jsonFileReader.readJsonFile(EMetaData.ITEM_DATA.getFileName(), MetadataConstants.JSON_LIST_ITEM);
if(metaList == null || metaList.isEmpty()) {
log.warn("item data is empty or file not found: {}", EMetaData.TOOL_DATA.getFileName());
return;
}
metaList.forEach(meta -> {
MetaItemData item = new MetaItemData();
@@ -200,6 +208,10 @@ public class MetaDataFileLoader {
// 의상 타입 데이터 로드
public void loadClothType(){
List<Map<String, Object>> metaList = jsonFileReader.readJsonFile(EMetaData.CLOTH_TYPE_DATA.getFileName(), MetadataConstants.JSON_LIST_CLOTH_TYPE);
if(metaList == null || metaList.isEmpty()) {
log.warn("clothType data is empty or file not found: {}", EMetaData.TOOL_DATA.getFileName());
return;
}
metaList.forEach(meta -> {
MetaClothTypeData item = new MetaClothTypeData();
@@ -215,6 +227,10 @@ public class MetaDataFileLoader {
// 도구 정보 데이터 로드
public void loadToolItems(){
List<Map<String, Object>> metaList = jsonFileReader.readJsonFile(EMetaData.TOOL_DATA.getFileName(), MetadataConstants.JSON_LIST_TOOL);
if(metaList == null || metaList.isEmpty()) {
log.warn("tool data is empty or file not found: {}", EMetaData.TOOL_DATA.getFileName());
return;
}
metaList.forEach(meta -> {
MetaToolData item = new MetaToolData();
@@ -229,6 +245,10 @@ public class MetaDataFileLoader {
// 금지어 데이터 로드
public void loadBanWord(){
List<Map<String, Object>> metaList = jsonFileReader.readJsonFile(EMetaData.BAN_WORD_DATA.getFileName(), MetadataConstants.JSON_LIST_BAN_WORD);
if(metaList == null || metaList.isEmpty()) {
log.warn("ban data is empty or file not found: {}", EMetaData.BAN_WORD_DATA.getFileName());
return;
}
metaList.forEach(meta -> {
banWords.put((Integer)meta.get("Id"), (String)meta.get("Ban_Word"));
@@ -240,6 +260,10 @@ public class MetaDataFileLoader {
// 퀘스트 데이터 로드
public void loadQuests(){
List<Map<String, Object>> metaList = jsonFileReader.readJsonFile(EMetaData.QUEST_DATA.getFileName(), MetadataConstants.JSON_LIST_QUEST);
if(metaList == null || metaList.isEmpty()) {
log.warn("quest data is empty or file not found: {}", EMetaData.QUEST_DATA.getFileName());
return;
}
metaList.forEach(meta -> {
MetaQuestData item = new MetaQuestData();
@@ -258,6 +282,10 @@ public class MetaDataFileLoader {
// 빌딩 데이터 로드
public void loadBuilding(){
List<Map<String, Object>> metaList = jsonFileReader.readJsonFile(EMetaData.BUILDING_DATA.getFileName(), MetadataConstants.JSON_LIST_BUILDING);
if(metaList == null || metaList.isEmpty()) {
log.warn("building data is empty or file not found: {}", EMetaData.BUILDING_DATA.getFileName());
return;
}
metaList.forEach(meta -> {
String building_name = (String)meta.get("BuildingName");
@@ -280,6 +308,10 @@ public class MetaDataFileLoader {
// 랜드 데이터 로드
public void loadLand(){
List<Map<String, Object>> metaList = jsonFileReader.readJsonFile(EMetaData.LAND_DATA.getFileName(), MetadataConstants.JSON_LIST_LAND);
if(metaList == null || metaList.isEmpty()) {
log.warn("land data is empty or file not found: {}", EMetaData.LAND_DATA.getFileName());
return;
}
metaList.forEach(meta -> {
String land_name = (String)meta.get("LandName");
@@ -304,11 +336,15 @@ public class MetaDataFileLoader {
// 전투 설정 데이터 로드
public void loadBattleConfig(){
List<Map<String, Object>> metaList = jsonFileReader.readJsonFile(EMetaData.BATTLE_CONFIG_DATA.getFileName(), MetadataConstants.JSON_LIST_BATTLE_CONFIG);
if(metaList == null || metaList.isEmpty()) {
log.warn("Battle config data is empty or file not found: {}", EMetaData.BATTLE_CONFIG_DATA.getFileName());
return;
}
metaList.forEach(meta -> {
MetaBattleConfigData item = new MetaBattleConfigData();
item.setId((Integer)meta.get("Id"));
item.setDesc((String)meta.get("_Desc"));
item.setDesc((String)meta.get("Description"));
item.setPlayerRespawnTime((Integer)meta.get("PlayerRespawnTime"));
item.setDefaultRoundCount((Integer)meta.get("DefaultRoundCount"));
item.setRoundTime((Integer)meta.get("RoundTime"));
@@ -324,11 +360,15 @@ public class MetaDataFileLoader {
// 전투 보상 데이터 로드
public void loadBattleReward(){
List<Map<String, Object>> metaList = jsonFileReader.readJsonFile(EMetaData.BATTLE_REWARD_DATA.getFileName(), MetadataConstants.JSON_LIST_BATTLE_REWARD);
if(metaList == null || metaList.isEmpty()) {
log.warn("Battle reward data is empty or file not found: {}", EMetaData.BATTLE_REWARD_DATA.getFileName());
return;
}
metaList.forEach(meta -> {
MetaBattleRewardData item = new MetaBattleRewardData();
item.setId((Integer)meta.get("Id"));
item.setDesc((String)meta.get("_Desc"));
item.setDesc((String)meta.get("Description"));
item.setGroupID((Integer)meta.get("GroupID"));
item.setChargeLevel((Integer)meta.get("ChargeLevel"));
item.setChargeTime((Integer)meta.get("ChargeTime"));

View File

@@ -20,6 +20,8 @@ public class BattleEvent {
private Integer rowNum;
@JsonProperty("group_id")
private String groupId;
@JsonProperty("event_id")
private Integer eventId;
@JsonProperty("event_name")
private String eventName;
@JsonProperty("repeat_type")
@@ -47,6 +49,8 @@ public class BattleEvent {
private Integer configId;
@JsonProperty("reward_group_id")
private Integer rewardGroupId;
@JsonProperty("instance_id")
private Integer instanceId;
private boolean deleted;
@@ -62,9 +66,10 @@ public class BattleEvent {
public enum BATTLE_STATUS {
WAIT,
REGISTER,
CANCEL,
STOP,
END,
FAIL,
CANCEL,
RUNNING
;
}

View File

@@ -47,8 +47,8 @@ public class BlackList {
public enum STATUSTYPE {
WAIT,
EXPIRATION,
INPROGRESS,
EXPIRATION, // 제재 종료
INPROGRESS, // 제재 중
FAIL
;
}

View File

@@ -22,6 +22,7 @@ public enum HISTORYTYPE {
MAIL_ITEM_DELETE("우편 아이템 삭제"),
MAIL_ITEM_UPDATE("우편 아이템 수정"),
WHITELIST_DELETE("화이트리스트 삭제"),
BLACKLIST_UPDATE("유저 제재 수정"),
BLACKLIST_DELETE("유저 제재 삭제"),
REPORT_DELETE("신고내역 삭제"),
USER_ITEM_DELETE("유저 아이템 삭제"),

View File

@@ -17,5 +17,5 @@ public class Item {
@JsonProperty("item_name")
private String itemName;
@JsonProperty("item_cnt")
private Integer itemCnt;
private Double itemCnt;
}

View File

@@ -1,23 +1,10 @@
package com.caliverse.admin.domain.entity;
import java.util.Arrays;
import java.util.List;
public enum LANGUAGETYPE {
NONE,
KO, // 한국어(기본값)
EN, // 영어
TH, // 태국
//LanguageType_zh, // 중국어
JA, // 일본어
//LanguageType_fr, // 프랑스어
//LanguageType_de, // 독일어
//LanguageType_es, // 스페인어
//LanguageType_ru, // 러시아어
//LanguageType_ar // 아랍어
JA // 일본어
;
public static List<LANGUAGETYPE> getAllLanguages() {
return Arrays.asList(LANGUAGETYPE.values());
}
}

View File

@@ -1,18 +0,0 @@
package com.caliverse.admin.domain.entity;
import java.util.Arrays;
import java.util.List;
public enum Language {
All,
Ko,
En,
Ja,
;
public static List<Language> getAllLanguages() {
return Arrays.asList(Language.values());
}
}

View File

@@ -1,9 +0,0 @@
package com.caliverse.admin.domain.entity.common;
public enum EAccountType {
None,
Google,
Apple
;
}

View File

@@ -0,0 +1,8 @@
package com.caliverse.admin.domain.entity.common;
import com.fasterxml.jackson.annotation.JsonValue;
public interface ValueEnum {
@JsonValue
int getValue();
}

View File

@@ -20,6 +20,8 @@ public class BattleEventRequest {
private Long id;
@JsonProperty("group_id")
private String groupId;
@JsonProperty("event_id")
private Integer eventId;
@JsonProperty("event_name")
private String eventName;
@JsonProperty("repeat_type")
@@ -47,6 +49,8 @@ public class BattleEventRequest {
private Integer configId;
@JsonProperty("reward_group_id")
private Integer rewardGroupId;
@JsonProperty("instance_id")
private Integer instanceId;
@JsonProperty("create_by")
private Long createBy;

View File

@@ -74,7 +74,7 @@ public class MailRequest {
@JsonProperty("item_id")
private Long itemId;
@JsonProperty("parrent_count")
private Integer parrentCount;
private Integer count;
private Double parrentCount;
private Double count;
}
}

View File

@@ -45,6 +45,9 @@ public class MailResponse {
@JsonProperty("page_no")
private int pageNo;
@JsonProperty("stock_calium")
private double stockCalium;
@JsonProperty("item_info")
private Item itemInfo;
}

View File

@@ -264,7 +264,7 @@ public class UsersResponse {
private Long itemId;
@JsonProperty("item_name")
private String itemName;
private Integer count;
private Double count;
private Integer level;
private Integer slot;
}
@@ -273,7 +273,7 @@ public class UsersResponse {
public static class Item{
@JsonProperty("item_id")
private String itemId;
private Integer count;
private Double count;
@JsonProperty("item_name")
private String itemName;
@JsonProperty("item_guid")
@@ -392,7 +392,7 @@ public class UsersResponse {
private String itemId;
@JsonProperty("item_name")
private String itemName;
private int count;
private double count;
}
}

View File

@@ -4,11 +4,11 @@ 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.HISTORYTYPE;
import com.caliverse.admin.domain.entity.LandAuction;
import com.caliverse.admin.domain.entity.metadata.MetaBattleConfigData;
import com.caliverse.admin.domain.entity.metadata.MetaBattleRewardData;
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.code.ErrorCode;
import com.caliverse.admin.global.common.code.SuccessCode;
@@ -25,8 +25,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -37,6 +35,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
@Slf4j
public class BattleEventService {
private final DynamodbBattleEventService dynamodbBattleEventService;
private final BattleMapper battleMapper;
private final MetaDataHandler metaDataHandler;
private final HistoryService historyService;
@@ -117,17 +117,32 @@ public class BattleEventService {
LocalDateTime end_dt = start_dt.plusHours(12);
battleEventRequest.setEventEndDt(end_dt);
}
battleEventRequest.setInstanceId(CommonConstants.BATTLE_INSTANCE_ID); //고정값으로 넣고 추후 맵정보가 늘어나면 선택하는 걸로
int operation_time = calcEndTime(battleEventRequest);
battleEventRequest.setEventOperationTime(operation_time);
// int is_time = battleMapper.chkTimeOver(battleEventRequest);
// if(is_time > 0){
// return BattleEventResponse.builder()
// .status(CommonCode.ERROR.getHttpStatus())
// .result(ErrorCode.ERROR_BATTLE_EVENT_TIME_OVER.toString())
// .build();
// }
List<BattleEvent> existingList = battleMapper.getCheckBattleEventList(battleEventRequest);
boolean isTime = isTimeOverlapping(existingList, battleEventRequest);
if(isTime){
return BattleEventResponse.builder()
.status(CommonCode.ERROR.getHttpStatus())
.result(ErrorCode.ERROR_BATTLE_EVENT_TIME_OVER.toString())
.build();
}
// 일자만 필요해서 UTC시간으로 변경되다보니 한국시간(+9)을 더해서 마지막시간으로 설정
LocalDateTime end_dt_kst = battleEventRequest.getEventEndDt()
.plusHours(9)
.withHour(23)
.withMinute(59)
.withSecond(59)
.withNano(0);
battleEventRequest.setEventEndDt(end_dt_kst);
int next_event_id = dynamodbBattleEventService.getEventId() + 1;
battleEventRequest.setEventId(next_event_id);
int result = battleMapper.postBattleEvent(battleEventRequest);
log.info("AdminToolDB BattleEvent Save: {}", battleEventRequest);
@@ -148,7 +163,7 @@ public class BattleEventService {
CommonUtils.getClientIp()
);
// dynamodbLandAuctionService.insertLandAuctionRegistryWithActivity(landRequest);
dynamodbBattleEventService.insertBattleEvent(battleEventRequest);
return BattleEventResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())
@@ -167,13 +182,34 @@ public class BattleEventService {
BattleEvent before_info = battleMapper.getBattleEventDetail(id);
if(!before_info.getStatus().equals(LandAuction.AUCTION_STATUS.WAIT) && !before_info.getStatus().equals(LandAuction.AUCTION_STATUS.RESV_START)){
if(!before_info.getStatus().equals(BattleEvent.BATTLE_STATUS.STOP)){
return BattleEventResponse.builder()
.status(CommonCode.ERROR.getHttpStatus())
.result(ErrorCode.ERROR_AUCTION_STATUS_IMPOSSIBLE.toString())
.result(ErrorCode.ERROR_BATTLE_EVENT_STATUS_IMPOSSIBLE.toString())
.build();
}
List<BattleEvent> existingList = battleMapper.getCheckBattleEventList(battleEventRequest);
boolean isTime = isTimeOverlapping(existingList, battleEventRequest);
if(isTime){
return BattleEventResponse.builder()
.status(CommonCode.ERROR.getHttpStatus())
.result(ErrorCode.ERROR_BATTLE_EVENT_TIME_OVER.toString())
.build();
}
int operation_time = calcEndTime(battleEventRequest);
battleEventRequest.setEventOperationTime(operation_time);
// 일자만 필요해서 UTC시간으로 변경되다보니 한국시간(+9)을 더해서 마지막시간으로 설정
LocalDateTime end_dt_kst = battleEventRequest.getEventEndDt()
.plusHours(9)
.withHour(23)
.withMinute(59)
.withSecond(59)
.withNano(0);
battleEventRequest.setEventEndDt(end_dt_kst);
int result = battleMapper.updateBattleEvent(battleEventRequest);
log.info("AdminToolDB BattleEvent Update Complete: {}", battleEventRequest);
@@ -192,7 +228,50 @@ public class BattleEventService {
CommonUtils.getClientIp()
);
// dynamodbLandAuctionService.updateLandAuction(landRequest);
dynamodbBattleEventService.updateBattleEvent(battleEventRequest);
return BattleEventResponse.builder()
.resultData(BattleEventResponse.ResultData.builder()
.build())
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.build();
}
@Transactional(transactionManager = "transactionManager")
public BattleEventResponse updateStopBattleEvent(Long id){
Map<String,Object> map = new HashMap<>();
BattleEvent info = battleMapper.getBattleEventDetail(id);
if(info.getStatus().equals(BattleEvent.BATTLE_STATUS.RUNNING)){
return BattleEventResponse.builder()
.status(CommonCode.ERROR.getHttpStatus())
.result(ErrorCode.ERROR_BATTLE_EVENT_STATUS_START_IMPOSSIBLE.toString())
.build();
}
map.put("id", id);
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(
HISTORYTYPE.BATTLE_EVENT_UPDATE,
MysqlConstants.TABLE_NAME_BATTLE_EVENT,
HISTORYTYPE.BATTLE_EVENT_UPDATE.name(),
info,
battleMapper.getBattleEventDetail(id),
CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp()
);
dynamodbBattleEventService.updateStopBattleEvent(info);
return BattleEventResponse.builder()
.resultData(BattleEventResponse.ResultData.builder()
@@ -212,7 +291,7 @@ public class BattleEventService {
Long id = item.getId();
BattleEvent info = battleMapper.getBattleEventDetail(id);
if(!info.getStatus().equals(LandAuction.AUCTION_STATUS.WAIT) && !info.getStatus().equals(LandAuction.AUCTION_STATUS.RESV_START)){
if(!info.getStatus().equals(BattleEvent.BATTLE_STATUS.STOP)){
is_falil.set(true);
return;
}
@@ -280,6 +359,18 @@ public class BattleEventService {
int total_time = round_time + ((round_count - 1) * (round_time + round_wait_time)) + result_wait_time + server_wait_time;
return total_time;
return total_time; // 초
}
private boolean isTimeOverlapping(List<BattleEvent> existingList, BattleEventRequest battleEventRequest){
LocalTime newStartTime = battleEventRequest.getEventStartDt().toLocalTime();
LocalTime newEndTime = newStartTime.plusSeconds(battleEventRequest.getEventOperationTime());
return existingList.stream().anyMatch(schedule -> {
LocalTime existingStartTime = schedule.getEventStartDt().toLocalTime();
LocalTime existingEndTime = existingStartTime.plusSeconds(schedule.getEventOperationTime());
return !existingStartTime.isAfter(newEndTime) && !newStartTime.isAfter(existingEndTime);
});
}
}

View File

@@ -6,6 +6,7 @@ import com.caliverse.admin.domain.entity.BlackList;
import com.caliverse.admin.domain.entity.HISTORYTYPE;
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.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.code.SuccessCode;
@@ -37,6 +38,7 @@ public class BlackListService {
private final HistoryMapper historyMapper;
private final HistoryService historyService;
private final DynamoDBService dynamoDBService;
private final DynamodbUserService dynamodbUserService;
@Value("${caliverse.file}")
private String excelPath;
private final ResourceLoader resourceLoader;
@@ -96,7 +98,7 @@ public class BlackListService {
BlackList blackList = new BlackList();
blackList.setGuid(item);
//gameDB에서 닉네임, isWhiteUser, isBlackUser 조회
String nickName = dynamoDBService.getGuidByName(item);
String nickName = dynamodbUserService.getGuidByName(item);
if(nickName != ""){
blackList.setNickname(nickName);
}
@@ -104,7 +106,8 @@ public class BlackListService {
//adminDB 에 데이터 있는지 체크
int cnt = blackListMapper.getCountByGuid(item);
//gameDB isWhiteUser 값 체크
boolean isBlackUser = dynamoDBService.isWhiteOrBlackUser(item);
// boolean isBlackUser = dynamoDBService.isWhiteOrBlackUser(item);
boolean isBlackUser = dynamodbUserService.isBlockUser(item);
boolean isGuid = dynamoDBService.isGuidChecked(item);
// //guid 검증
@@ -157,7 +160,8 @@ public class BlackListService {
if(dynamoDBService.isGuidChecked(guid)){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.GUID_CHECK.getMessage());
}
boolean isBlackUser = dynamoDBService.isWhiteOrBlackUser(guid);
// boolean isBlackUser = dynamoDBService.isWhiteOrBlackUser(guid);
boolean isBlackUser = dynamodbUserService.isBlockUser(guid);
if(isBlackUser){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_EXIT_ERROR.getMessage());
}
@@ -181,12 +185,13 @@ public class BlackListService {
if(dynamoDBService.isGuidChecked(item.getGuid())){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.GUID_CHECK.getMessage());
}
boolean isBlackUser = dynamoDBService.isWhiteOrBlackUser(item.getGuid());
// boolean isBlackUser = dynamoDBService.isWhiteOrBlackUser(item.getGuid());
boolean isBlackUser = dynamodbUserService.isBlockUser(item.getGuid());
if(isBlackUser){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_EXIT_ERROR.getMessage());
}
blackListRequest.setGuid(item.getGuid());
blackListRequest.setNickname(dynamoDBService.getGuidByName(item.getGuid()));
blackListRequest.setNickname(dynamodbUserService.getGuidByName(item.getGuid()));
blackListMapper.postBlackList(blackListRequest);
logger.info("postBlackList insertBlackList: {}",blackListRequest);
}
@@ -221,14 +226,14 @@ public class BlackListService {
JSONObject jsonObject = new JSONObject();
jsonObject.put("guid",blackList.getGuid());
jsonObject.put("name","");
//todo 닉네임을 dynamoDB에서 조회해와야 됨
map.put("content",jsonObject.toString());
historyMapper.saveLog(map);
//dynamoDB char# 테이블에 isBlackUser : false 값을 insert
// dynamoDBService.insertUpdateData(blackList.getGuid(),"isBlackUser", false);
logger.info("deleteBlackList delete: {}",map);
if(blackList.getStatus().equals(BlackList.STATUSTYPE.INPROGRESS))
dynamoDBService.updateBlockUserEnd(blackList.getGuid());
dynamodbUserService.updateBlockUser(BlackList.STATUSTYPE.EXPIRATION, blackList);
}
);
@@ -256,11 +261,12 @@ public class BlackListService {
return blackListMapper.getScheduleBlackList();
}
public void updateScheduleBlockUser(BlackList blockUser, String type){
if(type.equals("start")){
dynamoDBService.updateBlockUserStart(blockUser);
}else{
dynamoDBService.updateBlockUserEnd(blockUser.getGuid());
}
public void updateScheduleBlockUser(BlackList blockUser, BlackList.STATUSTYPE status){
// if(status.equals(BlackList.STATUSTYPE.INPROGRESS)){
// dynamoDBService.updateBlockUserStart(blockUser);
// }else{
// dynamoDBService.updateBlockUserEnd(blockUser.getGuid());
// }
dynamodbUserService.updateBlockUser(status, blockUser);
}
}

View File

@@ -1362,7 +1362,7 @@ public class DynamoDBService {
UsersResponse.Item inventory = UsersResponse.Item.builder()
.itemId(CommonUtils.objectToString(item_id))
.itemName(item_nm)
.count(CommonUtils.objectToInteger(attrMap.get("item_stack_count")))
.count(CommonUtils.objectToDouble(attrMap.get("item_stack_count")))
.itemGuid(CommonUtils.objectToString(attrMap.get("item_guid")))
.build();
@@ -1415,7 +1415,7 @@ public class DynamoDBService {
for (Map<String,Object> val : (List<Map<String,Object>>)attrMap.get("item_list")){
UsersResponse.MailItem item = new UsersResponse.MailItem();
item.setItemId(CommonUtils.objectToString(val.get("ItemId")));
item.setCount(CommonUtils.objectToInteger(val.get("Count")));
item.setCount(CommonUtils.objectToDouble(val.get("Count")));
String item_nm = metaDataHandler.getMetaItemNameData(CommonUtils.objectToInteger(val.get("ItemId")));
item.setItemName(metaDataHandler.getTextStringData(item_nm));
itemList.add(item);
@@ -1485,7 +1485,7 @@ public class DynamoDBService {
}
// 유저 조회 - 우편 아이템 삭제
public JSONObject updateMailItem(String type, String guid, String mail_guid, Long itemId, int count, int newCount) {
public JSONObject updateMailItem(String type, String guid, String mail_guid, Long itemId, double count, double newCount) {
try {
Map<String, AttributeValue> item = null;
Map<String, AttributeValue> key = new HashMap<>();
@@ -1871,7 +1871,7 @@ public class DynamoDBService {
UsersResponse.Item item = UsersResponse.Item.builder()
.itemId(item_id)
.itemName(metaDataHandler.getTextStringData(item_name))
.count(CommonUtils.objectToInteger(attrMap2.get("item_stack_count")))
.count(CommonUtils.objectToDouble(attrMap2.get("item_stack_count")))
.itemGuid(CommonUtils.objectToString(attrMap2.get("item_guid")))
.build();
itemList.add(item);

View File

@@ -7,9 +7,11 @@ import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
import com.caliverse.admin.domain.entity.*;
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.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.CommonConstants;
import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.global.common.utils.ExcelUtils;
@@ -51,6 +53,20 @@ public class MailService {
private final ResourceLoader resourceLoader;
private final ScheduleService scheduleService;
private final HistoryService historyService;
private final DynamodbCaliumService dynamodbCaliumService;
public MailResponse getStockCalium(){
double stock_calium = dynamodbCaliumService.getCaliumTotal();
return MailResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.resultData(MailResponse.ResultData.builder()
.stockCalium(stock_calium)
.build()
)
.build();
}
public MailResponse getList(Map requestParam){
@@ -176,7 +192,7 @@ public class MailService {
guid = getGuid(guid, Mail.USERTYPE.NICKNAME.name());
if(guid == null || mailRequest.getGuid().equals(guid)){
log.error("postMail RECEIVETYPE Single Nickname Find Fail");
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNOMODB_CHECK.getMessage() );
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NICKNAME_CHECK.getMessage() );
}
}else if(mailRequest.getUserType().equals(Mail.USERTYPE.EMAIL)){
guid = getGuid(guid, Mail.USERTYPE.EMAIL.name());
@@ -192,7 +208,7 @@ public class MailService {
else{
mailRequest.setReceiveType(Mail.RECEIVETYPE.MULTIPLE);
if(mailRequest.getFileName() == null){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NOT_EXIT_EXCEL.getMessage() ); //Excel 파일을 선택해주세요.
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NOT_EXIT_EXCEL.toString() ); //Excel 파일을 선택해주세요.
}
List<Excel> excelList = excelUtils.getExcelListData(mailRequest.getFileName());
for(Excel excel : excelList){
@@ -200,25 +216,25 @@ public class MailService {
case "GUID" -> {
if (dynamoDBService.isGuidChecked(excel.getUser())) {
log.error("postMail Multi Guid({}) Find Fail", excel.getUser());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.GUID_CHECK.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.GUID_CHECK.toString());
}
}
case "NICKNAME" -> {
String user = getGuid(excel.getUser(), Mail.USERTYPE.NICKNAME.name());
if (user == null || user.isEmpty()) {
log.error("postMail Multi Nickname({}) Find Fail", excel.getUser());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNOMODB_CHECK.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NICKNAME_CHECK.toString());
}
}
case "EMAIL" -> {
String user = getGuid(excel.getUser(), Mail.USERTYPE.EMAIL.name());
if (user == null || user.isEmpty()) {
log.error("postMail Multi Email({}) Find Fail", excel.getUser());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.EMAIL_CHECK.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.EMAIL_CHECK.toString());
}
}
default ->
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.USERTYPE_CHECK_EXCEL.getMessage()); //Excel 파일을 선택해주세요.
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.USERTYPE_CHECK_EXCEL.toString()); //Excel 파일을 선택해주세요.
}
}
mailRequest.setTarget(mailRequest.getFileName());
@@ -232,26 +248,37 @@ public class MailService {
//아이템 저장
if(mailRequest.getItemList()!= null && !mailRequest.getItemList().isEmpty()){
//칼리움일경우 수량체크
boolean hasCalium = mailRequest.getItemList().stream().anyMatch(item -> item.getItem().equals(CommonConstants.CALIUM_ITEM_CODE));
double caliumSum = 0;
if(hasCalium){
caliumSum = mailRequest.getItemList().stream()
.filter(item -> item.getItem().equals(CommonConstants.CALIUM_ITEM_CODE))
.mapToDouble(Item::getItemCnt)
.sum();
double stockCalium = dynamodbCaliumService.getCaliumTotal();
if(caliumSum > stockCalium){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.ERROR_MAIL_ITEM_CALIUM_OVER.toString());
}
}
mailRequest.getItemList().forEach(
item -> {
map.put("goodsId",item.getItem());
map.put("itemCnt",String.valueOf(item.getItemCnt()));
map.put("itemCnt", String.valueOf(item.getItemCnt()));
mailMapper.insertItem(map);
}
);
//재원저장소 칼리움 차감
if(hasCalium){
dynamodbCaliumService.caliumStockDeduction(caliumSum);
}
}
//자원 저장
// if(mailRequest.getResourceList()!= null && mailRequest.getResourceList().size() > 0){
// mailRequest.getResourceList().forEach(
// item -> {
// map.put("goodsId",item.getItem());
// map.put("itemCnt",String.valueOf(item.getItemCnt()));
// mailMapper.insertItem(map);
// }
// );
// }
//메시지 저장
if(mailRequest.getMailList()!= null && mailRequest.getMailList().size() > 0){
if(mailRequest.getMailList()!= null && !mailRequest.getMailList().isEmpty()){
mailRequest.getMailList().forEach(
item -> {
map.put("title",item.getTitle());

View File

@@ -1,11 +1,17 @@
package com.caliverse.admin.dynamodb.domain.atrrib;
import com.caliverse.admin.dynamodb.entity.EAccountCreationType;
import com.caliverse.admin.dynamodb.entity.EAccountType;
import com.caliverse.admin.dynamodb.entity.EAuthAdminLevelType;
import com.caliverse.admin.dynamodb.entity.ELanguageType;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.*;
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean;
import java.util.List;
@Getter
@Setter
@ToString(callSuper = true)
@@ -20,9 +26,31 @@ public class AccountBaseAttrib extends DynamoDBAttribBase {
private String userGuid;
private String password;
@JsonProperty("account_type")
private String AccountType;
private EAccountType AccountType;
@JsonProperty("language_type")
private String languageType;
private ELanguageType languageType;
@JsonProperty("auth_amdin_level_type")
private String authAdminLevelType;
private EAuthAdminLevelType authAdminLevelType;
@JsonProperty("account_creation_type")
private EAccountCreationType accountCreationType;
@JsonProperty("account_creation_meta_id")
private Integer accountCreationMetaId;
@JsonProperty("login_datetime")
private String loginDateTime;
@JsonProperty("logout_datetime")
private String logoutDateTime;
@JsonProperty("created_datetime")
private String createdDateTime;
@JsonProperty("block_start_datetime")
private String blockStartDateTime;
@JsonProperty("block_end_datetime")
private String blockEndDateTime;
@JsonProperty("block_policy")
private List<String> blockPolicy;
@JsonProperty("block_reason")
private String blockReason;
@JsonProperty("access_token")
private Long accessToken;
@JsonProperty("sso_account_auth_jwt")
private String ssoAccountAuthJWT;
}

View File

@@ -0,0 +1,61 @@
package com.caliverse.admin.dynamodb.domain.atrrib;
import com.caliverse.admin.dynamodb.entity.EDayOfWeekType;
import com.caliverse.admin.dynamodb.entity.EOncePeriodRangeType;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.*;
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean;
import java.util.HashSet;
@Getter
@Setter
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@DynamoDbBean
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class BattleEventAttrib extends DynamoDBAttribBase {
@JsonProperty("event_id")
private Integer eventId;
@JsonProperty("is_active")
private boolean isActive;
@JsonProperty("start_day")
private String startDay;
@JsonProperty("start_hour")
private Integer startHour;
@JsonProperty("start_min")
private Integer startMin;
@JsonProperty("end_date")
private String endDate;
@JsonProperty("instance_id")
private Integer instanceId;
@JsonProperty("once_period_type")
private EOncePeriodRangeType oncePeriodType;
@JsonProperty("day_of_week_type")
private HashSet<EDayOfWeekType> dayOfWeekType;
@JsonProperty("ffa_config_data_id")
private Integer configDataId;
@JsonProperty("ffa_reward_group_id")
private Integer rewardGroupId;
@JsonProperty("ffa_hot_time")
private Integer hotTime;
@JsonProperty("round_count")
private Integer roundCount;
}

View File

@@ -27,10 +27,10 @@ public class BuildingAttrib extends DynamoDBAttribBase{
@JsonProperty("owner_user_guid")
private String ownerUserGuid;
private String RentalCurrencyType;
private Double RentalCurrencyAmount;
private String IsRentalOpen;
@JsonProperty("RentalCurrencyType")
private String rentalCurrencyType;
@JsonProperty("RentalCurrencyAmount")
private Double rentalCurrencyAmount;
@JsonProperty("IsRentalOpen")
private String isRentalOpen;
}

View File

@@ -0,0 +1,26 @@
package com.caliverse.admin.dynamodb.domain.atrrib;
import com.caliverse.admin.dynamodb.entity.EOwnerEntityType;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.*;
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean;
@Getter
@Setter
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@DynamoDbBean
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class NicknameAttrib extends DynamoDBAttribBase {
private String nickname;
@JsonProperty("owner_guid")
private String ownerGuid;
@JsonProperty("owner_entity_type")
private EOwnerEntityType ownerEntityType;
}

View File

@@ -0,0 +1,30 @@
package com.caliverse.admin.dynamodb.domain.atrrib;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.*;
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean;
@Getter
@Setter
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@DynamoDbBean
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class UserBaseAttrib extends DynamoDBAttribBase {
@JsonProperty("account_id")
private String accountId;
@JsonProperty("user_guid")
private String userGuid;
private String eoa;
@JsonProperty("selected_character_guid")
private String selectedCharacterGuid;
@JsonProperty("is_intro_completed")
private boolean isIntroCompleted;
@JsonProperty("game_login_datetime")
private String gameLoginDateTime;
@JsonProperty("game_logout_datetime")
private String gameLogoutDateTime;
}

View File

@@ -0,0 +1,29 @@
package com.caliverse.admin.dynamodb.domain.doc;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbAttribute;
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean;
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@DynamoDbBean
public class AccountBaseDoc extends DynamoDBDocBase {
private String accountBaseAttrib;
public String getAttribFieldName() {
return "AccountBaseAttrib";
}
@DynamoDbAttribute("AccountBaseAttrib")
@JsonProperty("AccountBaseAttrib")
public String getAttribValue() {
return accountBaseAttrib;
}
public void setAttribValue(String value) {
this.accountBaseAttrib = value;
}
}

View File

@@ -10,20 +10,20 @@ import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean;
@NoArgsConstructor
@DynamoDbBean
public class BattleEventDoc extends DynamoDBDocBase {
private String systemMetaMailAttrib;
private String battleEventAttrib;
public String getAttribFieldName() {
return "SystemMetaMailAttrib";
return "BattleEventAttrib";
}
@DynamoDbAttribute("SystemMetaMailAttrib")
@JsonProperty("SystemMetaMailAttrib")
@DynamoDbAttribute("BattleEventAttrib")
@JsonProperty("BattleEventAttrib")
public String getAttribValue() {
return systemMetaMailAttrib;
return battleEventAttrib;
}
public void setAttribValue(String value) {
this.systemMetaMailAttrib = value;
this.battleEventAttrib = value;
}
}

View File

@@ -0,0 +1,29 @@
package com.caliverse.admin.dynamodb.domain.doc;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbAttribute;
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean;
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@DynamoDbBean
public class NicknameDoc extends DynamoDBDocBase {
private String nicknameAttrib;
public String getAttribFieldName() {
return "NicknameAttrib";
}
@DynamoDbAttribute("NicknameAttrib")
@JsonProperty("NicknameAttrib")
public String getAttribValue() {
return nicknameAttrib;
}
public void setAttribValue(String value) {
this.nicknameAttrib = value;
}
}

View File

@@ -0,0 +1,29 @@
package com.caliverse.admin.dynamodb.domain.doc;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbAttribute;
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean;
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@DynamoDbBean
public class UserBaseDoc extends DynamoDBDocBase {
private String userBaseAttrib;
public String getAttribFieldName() {
return "UserBaseAttrib";
}
@DynamoDbAttribute("UserBaseAttrib")
@JsonProperty("UserBaseAttrib")
public String getAttribValue() {
return userBaseAttrib;
}
public void setAttribValue(String value) {
this.userBaseAttrib = value;
}
}

View File

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

View File

@@ -0,0 +1,22 @@
package com.caliverse.admin.dynamodb.entity;
import com.caliverse.admin.domain.entity.common.ValueEnum;
public enum EAccountType implements ValueEnum {
None(0),
Google(1),
Apple(2),
;
private final int value;
EAccountType(int value) {
this.value = value;
}
@Override
public int getValue() {
return value;
}
}

View File

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

View File

@@ -0,0 +1,26 @@
package com.caliverse.admin.dynamodb.entity;
import lombok.Getter;
@Getter
public enum EDayOfWeekType {
Sunday(0), // 일요일
Monday(1), // 월요일
Tuesday(2), // 화요일
Wednesday(3), // 수요일
Thursday(4), // 목요일
Friday(5), // 금요일
Saturday(6), // 토요일
None(99);
private final int value;
EDayOfWeekType(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}

View File

@@ -0,0 +1,23 @@
package com.caliverse.admin.dynamodb.entity;
import com.caliverse.admin.domain.entity.common.ValueEnum;
public enum ELanguageType implements ValueEnum {
All(0),
Ko(1),
En(2),
Ja(4),
;
private final int value;
ELanguageType(int value) {
this.value = value;
}
@Override
public int getValue() {
return value;
}
}

View File

@@ -0,0 +1,24 @@
package com.caliverse.admin.dynamodb.entity;
import lombok.Getter;
@Getter
public enum EOncePeriodRangeType {
NONE(0),
Nolimit(1),
Daily(2),
Weekly(3),
Monthly(4);
private final int value;
EOncePeriodRangeType(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}

View File

@@ -0,0 +1,26 @@
package com.caliverse.admin.dynamodb.entity;
import com.caliverse.admin.domain.entity.common.ValueEnum;
public enum EOwnerEntityType implements ValueEnum {
None(0),
User(1),
Character(2),
UgcNpc(3),
Myhome(4),
Land(5),
Building(6),
;
private final int value;
EOwnerEntityType(int value) {
this.value = value;
}
@Override
public int getValue() {
return value;
}
}

View File

@@ -10,7 +10,7 @@ public class MailItem {
@JsonProperty("itemId")
private Integer itemId;
@JsonProperty("count")
private Integer count;
private Double count;
@JsonProperty("productId")
private Integer productId;
@JsonProperty("isRepeatProduct")

View File

@@ -0,0 +1,14 @@
package com.caliverse.admin.dynamodb.repository;
import com.caliverse.admin.domain.entity.BlackList;
import com.caliverse.admin.dynamodb.domain.atrrib.AccountBaseAttrib;
import com.caliverse.admin.dynamodb.domain.doc.AccountBaseDoc;
import java.util.List;
public interface AccountBaseRepository extends DynamoDBRepository<AccountBaseDoc> {
boolean isBlockUser(String account_id);
void updateBlockUserStart(String account_id, BlackList blackList);
void updateBlockUserEnd(String account_id);
AccountBaseAttrib findUser(Long account_id);
}

View File

@@ -70,6 +70,11 @@ public abstract class BaseDynamoDBRepository<T> implements DynamoDBRepository<T>
@Override
public List<T> findByPrefix(String partitionKey, String sortKeyPrefix) {
return operations.getItemsByPrefix(partitionKey, sortKeyPrefix, entityClass);
if(sortKeyPrefix.isEmpty()){
return operations.getItemsByPrefix(partitionKey, entityClass);
}
else{
return operations.getItemsByPrefix(partitionKey, sortKeyPrefix, entityClass);
}
}
}

View File

@@ -0,0 +1,13 @@
package com.caliverse.admin.dynamodb.repository;
import com.caliverse.admin.domain.entity.BattleEvent;
import com.caliverse.admin.domain.request.BattleEventRequest;
import com.caliverse.admin.dynamodb.domain.doc.BattleEventDoc;
public interface BattleEventRepository extends DynamoDBRepository<BattleEventDoc> {
int findEventId();
void insert(BattleEventRequest battleEventRequest);
void update(BattleEventRequest battleEventRequest);
void delete(BattleEventRequest battleEventRequest);
void updateStop(BattleEvent battleEvent);
}

View File

@@ -5,4 +5,5 @@ import com.caliverse.admin.dynamodb.domain.doc.CaliumStorageDoc;
public interface CaliumStorageRepository extends DynamoDBRepository<CaliumStorageDoc> {
double getTotal();
void updateTotal(double caliumCnt);
void stockDeduction(double caliumCnt);
}

View File

@@ -0,0 +1,162 @@
package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.BlackList;
import com.caliverse.admin.domain.entity.HISTORYTYPE;
import com.caliverse.admin.dynamodb.domain.atrrib.AccountBaseAttrib;
import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionRegistryAttrib;
import com.caliverse.admin.dynamodb.domain.atrrib.UserNicknameRegistryAttrib;
import com.caliverse.admin.dynamodb.domain.doc.AccountBaseDoc;
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRegistryDoc;
import com.caliverse.admin.dynamodb.domain.doc.UserNicknameRegistryDoc;
import com.caliverse.admin.dynamodb.repository.AccountBaseRepository;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
import com.caliverse.admin.dynamodb.repository.UserNicknameRegistryRepository;
import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.constants.CommonConstants;
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.history.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import software.amazon.awssdk.enhanced.dynamodb.Key;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import static com.caliverse.admin.global.common.utils.DateUtils.getDynamodbDateFormat;
@Component
@Slf4j
public class AccountBaseRepositoryImpl extends BaseDynamoDBRepository<AccountBaseDoc> implements AccountBaseRepository {
public AccountBaseRepositoryImpl(DynamoDBOperations operations, DynamodbHistoryLogService dynamodbHistoryLogService, ObjectMapper objectMapper) {
super(operations, AccountBaseDoc.class, dynamodbHistoryLogService, objectMapper);
}
@Override
public boolean isBlockUser(String account_id) {
Key key = Key.builder()
.partitionValue(DynamoDBConstants.PK_KEY_ACCOUNT_BASE + account_id)
.sortValue(DynamoDBConstants.EMPTY)
.build();
AccountBaseDoc doc = findById(key);
try {
AccountBaseAttrib attrib = objectMapper.readValue(doc.getAttribValue(), AccountBaseAttrib.class);
List<String> block_policy = attrib.getBlockPolicy();
return !block_policy.isEmpty();
} catch (JsonProcessingException e) {
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
}
@Override
public void updateBlockUserStart(String account_id, BlackList blackList) {
try {
Key key = Key.builder()
.partitionValue(DynamoDBConstants.PK_KEY_ACCOUNT_BASE + account_id)
.sortValue(DynamoDBConstants.EMPTY)
.build();
AccountBaseDoc beforeDoc = findById(key);
if (beforeDoc != null) {
AccountBaseDoc afterDoc = deepCopy(beforeDoc, AccountBaseDoc.class);
List<String> block_policy = new ArrayList<>();
block_policy.add(blackList.getType().toString());
AccountBaseAttrib attrib = objectMapper.readValue(afterDoc.getAttribValue(), AccountBaseAttrib.class);
attrib.setBlockStartDateTime(getDynamodbDateFormat(blackList.getStartDt()));
attrib.setBlockEndDateTime(getDynamodbDateFormat(blackList.getEndDt()));
attrib.setBlockPolicy(block_policy);
attrib.setBlockReason(blackList.getSanctions().toString());
afterDoc.setAttribValue(objectMapper.writeValueAsString(attrib));
afterDoc.setUpdatedDateTime(CommonUtils.convertUTCDate(LocalDateTime.now()));
update(afterDoc);
log.info("updateBlockUserStart Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPE.BLACKLIST_UPDATE,
HISTORYTYPE.BLACKLIST_UPDATE.name(),
beforeDoc,
afterDoc,
CommonConstants.SCHEDULE,
""
);
}
}catch (Exception e){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
}
@Override
public void updateBlockUserEnd(String account_id) {
try {
Key key = Key.builder()
.partitionValue(DynamoDBConstants.PK_KEY_ACCOUNT_BASE + account_id)
.sortValue(DynamoDBConstants.EMPTY)
.build();
AccountBaseDoc beforeDoc = findById(key);
if (beforeDoc != null) {
AccountBaseDoc afterDoc = deepCopy(beforeDoc, AccountBaseDoc.class);
String max_date = getDynamodbDateFormat(LocalDateTime.of(9999, 12, 31, 23, 59, 59, 999999900));
AccountBaseAttrib attrib = objectMapper.readValue(afterDoc.getAttribValue(), AccountBaseAttrib.class);
attrib.setBlockStartDateTime(max_date);
attrib.setBlockEndDateTime(max_date);
attrib.setBlockPolicy(new ArrayList<>());
attrib.setBlockReason("");
afterDoc.setAttribValue(objectMapper.writeValueAsString(attrib));
afterDoc.setUpdatedDateTime(CommonUtils.convertUTCDate(LocalDateTime.now()));
update(afterDoc);
log.info("updateBlockUserEnd Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPE.BLACKLIST_UPDATE,
HISTORYTYPE.BLACKLIST_UPDATE.name(),
beforeDoc,
afterDoc,
CommonConstants.SCHEDULE,
""
);
}
}catch (Exception e){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
}
@Override
public AccountBaseAttrib findUser(Long account_id) {
Key key = Key.builder()
.partitionValue(DynamoDBConstants.PK_KEY_ACCOUNT_BASE + account_id)
.sortValue(DynamoDBConstants.EMPTY)
.build();
AccountBaseDoc doc = findById(key);
try {
return objectMapper.readValue(doc.getAttribValue(), AccountBaseAttrib.class);
} catch (JsonProcessingException e) {
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
}
}

View File

@@ -0,0 +1,242 @@
package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.BattleEvent;
import com.caliverse.admin.domain.entity.HISTORYTYPE;
import com.caliverse.admin.domain.request.BattleEventRequest;
import com.caliverse.admin.dynamodb.domain.atrrib.BattleEventAttrib;
import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionRegistryAttrib;
import com.caliverse.admin.dynamodb.domain.doc.BattleEventDoc;
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRegistryDoc;
import com.caliverse.admin.dynamodb.entity.EDayOfWeekType;
import com.caliverse.admin.dynamodb.entity.EOncePeriodRangeType;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
import com.caliverse.admin.dynamodb.repository.BattleEventRepository;
import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.history.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import software.amazon.awssdk.enhanced.dynamodb.Key;
import java.time.LocalDateTime;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import static com.caliverse.admin.global.common.utils.CommonUtils.convertUTCDate;
import static com.caliverse.admin.global.common.utils.DateUtils.stringToISODateTime;
@Component
@Slf4j
public class BattleEventRepositoryImpl extends BaseDynamoDBRepository<BattleEventDoc> implements BattleEventRepository {
public BattleEventRepositoryImpl(DynamoDBOperations operations, DynamodbHistoryLogService dynamodbHistoryLogService, ObjectMapper objectMapper) {
super(operations, BattleEventDoc.class, dynamodbHistoryLogService, objectMapper);
}
@Override
public int findEventId() {
List<BattleEventDoc> docs = findByPrefix(
DynamoDBConstants.PK_KEY_BATTLE_EVENT,
""
);
if (docs.isEmpty()) return 0;
BattleEventDoc latestDoc = docs.stream().max(Comparator.comparing(doc -> Integer.parseInt(doc.getSK())))
.orElse(null);
try {
BattleEventAttrib attrib = objectMapper.readValue(latestDoc.getAttribValue(), BattleEventAttrib.class);
return attrib.getEventId();
}catch (Exception e){
log.error(e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
}
private boolean isEvent(Integer sk){
Key key = Key.builder()
.partitionValue(DynamoDBConstants.PK_KEY_BATTLE_EVENT)
.sortValue(String.valueOf(sk))
.build();
BattleEventDoc doc = findById(key);
return doc != null;
}
@Override
public void insert(BattleEventRequest battleEventRequest) {
if(isEvent(battleEventRequest.getEventId())){
log.error("insert EventId: {} is duplication", battleEventRequest.getEventId());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
LocalDateTime nowDate = LocalDateTime.now();
LocalDateTime start_dt = battleEventRequest.getEventStartDt();
BattleEvent.BATTLE_REPEAT_TYPE repeatType = battleEventRequest.getRepeatType();
EOncePeriodRangeType oncePeriodRangeType = getOncePeriodRangeType(repeatType);
EDayOfWeekType dayOfWeekType = getDayOfWeekType(repeatType);
HashSet<EDayOfWeekType> hDayOfWeekType = new HashSet<>();
hDayOfWeekType.add(dayOfWeekType);
try {
BattleEventAttrib attrib = new BattleEventAttrib();
attrib.setAttribType(DynamoDBConstants.ATTRIB_BATTLE_EVENT);
attrib.setEventId(battleEventRequest.getEventId());
attrib.setStartDay(stringToISODateTime(start_dt.toLocalDate().atStartOfDay()));
attrib.setStartHour(start_dt.getHour());
attrib.setStartMin(start_dt.getMinute());
attrib.setEndDate(stringToISODateTime(battleEventRequest.getEventEndDt()));
attrib.setInstanceId(battleEventRequest.getInstanceId());
attrib.setOncePeriodType(oncePeriodRangeType);
attrib.setDayOfWeekType(hDayOfWeekType);
attrib.setConfigDataId(battleEventRequest.getConfigId());
attrib.setRewardGroupId(battleEventRequest.getRewardGroupId());
attrib.setHotTime(battleEventRequest.getHotTime());
attrib.setRoundCount(battleEventRequest.getRoundCount());
attrib.setActive(true);
BattleEventDoc doc = new BattleEventDoc();
doc.setPK(DynamoDBConstants.PK_KEY_BATTLE_EVENT);
doc.setSK(String.valueOf(battleEventRequest.getEventId()));
doc.setDocType(DynamoDBConstants.DOC_BATTLE_EVENT);
doc.setAttribValue(objectMapper.writeValueAsString(attrib));
doc.setCreatedDateTime(convertUTCDate(nowDate));
doc.setUpdatedDateTime(convertUTCDate(nowDate));
doc.setDeletedDateTime(DynamoDBConstants.MIN_DATE);
doc.setRestoredDateTime(DynamoDBConstants.MIN_DATE);
save(doc);
dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPE.BATTLE_EVENT_ADD,
HISTORYTYPE.BATTLE_EVENT_ADD.name(),
doc,
CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp()
);
}catch (Exception e){
log.error("insert Error: {}", e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
}
@Override
public void update(BattleEventRequest battleEventRequest) {
LocalDateTime nowDate = LocalDateTime.now();
LocalDateTime start_dt = battleEventRequest.getEventStartDt();
try {
Key key = Key.builder()
.partitionValue(DynamoDBConstants.PK_KEY_BATTLE_EVENT)
.sortValue(String.valueOf(battleEventRequest.getEventId()))
.build();
BattleEventDoc beforeDoc = findById(key);
if (beforeDoc != null) {
BattleEventDoc afterDoc = deepCopy(beforeDoc, BattleEventDoc.class);
BattleEventAttrib attrib = objectMapper.readValue(afterDoc.getAttribValue(), BattleEventAttrib.class);
attrib.setStartDay(stringToISODateTime(start_dt.toLocalDate().atStartOfDay()));
attrib.setStartHour(start_dt.getHour());
attrib.setStartMin(start_dt.getMinute());
attrib.setEndDate(stringToISODateTime(battleEventRequest.getEventEndDt()));
attrib.setConfigDataId(battleEventRequest.getConfigId());
attrib.setRewardGroupId(battleEventRequest.getRewardGroupId());
attrib.setHotTime(battleEventRequest.getHotTime());
attrib.setRoundCount(battleEventRequest.getRoundCount());
attrib.setActive(true);
afterDoc.setAttribValue(objectMapper.writeValueAsString(attrib));
afterDoc.setUpdatedDateTime(CommonUtils.convertUTCDate(nowDate));
update(afterDoc);
log.info("BattleEventDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPE.BATTLE_EVENT_UPDATE,
HISTORYTYPE.BATTLE_EVENT_UPDATE.name(),
beforeDoc,
afterDoc,
CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp()
);
}
}catch (Exception e){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
}
@Override
public void delete(BattleEventRequest battleEventRequest) {
return;
}
@Override
public void updateStop(BattleEvent battleEvent) {
try {
Key key = Key.builder()
.partitionValue(DynamoDBConstants.PK_KEY_BATTLE_EVENT)
.sortValue(String.valueOf(battleEvent.getEventId()))
.build();
BattleEventDoc beforeDoc = findById(key);
if (beforeDoc != null) {
BattleEventDoc afterDoc = deepCopy(beforeDoc, BattleEventDoc.class);
BattleEventAttrib attrib = objectMapper.readValue(afterDoc.getAttribValue(), BattleEventAttrib.class);
attrib.setActive(false);
afterDoc.setAttribValue(objectMapper.writeValueAsString(attrib));
afterDoc.setUpdatedDateTime(CommonUtils.convertUTCDate(LocalDateTime.now()));
update(afterDoc);
log.info("BattleEventDoc Update Stop Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPE.BATTLE_EVENT_UPDATE,
HISTORYTYPE.BATTLE_EVENT_UPDATE.name(),
beforeDoc,
afterDoc,
CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp()
);
}
}catch (Exception e){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
}
private EOncePeriodRangeType getOncePeriodRangeType(BattleEvent.BATTLE_REPEAT_TYPE repeatType) {
return switch (repeatType) {
case DAY -> EOncePeriodRangeType.Daily;
case SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY -> EOncePeriodRangeType.Weekly;
default -> EOncePeriodRangeType.NONE;
};
}
private EDayOfWeekType getDayOfWeekType(BattleEvent.BATTLE_REPEAT_TYPE repeatType) {
return switch (repeatType) {
case SUNDAY -> EDayOfWeekType.Sunday;
case MONDAY -> EDayOfWeekType.Monday;
case TUESDAY -> EDayOfWeekType.Tuesday;
case WEDNESDAY -> EDayOfWeekType.Wednesday;
case THURSDAY -> EDayOfWeekType.Thursday;
case FRIDAY -> EDayOfWeekType.Friday;
case SATURDAY -> EDayOfWeekType.Saturday;
default -> EDayOfWeekType.None;
};
}
}

View File

@@ -64,10 +64,60 @@ public class CaliumStorageRepositoryImpl extends BaseDynamoDBRepository<CaliumSt
double currentTotal = attrib.getCaliumOperatorStorage().getOperatorTotalCalium();;
BigDecimal dclCurrentTotal = new BigDecimal(currentTotal);
BigDecimal dclCaliumCnt = new BigDecimal(caliumCnt);
BigDecimal result = dclCurrentTotal.multiply(dclCaliumCnt);
BigDecimal result = dclCurrentTotal.add(dclCaliumCnt);
// double sumTotal = currentTotal + caliumCnt; // 부동소수점으로 오차가 발생할수 있다(..000000001)
result = result.setScale(2, RoundingMode.HALF_UP);;
log.info("updateTotal currentTotal: {}, newCaliumCnt: {}", currentTotal, caliumCnt);
log.info("updateTotal currentTotal: {}, newCaliumCnt: {}, total: {}", currentTotal, caliumCnt, result);
CaliumStorageAttrib.CaliumOperatorStorage caliumOperatorStorage = attrib.getCaliumOperatorStorage();
caliumOperatorStorage.setOperatorTotalCalium(result.doubleValue());
caliumOperatorStorage.setOperatorCaliumFillUpDate(now_data);
attrib.setCaliumOperatorStorage(caliumOperatorStorage);
afterDoc.setAttribValue(attrib);
afterDoc.setUpdatedDateTime(now_data);
update(afterDoc);
log.info("CaliumStorageDoc Calium Total Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPE.CALIUM_TOTAL_UPDATE,
HISTORYTYPE.CALIUM_TOTAL_UPDATE.name(),
beforeDoc,
afterDoc,
CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp()
);
}
}catch (Exception e){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
}
@Override
public void stockDeduction(double caliumCnt) {
try{
Key key = Key.builder()
.partitionValue(DynamoDBConstants.PK_KEY_CALIUM)
.sortValue(DynamoDBConstants.EMPTY)
.build();
CaliumStorageDoc beforeDoc = findById(key);
if (beforeDoc != null) {
CaliumStorageDoc afterDoc = deepCopy(beforeDoc, CaliumStorageDoc.class);
CaliumStorageAttrib attrib = afterDoc.getAttribValue();
String now_data = CommonUtils.convertUTCDate(LocalDateTime.now());
double currentTotal = attrib.getCaliumOperatorStorage().getOperatorTotalCalium();;
BigDecimal dclCurrentTotal = new BigDecimal(currentTotal);
BigDecimal dclCaliumCnt = new BigDecimal(caliumCnt);
BigDecimal result = dclCurrentTotal.subtract(dclCaliumCnt);
result = result.setScale(2, RoundingMode.HALF_UP);;
log.info("stockDeduction currentTotal: {}, newCaliumCnt: {}, total: {}", currentTotal, caliumCnt, result);
CaliumStorageAttrib.CaliumOperatorStorage caliumOperatorStorage = attrib.getCaliumOperatorStorage();
caliumOperatorStorage.setOperatorTotalCalium(result.doubleValue());

View File

@@ -0,0 +1,41 @@
package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.dynamodb.domain.atrrib.NicknameAttrib;
import com.caliverse.admin.dynamodb.domain.doc.NicknameDoc;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
import com.caliverse.admin.dynamodb.repository.NicknameRepository;
import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.history.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import software.amazon.awssdk.enhanced.dynamodb.Key;
@Component
@Slf4j
public class NicknameRepositoryImpl extends BaseDynamoDBRepository<NicknameDoc> implements NicknameRepository {
public NicknameRepositoryImpl(DynamoDBOperations operations, DynamodbHistoryLogService dynamodbHistoryLogService, ObjectMapper objectMapper) {
super(operations, NicknameDoc.class, dynamodbHistoryLogService, objectMapper);
}
@Override
public NicknameAttrib findUser(String guid) {
Key key = Key.builder()
.partitionValue(DynamoDBConstants.PK_KEY_NICKNAME + guid)
.sortValue(DynamoDBConstants.EMPTY)
.build();
NicknameDoc doc = findById(key);
try {
return objectMapper.readValue(doc.getAttribValue(), NicknameAttrib.class);
} catch (JsonProcessingException e) {
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
}
}

View File

@@ -0,0 +1,41 @@
package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.dynamodb.domain.atrrib.UserBaseAttrib;
import com.caliverse.admin.dynamodb.domain.doc.UserBaseDoc;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
import com.caliverse.admin.dynamodb.repository.UserBaseRepository;
import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.history.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import software.amazon.awssdk.enhanced.dynamodb.Key;
@Component
@Slf4j
public class UserBaseRepositoryImpl extends BaseDynamoDBRepository<UserBaseDoc> implements UserBaseRepository {
public UserBaseRepositoryImpl(DynamoDBOperations operations, DynamodbHistoryLogService dynamodbHistoryLogService, ObjectMapper objectMapper) {
super(operations, UserBaseDoc.class, dynamodbHistoryLogService, objectMapper);
}
@Override
public UserBaseAttrib findUser(String guid) {
Key key = Key.builder()
.partitionValue(DynamoDBConstants.PK_KEY_USER_BASE + guid)
.sortValue(DynamoDBConstants.EMPTY)
.build();
UserBaseDoc doc = findById(key);
try {
return objectMapper.readValue(doc.getAttribValue(), UserBaseAttrib.class);
} catch (JsonProcessingException e) {
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
}
}

View File

@@ -1,11 +1,15 @@
package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.dynamodb.domain.atrrib.AccountBaseAttrib;
import com.caliverse.admin.dynamodb.domain.atrrib.UserNicknameRegistryAttrib;
import com.caliverse.admin.dynamodb.domain.doc.UserNicknameRegistryDoc;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
import com.caliverse.admin.dynamodb.repository.UserNicknameRegistryRepository;
import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.history.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
@@ -25,6 +29,20 @@ public class UserNicknameRegistryRepositoryImpl extends BaseDynamoDBRepository<U
super(operations, UserNicknameRegistryDoc.class, dynamodbHistoryLogService, objectMapper);
}
@Override
public UserNicknameRegistryAttrib findUser(String nickname) {
Key key = Key.builder()
.partitionValue(DynamoDBConstants.PK_KEY_USER_NICKNAME_REGISTRY)
.build();
UserNicknameRegistryDoc doc = findById(key);
try {
return objectMapper.readValue(doc.getAttribValue(), UserNicknameRegistryAttrib.class);
} catch (JsonProcessingException e) {
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
}
@Override
public List<String> findAllNicknameByGuid() {
Key key = Key.builder()

View File

@@ -0,0 +1,8 @@
package com.caliverse.admin.dynamodb.repository;
import com.caliverse.admin.dynamodb.domain.atrrib.NicknameAttrib;
import com.caliverse.admin.dynamodb.domain.doc.NicknameDoc;
public interface NicknameRepository extends DynamoDBRepository<NicknameDoc> {
NicknameAttrib findUser(String guid);
}

View File

@@ -0,0 +1,8 @@
package com.caliverse.admin.dynamodb.repository;
import com.caliverse.admin.dynamodb.domain.atrrib.UserBaseAttrib;
import com.caliverse.admin.dynamodb.domain.doc.UserBaseDoc;
public interface UserBaseRepository extends DynamoDBRepository<UserBaseDoc> {
UserBaseAttrib findUser(String guid);
}

View File

@@ -1,11 +1,13 @@
package com.caliverse.admin.dynamodb.repository;
import com.caliverse.admin.dynamodb.domain.atrrib.UserBaseAttrib;
import com.caliverse.admin.dynamodb.domain.atrrib.UserNicknameRegistryAttrib;
import com.caliverse.admin.dynamodb.domain.doc.UserNicknameRegistryDoc;
import java.util.List;
public interface UserNicknameRegistryRepository extends DynamoDBRepository<UserNicknameRegistryDoc> {
UserNicknameRegistryAttrib findUser(String nickname);
List<String> findAllNicknameByGuid();
List<UserNicknameRegistryAttrib> findAllAttrib();
}

View File

@@ -227,4 +227,17 @@ public class DynamoDBOperations {
.toList();
}
public <T> List<T> getItemsByPrefix(String partitionKey, Class<T> itemClass) {
DynamoDbTable<T> table = getTable(itemClass);
QueryConditional queryConditional = QueryConditional.keyEqualTo(b -> b
.partitionValue(partitionKey)
.build());
return table.query(r -> r.queryConditional(queryConditional))
.items()
.stream()
.toList();
}
}

View File

@@ -0,0 +1,36 @@
package com.caliverse.admin.dynamodb.service;
import com.caliverse.admin.domain.entity.BattleEvent;
import com.caliverse.admin.domain.request.BattleEventRequest;
import com.caliverse.admin.dynamodb.repository.BattleEventRepository;
import com.caliverse.admin.global.common.annotation.DynamoDBTransaction;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
@Slf4j
public class DynamodbBattleEventService {
private final BattleEventRepository battleEventRepository;
@DynamoDBTransaction
public void insertBattleEvent(BattleEventRequest battleEventRequest) {
battleEventRepository.insert(battleEventRequest);
}
@DynamoDBTransaction
public void updateBattleEvent(BattleEventRequest battleEventRequest) {
battleEventRepository.update(battleEventRequest);
}
public int getEventId(){
return battleEventRepository.findEventId();
}
@DynamoDBTransaction
public void updateStopBattleEvent(BattleEvent battleEvent) {
battleEventRepository.updateStop(battleEvent);
}
}

View File

@@ -19,6 +19,10 @@ public class DynamodbCaliumService {
@DynamoDBTransaction
public void updateCaliumTotal(double caliumCnt){
caliumStorageRepository.updateTotal(caliumCnt);
log.info("updateCaliumCharged DynamoDB Update Complete");
}
@DynamoDBTransaction
public void caliumStockDeduction(double caliumCnt){
caliumStorageRepository.stockDeduction(caliumCnt);
}
}

View File

@@ -0,0 +1,67 @@
package com.caliverse.admin.dynamodb.service;
import com.caliverse.admin.domain.entity.BlackList;
import com.caliverse.admin.dynamodb.domain.atrrib.NicknameAttrib;
import com.caliverse.admin.dynamodb.domain.atrrib.UserBaseAttrib;
import com.caliverse.admin.dynamodb.repository.*;
import com.caliverse.admin.global.common.annotation.DynamoDBTransaction;
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.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service
@RequiredArgsConstructor
public class DynamodbUserService {
private final AccountBaseRepository accountBaseRepository;
private final UserBaseRepository userBaseRepository;
private final UserNicknameRegistryRepository registryRepository;
private final NicknameRepository nicknameRepository;
private final ObjectMapper mapper = new ObjectMapper();
public boolean isBlockUser(String guid){
String account_id = getGuidByAccountId(guid);
return accountBaseRepository.isBlockUser(account_id);
}
@DynamoDBTransaction
public void updateBlockUser(BlackList.STATUSTYPE status, BlackList blackList){
String guid = blackList.getGuid();
String account_id = getGuidByAccountId(guid);
if(status.equals(BlackList.STATUSTYPE.INPROGRESS)){
accountBaseRepository.updateBlockUserStart(account_id, blackList);
}
else{
accountBaseRepository.updateBlockUserEnd(account_id);
}
}
public String getGuidByName(String guid){
NicknameAttrib nicknameAttrib = nicknameRepository.findUser(guid);
if(nicknameAttrib == null){
log.error("getGuidByName Nickname Null guid: {}", guid);
return "";
}
return nicknameAttrib.getNickname();
}
public String getGuidByAccountId(String guid){
UserBaseAttrib userBaseAttrib = userBaseRepository.findUser(guid);
if(userBaseAttrib == null){
log.error("getGuidByAccountId UserBase Null guid: {}", guid);
return "";
}
return userBaseAttrib.getAccountId();
}
}

View File

@@ -52,6 +52,9 @@ public enum ErrorCode {
//calium
ERROR_CALIUM_FINISH("충전 완료된 칼리움입니다."),
//mail
ERROR_MAIL_ITEM_CALIUM_OVER("첨부 가능한 칼리움을 초과하였습니다."),
//Land
ERROR_LAND_AUCTION_IMPOSSIBLE("경매를 진행할 수 없는 랜드입니다."),
ERROR_AUCTION_STATUS_IMPOSSIBLE("수정할 수 없는 경매상태입니다."),
@@ -59,6 +62,8 @@ public enum ErrorCode {
//Battle
ERROR_BATTLE_EVENT_TIME_OVER("해당 시간에 속하는 이벤트가 존재합니다."),
ERROR_BATTLE_EVENT_STATUS_IMPOSSIBLE("수정할 수 없는 이벤트상태입니다."),
ERROR_BATTLE_EVENT_STATUS_START_IMPOSSIBLE("진행중인 이벤트상태입니다."),
//------------------------------------------------------------------------------------------------------------------------------
// DyanamoDB
@@ -66,7 +71,7 @@ public enum ErrorCode {
GUID_CHECK("Guid를 확인해주세요."),
EMAIL_CHECK("Email을 확인해주세요"),
GUID_LENGTH_CHECK("guid(32자)를 확인해주세요."),
DYNOMODB_CHECK("gameDB에 닉네임이 없습니다."),
NICKNAME_CHECK("gameDB에 닉네임이 없습니다."),
DYNAMODB_CONNECTION_ERROR("dynamoDB_connection_error"),
DYNAMODB_CONDITION_CHECK_ERROR("dynamoDB_Conditional_Check_error"),
DYNAMODB_PROCESS_ERROR("dynamoDB 처리 중 에러발생"),

View File

@@ -4,6 +4,12 @@ public class CommonConstants {
public static final String TRUE = "True";
public static final String FALSE = "False";
public static final String NONE = "None";
public static final int BATTLE_SERVER_WAIT_TIME = 600; // (seconds) 이벤트 홍보시간이 300초인데 여유있게 처리하게 하기위해 600으로 준다.
public static final String SCHEDULE = "Schedule";
public static final int BATTLE_SERVER_WAIT_TIME = 600; // (seconds) 이벤트 홍보시간이 300초인데 여유있게 처리하게 하기위해 600으로 준다.
public static final int BATTLE_INSTANCE_ID = 1017007;
public static final String CALIUM_ITEM_CODE = "19010003";
public static final String FORMAT_DATE_ISO_DATETIME_MILLIS = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
public static final String FORMAT_DATE_DATETIME = "yyyy-MM-dd HH:mm:ss";
public static final String FORMAT_DATE_ISO_DATETIME = "yyyy-MM-dd'T'HH:mm:ss";
}

View File

@@ -17,6 +17,11 @@ public class DynamoDBConstants {
public static final String PK_KEY_OWNED_LAND = "owned_land#";
public static final String PK_KEY_BUILDING = "building#";
public static final String PK_KEY_OWNED_BUILDING = "owned_building#";
public static final String PK_KEY_BATTLE_EVENT = "management_battle_event#global";
public static final String PK_KEY_ACCOUNT_BASE = "account_base#";
public static final String PK_KEY_USER_BASE = "user_base#";
public static final String PK_KEY_NICKNAME = "nickname#";
//SK
//Attribute
@@ -26,6 +31,7 @@ public class DynamoDBConstants {
public static final String ATTRIB_LANDAUCTION_ACTIVE = "LandAuctionActivityAttrib";
public static final String ATTRIB_LANDAUCTION_HIGHEST_USER = "LandAuctionHighestBidUserAttrib";
public static final String ATTRIB_USER_NICKNAME_REGISTRY = "UserNicknameRegistryAttrib";
public static final String ATTRIB_BATTLE_EVENT = "BattleEventAttrib";
//DOC
public static final String DOC_SYSTEMMAIL = "SystemMetaMailDoc";
@@ -33,6 +39,7 @@ public class DynamoDBConstants {
public static final String DOC_LANDAUCTION_ACTIVE = "LandAuctionActivityDoc";
public static final String DOC_LANDAUCTION_HIGHEST_USER = "LandAuctionHighestBidUserDoc";
public static final String DOC_USER_NICKNAME_REGISTRY = "UserNicknameRegistryDoc";
public static final String DOC_BATTLE_EVENT = "BattleEventDoc";
//SCHEMA
public static final String SCHEMA_UPDATE_TIME = "UpdatedDateTime";

View File

@@ -11,6 +11,7 @@ import java.util.regex.*;
import com.caliverse.admin.domain.entity.DiffStatus;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.constants.CommonConstants;
import com.caliverse.admin.global.common.exception.RestApiException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
@@ -88,15 +89,68 @@ public class CommonUtils {
public static Integer objectToInteger(Object object){
if (object == null) {
return 0;
} else if (object instanceof Integer) {
return (Integer)object;
} else if (object instanceof Boolean) {
return (Integer)object;
} else {
}
if (object instanceof Integer) {
return (Integer) object;
}
if (object instanceof Number) {
return ((Number) object).intValue();
}
if (object instanceof Boolean) {
return ((Boolean) object) ? 1 : 0;
}
try {
// String이나 다른 타입의 경우 문자열로 변환 후 처리
String strValue = String.valueOf(object).trim();
if (strValue.isEmpty()) {
return 0;
}
// 소수점이 있는 숫자 문자열 처리
if (strValue.contains(".")) {
return (int) Double.parseDouble(strValue);
}
return Integer.parseInt(strValue);
} catch (NumberFormatException e) {
return 0;
}
}
public static Double objectToDouble(Object object) {
if (object == null) {
return 0.0;
}
if (object instanceof Double) {
return (Double) object;
}
if (object instanceof Number) {
return ((Number) object).doubleValue();
}
if (object instanceof Boolean) {
return ((Boolean) object) ? 1.0 : 0.0;
}
try {
// String이나 다른 타입의 경우 문자열로 변환 후 처리
String strValue = String.valueOf(object).trim();
if (strValue.isEmpty()) {
return 0.0;
}
return Double.parseDouble(strValue);
} catch (NumberFormatException e) {
return 0.0;
}
}
public static Long objectToLong(Object object) {
if (object == null) {
return 0L;
@@ -285,7 +339,7 @@ public class CommonUtils {
}
public static String convertUTCDate(LocalDateTime date){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(CommonConstants.FORMAT_DATE_ISO_DATETIME_MILLIS);
return date.atOffset(ZoneOffset.UTC).format(formatter);
}

View File

@@ -1,16 +1,34 @@
package com.caliverse.admin.global.common.utils;
import com.caliverse.admin.global.common.constants.CommonConstants;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
public class DateUtils {
public static String dateToString(LocalDateTime date) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
public static String stringToDateTime(LocalDateTime date) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(CommonConstants.FORMAT_DATE_DATETIME);
return date.format(formatter);
}
public static String stringToISODateTime(LocalDateTime date){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(CommonConstants.FORMAT_DATE_ISO_DATETIME);
return date.atOffset(ZoneOffset.UTC).format(formatter);
}
public static String stringToISODateTimeMillis(LocalDateTime date){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(CommonConstants.FORMAT_DATE_ISO_DATETIME_MILLIS);
return date.atOffset(ZoneOffset.UTC).format(formatter);
}
public static String nowDateTime(){
LocalDateTime now = LocalDateTime.now();
return dateToString(now);
return stringToDateTime(now);
}
public static String getDynamodbDateFormat(LocalDateTime date){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSSSSS");
return date.format(formatter);
}
}

View File

@@ -1,37 +0,0 @@
package com.caliverse.admin.logs.logservice.indicators;
import java.util.HashMap;
import java.util.Map;
import com.caliverse.admin.domain.entity.LANGUAGETYPE;
import com.caliverse.admin.logs.Indicatordomain.AuMongoLog;
public class IndicatorsLogHelper {
public static Map<String, AuMongoLog> createLanguageMap()
{
Map<String, AuMongoLog> map = new HashMap<String, AuMongoLog>();
for(LANGUAGETYPE lang : LANGUAGETYPE.getAllLanguages()){
map.put(lang.toString(), new AuMongoLog());
}
return map;
}
// public static Class getClassByAuDayNumber(int dayNumber){
// switch(dayNumber){
// case AdmiinConstants.STAT_DAY_NUM:
// return DauLogInfo.class;
// case AdmiinConstants.STAT_WEEK_NUM:
// return WauLogInfo.class;
// case AdmiinConstants.STAT_MONTH_NUM:
// return MauLogInfo.class;
// default:
// return DauLogInfo.class;
// }
// }
}

View File

@@ -26,6 +26,7 @@ import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.*;
@@ -54,6 +55,7 @@ public class DynamicScheduler {
private final ScheduleService schedulerService;
private final RedisUserInfoService redisUserInfoService;
private final MessageHandlerService messageHandlerService;
private final BattleEventService battleEventService;
private final HistoryService historyService;
private final DynamodbService dynamodbService;
@@ -61,6 +63,72 @@ public class DynamicScheduler {
private final ExcelUtils excelUtils;
private final ObjectMapper objectMapper;
public void battleEventSchedule(){
List<BattleEvent> eventList = battleEventService.getScheduleBattleEventList();
try{
eventList.forEach(event -> {
BattleEvent.BATTLE_STATUS status = event.getStatus();
LocalDateTime start_dt = event.getEventStartDt();
LocalTime startTime = start_dt.toLocalTime();
LocalDateTime now = LocalDateTime.now();
LocalTime currentTime = LocalDateTime.now().toLocalTime();
LocalDateTime end_dt = event.getEventEndDt();
int operation_time = event.getEventOperationTime();
//자정 체크
LocalTime endTime = startTime.plusSeconds(operation_time);
// 현재시간이 자정을 넘어간 경우(00:00 ~ endTime)라면 전날을 기준으로
LocalDate baseDate;
if (startTime.isAfter(endTime)) { // 시작시간이 종료시간보다 늦은 경우 (자정을 걸치는 경우)
if (currentTime.isBefore(endTime)) {
// 현재시간이 00:00 ~ endTime 사이면 전날 기준
baseDate = now.toLocalDate().minusDays(1);
} else if (!currentTime.isBefore(startTime)) {
// 현재시간이 startTime 이후면 현재 날짜 기준
baseDate = now.toLocalDate();
} else {
baseDate = now.toLocalDate();
}
} else {
// 자정을 걸치지 않는 일반적인 경우
baseDate = now.toLocalDate();
}
//오늘자 기준 시작, 종료 시간
LocalDateTime todayStart = LocalDateTime.of(baseDate, startTime);
LocalDateTime todayEnd = todayStart.plusSeconds(operation_time);
BattleEvent.BATTLE_STATUS change_status = null;
Map<String,Object> map = new HashMap<>();
map.put("id", event.getId());
if(status.equals(BattleEvent.BATTLE_STATUS.REGISTER) || status.equals(BattleEvent.BATTLE_STATUS.WAIT)){
if(!now.isBefore(todayStart) && !now.isAfter(todayEnd)){
change_status = BattleEvent.BATTLE_STATUS.RUNNING;
map.put("status", change_status);
battleEventService.updateBattleEventStatus(map);
}
}else if(status.equals(BattleEvent.BATTLE_STATUS.RUNNING)){
if(!(!now.isBefore(todayStart) && !now.isAfter(todayEnd))){
if(!baseDate.isBefore(end_dt.toLocalDate())){
change_status = BattleEvent.BATTLE_STATUS.END;
}else{
change_status = BattleEvent.BATTLE_STATUS.WAIT;
}
map.put("status", change_status);
battleEventService.updateBattleEventStatus(map);
}
}
});
}catch(Exception e){
log.error("battleEventSchedule Exception: {}", e.getMessage());
}
}
public void landAuctionSchedule(){
List<LandAuction> auctionList = landService.getScheduleLandAuctionList();
@@ -83,10 +151,11 @@ public class DynamicScheduler {
return;
}
// 비정상종료일때가 있다고 상시체크로 해달라고 함(23.02.18)
// 경매중일때 경매 종료시간이 되지않았다면 체크하지 않는다
if(auction_status.equals(LandAuction.AUCTION_STATUS.AUCTION_START) && nowDate.isBefore(auctionEndDate)){
return;
}
// if(auction_status.equals(LandAuction.AUCTION_STATUS.AUCTION_START) && nowDate.isBefore(auctionEndDate)){
// return;
// }
Map<String,Object> map = new HashMap<>();
map.put("id", auction.getId());
@@ -179,32 +248,56 @@ public class DynamicScheduler {
List<BlackList> blackList = blackListService.getScheduleBlackList();
try{
LocalDateTime nowDate = LocalDateTime.now();
blackList.forEach(blockUser -> {
LocalDateTime nowDate = LocalDateTime.now();
LocalDateTime startTime = blockUser.getStartDt();
LocalDateTime endTime = blockUser.getEndDt();
BlackList.STATUSTYPE status = blockUser.getStatus();
// 이미 지난시간이면 fail 처리
if(nowDate.isAfter(endTime) && blockUser.getStatus().equals(BlackList.STATUSTYPE.WAIT)){
blackListService.updateBlackListStatus(blockUser.getId(), BlackList.STATUSTYPE.FAIL);
log.error("blackListJob blackListSchedule timeOut : {}", blockUser);
return;
// WAIT 상태 처리
if(status == BlackList.STATUSTYPE.WAIT) {
if(nowDate.isAfter(blockUser.getEndDt())) {
// 만료시간 초과 - FAIL 처리
blackListService.updateBlackListStatus(blockUser.getId(), BlackList.STATUSTYPE.FAIL);
log.error("blackListJob blackListSchedule timeOut : {}", blockUser);
} else if(!nowDate.isBefore(blockUser.getStartDt())) {
// 시작시간 도달 - INPROGRESS 처리
userGameSessionService.kickUserSession(blockUser.getGuid());
blackListService.updateScheduleBlockUser(blockUser, BlackList.STATUSTYPE.INPROGRESS);
blackListService.updateBlackListStatus(blockUser.getId(), BlackList.STATUSTYPE.INPROGRESS);
log.info("blackListJob blackListSchedule block start : {}", blockUser);
}
}
// 시작시간 지났으면 정지 처리
if(!nowDate.isBefore(startTime) && blockUser.getStatus().equals(BlackList.STATUSTYPE.WAIT)){
// user kick 처리
userGameSessionService.kickUserSession(blockUser.getGuid());
blackListService.updateScheduleBlockUser(blockUser, "start");
blackListService.updateBlackListStatus(blockUser.getId(), BlackList.STATUSTYPE.INPROGRESS);
log.info("blackListJob blackListSchedule block start : {}", blockUser);
}
if(!nowDate.isBefore(endTime) && blockUser.getStatus().equals(BlackList.STATUSTYPE.INPROGRESS)){
blackListService.updateScheduleBlockUser(blockUser, "end");
// INPROGRESS 상태 처리
else if(status == BlackList.STATUSTYPE.INPROGRESS && !nowDate.isBefore(blockUser.getEndDt())) {
// 만료시간 도달 - EXPIRATION 처리
blackListService.updateScheduleBlockUser(blockUser, BlackList.STATUSTYPE.EXPIRATION);
blackListService.updateBlackListStatus(blockUser.getId(), BlackList.STATUSTYPE.EXPIRATION);
log.info("blackListJob blackListSchedule block end : {}", blockUser);
}
// LocalDateTime startTime = blockUser.getStartDt();
// LocalDateTime endTime = blockUser.getEndDt();
//
// // 상태가 대기중이고 만료시간이 지났으면 실패 처리
// if(nowDate.isAfter(endTime) && blockUser.getStatus().equals(BlackList.STATUSTYPE.WAIT)){
// blackListService.updateBlackListStatus(blockUser.getId(), BlackList.STATUSTYPE.FAIL);
// log.error("blackListJob blackListSchedule timeOut : {}", blockUser);
// return;
// }
//
// // 상태가 대기중이고 시작시간 지났으면 유저제재 처리
// if(!nowDate.isBefore(startTime) && blockUser.getStatus().equals(BlackList.STATUSTYPE.WAIT)){
// // user kick 처리
// userGameSessionService.kickUserSession(blockUser.getGuid());
// blackListService.updateScheduleBlockUser(blockUser, BlackList.STATUSTYPE.INPROGRESS);
// blackListService.updateBlackListStatus(blockUser.getId(), BlackList.STATUSTYPE.INPROGRESS);
// log.info("blackListJob blackListSchedule block start : {}", blockUser);
// }
//
// // 상태가 제재중이고 만료시간 지났으면 상태 종료 처리
// if(!nowDate.isBefore(endTime) && blockUser.getStatus().equals(BlackList.STATUSTYPE.INPROGRESS)){
// blackListService.updateScheduleBlockUser(blockUser, BlackList.STATUSTYPE.EXPIRATION);
// blackListService.updateBlackListStatus(blockUser.getId(), BlackList.STATUSTYPE.EXPIRATION);
// log.info("blackListJob blackListSchedule block end : {}", blockUser);
// }
});
}catch (Exception e){
log.error("blackListSchedule Exception: {}", e.getMessage());

View File

@@ -181,6 +181,11 @@ public class ScheduleSetter {
// log.info("end landAuctionJob");
}
@Scheduled(cron = "6 * * * * *")
public void battleEventJob(){
dynamicScheduler.battleEventSchedule();
}
//web3
@Scheduled(cron = "1 * * * * *")
public void web3Job(){

View File

@@ -69,14 +69,14 @@ public class BlackListScheduler implements Scheduler {
if(!nowDate.isBefore(startTime) && blackList.getStatus().equals(BlackList.STATUSTYPE.WAIT)) {
// user kick 처리
userGameSessionService.kickUserSession(blackList.getGuid());
blackListService.updateScheduleBlockUser(blackList, "start");
blackListService.updateScheduleBlockUser(blackList, BlackList.STATUSTYPE.INPROGRESS);
blackListService.updateBlackListStatus(blackList.getId(), BlackList.STATUSTYPE.INPROGRESS);
log.info("blackListJob blackListSchedule block start : {}", blackList);
}
// 종료시간 지났으면 만료 처리
if(!nowDate.isBefore(endTime) && blackList.getStatus().equals(BlackList.STATUSTYPE.INPROGRESS)) {
blackListService.updateScheduleBlockUser(blackList, "end");
blackListService.updateScheduleBlockUser(blackList, BlackList.STATUSTYPE.EXPIRATION);
blackListService.updateBlackListStatus(blackList.getId(), BlackList.STATUSTYPE.EXPIRATION);
log.info("blackListJob blackListSchedule block end : {}", blackList);
}

View File

@@ -5,6 +5,7 @@
<id property="id" column="id"/>
<result property="rowNum" column="row_num"/>
<result property="groupId" column="group_id"/>
<result property="eventId" column="event_id"/>
<result property="eventName" column="event_name"/>
<result property="repeatType" column="repeat_type"/>
<result property="eventOperationTime" column="event_operation_time"/>
@@ -15,6 +16,7 @@
<result property="roundCount" column="round_count"/>
<result property="hotTime" column="hot_time"/>
<result property="configId" column="config_id"/>
<result property="instanceId" column="instance_id"/>
<result property="rewardGroupId" column="reward_group_id"/>
<result property="createBy" column="create_by"/>
<result property="createDt" column="create_dt"/>
@@ -31,6 +33,7 @@
SELECT
a.id
, a.group_id
, a.event_id
, a.event_name
, a.repeat_type
, a.event_operation_time
@@ -50,33 +53,35 @@
WHERE 1 = 1
<choose>
<when test="land_type == 'NAME' or land_type == 'name' ">
<if test="land_data != null and land_data != ''">
AND a.land_name LIKE CONCAT('%',#{land_data},'%')
<when test="search_type == 'NAME' or search_type == 'name' ">
<if test="search_data != null and search_data != ''">
AND a.event_name LIKE CONCAT('%',#{search_data},'%')
</if>
</when>
<otherwise>
<if test="land_data != null and land_data != ''">
AND a.land_id = #{land_data}
<if test="search_data != null and search_data != ''">
AND a.event_id = #{search_data}
</if>
</otherwise>
</choose>
<choose>
<when test="user_type == 'NAME' or user_type == 'name' ">
<if test="user_data != null and user_data != ''">
AND a.bidder_nickname LIKE CONCAT('%',#{user_data},'%')
</if>
</when>
<otherwise>
<if test="user_data != null and user_data != ''">
AND a.bidder_guid = #{user_data}
</if>
</otherwise>
</choose>
<if test="land_size != null and land_size != ''">
<if test="config_id != null and config_id != ''">
<choose>
<when test="land_size != 'ALL' ">
AND a.land_size = #{land_size}
<when test="config_id != 'ALL' ">
AND a.config_id = #{config_id}
</when>
</choose>
</if>
<if test="reward_id != null and reward_id != ''">
<choose>
<when test="reward_id != 'ALL' ">
AND a.reward_group_id = #{reward_id}
</when>
</choose>
</if>
<if test="repeat_type != null and repeat_type != ''">
<choose>
<when test="repeat_type != 'ALL' ">
AND a.repeat_type = #{repeat_type}
</when>
</choose>
</if>
@@ -87,9 +92,23 @@
</when>
</choose>
</if>
<if test="hot_time != null and hot_time != ''">
<choose>
<when test="hot_time != 'ALL' ">
AND a.hot_time = #{hot_time}
</when>
</choose>
</if>
<if test="round_count != null and round_count != ''">
<choose>
<when test="round_count != 'ALL' ">
AND a.round_count = #{round_count}
</when>
</choose>
</if>
<if test="start_dt != null and start_dt != '' and end_dt !=null and end_dt!= ''">
AND a.auction_start_dt &gt;= #{start_dt, jdbcType=TIMESTAMP}
AND a.auction_end_dt &lt;= #{end_dt, jdbcType=TIMESTAMP}
AND DATE(a.event_start_dt) &gt;= DATE(#{start_dt, jdbcType=TIMESTAMP})
AND DATE(a.event_end_dt) &lt;= DATE(#{end_dt, jdbcType=TIMESTAMP})
</if>
GROUP BY a.id
ORDER BY status
@@ -97,7 +116,8 @@
, (SELECT @row_number:=0) AS t
) Z
ORDER BY
CASE WHEN Z.status = 'FAIL' OR Z.status = 'CANCEL' THEN 1 ELSE 0 END,
CASE WHEN Z.status = 'STOP' THEN 1 WHEN Z.status = 'END' THEN 2 WHEN Z.status = 'FAIL' OR Z.status = 'CANCEL' THEN 3 ELSE 0 END,
TIME (event_start_dt),
<if test="orderby != null and orderby != ''">
row_num ${orderby}
</if>
@@ -113,13 +133,50 @@
<select id="getAllCnt" resultType="java.lang.Integer" parameterType="map">
SELECT count(*) FROM battle_event a
WHERE 1 = 1
<if test="title != null and title != ''">
AND b.title LIKE CONCAT('%',#{title},'%')
</if>
<if test="event_type != null and event_type != ''">
<choose>
<when test="search_type == 'NAME' or search_type == 'name' ">
<if test="search_data != null and search_data != ''">
AND a.event_name LIKE CONCAT('%',#{search_data},'%')
</if>
</when>
<otherwise>
<if test="search_data != null and search_data != ''">
AND a.event_id = #{search_data}
</if>
</otherwise>
</choose>
<if test="config_id != null and config_id != ''">
<choose>
<when test="event_type != 'ALL' ">
AND event_type = #{event_type}
<when test="config_id != 'ALL' ">
AND a.config_id = #{config_id}
</when>
</choose>
</if>
<if test="reward_id != null and reward_id != ''">
<choose>
<when test="reward_id != 'ALL' ">
AND a.reward_group_id = #{reward_id}
</when>
</choose>
</if>
<if test="repeat_type != null and repeat_type != ''">
<choose>
<when test="repeat_type != 'ALL' ">
AND a.repeat_type = #{repeat_type}
</when>
</choose>
</if>
<if test="hot_time != null and hot_time != ''">
<choose>
<when test="hot_time != 'ALL' ">
AND a.hot_time = #{hot_time}
</when>
</choose>
</if>
<if test="round_count != null and round_count != ''">
<choose>
<when test="round_count != 'ALL' ">
AND a.round_count = #{round_count}
</when>
</choose>
</if>
@@ -131,24 +188,75 @@
</choose>
</if>
<if test="start_dt != null and start_dt != '' and end_dt !=null and end_dt!= ''">
AND a.auction_start_dt &gt;= #{start_dt, jdbcType=TIMESTAMP}
AND a.auction_end_dt &lt;= #{end_dt, jdbcType=TIMESTAMP}
AND DATE(a.event_start_dt) &gt;= DATE(#{start_dt, jdbcType=TIMESTAMP})
AND DATE(a.event_end_dt) &lt;= DATE(#{end_dt, jdbcType=TIMESTAMP})
</if>
</select>
<select id="getCheckBattleEventList" parameterType="com.caliverse.admin.domain.request.BattleEventRequest" resultMap="BattleEventResultMap">
SELECT id
, event_id
, repeat_type
, event_operation_time
, event_start_dt
, event_end_dt
FROM battle_event
WHERE status NOT IN ('END', 'FAIL', 'CANCEL', 'STOP')
<if test="id != null and id != ''">
AND id &lt;&gt; #{id}
</if>
AND (
/* NONE 타입인 경우 */
(repeat_type = 'NONE' AND DATE (event_start_dt) BETWEEN
DATE (#{eventStartDt})
AND DATE (#{eventEndDt}))
OR
/* DAY 타입인 경우 - 기간이 조금이라도 겹치면 가져옴 */
(repeat_type = 'DAY'
AND DATE (event_start_dt) &lt;= DATE (#{eventEndDt})
AND DATE (event_end_dt) &gt;= DATE (#{eventStartDt}))
OR
/* 요일 타입인 경우 - 기간이 겹치고 같은 요일이 있는 경우만 */
(repeat_type = #{repeatType}
AND DATE (event_start_dt) &lt;= DATE (#{eventEndDt})
AND DATE (event_end_dt) &gt;= DATE (#{eventStartDt})
)
)
</select>
<select id="chkTimeOver" parameterType="com.caliverse.admin.domain.request.BattleEventRequest" resultType="integer">
SELECT COUNT(*)
FROM battle_event
WHERE
-- 시간 중복 체크
TIME(#{eventStartTime}) &lt; ADDTIME(TIME(event_start_dt), SEC_TO_TIME(event_operation_time))
AND ADDTIME(TIME(#{eventStartTime}), SEC_TO_TIME(#{eventOperationTime})) > TIME(event_start_dt)
-- 날짜 범위 중복 체크
WHERE status = 'REGISTER'
AND (
(DATE(#{eventStartTime}) BETWEEN DATE(event_start_dt) AND DATE(event_end_dt))
OR (DATE(#{eventEndTime}) BETWEEN DATE(event_start_dt) AND DATE(event_end_dt))
OR (DATE(event_start_dt) BETWEEN DATE(#{eventStartTime}) AND DATE(#{eventEndTime}))
OR (DATE(event_end_dt) BETWEEN DATE(#{eventStartTime}) AND DATE(#{eventEndTime}))
/* 실행 날짜 체크 */
CASE
/* 기존 데이터가 NONE 타입일 때 */
WHEN type = 'NONE' THEN
DATE(event_start_dt) = DATE(#{eventStartDt})
/* 기존 데이터가 DAY 타입일 때 */
WHEN type = 'DAY' THEN
DATE(event_start_dt) &lt;= DATE(#{eventStartDt}) AND
DATE(event_end_dt) &gt;= DATE(#{eventStartDt})
/* 기존 데이터가 요일 타입일 때 */
WHEN type IN ('SUNDAY', 'MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY', 'SATURDAY') THEN
DATE(event_start_dt) &lt;= DATE(#{eventStartDt}) AND
DATE(event_end_dt) &gt;= DATE(#{eventStartDt}) AND
DAYOFWEEK(event_start_dt) = DAYOFWEEK(#{eventStartDt})
END
)
/* 시간 겹침 체크 */
AND (
TIME(event_start_dt) &lt;= TIME(#{eventStartDt})
AND TIME(DATE_ADD(event_start_dt, INTERVAL event_operation_time SECOND)) &gt; TIME(#{eventStartDt})
OR
TIME(event_start_dt) &lt; TIME(DATE_ADD(#{eventStartDt}, INTERVAL #{event_operation_time} SECOND))
AND TIME(DATE_ADD(event_start_dt, INTERVAL event_operation_time SECOND)) &gt;= TIME(DATE_ADD(#{eventStartDt}, INTERVAL #{eventOperationTime} SECOND))
OR
TIME(event_start_dt) &gt;= TIME(#{eventStartDt})
AND TIME(DATE_ADD(event_start_dt, INTERVAL event_operation_time SECOND)) &lt;= TIME(DATE_ADD(#{eventStartDt}, INTERVAL #{eventOperationTime} SECOND))
)
</select>
@@ -157,6 +265,7 @@
SELECT
a.id
, a.group_id
, a.event_id
, a.event_name
, a.repeat_type
, a.event_operation_time
@@ -178,18 +287,23 @@
<!--저장-->
<insert id="postBattleEvent" parameterType="com.caliverse.admin.domain.request.BattleEventRequest" useGeneratedKeys="true" keyProperty="id">
INSERT INTO battle_event (group_id, event_name, repeat_type, event_operation_time, event_start_dt, event_end_dt, config_id, reward_group_id, round_time, round_count, hot_time, create_by, update_by)
VALUES (#{groupId}, #{eventName}, #{repeatType}, #{eventOperationTime}, #{eventStartDt}, #{eventEndDt}, #{configId}, #{rewardGroupId}, #{roundTime}, #{roundCount}, #{hotTime}, #{createBy}, #{updateBy})
INSERT INTO battle_event (group_id, event_id, event_name, repeat_type, event_operation_time, event_start_dt, event_end_dt, config_id, reward_group_id, round_time, round_count, hot_time, instance_id, create_by, update_by)
VALUES (#{groupId}, #{eventId}, #{eventName}, #{repeatType}, #{eventOperationTime}, #{eventStartDt}, #{eventEndDt}, #{configId}, #{rewardGroupId}, #{roundTime}, #{roundCount}, #{hotTime}, #{instanceId}, #{createBy}, #{updateBy})
</insert>
<!--수정-->
<update id="updateBattleEvent" parameterType="com.caliverse.admin.domain.request.BattleEventRequest">
UPDATE battle_event SET group_id = #{groupId}
, resv_end_dt = #{resvEndDt}
, auction_start_dt = #{auctionStartDt}
, auction_end_dt = #{auctionEndDt}
, currency_type = #{currencyType}
, start_price = #{startPrice}
, event_name = #{eventName}
, event_operation_time = #{eventOperationTime}
, config_id = #{configId}
, event_start_dt = #{eventStartDt}
, event_end_dt = #{eventEndDt}
, reward_group_id = #{rewardGroupId}
, round_time = #{roundTime}
, round_count = #{roundCount}
, hot_time = #{hotTime}
, status = 'WAIT'
, update_by = #{updateBy}
, update_dt = NOW()
WHERE id = #{id}
@@ -208,25 +322,30 @@
<update id="updateStatusBattleEvent" parameterType="map">
UPDATE battle_event
SET status = #{status}
<if test="updateBy != null and updateBy != ''">
, update_by = #{updateBy}
, update_dt = NOW()
</if>
where id = #{id}
</update>
<select id="getScheduleBattleEventList" resultMap="BattleEventResultMap">
SELECT id
, a.group
, a.event_name
, a.repeat_type
, a.event_operation_time
, a.status
, a.event_start_dt
, a.event_end_dt
, a.round_time
, a.round_count
, a.hot_time
, a.config_id
, a.reward_group_id
, group_id
, event_id
, event_name
, repeat_type
, event_operation_time
, status
, event_start_dt
, event_end_dt
, round_time
, round_count
, hot_time
, config_id
, reward_group_id
FROM battle_event
WHERE (status = 'WAIT' or status = 'AUCTION_START' or status = 'RESV_START')
WHERE (status = 'WAIT' or status = 'RUNNING' or status = 'REGISTER')
AND deleted = 0
</select>

View File

@@ -157,7 +157,7 @@
</select>
<select id="getCountByGuid" parameterType="java.lang.String" resultType="java.lang.Integer">
SELECT COUNT(*) FROM black_list WHERE guid = #{guid} and STATUS &lt;&gt; 'EXPIRATION' AND deleted = 0
SELECT COUNT(*) FROM black_list WHERE guid = #{guid} and STATUS in ('INPROGRESS','WAIT') AND deleted = 0
</select>
<insert id="postBlackList" parameterType="com.caliverse.admin.domain.request.BlackListRequest">