HISTORYTYPE > HISTORYDETAILTYPE 변경
로그 유저 아닐시 시스템으로 남기게 변경 히스토리 남기는 방식 추가 적용 HistoryRequest 생성 히스토리 API 작업 히스토리 mongodb 조회
This commit is contained in:
@@ -4,7 +4,6 @@ import com.caliverse.admin.domain.adminlog.AdminPasswordInitLog;
|
||||
import com.caliverse.admin.domain.adminlog.IAdminLog;
|
||||
import com.caliverse.admin.domain.dao.admin.AdminMapper;
|
||||
import com.caliverse.admin.domain.dao.admin.GroupMapper;
|
||||
import com.caliverse.admin.domain.dao.admin.HistoryMapper;
|
||||
import com.caliverse.admin.domain.entity.*;
|
||||
import com.caliverse.admin.domain.request.AdminRequest;
|
||||
import com.caliverse.admin.domain.request.AuthenticateRequest;
|
||||
@@ -196,7 +195,7 @@ public class AdminService {
|
||||
jsonObject.put("email",item.getEmail());
|
||||
// map.put("content",jsonObject.toString());
|
||||
// historyMapper.saveLog(map);
|
||||
historyService.setLog(HISTORYTYPE.LOGIN_PERMITTED, jsonObject);
|
||||
historyService.setLog(HISTORYTYPEDETAIL.LOGIN_PERMITTED, jsonObject);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -240,7 +239,7 @@ public class AdminService {
|
||||
jsonObject.put("Authority(after)", afterGroup != null? afterGroup.get("name"):"");
|
||||
// map.put("content",jsonObject.toString());
|
||||
// historyMapper.saveLog(map);
|
||||
historyService.setLog(HISTORYTYPE.ADMIN_INFO_UPDATE, jsonObject);
|
||||
historyService.setLog(HISTORYTYPEDETAIL.ADMIN_INFO_UPDATE, jsonObject);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -275,7 +274,7 @@ public class AdminService {
|
||||
jsonObject.put("email",item.getEmail());
|
||||
// map.put("content",jsonObject.toString());
|
||||
// historyMapper.saveLog(map);
|
||||
historyService.setLog(HISTORYTYPE.ADMIN_INFO_DELETE, jsonObject);
|
||||
historyService.setLog(HISTORYTYPEDETAIL.ADMIN_INFO_DELETE, jsonObject);
|
||||
}
|
||||
);
|
||||
log.info("deleteAdmin Deleted Admin: {}", map);
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.caliverse.admin.domain.service;
|
||||
import com.caliverse.admin.domain.dao.admin.BattleMapper;
|
||||
import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
|
||||
import com.caliverse.admin.domain.entity.BattleEvent;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPE;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.domain.entity.metadata.MetaBattleConfigData;
|
||||
import com.caliverse.admin.domain.entity.metadata.MetaBattleRewardData;
|
||||
import com.caliverse.admin.domain.request.BattleEventRequest;
|
||||
@@ -15,7 +15,7 @@ import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
import com.caliverse.admin.global.common.constants.CommonConstants;
|
||||
import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.history.service.MysqlHistoryLogService;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -170,12 +170,10 @@ public class BattleEventService {
|
||||
BattleEvent event_info = battleMapper.getBattleEventDetail(battle_event_id);
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.BATTLE_EVENT_ADD,
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_ADD,
|
||||
MysqlConstants.TABLE_NAME_BATTLE_EVENT,
|
||||
HISTORYTYPE.BATTLE_EVENT_ADD.name(),
|
||||
event_info,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_ADD.name(),
|
||||
event_info
|
||||
);
|
||||
|
||||
dynamodbBattleEventService.insertBattleEvent(battleEventRequest);
|
||||
@@ -234,13 +232,11 @@ public class BattleEventService {
|
||||
BattleEvent after_info = battleMapper.getBattleEventDetail(id);
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.BATTLE_EVENT_UPDATE,
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_BATTLE_EVENT,
|
||||
HISTORYTYPE.BATTLE_EVENT_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE.name(),
|
||||
before_info,
|
||||
after_info,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
after_info
|
||||
);
|
||||
|
||||
dynamodbBattleEventService.updateBattleEvent(battleEventRequest);
|
||||
@@ -277,13 +273,11 @@ public class BattleEventService {
|
||||
}
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.BATTLE_EVENT_UPDATE,
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_BATTLE_EVENT,
|
||||
HISTORYTYPE.BATTLE_EVENT_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE.name(),
|
||||
info,
|
||||
battleMapper.getBattleEventDetail(id),
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
battleMapper.getBattleEventDetail(id)
|
||||
);
|
||||
|
||||
dynamodbBattleEventService.updateStopBattleEvent(info);
|
||||
@@ -317,12 +311,10 @@ public class BattleEventService {
|
||||
log.info("BattleEvent Delete Complete: {}", item);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.BATTLE_EVENT_DELETE,
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_DELETE,
|
||||
MysqlConstants.TABLE_NAME_BATTLE_EVENT,
|
||||
HISTORYTYPE.BATTLE_EVENT_DELETE.name(),
|
||||
info,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_DELETE.name(),
|
||||
info
|
||||
);
|
||||
|
||||
// dynamodbLandAuctionService.cancelLandAuction(auction_info);
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package com.caliverse.admin.domain.service;
|
||||
|
||||
import com.caliverse.admin.domain.dao.admin.BlackListMapper;
|
||||
import com.caliverse.admin.domain.dao.admin.HistoryMapper;
|
||||
import com.caliverse.admin.domain.entity.BlackList;
|
||||
import com.caliverse.admin.domain.entity.Excel;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPE;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.domain.request.BlackListRequest;
|
||||
import com.caliverse.admin.domain.response.BlackListResponse;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbUserService;
|
||||
@@ -16,9 +15,8 @@ import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.global.common.utils.ExcelUtils;
|
||||
import com.caliverse.admin.history.service.MysqlHistoryLogService;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -174,9 +172,9 @@ public class BlackListService {
|
||||
BlackList info = blackListMapper.getBlackListDetail(blackListRequest.getId());
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.BLACKLIST_ADD,
|
||||
HISTORYTYPEDETAIL.BLACKLIST_ADD,
|
||||
MysqlConstants.TABLE_NAME_USER_BLOCK,
|
||||
HISTORYTYPE.BLACKLIST_ADD.name(),
|
||||
HISTORYTYPEDETAIL.BLACKLIST_ADD.name(),
|
||||
info
|
||||
);
|
||||
}
|
||||
@@ -208,9 +206,9 @@ public class BlackListService {
|
||||
BlackList info = blackListMapper.getBlackListDetail(blackListRequest.getId());
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.BLACKLIST_ADD,
|
||||
HISTORYTYPEDETAIL.BLACKLIST_ADD,
|
||||
MysqlConstants.TABLE_NAME_USER_BLOCK,
|
||||
HISTORYTYPE.BLACKLIST_ADD.name(),
|
||||
HISTORYTYPEDETAIL.BLACKLIST_ADD.name(),
|
||||
info
|
||||
);
|
||||
}
|
||||
@@ -242,11 +240,12 @@ public class BlackListService {
|
||||
|
||||
logger.info("deleteBlackList delete: {}",map);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.BLACKLIST_DELETE,
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.BLACKLIST_DELETE,
|
||||
MysqlConstants.TABLE_NAME_USER_BLOCK,
|
||||
HISTORYTYPE.BLACKLIST_DELETE.name(),
|
||||
blackList
|
||||
HISTORYTYPEDETAIL.BLACKLIST_DELETE.name(),
|
||||
blackList,
|
||||
blackListMapper.getBlackListDetail(id)
|
||||
);
|
||||
|
||||
if(dynamodbUserService.isBlockUser(blackList.getGuid()))
|
||||
|
||||
@@ -17,7 +17,7 @@ import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.constants.Web3Constants;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.history.service.MysqlHistoryLogService;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.json.JSONObject;
|
||||
@@ -147,12 +147,10 @@ public class CaliumService {
|
||||
Calium calium = caliumMapper.getCaliumRequestDetail(caliumRequest.getId());
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.CALIUM_ADD,
|
||||
HISTORYTYPEDETAIL.CALIUM_ADD,
|
||||
MysqlConstants.TABLE_NAME_CALIUM_REQUEST,
|
||||
HISTORYTYPE.CALIUM_ADD.name(),
|
||||
calium,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.CALIUM_ADD.name(),
|
||||
calium
|
||||
);
|
||||
|
||||
//로그 기록
|
||||
@@ -160,7 +158,7 @@ public class CaliumService {
|
||||
jsonObject.put("dept",caliumRequest.getDept());
|
||||
jsonObject.put("count",caliumRequest.getCount());
|
||||
jsonObject.put("content",caliumRequest.getContent());
|
||||
historyService.setLog(HISTORYTYPE.CALIUM_ADD, jsonObject);
|
||||
historyService.setLog(HISTORYTYPEDETAIL.CALIUM_ADD, jsonObject);
|
||||
|
||||
return CaliumResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
@@ -195,7 +193,7 @@ public class CaliumService {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
// jsonObject.put("dynamoDB_update",dynamoResult);
|
||||
|
||||
historyService.setLog(HISTORYTYPE.CALIUM_TOTAL_UPDATE, jsonObject);
|
||||
historyService.setLog(HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE, jsonObject);
|
||||
|
||||
return CaliumResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.caliverse.admin.domain.service;
|
||||
import com.caliverse.admin.domain.dao.admin.DataMapper;
|
||||
import com.caliverse.admin.domain.dao.admin.LandMapper;
|
||||
import com.caliverse.admin.domain.entity.*;
|
||||
import com.caliverse.admin.domain.request.AuthenticateRequest;
|
||||
import com.caliverse.admin.domain.request.DataRequest;
|
||||
import com.caliverse.admin.domain.request.LogGenericRequest;
|
||||
import com.caliverse.admin.domain.response.DataResponse;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbDataService;
|
||||
@@ -12,10 +12,9 @@ import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.global.component.transaction.TransactionIdManager;
|
||||
import com.caliverse.admin.history.domain.DynamodbDataInitializeHistory;
|
||||
import com.caliverse.admin.history.service.DataInitializeHistoryService;
|
||||
import com.caliverse.admin.history.service.MysqlHistoryLogService;
|
||||
import com.caliverse.admin.mongodb.domain.APILogInfo;
|
||||
import com.caliverse.admin.mongodb.service.DataInitializeHistoryService;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.mongodb.UncategorizedMongoDbException;
|
||||
@@ -38,7 +37,7 @@ public class DataService {
|
||||
private final LandMapper landMapper;
|
||||
private final DataMapper dataMapper;
|
||||
private final DataInitializeHistoryService dataInitializeHistoryService;
|
||||
private final TransactionIdManager transactionIdManager;
|
||||
|
||||
|
||||
public DataResponse initHistoryList(LogGenericRequest logGenericRequest){
|
||||
|
||||
@@ -48,9 +47,9 @@ public class DataService {
|
||||
logGenericRequest.setStartDt(startDt);
|
||||
logGenericRequest.setEndDt(endDt);
|
||||
|
||||
List<DynamodbDataInitializeHistory> logList = new ArrayList<>();
|
||||
List<APILogInfo> logList = new ArrayList<>();
|
||||
try{
|
||||
logList = dataInitializeHistoryService.loadHistoryData(logGenericRequest, DynamodbDataInitializeHistory.class);
|
||||
logList = dataInitializeHistoryService.loadHistoryData(logGenericRequest, APILogInfo.class);
|
||||
}catch(UncategorizedMongoDbException e){
|
||||
if (e.getMessage().contains("Sort exceeded memory limit")) {
|
||||
log.error("MongoDB Query memory limit error: {}", e.getMessage());
|
||||
@@ -80,11 +79,19 @@ public class DataService {
|
||||
}
|
||||
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public DataResponse initData(AuthenticateRequest authenticateRequest){
|
||||
EInitDataType dataType = authenticateRequest.getInitDataType();
|
||||
public DataResponse initData(DataRequest dataRequest){
|
||||
EInitDataType dataType = dataRequest.getInitDataType();
|
||||
dataRequest.setCreateBy(CommonUtils.getAdmin().getId());
|
||||
log.info("initData email: {}, initDataType: {}", CommonUtils.getAdmin().getEmail(), dataType);
|
||||
|
||||
dataMapper.postDataInit(dataType, CommonUtils.getAdmin().getId());
|
||||
dataMapper.postDataInit(dataRequest);
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.DATA_INIT_ADD,
|
||||
MysqlConstants.TABLE_NAME_DATA_INIT,
|
||||
HISTORYTYPEDETAIL.DATA_INIT_ADD.name(),
|
||||
dataMapper.getDataInitDetail(dataRequest.getId())
|
||||
);
|
||||
|
||||
// switch(dataType){
|
||||
// case LandAuction -> {
|
||||
@@ -130,30 +137,25 @@ public class DataService {
|
||||
landMapper.deleteMessage(map);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.LAND_AUCTION_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
|
||||
MysqlConstants.TABLE_NAME_LAND_AUCTION,
|
||||
HISTORYTYPE.LAND_AUCTION_INITIALIZE.name(),
|
||||
landAuction,
|
||||
CommonUtils.getAdmin() == null ? "" : CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp() == null ? "" : CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
|
||||
landAuction
|
||||
);
|
||||
if (!message.isEmpty()) {
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.LAND_AUCTION_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
|
||||
MysqlConstants.TABLE_NAME_MESSAGE,
|
||||
HISTORYTYPE.LAND_AUCTION_INITIALIZE.name(),
|
||||
message,
|
||||
CommonUtils.getAdmin() == null ? "" : CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp() == null ? "" : CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
|
||||
message
|
||||
);
|
||||
}
|
||||
|
||||
dataInitializeHistoryService.mysqlDataInitHistory(
|
||||
EInitDataType.LandAuction,
|
||||
MysqlConstants.TABLE_NAME_LAND_AUCTION,
|
||||
transactionIdManager.getCurrentTransactionId(),
|
||||
true,
|
||||
"",
|
||||
"SUCCESS",
|
||||
landAuction
|
||||
);
|
||||
|
||||
@@ -162,7 +164,6 @@ public class DataService {
|
||||
dataInitializeHistoryService.mysqlDataInitHistory(
|
||||
EInitDataType.LandAuction,
|
||||
MysqlConstants.TABLE_NAME_LAND_AUCTION,
|
||||
transactionIdManager.getCurrentTransactionId(),
|
||||
false,
|
||||
e.getMessage(),
|
||||
landAuction
|
||||
@@ -176,20 +177,17 @@ public class DataService {
|
||||
landMapper.initLandOwnedChanges(id);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNED_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE,
|
||||
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
|
||||
HISTORYTYPE.LAND_OWNED_INITIALIZE.name(),
|
||||
landOwnerChange,
|
||||
CommonUtils.getAdmin() == null ? "" : CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp() == null ? "" : CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE.name(),
|
||||
landOwnerChange
|
||||
);
|
||||
|
||||
dataInitializeHistoryService.mysqlDataInitHistory(
|
||||
EInitDataType.LandOwned,
|
||||
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
|
||||
transactionIdManager.getCurrentTransactionId(),
|
||||
true,
|
||||
"",
|
||||
"SUCCESS",
|
||||
landOwnerChange
|
||||
);
|
||||
}catch(Exception e){
|
||||
@@ -197,7 +195,6 @@ public class DataService {
|
||||
dataInitializeHistoryService.mysqlDataInitHistory(
|
||||
EInitDataType.LandOwned,
|
||||
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
|
||||
transactionIdManager.getCurrentTransactionId(),
|
||||
false,
|
||||
e.getMessage(),
|
||||
landOwnerChange
|
||||
|
||||
@@ -90,11 +90,11 @@ public class DynamoDBService {
|
||||
}
|
||||
|
||||
// guid check
|
||||
public boolean isGuidChecked(String guid) {
|
||||
Map<String, AttributeValue> item = getItem("user_base#"+guid,"empty");
|
||||
|
||||
return item.isEmpty();
|
||||
}
|
||||
// public boolean isGuidChecked(String guid) {
|
||||
// Map<String, AttributeValue> item = getItem("user_base#"+guid,"empty");
|
||||
//
|
||||
// return item.isEmpty();
|
||||
// }
|
||||
|
||||
|
||||
// public Map<String, Object> getAccountInfo(String guid){
|
||||
@@ -274,125 +274,6 @@ public class DynamoDBService {
|
||||
});
|
||||
}
|
||||
|
||||
public boolean isWhiteOrBlackUser(String accountId){
|
||||
String key = "PK = :pkValue";
|
||||
Map<String, AttributeValue> values = Map.of(":pkValue", AttributeValue.builder().s("account_base#"+accountId).build());
|
||||
AtomicBoolean isFlag = new AtomicBoolean(false);
|
||||
|
||||
excuteItems(executeQuery(key, values), "AccountBaseAttrib")
|
||||
.forEach(attrMap -> {
|
||||
String[] blockPolicy = CommonUtils.objectToStringArray(attrMap.get("block_policy"));
|
||||
|
||||
if(Arrays.stream(blockPolicy).findAny().isEmpty()){
|
||||
isFlag.set(false);
|
||||
}else{
|
||||
isFlag.set(true);
|
||||
}
|
||||
});
|
||||
|
||||
return isFlag.get();
|
||||
// if (attributeValue == null || attributeValue.s() == null) {
|
||||
// // 속성 값이 없거나 문자열이 아닌 경우에 대한 처리
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// // 속성 값을 문자열로 가져옴
|
||||
// String isFlag = attributeValue.s();
|
||||
//
|
||||
// // "true" 문자열과 대소문자 구분 없이 비교하여 boolean 값으로 반환
|
||||
// return isFlag.equalsIgnoreCase("true");
|
||||
// if(attr == null) return false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 닉네임 변경
|
||||
public void updateNickname(String guid,String nickname,String newNickname){
|
||||
try{
|
||||
// char#guid 에서 CharInfo-> DisplayName 변경
|
||||
updateCharInfo(guid, newNickname);
|
||||
|
||||
// nickname#xxx 에서 Attr-> AccountId 변경
|
||||
createNewNickName(guid,newNickname);
|
||||
|
||||
// 기존 nickname 항목 삭제 처리
|
||||
deleteNickname(nickname);
|
||||
}catch (Exception e){
|
||||
log.error("updateNickname: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void updateCharInfo(String guid, String newNickname) throws JsonProcessingException {
|
||||
|
||||
// 기존 CharInfo 값 가져오기
|
||||
Map<String, AttributeValue> item = getItem("char#" + guid, "char#" + guid);
|
||||
String charInfoJson = item.get("CharInfo").s();
|
||||
|
||||
// CharInfo JSON 문자열을 파싱
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
JsonNode charInfoNode = objectMapper.readTree(charInfoJson);
|
||||
|
||||
// 원하는 속성 변경
|
||||
((ObjectNode) charInfoNode).put("DisplayName", newNickname);
|
||||
|
||||
// 변경된 CharInfo JSON 문자열
|
||||
String updatedCharInfoJson = charInfoNode.toString();
|
||||
|
||||
// 업데이트할 내용을 정의
|
||||
Map<String, AttributeValue> expressionAttributeValues = new HashMap<>();
|
||||
expressionAttributeValues.put(":newNickName", AttributeValue.builder().s(updatedCharInfoJson).build());
|
||||
|
||||
// 업데이트 표현식을 정의
|
||||
String updateExpression = "SET CharInfo = :newNickName";
|
||||
// 업데이트 요청 생성
|
||||
UpdateItemRequest updateRequest = UpdateItemRequest.builder()
|
||||
.tableName(metaTable)
|
||||
.key(Map.of(
|
||||
"PK", AttributeValue.builder().s("char#" + guid).build(),
|
||||
"SK", AttributeValue.builder().s("char#" + guid).build()))
|
||||
.updateExpression(updateExpression)
|
||||
.expressionAttributeValues(expressionAttributeValues)
|
||||
.returnValues(ReturnValue.ALL_NEW) // 업데이트 후의 값을 반환하려면 지정
|
||||
.build();
|
||||
|
||||
|
||||
dynamoDbClient.updateItem(updateRequest);
|
||||
}
|
||||
|
||||
public void createNewNickName(String guid, String newNickname) {
|
||||
String attrJson = String.format("{\"AccountGuid\":\"%s\",\"AccountId\":\"%s\"}", guid, newNickname);
|
||||
|
||||
Map<String, AttributeValue> itemAttributes = new HashMap<>();
|
||||
itemAttributes.put("PK", AttributeValue.builder().s("user_nickname_registry#global").build());
|
||||
itemAttributes.put("SK", AttributeValue.builder().s(newNickname).build());
|
||||
itemAttributes.put("Attr", AttributeValue.builder().s(attrJson).build());
|
||||
itemAttributes.put("Type", AttributeValue.builder().s("NickName").build());
|
||||
|
||||
PutItemRequest item = PutItemRequest.builder()
|
||||
.tableName(metaTable)
|
||||
.item(itemAttributes)
|
||||
.build();
|
||||
|
||||
dynamoDbClient.putItem(item);
|
||||
|
||||
}
|
||||
public void deleteNickname(String nickname) {
|
||||
|
||||
Map<String, AttributeValue> itemAttributes = new HashMap<>();
|
||||
itemAttributes.put("PK", AttributeValue.builder().s("nickname#" + nickname).build());
|
||||
itemAttributes.put("SK", AttributeValue.builder().s("nickname#").build());
|
||||
|
||||
DeleteItemRequest request = DeleteItemRequest.builder()
|
||||
.tableName(metaTable)
|
||||
.key(itemAttributes)
|
||||
.build();
|
||||
|
||||
dynamoDbClient.deleteItem(request);
|
||||
|
||||
}
|
||||
|
||||
//신고 내역 조회
|
||||
public List<UserReportResponse.Report> getUserReportList(Map<String,String> requestParam) {
|
||||
|
||||
@@ -708,63 +589,6 @@ public class DynamoDBService {
|
||||
dynamoDbClient.updateItem(item);
|
||||
}
|
||||
|
||||
//아이템 내역 조회
|
||||
// public List<ItemList> getItems(String guid){
|
||||
// List<ItemList> list = new ArrayList<>();
|
||||
//
|
||||
// String key = "PK = :pkValue";
|
||||
// Map<String, AttributeValue> values = Map.of(":pkValue", AttributeValue.builder().s("item#"+guid).build());
|
||||
//
|
||||
//// QueryRequest queryRequest = QueryRequest.builder()
|
||||
//// .tableName(metaTable)
|
||||
//// .keyConditionExpression("PK = :pkValue") // 파티션 키와 조건식 설정
|
||||
//// .expressionAttributeValues(Map.of(":pkValue", AttributeValue.builder().s("item#"+guid).build()))
|
||||
//// .build();
|
||||
//
|
||||
// try {
|
||||
// // 쿼리 실행
|
||||
// QueryResponse response = executeQuery(key, values);
|
||||
//
|
||||
// int row = 1;
|
||||
// // 응답에서 원하는 속성을 가져옵니다.
|
||||
// for (Map<String, AttributeValue> item : response.items()) {
|
||||
// AttributeValue attrValue = item.get("ItemAttrib");
|
||||
// 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>>() {
|
||||
// });
|
||||
//
|
||||
// String item_nm = metaDataHandler.getMetaItemNameData(CommonUtils.objectToInteger(attrMap.get("item_meta_id")));
|
||||
// ItemList itemInfo = ItemList.builder()
|
||||
// .rowNum((long) row)
|
||||
// .guid(guid)
|
||||
// .itemId(attrMap.get("item_meta_id").toString())
|
||||
// .itemName(metaDataHandler.getTextStringData(item_nm))
|
||||
// .status(ItemList.STATUS.PERMITTED)
|
||||
// .restoreType("")
|
||||
// .createBy(item.get("CreatedDateTime").s()).build();
|
||||
//
|
||||
// list.add(itemInfo);
|
||||
//
|
||||
// row++;
|
||||
// }
|
||||
// }
|
||||
// log.info("getItems Response ItemInfo: {}", list);
|
||||
// }
|
||||
// catch (JsonProcessingException jpe){
|
||||
// log.error("getItems JsonProcessingException: {}", jpe.getMessage());
|
||||
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
// }catch (Exception e){
|
||||
// log.error("getItems: {}", e.getMessage());
|
||||
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
// }
|
||||
// return list;
|
||||
// }
|
||||
|
||||
//아이템 - 의상 조회
|
||||
public Map<String, Object> getCloth(String guid){
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
@@ -868,184 +692,25 @@ public class DynamoDBService {
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
//아이템 - 인벤토리 조회
|
||||
public UsersResponse.InventoryInfo getInvenItems(String guid){
|
||||
String key = "PK = :pkValue";
|
||||
Map<String, AttributeValue> values = Map.of(":pkValue", AttributeValue.builder().s("item#"+guid).build());
|
||||
|
||||
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<>();
|
||||
|
||||
try {
|
||||
excuteItems(executeQuery(key, values), "ItemAttrib")
|
||||
.filter(attrMap -> attrMap.containsKey("equiped_inven_type") && (int) attrMap.get("equiped_inven_type") == 0)
|
||||
.forEach(attrMap -> {
|
||||
int item_id = (int) attrMap.get("item_meta_id");
|
||||
String item_nm = metaDataHandler.getTextStringData(metaDataHandler.getMetaItemNameData(item_id));
|
||||
String item_type = metaDataHandler.getMetaItemLargeTypeData(item_id);
|
||||
|
||||
UsersResponse.Item inventory = UsersResponse.Item.builder()
|
||||
.itemId(item_id)
|
||||
.itemName(item_nm)
|
||||
.count(CommonUtils.objectToInteger(attrMap.get("item_stack_count")))
|
||||
.itemGuid(CommonUtils.objectToString(attrMap.get("item_guid")))
|
||||
.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);
|
||||
}}
|
||||
});
|
||||
|
||||
log.info("getInvenItems Response cloth: {}, prop: {}, beauty: {}, tattoo: {}, currency: {}, etc: {}", clothList, propList, beautyList, tattooList, currencyList, etcList);
|
||||
|
||||
return UsersResponse.InventoryInfo.builder()
|
||||
.cloth(clothList)
|
||||
.prop(propList)
|
||||
.beauty(beautyList)
|
||||
.tattoo(tattooList)
|
||||
.currency(currencyList)
|
||||
.etc(etcList)
|
||||
.build();
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("getInvenItems: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 유저 조회 - 우편 삭제
|
||||
public String deleteMail(String type, String guid, String mail_guid) {
|
||||
Map<String, AttributeValue> itemAttributes = new HashMap<>();
|
||||
if(type.equals("SEND")){
|
||||
itemAttributes.put("PK", AttributeValue.builder().s("sent_mail#" + guid).build());
|
||||
}else{
|
||||
itemAttributes.put("PK", AttributeValue.builder().s("recv_mail#" + guid).build());
|
||||
}
|
||||
itemAttributes.put("SK", AttributeValue.builder().s(mail_guid).build());
|
||||
try {
|
||||
Map<String, AttributeValue> item = null;
|
||||
if(type.equals("SEND")){
|
||||
item = getItem("sent_mail#" + guid, mail_guid);
|
||||
log.info("deleteMail PK: {}, SK: {}", "sent_mail#" + guid, mail_guid);
|
||||
}else{
|
||||
item = getItem("recv_mail#" + guid, mail_guid);
|
||||
log.info("deleteMail PK: {}, SK: {}", "recv_mail#" + guid, mail_guid);
|
||||
}
|
||||
|
||||
DeleteItemRequest request = DeleteItemRequest.builder()
|
||||
.tableName(metaTable)
|
||||
.key(itemAttributes)
|
||||
.build();
|
||||
|
||||
DeleteItemResponse response = dynamoDbClient.deleteItem(request);
|
||||
|
||||
if(response.sdkHttpResponse().isSuccessful())
|
||||
return item.toString();
|
||||
|
||||
return "";
|
||||
}catch (ConditionalCheckFailedException e) {
|
||||
log.error("deleteUsersMail Conditional check failed: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
}catch(Exception e){
|
||||
log.error("deleteUsersMail: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 유저 조회 - 우편 아이템 삭제
|
||||
public JSONObject updateMailItem(String type, String guid, String mail_guid, Long itemId, double count, double newCount) {
|
||||
try {
|
||||
Map<String, AttributeValue> item = null;
|
||||
Map<String, AttributeValue> key = new HashMap<>();
|
||||
if(type.equals("SEND")){
|
||||
item = getItem("sent_mail#" + guid, mail_guid);
|
||||
key = Map.of("PK", AttributeValue.builder().s("sent_mail#" + guid).build(),"SK", AttributeValue.builder().s(mail_guid).build());
|
||||
}else{
|
||||
item = getItem("recv_mail#" + guid, mail_guid);
|
||||
key = Map.of("PK", AttributeValue.builder().s("recv_mail#" + guid).build(),"SK", AttributeValue.builder().s(mail_guid).build());
|
||||
}
|
||||
|
||||
String InfoJson = item.get("MailAttrib").s();
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
JsonNode infoNode = objectMapper.readTree(InfoJson);
|
||||
log.info("updateMailItem Before updatedInfoJson: {}", infoNode.toString());
|
||||
|
||||
ArrayNode itemListNode = (ArrayNode) infoNode.get("item_list");
|
||||
|
||||
// Java 17 스타일의 IntStream을 사용하여 itemId를 찾고 처리
|
||||
OptionalInt indexOpt = IntStream.range(0, itemListNode.size())
|
||||
.filter(i -> itemListNode.get(i).get("ItemId").asInt() == itemId)
|
||||
.findFirst();
|
||||
|
||||
if (indexOpt.isEmpty()) {
|
||||
log.error("updateMailItem mail item not found");
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
}
|
||||
|
||||
int index = indexOpt.getAsInt();
|
||||
JsonNode itemNode = itemListNode.get(index);
|
||||
|
||||
if (count > newCount) {
|
||||
// count 수정
|
||||
((ObjectNode) itemNode).put("Count", count - newCount);
|
||||
} else {
|
||||
// item 삭제
|
||||
itemListNode.remove(index);
|
||||
}
|
||||
|
||||
String updatedInfoJson = infoNode.toString();
|
||||
log.info("updateMailItem Tobe updatedInfoJson: {}", updatedInfoJson);
|
||||
|
||||
Map<String, AttributeValue> expressionAttributeValues = new HashMap<>();
|
||||
expressionAttributeValues.put(":newAttrib", AttributeValue.builder().s(updatedInfoJson).build());
|
||||
|
||||
String updateExpression = "SET MailAttrib = :newAttrib";
|
||||
|
||||
UpdateItemRequest updateRequest = UpdateItemRequest.builder()
|
||||
.tableName(metaTable)
|
||||
.key(key)
|
||||
.updateExpression(updateExpression)
|
||||
.expressionAttributeValues(expressionAttributeValues)
|
||||
.returnValues(ReturnValue.ALL_NEW) // 업데이트 후의 값을 반환하려면 지정
|
||||
.build();
|
||||
|
||||
|
||||
dynamoDbClient.updateItem(updateRequest);
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("data(before)", InfoJson);
|
||||
jsonObject.put("data(after)", updatedInfoJson);
|
||||
return jsonObject;
|
||||
}catch (ConditionalCheckFailedException e) {
|
||||
log.error("deleteUsersMail Conditional check failed: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
}catch(Exception e){
|
||||
log.error("deleteUsersMail: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 아이템 삭제
|
||||
// public String deleteItem(String guid, String item_guid) {
|
||||
// public String deleteMail(String type, String guid, String mail_guid) {
|
||||
// Map<String, AttributeValue> itemAttributes = new HashMap<>();
|
||||
// itemAttributes.put("PK", AttributeValue.builder().s("item#" + guid).build());
|
||||
// itemAttributes.put("SK", AttributeValue.builder().s(item_guid).build());
|
||||
// if(type.equals("SEND")){
|
||||
// itemAttributes.put("PK", AttributeValue.builder().s("sent_mail#" + guid).build());
|
||||
// }else{
|
||||
// itemAttributes.put("PK", AttributeValue.builder().s("recv_mail#" + guid).build());
|
||||
// }
|
||||
// itemAttributes.put("SK", AttributeValue.builder().s(mail_guid).build());
|
||||
// try {
|
||||
// Map<String, AttributeValue> item = getItem("item#" + guid, item_guid);
|
||||
// log.info("deleteItem PK: {}, SK: {}", "item#" + guid, item_guid);
|
||||
// Map<String, AttributeValue> item = null;
|
||||
// if(type.equals("SEND")){
|
||||
// item = getItem("sent_mail#" + guid, mail_guid);
|
||||
// log.info("deleteMail PK: {}, SK: {}", "sent_mail#" + guid, mail_guid);
|
||||
// }else{
|
||||
// item = getItem("recv_mail#" + guid, mail_guid);
|
||||
// log.info("deleteMail PK: {}, SK: {}", "recv_mail#" + guid, mail_guid);
|
||||
// }
|
||||
//
|
||||
// DeleteItemRequest request = DeleteItemRequest.builder()
|
||||
// .tableName(metaTable)
|
||||
@@ -1059,41 +724,67 @@ public class DynamoDBService {
|
||||
//
|
||||
// return "";
|
||||
// }catch (ConditionalCheckFailedException e) {
|
||||
// log.error("deleteItem Conditional check failed: {}", e.getMessage());
|
||||
// log.error("deleteUsersMail Conditional check failed: {}", e.getMessage());
|
||||
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
// }catch(Exception e){
|
||||
// log.error("deleteItem: {}", e.getMessage());
|
||||
// log.error("deleteUsersMail: {}", e.getMessage());
|
||||
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
// }
|
||||
// }
|
||||
|
||||
// 아이템 정보 수정
|
||||
// public JSONObject updateItem(String guid, String item_guid, int cnt) {
|
||||
// try{
|
||||
// 유저 조회 - 우편 아이템 삭제
|
||||
// public JSONObject updateMailItem(String type, String guid, String mail_guid, Long itemId, double count, double newCount) {
|
||||
// try {
|
||||
// Map<String, AttributeValue> item = null;
|
||||
// Map<String, AttributeValue> key = new HashMap<>();
|
||||
// if(type.equals("SEND")){
|
||||
// item = getItem("sent_mail#" + guid, mail_guid);
|
||||
// key = Map.of("PK", AttributeValue.builder().s("sent_mail#" + guid).build(),"SK", AttributeValue.builder().s(mail_guid).build());
|
||||
// }else{
|
||||
// item = getItem("recv_mail#" + guid, mail_guid);
|
||||
// key = Map.of("PK", AttributeValue.builder().s("recv_mail#" + guid).build(),"SK", AttributeValue.builder().s(mail_guid).build());
|
||||
// }
|
||||
//
|
||||
// Map<String, AttributeValue> item = getItem("item#" + guid, item_guid);
|
||||
//
|
||||
// String InfoJson = item.get("ItemAttrib").s();
|
||||
// String InfoJson = item.get("MailAttrib").s();
|
||||
//
|
||||
// ObjectMapper objectMapper = new ObjectMapper();
|
||||
// JsonNode infoNode = objectMapper.readTree(InfoJson);
|
||||
// log.info("updateItem Before UpdateInfo : {}", infoNode.toString());
|
||||
// log.info("updateMailItem Before updatedInfoJson: {}", infoNode.toString());
|
||||
//
|
||||
// ((ObjectNode) infoNode).put("item_stack_count", cnt);
|
||||
// ArrayNode itemListNode = (ArrayNode) infoNode.get("item_list");
|
||||
//
|
||||
// // Java 17 스타일의 IntStream을 사용하여 itemId를 찾고 처리
|
||||
// OptionalInt indexOpt = IntStream.range(0, itemListNode.size())
|
||||
// .filter(i -> itemListNode.get(i).get("ItemId").asInt() == itemId)
|
||||
// .findFirst();
|
||||
//
|
||||
// if (indexOpt.isEmpty()) {
|
||||
// log.error("updateMailItem mail item not found");
|
||||
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
// }
|
||||
//
|
||||
// int index = indexOpt.getAsInt();
|
||||
// JsonNode itemNode = itemListNode.get(index);
|
||||
//
|
||||
// if (count > newCount) {
|
||||
// // count 수정
|
||||
// ((ObjectNode) itemNode).put("Count", count - newCount);
|
||||
// } else {
|
||||
// // item 삭제
|
||||
// itemListNode.remove(index);
|
||||
// }
|
||||
//
|
||||
// String updatedInfoJson = infoNode.toString();
|
||||
// log.info("updateItem Tobe UpdateInfo : {}", updatedInfoJson);
|
||||
// log.info("updateMailItem Tobe updatedInfoJson: {}", updatedInfoJson);
|
||||
//
|
||||
// Map<String, AttributeValue> expressionAttributeValues = new HashMap<>();
|
||||
// expressionAttributeValues.put(":newAttrib", AttributeValue.builder().s(updatedInfoJson).build());
|
||||
//
|
||||
// String updateExpression = "SET ItemAttrib = :newAttrib";
|
||||
// String updateExpression = "SET MailAttrib = :newAttrib";
|
||||
//
|
||||
// UpdateItemRequest updateRequest = UpdateItemRequest.builder()
|
||||
// .tableName(metaTable)
|
||||
// .key(Map.of(
|
||||
// "PK", AttributeValue.builder().s("item#" + guid).build(),
|
||||
// "SK", AttributeValue.builder().s(item_guid).build()))
|
||||
// .key(key)
|
||||
// .updateExpression(updateExpression)
|
||||
// .expressionAttributeValues(expressionAttributeValues)
|
||||
// .returnValues(ReturnValue.ALL_NEW) // 업데이트 후의 값을 반환하려면 지정
|
||||
@@ -1106,9 +797,12 @@ public class DynamoDBService {
|
||||
// jsonObject.put("data(before)", InfoJson);
|
||||
// jsonObject.put("data(after)", updatedInfoJson);
|
||||
// return jsonObject;
|
||||
// }catch (ConditionalCheckFailedException e) {
|
||||
// log.error("deleteUsersMail Conditional check failed: {}", e.getMessage());
|
||||
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
// }catch(Exception e){
|
||||
// log.error("updateItem: {}", e.getMessage());
|
||||
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage() );
|
||||
// log.error("deleteUsersMail: {}", e.getMessage());
|
||||
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
@@ -5,14 +5,14 @@ import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
|
||||
import com.caliverse.admin.domain.entity.*;
|
||||
import com.caliverse.admin.domain.request.EventRequest;
|
||||
import com.caliverse.admin.domain.response.EventResponse;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbMailService;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbService;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.history.service.MysqlHistoryLogService;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.json.JSONObject;
|
||||
@@ -30,6 +30,7 @@ import java.util.Map;
|
||||
public class EventService {
|
||||
private final DynamoDBService dynamoDBService;
|
||||
private final DynamodbService dynamodbService;
|
||||
private final DynamodbMailService dynamodbMailService;
|
||||
|
||||
private final EventMapper eventMapper;
|
||||
private final MetaDataHandler metaDataHandler;
|
||||
@@ -120,23 +121,12 @@ public class EventService {
|
||||
Event event = eventMapper.getEventDetail(event_id);
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.EVENT_ADD,
|
||||
HISTORYTYPEDETAIL.EVENT_ADD,
|
||||
MysqlConstants.TABLE_NAME_EVENT,
|
||||
HISTORYTYPE.EVENT_ADD.name(),
|
||||
event,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.EVENT_ADD.name(),
|
||||
event
|
||||
);
|
||||
|
||||
|
||||
//로그 기록
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("type",eventRequest.getEventType());
|
||||
jsonObject.put("start_dt",eventRequest.getStartDt());
|
||||
jsonObject.put("end_dt",eventRequest.getEndDt());
|
||||
jsonObject.put("mail_list",map);
|
||||
historyService.setLog(HISTORYTYPE.EVENT_ADD, jsonObject);
|
||||
|
||||
return EventResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
@@ -197,61 +187,13 @@ public class EventService {
|
||||
after_event.setItemList(eventMapper.getItem(event_id));
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.EVENT_UPDATE,
|
||||
HISTORYTYPEDETAIL.EVENT_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_EVENT,
|
||||
HISTORYTYPE.EVENT_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.EVENT_UPDATE.name(),
|
||||
before_info,
|
||||
after_event,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
after_event
|
||||
);
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
// if(result == 1){
|
||||
// ObjectMapper objectMapper = new ObjectMapper();
|
||||
// ArrayNode mailTitleArray = objectMapper.createArrayNode();
|
||||
// ArrayNode mailTextArray = objectMapper.createArrayNode();
|
||||
// ArrayNode mailItemArray = objectMapper.createArrayNode();
|
||||
// for(Item item : eventRequest.getItemList()){
|
||||
// MailItem mailItem = MailItem.newBuilder().setItemId(CommonUtils.stringToInt(item.getItem())).setCount(item.getItemCnt()).build();
|
||||
// mailItemArray.add(JsonUtils.createMAilItem(mailItem));
|
||||
// }
|
||||
// for(Message msg: eventRequest.getMailList()){
|
||||
// String langText = msg.getLanguage();
|
||||
// int lang;
|
||||
//
|
||||
// if(langText.equals(LANGUAGETYPE.EN.toString())){
|
||||
// lang = LanguageType.LanguageType_en.getNumber();
|
||||
// }else if(langText.equals(LANGUAGETYPE.JA.toString())){
|
||||
// lang = LanguageType.LanguageType_ja.getNumber();
|
||||
// }else{
|
||||
// lang = LanguageType.LanguageType_ko.getNumber();
|
||||
// }
|
||||
// SystemMessage titleMessage = SystemMessage.builder().LanguageType(lang).Text(msg.getTitle()).build();
|
||||
// SystemMessage textMessage = SystemMessage.builder().LanguageType(lang).Text(msg.getContent()).build();
|
||||
//
|
||||
// mailTitleArray.add(JsonUtils.createSystemMessage(titleMessage));
|
||||
// mailTextArray.add(JsonUtils.createSystemMessage(textMessage));
|
||||
// }
|
||||
//
|
||||
// String dynamoResult = dynamoDBService.updateSystemMail(
|
||||
// event_id.toString(),
|
||||
// mailTitleArray,
|
||||
// mailTextArray,
|
||||
// eventRequest.getStartDt(),
|
||||
// eventRequest.getEndDt(),
|
||||
// mailItemArray);
|
||||
// jsonObject.put("dynamoDB_update",dynamoResult);
|
||||
// log.info("updateEvent DynamoDB Update Complete: {}", dynamoResult);
|
||||
// }
|
||||
|
||||
//로그 기록
|
||||
jsonObject.put("before_event",before_info.toString());
|
||||
jsonObject.put("type",eventRequest.getEventType());
|
||||
jsonObject.put("start_dt",eventRequest.getStartDt());
|
||||
jsonObject.put("end_dt",eventRequest.getEndDt());
|
||||
historyService.setLog(HISTORYTYPE.EVENT_UPDATE, jsonObject);
|
||||
|
||||
return EventResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
@@ -278,12 +220,10 @@ public class EventService {
|
||||
log.info("updateEvent AdminTool Delete Complete: {}", eventRequest);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.EVENT_DELETE,
|
||||
HISTORYTYPEDETAIL.EVENT_DELETE,
|
||||
MysqlConstants.TABLE_NAME_EVENT,
|
||||
HISTORYTYPE.EVENT_DELETE.name(),
|
||||
event,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.EVENT_DELETE.name(),
|
||||
event
|
||||
);
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
@@ -298,7 +238,7 @@ public class EventService {
|
||||
if(!message.isEmpty()){
|
||||
jsonObject.put("message",message.get(0).getTitle());
|
||||
}
|
||||
historyService.setLog(HISTORYTYPE.EVENT_DELETE, jsonObject);
|
||||
historyService.setLog(HISTORYTYPEDETAIL.EVENT_DELETE, jsonObject);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -365,7 +305,7 @@ public class EventService {
|
||||
event.setMailList(eventMapper.getMessage(event_id));
|
||||
event.setItemList(eventMapper.getItem(event_id));
|
||||
|
||||
dynamodbService.insertSystemMail(event);
|
||||
dynamodbMailService.insertSystemMail(event);
|
||||
|
||||
eventMapper.updateAddFlag(event_id);
|
||||
updateEventStatus(event_id, Event.EVENTSTATUS.RUNNING);
|
||||
|
||||
@@ -137,7 +137,7 @@ public class GroupService {
|
||||
map.put("adminId", CommonUtils.getAdmin().getId());
|
||||
map.put("name", CommonUtils.getAdmin().getName());
|
||||
map.put("mail", CommonUtils.getAdmin().getEmail());
|
||||
map.put("type", HISTORYTYPE.GROUP_AUTH_UPDATE);
|
||||
map.put("type", HISTORYTYPEDETAIL.GROUP_AUTH_UPDATE);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("groupNm",groupMapper.getGroupInfo(Long.valueOf(groupId)).get("name"));
|
||||
jsonObject.put("auth(before)",beforeAuth);
|
||||
@@ -168,7 +168,7 @@ public class GroupService {
|
||||
map.put("adminId", CommonUtils.getAdmin().getId());
|
||||
map.put("name", CommonUtils.getAdmin().getName());
|
||||
map.put("mail", CommonUtils.getAdmin().getEmail());
|
||||
map.put("type", HISTORYTYPE.GROUP_DELETE);
|
||||
map.put("type", HISTORYTYPEDETAIL.GROUP_DELETE);
|
||||
map.put("content",jsonObject.toString());
|
||||
historyMapper.saveLog(map);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
package com.caliverse.admin.domain.service;
|
||||
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPE;
|
||||
import com.caliverse.admin.domain.entity.Log;
|
||||
import com.caliverse.admin.domain.dao.admin.AdminMapper;
|
||||
import com.caliverse.admin.domain.entity.Admin;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.domain.dao.admin.HistoryMapper;
|
||||
import com.caliverse.admin.domain.request.HistoryRequest;
|
||||
import com.caliverse.admin.domain.response.HistoryResponse;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
|
||||
import io.jsonwebtoken.io.IOException;
|
||||
import com.caliverse.admin.global.common.utils.DateUtils;
|
||||
import com.caliverse.admin.mongodb.domain.HistoryLogInfoBase;
|
||||
import com.caliverse.admin.mongodb.service.HistoryLogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -15,42 +20,84 @@ import org.apache.commons.io.FileUtils;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class HistoryService {
|
||||
|
||||
private final AdminMapper adminMapper;
|
||||
private final HistoryMapper historyMapper;
|
||||
private final HistoryLogService historyLogService;
|
||||
|
||||
public HistoryResponse getHistoryList(Map requestParams){
|
||||
|
||||
//페이징 처리
|
||||
requestParams = CommonUtils.pageSetting(requestParams);
|
||||
String searchType = requestParams.get("searchType").toString();
|
||||
String searchData = requestParams.get("searchData").toString();
|
||||
HISTORYTYPEDETAIL historyType = requestParams.get("historyType").equals("") ? null : HISTORYTYPEDETAIL.valueOf(requestParams.get("historyType").toString());
|
||||
LocalDateTime startDt = requestParams.get("startDate").equals("") ? null : DateUtils.stringISOToLocalDateTime(requestParams.get("startDate").toString());
|
||||
LocalDateTime endDt = requestParams.get("endDate").equals("") ? null : DateUtils.stringISOToLocalDateTime(requestParams.get("endDate").toString());
|
||||
|
||||
List<Log> historyList = historyMapper.getHistoryList(requestParams);
|
||||
// List<Log> historyList = historyMapper.getHistoryList(requestParams);
|
||||
|
||||
HistoryRequest historyRequest = new HistoryRequest();
|
||||
historyRequest.setHistoryType(historyType);
|
||||
historyRequest.setStartDt(startDt);
|
||||
historyRequest.setEndDt(endDt);
|
||||
if(searchType.equals("NAME")){
|
||||
Optional<Admin> admin = adminMapper.findByEmail(searchData);
|
||||
if(admin.isPresent()){
|
||||
historyRequest.setUserMail(searchData);
|
||||
}else{
|
||||
return HistoryResponse.builder()
|
||||
.resultData(HistoryResponse.ResultData.builder()
|
||||
.message(ErrorCode.NOT_USER.toString())
|
||||
.build())
|
||||
.status(CommonCode.ERROR.getHttpStatus())
|
||||
.result(CommonCode.ERROR.getResult())
|
||||
.build();
|
||||
}
|
||||
}else{
|
||||
historyRequest.setUserMail(searchData);
|
||||
}
|
||||
|
||||
List<HistoryLogInfoBase> historyList = historyLogService.loadHistoryData(historyRequest, HistoryLogInfoBase.class);
|
||||
|
||||
int allCnt = historyMapper.getAllCnt(requestParams);
|
||||
|
||||
return HistoryResponse.builder()
|
||||
.resultData(HistoryResponse.ResultData.builder()
|
||||
.total(historyMapper.getTotal())
|
||||
.totalAll(allCnt)
|
||||
.pageNo(requestParams.get("page_no")!=null?
|
||||
Integer.valueOf(requestParams.get("page_no").toString()):1)
|
||||
.list(historyList).build())
|
||||
.list(historyList)
|
||||
.build())
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
.build();
|
||||
}
|
||||
|
||||
public HistoryResponse getHistory(HistoryRequest historyRequest){
|
||||
|
||||
List<HistoryLogInfoBase> historyList = historyLogService.loadHistoryData(historyRequest, HistoryLogInfoBase.class);
|
||||
|
||||
return HistoryResponse.builder()
|
||||
.resultData(HistoryResponse.ResultData.builder()
|
||||
.list(historyList)
|
||||
.build())
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
.build();
|
||||
}
|
||||
|
||||
public HistoryResponse getHistoryDetail(String id){
|
||||
String logJson = historyMapper.getLogJson(id);
|
||||
return HistoryResponse.builder()
|
||||
@@ -100,7 +147,7 @@ public class HistoryService {
|
||||
}
|
||||
}
|
||||
|
||||
public void setLog(HISTORYTYPE type, JSONObject content){
|
||||
public void setLog(HISTORYTYPEDETAIL type, JSONObject content){
|
||||
//로그 기록
|
||||
Map<String, Object> logMap = new HashMap<>();
|
||||
logMap.put("adminId", CommonUtils.getAdmin().getId());
|
||||
@@ -111,7 +158,7 @@ public class HistoryService {
|
||||
historyMapper.saveLog(logMap);
|
||||
}
|
||||
|
||||
public void setScheduleLog(HISTORYTYPE type, String message){
|
||||
public void setScheduleLog(HISTORYTYPEDETAIL type, String message){
|
||||
//스케줄 로그 기록
|
||||
Map<String, Object> logMap = new HashMap<>();
|
||||
logMap.put("adminId", 1);
|
||||
|
||||
@@ -68,7 +68,7 @@ public class ItemsService {
|
||||
ItemsResponse.Item item = ItemsResponse.Item.builder()
|
||||
.userGuid(finalGuid)
|
||||
.itemGuid(attrib.getItemGuid())
|
||||
.id(itemId)
|
||||
.id(attrib.getItemGuid())
|
||||
.itemId(itemId)
|
||||
.itemName(metaDataHandler.getTextStringData(metaDataHandler.getMetaItemNameData(itemId)))
|
||||
.count(attrib.getItemStackCount())
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.caliverse.admin.global.common.constants.CommonConstants;
|
||||
import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.global.common.utils.DateUtils;
|
||||
import com.caliverse.admin.history.service.MysqlHistoryLogService;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -417,12 +417,10 @@ public class LandService {
|
||||
auction_info.setMessageList(landMapper.getMessage(auction_id));
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.LAND_AUCTION_ADD,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_ADD,
|
||||
MysqlConstants.TABLE_NAME_LAND_AUCTION,
|
||||
HISTORYTYPE.LAND_AUCTION_ADD.name(),
|
||||
auction_info,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_ADD.name(),
|
||||
auction_info
|
||||
);
|
||||
|
||||
dynamodbLandAuctionService.insertLandAuctionRegistryWithActivity(landRequest);
|
||||
@@ -485,12 +483,10 @@ public class LandService {
|
||||
LandOwnerChange info = landMapper.getLandOwnerChangeDetail(id);
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_ADD,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD,
|
||||
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_ADD.name(),
|
||||
info,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD.name(),
|
||||
info
|
||||
);
|
||||
|
||||
// if(!is_reserve){
|
||||
@@ -547,16 +543,14 @@ public class LandService {
|
||||
// log.info("AdminToolDB Message Update Complete");
|
||||
|
||||
LandAuction after_info = landMapper.getLandAuctionDetail(id);
|
||||
after_info.setMessageList(landMapper.getMessage(id));
|
||||
// after_info.setMessageList(landMapper.getMessage(id));
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.LAND_AUCTION_UPDATE,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_LAND_AUCTION,
|
||||
HISTORYTYPE.LAND_AUCTION_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE.name(),
|
||||
before_info,
|
||||
after_info,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
after_info
|
||||
);
|
||||
|
||||
dynamodbLandAuctionService.updateLandAuction(landRequest);
|
||||
@@ -587,13 +581,11 @@ public class LandService {
|
||||
LandOwnerChange after_info = landMapper.getLandOwnerChangeDetail(id);
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
|
||||
before_info,
|
||||
after_info,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
after_info
|
||||
);
|
||||
|
||||
dynamodbLandService.ChangesLandOwner(landRequest);
|
||||
@@ -628,12 +620,10 @@ public class LandService {
|
||||
log.info("LandAuction Delete Complete: {}", item);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.LAND_AUCTION_DELETE,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_DELETE,
|
||||
MysqlConstants.TABLE_NAME_LAND_AUCTION,
|
||||
HISTORYTYPE.LAND_AUCTION_DELETE.name(),
|
||||
auction_info,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_DELETE.name(),
|
||||
auction_info
|
||||
);
|
||||
|
||||
dynamodbLandAuctionService.cancelLandAuction(auction_info);
|
||||
@@ -647,7 +637,7 @@ public class LandService {
|
||||
}
|
||||
jsonObject.put("auction_info", auction_info);
|
||||
// jsonObject.put("dynamoDB_result",land_auction_registry_result);
|
||||
historyService.setLog(HISTORYTYPE.LAND_AUCTION_DELETE, jsonObject);
|
||||
historyService.setLog(HISTORYTYPEDETAIL.LAND_AUCTION_DELETE, jsonObject);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -686,12 +676,10 @@ public class LandService {
|
||||
log.info("LandOwnerChanges Delete Complete: {}", landRequest);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_DELETE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_DELETE,
|
||||
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_DELETE.name(),
|
||||
info,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_DELETE.name(),
|
||||
info
|
||||
);
|
||||
|
||||
return LandResponse.builder()
|
||||
|
||||
@@ -41,7 +41,13 @@ public class LogService {
|
||||
.status(CommonCode.ERROR.getHttpStatus())
|
||||
.result(ErrorCode.ERROR_LOG_MEMORY_LIMIT.toString())
|
||||
.build();
|
||||
} else {
|
||||
} else if (e.getMessage().contains("time limit")) {
|
||||
log.error("MongoDB Query operation exceeded time limit: {}", e.getMessage());
|
||||
return LogResponse.builder()
|
||||
.status(CommonCode.ERROR.getHttpStatus())
|
||||
.result(ErrorCode.ERROR_LOG_MEMORY_LIMIT.toString())
|
||||
.build();
|
||||
}else {
|
||||
log.error("MongoDB Query error", e);
|
||||
return LogResponse.builder()
|
||||
.status(CommonCode.ERROR.getHttpStatus())
|
||||
|
||||
@@ -13,13 +13,14 @@ import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
import com.caliverse.admin.global.common.constants.CommonConstants;
|
||||
import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.global.common.utils.ExcelUtils;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import com.caliverse.admin.scheduler.ScheduleService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.UrlResource;
|
||||
@@ -53,6 +54,7 @@ public class MailService {
|
||||
private final ScheduleService scheduleService;
|
||||
private final HistoryService historyService;
|
||||
private final DynamodbCaliumService dynamodbCaliumService;
|
||||
private final MysqlHistoryLogService mysqlHistoryLogService;
|
||||
|
||||
public MailResponse getStockCalium(){
|
||||
double stock_calium = dynamodbCaliumService.getCaliumTotal();
|
||||
@@ -153,7 +155,7 @@ public class MailService {
|
||||
public Resource excelDown(String fileName) {
|
||||
Path filePath = Path.of(excelPath+fileName);
|
||||
try {
|
||||
if(fileName.contains("sample")){
|
||||
if(fileName.contains("_sample")){
|
||||
return resourceLoader.getResource(samplePath + fileName);
|
||||
}
|
||||
Resource resource = new UrlResource(filePath.toUri());
|
||||
@@ -180,16 +182,15 @@ public class MailService {
|
||||
|
||||
//단일일경우 guid 를 target 설정, 복수이면은 fileName을 target에 설정
|
||||
if(mailRequest.getGuid() != null){
|
||||
if(mailRequest.getUserType().equals(Mail.USERTYPE.GUID) && dynamoDBService.isGuidChecked(mailRequest.getGuid())){
|
||||
if(mailRequest.getUserType().equals(Mail.USERTYPE.GUID) && !dynamodbUserService.isUser(mailRequest.getGuid())){
|
||||
log.error("postMail RECEIVETYPE Single Guid Find Fail");
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.WARNING_GUID_CHECK.getMessage());
|
||||
}
|
||||
String guid = mailRequest.getGuid();
|
||||
// 닉네임이면 guid로 바꾼다
|
||||
if(mailRequest.getUserType().equals(Mail.USERTYPE.NICKNAME)) {
|
||||
// guid = dynamoDBService.getNickNameByGuid(guid);
|
||||
guid = getGuid(guid, Mail.USERTYPE.NICKNAME.name());
|
||||
if(guid == null || mailRequest.getGuid().equals(guid)){
|
||||
if(guid == null || guid.isEmpty() || mailRequest.getGuid().equals(guid)){
|
||||
log.error("postMail RECEIVETYPE Single Nickname Find Fail");
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NICKNAME_CHECK.getMessage() );
|
||||
}
|
||||
@@ -213,7 +214,7 @@ public class MailService {
|
||||
for(Excel excel : excelList){
|
||||
switch (excel.getType()) {
|
||||
case "GUID" -> {
|
||||
if (dynamoDBService.isGuidChecked(excel.getUser())) {
|
||||
if (!dynamodbUserService.isUser(excel.getUser())) {
|
||||
log.error("postMail Multi Guid({}) Find Fail", excel.getUser());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.WARNING_GUID_CHECK.toString());
|
||||
}
|
||||
@@ -241,7 +242,6 @@ public class MailService {
|
||||
|
||||
mailMapper.postMail(mailRequest);
|
||||
|
||||
//log.info("mail_id::"+ mailRequest.getId());
|
||||
HashMap<String,String> map = new HashMap<>();
|
||||
map.put("mailId",String.valueOf(mailRequest.getId()));
|
||||
|
||||
@@ -289,16 +289,16 @@ public class MailService {
|
||||
}
|
||||
log.info("postMail Insert Mail: {}", mailRequest);
|
||||
|
||||
//로그 기록
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("mail_type",mailRequest.getMailType());
|
||||
jsonObject.put("receiver",mailRequest.getTarget());
|
||||
Mail.SENDTYPE sendType = mailRequest.getSendType();
|
||||
jsonObject.put("send_type",sendType);
|
||||
if(sendType.equals(Mail.SENDTYPE.RESERVE_SEND))
|
||||
jsonObject.put("send_dt",mailRequest.getSendDt());
|
||||
jsonObject.put("mail_list",map);
|
||||
historyService.setLog(HISTORYTYPE.MAIL_ADD, jsonObject);
|
||||
Mail info = mailMapper.getMailDetail(mailRequest.getId());
|
||||
info.setMailList(mailMapper.getMessage(mailRequest.getId()));
|
||||
info.setItemList(mailMapper.getItem(mailRequest.getId()));
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.MAIL_ADD,
|
||||
MysqlConstants.TABLE_NAME_MAIL,
|
||||
HISTORYTYPEDETAIL.MAIL_ADD.name(),
|
||||
info
|
||||
);
|
||||
|
||||
return MailResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
@@ -339,10 +339,10 @@ public class MailService {
|
||||
|
||||
Long mail_id = mailRequest.getId();
|
||||
Mail before_info = mailMapper.getMailDetail(mail_id);
|
||||
List<Message> before_msg = mailMapper.getMessage(mail_id);
|
||||
List<Item> before_item = mailMapper.getItem(mail_id);
|
||||
before_info.setMailList(mailMapper.getMessage(mail_id));
|
||||
before_info.setItemList(mailMapper.getItem(mail_id));
|
||||
|
||||
log.info("updateMail Update Before MailInfo: {}, Message: {}, Item: {}", before_info, before_msg, before_item);
|
||||
log.info("updateMail Update Before MailInfo: {}", before_info);
|
||||
|
||||
mailMapper.updateMail(mailRequest);
|
||||
|
||||
@@ -380,18 +380,28 @@ public class MailService {
|
||||
}
|
||||
log.info("updateMail Update After Mail: {}", mailRequest);
|
||||
|
||||
Mail after_info = mailMapper.getMailDetail(mail_id);
|
||||
after_info.setMailList(mailMapper.getMessage(mail_id));
|
||||
after_info.setItemList(mailMapper.getItem(mail_id));
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.MAIL_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_MAIL,
|
||||
HISTORYTYPEDETAIL.MAIL_UPDATE.name(),
|
||||
before_info,
|
||||
after_info
|
||||
);
|
||||
|
||||
//로그 기록
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("before_info",before_info.toString());
|
||||
jsonObject.put("before_msg",before_msg.toString());
|
||||
jsonObject.put("before_item",before_item.toString());
|
||||
jsonObject.put("mail_type",mailRequest.getMailType());
|
||||
jsonObject.put("receiver",mailRequest.getTarget());
|
||||
Mail.SENDTYPE sendType = mailRequest.getSendType();
|
||||
jsonObject.put("send_type",sendType);
|
||||
if(sendType.equals(Mail.SENDTYPE.RESERVE_SEND))
|
||||
jsonObject.put("send_dt",mailRequest.getSendDt());
|
||||
historyService.setLog(HISTORYTYPE.MAIL_UPDATE, jsonObject);
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// jsonObject.put("before_info",before_info.toString());
|
||||
// jsonObject.put("mail_type",mailRequest.getMailType());
|
||||
// jsonObject.put("receiver",mailRequest.getTarget());
|
||||
// Mail.SENDTYPE sendType = mailRequest.getSendType();
|
||||
// jsonObject.put("send_type",sendType);
|
||||
// if(sendType.equals(Mail.SENDTYPE.RESERVE_SEND))
|
||||
// jsonObject.put("send_dt",mailRequest.getSendDt());
|
||||
// historyService.setLog(HISTORYTYPE.MAIL_UPDATE, jsonObject);
|
||||
|
||||
return MailResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
@@ -408,25 +418,36 @@ public class MailService {
|
||||
|
||||
mailRequest.getList().forEach(
|
||||
item->{
|
||||
map.put("id",item.getId());
|
||||
long id = item.getId();
|
||||
|
||||
Mail info = mailMapper.getMailDetail(id);
|
||||
|
||||
map.put("id",id);
|
||||
mailMapper.deleteMail(map);
|
||||
|
||||
// 스케줄에서 제거
|
||||
scheduleService.closeTask("mail-" + item.getId());
|
||||
log.info("deleteMail Mail: {}", item);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.MAIL_DELETE,
|
||||
MysqlConstants.TABLE_NAME_MAIL,
|
||||
HISTORYTYPEDETAIL.MAIL_DELETE.name(),
|
||||
info
|
||||
);
|
||||
|
||||
//로그 기록
|
||||
List<Message> message = mailMapper.getMessage(Long.valueOf(item.getId()));
|
||||
map.put("adminId", CommonUtils.getAdmin().getId());
|
||||
map.put("name", CommonUtils.getAdmin().getName());
|
||||
map.put("mail", CommonUtils.getAdmin().getEmail());
|
||||
map.put("type", HISTORYTYPE.MAIL_DELETE);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
if(!message.isEmpty()){
|
||||
jsonObject.put("message",message.get(0).getTitle());
|
||||
}
|
||||
map.put("content",jsonObject.toString());
|
||||
historyMapper.saveLog(map);
|
||||
// List<Message> message = mailMapper.getMessage(Long.valueOf(item.getId()));
|
||||
// map.put("adminId", CommonUtils.getAdmin().getId());
|
||||
// map.put("name", CommonUtils.getAdmin().getName());
|
||||
// map.put("mail", CommonUtils.getAdmin().getEmail());
|
||||
// map.put("type", HISTORYTYPE.MAIL_DELETE);
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// if(!message.isEmpty()){
|
||||
// jsonObject.put("message",message.get(0).getTitle());
|
||||
// }
|
||||
// map.put("content",jsonObject.toString());
|
||||
// historyMapper.saveLog(map);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -495,7 +516,7 @@ public class MailService {
|
||||
return target;
|
||||
}
|
||||
|
||||
public void setScheduleLog(HISTORYTYPE type, String message){
|
||||
public void setScheduleLog(HISTORYTYPEDETAIL type, String message){
|
||||
//스케줄 로그 기록
|
||||
historyService.setScheduleLog(type, message);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.global.common.utils.FileUtils;
|
||||
import com.caliverse.admin.history.service.MysqlHistoryLogService;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -198,12 +198,10 @@ public class MenuService {
|
||||
MenuBanner banner = menuMapper.getBannerDetail(menuRequest.getId());
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.MENU_BANNER_ADD,
|
||||
HISTORYTYPEDETAIL.MENU_BANNER_ADD,
|
||||
MysqlConstants.TABLE_NAME_MENU_BANNER,
|
||||
HISTORYTYPE.MENU_BANNER_ADD.name(),
|
||||
banner,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.MENU_BANNER_ADD.name(),
|
||||
banner
|
||||
);
|
||||
|
||||
return MenuResponse.builder()
|
||||
@@ -252,13 +250,11 @@ public class MenuService {
|
||||
after_info.setImageList(menuMapper.getMessage(banner_id));
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.MENU_BANNER_UPDATE,
|
||||
HISTORYTYPEDETAIL.MENU_BANNER_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_MENU_BANNER,
|
||||
HISTORYTYPE.MENU_BANNER_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.MENU_BANNER_UPDATE.name(),
|
||||
before_info,
|
||||
after_info,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
after_info
|
||||
);
|
||||
|
||||
return MenuResponse.builder()
|
||||
|
||||
@@ -2,14 +2,16 @@ package com.caliverse.admin.domain.service;
|
||||
|
||||
import com.caliverse.admin.domain.dao.admin.HistoryMapper;
|
||||
import com.caliverse.admin.domain.dao.admin.NoticeMapper;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPE;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.domain.entity.InGame;
|
||||
import com.caliverse.admin.domain.entity.Message;
|
||||
import com.caliverse.admin.domain.request.NoticeRequest;
|
||||
import com.caliverse.admin.domain.response.NoticeResponse;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import com.caliverse.admin.scheduler.ScheduleService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -31,6 +33,7 @@ public class NoticeService {
|
||||
private final HistoryMapper historyMapper;
|
||||
private final ScheduleService scheduleService;
|
||||
private final HistoryService historyService;
|
||||
private final MysqlHistoryLogService mysqlHistoryLogService;
|
||||
|
||||
public NoticeResponse getNoticeList(){
|
||||
|
||||
@@ -95,16 +98,23 @@ public class NoticeService {
|
||||
}
|
||||
log.info("postInGameMessage notice: {}", noticeRequest);
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.NOTICE_ADD,
|
||||
MysqlConstants.TABLE_NAME_NOTICE,
|
||||
HISTORYTYPEDETAIL.NOTICE_ADD.name(),
|
||||
noticeMapper.getNoticeDetail(noticeRequest.getId())
|
||||
);
|
||||
|
||||
//로그 기록
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("message_type",noticeRequest.getMessageType());
|
||||
jsonObject.put("repeat_type",noticeRequest.getRepeatType());
|
||||
jsonObject.put("repeat_cnt",noticeRequest.getRepeatCnt());
|
||||
jsonObject.put("repeat_dt",noticeRequest.getRepeatDt());
|
||||
jsonObject.put("send_dt",noticeRequest.getSendDt());
|
||||
jsonObject.put("end_dt",noticeRequest.getEndDt());
|
||||
jsonObject.put("message",noticeRequest.getGameMessages().toString());
|
||||
historyService.setLog(HISTORYTYPE.NOTICE_ADD, jsonObject);
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// jsonObject.put("message_type",noticeRequest.getMessageType());
|
||||
// jsonObject.put("repeat_type",noticeRequest.getRepeatType());
|
||||
// jsonObject.put("repeat_cnt",noticeRequest.getRepeatCnt());
|
||||
// jsonObject.put("repeat_dt",noticeRequest.getRepeatDt());
|
||||
// jsonObject.put("send_dt",noticeRequest.getSendDt());
|
||||
// jsonObject.put("end_dt",noticeRequest.getEndDt());
|
||||
// jsonObject.put("message",noticeRequest.getGameMessages().toString());
|
||||
// historyService.setLog(HISTORYTYPE.NOTICE_ADD, jsonObject);
|
||||
|
||||
return NoticeResponse.builder()
|
||||
.resultData(NoticeResponse.ResultData.builder().message(SuccessCode.REGISTRATION.getMessage()).build())
|
||||
@@ -117,6 +127,9 @@ public class NoticeService {
|
||||
public NoticeResponse updateInGameMessage(Long id, NoticeRequest noticeRequest){
|
||||
noticeRequest.setId(id);
|
||||
noticeRequest.setUpdateBy(CommonUtils.getAdmin().getId());
|
||||
|
||||
InGame before_info = noticeMapper.getNoticeDetail(id);
|
||||
|
||||
int i = noticeMapper.updateNotice(noticeRequest);
|
||||
// 스케줄에서 기존 등록 제거
|
||||
scheduleService.closeTask(noticeRequest.getId().toString());
|
||||
@@ -144,6 +157,14 @@ public class NoticeService {
|
||||
}
|
||||
}
|
||||
log.info("updateInGameMessage After notice: {}", noticeRequest);
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.NOTICE_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_NOTICE,
|
||||
HISTORYTYPEDETAIL.NOTICE_UPDATE.name(),
|
||||
before_info,
|
||||
noticeMapper.getNoticeDetail(id)
|
||||
);
|
||||
return NoticeResponse.builder()
|
||||
.resultData(NoticeResponse.ResultData.builder().message(SuccessCode.UPDATE.getMessage()).build())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
@@ -168,15 +189,22 @@ public class NoticeService {
|
||||
|
||||
log.info("deleteInGameMessage notice: {}", item);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.NOTICE_DELETE,
|
||||
MysqlConstants.TABLE_NAME_NOTICE,
|
||||
HISTORYTYPEDETAIL.NOTICE_DELETE.name(),
|
||||
noticeMapper.getNoticeDetail(item.getMessageId())
|
||||
);
|
||||
|
||||
//로그 기록
|
||||
map.put("adminId", CommonUtils.getAdmin().getId());
|
||||
map.put("name", CommonUtils.getAdmin().getName());
|
||||
map.put("mail", CommonUtils.getAdmin().getEmail());
|
||||
map.put("type", HISTORYTYPE.NOTICE_DELETE);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("message",message);
|
||||
map.put("content",jsonObject.toString());
|
||||
historyMapper.saveLog(map);
|
||||
// map.put("adminId", CommonUtils.getAdmin().getId());
|
||||
// map.put("name", CommonUtils.getAdmin().getName());
|
||||
// map.put("mail", CommonUtils.getAdmin().getEmail());
|
||||
// map.put("type", HISTORYTYPE.NOTICE_DELETE);
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// jsonObject.put("message",message);
|
||||
// map.put("content",jsonObject.toString());
|
||||
// historyMapper.saveLog(map);
|
||||
}
|
||||
);
|
||||
log.info("deleteInGameMessage notice: {}", noticeRequest);
|
||||
@@ -206,7 +234,7 @@ public class NoticeService {
|
||||
noticeMapper.updateCountNotice(id);
|
||||
}
|
||||
|
||||
public void setScheduleLog(HISTORYTYPE type, String message){
|
||||
public void setScheduleLog(HISTORYTYPEDETAIL type, String message){
|
||||
//스케줄 로그 기록
|
||||
Map<String, Object> logMap = new HashMap<>();
|
||||
logMap.put("adminId", 1);
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.caliverse.admin.domain.entity.FriendRequest;
|
||||
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.dynamodb.domain.atrrib.AccountBaseAttrib;
|
||||
@@ -18,17 +17,14 @@ 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.DynamodbItemService;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbMailService;
|
||||
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;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
|
||||
@@ -55,6 +51,7 @@ public class UsersService {
|
||||
private final RedisUserInfoService redisUserInfoService;
|
||||
private final DynamodbUserService dynamodbUserService;
|
||||
private final DynamodbItemService dynamodbItemService;
|
||||
private final DynamodbMailService dynamodbMailService;
|
||||
|
||||
@Autowired
|
||||
private MetaDataHandler metaDataHandler;
|
||||
@@ -154,6 +151,7 @@ public class UsersService {
|
||||
.build();
|
||||
}
|
||||
|
||||
//유저 기본 정보
|
||||
public UsersResponse getBasicInfo(String guid){
|
||||
|
||||
String account_id = dynamodbUserService.getGuidByAccountId(guid);
|
||||
@@ -200,6 +198,7 @@ public class UsersService {
|
||||
|
||||
}
|
||||
|
||||
//아바타 정보
|
||||
public UsersResponse getAvatarInfo(String guid){
|
||||
|
||||
//avatarInfo
|
||||
@@ -217,10 +216,8 @@ public class UsersService {
|
||||
|
||||
}
|
||||
|
||||
//의상 정보
|
||||
public UsersResponse getClothInfo(String guid){
|
||||
|
||||
//clothInfo
|
||||
// Map<String, Object> charInfo = dynamoDBService.getClothInfo(guid);
|
||||
Map<String, Object> charInfo = dynamoDBService.getCloth(guid);
|
||||
|
||||
return UsersResponse.builder()
|
||||
@@ -235,10 +232,8 @@ public class UsersService {
|
||||
|
||||
}
|
||||
|
||||
//도구 정보
|
||||
public UsersResponse getToolSlotInfo(String guid){
|
||||
|
||||
// toolslotInfo
|
||||
// List<UsersResponse.SlotInfo> toolSlot = dynamoDBService.getToolSlot(guid);
|
||||
Map<String, Object> toolSlot = dynamoDBService.getTools(guid);
|
||||
|
||||
return UsersResponse.builder()
|
||||
@@ -252,33 +247,9 @@ public class UsersService {
|
||||
.build();
|
||||
|
||||
}
|
||||
public UsersResponse getInventoryInfo(String guid){
|
||||
|
||||
// List<List<UsersResponse.Inventory>> inventoryList = new ArrayList<>();
|
||||
// List<List<String>> item = dynamoDBService.getInvenItems(guid);
|
||||
// if(item != null){
|
||||
// for (List<String> list : item){
|
||||
// List<UsersResponse.Inventory> innerList = new ArrayList<>();
|
||||
// for (String key : list){
|
||||
// Map<String, Object> resItem = dynamoDBService.getItemTable(key);
|
||||
//
|
||||
// //객체를 생성하고 값을 설정
|
||||
// UsersResponse.Inventory inventory = new UsersResponse.Inventory();
|
||||
//
|
||||
// Object itemId = resItem.get("ItemId");
|
||||
// String itemIdString = CommonUtils.objectToString(itemId);
|
||||
// Integer itemIdInteger = CommonUtils.objectToInteger(itemId);
|
||||
//
|
||||
//
|
||||
// inventory.setCount(Integer.valueOf(CommonUtils.objectToString(resItem.get("Count"))));
|
||||
// inventory.setItemId(itemIdString);
|
||||
// inventory.setItemName(metaDataHandler.getMetaItemData(itemIdInteger).getName());
|
||||
// innerList.add(inventory);
|
||||
// }
|
||||
// inventoryList.add(innerList);
|
||||
// }
|
||||
// }
|
||||
// UsersResponse.InventoryInfo inventoryInfo = dynamoDBService.getInvenItems(guid);
|
||||
//인벤토리 정보
|
||||
public UsersResponse getInventoryInfo(String guid){
|
||||
UsersResponse.InventoryInfo inventoryInfo = dynamodbItemService.getInvenItems(guid);
|
||||
logger.info("getInventoryInfo Inventory Items: {}", inventoryInfo);
|
||||
|
||||
@@ -294,6 +265,7 @@ public class UsersService {
|
||||
|
||||
}
|
||||
|
||||
//인벤토리 아이템 삭제
|
||||
public UsersResponse deleteInventoryItem(Map<String, String> requestParams){
|
||||
String guid = requestParams.get("guid");
|
||||
String item_guid = requestParams.get("item_guid");
|
||||
@@ -302,12 +274,6 @@ public class UsersService {
|
||||
|
||||
userGameSessionService.kickUserSession(guid, "Item delete");
|
||||
if(update_cnt >= current_cnt){
|
||||
// String attrib = dynamoDBService.deleteItem(guid, item_guid);
|
||||
// if(!attrib.isEmpty()){
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// jsonObject.put("data",attrib);
|
||||
// historyService.setLog(HISTORYTYPE.INVENTORY_ITEM_DELETE, jsonObject);
|
||||
// }
|
||||
dynamodbItemService.deleteItem(guid, item_guid);
|
||||
return UsersResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
@@ -319,10 +285,6 @@ public class UsersService {
|
||||
}else{
|
||||
int cnt = current_cnt - update_cnt;
|
||||
dynamodbItemService.updateItemStack(guid, item_guid, cnt);
|
||||
// JSONObject json = dynamoDBService.updateItem(guid, item_guid, cnt);
|
||||
// if(!json.isEmpty()){
|
||||
// historyService.setLog(HISTORYTYPE.INVENTORY_ITEM_UPDATE, json);
|
||||
// }
|
||||
return UsersResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
@@ -333,18 +295,17 @@ public class UsersService {
|
||||
}
|
||||
}
|
||||
|
||||
//우편 정보
|
||||
public UsersResponse getMail(UsersRequest usersRequest){
|
||||
// List<UsersResponse.Mail> mailList = dynamoDBService.getMail(guid, type);
|
||||
PageResult<MailDoc> mailPageResult = dynamodbService.getMail(usersRequest.getMailType(), usersRequest.getGuid(), "", usersRequest.getPageKey());
|
||||
PageResult<MailDoc> mailPageResult = dynamodbMailService.getMail(usersRequest.getMailType(), usersRequest.getGuid(), "", usersRequest.getPageKey());
|
||||
List<UsersResponse.Mail> mailList = new ArrayList<>();
|
||||
|
||||
mailPageResult.getItems().forEach(doc -> {
|
||||
try {
|
||||
// MailAttrib attrib = objectMapper.readValue(doc.getAttribValue(), MailAttrib.class);
|
||||
MailAttrib attrib = doc.getAttribValue();
|
||||
List<UsersResponse.MailItem> itemList = new ArrayList<>();
|
||||
if(attrib == null){
|
||||
MailJsonAttrib mailJsonAttrib = dynamodbService.getMailJsonAttrib(doc.getPK(),doc.getSK());
|
||||
MailJsonAttrib mailJsonAttrib = dynamodbMailService.getMailJsonAttrib(doc.getPK(),doc.getSK());
|
||||
mailJsonAttrib.getItemList().forEach(item -> {
|
||||
UsersResponse.MailItem mailItem = new UsersResponse.MailItem();
|
||||
mailItem.setItemId(CommonUtils.objectToString(item.getItemId()));
|
||||
@@ -416,18 +377,14 @@ public class UsersService {
|
||||
|
||||
}
|
||||
|
||||
//우편 삭제
|
||||
public UsersResponse deleteMail(Map<String, String> requestParams){
|
||||
String guid = requestParams.get("guid");
|
||||
String mail_guid = requestParams.get("mail_guid");
|
||||
String type = requestParams.get("type");
|
||||
|
||||
userGameSessionService.kickUserSession(guid, "delete mail");
|
||||
String attrib = dynamoDBService.deleteMail(type, guid, mail_guid);
|
||||
if(!attrib.isEmpty()){
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("data",attrib);
|
||||
historyService.setLog(HISTORYTYPE.USER_MAIL_DELETE, jsonObject);
|
||||
}
|
||||
dynamodbMailService.deleteMail(type, guid, mail_guid);
|
||||
|
||||
return UsersResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
@@ -438,13 +395,12 @@ public class UsersService {
|
||||
.build();
|
||||
}
|
||||
|
||||
//우편 아이템 삭제
|
||||
public UsersResponse deleteMailItem(MailRequest.DeleteMailItem deleteMailItem){
|
||||
userGameSessionService.kickUserSession(deleteMailItem.getGuid(), "delete mail item");
|
||||
JSONObject json = dynamoDBService.updateMailItem(deleteMailItem.getType(), deleteMailItem.getGuid(),
|
||||
dynamodbMailService.deleteMailItem(deleteMailItem.getType(), deleteMailItem.getGuid(),
|
||||
deleteMailItem.getMailGuid(), deleteMailItem.getItemId(), deleteMailItem.getParrentCount(), deleteMailItem.getCount());
|
||||
if(!json.isEmpty()){
|
||||
historyService.setLog(HISTORYTYPE.MAIL_ITEM_UPDATE, json);
|
||||
}
|
||||
|
||||
return UsersResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
@@ -454,6 +410,7 @@ public class UsersService {
|
||||
.build();
|
||||
}
|
||||
|
||||
//마이홈 정보
|
||||
public UsersResponse getMyhome(String guid){
|
||||
|
||||
UsersResponse.Myhome myhome = dynamoDBService.getMyhome(guid);
|
||||
@@ -470,6 +427,7 @@ public class UsersService {
|
||||
|
||||
}
|
||||
|
||||
//친구 목록
|
||||
public UsersResponse getFriendList(String guid){
|
||||
|
||||
List<UsersResponse.Friend> friendList = dynamoDBService.getFriendList(guid);
|
||||
@@ -518,6 +476,7 @@ public class UsersService {
|
||||
.build();
|
||||
}
|
||||
|
||||
//타투 정보
|
||||
public UsersResponse getTattoo(String guid){
|
||||
List<UsersResponse.Tattoo> resTatto = dynamoDBService.getTattoo(guid);
|
||||
|
||||
@@ -533,29 +492,8 @@ public class UsersService {
|
||||
|
||||
}
|
||||
|
||||
//퀘스트 정보
|
||||
public UsersResponse getQuest(String guid){
|
||||
// UsersResponse.Quest quest = new UsersResponse.Quest();
|
||||
//
|
||||
// List<UsersResponse.Quest> questListQuest = new ArrayList<>();
|
||||
//
|
||||
// Map<String, List<Map<String, Object>>> resMap= dynamoDBService.getQuest(guid);
|
||||
//
|
||||
// //List<Map<String, Object>> endList = resMap.get("EndList");
|
||||
// List<Map<String, Object>> questList = resMap.get("QuestList");
|
||||
//
|
||||
// int index = 1;
|
||||
// if(questList != null){
|
||||
// for (Map<String,Object> val : questList){
|
||||
// if(val != null){
|
||||
// quest = new UsersResponse.Quest();
|
||||
// quest.setQuestId(Integer.valueOf(CommonUtils.objectToString(val.get("QuestId"))));
|
||||
// quest.setStatus(CommonUtils.objectToString(val.get("IsComplete")));
|
||||
// quest.setRowNum((long)index);
|
||||
// questListQuest.add(quest);
|
||||
// index++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
List<UsersResponse.QuestInfo> questList = dynamoDBService.getQuest(guid);
|
||||
|
||||
@@ -570,20 +508,5 @@ public class UsersService {
|
||||
.build();
|
||||
|
||||
}
|
||||
/*public UsersResponse getClaim(String guid){
|
||||
|
||||
List<UsersResponse.Guid> tattoo = dynamoDBService.getTattoo(guid);
|
||||
|
||||
return UsersResponse.builder()
|
||||
.resultData(
|
||||
UsersResponse.ResultData.builder()
|
||||
.tattooList(tattoo)
|
||||
.build()
|
||||
)
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
.build();
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user