유저부분 신규 dynamodb domain 방식으로변경
아이템 처리 관련 추가
This commit is contained in:
@@ -20,13 +20,13 @@ import java.util.Map;
|
|||||||
public class ItemsController {
|
public class ItemsController {
|
||||||
private final ItemsService itemsService;
|
private final ItemsService itemsService;
|
||||||
|
|
||||||
@GetMapping("/list")
|
@PostMapping("/list")
|
||||||
public ResponseEntity<ItemsResponse> findItems(
|
public ResponseEntity<ItemsResponse> findItems(
|
||||||
@RequestParam Map<String, String> requestParams){
|
@RequestBody ItemsRequest itemRequest){
|
||||||
return ResponseEntity.ok().body( itemsService.findItems(requestParams));
|
return ResponseEntity.ok().body( itemsService.findItems(itemRequest));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
public ResponseEntity<ItemDeleteResponse> postItemDelete(
|
public ResponseEntity<ItemDeleteResponse> postItemDelete(
|
||||||
@RequestBody ItemsRequest ItemDeleteRequest){
|
@RequestBody ItemsRequest ItemDeleteRequest){
|
||||||
return ResponseEntity.ok().body( itemsService.postItemDelete(ItemDeleteRequest));
|
return ResponseEntity.ok().body( itemsService.postItemDelete(ItemDeleteRequest));
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class Admin implements UserDetails{
|
|||||||
private LocalDateTime expiredDt;
|
private LocalDateTime expiredDt;
|
||||||
|
|
||||||
@JsonProperty("auth_level_type")
|
@JsonProperty("auth_level_type")
|
||||||
private EAuthAdminLevelType authLevelType;
|
private AuthAdminLevelType authLevelType;
|
||||||
|
|
||||||
/* 만료일 만 가져올려면 */
|
/* 만료일 만 가져올려면 */
|
||||||
/*@Column(name = "expired_dt")
|
/*@Column(name = "expired_dt")
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.caliverse.admin.domain.entity;
|
package com.caliverse.admin.domain.entity;
|
||||||
|
|
||||||
public enum EAuthAdminLevelType {
|
public enum AuthAdminLevelType {
|
||||||
None,
|
None,
|
||||||
Reader,
|
Reader,
|
||||||
Master,
|
Master,
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.caliverse.admin.domain.entity;
|
||||||
|
|
||||||
|
public enum EFilterOperator {
|
||||||
|
NONE,
|
||||||
|
EQUALS, // 같음
|
||||||
|
CONTAINS, // 포함
|
||||||
|
BEGINS_WITH, // 시작 문자
|
||||||
|
NOT_EQUALS // 같지 않음
|
||||||
|
}
|
||||||
@@ -55,6 +55,9 @@ public enum HISTORYTYPE {
|
|||||||
MENU_BANNER_ADD("메뉴 배너 등록"),
|
MENU_BANNER_ADD("메뉴 배너 등록"),
|
||||||
MENU_BANNER_UPDATE("메뉴 배너 수정"),
|
MENU_BANNER_UPDATE("메뉴 배너 수정"),
|
||||||
MENU_BANNER_DELETE("메뉴 배너 삭제"),
|
MENU_BANNER_DELETE("메뉴 배너 삭제"),
|
||||||
|
ITEM_UPDATE("아이템 수정"),
|
||||||
|
ITEM_DELETE("아이템 삭제"),
|
||||||
|
USER_ADMIN_AUTH_UPDATE("유저 관리자 권한 수정")
|
||||||
;
|
;
|
||||||
private String historyType;
|
private String historyType;
|
||||||
HISTORYTYPE(String type) {
|
HISTORYTYPE(String type) {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.caliverse.admin.domain.request;
|
package com.caliverse.admin.domain.request;
|
||||||
|
|
||||||
import com.caliverse.admin.domain.entity.ItemList;
|
import com.caliverse.admin.domain.entity.SEARCHTYPE;
|
||||||
|
import com.caliverse.admin.dynamodb.entity.KeyParam;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -12,34 +12,34 @@ import java.time.LocalDateTime;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class ItemsRequest {
|
public class ItemsRequest {
|
||||||
|
private SEARCHTYPE searchType;
|
||||||
|
private String searchData;
|
||||||
|
private KeyParam pageKey;
|
||||||
|
|
||||||
|
@JsonProperty("user_guid")
|
||||||
private String userGuid;
|
private String userGuid;
|
||||||
|
|
||||||
//guid
|
//guid
|
||||||
|
@JsonProperty("item_guid")
|
||||||
private String itemGuid;
|
private String itemGuid;
|
||||||
|
|
||||||
//아이템id
|
//아이템id
|
||||||
@JsonProperty("item_id")
|
@JsonProperty("item_id")
|
||||||
private String itemId;
|
private String itemId;
|
||||||
|
|
||||||
//아이템 수
|
|
||||||
@JsonProperty("item_count")
|
@JsonProperty("item_count")
|
||||||
private String itemCount;
|
private Integer itemCount;
|
||||||
|
@JsonProperty("delete_count")
|
||||||
|
private Integer deleteCount;
|
||||||
//아이템명
|
//아이템명
|
||||||
@JsonProperty("item_nm")
|
@JsonProperty("item_nm")
|
||||||
private String itemName;
|
private String itemName;
|
||||||
//상태
|
//상태
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
//복구가능여부
|
//복구가능여부
|
||||||
@JsonProperty("restore")
|
@JsonProperty("restore")
|
||||||
private String restoreType;
|
private String restoreType;
|
||||||
|
|
||||||
//생성 날짜
|
//생성 날짜
|
||||||
@JsonProperty("start_dt")
|
@JsonProperty("start_dt")
|
||||||
private LocalDateTime startDt;
|
private LocalDateTime startDt;
|
||||||
|
|
||||||
@JsonProperty("end_dt")
|
@JsonProperty("end_dt")
|
||||||
private LocalDateTime endDt;
|
private LocalDateTime endDt;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.caliverse.admin.domain.request;
|
|||||||
|
|
||||||
import com.caliverse.admin.domain.entity.SEARCHTYPE;
|
import com.caliverse.admin.domain.entity.SEARCHTYPE;
|
||||||
import com.caliverse.admin.domain.entity.WhiteList;
|
import com.caliverse.admin.domain.entity.WhiteList;
|
||||||
|
import com.caliverse.admin.dynamodb.entity.EAuthAdminLevelType;
|
||||||
import com.caliverse.admin.dynamodb.entity.KeyParam;
|
import com.caliverse.admin.dynamodb.entity.KeyParam;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
@@ -20,7 +21,7 @@ public class UsersRequest {
|
|||||||
@JsonProperty("new_nickname")
|
@JsonProperty("new_nickname")
|
||||||
private String newNickname;
|
private String newNickname;
|
||||||
@JsonProperty("admin_level")
|
@JsonProperty("admin_level")
|
||||||
private String adminLevel;
|
private EAuthAdminLevelType adminLevel;
|
||||||
|
|
||||||
@JsonProperty("mail_type")
|
@JsonProperty("mail_type")
|
||||||
private SEARCHTYPE mailType;
|
private SEARCHTYPE mailType;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class AdminResponse {
|
|||||||
private Long groupId;
|
private Long groupId;
|
||||||
|
|
||||||
@JsonProperty("auth_level_type")
|
@JsonProperty("auth_level_type")
|
||||||
private EAuthAdminLevelType authLevelType;
|
private AuthAdminLevelType authLevelType;
|
||||||
|
|
||||||
@JsonProperty("list")
|
@JsonProperty("list")
|
||||||
private List<Admin> adminList;
|
private List<Admin> adminList;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.caliverse.admin.domain.response;
|
package com.caliverse.admin.domain.response;
|
||||||
|
|
||||||
import com.caliverse.admin.domain.entity.ItemList;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -8,8 +7,6 @@ import lombok.Builder;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Builder
|
@Builder
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
package com.caliverse.admin.domain.response;
|
package com.caliverse.admin.domain.response;
|
||||||
|
|
||||||
import com.caliverse.admin.domain.entity.Item;
|
import com.caliverse.admin.domain.entity.ITEMLARGETYPE;
|
||||||
import com.caliverse.admin.domain.entity.ItemList;
|
import com.caliverse.admin.dynamodb.domain.doc.ItemDoc;
|
||||||
|
import com.caliverse.admin.dynamodb.entity.EInvenEquipType;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -9,7 +10,6 @@ import lombok.Builder;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -36,13 +36,38 @@ public class ItemsResponse {
|
|||||||
@JsonProperty("page_no")
|
@JsonProperty("page_no")
|
||||||
private int pageNo;
|
private int pageNo;
|
||||||
|
|
||||||
private ItemList item;
|
@JsonProperty("list")
|
||||||
private List<ItemList> list;
|
private List<Item> itemList;
|
||||||
|
|
||||||
private int totalCnt;
|
private int totalCnt;
|
||||||
private int resolve;
|
private int resolve;
|
||||||
private int unresolve;
|
private int unresolve;
|
||||||
private String rate;
|
private String rate;
|
||||||
|
private Map<String,String> pageKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public static class Item{
|
||||||
|
private Integer id;
|
||||||
|
@JsonProperty("user_guid")
|
||||||
|
private String userGuid;
|
||||||
|
@JsonProperty("item_guid")
|
||||||
|
private String itemGuid;
|
||||||
|
@JsonProperty("item_id")
|
||||||
|
private Integer itemId;
|
||||||
|
@JsonProperty("item_name")
|
||||||
|
private String itemName;
|
||||||
|
private Integer count;
|
||||||
|
private Integer level;
|
||||||
|
@JsonProperty("equip_type")
|
||||||
|
private EInvenEquipType equipType;
|
||||||
|
@JsonProperty("equiped_pos")
|
||||||
|
private Integer equipedPos;
|
||||||
|
@JsonProperty("item_type")
|
||||||
|
private ITEMLARGETYPE itemType;
|
||||||
|
@JsonProperty("create_dt")
|
||||||
|
private String createDt;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.caliverse.admin.domain.response;
|
|||||||
|
|
||||||
import com.caliverse.admin.domain.entity.FriendRequest;
|
import com.caliverse.admin.domain.entity.FriendRequest;
|
||||||
import com.caliverse.admin.domain.entity.LANGUAGETYPE;
|
import com.caliverse.admin.domain.entity.LANGUAGETYPE;
|
||||||
|
import com.caliverse.admin.dynamodb.entity.EAuthAdminLevelType;
|
||||||
import com.caliverse.admin.dynamodb.entity.ELanguageType;
|
import com.caliverse.admin.dynamodb.entity.ELanguageType;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
@@ -94,7 +95,7 @@ public class UsersResponse {
|
|||||||
private String walletUrl;
|
private String walletUrl;
|
||||||
// GM 타입
|
// GM 타입
|
||||||
@JsonProperty("admin_level")
|
@JsonProperty("admin_level")
|
||||||
private String adminLevel;
|
private EAuthAdminLevelType adminLevel;
|
||||||
//예비 슬롯
|
//예비 슬롯
|
||||||
@JsonProperty("spare_slot")
|
@JsonProperty("spare_slot")
|
||||||
private String spareSlot;
|
private String spareSlot;
|
||||||
@@ -277,8 +278,8 @@ public class UsersResponse {
|
|||||||
@Builder
|
@Builder
|
||||||
public static class Item{
|
public static class Item{
|
||||||
@JsonProperty("item_id")
|
@JsonProperty("item_id")
|
||||||
private String itemId;
|
private Integer itemId;
|
||||||
private Double count;
|
private Integer count;
|
||||||
@JsonProperty("item_name")
|
@JsonProperty("item_name")
|
||||||
private String itemName;
|
private String itemName;
|
||||||
@JsonProperty("item_guid")
|
@JsonProperty("item_guid")
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import com.caliverse.admin.dynamodb.domain.doc.LandAuctionActivityDoc;
|
|||||||
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionHighestBidUserDoc;
|
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionHighestBidUserDoc;
|
||||||
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRegistryDoc;
|
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRegistryDoc;
|
||||||
import com.caliverse.admin.dynamodb.entity.ELandAuctionResult;
|
import com.caliverse.admin.dynamodb.entity.ELandAuctionResult;
|
||||||
|
import com.caliverse.admin.dynamodb.service.DynamodbUserService;
|
||||||
import com.caliverse.admin.global.common.annotation.DynamoDBTransaction;
|
import com.caliverse.admin.global.common.annotation.DynamoDBTransaction;
|
||||||
import com.caliverse.admin.global.common.code.CommonCode;
|
import com.caliverse.admin.global.common.code.CommonCode;
|
||||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||||
@@ -65,6 +66,8 @@ public class DynamoDBService {
|
|||||||
private final DynamoDbEnhancedClient enhancedClient;
|
private final DynamoDbEnhancedClient enhancedClient;
|
||||||
private final DynamoDBOperations DynamoDBOperations;
|
private final DynamoDBOperations DynamoDBOperations;
|
||||||
|
|
||||||
|
private final DynamodbUserService dynamodbUserService;
|
||||||
|
|
||||||
private final AdminMapper adminMapper;
|
private final AdminMapper adminMapper;
|
||||||
private final MetaDataHandler metaDataHandler;
|
private final MetaDataHandler metaDataHandler;
|
||||||
//private final HistoryService historyService;
|
//private final HistoryService historyService;
|
||||||
@@ -76,12 +79,14 @@ public class DynamoDBService {
|
|||||||
HistoryService historyService,
|
HistoryService historyService,
|
||||||
MetaDataHandler metaDataHandler,
|
MetaDataHandler metaDataHandler,
|
||||||
DynamoDbEnhancedClient enhancedClient,
|
DynamoDbEnhancedClient enhancedClient,
|
||||||
DynamoDBOperations DynamoDBOperations) {
|
DynamoDBOperations DynamoDBOperations,
|
||||||
|
DynamodbUserService dynamodbUserService) {
|
||||||
this.dynamoDbClient = dynamoDbClient;
|
this.dynamoDbClient = dynamoDbClient;
|
||||||
this.adminMapper = adminMapper;
|
this.adminMapper = adminMapper;
|
||||||
this.metaDataHandler = metaDataHandler;
|
this.metaDataHandler = metaDataHandler;
|
||||||
this.enhancedClient = enhancedClient;
|
this.enhancedClient = enhancedClient;
|
||||||
this.DynamoDBOperations = DynamoDBOperations;
|
this.DynamoDBOperations = DynamoDBOperations;
|
||||||
|
this.dynamodbUserService = dynamodbUserService;
|
||||||
}
|
}
|
||||||
|
|
||||||
// guid check
|
// guid check
|
||||||
@@ -91,239 +96,6 @@ public class DynamoDBService {
|
|||||||
return item.isEmpty();
|
return item.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
// nickname > guid
|
|
||||||
public String getNickNameByGuid(String primaryKey) {
|
|
||||||
Map<String, Object> resMap = new HashMap<>();
|
|
||||||
Map<String, AttributeValue> key = new HashMap<>();
|
|
||||||
key.put("PK", AttributeValue.builder().s("user_nickname_registry#global").build());
|
|
||||||
key.put("SK", AttributeValue.builder().s(primaryKey.toLowerCase(Locale.ENGLISH)).build());
|
|
||||||
// GetItem 요청을 만듭니다.
|
|
||||||
GetItemRequest getItemRequest = GetItemRequest.builder()
|
|
||||||
.tableName(metaTable)
|
|
||||||
.key(key)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
try {
|
|
||||||
// GetItem 요청을 실행하고 응답을 받습니다.
|
|
||||||
GetItemResponse response = dynamoDbClient.getItem(getItemRequest);
|
|
||||||
|
|
||||||
// 응답에서 원하는 속성을 가져옵니다.
|
|
||||||
AttributeValue attributeValue = response.item().get("UserNicknameRegistryAttrib");
|
|
||||||
|
|
||||||
if (attributeValue != null) {
|
|
||||||
String attrJsonString = attributeValue.s();
|
|
||||||
// JSON 문자열을 파싱합니다.
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
JsonNode attrJson = objectMapper.readTree(attrJsonString);
|
|
||||||
|
|
||||||
// 원하는 필드를 추출합니다.
|
|
||||||
return attrJson.get("user_guid").asText();
|
|
||||||
|
|
||||||
}
|
|
||||||
return primaryKey;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("getNickNameByGuid exception: {}", e.getMessage());
|
|
||||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// guid > nickname
|
|
||||||
public String getGuidByName(String guid){
|
|
||||||
Map<String, AttributeValue> item = getItem("nickname#"+guid,"empty");
|
|
||||||
|
|
||||||
if(item.isEmpty()) return null;
|
|
||||||
|
|
||||||
Map<String, Object> attrMap = CommonUtils.stringByObject(item.get("NicknameAttrib").s());
|
|
||||||
|
|
||||||
return CommonUtils.objectToString(attrMap.get("nickname"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// guid > account_id
|
|
||||||
public String getGuidByAccountId(String guid){
|
|
||||||
Map<String, AttributeValue> item = getItem("user_base#"+guid,"empty");
|
|
||||||
|
|
||||||
if(item.isEmpty()) return null;
|
|
||||||
|
|
||||||
Map<String, Object> attrMap = CommonUtils.stringByObject(item.get("UserBaseAttrib").s());
|
|
||||||
|
|
||||||
return CommonUtils.objectToString(attrMap.get("account_id"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// account_id > guid
|
|
||||||
public String getAccountIdByGuid(Long id){
|
|
||||||
Map<String, AttributeValue> item = getItem("account_base#"+id,"empty");
|
|
||||||
|
|
||||||
if(item.isEmpty()) return null;
|
|
||||||
|
|
||||||
Map<String, Object> attrMap = CommonUtils.stringByObject(item.get("AccountBaseAttrib").s());
|
|
||||||
|
|
||||||
return CommonUtils.objectToString(attrMap.get("user_guid"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 유저 언어타입
|
|
||||||
public String getUserLanguage(String guid){
|
|
||||||
String account_id = getGuidByAccountId(guid);
|
|
||||||
Map<String, AttributeValue> item = getItem("account_base#" + account_id,"empty");
|
|
||||||
|
|
||||||
if(item.isEmpty()) return null;
|
|
||||||
|
|
||||||
Map<String, Object> attrMap = CommonUtils.stringByObject(item.get("AccountBaseAttrib").s());
|
|
||||||
|
|
||||||
return CommonUtils.objectToString(attrMap.get("language_type"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 유저조회 타입별 분기
|
|
||||||
public Map<String,String> findUsersBykey(String searchType, String searchKey){
|
|
||||||
Map<String, String> resultMap = new HashMap<>();
|
|
||||||
Map<String, AttributeValue> key = new HashMap<>();
|
|
||||||
try {
|
|
||||||
if(searchType.equals(SEARCHTYPE.NAME.name())){
|
|
||||||
return getUsersByName(searchKey.toLowerCase()); //nickname은 무조건 소문자
|
|
||||||
}else if(searchType.equals(SEARCHTYPE.GUID.name())){
|
|
||||||
return getUsersByGuid(searchKey);
|
|
||||||
}else if(searchType.equals(SEARCHTYPE.ACCOUNT.name())){
|
|
||||||
return getUsersByAccountId(searchKey);
|
|
||||||
}
|
|
||||||
//else if(searchType.equals(SEARCHTYPE.TEMP_DATA.name())){
|
|
||||||
// return historyService.insertTempMetaData();
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
return resultMap;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("findUsersBykey exception: {}", e.getMessage());
|
|
||||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 유저조회 닉네임
|
|
||||||
// return guid, 닉네임
|
|
||||||
public Map<String, String> getUsersByName(String searchKey){
|
|
||||||
Map<String,String> resultMap = null;
|
|
||||||
|
|
||||||
QueryRequest queryRequest = QueryRequest.builder()
|
|
||||||
.tableName(metaTable)
|
|
||||||
.keyConditionExpression("PK = :pkValue AND SK = :skValue") // 파티션 키와 조건식 설정
|
|
||||||
// .expressionAttributeValues(Map.of(":pkValue", AttributeValue.builder().s("nickname#"+searchKey).build()
|
|
||||||
// ,":skValue", AttributeValue.builder().s("nickname#").build()))
|
|
||||||
.expressionAttributeValues(Map.of(":pkValue", AttributeValue.builder().s("user_nickname_registry#global").build()
|
|
||||||
,":skValue", AttributeValue.builder().s(searchKey).build()))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
try{
|
|
||||||
// 쿼리 실행
|
|
||||||
QueryResponse response = dynamoDbClient.query(queryRequest);
|
|
||||||
|
|
||||||
// 응답에서 원하는 속성을 가져옵니다.
|
|
||||||
for (Map<String, AttributeValue> item : response.items()) {
|
|
||||||
// AttributeValue attrValue = item.get("Attr");
|
|
||||||
AttributeValue attrValue = item.get("UserNicknameRegistryAttrib");
|
|
||||||
if (attrValue != null) {
|
|
||||||
resultMap = new HashMap<>();
|
|
||||||
// "Attr" 속성의 값을 읽어옵니다.
|
|
||||||
String attrJson = attrValue.s();
|
|
||||||
|
|
||||||
// JSON 문자열을 파싱하여 Map 또는 다른 객체로 변환합니다.
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
Map<String, Object> attrMap = objectMapper.readValue(attrJson, new TypeReference<Map<String, Object>>() {
|
|
||||||
});
|
|
||||||
|
|
||||||
// resultMap.put("guid", (String) attrMap.get("AccountGuid"));
|
|
||||||
// resultMap.put("nickname", (String) attrMap.get("AccountId"));
|
|
||||||
resultMap.put("guid", (String) attrMap.get("user_guid"));
|
|
||||||
resultMap.put("nickname", searchKey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return resultMap;
|
|
||||||
}catch (Exception e){
|
|
||||||
log.error("getUsersByName exception: {}", e.getMessage());
|
|
||||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// 유저조회 guid
|
|
||||||
// return guid, account_id
|
|
||||||
public Map<String, String> getUsersByGuid(String searchKey){
|
|
||||||
Map<String,String> resultMap = null;
|
|
||||||
|
|
||||||
QueryRequest queryRequest = QueryRequest.builder()
|
|
||||||
.tableName(metaTable)
|
|
||||||
.keyConditionExpression("PK = :pkValue AND SK = :skValue") // 파티션 키와 조건식 설정
|
|
||||||
.expressionAttributeValues(Map.of(":pkValue", AttributeValue.builder().s("user_base#"+searchKey).build()
|
|
||||||
,":skValue", AttributeValue.builder().s("empty").build()))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
try{
|
|
||||||
// 쿼리 실행
|
|
||||||
QueryResponse response = dynamoDbClient.query(queryRequest);
|
|
||||||
|
|
||||||
// 응답에서 원하는 속성을 가져옵니다.
|
|
||||||
for (Map<String, AttributeValue> item : response.items()) {
|
|
||||||
AttributeValue attrValue = item.get("UserBaseAttrib");
|
|
||||||
if (attrValue != null) {
|
|
||||||
resultMap = new HashMap<>();
|
|
||||||
// "Attr" 속성의 값을 읽어옵니다.
|
|
||||||
String attrJson = attrValue.s();
|
|
||||||
|
|
||||||
// JSON 문자열을 파싱하여 Map 또는 다른 객체로 변환합니다.
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
Map<String, Object> attrMap = objectMapper.readValue(attrJson, new TypeReference<Map<String, Object>>() {
|
|
||||||
});
|
|
||||||
|
|
||||||
resultMap.put("guid", searchKey);
|
|
||||||
resultMap.put("nickname", (String) attrMap.get("account_id"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return resultMap;
|
|
||||||
}catch (Exception e){
|
|
||||||
log.error("getUsersByGuid exception: {}", e.getMessage());
|
|
||||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//유저조회 account_id
|
|
||||||
//return guid, account_id
|
|
||||||
public Map<String, String> getUsersByAccountId(String searchKey){
|
|
||||||
Map<String,String> resultMap = null;
|
|
||||||
|
|
||||||
QueryRequest queryRequest = QueryRequest.builder()
|
|
||||||
.tableName(metaTable)
|
|
||||||
.keyConditionExpression("PK = :pkValue AND SK = :skValue") // 파티션 키와 조건식 설정
|
|
||||||
.expressionAttributeValues(Map.of(":pkValue", AttributeValue.builder().s("account_base#"+searchKey).build()
|
|
||||||
,":skValue", AttributeValue.builder().s("empty").build()))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
try{
|
|
||||||
// 쿼리 실행
|
|
||||||
QueryResponse response = dynamoDbClient.query(queryRequest);
|
|
||||||
|
|
||||||
// 응답에서 원하는 속성을 가져옵니다.
|
|
||||||
for (Map<String, AttributeValue> item : response.items()) {
|
|
||||||
AttributeValue attrValue = item.get("AccountBaseAttrib");
|
|
||||||
if (attrValue != null) {
|
|
||||||
resultMap = new HashMap<>();
|
|
||||||
// "Attr" 속성의 값을 읽어옵니다.
|
|
||||||
String attrJson = attrValue.s();
|
|
||||||
|
|
||||||
// JSON 문자열을 파싱하여 Map 또는 다른 객체로 변환합니다.
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
Map<String, Object> attrMap = objectMapper.readValue(attrJson, new TypeReference<Map<String, Object>>() {
|
|
||||||
});
|
|
||||||
|
|
||||||
resultMap.put("guid", (String) attrMap.get("user_guid"));
|
|
||||||
resultMap.put("nickname", (String) attrMap.get("account_id"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return resultMap;
|
|
||||||
}catch (Exception e){
|
|
||||||
log.error("getUsersByAccountId exception: {}", e.getMessage());
|
|
||||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// public Map<String, Object> getAccountInfo(String guid){
|
// public Map<String, Object> getAccountInfo(String guid){
|
||||||
// Map<String, Object> resMap = new HashMap<>();
|
// Map<String, Object> resMap = new HashMap<>();
|
||||||
@@ -371,45 +143,6 @@ public class DynamoDBService {
|
|||||||
// } catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||||
// }
|
// }
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 유저조회 - 기본정보
|
|
||||||
// public Map<String, Object> getCharInfo(String guid){
|
|
||||||
// Map<String, Object> resMap = new HashMap<>();
|
|
||||||
//
|
|
||||||
// String key = "PK = :pkValue AND SK = :skValue";
|
|
||||||
// Map<String, AttributeValue> values = Map.of(":pkValue", AttributeValue.builder().s("money#"+guid).build()
|
|
||||||
// ,":skValue", AttributeValue.builder().s("empty").build());
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// // 쿼리 실행
|
|
||||||
// QueryResponse response = executeQuery(key, values);
|
|
||||||
//
|
|
||||||
// // 응답에서 원하는 속성을 가져옵니다.
|
|
||||||
// for (Map<String, AttributeValue> item : response.items()) {
|
|
||||||
//
|
|
||||||
// //캐릭터 CharInfo 조회
|
|
||||||
// AttributeValue charValue = item.get("MoneyAttrib");
|
|
||||||
// if (charValue != null) {
|
|
||||||
// // "Attr" 속성의 값을 읽어옵니다.
|
|
||||||
// Map<String, AttributeValue> attrMap = charValue.m();
|
|
||||||
//
|
|
||||||
// resMap.put("charInfo", UsersResponse.CharInfo.builder()
|
|
||||||
// .characterName(getGuidByName(guid))
|
|
||||||
// .level(CommonUtils.objectToString(null))
|
|
||||||
// .goldCali(CommonUtils.objectToString(attrMap.get("gold").n()))
|
|
||||||
// .redCali(CommonUtils.objectToString(attrMap.get("calium").n()))
|
|
||||||
// .blackCali(CommonUtils.objectToString(attrMap.get("ruby").n()))
|
|
||||||
// .blueCali(CommonUtils.objectToString(attrMap.get("sapphire").n()))
|
|
||||||
// .build());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// log.info("getCharInfo CharInfo: {}", resMap);
|
|
||||||
//
|
|
||||||
// return resMap;
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
|
||||||
// }
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// 유저조회 - 아바타
|
// 유저조회 - 아바타
|
||||||
@@ -494,67 +227,6 @@ public class DynamoDBService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//guid 로 item 테이블 조회
|
|
||||||
public Map<String, Object> getItemTable(String guid){
|
|
||||||
QueryRequest queryRequest = QueryRequest.builder()
|
|
||||||
.tableName(metaTable)
|
|
||||||
.keyConditionExpression("PK = :pkValue AND SK = :skValue") // 파티션 키와 조건식 설정
|
|
||||||
.expressionAttributeValues(
|
|
||||||
Map.of(":pkValue", AttributeValue.builder().s("item#"+guid).build()
|
|
||||||
,":skValue", AttributeValue.builder().s("item#"+guid).build()))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
try {
|
|
||||||
// 쿼리 실행
|
|
||||||
QueryResponse response = dynamoDbClient.query(queryRequest);
|
|
||||||
|
|
||||||
// 응답에서 원하는 속성을 가져옵니다.
|
|
||||||
for (Map<String, AttributeValue> item : response.items()) {
|
|
||||||
AttributeValue attrValue = item.get("Attr");
|
|
||||||
if (attrValue != null) {
|
|
||||||
// "Attr" 속성의 값을 읽어옵니다.
|
|
||||||
String attrJson = attrValue.s();
|
|
||||||
|
|
||||||
// JSON 문자열을 파싱하여 Map 또는 다른 객체로 변환합니다.
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
// JSON 문자열을 Map으로 파싱
|
|
||||||
Map<String, Object> attrMap = objectMapper.readValue(attrJson, new TypeReference<Map<String, Object>>() {});
|
|
||||||
|
|
||||||
return attrMap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void insertUpdateData(String guid, String type, boolean flag) {
|
|
||||||
|
|
||||||
// 업데이트할 데이터 맵 생성
|
|
||||||
Map<String, AttributeValue> key = new HashMap<>();
|
|
||||||
key.put("PK", AttributeValue.builder().s("char#"+guid).build());
|
|
||||||
key.put("SK", AttributeValue.builder().s("char#"+guid).build());
|
|
||||||
|
|
||||||
Map<String, AttributeValueUpdate> attributeUpdates = new HashMap<>();
|
|
||||||
|
|
||||||
attributeUpdates.put(type, AttributeValueUpdate.builder()
|
|
||||||
.action(AttributeAction.PUT)
|
|
||||||
.value(AttributeValue.builder().bool(flag).build())
|
|
||||||
.build());
|
|
||||||
|
|
||||||
// UpdateItem 요청 작성
|
|
||||||
UpdateItemRequest updateItemRequest = UpdateItemRequest.builder()
|
|
||||||
.tableName(metaTable)
|
|
||||||
.key(key)
|
|
||||||
.attributeUpdates(attributeUpdates)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
// 데이터 업데이트 또는 인서트 요청
|
|
||||||
dynamoDbClient.updateItem(updateItemRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
// dynamoDB 쿼리 리턴
|
// dynamoDB 쿼리 리턴
|
||||||
public QueryResponse executeQuery(String key, Map<String, AttributeValue> values) {
|
public QueryResponse executeQuery(String key, Map<String, AttributeValue> values) {
|
||||||
QueryRequest getItemRequest = QueryRequest.builder()
|
QueryRequest getItemRequest = QueryRequest.builder()
|
||||||
@@ -634,107 +306,6 @@ public class DynamoDBService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateBlockUserStart(BlackList blockUser){
|
|
||||||
try{
|
|
||||||
String accountId = getGuidByAccountId(blockUser.getGuid());
|
|
||||||
SANCTIONS reasonType = blockUser.getSanctions();
|
|
||||||
// SANCTIONSTYPE policyType = blockUser.getType();
|
|
||||||
// List<SANCTIONSTYPE> listPolicyType = new ArrayList<>();
|
|
||||||
// listPolicyType.add(policyType);
|
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSSSSS");
|
|
||||||
String startTime = blockUser.getStartDt().format(formatter);
|
|
||||||
String endTime = blockUser.getEndDt().format(formatter);
|
|
||||||
|
|
||||||
Map<String, AttributeValue> item = getItem("account_base#" + accountId,"empty");
|
|
||||||
|
|
||||||
String InfoJson = item.get("AccountBaseAttrib").s();
|
|
||||||
log.info("updateBlockUserStart Before AccountBaseAttrib: {}", InfoJson);
|
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
JsonNode infoNode = objectMapper.readTree(InfoJson);
|
|
||||||
|
|
||||||
((ObjectNode) infoNode).put("block_start_datetime", startTime);
|
|
||||||
((ObjectNode) infoNode).put("block_end_datetime", endTime);
|
|
||||||
ArrayNode policyArray = objectMapper.createArrayNode();
|
|
||||||
policyArray.add(blockUser.getType().toString());
|
|
||||||
((ObjectNode) infoNode).set("block_policy", policyArray);
|
|
||||||
// ((ObjectNode) infoNode).put("block_policy", listPolicyType.toString());
|
|
||||||
((ObjectNode) infoNode).put("block_reason", reasonType.toString());
|
|
||||||
|
|
||||||
String updatedInfoJson = infoNode.toString();
|
|
||||||
String nowDateTime = LocalDateTime.now().format(formatter);
|
|
||||||
log.info("updateBlockUserStart Tobe AccountBaseAttrib: {}", updatedInfoJson);
|
|
||||||
|
|
||||||
Map<String, AttributeValue> expressionAttributeValues = new HashMap<>();
|
|
||||||
expressionAttributeValues.put(":newAttrib", AttributeValue.builder().s(updatedInfoJson).build());
|
|
||||||
expressionAttributeValues.put(":nowDate", AttributeValue.builder().s(nowDateTime).build());
|
|
||||||
|
|
||||||
String updateExpression = "SET AccountBaseAttrib = :newAttrib, UpdatedDateTime = :nowDate";
|
|
||||||
|
|
||||||
UpdateItemRequest updateRequest = UpdateItemRequest.builder()
|
|
||||||
.tableName(metaTable)
|
|
||||||
.key(Map.of(
|
|
||||||
"PK", AttributeValue.builder().s("account_base#" + accountId).build(),
|
|
||||||
"SK", AttributeValue.builder().s("empty").build()))
|
|
||||||
.updateExpression(updateExpression)
|
|
||||||
.expressionAttributeValues(expressionAttributeValues)
|
|
||||||
.returnValues(ReturnValue.ALL_NEW) // 업데이트 후의 값을 반환하려면 지정
|
|
||||||
.build();
|
|
||||||
|
|
||||||
|
|
||||||
dynamoDbClient.updateItem(updateRequest);
|
|
||||||
}catch(Exception e){
|
|
||||||
log.error("updateBlockUserStart: " + e.getMessage());
|
|
||||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateBlockUserEnd(String guid){
|
|
||||||
try{
|
|
||||||
String accountId = getGuidByAccountId(guid);
|
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSSSSS");
|
|
||||||
String endTime = LocalDateTime.of(9999, 12, 31, 23, 59, 59, 999999900).format(formatter);
|
|
||||||
|
|
||||||
Map<String, AttributeValue> item = getItem("account_base#" + accountId,"empty");
|
|
||||||
|
|
||||||
String InfoJson = item.get("AccountBaseAttrib").s();
|
|
||||||
log.info("updateBlockUserEnd Before AccountBaseAttrib: {}", InfoJson);
|
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
JsonNode infoNode = objectMapper.readTree(InfoJson);
|
|
||||||
|
|
||||||
((ObjectNode) infoNode).put("block_start_datetime", endTime);
|
|
||||||
((ObjectNode) infoNode).put("block_end_datetime", endTime);
|
|
||||||
((ObjectNode) infoNode).put("block_policy", new ArrayList<>().toString());
|
|
||||||
((ObjectNode) infoNode).put("block_reason", "");
|
|
||||||
|
|
||||||
String updatedInfoJson = infoNode.toString();
|
|
||||||
String nowDateTime = LocalDateTime.now().format(formatter);
|
|
||||||
log.info("updateBlockUserEnd Tobe AccountBaseAttrib: {}", updatedInfoJson);
|
|
||||||
|
|
||||||
Map<String, AttributeValue> expressionAttributeValues = new HashMap<>();
|
|
||||||
expressionAttributeValues.put(":newAttrib", AttributeValue.builder().s(updatedInfoJson).build());
|
|
||||||
expressionAttributeValues.put(":nowDate", AttributeValue.builder().s(nowDateTime).build());
|
|
||||||
|
|
||||||
String updateExpression = "SET AccountBaseAttrib = :newAttrib, UpdatedDateTime = :nowDate";
|
|
||||||
|
|
||||||
UpdateItemRequest updateRequest = UpdateItemRequest.builder()
|
|
||||||
.tableName(metaTable)
|
|
||||||
.key(Map.of(
|
|
||||||
"PK", AttributeValue.builder().s("account_base#" + accountId).build(),
|
|
||||||
"SK", AttributeValue.builder().s("empty").build()))
|
|
||||||
.updateExpression(updateExpression)
|
|
||||||
.expressionAttributeValues(expressionAttributeValues)
|
|
||||||
.returnValues(ReturnValue.ALL_NEW) // 업데이트 후의 값을 반환하려면 지정
|
|
||||||
.build();
|
|
||||||
|
|
||||||
dynamoDbClient.updateItem(updateRequest);
|
|
||||||
}catch(Exception e){
|
|
||||||
log.error("updateBlockUserEnd: {}", e.getMessage());
|
|
||||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 닉네임 변경
|
// 닉네임 변경
|
||||||
public void updateNickname(String guid,String nickname,String newNickname){
|
public void updateNickname(String guid,String nickname,String newNickname){
|
||||||
try{
|
try{
|
||||||
@@ -753,49 +324,6 @@ public class DynamoDBService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GM 권한 변경
|
|
||||||
public void updateAdminLevel(String guid, String type){
|
|
||||||
AuthAdminLevelType adminLevel = RabbitMqUtils.getUserAdminLevelType(type);
|
|
||||||
|
|
||||||
try{
|
|
||||||
String accountId = getGuidByAccountId(guid);
|
|
||||||
Map<String, AttributeValue> item = getItem("account_base#" + accountId, "empty");
|
|
||||||
|
|
||||||
String InfoJson = item.get("AccountBaseAttrib").s();
|
|
||||||
log.info("updateAdminLevel Before AccountBaseAttrib: {}", InfoJson);
|
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
JsonNode infoNode = objectMapper.readTree(InfoJson);
|
|
||||||
|
|
||||||
((ObjectNode) infoNode).put("auth_amdin_level_type", adminLevel.getNumber());
|
|
||||||
|
|
||||||
String updatedInfoJson = infoNode.toString();
|
|
||||||
log.info("updateAdminLevel Tobe AccountBaseAttrib: {}", updatedInfoJson);
|
|
||||||
|
|
||||||
Map<String, AttributeValue> expressionAttributeValues = new HashMap<>();
|
|
||||||
expressionAttributeValues.put(":newAttrib", AttributeValue.builder().s(updatedInfoJson).build());
|
|
||||||
|
|
||||||
String updateExpression = "SET AccountBaseAttrib = :newAttrib";
|
|
||||||
|
|
||||||
UpdateItemRequest updateRequest = UpdateItemRequest.builder()
|
|
||||||
.tableName(metaTable)
|
|
||||||
.key(Map.of(
|
|
||||||
"PK", AttributeValue.builder().s("account_base#" + accountId).build(),
|
|
||||||
"SK", AttributeValue.builder().s("empty").build()))
|
|
||||||
.updateExpression(updateExpression)
|
|
||||||
.expressionAttributeValues(expressionAttributeValues)
|
|
||||||
.returnValues(ReturnValue.ALL_NEW) // 업데이트 후의 값을 반환하려면 지정
|
|
||||||
.build();
|
|
||||||
|
|
||||||
|
|
||||||
dynamoDbClient.updateItem(updateRequest);
|
|
||||||
}catch (Exception e){
|
|
||||||
log.error("updateAdminLevel: {}", e.getMessage());
|
|
||||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage() );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateCharInfo(String guid, String newNickname) throws JsonProcessingException {
|
public void updateCharInfo(String guid, String newNickname) throws JsonProcessingException {
|
||||||
|
|
||||||
// 기존 CharInfo 값 가져오기
|
// 기존 CharInfo 값 가져오기
|
||||||
@@ -832,6 +360,7 @@ public class DynamoDBService {
|
|||||||
|
|
||||||
dynamoDbClient.updateItem(updateRequest);
|
dynamoDbClient.updateItem(updateRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createNewNickName(String guid, String newNickname) {
|
public void createNewNickName(String guid, String newNickname) {
|
||||||
String attrJson = String.format("{\"AccountGuid\":\"%s\",\"AccountId\":\"%s\"}", guid, newNickname);
|
String attrJson = String.format("{\"AccountGuid\":\"%s\",\"AccountId\":\"%s\"}", guid, newNickname);
|
||||||
|
|
||||||
@@ -1180,61 +709,61 @@ public class DynamoDBService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//아이템 내역 조회
|
//아이템 내역 조회
|
||||||
public List<ItemList> getItems(String guid){
|
// public List<ItemList> getItems(String guid){
|
||||||
List<ItemList> list = new ArrayList<>();
|
// List<ItemList> list = new ArrayList<>();
|
||||||
|
//
|
||||||
String key = "PK = :pkValue";
|
// String key = "PK = :pkValue";
|
||||||
Map<String, AttributeValue> values = Map.of(":pkValue", AttributeValue.builder().s("item#"+guid).build());
|
// Map<String, AttributeValue> values = Map.of(":pkValue", AttributeValue.builder().s("item#"+guid).build());
|
||||||
|
//
|
||||||
// QueryRequest queryRequest = QueryRequest.builder()
|
//// QueryRequest queryRequest = QueryRequest.builder()
|
||||||
// .tableName(metaTable)
|
//// .tableName(metaTable)
|
||||||
// .keyConditionExpression("PK = :pkValue") // 파티션 키와 조건식 설정
|
//// .keyConditionExpression("PK = :pkValue") // 파티션 키와 조건식 설정
|
||||||
// .expressionAttributeValues(Map.of(":pkValue", AttributeValue.builder().s("item#"+guid).build()))
|
//// .expressionAttributeValues(Map.of(":pkValue", AttributeValue.builder().s("item#"+guid).build()))
|
||||||
// .build();
|
//// .build();
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
// 쿼리 실행
|
// // 쿼리 실행
|
||||||
QueryResponse response = executeQuery(key, values);
|
// QueryResponse response = executeQuery(key, values);
|
||||||
|
//
|
||||||
int row = 1;
|
// int row = 1;
|
||||||
// 응답에서 원하는 속성을 가져옵니다.
|
// // 응답에서 원하는 속성을 가져옵니다.
|
||||||
for (Map<String, AttributeValue> item : response.items()) {
|
// for (Map<String, AttributeValue> item : response.items()) {
|
||||||
AttributeValue attrValue = item.get("ItemAttrib");
|
// AttributeValue attrValue = item.get("ItemAttrib");
|
||||||
if (attrValue != null) {
|
// if (attrValue != null) {
|
||||||
// "Attr" 속성의 값을 읽어옵니다.
|
// // "Attr" 속성의 값을 읽어옵니다.
|
||||||
String attrJson = attrValue.s();
|
// String attrJson = attrValue.s();
|
||||||
|
//
|
||||||
// JSON 문자열을 파싱하여 Map 또는 다른 객체로 변환합니다.
|
// // JSON 문자열을 파싱하여 Map 또는 다른 객체로 변환합니다.
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
// ObjectMapper objectMapper = new ObjectMapper();
|
||||||
Map<String, Object> attrMap = objectMapper.readValue(attrJson, new TypeReference<Map<String, Object>>() {
|
// Map<String, Object> attrMap = objectMapper.readValue(attrJson, new TypeReference<Map<String, Object>>() {
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
String item_nm = metaDataHandler.getMetaItemNameData(CommonUtils.objectToInteger(attrMap.get("item_meta_id")));
|
// String item_nm = metaDataHandler.getMetaItemNameData(CommonUtils.objectToInteger(attrMap.get("item_meta_id")));
|
||||||
ItemList itemInfo = ItemList.builder()
|
// ItemList itemInfo = ItemList.builder()
|
||||||
.rowNum((long) row)
|
// .rowNum((long) row)
|
||||||
.guid(guid)
|
// .guid(guid)
|
||||||
.itemId(attrMap.get("item_meta_id").toString())
|
// .itemId(attrMap.get("item_meta_id").toString())
|
||||||
.itemName(metaDataHandler.getTextStringData(item_nm))
|
// .itemName(metaDataHandler.getTextStringData(item_nm))
|
||||||
.status(ItemList.STATUS.PERMITTED)
|
// .status(ItemList.STATUS.PERMITTED)
|
||||||
.restoreType("")
|
// .restoreType("")
|
||||||
.createBy(item.get("CreatedDateTime").s()).build();
|
// .createBy(item.get("CreatedDateTime").s()).build();
|
||||||
|
//
|
||||||
list.add(itemInfo);
|
// list.add(itemInfo);
|
||||||
|
//
|
||||||
row++;
|
// row++;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
log.info("getItems Response ItemInfo: {}", list);
|
// log.info("getItems Response ItemInfo: {}", list);
|
||||||
}
|
// }
|
||||||
catch (JsonProcessingException jpe){
|
// catch (JsonProcessingException jpe){
|
||||||
log.error("getItems JsonProcessingException: {}", jpe.getMessage());
|
// log.error("getItems JsonProcessingException: {}", jpe.getMessage());
|
||||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||||
}catch (Exception e){
|
// }catch (Exception e){
|
||||||
log.error("getItems: {}", e.getMessage());
|
// log.error("getItems: {}", e.getMessage());
|
||||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||||
}
|
// }
|
||||||
return list;
|
// return list;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//아이템 - 의상 조회
|
//아이템 - 의상 조회
|
||||||
public Map<String, Object> getCloth(String guid){
|
public Map<String, Object> getCloth(String guid){
|
||||||
@@ -1360,9 +889,9 @@ public class DynamoDBService {
|
|||||||
String item_type = metaDataHandler.getMetaItemLargeTypeData(item_id);
|
String item_type = metaDataHandler.getMetaItemLargeTypeData(item_id);
|
||||||
|
|
||||||
UsersResponse.Item inventory = UsersResponse.Item.builder()
|
UsersResponse.Item inventory = UsersResponse.Item.builder()
|
||||||
.itemId(CommonUtils.objectToString(item_id))
|
.itemId(item_id)
|
||||||
.itemName(item_nm)
|
.itemName(item_nm)
|
||||||
.count(CommonUtils.objectToDouble(attrMap.get("item_stack_count")))
|
.count(CommonUtils.objectToInteger(attrMap.get("item_stack_count")))
|
||||||
.itemGuid(CommonUtils.objectToString(attrMap.get("item_guid")))
|
.itemGuid(CommonUtils.objectToString(attrMap.get("item_guid")))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -1396,55 +925,6 @@ public class DynamoDBService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 유저 조회 - 메일
|
|
||||||
public List<UsersResponse.Mail> getMail(String guid, String type){
|
|
||||||
List<UsersResponse.Mail> resList = new ArrayList<>();
|
|
||||||
|
|
||||||
String key = "PK = :pkValue";
|
|
||||||
Map<String, AttributeValue> values = null;
|
|
||||||
if(type.equals(SEARCHTYPE.SEND.name())){
|
|
||||||
values = Map.of(":pkValue", AttributeValue.builder().s("sent_mail#"+guid).build());
|
|
||||||
}else{
|
|
||||||
values = Map.of(":pkValue", AttributeValue.builder().s("recv_mail#"+guid).build());
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
excuteItems(executeQuery(key, values), "MailAttrib")
|
|
||||||
.forEach(attrMap -> {
|
|
||||||
List<UsersResponse.MailItem> itemList = new ArrayList<>();
|
|
||||||
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.objectToDouble(val.get("Count")));
|
|
||||||
String item_nm = metaDataHandler.getMetaItemNameData(CommonUtils.objectToInteger(val.get("ItemId")));
|
|
||||||
item.setItemName(metaDataHandler.getTextStringData(item_nm));
|
|
||||||
itemList.add(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
UsersResponse.Mail mail = UsersResponse.Mail.builder()
|
|
||||||
.mailGuid(CommonUtils.objectToString(attrMap.get("mail_guid")))
|
|
||||||
.createDt(CommonUtils.objectToString(attrMap.get("create_time")))
|
|
||||||
.title(CommonUtils.objectToString(attrMap.get("title")))
|
|
||||||
.content(CommonUtils.objectToString(attrMap.get("text")))
|
|
||||||
.receiveNickname(CommonUtils.objectToString(attrMap.get("receiver_nickname")))
|
|
||||||
.senderNickname(CommonUtils.objectToString(attrMap.get("sender_nickname")))
|
|
||||||
.isGetItem((boolean)attrMap.get("is_get_item"))
|
|
||||||
.status((boolean) attrMap.get("is_read"))
|
|
||||||
.isSystemMail((boolean) attrMap.get("is_system_mail"))
|
|
||||||
.mailItemList(itemList)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
resList.add(mail);
|
|
||||||
});
|
|
||||||
log.info("getMail Response MailInfo: {}", resList);
|
|
||||||
|
|
||||||
return resList;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("getMail: {}", e.getMessage());
|
|
||||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 유저 조회 - 우편 삭제
|
// 유저 조회 - 우편 삭제
|
||||||
public String deleteMail(String type, String guid, String mail_guid) {
|
public String deleteMail(String type, String guid, String mail_guid) {
|
||||||
Map<String, AttributeValue> itemAttributes = new HashMap<>();
|
Map<String, AttributeValue> itemAttributes = new HashMap<>();
|
||||||
@@ -1559,78 +1039,78 @@ public class DynamoDBService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 아이템 삭제
|
// 아이템 삭제
|
||||||
public String deleteItem(String guid, String item_guid) {
|
// public String deleteItem(String guid, String item_guid) {
|
||||||
Map<String, AttributeValue> itemAttributes = new HashMap<>();
|
// Map<String, AttributeValue> itemAttributes = new HashMap<>();
|
||||||
itemAttributes.put("PK", AttributeValue.builder().s("item#" + guid).build());
|
// itemAttributes.put("PK", AttributeValue.builder().s("item#" + guid).build());
|
||||||
itemAttributes.put("SK", AttributeValue.builder().s(item_guid).build());
|
// itemAttributes.put("SK", AttributeValue.builder().s(item_guid).build());
|
||||||
try {
|
// try {
|
||||||
Map<String, AttributeValue> item = getItem("item#" + guid, item_guid);
|
// Map<String, AttributeValue> item = getItem("item#" + guid, item_guid);
|
||||||
log.info("deleteItem PK: {}, SK: {}", "item#" + guid, item_guid);
|
// log.info("deleteItem PK: {}, SK: {}", "item#" + guid, item_guid);
|
||||||
|
//
|
||||||
DeleteItemRequest request = DeleteItemRequest.builder()
|
// DeleteItemRequest request = DeleteItemRequest.builder()
|
||||||
.tableName(metaTable)
|
// .tableName(metaTable)
|
||||||
.key(itemAttributes)
|
// .key(itemAttributes)
|
||||||
.build();
|
// .build();
|
||||||
|
//
|
||||||
DeleteItemResponse response = dynamoDbClient.deleteItem(request);
|
// DeleteItemResponse response = dynamoDbClient.deleteItem(request);
|
||||||
|
//
|
||||||
if(response.sdkHttpResponse().isSuccessful())
|
// if(response.sdkHttpResponse().isSuccessful())
|
||||||
return item.toString();
|
// return item.toString();
|
||||||
|
//
|
||||||
return "";
|
// return "";
|
||||||
}catch (ConditionalCheckFailedException e) {
|
// }catch (ConditionalCheckFailedException e) {
|
||||||
log.error("deleteItem Conditional check failed: {}", e.getMessage());
|
// log.error("deleteItem Conditional check failed: {}", e.getMessage());
|
||||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||||
}catch(Exception e){
|
// }catch(Exception e){
|
||||||
log.error("deleteItem: {}", e.getMessage());
|
// log.error("deleteItem: {}", e.getMessage());
|
||||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 아이템 정보 수정
|
// 아이템 정보 수정
|
||||||
public JSONObject updateItem(String guid, String item_guid, int cnt) {
|
// public JSONObject updateItem(String guid, String item_guid, int cnt) {
|
||||||
try{
|
// try{
|
||||||
|
//
|
||||||
Map<String, AttributeValue> item = getItem("item#" + guid, item_guid);
|
// Map<String, AttributeValue> item = getItem("item#" + guid, item_guid);
|
||||||
|
//
|
||||||
String InfoJson = item.get("ItemAttrib").s();
|
// String InfoJson = item.get("ItemAttrib").s();
|
||||||
|
//
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
// ObjectMapper objectMapper = new ObjectMapper();
|
||||||
JsonNode infoNode = objectMapper.readTree(InfoJson);
|
// JsonNode infoNode = objectMapper.readTree(InfoJson);
|
||||||
log.info("updateItem Before UpdateInfo : {}", infoNode.toString());
|
// log.info("updateItem Before UpdateInfo : {}", infoNode.toString());
|
||||||
|
//
|
||||||
((ObjectNode) infoNode).put("item_stack_count", cnt);
|
// ((ObjectNode) infoNode).put("item_stack_count", cnt);
|
||||||
|
//
|
||||||
String updatedInfoJson = infoNode.toString();
|
// String updatedInfoJson = infoNode.toString();
|
||||||
log.info("updateItem Tobe UpdateInfo : {}", updatedInfoJson);
|
// log.info("updateItem Tobe UpdateInfo : {}", updatedInfoJson);
|
||||||
|
//
|
||||||
Map<String, AttributeValue> expressionAttributeValues = new HashMap<>();
|
// Map<String, AttributeValue> expressionAttributeValues = new HashMap<>();
|
||||||
expressionAttributeValues.put(":newAttrib", AttributeValue.builder().s(updatedInfoJson).build());
|
// expressionAttributeValues.put(":newAttrib", AttributeValue.builder().s(updatedInfoJson).build());
|
||||||
|
//
|
||||||
String updateExpression = "SET ItemAttrib = :newAttrib";
|
// String updateExpression = "SET ItemAttrib = :newAttrib";
|
||||||
|
//
|
||||||
UpdateItemRequest updateRequest = UpdateItemRequest.builder()
|
// UpdateItemRequest updateRequest = UpdateItemRequest.builder()
|
||||||
.tableName(metaTable)
|
// .tableName(metaTable)
|
||||||
.key(Map.of(
|
// .key(Map.of(
|
||||||
"PK", AttributeValue.builder().s("item#" + guid).build(),
|
// "PK", AttributeValue.builder().s("item#" + guid).build(),
|
||||||
"SK", AttributeValue.builder().s(item_guid).build()))
|
// "SK", AttributeValue.builder().s(item_guid).build()))
|
||||||
.updateExpression(updateExpression)
|
// .updateExpression(updateExpression)
|
||||||
.expressionAttributeValues(expressionAttributeValues)
|
// .expressionAttributeValues(expressionAttributeValues)
|
||||||
.returnValues(ReturnValue.ALL_NEW) // 업데이트 후의 값을 반환하려면 지정
|
// .returnValues(ReturnValue.ALL_NEW) // 업데이트 후의 값을 반환하려면 지정
|
||||||
.build();
|
// .build();
|
||||||
|
//
|
||||||
|
//
|
||||||
dynamoDbClient.updateItem(updateRequest);
|
// dynamoDbClient.updateItem(updateRequest);
|
||||||
|
//
|
||||||
JSONObject jsonObject = new JSONObject();
|
// JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("data(before)", InfoJson);
|
// jsonObject.put("data(before)", InfoJson);
|
||||||
jsonObject.put("data(after)", updatedInfoJson);
|
// jsonObject.put("data(after)", updatedInfoJson);
|
||||||
return jsonObject;
|
// return jsonObject;
|
||||||
}catch(Exception e){
|
// }catch(Exception e){
|
||||||
log.error("updateItem: {}", e.getMessage());
|
// log.error("updateItem: {}", e.getMessage());
|
||||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage() );
|
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage() );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 아이템 - 타투 죄회
|
// 아이템 - 타투 죄회
|
||||||
public List<UsersResponse.Tattoo> getTattoo(String guid){Map<String, Object> resultMap = new HashMap<>();
|
public List<UsersResponse.Tattoo> getTattoo(String guid){Map<String, Object> resultMap = new HashMap<>();
|
||||||
@@ -1680,9 +1160,9 @@ public class DynamoDBService {
|
|||||||
friend.setRowNum(idx.getAndIncrement());
|
friend.setRowNum(idx.getAndIncrement());
|
||||||
String friend_guid = CommonUtils.objectToString(attrMap.get("friend_guid"));
|
String friend_guid = CommonUtils.objectToString(attrMap.get("friend_guid"));
|
||||||
friend.setFriendGuid(friend_guid);
|
friend.setFriendGuid(friend_guid);
|
||||||
friend.setFriendName(getGuidByName(friend_guid));
|
friend.setFriendName(dynamodbUserService.getGuidByName(friend_guid));
|
||||||
friend.setReceiveDt(CommonUtils.objectToString(attrMap.get("create_time")));
|
friend.setReceiveDt(CommonUtils.objectToString(attrMap.get("create_time")));
|
||||||
friend.setLanguage(LANGUAGETYPE.values()[Integer.parseInt(getUserLanguage(friend_guid))].toString());
|
friend.setLanguage(dynamodbUserService.getUserLanguage(guid));
|
||||||
resList.add(friend);
|
resList.add(friend);
|
||||||
});
|
});
|
||||||
log.info("getFriendList FriendInfo: {}", resList);
|
log.info("getFriendList FriendInfo: {}", resList);
|
||||||
@@ -1719,9 +1199,9 @@ public class DynamoDBService {
|
|||||||
friend.setRowNum(idx.getAndIncrement());
|
friend.setRowNum(idx.getAndIncrement());
|
||||||
String block_guid = CommonUtils.objectToString(attrMap.get("guid"));
|
String block_guid = CommonUtils.objectToString(attrMap.get("guid"));
|
||||||
friend.setFriendGuid(block_guid);
|
friend.setFriendGuid(block_guid);
|
||||||
friend.setFriendName(getGuidByName(block_guid));
|
friend.setFriendName(dynamodbUserService.getGuidByName(block_guid));
|
||||||
friend.setReceiveDt(CommonUtils.objectToString(item.get("CreatedDateTime").s()));
|
friend.setReceiveDt(CommonUtils.objectToString(item.get("CreatedDateTime").s()));
|
||||||
friend.setLanguage(LANGUAGETYPE.values()[Integer.parseInt(getUserLanguage(block_guid))].toString());
|
friend.setLanguage(dynamodbUserService.getUserLanguage(guid));
|
||||||
|
|
||||||
resList.add(friend);
|
resList.add(friend);
|
||||||
}
|
}
|
||||||
@@ -1750,12 +1230,12 @@ public class DynamoDBService {
|
|||||||
String second_key = "PK = :pkValue";
|
String second_key = "PK = :pkValue";
|
||||||
Map<String, AttributeValue> second_values = Map.of(":pkValue", AttributeValue.builder().s("item#"+myhome_guid).build());
|
Map<String, AttributeValue> second_values = Map.of(":pkValue", AttributeValue.builder().s("item#"+myhome_guid).build());
|
||||||
excuteItems(executeQuery(second_key, second_values), "ItemAttrib").forEach(attrMap2 -> {
|
excuteItems(executeQuery(second_key, second_values), "ItemAttrib").forEach(attrMap2 -> {
|
||||||
String item_id = CommonUtils.objectToString(attrMap2.get("item_meta_id"));
|
int item_id = CommonUtils.objectToInteger(attrMap2.get("item_meta_id"));
|
||||||
String item_name = metaDataHandler.getMetaItemNameData(Integer.parseInt(item_id));
|
String item_name = metaDataHandler.getMetaItemNameData(item_id);
|
||||||
UsersResponse.Item item = UsersResponse.Item.builder()
|
UsersResponse.Item item = UsersResponse.Item.builder()
|
||||||
.itemId(item_id)
|
.itemId(item_id)
|
||||||
.itemName(metaDataHandler.getTextStringData(item_name))
|
.itemName(metaDataHandler.getTextStringData(item_name))
|
||||||
.count(CommonUtils.objectToDouble(attrMap2.get("item_stack_count")))
|
.count(CommonUtils.objectToInteger(attrMap2.get("item_stack_count")))
|
||||||
.itemGuid(CommonUtils.objectToString(attrMap2.get("item_guid")))
|
.itemGuid(CommonUtils.objectToString(attrMap2.get("item_guid")))
|
||||||
.build();
|
.build();
|
||||||
itemList.add(item);
|
itemList.add(item);
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
package com.caliverse.admin.domain.service;
|
package com.caliverse.admin.domain.service;
|
||||||
|
|
||||||
import java.util.List;
|
import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
|
||||||
import java.util.Map;
|
import com.caliverse.admin.domain.entity.ITEMLARGETYPE;
|
||||||
|
|
||||||
import com.caliverse.admin.domain.adminlog.AdminItemDeleteLog;
|
|
||||||
import com.caliverse.admin.domain.adminlog.IAdminLog;
|
|
||||||
import com.caliverse.admin.domain.dao.admin.HistoryMapper;
|
|
||||||
import com.caliverse.admin.domain.entity.ItemList;
|
|
||||||
import com.caliverse.admin.domain.entity.SEARCHTYPE;
|
import com.caliverse.admin.domain.entity.SEARCHTYPE;
|
||||||
import com.caliverse.admin.domain.response.ItemDeleteResponse;
|
import com.caliverse.admin.domain.response.ItemDeleteResponse;
|
||||||
import org.slf4j.Logger;
|
import com.caliverse.admin.domain.response.UsersResponse;
|
||||||
import org.slf4j.LoggerFactory;
|
import com.caliverse.admin.dynamodb.domain.atrrib.ItemAttrib;
|
||||||
|
import com.caliverse.admin.dynamodb.domain.doc.ItemDoc;
|
||||||
|
import com.caliverse.admin.dynamodb.dto.PageResult;
|
||||||
|
import com.caliverse.admin.dynamodb.service.DynamodbItemService;
|
||||||
|
import com.caliverse.admin.dynamodb.service.DynamodbUserService;
|
||||||
|
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||||
|
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.caliverse.admin.domain.request.ItemsRequest;
|
import com.caliverse.admin.domain.request.ItemsRequest;
|
||||||
@@ -21,33 +23,75 @@ import com.caliverse.admin.global.common.code.SuccessCode;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
public class ItemsService {
|
public class ItemsService {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ItemsService.class);
|
|
||||||
|
|
||||||
private final DynamoDBService dynamoDBService;
|
|
||||||
private final UserGameSessionService userGameSessionService;
|
private final UserGameSessionService userGameSessionService;
|
||||||
private final DynamoDBQueryServiceBase dynamoDBQueryServiceBase;
|
private final DynamodbUserService dynamodbUserService;
|
||||||
private final HistoryMapper historyMapper;
|
private final DynamodbItemService dynamodbItemService;
|
||||||
|
private final MetaDataHandler metaDataHandler;
|
||||||
|
|
||||||
|
public ItemsResponse findItems(ItemsRequest itemDeleteRequest){
|
||||||
|
String guid = "";
|
||||||
|
String searchData = itemDeleteRequest.getSearchData();
|
||||||
|
|
||||||
|
if(itemDeleteRequest.getSearchType().equals(SEARCHTYPE.NAME)){
|
||||||
// 아이템 정보 조회 GUID,item ID, item name
|
guid = dynamodbUserService.getNameByGuid(searchData);
|
||||||
public ItemsResponse findItems(Map<String,String> requestParam){
|
}else{
|
||||||
String searchType = requestParam.get("search_type").toString();
|
guid = dynamodbUserService.isUser(searchData) ? searchData: "";
|
||||||
String search_key = requestParam.get("search_key").toString().trim();
|
|
||||||
String guid = search_key;
|
|
||||||
|
|
||||||
if(searchType.equals(SEARCHTYPE.NAME.name())){
|
|
||||||
guid = dynamoDBService.getNickNameByGuid(search_key);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ItemList> itemList = dynamoDBService.getItems(guid);
|
if(guid.isEmpty()){
|
||||||
|
return ItemsResponse.builder()
|
||||||
|
.status(CommonCode.ERROR.getHttpStatus())
|
||||||
|
.result(CommonCode.ERROR.getResult())
|
||||||
|
.resultData(ItemsResponse.ResultData.builder()
|
||||||
|
.message(ErrorCode.DYNAMODB_NOT_USER.name())
|
||||||
|
.build())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
PageResult<ItemDoc> itemPageResult = dynamodbItemService.getItems(guid, itemDeleteRequest.getPageKey());
|
||||||
|
List<ItemsResponse.Item> items = new ArrayList<>();
|
||||||
|
String finalGuid = guid;
|
||||||
|
itemPageResult.getItems().forEach(itemDoc -> {
|
||||||
|
ItemAttrib attrib = CommonUtils.stringByObject(itemDoc.getAttribValue(), ItemAttrib.class);
|
||||||
|
int itemId = attrib.getItemMetaId();
|
||||||
|
String itemType = metaDataHandler.getMetaItemLargeTypeData(itemId);
|
||||||
|
ItemsResponse.Item item = ItemsResponse.Item.builder()
|
||||||
|
.userGuid(finalGuid)
|
||||||
|
.itemGuid(attrib.getItemGuid())
|
||||||
|
.id(itemId)
|
||||||
|
.itemId(itemId)
|
||||||
|
.itemName(metaDataHandler.getTextStringData(metaDataHandler.getMetaItemNameData(itemId)))
|
||||||
|
.count(attrib.getItemStackCount())
|
||||||
|
.level(attrib.getLevel())
|
||||||
|
.equipedPos(attrib.getEquipedPos())
|
||||||
|
.equipType(attrib.getEquipedIvenType())
|
||||||
|
.itemType(ITEMLARGETYPE.valueOf(itemType))
|
||||||
|
.createDt(itemDoc.getCreatedDateTime())
|
||||||
|
.build();
|
||||||
|
items.add(item);
|
||||||
|
});
|
||||||
|
|
||||||
return ItemsResponse.builder()
|
return ItemsResponse.builder()
|
||||||
.resultData(ItemsResponse.ResultData.builder()
|
.resultData(ItemsResponse.ResultData.builder()
|
||||||
.list(itemList)
|
.itemList(items)
|
||||||
|
.pageKey(itemPageResult.getLastEvaluatedKey() == null ?
|
||||||
|
null :
|
||||||
|
itemPageResult.getLastEvaluatedKey().entrySet().stream()
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
Map.Entry::getKey,
|
||||||
|
entry -> entry.getValue().s()
|
||||||
|
))
|
||||||
|
)
|
||||||
.build())
|
.build())
|
||||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||||
.result(CommonCode.SUCCESS.getResult())
|
.result(CommonCode.SUCCESS.getResult())
|
||||||
@@ -57,19 +101,20 @@ public class ItemsService {
|
|||||||
|
|
||||||
@Transactional(transactionManager = "transactionManager")
|
@Transactional(transactionManager = "transactionManager")
|
||||||
public ItemDeleteResponse postItemDelete(ItemsRequest itemDeleteRequest){
|
public ItemDeleteResponse postItemDelete(ItemsRequest itemDeleteRequest){
|
||||||
var userGuid = itemDeleteRequest.getUserGuid();
|
String userGuid = itemDeleteRequest.getUserGuid();
|
||||||
var itemGuid = itemDeleteRequest.getItemGuid();
|
String itemGuid = itemDeleteRequest.getItemGuid();
|
||||||
var itemCount = itemDeleteRequest.getItemCount();
|
int itemCount = itemDeleteRequest.getItemCount();
|
||||||
|
int deleteCount = itemDeleteRequest.getDeleteCount();
|
||||||
|
|
||||||
//UserKick
|
//UserKick
|
||||||
userGameSessionService.kickUserSession(userGuid, "item delete");
|
userGameSessionService.kickUserSession(userGuid, "item delete");
|
||||||
//ItemDelete
|
|
||||||
dynamoDBQueryServiceBase.deleteUserItem(userGuid, itemGuid);
|
|
||||||
|
|
||||||
//로그 기록
|
|
||||||
IAdminLog adminLog = new AdminItemDeleteLog(userGuid, itemGuid, itemCount);
|
|
||||||
adminLog.saveLogToDB();
|
|
||||||
|
|
||||||
|
if(deleteCount >= itemCount){
|
||||||
|
dynamodbItemService.deleteItem(userGuid, itemGuid);
|
||||||
|
}else{
|
||||||
|
int cnt = itemCount - deleteCount;
|
||||||
|
dynamodbItemService.updateItemStack(userGuid, itemGuid, cnt);
|
||||||
|
}
|
||||||
|
|
||||||
return ItemDeleteResponse.builder()
|
return ItemDeleteResponse.builder()
|
||||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.caliverse.admin.domain.entity.*;
|
|||||||
import com.caliverse.admin.domain.request.MailRequest;
|
import com.caliverse.admin.domain.request.MailRequest;
|
||||||
import com.caliverse.admin.domain.response.MailResponse;
|
import com.caliverse.admin.domain.response.MailResponse;
|
||||||
import com.caliverse.admin.dynamodb.service.DynamodbCaliumService;
|
import com.caliverse.admin.dynamodb.service.DynamodbCaliumService;
|
||||||
|
import com.caliverse.admin.dynamodb.service.DynamodbUserService;
|
||||||
import com.caliverse.admin.global.common.code.CommonCode;
|
import com.caliverse.admin.global.common.code.CommonCode;
|
||||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||||
@@ -38,6 +39,7 @@ import java.util.*;
|
|||||||
public class MailService {
|
public class MailService {
|
||||||
private final DynamoDBService dynamoDBService;
|
private final DynamoDBService dynamoDBService;
|
||||||
private final WalletUserMapper walletUserMapper;
|
private final WalletUserMapper walletUserMapper;
|
||||||
|
private final DynamodbUserService dynamodbUserService;
|
||||||
|
|
||||||
@Value("${excel.file-path}")
|
@Value("${excel.file-path}")
|
||||||
private String excelPath;
|
private String excelPath;
|
||||||
@@ -323,7 +325,7 @@ public class MailService {
|
|||||||
if (mailRequest.getGuid() != null) {
|
if (mailRequest.getGuid() != null) {
|
||||||
String guid = mailRequest.getGuid();
|
String guid = mailRequest.getGuid();
|
||||||
// 닉네임이면 guid로 바꾼다
|
// 닉네임이면 guid로 바꾼다
|
||||||
if(mailRequest.getUserType().equals(Mail.USERTYPE.NICKNAME)) guid = dynamoDBService.getNickNameByGuid(guid);
|
if(mailRequest.getUserType().equals(Mail.USERTYPE.NICKNAME)) guid = dynamodbUserService.getNameByGuid(guid);
|
||||||
mailRequest.setReceiveType(Mail.RECEIVETYPE.SINGLE);
|
mailRequest.setReceiveType(Mail.RECEIVETYPE.SINGLE);
|
||||||
mailRequest.setTarget(guid);
|
mailRequest.setTarget(guid);
|
||||||
} else {
|
} else {
|
||||||
@@ -486,9 +488,9 @@ public class MailService {
|
|||||||
public String getGuid(String target, String type){
|
public String getGuid(String target, String type){
|
||||||
if(Mail.USERTYPE.EMAIL.name().equals(type)){
|
if(Mail.USERTYPE.EMAIL.name().equals(type)){
|
||||||
WalletUser user = walletUserMapper.getUser(target);
|
WalletUser user = walletUserMapper.getUser(target);
|
||||||
return dynamoDBService.getAccountIdByGuid(user.getAccount_id());
|
return dynamodbUserService.getAccountIdByGuid(String.valueOf(user.getAccount_id()));
|
||||||
}else if(Mail.USERTYPE.NICKNAME.name().equals(type)){
|
}else if(Mail.USERTYPE.NICKNAME.name().equals(type)){
|
||||||
return dynamoDBService.getNickNameByGuid(target);
|
return dynamodbUserService.getNameByGuid(target);
|
||||||
}
|
}
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.caliverse.admin.domain.service;
|
package com.caliverse.admin.domain.service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
@@ -8,6 +9,7 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import com.caliverse.admin.domain.entity.FriendRequest;
|
import com.caliverse.admin.domain.entity.FriendRequest;
|
||||||
import com.caliverse.admin.domain.entity.HISTORYTYPE;
|
import com.caliverse.admin.domain.entity.HISTORYTYPE;
|
||||||
|
import com.caliverse.admin.domain.entity.SEARCHTYPE;
|
||||||
import com.caliverse.admin.domain.request.MailRequest;
|
import com.caliverse.admin.domain.request.MailRequest;
|
||||||
import com.caliverse.admin.dynamodb.domain.atrrib.AccountBaseAttrib;
|
import com.caliverse.admin.dynamodb.domain.atrrib.AccountBaseAttrib;
|
||||||
import com.caliverse.admin.dynamodb.domain.atrrib.MailAttrib;
|
import com.caliverse.admin.dynamodb.domain.atrrib.MailAttrib;
|
||||||
@@ -15,6 +17,7 @@ import com.caliverse.admin.dynamodb.domain.atrrib.MailJsonAttrib;
|
|||||||
import com.caliverse.admin.dynamodb.domain.atrrib.MoneyAttrib;
|
import com.caliverse.admin.dynamodb.domain.atrrib.MoneyAttrib;
|
||||||
import com.caliverse.admin.dynamodb.domain.doc.MailDoc;
|
import com.caliverse.admin.dynamodb.domain.doc.MailDoc;
|
||||||
import com.caliverse.admin.dynamodb.dto.PageResult;
|
import com.caliverse.admin.dynamodb.dto.PageResult;
|
||||||
|
import com.caliverse.admin.dynamodb.service.DynamodbItemService;
|
||||||
import com.caliverse.admin.dynamodb.service.DynamodbService;
|
import com.caliverse.admin.dynamodb.service.DynamodbService;
|
||||||
import com.caliverse.admin.dynamodb.service.DynamodbUserService;
|
import com.caliverse.admin.dynamodb.service.DynamodbUserService;
|
||||||
import com.caliverse.admin.global.common.utils.DynamodbUtil;
|
import com.caliverse.admin.global.common.utils.DynamodbUtil;
|
||||||
@@ -50,15 +53,12 @@ public class UsersService {
|
|||||||
private final HistoryService historyService;
|
private final HistoryService historyService;
|
||||||
private final UserGameSessionService userGameSessionService;
|
private final UserGameSessionService userGameSessionService;
|
||||||
private final RedisUserInfoService redisUserInfoService;
|
private final RedisUserInfoService redisUserInfoService;
|
||||||
|
private final DynamodbUserService dynamodbUserService;
|
||||||
|
private final DynamodbItemService dynamodbItemService;
|
||||||
|
|
||||||
//metadataHandler 어떻게 가져와야 되는가
|
//metadataHandler 어떻게 가져와야 되는가
|
||||||
@Autowired
|
@Autowired
|
||||||
private MetaDataHandler metaDataHandler;
|
private MetaDataHandler metaDataHandler;
|
||||||
@Qualifier("objectMapper")
|
|
||||||
@Autowired
|
|
||||||
private ObjectMapper objectMapper;
|
|
||||||
@Autowired
|
|
||||||
private DynamodbUserService dynamodbUserService;
|
|
||||||
|
|
||||||
// 닉네임 변경
|
// 닉네임 변경
|
||||||
public UsersResponse changeNickname(UsersRequest usersRequest){
|
public UsersResponse changeNickname(UsersRequest usersRequest){
|
||||||
@@ -72,8 +72,9 @@ public class UsersService {
|
|||||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), check.getMessage() );
|
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), check.getMessage() );
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, String> serachNickname = dynamoDBService.getUsersByName(newNickname);
|
String isGuid = dynamodbUserService.getNameByGuid(newNickname);
|
||||||
if(serachNickname != null){
|
|
||||||
|
if(!isGuid.isEmpty()){
|
||||||
//변경 닉네임이 존재합니다. 다시 시도해주세요.
|
//변경 닉네임이 존재합니다. 다시 시도해주세요.
|
||||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NICKNAME_EXIT_ERROR.getMessage() );
|
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NICKNAME_EXIT_ERROR.getMessage() );
|
||||||
}else{
|
}else{
|
||||||
@@ -93,9 +94,8 @@ public class UsersService {
|
|||||||
// GM 권한 변경
|
// GM 권한 변경
|
||||||
public UsersResponse changeAdminLevel(UsersRequest usersRequest){
|
public UsersResponse changeAdminLevel(UsersRequest usersRequest){
|
||||||
String guid = usersRequest.getGuid();
|
String guid = usersRequest.getGuid();
|
||||||
String type = usersRequest.getAdminLevel();
|
|
||||||
|
|
||||||
dynamoDBService.updateAdminLevel(guid, type);
|
dynamodbUserService.updateAdminLevel(guid, usersRequest.getAdminLevel());
|
||||||
|
|
||||||
return UsersResponse.builder()
|
return UsersResponse.builder()
|
||||||
.resultData(UsersResponse.ResultData.builder()
|
.resultData(UsersResponse.ResultData.builder()
|
||||||
@@ -130,11 +130,22 @@ public class UsersService {
|
|||||||
String searchType = requestParam.get("search_type").toString();
|
String searchType = requestParam.get("search_type").toString();
|
||||||
String searchKey = requestParam.get("search_key").toString();
|
String searchKey = requestParam.get("search_key").toString();
|
||||||
|
|
||||||
Map<String,String> res = dynamoDBService.findUsersBykey(searchType, searchKey);
|
// Map<String,String> res = dynamoDBService.findUsersBykey(searchType, searchKey);
|
||||||
|
Map<String,String> resultMap = new HashMap<>();
|
||||||
|
if(searchType.equals(SEARCHTYPE.NAME.name())){
|
||||||
|
resultMap.put("guid", dynamodbUserService.getNameByGuid(searchKey.toLowerCase())); //nickname은 무조건 소문자
|
||||||
|
resultMap.put("nickname", searchKey);
|
||||||
|
}else if(searchType.equals(SEARCHTYPE.GUID.name())){
|
||||||
|
resultMap.put("guid", searchKey);
|
||||||
|
resultMap.put("nickname", dynamodbUserService.getGuidByName(searchKey));
|
||||||
|
}else if(searchType.equals(SEARCHTYPE.ACCOUNT.name())){
|
||||||
|
resultMap.put("guid", dynamodbUserService.getAccountIdByGuid(searchKey));
|
||||||
|
resultMap.put("nickname", dynamodbUserService.getAccountIdByName(searchKey));
|
||||||
|
}
|
||||||
|
|
||||||
return UsersResponse.builder()
|
return UsersResponse.builder()
|
||||||
.resultData(UsersResponse.ResultData.builder()
|
.resultData(UsersResponse.ResultData.builder()
|
||||||
.result(res)
|
.result(resultMap)
|
||||||
.build())
|
.build())
|
||||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||||
.result(CommonCode.SUCCESS.getResult())
|
.result(CommonCode.SUCCESS.getResult())
|
||||||
@@ -156,7 +167,7 @@ public class UsersService {
|
|||||||
.accessDt(accountBaseAttrib.getLoginDateTime())
|
.accessDt(accountBaseAttrib.getLoginDateTime())
|
||||||
.endDt(accountBaseAttrib.getLogoutDateTime())
|
.endDt(accountBaseAttrib.getLogoutDateTime())
|
||||||
.walletUrl("")
|
.walletUrl("")
|
||||||
.adminLevel(accountBaseAttrib.getAuthAdminLevelType().name())
|
.adminLevel(accountBaseAttrib.getAuthAdminLevelType())
|
||||||
.spareSlot("")
|
.spareSlot("")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -265,7 +276,8 @@ public class UsersService {
|
|||||||
// inventoryList.add(innerList);
|
// inventoryList.add(innerList);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
UsersResponse.InventoryInfo inventoryInfo = dynamoDBService.getInvenItems(guid);
|
// UsersResponse.InventoryInfo inventoryInfo = dynamoDBService.getInvenItems(guid);
|
||||||
|
UsersResponse.InventoryInfo inventoryInfo = dynamodbItemService.getInvenItems(guid);
|
||||||
logger.info("getInventoryInfo Inventory Items: {}", inventoryInfo);
|
logger.info("getInventoryInfo Inventory Items: {}", inventoryInfo);
|
||||||
|
|
||||||
return UsersResponse.builder()
|
return UsersResponse.builder()
|
||||||
@@ -288,12 +300,13 @@ public class UsersService {
|
|||||||
|
|
||||||
userGameSessionService.kickUserSession(guid, "Item delete");
|
userGameSessionService.kickUserSession(guid, "Item delete");
|
||||||
if(update_cnt >= current_cnt){
|
if(update_cnt >= current_cnt){
|
||||||
String attrib = dynamoDBService.deleteItem(guid, item_guid);
|
// String attrib = dynamoDBService.deleteItem(guid, item_guid);
|
||||||
if(!attrib.isEmpty()){
|
// if(!attrib.isEmpty()){
|
||||||
JSONObject jsonObject = new JSONObject();
|
// JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("data",attrib);
|
// jsonObject.put("data",attrib);
|
||||||
historyService.setLog(HISTORYTYPE.INVENTORY_ITEM_DELETE, jsonObject);
|
// historyService.setLog(HISTORYTYPE.INVENTORY_ITEM_DELETE, jsonObject);
|
||||||
}
|
// }
|
||||||
|
dynamodbItemService.deleteItem(guid, item_guid);
|
||||||
return UsersResponse.builder()
|
return UsersResponse.builder()
|
||||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||||
.result(CommonCode.SUCCESS.getResult())
|
.result(CommonCode.SUCCESS.getResult())
|
||||||
@@ -303,10 +316,11 @@ public class UsersService {
|
|||||||
.build();
|
.build();
|
||||||
}else{
|
}else{
|
||||||
int cnt = current_cnt - update_cnt;
|
int cnt = current_cnt - update_cnt;
|
||||||
JSONObject json = dynamoDBService.updateItem(guid, item_guid, cnt);
|
dynamodbItemService.updateItemStack(guid, item_guid, cnt);
|
||||||
if(!json.isEmpty()){
|
// JSONObject json = dynamoDBService.updateItem(guid, item_guid, cnt);
|
||||||
historyService.setLog(HISTORYTYPE.INVENTORY_ITEM_UPDATE, json);
|
// if(!json.isEmpty()){
|
||||||
}
|
// historyService.setLog(HISTORYTYPE.INVENTORY_ITEM_UPDATE, json);
|
||||||
|
// }
|
||||||
return UsersResponse.builder()
|
return UsersResponse.builder()
|
||||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||||
.result(CommonCode.SUCCESS.getResult())
|
.result(CommonCode.SUCCESS.getResult())
|
||||||
@@ -319,7 +333,7 @@ public class UsersService {
|
|||||||
|
|
||||||
public UsersResponse getMail(UsersRequest usersRequest){
|
public UsersResponse getMail(UsersRequest usersRequest){
|
||||||
// List<UsersResponse.Mail> mailList = dynamoDBService.getMail(guid, type);
|
// List<UsersResponse.Mail> mailList = dynamoDBService.getMail(guid, type);
|
||||||
PageResult<MailDoc> mailPageResult = dynamodbService.getMail(usersRequest.getMailType(), usersRequest.getGuid(), "", "", "", usersRequest.getPageKey(), false);
|
PageResult<MailDoc> mailPageResult = dynamodbService.getMail(usersRequest.getMailType(), usersRequest.getGuid(), "", usersRequest.getPageKey());
|
||||||
List<UsersResponse.Mail> mailList = new ArrayList<>();
|
List<UsersResponse.Mail> mailList = new ArrayList<>();
|
||||||
|
|
||||||
mailPageResult.getItems().forEach(doc -> {
|
mailPageResult.getItems().forEach(doc -> {
|
||||||
@@ -377,7 +391,7 @@ public class UsersService {
|
|||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
return;
|
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), e.getMessage());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return UsersResponse.builder()
|
return UsersResponse.builder()
|
||||||
@@ -469,9 +483,9 @@ public class UsersService {
|
|||||||
friend.setRowNum(idx.getAndIncrement());
|
friend.setRowNum(idx.getAndIncrement());
|
||||||
String receive_guid = friendReq.getReceiverGuid();
|
String receive_guid = friendReq.getReceiverGuid();
|
||||||
friend.setFriendGuid(receive_guid);
|
friend.setFriendGuid(receive_guid);
|
||||||
friend.setFriendName(dynamoDBService.getGuidByName(receive_guid));
|
friend.setFriendName(dynamodbUserService.getGuidByName(receive_guid));
|
||||||
friend.setReceiveDt(friendReq.getRequestTime());
|
friend.setReceiveDt(friendReq.getRequestTime());
|
||||||
friend.setLanguage(dynamoDBService.getUserLanguage(receive_guid));
|
friend.setLanguage(dynamodbUserService.getUserLanguage(receive_guid));
|
||||||
|
|
||||||
friendSendList.add(friend);
|
friendSendList.add(friend);
|
||||||
}
|
}
|
||||||
@@ -481,9 +495,9 @@ public class UsersService {
|
|||||||
friend.setRowNum(idx.getAndIncrement());
|
friend.setRowNum(idx.getAndIncrement());
|
||||||
String send_guid = friendReq.getSenderGuid();
|
String send_guid = friendReq.getSenderGuid();
|
||||||
friend.setFriendGuid(send_guid);
|
friend.setFriendGuid(send_guid);
|
||||||
friend.setFriendName(dynamoDBService.getGuidByName(send_guid));
|
friend.setFriendName(dynamodbUserService.getGuidByName(send_guid));
|
||||||
friend.setReceiveDt(friendReq.getRequestTime());
|
friend.setReceiveDt(friendReq.getRequestTime());
|
||||||
friend.setLanguage(dynamoDBService.getUserLanguage(send_guid));
|
friend.setLanguage(dynamodbUserService.getUserLanguage(send_guid));
|
||||||
|
|
||||||
friendReceiveList.add(friend);
|
friendReceiveList.add(friend);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.caliverse.admin.dynamodb.domain.atrrib;
|
||||||
|
|
||||||
|
import com.caliverse.admin.dynamodb.entity.EInvenEquipType;
|
||||||
|
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;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@NoArgsConstructor
|
||||||
|
@DynamoDbBean
|
||||||
|
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
|
||||||
|
public class ItemAttrib extends DynamoDBAttribBase{
|
||||||
|
@JsonProperty("item_guid")
|
||||||
|
private String itemGuid;
|
||||||
|
@JsonProperty("item_meta_id")
|
||||||
|
private Integer itemMetaId;
|
||||||
|
@JsonProperty("owner_guid")
|
||||||
|
private String ownerGuid;
|
||||||
|
@JsonProperty("owner_entity_type")
|
||||||
|
private EOwnerEntityType ownerEntityType;
|
||||||
|
@JsonProperty("item_stack_count")
|
||||||
|
private Integer itemStackCount;
|
||||||
|
private Integer level;
|
||||||
|
@JsonProperty("attributes")
|
||||||
|
private List<Integer> attributes;
|
||||||
|
@JsonProperty("equiped_inven_type")
|
||||||
|
private EInvenEquipType equipedIvenType;
|
||||||
|
@JsonProperty("equiped_pos")
|
||||||
|
private Integer equipedPos;
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.caliverse.admin.dynamodb.domain.doc;
|
||||||
|
|
||||||
|
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbAttribute;
|
||||||
|
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@NoArgsConstructor
|
||||||
|
@DynamoDbBean
|
||||||
|
public class ItemDoc extends DynamoDBDocBase {
|
||||||
|
private String itemAttrib;
|
||||||
|
|
||||||
|
public String getAttribFieldName() {
|
||||||
|
return DynamoDBConstants.ATTRIB_ITEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DynamoDbAttribute(DynamoDBConstants.ATTRIB_ITEM)
|
||||||
|
@JsonProperty(DynamoDBConstants.ATTRIB_ITEM)
|
||||||
|
public String getAttribValue() {
|
||||||
|
return itemAttrib;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAttribValue(String value) {
|
||||||
|
this.itemAttrib = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.caliverse.admin.dynamodb.entity;
|
||||||
|
|
||||||
|
|
||||||
|
import com.caliverse.admin.domain.entity.common.ValueEnum;
|
||||||
|
|
||||||
|
public enum EInvenEquipType implements ValueEnum {
|
||||||
|
None(0),
|
||||||
|
Cloth(1),
|
||||||
|
Tool(2),
|
||||||
|
Tattoo(3),
|
||||||
|
;
|
||||||
|
|
||||||
|
private final int value;
|
||||||
|
|
||||||
|
EInvenEquipType(int value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
package com.caliverse.admin.dynamodb.repository;
|
package com.caliverse.admin.dynamodb.repository;
|
||||||
|
|
||||||
|
import com.caliverse.admin.domain.RabbitMq.message.AuthAdminLevelType;
|
||||||
import com.caliverse.admin.domain.entity.BlackList;
|
import com.caliverse.admin.domain.entity.BlackList;
|
||||||
import com.caliverse.admin.dynamodb.domain.atrrib.AccountBaseAttrib;
|
import com.caliverse.admin.dynamodb.domain.atrrib.AccountBaseAttrib;
|
||||||
import com.caliverse.admin.dynamodb.domain.doc.AccountBaseDoc;
|
import com.caliverse.admin.dynamodb.domain.doc.AccountBaseDoc;
|
||||||
|
import com.caliverse.admin.dynamodb.entity.EAuthAdminLevelType;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -10,5 +12,6 @@ public interface AccountBaseRepository extends DynamoDBRepository<AccountBaseDoc
|
|||||||
boolean isBlockUser(String account_id);
|
boolean isBlockUser(String account_id);
|
||||||
void updateBlockUserStart(String account_id, BlackList blackList);
|
void updateBlockUserStart(String account_id, BlackList blackList);
|
||||||
void updateBlockUserEnd(String account_id);
|
void updateBlockUserEnd(String account_id);
|
||||||
|
void updateAdminLevel(String accountId, EAuthAdminLevelType type);
|
||||||
AccountBaseAttrib findUser(String account_id);
|
AccountBaseAttrib findUser(String account_id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.caliverse.admin.dynamodb.repository;
|
package com.caliverse.admin.dynamodb.repository;
|
||||||
|
|
||||||
|
import com.caliverse.admin.domain.entity.EFilterOperator;
|
||||||
import com.caliverse.admin.dynamodb.dto.PageResult;
|
import com.caliverse.admin.dynamodb.dto.PageResult;
|
||||||
import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
|
import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
|
||||||
import com.caliverse.admin.global.common.code.CommonCode;
|
import com.caliverse.admin.global.common.code.CommonCode;
|
||||||
@@ -91,11 +92,31 @@ public abstract class BaseDynamoDBRepository<T> implements DynamoDBRepository<T>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<T> findByPaging(
|
||||||
|
String partitionKey,
|
||||||
|
String sortKeyPrefix,
|
||||||
|
Map<String, AttributeValue> exclusiveStartKey
|
||||||
|
) {
|
||||||
|
|
||||||
|
return operations.queryItemsPaging(
|
||||||
|
partitionKey,
|
||||||
|
sortKeyPrefix,
|
||||||
|
"",
|
||||||
|
EFilterOperator.NONE,
|
||||||
|
"",
|
||||||
|
exclusiveStartKey,
|
||||||
|
false,
|
||||||
|
entityClass
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<T> findByPaging(
|
public PageResult<T> findByPaging(
|
||||||
String partitionKey,
|
String partitionKey,
|
||||||
String sortKeyPrefix,
|
String sortKeyPrefix,
|
||||||
String filterAttributeName,
|
String filterAttributeName,
|
||||||
|
EFilterOperator filterOperator,
|
||||||
String filterAttributeValue,
|
String filterAttributeValue,
|
||||||
Map<String, AttributeValue> exclusiveStartKey,
|
Map<String, AttributeValue> exclusiveStartKey,
|
||||||
boolean scanIndexForward
|
boolean scanIndexForward
|
||||||
@@ -105,6 +126,7 @@ public abstract class BaseDynamoDBRepository<T> implements DynamoDBRepository<T>
|
|||||||
partitionKey,
|
partitionKey,
|
||||||
sortKeyPrefix,
|
sortKeyPrefix,
|
||||||
filterAttributeName,
|
filterAttributeName,
|
||||||
|
filterOperator,
|
||||||
filterAttributeValue,
|
filterAttributeValue,
|
||||||
exclusiveStartKey,
|
exclusiveStartKey,
|
||||||
scanIndexForward,
|
scanIndexForward,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.caliverse.admin.dynamodb.repository;
|
package com.caliverse.admin.dynamodb.repository;
|
||||||
|
|
||||||
|
import com.caliverse.admin.domain.entity.EFilterOperator;
|
||||||
import com.caliverse.admin.dynamodb.dto.PageResult;
|
import com.caliverse.admin.dynamodb.dto.PageResult;
|
||||||
import software.amazon.awssdk.enhanced.dynamodb.Expression;
|
import software.amazon.awssdk.enhanced.dynamodb.Expression;
|
||||||
import software.amazon.awssdk.enhanced.dynamodb.Key;
|
import software.amazon.awssdk.enhanced.dynamodb.Key;
|
||||||
@@ -20,11 +21,16 @@ public interface DynamoDBRepository<T> {
|
|||||||
List<T> findAllScan(String prefix);
|
List<T> findAllScan(String prefix);
|
||||||
List<T> findAllScan(String prefix, String sortKey);
|
List<T> findAllScan(String prefix, String sortKey);
|
||||||
List<T> findByPrefix(String partitionKey, String sortKeyPrefix);
|
List<T> findByPrefix(String partitionKey, String sortKeyPrefix);
|
||||||
|
PageResult<T> findByPaging(
|
||||||
|
String partitionKey,
|
||||||
|
String sortKeyPrefix,
|
||||||
|
Map<String, AttributeValue> exclusiveStartKey
|
||||||
|
);
|
||||||
PageResult<T> findByPaging(
|
PageResult<T> findByPaging(
|
||||||
String partitionKey,
|
String partitionKey,
|
||||||
String sortKeyPrefix,
|
String sortKeyPrefix,
|
||||||
String filterAttributeName,
|
String filterAttributeName,
|
||||||
|
EFilterOperator filterOperator,
|
||||||
String filterAttributeValue,
|
String filterAttributeValue,
|
||||||
Map<String, AttributeValue> exclusiveStartKey,
|
Map<String, AttributeValue> exclusiveStartKey,
|
||||||
boolean scanIndexForward
|
boolean scanIndexForward
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.caliverse.admin.dynamodb.repository.Impl;
|
package com.caliverse.admin.dynamodb.repository.Impl;
|
||||||
|
|
||||||
|
import com.caliverse.admin.domain.RabbitMq.message.AuthAdminLevelType;
|
||||||
import com.caliverse.admin.domain.entity.BlackList;
|
import com.caliverse.admin.domain.entity.BlackList;
|
||||||
import com.caliverse.admin.domain.entity.HISTORYTYPE;
|
import com.caliverse.admin.domain.entity.HISTORYTYPE;
|
||||||
import com.caliverse.admin.dynamodb.domain.atrrib.AccountBaseAttrib;
|
import com.caliverse.admin.dynamodb.domain.atrrib.AccountBaseAttrib;
|
||||||
@@ -8,6 +9,7 @@ import com.caliverse.admin.dynamodb.domain.atrrib.UserNicknameRegistryAttrib;
|
|||||||
import com.caliverse.admin.dynamodb.domain.doc.AccountBaseDoc;
|
import com.caliverse.admin.dynamodb.domain.doc.AccountBaseDoc;
|
||||||
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRegistryDoc;
|
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRegistryDoc;
|
||||||
import com.caliverse.admin.dynamodb.domain.doc.UserNicknameRegistryDoc;
|
import com.caliverse.admin.dynamodb.domain.doc.UserNicknameRegistryDoc;
|
||||||
|
import com.caliverse.admin.dynamodb.entity.EAuthAdminLevelType;
|
||||||
import com.caliverse.admin.dynamodb.repository.AccountBaseRepository;
|
import com.caliverse.admin.dynamodb.repository.AccountBaseRepository;
|
||||||
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
|
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
|
||||||
import com.caliverse.admin.dynamodb.repository.UserNicknameRegistryRepository;
|
import com.caliverse.admin.dynamodb.repository.UserNicknameRegistryRepository;
|
||||||
@@ -140,6 +142,41 @@ public class AccountBaseRepositoryImpl extends BaseDynamoDBRepository<AccountBas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateAdminLevel(String accountId, EAuthAdminLevelType type) {
|
||||||
|
try {
|
||||||
|
Key key = Key.builder()
|
||||||
|
.partitionValue(DynamoDBConstants.PK_KEY_ACCOUNT_BASE + accountId)
|
||||||
|
.sortValue(DynamoDBConstants.EMPTY)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
AccountBaseDoc beforeDoc = findById(key);
|
||||||
|
|
||||||
|
if (beforeDoc != null) {
|
||||||
|
AccountBaseDoc afterDoc = deepCopy(beforeDoc, AccountBaseDoc.class);
|
||||||
|
|
||||||
|
AccountBaseAttrib attrib = objectMapper.readValue(afterDoc.getAttribValue(), AccountBaseAttrib.class);
|
||||||
|
attrib.setAuthAdminLevelType(type);
|
||||||
|
|
||||||
|
afterDoc.setAttribValue(objectMapper.writeValueAsString(attrib));
|
||||||
|
afterDoc.setUpdatedDateTime(CommonUtils.convertUTCDate(LocalDateTime.now()));
|
||||||
|
|
||||||
|
update(afterDoc);
|
||||||
|
|
||||||
|
log.info("updateAdminLevel Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||||
|
|
||||||
|
dynamodbHistoryLogService.updateHistoryLog(
|
||||||
|
HISTORYTYPE.USER_ADMIN_AUTH_UPDATE,
|
||||||
|
HISTORYTYPE.USER_ADMIN_AUTH_UPDATE.name(),
|
||||||
|
beforeDoc,
|
||||||
|
afterDoc
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AccountBaseAttrib findUser(String account_id) {
|
public AccountBaseAttrib findUser(String account_id) {
|
||||||
Key key = Key.builder()
|
Key key = Key.builder()
|
||||||
|
|||||||
@@ -0,0 +1,123 @@
|
|||||||
|
package com.caliverse.admin.dynamodb.repository.Impl;
|
||||||
|
|
||||||
|
import com.caliverse.admin.domain.entity.EFilterOperator;
|
||||||
|
import com.caliverse.admin.domain.entity.HISTORYTYPE;
|
||||||
|
import com.caliverse.admin.domain.entity.SEARCHTYPE;
|
||||||
|
import com.caliverse.admin.dynamodb.domain.atrrib.ItemAttrib;
|
||||||
|
import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionRegistryAttrib;
|
||||||
|
import com.caliverse.admin.dynamodb.domain.doc.ItemDoc;
|
||||||
|
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRegistryDoc;
|
||||||
|
import com.caliverse.admin.dynamodb.dto.PageResult;
|
||||||
|
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
|
||||||
|
import com.caliverse.admin.dynamodb.repository.ItemRepository;
|
||||||
|
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 software.amazon.awssdk.services.dynamodb.model.AttributeValue;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class ItemRepositoryImpl extends BaseDynamoDBRepository<ItemDoc> implements ItemRepository {
|
||||||
|
public ItemRepositoryImpl(DynamoDBOperations operations, DynamodbHistoryLogService dynamodbHistoryLogService, ObjectMapper objectMapper) {
|
||||||
|
super(operations, ItemDoc.class, dynamodbHistoryLogService, objectMapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<ItemDoc> getItemListWithPaging(
|
||||||
|
String userGuid,
|
||||||
|
String sortKeyPrefix,
|
||||||
|
String filterAttributeName,
|
||||||
|
EFilterOperator filterOperator,
|
||||||
|
String filterAttributeValue,
|
||||||
|
Map<String, AttributeValue> exclusiveStartKey,
|
||||||
|
boolean sortIndex
|
||||||
|
) {
|
||||||
|
|
||||||
|
String pk = DynamoDBConstants.PK_KEY_ITEM + userGuid;;
|
||||||
|
|
||||||
|
return findByPaging(
|
||||||
|
pk,
|
||||||
|
sortKeyPrefix,
|
||||||
|
filterAttributeName,
|
||||||
|
filterOperator,
|
||||||
|
filterAttributeValue,
|
||||||
|
exclusiveStartKey,
|
||||||
|
sortIndex
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateItemStack(String guid, String itemGuid, int stackCount) {
|
||||||
|
try {
|
||||||
|
Key key = Key.builder()
|
||||||
|
.partitionValue(DynamoDBConstants.PK_KEY_ITEM + guid)
|
||||||
|
.sortValue(itemGuid)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ItemDoc beforeDoc = findById(key);
|
||||||
|
|
||||||
|
if (beforeDoc != null) {
|
||||||
|
ItemDoc afterDoc = deepCopy(beforeDoc, ItemDoc.class);
|
||||||
|
|
||||||
|
ItemAttrib attrib = CommonUtils.stringByObject(afterDoc.getAttribValue(), ItemAttrib.class);
|
||||||
|
attrib.setItemStackCount(stackCount);
|
||||||
|
|
||||||
|
afterDoc.setAttribValue(CommonUtils.objectByString(attrib));
|
||||||
|
afterDoc.setUpdatedDateTime(CommonUtils.convertUTCDate(LocalDateTime.now()));
|
||||||
|
|
||||||
|
update(afterDoc);
|
||||||
|
|
||||||
|
log.info("updateItemStack Update Success: {}", CommonUtils.objectByString(afterDoc));
|
||||||
|
|
||||||
|
dynamodbHistoryLogService.updateHistoryLog(
|
||||||
|
HISTORYTYPE.ITEM_UPDATE,
|
||||||
|
HISTORYTYPE.ITEM_UPDATE.name(),
|
||||||
|
beforeDoc,
|
||||||
|
afterDoc
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("Update Item Error: {}", e.getMessage());
|
||||||
|
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_ITEM_UPDATE_ERROR.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteItem(String guid, String itemGuid) {
|
||||||
|
try {
|
||||||
|
Key key = Key.builder()
|
||||||
|
.partitionValue(DynamoDBConstants.PK_KEY_ITEM + guid)
|
||||||
|
.sortValue(itemGuid)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
ItemDoc beforeDoc = findById(key);
|
||||||
|
|
||||||
|
if (beforeDoc != null) {
|
||||||
|
delete(key);
|
||||||
|
|
||||||
|
log.info("ItemDoc Delete Success: {}", CommonUtils.objectByString(beforeDoc));
|
||||||
|
|
||||||
|
dynamodbHistoryLogService.deleteHistoryLog(
|
||||||
|
HISTORYTYPE.ITEM_DELETE,
|
||||||
|
HISTORYTYPE.ITEM_DELETE.name(),
|
||||||
|
beforeDoc
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("Update LandAuctionRegistry Error: {}", e.getMessage());
|
||||||
|
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_ITEM_DELETE_ERROR.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -119,10 +119,7 @@ public class MailJsonRepositoryImpl extends BaseDynamoDBRepository<MailJsonDoc>
|
|||||||
SEARCHTYPE type,
|
SEARCHTYPE type,
|
||||||
String userGuid,
|
String userGuid,
|
||||||
String sortKeyPrefix,
|
String sortKeyPrefix,
|
||||||
String filterAttributeName,
|
Map<String, AttributeValue> exclusiveStartKey
|
||||||
String filterAttributeValue,
|
|
||||||
Map<String, AttributeValue> exclusiveStartKey,
|
|
||||||
boolean sortIndex
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
String pk;
|
String pk;
|
||||||
@@ -135,10 +132,7 @@ public class MailJsonRepositoryImpl extends BaseDynamoDBRepository<MailJsonDoc>
|
|||||||
return findByPaging(
|
return findByPaging(
|
||||||
pk,
|
pk,
|
||||||
sortKeyPrefix,
|
sortKeyPrefix,
|
||||||
filterAttributeName,
|
exclusiveStartKey
|
||||||
filterAttributeValue,
|
|
||||||
exclusiveStartKey,
|
|
||||||
sortIndex
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,10 +119,7 @@ public class MailRepositoryImpl extends BaseDynamoDBRepository<MailDoc> implemen
|
|||||||
SEARCHTYPE type,
|
SEARCHTYPE type,
|
||||||
String userGuid,
|
String userGuid,
|
||||||
String sortKeyPrefix,
|
String sortKeyPrefix,
|
||||||
String filterAttributeName,
|
Map<String, AttributeValue> exclusiveStartKey
|
||||||
String filterAttributeValue,
|
|
||||||
Map<String, AttributeValue> exclusiveStartKey,
|
|
||||||
boolean sortIndex
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
String pk;
|
String pk;
|
||||||
@@ -135,10 +132,7 @@ public class MailRepositoryImpl extends BaseDynamoDBRepository<MailDoc> implemen
|
|||||||
return findByPaging(
|
return findByPaging(
|
||||||
pk,
|
pk,
|
||||||
sortKeyPrefix,
|
sortKeyPrefix,
|
||||||
filterAttributeName,
|
exclusiveStartKey
|
||||||
filterAttributeValue,
|
|
||||||
exclusiveStartKey,
|
|
||||||
sortIndex
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.caliverse.admin.global.common.code.CommonCode;
|
|||||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||||
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
||||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||||
|
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||||
import com.caliverse.admin.history.service.DynamodbHistoryLogService;
|
import com.caliverse.admin.history.service.DynamodbHistoryLogService;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
@@ -33,10 +34,6 @@ public class UserBaseRepositoryImpl extends BaseDynamoDBRepository<UserBaseDoc>
|
|||||||
UserBaseDoc doc = findById(key);
|
UserBaseDoc doc = findById(key);
|
||||||
if(doc == null) return null;
|
if(doc == null) return null;
|
||||||
|
|
||||||
try {
|
return CommonUtils.stringByObject(doc.getAttribValue(), UserBaseAttrib.class);
|
||||||
return objectMapper.readValue(doc.getAttribValue(), UserBaseAttrib.class);
|
|
||||||
} catch (JsonProcessingException e) {
|
|
||||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.caliverse.admin.global.common.code.CommonCode;
|
|||||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||||
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
||||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||||
|
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||||
import com.caliverse.admin.history.service.DynamodbHistoryLogService;
|
import com.caliverse.admin.history.service.DynamodbHistoryLogService;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
@@ -33,14 +34,12 @@ public class UserNicknameRegistryRepositoryImpl extends BaseDynamoDBRepository<U
|
|||||||
public UserNicknameRegistryAttrib findUser(String nickname) {
|
public UserNicknameRegistryAttrib findUser(String nickname) {
|
||||||
Key key = Key.builder()
|
Key key = Key.builder()
|
||||||
.partitionValue(DynamoDBConstants.PK_KEY_USER_NICKNAME_REGISTRY)
|
.partitionValue(DynamoDBConstants.PK_KEY_USER_NICKNAME_REGISTRY)
|
||||||
|
.sortValue(nickname)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
UserNicknameRegistryDoc doc = findById(key);
|
UserNicknameRegistryDoc doc = findById(key);
|
||||||
try {
|
if(doc == null) return null;
|
||||||
return objectMapper.readValue(doc.getAttribValue(), UserNicknameRegistryAttrib.class);
|
return CommonUtils.stringByObject(doc.getAttribValue(), UserNicknameRegistryAttrib.class);
|
||||||
} catch (JsonProcessingException e) {
|
|
||||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -50,6 +49,7 @@ public class UserNicknameRegistryRepositoryImpl extends BaseDynamoDBRepository<U
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
List<UserNicknameRegistryDoc> doc = findAll(key);
|
List<UserNicknameRegistryDoc> doc = findAll(key);
|
||||||
|
if(doc == null) return null;
|
||||||
|
|
||||||
return doc.stream()
|
return doc.stream()
|
||||||
.map(UserNicknameRegistryDoc::getAttribValue)
|
.map(UserNicknameRegistryDoc::getAttribValue)
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.caliverse.admin.dynamodb.repository;
|
||||||
|
|
||||||
|
import com.caliverse.admin.domain.entity.EFilterOperator;
|
||||||
|
import com.caliverse.admin.dynamodb.domain.doc.ItemDoc;
|
||||||
|
import com.caliverse.admin.dynamodb.dto.PageResult;
|
||||||
|
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface ItemRepository extends DynamoDBRepository<ItemDoc> {
|
||||||
|
PageResult<ItemDoc> getItemListWithPaging(
|
||||||
|
String userGuid,
|
||||||
|
String sortKeyPrefix,
|
||||||
|
String filterAttributeName,
|
||||||
|
EFilterOperator filterOperator,
|
||||||
|
String filterAttributeValue,
|
||||||
|
Map<String, AttributeValue> exclusiveStartKey,
|
||||||
|
boolean sortIndex
|
||||||
|
);
|
||||||
|
void updateItemStack(String guid, String itemGuid, int stackCount);
|
||||||
|
void deleteItem(String userGuid, String itemGuid);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -20,9 +20,6 @@ public interface MailJsonRepository extends DynamoDBRepository<MailJsonDoc> {
|
|||||||
SEARCHTYPE type,
|
SEARCHTYPE type,
|
||||||
String userGuid,
|
String userGuid,
|
||||||
String sortKeyPrefix,
|
String sortKeyPrefix,
|
||||||
String filterAttributeName,
|
Map<String, AttributeValue> exclusiveStartKey
|
||||||
String filterAttributeValue,
|
|
||||||
Map<String, AttributeValue> exclusiveStartKey,
|
|
||||||
boolean sortIndex
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.caliverse.admin.domain.entity.metadata.MetaSystemMailData;
|
|||||||
import com.caliverse.admin.domain.request.MailRequest;
|
import com.caliverse.admin.domain.request.MailRequest;
|
||||||
import com.caliverse.admin.dynamodb.domain.atrrib.MailItemAttrib;
|
import com.caliverse.admin.dynamodb.domain.atrrib.MailItemAttrib;
|
||||||
import com.caliverse.admin.dynamodb.domain.doc.MailDoc;
|
import com.caliverse.admin.dynamodb.domain.doc.MailDoc;
|
||||||
|
import com.caliverse.admin.dynamodb.domain.doc.MailJsonDoc;
|
||||||
import com.caliverse.admin.dynamodb.dto.PageResult;
|
import com.caliverse.admin.dynamodb.dto.PageResult;
|
||||||
import com.caliverse.admin.dynamodb.entity.MailItem;
|
import com.caliverse.admin.dynamodb.entity.MailItem;
|
||||||
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
|
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
|
||||||
@@ -21,9 +22,6 @@ public interface MailRepository extends DynamoDBRepository<MailDoc> {
|
|||||||
SEARCHTYPE type,
|
SEARCHTYPE type,
|
||||||
String userGuid,
|
String userGuid,
|
||||||
String sortKeyPrefix,
|
String sortKeyPrefix,
|
||||||
String filterAttributeName,
|
Map<String, AttributeValue> exclusiveStartKey
|
||||||
String filterAttributeValue,
|
|
||||||
Map<String, AttributeValue> exclusiveStartKey,
|
|
||||||
boolean sortIndex
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.caliverse.admin.dynamodb.service;
|
package com.caliverse.admin.dynamodb.service;
|
||||||
|
|
||||||
|
import com.caliverse.admin.domain.entity.EFilterOperator;
|
||||||
import com.caliverse.admin.dynamodb.dto.PageResult;
|
import com.caliverse.admin.dynamodb.dto.PageResult;
|
||||||
import com.caliverse.admin.global.common.constants.CommonConstants;
|
import com.caliverse.admin.global.common.constants.CommonConstants;
|
||||||
import com.caliverse.admin.global.component.transaction.DynamoDBTransactionContext;
|
import com.caliverse.admin.global.component.transaction.DynamoDBTransactionContext;
|
||||||
@@ -296,6 +297,7 @@ public class DynamoDBOperations {
|
|||||||
String partitionKey,
|
String partitionKey,
|
||||||
String sortKeyPrefix,
|
String sortKeyPrefix,
|
||||||
String filterAttributeName,
|
String filterAttributeName,
|
||||||
|
EFilterOperator filterOperator,
|
||||||
String filterAttributeValue,
|
String filterAttributeValue,
|
||||||
Map<String, AttributeValue> exclusiveStartKey,
|
Map<String, AttributeValue> exclusiveStartKey,
|
||||||
boolean scanIndexForward,
|
boolean scanIndexForward,
|
||||||
@@ -318,8 +320,15 @@ public class DynamoDBOperations {
|
|||||||
// 필터
|
// 필터
|
||||||
Expression filterExpression = null;
|
Expression filterExpression = null;
|
||||||
if (!filterAttributeName.isEmpty() && !filterAttributeValue.isEmpty()) {
|
if (!filterAttributeName.isEmpty() && !filterAttributeValue.isEmpty()) {
|
||||||
|
String expressionString = switch (filterOperator) {
|
||||||
|
case EQUALS -> "#filterAttr = :filterValue";
|
||||||
|
case CONTAINS -> "contains(#filterAttr, :filterValue)";
|
||||||
|
case NOT_EQUALS -> "#filterAttr <> :filterValue";
|
||||||
|
default -> "begins_with(#filterAttr, :filterValue)";
|
||||||
|
};
|
||||||
|
|
||||||
filterExpression = Expression.builder()
|
filterExpression = Expression.builder()
|
||||||
.expression("begins_with(#filterAttr, :filterValue)")
|
.expression(expressionString)
|
||||||
.putExpressionName("#filterAttr", filterAttributeName)
|
.putExpressionName("#filterAttr", filterAttributeName)
|
||||||
.putExpressionValue(":filterValue", AttributeValue.builder().s(filterAttributeValue).build())
|
.putExpressionValue(":filterValue", AttributeValue.builder().s(filterAttributeValue).build())
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
@@ -0,0 +1,105 @@
|
|||||||
|
package com.caliverse.admin.dynamodb.service;
|
||||||
|
|
||||||
|
import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
|
||||||
|
import com.caliverse.admin.domain.entity.EFilterOperator;
|
||||||
|
import com.caliverse.admin.domain.entity.ITEMLARGETYPE;
|
||||||
|
import com.caliverse.admin.domain.response.UsersResponse;
|
||||||
|
import com.caliverse.admin.dynamodb.domain.atrrib.ItemAttrib;
|
||||||
|
import com.caliverse.admin.dynamodb.domain.doc.ItemDoc;
|
||||||
|
import com.caliverse.admin.dynamodb.dto.PageResult;
|
||||||
|
import com.caliverse.admin.dynamodb.entity.KeyParam;
|
||||||
|
import com.caliverse.admin.dynamodb.repository.*;
|
||||||
|
import com.caliverse.admin.global.common.annotation.DynamoDBTransaction;
|
||||||
|
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
||||||
|
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class DynamodbItemService {
|
||||||
|
private final ItemRepository itemRepository;
|
||||||
|
private final MetaDataHandler metaDataHandler;
|
||||||
|
|
||||||
|
public PageResult<ItemDoc> getItems(String guid, KeyParam pageKey){
|
||||||
|
Map<String, AttributeValue> pagingKey = null;
|
||||||
|
if(pageKey != null){
|
||||||
|
pagingKey = new HashMap<>();
|
||||||
|
pagingKey.put(DynamoDBConstants.PK_KEY_NAME, AttributeValue.builder().s(pageKey.getPk()).build());
|
||||||
|
pagingKey.put(DynamoDBConstants.SK_KEY_NAME, AttributeValue.builder().s(pageKey.getSk()).build());
|
||||||
|
}
|
||||||
|
PageResult<ItemDoc> itemList = itemRepository.getItemListWithPaging(guid, "","",null, "", pagingKey, false);
|
||||||
|
return itemList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UsersResponse.InventoryInfo getInvenItems(String guid){
|
||||||
|
List<UsersResponse.Item> clothList = new ArrayList<>();
|
||||||
|
List<UsersResponse.Item> propList = new ArrayList<>();
|
||||||
|
List<UsersResponse.Item> beautyList = new ArrayList<>();
|
||||||
|
List<UsersResponse.Item> tattooList = new ArrayList<>();
|
||||||
|
List<UsersResponse.Item> currencyList = new ArrayList<>();
|
||||||
|
List<UsersResponse.Item> etcList = new ArrayList<>();
|
||||||
|
|
||||||
|
Map<String, AttributeValue> pageKey = null;
|
||||||
|
do {
|
||||||
|
PageResult<ItemDoc> itemList = itemRepository.getItemListWithPaging(guid, "", DynamoDBConstants.ATTRIB_ITEM, EFilterOperator.CONTAINS,"\"equiped_inven_type\":0", pageKey, false);
|
||||||
|
|
||||||
|
itemList.getItems().forEach(item -> {
|
||||||
|
ItemAttrib attrib = CommonUtils.stringByObject(item.getAttribValue(), ItemAttrib.class);
|
||||||
|
int item_id = attrib.getItemMetaId();
|
||||||
|
String item_name = metaDataHandler.getTextStringData(metaDataHandler.getMetaItemNameData(item_id));
|
||||||
|
String item_type = metaDataHandler.getMetaItemLargeTypeData(item_id);
|
||||||
|
|
||||||
|
UsersResponse.Item inventory = UsersResponse.Item.builder()
|
||||||
|
.itemId(item_id)
|
||||||
|
.itemName(item_name)
|
||||||
|
.count(attrib.getItemStackCount())
|
||||||
|
.itemGuid(attrib.getItemGuid())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
if(item_type.isEmpty()) {
|
||||||
|
etcList.add(inventory);
|
||||||
|
}else{
|
||||||
|
switch (ITEMLARGETYPE.valueOf(item_type)){
|
||||||
|
case CLOTH -> clothList.add(inventory);
|
||||||
|
case PROP -> propList.add(inventory);
|
||||||
|
case BEAUTY -> beautyList.add(inventory);
|
||||||
|
case TATTOO -> tattooList.add(inventory);
|
||||||
|
case CURRENCY -> currencyList.add(inventory);
|
||||||
|
default -> etcList.add(inventory);
|
||||||
|
}}
|
||||||
|
});
|
||||||
|
|
||||||
|
pageKey = itemList.getLastEvaluatedKey();
|
||||||
|
} while (pageKey != null);
|
||||||
|
|
||||||
|
return UsersResponse.InventoryInfo.builder()
|
||||||
|
.cloth(clothList)
|
||||||
|
.prop(propList)
|
||||||
|
.beauty(beautyList)
|
||||||
|
.tattoo(tattooList)
|
||||||
|
.currency(currencyList)
|
||||||
|
.etc(etcList)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@DynamoDBTransaction
|
||||||
|
public void updateItemStack(String guid, String itemGuid, int stackCount){
|
||||||
|
itemRepository.updateItemStack(guid, itemGuid, stackCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DynamoDBTransaction
|
||||||
|
public void deleteItem(String guid, String itemGuid){
|
||||||
|
itemRepository.deleteItem(guid, itemGuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,6 +21,7 @@ import com.caliverse.admin.global.common.annotation.DynamoDBTransaction;
|
|||||||
import com.caliverse.admin.global.common.constants.AdminConstants;
|
import com.caliverse.admin.global.common.constants.AdminConstants;
|
||||||
import com.caliverse.admin.global.common.constants.CommonConstants;
|
import com.caliverse.admin.global.common.constants.CommonConstants;
|
||||||
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
||||||
|
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||||
import com.caliverse.admin.logs.Indicatordomain.StartEndTime;
|
import com.caliverse.admin.logs.Indicatordomain.StartEndTime;
|
||||||
import com.caliverse.admin.logs.logservice.LogServiceHelper;
|
import com.caliverse.admin.logs.logservice.LogServiceHelper;
|
||||||
import com.caliverse.admin.logs.logservice.indicators.IndicatorsMoneyService;
|
import com.caliverse.admin.logs.logservice.indicators.IndicatorsMoneyService;
|
||||||
@@ -101,14 +102,14 @@ public class DynamodbService {
|
|||||||
mailRepository.insertRecvSystemMail(guid, nickname, items, systemMailData, arguments);
|
mailRepository.insertRecvSystemMail(guid, nickname, items, systemMailData, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PageResult<MailDoc> getMail(SEARCHTYPE type, String guid, String sortKey, String filterName, String filterValue, KeyParam pageKey, boolean sortIndex){
|
public PageResult<MailDoc> getMail(SEARCHTYPE type, String guid, String sortKey, KeyParam pageKey){
|
||||||
Map<String, AttributeValue> pagingKey = null;
|
Map<String, AttributeValue> pagingKey = null;
|
||||||
if(pageKey != null){
|
if(pageKey != null){
|
||||||
pagingKey = new HashMap<>();
|
pagingKey = new HashMap<>();
|
||||||
pagingKey.put(DynamoDBConstants.PK_KEY_NAME, AttributeValue.builder().s(pageKey.getPk()).build());
|
pagingKey.put(DynamoDBConstants.PK_KEY_NAME, AttributeValue.builder().s(pageKey.getPk()).build());
|
||||||
pagingKey.put(DynamoDBConstants.SK_KEY_NAME, AttributeValue.builder().s(pageKey.getSk()).build());
|
pagingKey.put(DynamoDBConstants.SK_KEY_NAME, AttributeValue.builder().s(pageKey.getSk()).build());
|
||||||
}
|
}
|
||||||
PageResult<MailDoc> mailList = mailRepository.getMailListWithPaging(type, guid, sortKey, filterName, filterValue, pagingKey, sortIndex);
|
PageResult<MailDoc> mailList = mailRepository.getMailListWithPaging(type, guid, sortKey, pagingKey);
|
||||||
return mailList;
|
return mailList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,7 +120,7 @@ public class DynamodbService {
|
|||||||
.sortValue(sk)
|
.sortValue(sk)
|
||||||
.build();
|
.build();
|
||||||
MailJsonDoc mailDoc = mailJsonRepository.findById(key);
|
MailJsonDoc mailDoc = mailJsonRepository.findById(key);
|
||||||
return mapper.readValue(mailDoc.getAttribValue(), MailJsonAttrib.class);
|
return CommonUtils.stringByObject(mailDoc.getAttribValue(), MailJsonAttrib.class);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,10 @@
|
|||||||
package com.caliverse.admin.dynamodb.service;
|
package com.caliverse.admin.dynamodb.service;
|
||||||
|
|
||||||
import com.caliverse.admin.domain.entity.BlackList;
|
import com.caliverse.admin.domain.entity.BlackList;
|
||||||
import com.caliverse.admin.dynamodb.domain.atrrib.AccountBaseAttrib;
|
import com.caliverse.admin.dynamodb.domain.atrrib.*;
|
||||||
import com.caliverse.admin.dynamodb.domain.atrrib.MoneyAttrib;
|
import com.caliverse.admin.dynamodb.entity.EAuthAdminLevelType;
|
||||||
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.dynamodb.repository.*;
|
||||||
import com.caliverse.admin.global.common.annotation.DynamoDBTransaction;
|
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 com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -23,7 +17,7 @@ import org.springframework.stereotype.Service;
|
|||||||
public class DynamodbUserService {
|
public class DynamodbUserService {
|
||||||
private final AccountBaseRepository accountBaseRepository;
|
private final AccountBaseRepository accountBaseRepository;
|
||||||
private final UserBaseRepository userBaseRepository;
|
private final UserBaseRepository userBaseRepository;
|
||||||
private final UserNicknameRegistryRepository registryRepository;
|
private final UserNicknameRegistryRepository userNicknameRegistryRepository;
|
||||||
private final NicknameRepository nicknameRepository;
|
private final NicknameRepository nicknameRepository;
|
||||||
private final MoneyRepository moneyRepository;
|
private final MoneyRepository moneyRepository;
|
||||||
|
|
||||||
@@ -34,6 +28,14 @@ public class DynamodbUserService {
|
|||||||
return accountBaseRepository.isBlockUser(account_id);
|
return accountBaseRepository.isBlockUser(account_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isUser(String guid){
|
||||||
|
UserBaseAttrib userBaseAttrib = userBaseRepository.findUser(guid);
|
||||||
|
if(userBaseAttrib == null){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@DynamoDBTransaction
|
@DynamoDBTransaction
|
||||||
public void updateBlockUser(BlackList.STATUSTYPE status, BlackList blackList){
|
public void updateBlockUser(BlackList.STATUSTYPE status, BlackList blackList){
|
||||||
String guid = blackList.getGuid();
|
String guid = blackList.getGuid();
|
||||||
@@ -67,6 +69,53 @@ public class DynamodbUserService {
|
|||||||
return userBaseAttrib.getAccountId();
|
return userBaseAttrib.getAccountId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAccountIdByGuid(String accountId){
|
||||||
|
AccountBaseAttrib accountBaseAttrib = accountBaseRepository.findUser(accountId);
|
||||||
|
if(accountBaseAttrib == null){
|
||||||
|
log.error("getAccountIdByGuid accountBase Null accountId: {}", accountId);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return accountBaseAttrib.getUserGuid();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccountIdByName(String accountId){
|
||||||
|
AccountBaseAttrib accountBaseAttrib = accountBaseRepository.findUser(accountId);
|
||||||
|
if(accountBaseAttrib == null){
|
||||||
|
log.error("getAccountIdByName accountBase Null accountId: {}", accountId);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return getGuidByName(accountBaseAttrib.getUserGuid());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNameByGuid(String nickname){
|
||||||
|
UserNicknameRegistryAttrib nicknameRegistryAttrib = userNicknameRegistryRepository.findUser(nickname);
|
||||||
|
if(nicknameRegistryAttrib == null){
|
||||||
|
log.error("getNameByGuid UserNicknameRegistry Null nickname: {}", nickname);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return nicknameRegistryAttrib.getUserGuid();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserLanguage(String guid){
|
||||||
|
String account_id = getGuidByAccountId(guid);
|
||||||
|
AccountBaseAttrib accountBaseAttrib = accountBaseRepository.findUser(account_id);
|
||||||
|
if(accountBaseAttrib == null){
|
||||||
|
log.error("getUserLanguage accountBase Null accountId: {}", account_id);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return accountBaseAttrib.getLanguageType().name();
|
||||||
|
}
|
||||||
|
|
||||||
|
@DynamoDBTransaction
|
||||||
|
public void updateAdminLevel(String guid, EAuthAdminLevelType type){
|
||||||
|
String account_id = getGuidByAccountId(guid);
|
||||||
|
accountBaseRepository.updateAdminLevel(account_id, type);
|
||||||
|
}
|
||||||
|
|
||||||
public AccountBaseAttrib getAccountInfo(String accountId){
|
public AccountBaseAttrib getAccountInfo(String accountId){
|
||||||
return accountBaseRepository.findUser(accountId);
|
return accountBaseRepository.findUser(accountId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public enum ErrorCode {
|
|||||||
// json
|
// json
|
||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
USER_GAME_LOGIN_JSON_MAPPER_PARSE_ERROR("유저 게임세션 데이터 파싱하는 도중 에러가 발생했습니다."),
|
USER_GAME_LOGIN_JSON_MAPPER_PARSE_ERROR("유저 게임세션 데이터 파싱하는 도중 에러가 발생했습니다."),
|
||||||
|
JSON_PARSE_ERROR("데이터 파싱 에러"),
|
||||||
|
|
||||||
WRONG_TYPE_TOKEN("잘못된 타입의 토큰입니다."),
|
WRONG_TYPE_TOKEN("잘못된 타입의 토큰입니다."),
|
||||||
EXPIRED_TOKEN("만료된 토큰입니다."),
|
EXPIRED_TOKEN("만료된 토큰입니다."),
|
||||||
@@ -102,6 +102,7 @@ public enum ErrorCode {
|
|||||||
DYNAMODB_ITEM_DELETE_FAIL("아이템 삭제에 실패하였습니다."),
|
DYNAMODB_ITEM_DELETE_FAIL("아이템 삭제에 실패하였습니다."),
|
||||||
DYNAMODB_CONVERT_ERROR("형변환 도중 에러가 발생하였습니다."),
|
DYNAMODB_CONVERT_ERROR("형변환 도중 에러가 발생하였습니다."),
|
||||||
DYNAMODB_JSON_PARSE_ERROR("dynamoDB Json 변환 중 에러 발생"),
|
DYNAMODB_JSON_PARSE_ERROR("dynamoDB Json 변환 중 에러 발생"),
|
||||||
|
DYNAMODB_NOT_USER("유저를 찾을수 없습니다."),
|
||||||
|
|
||||||
USER_BLOCK_REGIST_DUPLE_WARNING("이미 제재가 등록된 유저입니다."),
|
USER_BLOCK_REGIST_DUPLE_WARNING("이미 제재가 등록된 유저입니다."),
|
||||||
|
|
||||||
@@ -112,6 +113,9 @@ public enum ErrorCode {
|
|||||||
NICKNAME_SPECIALCHAR_ERROR("닉네임은 특수문자를 사용할 수 없습니다. 다시 시도해주세요."),
|
NICKNAME_SPECIALCHAR_ERROR("닉네임은 특수문자를 사용할 수 없습니다. 다시 시도해주세요."),
|
||||||
NICKNAME_LANGTH_ERROR("닉네임은 최소 2글자에서 최대 12글자까지 허용 합니다. 다시 시도해주세요."),
|
NICKNAME_LANGTH_ERROR("닉네임은 최소 2글자에서 최대 12글자까지 허용 합니다. 다시 시도해주세요."),
|
||||||
|
|
||||||
|
//item
|
||||||
|
DYNAMODB_ITEM_DELETE_ERROR("아이템 삭제 중 오류가 발생하였습니다."),
|
||||||
|
DYNAMODB_ITEM_UPDATE_ERROR("아이템 수정 중 오류가 발생하였습니다."),
|
||||||
|
|
||||||
SENDMAIL_ERROR("메일 발송중 오류가 발생하였습니다. 관리자에게 문의주세요."),
|
SENDMAIL_ERROR("메일 발송중 오류가 발생하였습니다. 관리자에게 문의주세요."),
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ public class DynamoDBConstants {
|
|||||||
public static final String PK_KEY_NICKNAME = "nickname#";
|
public static final String PK_KEY_NICKNAME = "nickname#";
|
||||||
public static final String PK_KEY_RECV_MAIL = "recv_mail#";
|
public static final String PK_KEY_RECV_MAIL = "recv_mail#";
|
||||||
public static final String PK_KEY_SENT_MAIL = "sent_mail#";
|
public static final String PK_KEY_SENT_MAIL = "sent_mail#";
|
||||||
|
public static final String PK_KEY_ITEM = "item#";
|
||||||
|
|
||||||
//SK
|
//SK
|
||||||
public static final String SK_KEY_NAME = "SK";
|
public static final String SK_KEY_NAME = "SK";
|
||||||
@@ -43,6 +44,7 @@ public class DynamoDBConstants {
|
|||||||
public static final String ATTRIB_OWNED_LAND = "OwnedLandAttrib";
|
public static final String ATTRIB_OWNED_LAND = "OwnedLandAttrib";
|
||||||
public static final String ATTRIB_OWNED_BUILDING = "OwnedBuildingAttrib";
|
public static final String ATTRIB_OWNED_BUILDING = "OwnedBuildingAttrib";
|
||||||
public static final String ATTRIB_MAIL = "MailAttrib";
|
public static final String ATTRIB_MAIL = "MailAttrib";
|
||||||
|
public static final String ATTRIB_ITEM = "ItemAttrib";
|
||||||
|
|
||||||
//DOC
|
//DOC
|
||||||
public static final String DOC_SYSTEMMAIL = "SystemMetaMailDoc";
|
public static final String DOC_SYSTEMMAIL = "SystemMetaMailDoc";
|
||||||
@@ -56,6 +58,7 @@ public class DynamoDBConstants {
|
|||||||
public static final String DOC_OWNED_LAND = "OwnedLandDoc";
|
public static final String DOC_OWNED_LAND = "OwnedLandDoc";
|
||||||
public static final String DOC_OWNED_BUILDING = "OwnedBuildingDoc";
|
public static final String DOC_OWNED_BUILDING = "OwnedBuildingDoc";
|
||||||
public static final String DOC_Mail = "MailDoc";
|
public static final String DOC_Mail = "MailDoc";
|
||||||
|
public static final String DOC_ITEM = "ItemDoc";
|
||||||
|
|
||||||
//SCHEMA
|
//SCHEMA
|
||||||
public static final String SCHEMA_UPDATE_TIME = "UpdatedDateTime";
|
public static final String SCHEMA_UPDATE_TIME = "UpdatedDateTime";
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import com.caliverse.admin.global.common.code.CommonCode;
|
|||||||
import com.caliverse.admin.global.common.constants.CommonConstants;
|
import com.caliverse.admin.global.common.constants.CommonConstants;
|
||||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -306,12 +305,21 @@ public class CommonUtils {
|
|||||||
return matcher.find();
|
return matcher.find();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<String, Object> stringByObject(String string) {
|
public static <T> T stringByObject(String string, Class<T> valueType) {
|
||||||
try {
|
try {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
return objectMapper.readValue(string, new TypeReference<>() {});
|
return objectMapper.readValue(string, valueType);
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.JSON_PARSE_ERROR.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String objectByString(Object object) {
|
||||||
|
try {
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
return objectMapper.writeValueAsString(object);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.JSON_PARSE_ERROR.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
package com.caliverse.admin.global.configuration;
|
|
||||||
|
|
||||||
|
|
||||||
import com.caliverse.admin.history.repository.MongoAdminRepository;
|
|
||||||
import com.mongodb.client.MongoClient;
|
|
||||||
import com.mongodb.client.MongoClients;
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.data.mongodb.MongoDatabaseFactory;
|
|
||||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
|
||||||
import org.springframework.data.mongodb.core.SimpleMongoClientDatabaseFactory;
|
|
||||||
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
|
||||||
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
//@EnableMongoRepositories(basePackages = "com.caliverse.admin.history.repository", mongoTemplateRef = "mongoAdminTemplate")
|
|
||||||
public class MongoAdminConfig {
|
|
||||||
|
|
||||||
@Value("${mongodb.host}")
|
|
||||||
String businessLogHost;
|
|
||||||
@Value("${mongodb.admin.username}")
|
|
||||||
String username;
|
|
||||||
@Value("${mongodb.admin.password}")
|
|
||||||
String password;
|
|
||||||
@Value("${mongodb.admin.db}")
|
|
||||||
String db;
|
|
||||||
|
|
||||||
// @Bean(name = "mongoAdminClient")
|
|
||||||
// public MongoClient mongoStatClient() {
|
|
||||||
// String encodePassword = URLEncoder.encode(password, StandardCharsets.UTF_8);
|
|
||||||
// String auth = username.isEmpty() ? "" : String.format("%s:%s@",username, encodePassword);
|
|
||||||
// String connection = String.format("mongodb://%s%s/?authSource=%s", auth, businessLogHost, db);
|
|
||||||
// return MongoClients.create(connection);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @Bean(name = "mongoAdminFactory")
|
|
||||||
// public MongoDatabaseFactory mongoIndicatorFactory(@Qualifier("mongoAdminClient") MongoClient mongoIndicatorClient) {
|
|
||||||
// return new SimpleMongoClientDatabaseFactory(mongoIndicatorClient, db);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @Bean(name = "mongoAdminTemplate")
|
|
||||||
// public MongoTemplate mongoIndicatorTemplate(@Qualifier("mongoAdminFactory") MongoDatabaseFactory mongoIndicatorFactory) {
|
|
||||||
// return new MongoTemplate(mongoIndicatorFactory);
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -46,11 +46,10 @@ public class MongoBusinessLogConfig {
|
|||||||
String encodePassword = URLEncoder.encode(password, StandardCharsets.UTF_8);
|
String encodePassword = URLEncoder.encode(password, StandardCharsets.UTF_8);
|
||||||
String auth = username.isEmpty() ? "" : String.format("%s:%s@",username, encodePassword);
|
String auth = username.isEmpty() ? "" : String.format("%s:%s@",username, encodePassword);
|
||||||
String connection;
|
String connection;
|
||||||
// if(activeProfile.equals("local") || activeProfile.equals("dev")) {
|
if(activeProfile.equals("local") || activeProfile.equals("dev")) {
|
||||||
if(!activeProfile.equals("qa")) {
|
|
||||||
connection = String.format("mongodb://%s%s/?authSource=%s", auth, businessLogHost, businessLogdb);
|
connection = String.format("mongodb://%s%s/?authSource=%s", auth, businessLogHost, businessLogdb);
|
||||||
}else{
|
}else{
|
||||||
connection = String.format("mongodb+srv://%s%s/%s", auth, businessLogHost, businessLogdb);
|
connection = String.format("mongodb+srv://%s%s/%s?retryWrites=true&w=majority&appName=backoffice-%s", auth, businessLogHost, businessLogdb, activeProfile);
|
||||||
}
|
}
|
||||||
return MongoClients.create(connection);
|
return MongoClients.create(connection);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,11 +47,10 @@ public class MongoIndicatorConfig {
|
|||||||
String encodePassword = URLEncoder.encode(password, StandardCharsets.UTF_8);
|
String encodePassword = URLEncoder.encode(password, StandardCharsets.UTF_8);
|
||||||
String auth = username.isEmpty() ? "" : String.format("%s:%s@",username, encodePassword);
|
String auth = username.isEmpty() ? "" : String.format("%s:%s@",username, encodePassword);
|
||||||
String connection;
|
String connection;
|
||||||
// if(activeProfile.equals("local") || activeProfile.equals("dev")) {
|
if(activeProfile.equals("local") || activeProfile.equals("dev")) {
|
||||||
if(!activeProfile.equals("qa")) {
|
|
||||||
connection = String.format("mongodb://%s%s/?authSource=%s", auth, businessLogHost, db);
|
connection = String.format("mongodb://%s%s/?authSource=%s", auth, businessLogHost, db);
|
||||||
}else{
|
}else{
|
||||||
connection = String.format("mongodb+srv://%s%s/%s", auth, businessLogHost, db);
|
connection = String.format("mongodb+srv://%s%s/%s?retryWrites=true&w=majority&appName=backoffice-%s", auth, businessLogHost, db, activeProfile);
|
||||||
}
|
}
|
||||||
return MongoClients.create(connection);
|
return MongoClients.create(connection);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,9 +58,7 @@ public class BusinessLogGenericService extends BusinessLogServiceBase {
|
|||||||
Criteria criteria = makeCriteria(startTime, endTime);
|
Criteria criteria = makeCriteria(startTime, endTime);
|
||||||
List<AggregationOperation> operations = setDefaultOperation(criteria);
|
List<AggregationOperation> operations = setDefaultOperation(criteria);
|
||||||
|
|
||||||
// if(activeProfile.equals("local") || activeProfile.equals("dev")) {
|
if(activeProfile.equals("local") || activeProfile.equals("dev")) {
|
||||||
if(!activeProfile.equals("qa")) {
|
|
||||||
|
|
||||||
//message json parsing
|
//message json parsing
|
||||||
operations.add(context ->
|
operations.add(context ->
|
||||||
new Document("$addFields",
|
new Document("$addFields",
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ public class OneTimeSchedule implements CommandLineRunner {
|
|||||||
@Autowired private IndicatorsDBCapacityService capacityService;
|
@Autowired private IndicatorsDBCapacityService capacityService;
|
||||||
@Autowired private IndicatorsUgqCreateService ugqCreateService;
|
@Autowired private IndicatorsUgqCreateService ugqCreateService;
|
||||||
@Autowired private IndicatorsMetaverseServerService metaverseServerService;
|
@Autowired private IndicatorsMetaverseServerService metaverseServerService;
|
||||||
|
@Autowired private IndicatorsUserCreateService userCreateService;
|
||||||
|
@Autowired private IndicatorsUserLoginService userLoginService;
|
||||||
|
|
||||||
@Autowired private DynamodbService dynamodbService;
|
@Autowired private DynamodbService dynamodbService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -37,15 +40,17 @@ public class OneTimeSchedule implements CommandLineRunner {
|
|||||||
log.info("Starting OneTimeSchedule");
|
log.info("Starting OneTimeSchedule");
|
||||||
// dynamodbService.saveUserMoney(); //유저별 재화 데이터 저장
|
// dynamodbService.saveUserMoney(); //유저별 재화 데이터 저장
|
||||||
|
|
||||||
// LocalDate startDate = LocalDate.of(2024, 11, 8);
|
LocalDate startDate = LocalDate.of(2024, 8, 28);
|
||||||
//// LocalDate currentDate = LocalDate.of(2024, 9, 10);
|
// LocalDate currentDate = LocalDate.of(2025, 1, 31);
|
||||||
// LocalDate currentDate = LocalDate.now();
|
LocalDate currentDate = LocalDate.now();
|
||||||
//
|
|
||||||
// for (LocalDate date = startDate; !date.isAfter(currentDate); date = date.plusDays(1)) {
|
|
||||||
// StartEndTime dayStartEndTime = LogServiceHelper.getCurrentLogSearchEndTime(date, AdminConstants.STAT_DAY_NUM);
|
|
||||||
// StartEndTime weekStartEndTime = LogServiceHelper.getCurrentLogSearchEndTime(date, AdminConstants.STAT_WEEK_NUM);
|
|
||||||
// StartEndTime monthStartEndTime = LogServiceHelper.getCurrentLogSearchEndTime(date, AdminConstants.STAT_MONTH_NUM);
|
|
||||||
//
|
//
|
||||||
|
for (LocalDate date = startDate; !date.isAfter(currentDate); date = date.plusDays(1)) {
|
||||||
|
StartEndTime dayStartEndTime = LogServiceHelper.getCurrentLogSearchEndTime(date, AdminConstants.STAT_DAY_NUM);
|
||||||
|
StartEndTime weekStartEndTime = LogServiceHelper.getCurrentLogSearchEndTime(date, AdminConstants.STAT_WEEK_NUM);
|
||||||
|
StartEndTime monthStartEndTime = LogServiceHelper.getCurrentLogSearchEndTime(date, AdminConstants.STAT_MONTH_NUM);
|
||||||
|
|
||||||
|
// userLoginService.collectUserLogin(dayStartEndTime.getStartTime(), dayStartEndTime.getEndTime());
|
||||||
|
// userCreateService.collectUserCreate(dayStartEndTime.getStartTime(), dayStartEndTime.getEndTime());
|
||||||
// metaverseServerService.collectMetaverseServerCount(dayStartEndTime.getStartTime(), dayStartEndTime.getEndTime(), 13);
|
// metaverseServerService.collectMetaverseServerCount(dayStartEndTime.getStartTime(), dayStartEndTime.getEndTime(), 13);
|
||||||
// capacityService.collectDBCapacity(dayStartEndTime.getStartTime(), dayStartEndTime.getEndTime()); //체크
|
// capacityService.collectDBCapacity(dayStartEndTime.getStartTime(), dayStartEndTime.getEndTime()); //체크
|
||||||
// dauService.collectDailyActiveUser(dayStartEndTime.getStartTime(), dayStartEndTime.getEndTime()); //체크
|
// dauService.collectDailyActiveUser(dayStartEndTime.getStartTime(), dayStartEndTime.getEndTime()); //체크
|
||||||
@@ -56,7 +61,7 @@ public class OneTimeSchedule implements CommandLineRunner {
|
|||||||
// playTimeService.collectUserPlayTime(dayStartEndTime.getStartTime(), dayStartEndTime.getEndTime()); //체크
|
// playTimeService.collectUserPlayTime(dayStartEndTime.getStartTime(), dayStartEndTime.getEndTime()); //체크
|
||||||
// dglcService.collectDailyGameLoginCount(dayStartEndTime.getStartTime(), dayStartEndTime.getEndTime()); //체크
|
// dglcService.collectDailyGameLoginCount(dayStartEndTime.getStartTime(), dayStartEndTime.getEndTime()); //체크
|
||||||
// ugqCreateService.collectUGQCreateCount(dayStartEndTime.getStartTime(), dayStartEndTime.getEndTime()); //체크
|
// ugqCreateService.collectUGQCreateCount(dayStartEndTime.getStartTime(), dayStartEndTime.getEndTime()); //체크
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
package com.caliverse.admin.scheduler.entity;
|
|
||||||
|
|
||||||
public enum ScheduleType {
|
|
||||||
IMMEDIATE, //즉시 실행
|
|
||||||
DELAYED, //지연 실행
|
|
||||||
RECURRING, //반복 실행
|
|
||||||
PERIODIC //특정 시간
|
|
||||||
}
|
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
AND a.deleted = 0
|
AND a.deleted = 0
|
||||||
|
|
||||||
<if test="search_data != null and search_data != ''">
|
<if test="search_data != null and search_data != ''">
|
||||||
AND a.title LIKE CONCAT('%',#{search_data},'%')
|
AND a.title LIKE CONCAT('%',#{searchData},'%')
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="status != null and status != ''">
|
<if test="status != null and status != ''">
|
||||||
@@ -51,8 +51,8 @@
|
|||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="start_dt != null and start_dt != '' and end_dt !=null and end_dt!= ''">
|
<if test="start_dt != null and start_dt != '' and end_dt !=null and end_dt!= ''">
|
||||||
AND a.start_dt >= #{start_dt, jdbcType=TIMESTAMP}
|
AND a.start_dt >= #{startDate, jdbcType=TIMESTAMP}
|
||||||
AND a.end_dt <= #{end_dt, jdbcType=TIMESTAMP}
|
AND a.end_dt <= #{endDate, jdbcType=TIMESTAMP}
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
ORDER BY a.create_dt
|
ORDER BY a.create_dt
|
||||||
|
|||||||
Reference in New Issue
Block a user