에러 반환 타입변경
유저 정보 조회 수정
This commit is contained in:
@@ -158,12 +158,12 @@ public class BlackListService {
|
||||
if(item.getGuid() != null){
|
||||
String guid = item.getGuid();
|
||||
if(dynamoDBService.isGuidChecked(guid)){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.GUID_CHECK.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.WARNING_GUID_CHECK.toString());
|
||||
}
|
||||
// boolean isBlackUser = dynamoDBService.isWhiteOrBlackUser(guid);
|
||||
boolean isBlackUser = dynamodbUserService.isBlockUser(guid);
|
||||
if(isBlackUser){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_EXIT_ERROR.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.USER_BLOCK_REGIST_DUPLE_WARNING.toString());
|
||||
}
|
||||
blackListRequest.setGuid(guid);
|
||||
blackListRequest.setNickname(item.getNickname());
|
||||
@@ -180,15 +180,15 @@ public class BlackListService {
|
||||
//adminDB 에 데이터 있는지 체크
|
||||
int cnt = blackListMapper.getCountByGuid(item.getGuid());
|
||||
if(cnt > 0){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.ADMINDB_EXIT_ERROR.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.USER_BLOCK_REGIST_DUPLE_WARNING.toString());
|
||||
}
|
||||
if(dynamoDBService.isGuidChecked(item.getGuid())){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.GUID_CHECK.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.WARNING_GUID_CHECK.toString());
|
||||
}
|
||||
// boolean isBlackUser = dynamoDBService.isWhiteOrBlackUser(item.getGuid());
|
||||
boolean isBlackUser = dynamodbUserService.isBlockUser(item.getGuid());
|
||||
if(isBlackUser){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_EXIT_ERROR.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.USER_BLOCK_REGIST_DUPLE_WARNING.toString());
|
||||
}
|
||||
blackListRequest.setGuid(item.getGuid());
|
||||
blackListRequest.setNickname(dynamodbUserService.getGuidByName(item.getGuid()));
|
||||
|
||||
@@ -325,92 +325,92 @@ public class DynamoDBService {
|
||||
}
|
||||
|
||||
|
||||
public Map<String, Object> getAccountInfo(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("account_base#"+guid).build()
|
||||
,":skValue", AttributeValue.builder().s("empty").build());
|
||||
|
||||
try {
|
||||
// 쿼리 실행
|
||||
QueryResponse response = executeQuery(key, values);
|
||||
|
||||
// 응답에서 원하는 속성을 가져옵니다.
|
||||
for (Map<String, AttributeValue> item : response.items()) {
|
||||
AttributeValue attrValue = item.get("AccountBaseAttrib");
|
||||
if (attrValue != null) {
|
||||
// "Attr" 속성의 값을 읽어옵니다.
|
||||
String attrJson = attrValue.s();
|
||||
|
||||
// JSON 문자열을 파싱하여 Map 또는 다른 객체로 변환합니다.
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
Map<String, Object> attrMap = objectMapper.readValue(attrJson, new TypeReference<Map<String, Object>>() {});
|
||||
|
||||
resMap.put("userInfo", UsersResponse.UserInfo.builder()
|
||||
.aid(CommonUtils.objectToString(attrMap.get("user_guid")))
|
||||
.userId(CommonUtils.objectToString(attrMap.get("account_id")))
|
||||
.nation(LANGUAGETYPE.values()[CommonUtils.objectToInteger(attrMap.get("language_type"))])
|
||||
//
|
||||
.membership(CommonUtils.objectToString(null))
|
||||
//todo 친구 추천 코드 임시 null 값으로 셋팅 23.09.20
|
||||
.friendCode(CommonUtils.objectToString(null))
|
||||
.createDt(CommonUtils.objectToString(attrMap.get("created_datetime")))
|
||||
.accessDt(CommonUtils.objectToString(attrMap.get("login_datetime")))
|
||||
.endDt(CommonUtils.objectToString(attrMap.get("logout_datetime")))
|
||||
.walletUrl(CommonUtils.objectToString(attrMap.get("connect_facewallet")))
|
||||
.adminLevel(CommonUtils.objectToString(attrMap.get("auth_amdin_level_type")))
|
||||
//todo 예비슬롯 임시 null 값으로 셋팅 23.09.20
|
||||
.spareSlot(CommonUtils.objectToString(null))
|
||||
.build());
|
||||
}
|
||||
}
|
||||
log.info("getAccountInfo UserInfo: {}", resMap);
|
||||
|
||||
return resMap;
|
||||
} catch (Exception e) {
|
||||
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());
|
||||
}
|
||||
}
|
||||
// public Map<String, Object> getAccountInfo(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("account_base#"+guid).build()
|
||||
// ,":skValue", AttributeValue.builder().s("empty").build());
|
||||
//
|
||||
// try {
|
||||
// // 쿼리 실행
|
||||
// QueryResponse response = executeQuery(key, values);
|
||||
//
|
||||
// // 응답에서 원하는 속성을 가져옵니다.
|
||||
// for (Map<String, AttributeValue> item : response.items()) {
|
||||
// AttributeValue attrValue = item.get("AccountBaseAttrib");
|
||||
// if (attrValue != null) {
|
||||
// // "Attr" 속성의 값을 읽어옵니다.
|
||||
// String attrJson = attrValue.s();
|
||||
//
|
||||
// // JSON 문자열을 파싱하여 Map 또는 다른 객체로 변환합니다.
|
||||
// ObjectMapper objectMapper = new ObjectMapper();
|
||||
// Map<String, Object> attrMap = objectMapper.readValue(attrJson, new TypeReference<Map<String, Object>>() {});
|
||||
//
|
||||
// resMap.put("userInfo", UsersResponse.UserInfo.builder()
|
||||
// .aid(CommonUtils.objectToString(attrMap.get("user_guid")))
|
||||
// .userId(CommonUtils.objectToString(attrMap.get("account_id")))
|
||||
// .nation(LANGUAGETYPE.values()[CommonUtils.objectToInteger(attrMap.get("language_type"))])
|
||||
// //
|
||||
// .membership(CommonUtils.objectToString(null))
|
||||
// //todo 친구 추천 코드 임시 null 값으로 셋팅 23.09.20
|
||||
// .friendCode(CommonUtils.objectToString(null))
|
||||
// .createDt(CommonUtils.objectToString(attrMap.get("created_datetime")))
|
||||
// .accessDt(CommonUtils.objectToString(attrMap.get("login_datetime")))
|
||||
// .endDt(CommonUtils.objectToString(attrMap.get("logout_datetime")))
|
||||
// .walletUrl(CommonUtils.objectToString(attrMap.get("connect_facewallet")))
|
||||
// .adminLevel(CommonUtils.objectToString(attrMap.get("auth_amdin_level_type")))
|
||||
// //todo 예비슬롯 임시 null 값으로 셋팅 23.09.20
|
||||
// .spareSlot(CommonUtils.objectToString(null))
|
||||
// .build());
|
||||
// }
|
||||
// }
|
||||
// log.info("getAccountInfo UserInfo: {}", resMap);
|
||||
//
|
||||
// return resMap;
|
||||
// } catch (Exception e) {
|
||||
// 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());
|
||||
// }
|
||||
// }
|
||||
|
||||
// 유저조회 - 아바타
|
||||
public Map<String, Object> getAvatarInfo(String guid){
|
||||
|
||||
@@ -38,7 +38,6 @@ import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static com.caliverse.admin.global.common.utils.CommonUtils.convertIsoByDatetime;
|
||||
import static com.caliverse.admin.global.common.utils.DateUtils.stringToDateTime;
|
||||
import static com.caliverse.admin.global.common.utils.DateUtils.stringISOToLocalDateTime;
|
||||
|
||||
@Service
|
||||
@@ -445,7 +444,7 @@ public class LandService {
|
||||
if(nickname.isEmpty() || !nickname.equals(landRequest.getUserName())){
|
||||
return LandResponse.builder()
|
||||
.status(CommonCode.ERROR.getHttpStatus())
|
||||
.result(ErrorCode.GUID_CHECK.toString())
|
||||
.result(ErrorCode.WARNING_GUID_CHECK.toString())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ public class MailService {
|
||||
if(mailRequest.getGuid() != null){
|
||||
if(mailRequest.getUserType().equals(Mail.USERTYPE.GUID) && dynamoDBService.isGuidChecked(mailRequest.getGuid())){
|
||||
log.error("postMail RECEIVETYPE Single Guid Find Fail");
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.GUID_CHECK.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.WARNING_GUID_CHECK.getMessage());
|
||||
}
|
||||
String guid = mailRequest.getGuid();
|
||||
// 닉네임이면 guid로 바꾼다
|
||||
@@ -213,7 +213,7 @@ public class MailService {
|
||||
case "GUID" -> {
|
||||
if (dynamoDBService.isGuidChecked(excel.getUser())) {
|
||||
log.error("postMail Multi Guid({}) Find Fail", excel.getUser());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.GUID_CHECK.toString());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.WARNING_GUID_CHECK.toString());
|
||||
}
|
||||
}
|
||||
case "NICKNAME" -> {
|
||||
|
||||
@@ -9,11 +9,14 @@ import java.util.stream.Collectors;
|
||||
import com.caliverse.admin.domain.entity.FriendRequest;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPE;
|
||||
import com.caliverse.admin.domain.request.MailRequest;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.AccountBaseAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.MailAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.MailJsonAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.MoneyAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.MailDoc;
|
||||
import com.caliverse.admin.dynamodb.dto.PageResult;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbService;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbUserService;
|
||||
import com.caliverse.admin.global.common.utils.DynamodbUtil;
|
||||
import com.caliverse.admin.redis.service.RedisUserInfoService;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
@@ -54,6 +57,8 @@ public class UsersService {
|
||||
@Qualifier("objectMapper")
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
@Autowired
|
||||
private DynamodbUserService dynamodbUserService;
|
||||
|
||||
// 닉네임 변경
|
||||
public UsersResponse changeNickname(UsersRequest usersRequest){
|
||||
@@ -138,20 +143,41 @@ public class UsersService {
|
||||
|
||||
public UsersResponse getBasicInfo(String guid){
|
||||
|
||||
String account_id = dynamoDBService.getGuidByAccountId(guid);
|
||||
//userInfo
|
||||
Map<String, Object> userInfo = dynamoDBService.getAccountInfo(account_id);
|
||||
String account_id = dynamodbUserService.getGuidByAccountId(guid);
|
||||
|
||||
AccountBaseAttrib accountBaseAttrib = dynamodbUserService.getAccountInfo(account_id);
|
||||
UsersResponse.UserInfo userInfo = UsersResponse.UserInfo.builder()
|
||||
.aid(accountBaseAttrib.getUserGuid())
|
||||
.userId(accountBaseAttrib.getAccountId())
|
||||
.nation(accountBaseAttrib.getLanguageType())
|
||||
.membership("")
|
||||
.friendCode("")
|
||||
.createDt(accountBaseAttrib.getCreatedDateTime())
|
||||
.accessDt(accountBaseAttrib.getLoginDateTime())
|
||||
.endDt(accountBaseAttrib.getLogoutDateTime())
|
||||
.walletUrl("")
|
||||
.adminLevel(accountBaseAttrib.getAuthAdminLevelType().name())
|
||||
.spareSlot("")
|
||||
.build();
|
||||
|
||||
// charInfo
|
||||
Map<String, Object> charInfo = dynamoDBService.getCharInfo(guid);
|
||||
MoneyAttrib moneyAttrib = dynamodbUserService.getMoneyInfo(guid);
|
||||
UsersResponse.CharInfo charInfo = UsersResponse.CharInfo.builder()
|
||||
.characterName(dynamodbUserService.getGuidByName(guid))
|
||||
.level("")
|
||||
.goldCali(moneyAttrib.getGold())
|
||||
.redCali(moneyAttrib.getCalium())
|
||||
.blackCali(moneyAttrib.getRuby())
|
||||
.blueCali(moneyAttrib.getSapphire())
|
||||
.build();
|
||||
|
||||
boolean userSession = userGameSessionService.userSession(guid);
|
||||
|
||||
return UsersResponse.builder()
|
||||
.resultData(
|
||||
UsersResponse.ResultData.builder()
|
||||
.charInfo((UsersResponse.CharInfo) charInfo.get("charInfo"))
|
||||
.userInfo((UsersResponse.UserInfo) userInfo.get("userInfo"))
|
||||
.charInfo(charInfo)
|
||||
.userInfo(userInfo)
|
||||
.userSession(userSession)
|
||||
.build()
|
||||
)
|
||||
|
||||
@@ -79,7 +79,7 @@ public class WhiteListService {
|
||||
Map<String, AttributeValue> whiteAttr = dynamoDBService.getItem("char#" + item, "char#" + item);
|
||||
//guid 검증
|
||||
if(whiteAttr.size() == 0){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.GUID_CHECK.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.WARNING_GUID_CHECK.getMessage());
|
||||
}
|
||||
//화이트리스트 확정까지 보류
|
||||
// boolean isWhiteUser = dynamoDBService.isWhiteOrBlackUser(whiteAttr.get("isWhiteUser"));
|
||||
@@ -116,7 +116,7 @@ public class WhiteListService {
|
||||
|
||||
//guid 검증
|
||||
if(whiteAttr.size() == 0){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.GUID_CHECK.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.WARNING_GUID_CHECK.getMessage());
|
||||
}
|
||||
//화이트리스트 확정까지 보류
|
||||
// boolean isWhiteUser = dynamoDBService.isWhiteOrBlackUser(whiteAttr.get("isWhiteUser"));
|
||||
|
||||
Reference in New Issue
Block a user